Mirror of the LuaJIT git repository
Go to file
Peter Cawley 33ee12a91b Have lj_ir_kptr_ accept pointers in [0, 4G) rather than [-2G, 2G)
The assertion logic is the only thing actually changing within
`lj_ir_kptr_`: the existing `mref` / `setmref` invocations already deal in
zero-extended pointers rather than sign-extended pointers.

Perhaps surprisingly, the logic around continuation pointers is changing.
To appreciate why, the following cryptic comment from vm_x86.dasc comes
into play:
```
  |->cont_dispatch:
...
  |  movsxd RAa, dword [RB-16]  // May be negative on WIN64 with debug.
```
Namely, when using MSVC in debug mode, function symbols with external
linkage are subject to extra jump stubs in order to support incremental
linking. For example, these jump stubs might look like:
```
...
lj_bcwrite:
07FFC47A5EF23  jmp         lj_bcwrite (07FFC47AB5750h)
lj_cont_ra:
07FFC47A5EF28  jmp         lj_cont_ra (07FFC47A6230Dh)
lj_ir_call:
07FFC47A5EF2D  jmp         lj_ir_call (07FFC47AF6310h)
lj_cconv_tv_bf:
07FFC47A5EF32  jmp         lj_cconv_tv_bf (07FFC47AC1EA0h)
...
```
When continutation pointers are formed, it is e.g. 07FFC47A5EF28 rather
than 07FFC47A6230 from which lj_vm_asm_begin gets subtracted, and it can
be the case that 07FFC47A5EF28 is less than lj_vm_asm_begin. Consequently,
this could previously result in continuation pointers in range [-2G, 0).
(The eagle-eyed reader might think that lj_vm_asm_begin is also a function
symbol with external linkage, but buildvm is careful to define it as a
data symbol rather than a function symbol).

This change was actually motivated by an assertion failure in WIN64 debug
mode (wherein `snap_replay_const` does `lj_ir_kptr(J, ir_kptr(ir))`, as
`ir_kptr` performs zero-extension, and then `lj_ir_kptr` would barf), but
given the recent block allocator change to support the [0, 4G) address
range on (non-x64) 64-bit platforms, the change seems prudent for other
reasons too.
2016-04-23 23:13:37 +01:00
doc Merge branch 'master' into v2.1 2016-03-22 22:22:51 +01:00
dynasm DynASM/x86: Add ADX instructions. 2016-03-06 12:25:03 +01:00
etc RELEASE LuaJIT-2.1.0-beta2 2016-03-03 12:40:02 +01:00
src Have lj_ir_kptr_ accept pointers in [0, 4G) rather than [-2G, 2G) 2016-04-23 23:13:37 +01:00
.gitignore RELEASE LuaJIT-2.0.0-beta1 2009-12-08 19:46:35 +01:00
COPYRIGHT Bump copyright date to 2016. 2016-03-03 12:02:22 +01:00
Makefile Merge branch 'master' into v2.1 2016-03-22 22:22:51 +01:00
README RELEASE LuaJIT-2.1.0-beta2 2016-03-03 12:40:02 +01:00

README for LuaJIT 2.1.0-beta2
-----------------------------

LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.

Project Homepage: http://luajit.org/

LuaJIT is Copyright (C) 2005-2016 Mike Pall.
LuaJIT is free software, released under the MIT license.
See full Copyright Notice in the COPYRIGHT file or in luajit.h.

Documentation for LuaJIT is available in HTML format.
Please point your favorite browser to:

 doc/luajit.html