-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runtime errors on fa526 (arm4tl): res != DUK_TVAL_GET_NUMBER(tv) (duk_hobject_props.c:2628) #127
Comments
If you didn't already have it defined, could you check what happens with |
Another thing you could try (to help in diagnosis) is |
It seems the execution log is no different: Compiled with:
Allocation log: Execution log without assertions:
|
The target has an ancient uClibc (9.26), here is the uClibc_config.h Unfortunately I can't upgrade the uClibc easily. |
I'd also suspect the issue is related to IEEE double handling - but the known cases are caught by the self tests (e.g. clang/llvm union aliasing issue with -m32). It might also be that Duktape ends up determining endianness incorrectly. On that front:
|
The define dump has:
With these Duktape should end up thinking the platform is mixed endian (little endian 64-bit integers but mixed endian IEEE doubles), i.e. same as Just to make sure, could you compile https://github.com/svaarala/duktape/blob/master/util/check_align.c and run the following:
|
check_align:
The compiler I use is a selfbuild The builtin defines are quite short, maybe that's a helpful clue?
|
Quite an interesting situation, but I'm sure we can figure it out :-) Did you try the Also if you could dump the very verbose debug logs ( |
Here is the really verbose 7.2MB log: |
Here is the execution log from the ancient but working gcc-2.95.3 compiler version: They don't match very well after the self-tests, the good log is only 4MB large.
The good one shows 4% load, the bad one shows 2147483647% load. |
Also the bad one has lots of occurences of dragon4 (from duk_numconv.c) while the good one has not one. |
That load debug is printed by:
There are other |
The Dragon4 difference is probable due to this double-to-string fast path check:
I'm guessing the same cast issues cause this fast path to missed in the "bad" case, which results in Duktape going through the much more complicated (and verbose) slow path. |
I think I've found the underlying problem: the unsigned int to float conversion is broken in my compiler. The internal libgcc function Here's a little test program:
With the custom
Without it the output is:
The failure might be associated with this gcc-bug, where I also got the Thank you very much for your support! |
Great :) Did you figure out how to fix it? I'll add cast tests to the self test set, because there are now at least 3 cases where they have been broken. It's often fixable but it's hard to pin down so it'd be nice to self test for. |
For our application I see the following options:
An self test is easy enough and seems like a good idea because this took lots of time to pin down, like you said. |
Another approach: Duktape does a double-to-integer and integer-to-double cast in a reasonable amount of places so it'd also be possible to make those casts explicit through macros. This would allow the casts used by Duktape to be reimplemented to avoid problems in the compiler environment. Another dependency Duktape has is a sprintf() with working |
You've gone a long way with supporting a lot of different host/target configurations. |
One counterargument to fixing this by avoiding such casts in Duktape is that other code (such as existing Duktape/C binding code) might still break due to problematic casts. But if one is writing all the C code from scratch and can deal with compiler deficiencies it certainly is feasible. I've had to work with closed toolchains with similar issues, e.g. one has working double-to-integer casts up to 32-bit range but beyond 32 bits the cast results start to go wrong. In that particular case it was possible to just avoid the offending casts. Anyway, it'd be interesting to hear if you can resolve this on the compiler end somehow, because people might encounter similar problems. |
@jbysewski Any updates on this issue re: compiler configuration? :) |
It seems the compiler is a bit weird, but I had no time rebuilding the compiler suite and playing with the different soft/hard-float options gcc has available. Currently we're running with the |
Good to hear - I'll close this issue because there's no clear Duktape change (except the added self test). |
I was able to compile duktape to run on the fa526 (arm4tl) processor in a MOXA UC7101 device.
With debug logging and assertions enabled I see, that it is able to create the heap and run an gc.
To rule out my own application which runs fine under generic linux x86 and OS X hosts, I reproduced the error with the cmdline example: duk.
It boils down to:
Compiler defines:
http://pastebin.com/H7dKiLrM
duk execution log:
http://pastebin.com/rV7i9cYQ
The text was updated successfully, but these errors were encountered: