* lib/jit_x86.c: Rewrite incorrect inline assembly that could
truncate a variable in a callee save register. Now it simply
tells gcc that the register is clobbered, instead of using a
*32 bit* swap with a temporary variable. The problem only
happens when compiling with optimization.
* lib/jit_x86-cpu.c: Use the emms instruction before
calling any function. This is particularly important
when using c99 complex functions as it can easily
overflow the x87 stack due to the way lightning uses
the x87 stack as a flat register file.
* include/lightning/jit_arm.h, lib/jit_arm-cpu.c: Do not use
by default load/store instructions that map to ldrt/strt.
There is already the long displacement version for positive
offsets, and when using a (shorter) negative offset it does
not map to ldrt/strt. At least on qemu strt may cause
reproducible, but unexpected SIGILL.
* lib/jit_arm-vfp.c: Correct wrong load/store offset
calculation when the displacement is constant but too
large to use an instruction with an immediate offset.
2013-10-07 Paulo Andrade <pcpa@gnu.org>
* check/self.c: Extend tests to validate jit_callee_save_p
does not cause an assertion on valid arguments, and test
extra registers defined on some backends.
* configure.ac: Do not ignore environment CFLAGS when
checking if need to test runtime configurable options,
like use x87 when sse2 is available, arm instruction set
instead of thumb, etc.
* include/lightning/jit_arm.h: Correct wrong jit_f macro
definition.
* include/lightning/jit_ia64.h, include/lightning/jit_ppc.h:
Correct wrong jit_r macro definition.
* lib/jit_x86-x87.c, lib/jit_x86.c: Actually use the
reserved stack space for integer to/from float conversion.
The stack space was also changed to ensure it is 8 bytes
aligned. Also, for Solaris x86 in 32 bit mode, an alternate
truncr_d was implemented because for some reason it is
failing with SIGILL if using the "fisttpl" instructions,
that must be available on p6 or newer, but for the sake of
making all tests pass, implement a 486 or newer sequence
if "sun" is defined.
* include/lightning/jit_mips.h, lib/jit_mips-cpu.c,
lib/jit_mips-sz.c, lib/jit_mips.c, size: Build and
pass all test cases on Irix big endian mips using
the 64 bit abi.
* lib/jit_x86-cpu.c: Correct not properly tested case of using
%r12 as index register, what was causing an invalid assertion.
%r12 is mapped to the "extra" JIT_R3 register, and test cases
only test "standard" lightning registers.
* lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c: Correct some
off by one range checks (that were only accepting values
one less than the maximum allowed) and an invalid test
condition check that was forcing it to always use
indirect jumps even when reachable with an immediate
displacement.
* lib/jit_aarch64-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_s390x-sz.c, lib/jit_size.c, lib/jit_sparc-sz.c,
lib/jit_x86-sz.c: New files implementing static tables
with longest known instructions length generated to match
a lightning instruction. These tables should make it easier
to make it very unlikely to ever miscalculate, or by too
much, the size of a code buffer.
* lib/jit_size.c: New file that aids to either collect
jit code size information, or use the information depending
on build options.
* size.c: New helper file that parses input for, and create
an initial jit_$arch-sz.c file, that needs some minor edit
for arches with multiple configurations.
* configure.ac, Makefile.am: Add the new, devel mode only
--enable-devel-get-jit-size configure option, that sets
compile time flags to collect jit code size information,
that will be used as input for the "noinst size program".
* lib/jit_aarch64.c, lib/jit_arm.c, lib/jit_disasm.c,
lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_memory.c,
lib/jit_mips.c, lib/jit_ppc.c, lib/jit_s390x.c,
lib/jit_sparc.c, lib/jit_x86.c, lib/lightning.c: Minor
changes for the --enable-devel-get-jit-size build mode,
as well as the "production build mode" with jit code
size information.
* include/lightning.h, lib/lightning.c: Add the new
jit_pointer_p interface, that returns a boolean value
telling if the pointer argument is inside the jit
code buffer. This is useful to avoid the need to add
extra labels and calls to jit_address to figure bounds
of code buffer, and still keep internal data private.
* include/lightning.h, include/lightning/jit_private.h,
lib/jit_note.c: Change the code argument of jit_get_note
to a jit_pointer_t and make jit_get_note a public interface.
It was intended so since start, as a way to map an offset
in the code to a function name, file name and line number
mapping.
* doc/body.texi: Correct reversed arguments in example of
usage in a (possibly) multi threaded, multiple jit_state_t
environments.
* include/lightning/jit_arm.h, include/lightning/jit_private.h,
lib/jit_arm-cpu.c, lib/jit_arm.c: Make a previously, non
documented, global state private to the related jit_state_t
generating code.
* check/self.c, check/self.ok: New files implementing simple
consistency check assertions. At first validating some macros
that use values from different sources agree.
* check/Makefile.am: Update for the new test case.
* include/lightning.h, lib/lightning.c: Add the new
jit_callee_save_p() call, that is intended to be used when
writing complex code using lightning, so that one does not
need to verify what backend is being used, or have access to
private data, to query if a register is callee save or not;
on several backends the scratch registers are actually callee
save.
* include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
include/lightning/jit_hppa.h, include/lightning/jit_mips.h,
include/lightning/jit_ppc.h, include/lightning/jit_sparc.h,
include/lightning/jit_x86.h: Add an explicit definition for
JIT_R3-JIT_Rn, JIT_V3-JIT_Vn and JIT_F6-JIT_Fn when applicable.
This allows one to write code based on "#if defined(JIT_XN)"
and therefore, not need to check what is the current backend
or have access to private data structures. This is particularly
useful when writing virtual machines with several specialized,
global registers.
* lib/jit_ia64.c: Properly flag the callee save general
purpose registers as such, so that jit_callee_save_p() works
as intended.
* check/lightning.c, configure.ac: Conditionally use the
code written to workaround a bug in the Hercules emulator,
as isnan and isinf are not available at least on HP-UX ia64.
enter the commit message for your changes. Lines starting
* lib/jit_arm-cpu.c, lib/jit_arm.c: Correct wrong test and update
of the thumb offset information, when checking if needing to
patch a jump from arm to thumb mode. The problem would happen when
remapping the code buffer, and the new address being lower than
the previous one.
* configure.ac: Extend FreeBSD test to also handle NetBSD.
* lib/jit_x86-cpu.c: Correct wrongly defined offset type of
ldxi_ui. Problem detected when building on NetBSD.
* lib/lightning.c: Adjust code to handle NetBSD mremap,
where arguments do not match Linux mremap.
lib/jit_ppc.c: Correct C sequence point problem miscalculating
the actual function address in a function descriptor. Problem
happens with gcc 4.8.1 at least.
* include/lightning/jit_s390x.h, lib/jit_s390x-cpu.c,
lib/jit_s390x-fpu.c, lib/jit_s390x.c: New files
implementing the new s390x port.
* configure.ac, include/lightning.h,
include/lightning/Makefile.am,
include/lightning/jit_private.h,
lib/Makefile.am, lib/jit_disasm.c, lib/lightning.c:
Minor adaptation for the new s390x backend.
* check/float.tst: Update for the s390x result of
truncating +Inf to integer.
* check/qalu_mul.tst: Add extra test cases to better test
high word of signed multiplication as the result is
adjust from unsigned multiplication on s390x.
* check/lightning.c: Do not assume casting a double NaN or
Inf to float will produce the expected float NaN or Inf.
This is not true at least under s390x.
* check/check.arm.sh, check/check.sh, check/check.swf.sh,
check/check.x87.sh: Properly check test programs output,
not just rely on the test program self testing the results
and not crashing.