[Top][All Lists]

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

Preparation for Lightning 2.0.0 release

From: Paulo César Pereira de Andrade
Subject: Preparation for Lightning 2.0.0 release
Date: Wed, 9 Nov 2022 18:22:09 -0300


  An issue was noticed in Apple M1, where Lightning semantics break.

  To attempt to keep the interface as simple as possible, Lightning
implementation did take advantage that all supported environments
did have an ABI where integral arguments are word sized, both if
passed in registers, or if passed in the stack. The same logic was
used for return values. Only float and double had type checking.

  To work correctly, and without limitations on Apple M1, now Lightning
accepts typed arguments. For example:

    arg $a
    arg $b
    getarg_c %r0 $a
    getarg_s %r1 $b
    putargr  %r2 $a
    putargi    3 $a
    retr %r0
    retval_c %r0

did not trigger any errors, as values are truncated and zero or sign
extended by the proper getarg or retval.

  Now there is a new configure option --enable-devel-strong-type-checking
that will enforce the above to be written as:

    arg_c $a
    arg_s $b
    getarg_c  %r0 $a
    getarg_s  %r1 $b
    putargr_c %r2 $a
    putargi_s   3 $a
    retr_c %r0
    retval_c %r0

  Well, not completely, it cannot follow the retr_c vs retval_c as there
is no concept of function prototypes. But the getarg and putarg will
trigger an assertion due to mismatching types.

  Note that --enable-devel-strong-type-checking is only functional if
the --enable-assertions option is also passed to configure.

  The --enable-devel-strong-type-checking basically ensures generated jit
will work in Apple M1, even if you never test in this setup. It is also
not enforced because it could break existing code that implement jit
functions handling non wordsize data types.

  Please experiment a jit checkout and let me know if the changes break
any code you have. It should not break any code that uses the public API,
but there might be special conditions that were not exercised.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]