* include/lightning.h, include/lightning/jit_private.h,
lib/jit_names.c, lib/lightning.c: Add initial support
for the new jit_va_start, jit_va_arg, jit_va_arg_d, and
jit_va_end interfaces. The jit_va_start call is supposed
to return a va_list compatible pointer, but not yet
decided if it will be "declared" stdarg compatible,
as for now only x86 support has been added (and should
be compatible), but issues may arise on other backends.
* check/lightning.c: Add wrappers to call the new jit_va_*
interfaces.
* lib/jit_x86-cpu.c, lib/jit_x86.c: Implement the new
jit_va_* for x86.
* lib/jit_x86-sz.c: Add fields, but not yet fully updated,
as this is an intermediate commit.
* lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
lib/jit_alpha-sz.c, lib/jit_alpha.c,
lib/jit_arm-sz.c, lib/jit_arm.c,
lib/jit_hppa-sz.c, lib/jit_hppa.c,
lib/jit_ia64-sz.c, lib/jit_ia64.c,
lib/jit_mips-sz.c, lib/jit_mips.c,
lib/jit_ppc-sz.c, lib/jit_ppc.c,
lib/jit_s390-sz.c, lib/jit_s390.c,
lib/jit_sparc-sz.c, lib/jit_sparc.c: Prepare for the
new jit_va_* interfaces. Not yet implemented, and will
cause an assertion if used.
* check/va_list.tst: Simple early test case, that works
on x86_64, x32, ix86, cygwin, and cygwin64.
* include/lightning.h, include/lightning/jit_private.h,
lib/jit_aarch64-cpu.c, lib/jit_aarch64.c,
lib/jit_alpha-cpu.c, lib/jit_alpha.c,
lib/jit_arm-cpu.c, lib/jit_arm.c,
lib/jit_hppa-cpu.c, lib/jit_hppa.c,
lib/jit_ia64-cpu.c, lib/jit_ia64.c,
lib/jit_mips-cpu.c, lib/jit_mips.c,
lib/jit_ppc-cpu.c, lib/jit_ppc.c,
lib/jit_s390-cpu.c, lib/jit_s390.c,
lib/jit_sparc-cpu.c, lib/jit_sparc.c,
lib/jit_x86-cpu.c, lib/jit_x86.c: Implement the new
jit_allocar(offs, size) interface, that receives
two integer registers arguments, allocates space
dynamically in the stack, returns the offset in
the first argument, and uses the second argument
for the size in bytes of the memory to be allocated.
* check/allocar.ok, check/allocar.tst: New files
implementing test cases for the new jit_allocar
interface.
* check/Makefile.am, check/lightning.c: Update for
the new test case and interface.
* doc/body.texi: Add documentation of the new
interface.
* configure.ac, include/lightning/jit_private.h,
lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
lib/jit_disasm.c, lib/jit_hppa.c, lib/jit_ia64.c,
lib/jit_mips.c, lib/jit_ppc.c, lib/jit_print.c,
lib/jit_s390.c, lib/jit_sparc.c, lib/jit_x86.c: Add a new
--enable-devel-disassembler option, that should be used
during development, or lightning debug. This option
intermixes previous jit_print and jit_disassemble
output, making it easier to visualize what lightning
call was used, and what code was generated.
* include/lightning.h, lib/jit_aarch64.c,
lib/jit_alpha.c, lib/jit_arm-vfp.c, lib/jit_arm.c,
lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_mips.c,
lib/jit_ppc.c, lib/jit_s390.c, lib/jit_sparc.c,
lib/jit_x86.c: Add the new jit_arg_register_p predicate.
The predicate is expected to be used to know if an
argument is in a register, what would need special
handling if code that can overwrite non callee save
registers is executed.
* check/carg.c: New test case to check consistency and
expected usage of jit_arg_register_p.
* check/Makefile.am: Update for new test case.
* include/lightning/jit_aarch64.h,
include/lightning/jit_alpha.h,
include/lightning/jit_arm.h,
include/lightning/jit_hppa.h,
include/lightning/jit_mips.h,
include/lightning/jit_ppc.h,
include/lightning/jit_s390.h,
include/lightning/jit_sparc.h,
include/lightning/jit_x86.h,
lib/jit_aarch64.c, lib/jit_alpha.c,
lib/jit_arm.c, lib/jit_hppa.c,
lib/jit_ia64.c, lib/jit_mips.c,
lib/jit_ppc.c, lib/jit_s390.c,
lib/jit_sparc.c, lib/jit_x86.c: Remove jit_arg_reg_p and
jit_arg_f_reg_p from a public header, and define it only
on port specific files where an integer offset is used
to qualify an argument identifier. Exported code expects
an opaque pointer (but of jit_node_t* type) to "qualify"
an argument identifier.
This patch, and the code review/simplification done during
it also corrected some bugs:
o Inconsistent jit_arg_d value of double argument after 3
integer arguments in arm for jit_functions; tested, C
functions were being properly called.
o Inconsistent use of getarg_{f,d} and putarg*_{f,d} on
s390 (32-bit) that happened to not have a proper test
case, as it would only happen for jit functions, and
tested, called C functions had proper arguments.
o Corrected a "last minute" correction that did not go
to the committed version, and would not compile on hppa,
due to bad _jit_putargi_d prototype definition.
* include/lightning.h, lib/jit_aarch64.c,
lib/jit_alpha.c, lib/jit_arm.c, lib/jit_hppa.c,
lib/jit_ia64.c, lib/jit_mips.c, lib/jit_ppc.c,
lib/jit_s390.c, lib/jit_sparc.c, lib/jit_x86.c:
Implement jit_putarg*. It works as a mix of jit_getarg*
and jit_pusharg*, in the way that the first argument is
a register or immediate, and the second is a pointer
returned by jit_arg*. The use of the interface is to change
values of arguments to the current jit function.
* check/put.ok, check/put.tst: New test cases exercising
the new jit_putarg* interface.
* check/Makefile.am, check/lightning.c: Update for the
new test case and interface.
* include/lightning.h: Split jit_htonr in the new 3 interfaces
jit_htonr_us, jit_htonr_ui and jit_htonr_ul, the later only
available on 64 bit. The plain/untyped jit_htonr macro call
maps to the wordsize one.
* lib/jit_aarch64-cpu.c, lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
lib/jit_alpha-cpu.c, lib/jit_alpha-sz.c, lib/jit_alpha.c,
lib/jit_arm-cpu.c, lib/jit_arm-sz.c, lib/jit_arm.c,
lib/jit_hppa-cpu.c, lib/jit_hppa-sz.c, lib/jit_hppa.c,
lib/jit_ia64-cpu.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
lib/jit_mips-cpu.c, lib/jit_mips-sz.c, lib/jit_mips.c,
lib/jit_ppc-cpu.c, lib/jit_ppc-sz.c, lib/jit_ppc.c,
lib/jit_s390x-cpu.c, lib/jit_s390x-sz.c, lib/jit_s390x.c,
lib/jit_sparc-cpu.c, lib/jit_sparc-sz.c, lib/jit_sparc.c,
lib/jit_x86-cpu.c, lib/jit_x86-sz.c, lib/jit_x86.c:
Update backends for the new jit_htonr*.
* check/lightning.c, lib/jit_names.c, lib/lightning.c:
Update for the new jit_htonr* interfaces.
* check/Makefile.am: Update for new test cases.
* check/hton.ok, check/hton.tst: New test cases.
* include/lightning/jit_private.h, lib/jit_aarch64.c,
lib/jit_alpha.c, lib/jit_arm.c, lib/jit_hppa.c,
lib/jit_ia64.c, lib/jit_mips.c, lib/jit_ppc.c,
lib/jit_s390x.c, lib/jit_sparc.c, lib/jit_x86.c:
Implement a private jit_flush call, that flushes
the cache, if applicable, aligning down to the
previous and up to the next page boundary.
* lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_mips.c, lib/jit_ppc.c,
lib/jit_s390x.c, lib/jit_sparc.c, lib/jit_x86.c: Add an
assertion to all code generation "drivers" to ensure
_jitc->regarg is empty or in an expected state, after
translation of a lightning instruction to native code.
This change was a brute force test to find out other cases
of a temporary not being release (like was happening with
_bmsi and _bmci on x86), but no other case was found,
after running make check, with assertions enabled, on all
backends.
* check/alu_rsb.ok, check/alu_rsb.tst: New files implementing
tests for jit_rsb*.
* check/Makefile.am, check/lightning.c, include/lightning.h,
lib/jit_aarch64-cpu.c, lib/jit_aarch64-fpu.c, lib/jit_aarch64-sz.c,
lib/jit_aarch64.c, lib/jit_alpha-cpu.c, lib/jit_alpha-fpu.c,
lib/jit_alpha-sz.c, lib/jit_alpha.c, lib/jit_arm-cpu.c,
lib/jit_arm-swf.c, lib/jit_arm-sz.c, lib/jit_arm-vfp.c,
lib/jit_arm.c, lib/jit_hppa-cpu.c, lib/jit_hppa-fpu.c,
lib/jit_hppa-sz.c, lib/jit_hppa.c, lib/jit_ia64-cpu.c,
lib/jit_ia64-fpu.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
lib/jit_mips-cpu.c, lib/jit_mips-fpu.c, lib/jit_mips-sz.c,
lib/jit_mips.c, lib/jit_names.c, lib/jit_ppc-cpu.c,
lib/jit_ppc-fpu.c, lib/jit_ppc-sz.c, lib/jit_ppc.c,
lib/jit_s390x-cpu.c, lib/jit_s390x-fpu.c, lib/jit_s390x-sz.c,
lib/jit_s390x.c, lib/jit_sparc-cpu.c, lib/jit_sparc-fpu.c,
lib/jit_sparc-sz.c, lib/jit_sparc.c, lib/jit_x86-cpu.c,
lib/jit_x86-sse.c, lib/jit_x86-sz.c, lib/jit_x86-x87.c,
lib/jit_x86.c, lib/lightning.c: Implement jit_rsb*. This
was a missing lightning 1.x interface, that on most
backends is synthesized, but on a few backends (hppa and ia64),
it can generate better code as on those there is, or the
only instruction with an immediate is in "rsb" format
(left operand).
* lib/jit_aarch64-cpu.c, lib/jit_alpha-cpu.c, lib/jit_arm-cpu.c,
lib/jit_hppa-cpu.c, lib/jit_mips-cpu.c, lib/jit_ppc-cpu.c,
lib/jit_sparc-cpu.c: Implement or correct the internal
nop(count) call that receives an argument that tells the
modulo bytes to align the code for the next instruction.
* include/lightning.h, lib/lightning.c, lib/jit_aarch64.c,
lib/jit_alpha.c, lib/jit_arm.c, lib/jit_hppa.c, lib/jit_ia64.c,
lib/jit_mips.c, lib/jit_ppc.c, lib/jit_s390x.c, lib/jit_sparc.c,
lib/jit_x86.c: Implement the new jit_align() call that receive
an argument, that tells the modulo, in bytes, to align the
next instruction. In most backends the only value that makes
a difference is a value that matches sizeof(void*), as all
other values usually are already automatically aligned in
labels, but not guaranteed to be aligned at word size bytes.
* check/align.ok, check/align.tst: New files, implementing
a simple test for the new jit_align() interface.
* check/Makefile.am, check/lightning.c, lib/jit_aarch64-sz.c,
lib/jit_alpha-sz.c, lib/jit_arm-sz.c, lib/jit_hppa-sz.c,
lib/jit_ia64-sz.c, lib/jit_mips-sz.c, lib/jit_ppc-sz.c,
lib/jit_print.c, lib/jit_s390x-sz.c, lib/jit_sparc-sz.c,
lib/jit_x86-sz.c: Update for the new jit_code_align code and
the jit_align() interface.
* lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_mips.c,
lib/jit_ppc.c, lib/jit_s390x.c, lib/jit_sparc.c,
lib/jit_x86.c, lib/lightning.c: Allow jit_jmpi on a
target that is not a node. This may lead to hard to
debug code generation, but is a required feature for
certain generators, like the ones that used lightning
1.2x. Note that previously, but not really well
documented, it was instructed to use:
jit_movi(rn, addr); jit_jmpr(rn);
but now, plain:
jit_patch_abs(jit_jmpi(), addr);
should also work.
* lib/jit_alpha.c: Correct wrong bitmask of most argument
float register arguments, that were being set as callee
save instead of argument registers class.
* include/lightning/jit_alpha.h, lib/jit_alpha-cpu.c,
lib/jit_alpha-fpu.c, lib/jit_alpha-sz.c, lib/jit_alpha.c:
New files implementing a lightning Alpha port. Thanks
to Trent Nelson and snakebit.net staff for providing access
to an Alpha system.
* check/float.tst, check/lightning.c, configure.ac,
include/lightning.h, include/lightning/Makefile.am,
include/lightning/jit_private.h, lib/Makefile.am,
lib/jit_disasm.c, lib/jit_size.c, lib/lightning.c:
Minor changes to adapt for the new Alpha port.