[Ecls-list] [emscripten] exception in cs_set_size (when executing cl-boot)

Rujia Liu 2575127 at qq.com
Fri Mar 20 16:37:33 UTC 2015


Dear all,

Now that I've successfully compiled ECL with empscripten after quite a few tweaking in code and config. However, it crashes:

>node a.out.js
Calling stub instead of signal()
Calling stub instead of signal()
Calling stub instead of signal()
Calling stub instead of signal()
Calling stub instead of signal()
Calling stub instead of signal()
Calling stub instead of signal()

Internal or unrecoverable error in:
can't reset env->cs_limit.
Calling stub instead of signal()

d:\ecl-em\msvc\bclink\a.out.js:84
      throw ex;
            ^
abort() at Error
    at jsStackTrace (d:\ecl-em\msvc\bclink\a.out.js:987:13)
    at stackTrace (d:\ecl-em\msvc\bclink\a.out.js:1004:22)
    at Object.abort (d:\ecl-em\msvc\bclink\a.out.js:227043:25)
    at _abort (d:\ecl-em\msvc\bclink\a.out.js:6686:22)
    at _ecl_internal_error (d:\ecl-em\msvc\bclink\a.out.js:106763:3)
    at _cs_set_size (d:\ecl-em\msvc\bclink\a.out.js:189770:3)
    at _ecl_cs_set_org (d:\ecl-em\msvc\bclink\a.out.js:139536:2)
    at _cl_boot (d:\ecl-em\msvc\bclink\a.out.js:51609:2)
    at _main (d:\ecl-em\msvc\bclink\a.out.js:51142:3)
    at Object.asm._main (d:\ecl-em\msvc\bclink\a.out.js:225080:19)‍

The crashing function is:

static void
cs_set_size(cl_env_ptr env, cl_index new_size)
{
    volatile char foo = 0;
    cl_index safety_area = ecl_option_values[ECL_OPT_C_STACK_SAFETY_AREA];
    new_size += 2*safety_area;
#ifdef ECL_DOWN_STACK
    if (&foo > env->cs_org - new_size + 16) {
        env->cs_limit = env->cs_org - new_size + 2*safety_area;
        if (env->cs_limit < env->cs_barrier)
            env->cs_barrier = env->cs_limit;
    }
#else
    if (&foo < env->cs_org + new_size - 16) {
        env->cs_limit = env->cs_org + new_size - 2*safety_area;
        if (env->cs_limit > env->cs_barrier)
            env->cs_barrier = env->cs_limit;
    }
#endif
    else
        ecl_internal_error("can't reset env->cs_limit.");
    env->cs_size = new_size;
}
‍
I didn't change ECL_DOWN_STACK‍ in config.h so it remains 1.

Any thoughts about this? More information:

1.  I disabled FFI (by commenting out ECL_FFI‍), will it affact anything? I think FFI does not make sense with emscripten so I disabled it.
2. "Calling stub instead of signal()‍" is printed from the sub implementation of signal(), provided by empscriten, like this:

>grep "Calling stub" *.js -A 2 -B 2

  function ___libc_current_sigrtmax() {
      Module.printErr('Calling stub instead of __libc_current_sigrtmax');
      return 0;
    }
--

  function _signal(sig, func) {
      Module.printErr('Calling stub instead of signal()');
      return 0;
    }
--

  function _raise(sig) {
      Module.printErr('Calling stub instead of raise()');
    ___setErrNo(ERRNO_CODES.ENOSYS);
        Runtime.warnOnce('raise() returning an error as we do not support it');
--

  function ___libc_current_sigrtmin() {
      Module.printErr('Calling stub instead of __libc_current_sigrtmin');
      return 0;
    }‍

Thanks!

- Rujia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20150321/2ed359fb/attachment.html>


More information about the ecl-devel mailing list