• The forum software that supports hummy.tv has been upgraded to XenForo 2.3!

    Please bear with us as we continue to tweak things, and feel free to post any questions, issues or suggestions in the upgrade thread.

[quickjs] A JS interpreter for the Humax Fox-T2 platform (is it possible?)

/df

Well-Known Member
Stumbling block seems to be it needs a C compiler with c11 support and we only have a (cross-)compiler that does c99 (bypassing fenv.h and then falling over on stdatomic.h).

The good news is that there's basically just the one file with 60k lines of C.

The bad news is that there's basically just the one file with 60k lines of C.

I love that Bellard can keep this entire thing in his head -- or is it just easier to search in a single file ...?

With some borrowing (hacking the .h into the qjs directory for now)
-std-gnu99 gets us a long way with an on--box build:
Code:
# CFLAGS='-I. -std=gnu99' make PREFIX=/mod 

gcc -I. -std=gnu99 -g -Wall -MMD -MF .obj/.d -Wno-array-bounds -Wno-format-truncation -Wno-infinite-recursion -fwrapv  -D_GNU_SOURCE -DCONFIG_VERSION=\"2025-09-13\" -DCONFIG_CHECK_JSVALUE -c -o .obj/quickjs.check.o quickjs.c
quickjs.c: In function 'js_def_malloc_usable_size':
quickjs.c:1720:5: warning: implicit declaration of function 'malloc_usable_size'
quickjs.c: In function 'js_atomics_op':
quickjs.c:58634:1: error: unrecognizable insn:
(insn 646 645 647 48 quickjs.c:58560 (parallel [
            (set (reg:SI 598)
                (mem/v:SI (reg:SI 593) [-1 S4 A32]))
            (set (mem/v:SI (reg:SI 593) [-1 S4 A32])
                (unspec_volatile:SI [
                        (reg:SI 596)
                        (reg:SI 597)
                        (plus:SI (reg:SI 598)
                            (const_int 0 [0x0]))
                    ] 42))
            (clobber (scratch:SI))
        ]) -1 (nil))
quickjs.c:58634:1: internal compiler error: in extract_insn, at recog.c:2103
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [.obj/quickjs.check.o] Error 1
#
malloc_usable_size() is a new (-er than 2011) Linux libc malloc helper function that can probably be shimmed or ignored (eg, if it's just used for heap usage reporting).

The unexpected inline assembly indicates that there is a problem with __sync_val_compare_and_swap() in the on-box gcc. The operation appears to be supported, as in the linked doc, yet the inline assembly that implements it isn't being understood. I fear that a bug report for this compiler version would get short shrift, so more research needed ... Ray Chen made a lengthy set of Old New Thing posts on atomic operations in various instruction architectures (targeting Windows, obvs, but the ideas would apply).

The answer to "is it possible?":
Code:
# nm -D /usr/browser/lib/libopera.so | grep script
00536634 T op_execute_atvef_javascript
00531210 T op_get_scripting_enabled
005367e0 T op_get_scripting_paused
005311c8 T op_set_scripting_disabled
0053684c T op_set_scripting_paused
#
Really the question should have been about an accessible and modern JS interpreter.
 
Last edited:
Back
Top