Re: Solaris/x64 support for LuaJIT

  • From: Mike Pall <mike-1206@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Mon, 25 Jun 2012 22:34:22 +0200

Dmitri Shubin wrote:
> I was able to avoid 2-nd problem by moving executable text and data
> as high as possible (used 0x70280000) and allocating pages with
> mmap(MAP_FIXED) from range 0x10000 to 0x70280000.

MAP_FIXED is problematic: it blindly overwrites existing mappings.
You can't really use that safely, unless you have full control
over every allocation in your process. That's not very useful for
an embeddable component, such as LuaJIT.

> And AFAIU generated code assume that it could jump to some of its
> functions (e.g. lj_vm_exit_handler) using 32-bit displacement which
> isn't true.

There are plenty more places that require the mcode pages to be
close to the library. If there's a way to solve the above problem
without MAP_FIXED, the mcode placement problem can be solved, too.

> Probably there are some other places in luajit that implicitly
> assume that shared libraries are loaded within (1<<47) of address
> space?

Well, there's lightudV() and setlightudV(). But that has more to
do with the possible range of addresses, not the placement of the
code.

--Mike

Other related posts: