Open wingo opened 6 years ago
Or heh, it seems it's just that you can't embed loads from immediate 64-bit addresses. Have to load the immediate address into a register with movq (which has special support for 64-bit immediates), then dereference the register; fair enough.
Blocks https://github.com/snabbco/snabb/pull/1264, fix in the works
In Snabb we use DynASM to generate assembly at run-time. One thing that we like to do is to embed references to FFI data structures defined in Lua. For example, consider this test file:
Put that in
test.dasl
. Whenfptr()
is called, it sets the first uint32 in the FFI dataasm_status
. To run in Snabb, from a build directory, do:The test file needs to be run under snabb and not basic raptorjit because it uses the Lua interface to dynasm, which is only built into Snabb at this point.
Anyway making
test.lua
works fine and does the same as upstream Snabb. However running the file doesn't work:The reason is because DynASM currently expects embedded constants to be addressable with 32-bit references. As you can see from the printout,
0x7f1b69e5ff38
is outside the 32-bit address space.In contrast, compare to running the same file with upstream Snabb:
The address is in the lower 32 bits and thus it works.
The difference between RaptorJIT Snabb and upstream Snabb is that RaptorJIT uses GC64. So we need to resolve the incompatibility, allowing RaptorJIT Snabb to use DynASM, by extending RaptorJIT's dynasm.