feat: implement NaN tagging for Value union and hoist bytecode/IP into locals in interpret loop

Switch Value from a struct with type/num/obj fields to a NaN-tagged uint64_t/double union, enabling faster type checks and unboxed numbers. Refactor all macros and accessors (IS_OBJ, AS_OBJ, AS_NUM, etc.) to work with the new representation. Hoist CallFrame pointer, instruction pointer, and bytecode array into local variables inside the interpret loop, updating them on frame push/pop. Enable NAN_TAGGING define and DEBUG_GC_STRESS in common.h. Update Xcode project to use c99 standard, pedantic warnings, and treat warnings as errors. Add benchmark/fib.txt with timing comparisons showing fib benchmark within 25% of Lua.
This commit is contained in:
Bob Nystrom
2013-11-17 22:20:15 +00:00
parent b3d5f3b4a0
commit 9c663aa13c
6 changed files with 329 additions and 39 deletions
+37
View File
@@ -0,0 +1,37 @@
Value is just Obj* and all values are boxed.
→ time ../build/Release/wren fib.wren
9.22746e+06
real 0m12.688s
user 0m12.076s
sys 0m0.601s
---
Unboxed singletons and numbers. Value is a struct of ValueType, double, Obj* obj.
→ time ../build/Release/wren fib.wren
9.22746e+06
real 0m3.233s
user 0m3.229s
sys 0m0.003s
---
NaN tagged values.
→ time ../build/Release/wren fib.wren
9.22746e+06
real 0m3.100s
user 0m3.097s
sys 0m0.002s
---
Hoist bytecode and IP into locals in interpret loop.
→ time ../build/Release/wren fib.wren
9.22746e+06
real 0m2.490s
user 0m2.487s
sys 0m0.002s