-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Fix #54 misbehaving integers #97
Changes from 3 commits
6272005
5534d35
6bcda76
baebf66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,18 @@ LUA_SRC=$(ls ./lua/*.c | grep -v "luac.c" | grep -v "lua.c" | tr "\n" " ") | |
extension="" | ||
if [ "$1" == "dev" ]; | ||
then | ||
extension="$extension -O0 -g3 -s ASSERTIONS=1 -s SAFE_HEAP=1 -s STACK_OVERFLOW_CHECK=2" | ||
extension="-O0 -g3 -s ASSERTIONS=1 -s SAFE_HEAP=1 -s STACK_OVERFLOW_CHECK=2" | ||
else | ||
extension="$extension -O3 --closure 1" | ||
# ASSERTIONS=1 required with optimisations and strict mode. https://github.com/emscripten-core/emscripten/issues/20721 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually this is a bug on emscripten? Assertions are probably unnecessary and just increase the code size and slow down a little bit. Should have a TODO to remove it later, wdyt? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I can tell it's a bug in emscripten, the one linked. I'd be quite happy if you found time to take a second look though just in case. I'll add that TODO in |
||
extension="-O3 --closure 1 -s ASSERTIONS=1" | ||
fi | ||
|
||
# Instead of telling Lua to be 32 bit for both floats and ints override the default | ||
# int type to 32 bit and leave the float as 64 bits. | ||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
sed -i '' "s/^#define LUA_32BITS\t0$/#define LUA_32BITS\t1/" ./lua/luaconf.h | ||
sed -E -i '' "s/#define LUA_INT_DEFAULT\s+LUA_INT_LONGLONG/#define LUA_INT_DEFAULT \tLUA_INT_INT/" ./lua/luaconf.h | ||
else | ||
sed -i "s/^#define LUA_32BITS\t0$/#define LUA_32BITS\t1/" ./lua/luaconf.h | ||
sed -E -i "s/#define LUA_INT_DEFAULT\s+LUA_INT_LONGLONG/#define LUA_INT_DEFAULT \tLUA_INT_INT/" ./lua/luaconf.h | ||
fi | ||
|
||
emcc \ | ||
|
@@ -44,7 +47,7 @@ emcc \ | |
-s STRICT=1 \ | ||
-s EXPORT_ES6=1 \ | ||
-s NODEJS_CATCH_EXIT=0 \ | ||
-s NODEJS_CATCH_REJECTION=0 \ | ||
-s NODEJS_CATCH_REJECTION=0 \ | ||
-s MALLOC=emmalloc \ | ||
-s STACK_SIZE=1MB \ | ||
-s EXPORTED_FUNCTIONS="[ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While testing this, I made the following update to the if/else block at the bottom to avoid leaving local changes to the lua submodule.: