9 Commits
Author SHA1 Message Date
Will Speak a23b96a45d fix: guard backslash escape advance in REPL lexer to prevent crash at end of input
When the REPL lexer encountered a backslash as the last character of input, it would unconditionally call advance() and consume past the token boundary, producing a token with an invalid length. This caused a crash when the token was later printed. The fix adds an isAtEnd guard before advancing, matching the pattern already used for the percent escape handler.
2018-10-08 06:35:55 +00:00
Will Speak de15c1f14d fix: remove 32-bit macOS build target and update CI to only build 64-bit
Remove the i386 architecture from the libuv xcodebuild command in
util/build_libuv.py to eliminate deprecation warnings from XCode.
Update the Travis CI configuration to drop the ci_32 build target,
leaving only ci_64 for macOS builds. Also add XCBuildData cache
directory to .gitignore.
2018-10-06 08:02:10 +00:00
Will Speak 921aec9ff7 fix: update WrenInterpret calls in embedding docs to include module name argument 2018-10-03 06:39:26 +00:00
Will Speak cb0dcaefc3 fix: correct GC next threshold calculation to prevent infinite GC on 32-bit builds
The previous formula `vm->bytesAllocated * (100 + heapGrowthPercent) / 100` could overflow on 32-bit systems when `bytesAllocated` was large, causing `nextGC` to wrap below the current allocation and trigger endless garbage collection cycles. Changed to `bytesAllocated + (bytesAllocated * heapGrowthPercent / 100)` which avoids the overflow by computing the growth increment separately and adding it to the base allocation.
2016-10-09 16:59:58 +00:00
Will Speak 2d578e0051 feat: add multi-arch CI matrix with nan-tagging toggle and 32-bit test suite
Add Travis CI configuration to build and test Wren on both Linux and macOS, for both 32-bit and 64-bit architectures, with and without WREN_NAN_TAGGING defined. Introduce `ci_32` and `ci_64` make targets that build debug/release and C/C++ variants, then run the test suite against each binary using a suffix parameter. Update `util/test.py` with argparse to accept `--suffix` and `suite` arguments, increase test timeout from 2 to 5 seconds, and fix handle leak in `test/api/slots.c` by moving `wrenReleaseHandle` after the conditional block. Replace `fpclassify`/`signbit` checks for infinity/nan in `wrenNumToString` to avoid GCC overflow warnings on 32-bit, double-cast `double` to `uint32_t` in `num_bitwiseNot` to prevent undefined behavior, and relax floating-point comparisons in `test/core/number/sin.wren` and `cos.wren` to use absolute tolerance. Comment out hex literals larger than `0x1000000` in `example/syntax.wren` since they exceed 32-bit range, and bump libuv from v1.8.0 to v1.10.0 for 32-bit build fixes.
2016-10-09 08:18:27 +00:00
Will Speak ca3cbf9a88 fix: correct GC next threshold calculation to prevent infinite collections on 32-bit builds
The previous formula `vm->bytesAllocated * (100 + heapGrowthPercent) / 100` incorrectly computed the total heap size instead of the additional allocation threshold, causing the GC to trigger endlessly when `bytesAllocated` already exceeded the calculated `nextGC` value. The fix changes the calculation to `bytesAllocated + (bytesAllocated * heapGrowthPercent / 100)`, which properly represents the next collection point as the current allocation plus a growth allowance. This resolves the infinite GC loop observed in `test/language/deeply_nested_gc.wren` on 32-bit architectures.
2016-10-09 16:59:58 +00:00
Will Speak 140fb7738e feat: replace recursive mark with iterative gray/darken GC to prevent stack overflow
The previous recursive `wrenMarkObj` approach could overflow the C stack when marking deeply nested object graphs. This commit introduces an iterative two-phase collector: objects are first "grayed" onto an explicit stack in the WrenVM struct, then `wrenDarkenObjs` iteratively processes the gray stack until all reachable objects are marked as "dark". The `marked` field is renamed to `isDark` to reflect the new semantics. A `gray` array with `grayDepth` and `maxGray` tracking is added to `WrenVM`, initialized in `initializeGC` and freed in `wrenFreeVM`. All internal mark calls (`markClass`, `markClosure`, `markFiber`, `wrenCollectGarbage`) are updated to use `wrenGrayObj` instead of `wrenMarkObj`. Two new test files (`deeply_nested_gc.wren` and `many_reallocations.wren`) verify that deeply nested object graphs and repeated GC cycles complete without stack overflow.
2015-10-19 21:45:15 +00:00
Will Speak 55c21c397d docs: add Will Speak to AUTHORS file with email contact
Append a new contributor entry for Will Speak with their email address
to the project's AUTHORS file, following the existing formatting
convention used for other contributors.
2015-10-18 09:55:34 +00:00
Will Speak 645296cbd8 feat: add \U style 8-hex-digit unicode escape support in string literals
Extend the compiler's string parser to handle `\U` escapes with 8 hex digits
for codepoints above U+FFFF, replacing the previous TODO comment. The
`readUnicodeEscape` helper now accepts a variable digit count (4 or 8) and
the `readString` function dispatches `\u` with length 4 and `\U` with length 8.
New test cases verify correct encoding of emoji and ancient scripts, plus
error handling for incomplete long escapes and values that fit in 4 digits.
2015-10-03 16:28:25 +00:00