lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


LuaJIT supports Solaris/Illumos, with the single caveat that one
cannot use lightuserdata on the stack. While LuaJIT was very
accommodating to changes required to support
Solaris/Illumos, this particular incompatibility is not something that
can be fixed easily:
LuaJIT uses pointer compaction and does not support pointers using high bits.
Illumos and its derivatives use high bits on stack memory: they are
just incompatible!

So, if lpeg wants to support Solaris/Illumus it has to avoid using
lightusedata residing the stack.

Fortunately, the problem very easy to circumvent on the application
side, by making surgical changes that are easy to reason about, as in
the PR.

Best regards,
Heinrich



On Wed, Jun 1, 2016 at 6:52 PM, Owen Shepherd <owen.shepherd@e43.eu> wrote:
> Solaris, unlike every other x86_64 OS, puts application stacks in the top
> half of the address space. LuaJIT is not compatible with this.
>
> This should be fixed in LuaJIT. Unfortunately, making this work involves
> quite a bit of overhead and complexity; I know of several other language
> runtimes which don't support Solaris due to this oddity.
>
>
> On Wed, 1 Jun 2016, 15:23 Daurnimator, <quae@daurnimator.com> wrote:
>>
>> On 2 June 2016 at 00:14, Roberto Ierusalimschy <roberto@inf.puc-rio.br>
>> wrote:
>> >> here is a PR for lpeg that fixes some issues we have had with deploying
>> >> the
>> >> it on Solaris / OmniOS.
>> >> Please consider merging this upstream.
>> >>
>> >> https://github.com/LuaDist/lpeg/pull/1
>> >>
>> >> """
>> >> On operating systems like Solaris and Illumos where the stack grows
>> >> down,
>> >> lightuserdata and user data cannot be assigned from the stack. This
>> >> commit
>> >> patch fixes this behaviour by moving the allocations to the heap (using
>> >> calloc).
>> >
>> > Sorry, but this does not seem to make sense. Of course we can allocate
>> > and use an automatic array in C no matter the direction the stack
>> > grows. Your fix probably only hides the bug, instead of fixing it.
>> >
>> > Do you have a simple example that exercises the bug?
>> >
>> > -- Roberto
>> >
>>
>> Looking at his commit message, it seems to be a luajit bug:
>>
>> > Allocate lightuserdata on the heap.
>> >
>> > Solaris (OmniOS, Illumos) version of luajit does not support support
>> > allocation of lightuserdata on the stack. This gives errors like this:
>> >
>> > ```
>> > $ luajit test.lua
>> > General tests for LPeg library
>> > version 1.0.0
>> > luajit: bad light userdata pointer
>> > stack traceback:
>> >        [C]: in function 'match'
>> >        test.lua:58: in main chunk
>> >        [C]: at 0x00402d50
>> > ```
>> >
>> > This commit patch fixes this behavior by moving the allocations to the
>> > heap.
>>
>> Heinrich, this seems like an issue that should be fixed in luajit, not
>> LPEG.
>> Have you reported the issue there?
>>
>



-- 
Dr. Heinrich Hartmann
Stefan-George Ring 41
81929 München

Mobile: +49 1525 363 8134
Landline: +49 89 95928493
Web: heinrichhartmann.com
Twitter: @HeinrichHartman