1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-04 05:50:26 +02:00
Commit graph

419 commits

Author SHA1 Message Date
pcpa
d462a4f85f Correct typo in x87.nodata test list 2015-02-17 14:39:08 -02:00
pcpa
ad589fbb0a Implement jit_allocar for dynamic stack allocation
* 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.
2015-02-17 14:37:57 -02:00
pcpa
9f72e66116 X86: No longer make st7 available as a temporary
* include/lightning/jit_x86.h, lib/jit_x86-cpu.c,
	lib/jit_x86-x87.c: No longer make st(7) available.
	Need to keep one x87 slots empty to avoid exceptions.
	This has the side effect of no longer needing the
	hackish emms instruction before a function call.
2015-02-17 13:55:01 -02:00
pcpa
2597bf3c13 Correct inconsistency with jit_regno_patch
* lib/lightning.c: Remove the jit_regno_patch bitfield
	register fields before actual emit, as it is only really
	used before emit, otherwise, on special	conditions it
	may consider live registers as dead during code emit.
2015-02-16 15:07:36 -02:00
pcpa
3a03feae5d X86: Correct load and store in the x32 abi
* lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c:
	Correct encoding of ldxr* stxr* in the x32 abi. If the
	displacement register is negative, it would generate
	a 64 bit instruction with a 32 bit unsigned displacement.

	* check/ranger.tst, check/ranger.ok: New files, implementing
	a test case for negative loads and stores. This is range.tst
	converted to use registers instead of immediate offsets.

	check/Makefile.am: Update for the new test case.
2015-02-15 23:14:27 -02:00
pcpa
7fdbc5b84a GNU lightning 2.1.0 release 2015-02-07 17:10:37 -02:00
pcpa
26c28beeeb Correct typo 2015-02-07 17:09:22 -02:00
pcpa
fb21cf9f38 Avoid problems if JIT_INSTR_MAX is miscalculated
* lib/jit_size.c: Preventively use at least 144 bytes
	if JIT_INSTR_MAX is less than it. The logic is not
	guaranteed to be 100% precise, it is mostly heuristics
	to allocate a buffer with as close as possible size,
	but a wrong value may cause code generation to write
	past the end of the buffer.
2015-02-07 17:08:43 -02:00
Paulo Andrade
f6970c62cf Correct the reason the simplify_stxi bug was not noticed before
* lib/lightning.c: Correct the reason the bug in
	simplify_stxi was not triggered before, it was due to
	incorrectly resetting the value->code field, what was
	causing it to never properly optimize:
		stxi Im0 Rb0 Rt0
		ldxi Rt1 Rb1 Im1
	when Rb0 == Rb1, Rt0 == Rt1 and Im0 == Im1
	There was another possible issue, that has been also
	addressed in this commit, that would be the case of
	Rbn == Rtn, where no redundancy removal is possible.
2015-02-03 15:42:50 -02:00
Paulo Andrade
5724068b1c Correct wrong check in simplify_stxi.
* lib/lightning.c: Correct wrong check in simplify_stxi.
	The test was incorrectly comparing the target register
	and the displacement offset. This was a time bomb bug,
	that would trigger in code like:
		stxi Im0 Rb0 Rt0
		stxi Im1 Rb1 Rt1
	if Rb0 == Rb1 && Rt0 == Rt1 && Im0 == Rt1, that is,
	the wrong check was Im0 == Rt1, instead of the supposed
	Im0 == Imm1 (that was what the code mean't to do). It
	was removing the second stxi assuming it was redundantly
	generated; as that is not uncommon pattern on
	translators generating jit.
2015-02-03 15:19:21 -02:00
Paulo Andrade
cdf5b785eb ARM: Regenerate size table for hard float armv7 or newer. 2015-02-02 20:49:48 -02:00
Paulo Andrade
678280734e Add new --enable-devel-disassembler configure option
* 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.
2015-02-02 20:49:22 -02:00
Paulo Andrade
1b055bf0d8 Make more readable always true test 2015-02-01 13:04:38 -02:00
Paulo Andrade
6db38b75e9 ARM: Do not limit to 24 bit displacement jump to unknown address
* lib/jit_arm-cpu.c, lib/jit_arm.c: Only limit to 24 bit
	displacement non conditional jump in the same jit_state_t.
2015-01-31 15:59:25 -02:00
pcpa
894a02412c Update documentation on jit_frame and jit_tramp
* doc/body.texi: Reorder documentation, making jit_frame
	and jit_tramp the lightning response to the need of
	trampolines, continuations and tail call optimizations.
	A pseudo code example of a factorial function was added.
	Also added a section for description of the available
	predicates.

	* doc/fact.c: New file, implementing a simple example of
	a translation of a trivial, recursive, tail call optimization
	into lightning calls. This is the conversion to functional C
	code of the example in doc/body.texi.

	* doc/Makefile.am: Update for the next test case.
2015-01-19 19:09:37 -02:00
pcpa
c8b6c36971 Implement the jit_arg_register_p predicate.
* 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.
2015-01-18 11:24:25 -02:00
pcpa
73e520767f Remove inconsistent, public jit_arg_reg_p macro
* 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.
2015-01-17 17:31:09 -02:00
pcpa
3695a2e99c Update documentation
* doc/body.texi: Correct wrong/outdated information for
	hton*, pusharg* and ret*, and add missing documentation
	for rsb*, qmul*, qdvi* and putarg*.
2015-01-17 13:09:08 -02:00
Paulo Andrade
361caf2854 PPC: Only call binutils function if it is available
* configure.ac, lib/jit_disasm.c: Rewrite workaround
	to apparent problem to initialize powerpc disassembler.
2015-01-15 14:56:38 -02:00
Paulo Andrade
618512a889 Correct typo. 2015-01-15 14:21:11 -02:00
Paulo Andrade
27d9b68a3f Implement jit_putarg*
* 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.
2015-01-15 14:20:07 -02:00
pcpa
192f89c0ee S390: Replace s390x filenames with s390
* include/lightning/jit_s390.h, lib/jit_s390-cpu.c,
	lib/jit_s390-fpu.c, lib/jit_s390-sz.c, lib/jit_s390.c:
	Renamed s390x* files to s390*.

	* check/float.tst, check/lightning.c, configure.ac,
	include/lightning.h, include/lightning/Makefile.am,
	lib/Makefile.am, lib/jit_s390.c, lib/jit_size.c,
	lib/lightning.c: Update for renamed files.
2015-01-08 13:01:49 -02:00
pcpa
32c4f90a2b S390: Add support for 32 bit.
* include/lightning.h, include/lightning/jit_private.h,
        include/lightning/jit_s390x.h, lib/jit_disasm.c,
        lib/jit_s390x-cpu.c, lib/jit_s390x-fpu.c, lib/jit_s390x-sz.c,
        lib/jit_s390x.c, lib/jit_size.c, lib/lightning.c:
	Add support for generating jit for s390 32 bit. This change
	also removed %f15 from the list of temporaries fpr registers;
	it was not being used, but if were, it would corrupt the
	stack frame because the spill address would overwrite grp
	offsets.
2015-01-08 10:45:30 -02:00
Paulo Andrade
af9df5faeb PPC: Build and pass all tests in powerpcle
* lib/jit_ppc-cpu.c, lib/jit_ppc.c: Correct some endianess issues
	on the powerpc le backend.
2014-12-26 17:23:39 -02:00
Paulo Andrade
a16adad0fd PPC: Implement and use mcrxr emulation by default
* lib/jit_ppc-cpu.c: Add mcrxr instruction emulation,
	as this instruction has been phased out, and should be
	implemented as a kernel trap.
2014-12-26 15:41:12 -02:00
pcpa
5eb3c3602f ARM: Better check for constants offset overflow
* lib/jit_arm.c: Better check for need to flush constants
	before the pool being no longer reachable.
2014-12-26 00:38:54 -02:00
pcpa
88aa2fcad2 Implement new, typed, jit_htonr* interfaces
* 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.
2014-12-25 23:06:24 -02:00
Paulo Andrade
fdf41c1fa4 x86: Implement support for the x32 abi
* include/lightning/jit_private.h, include/lightning/jit_x86.h,
	lib/jit_disasm.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,
	size.c: Implement support for the x32 abi. Built and
	tested on Gentoo default/linux/amd64/13.0/x32 profile.
2014-12-24 14:14:38 -02:00
Paulo Andrade
3b829ab075 Add missing float rsbi strings 2014-12-24 13:54:28 -02:00
Paulo Andrade
1cb0e18c7b ARM: Flush cache page by page
* lib/jit_arm.c: Call __clear_cache for every page.
	This should only be required for older boards or
	toolchain setup, but has been reported to be required
	for lightning at some point.
2014-12-21 21:21:54 -02:00
Paulo Andrade
f63d064a10 ARM: Correct constants offset check
* lib/jit_arm.c: Correct check to guard overflow of index
	of constants from program counter.
2014-12-21 21:21:54 -02:00
pcpa
ce2dd3d446 Add missing ellipsis mark to align.tst 2014-12-16 13:10:48 -02:00
pcpa
c95a356c1a Remove a wrong optimization of callee save registers 2014-11-24 12:40:32 -02:00
pcpa
2d3529ddb5 Correct bogus git entry 2014-11-20 22:48:43 -02:00
pcpa
6e34a532ae PPC: Add initial powerpc le support. 2014-11-20 21:25:52 -02:00
pcpa
3f397228f5 ARM: Correct several inconsistencies with ldrd and strd
* lib/jit_disasm.c: Change thumb or arm disassemble based on
	jit code before disassembly.

	* lib/jit_arm-cpu.c: Correct reversed arguments to LDRD and
	STRD instructions, and correct checking for support of those.

	* lib/jit_arm-swf.c: Correct wrong use of LDRD and STRD and
	only use those if the register is even.

	* check/check.arm.swf.sh, check/check.arm4.swf.sh: New files
	to test LDRD and STRD, as well as the alternate code path
	when those are not available, in the .arm4. test case.

	* check/Makefile.am: Update for the new test cases.
2014-11-20 15:05:13 -02:00
pcpa
7b449aa063 Implement jit_flush
* 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.
2014-11-08 19:34:23 -02:00
pcpa
95f4ee4737 Add test case to check possible issues with 2 contexts
* check/ctramp.c: New file. It just repeats the test
	of tramp.tst, but using two jit_state_t, what should
	test possible issues with two contexts, and also validate
	jit_tramp works on backends with function descriptions.

	* check/Makefile.am: Update for new test case.
2014-11-08 14:13:10 -02:00
pcpa
ade23376f9 mips: Do not make t9 available as a generic register
* include/lightning/jit_mips.h: Do not make the t9 register
	JIT_R11 (or JIT_R7 for n32 or n64 abi) available. Previously
	it cause problems if one expects it to not be changed in a
	function call. For example, calling a jit function, where it
	really does not need to be changed.
2014-11-03 12:55:35 -02:00
pcpa
85ab988cd1 Resync with new patch to make functions receive a const argument 2014-11-01 22:32:23 -02:00
Holger Hans Peter Freyther
e98640e1ac cross: Provide the action for the cross compiling case
Assume that the functionality is not present
2014-11-01 22:20:56 -02:00
pcpa
dea1775f62 Update THANKS file 2014-11-01 19:08:23 -02:00
pcpa
81b1a90777 Force creation of the m4 directory on a clean checkout 2014-11-01 19:05:46 -02:00
pcpa
59eb1a16e2 Actually install the pkgconfig file. 2014-11-01 19:05:28 -02:00
Holger Hans Peter Freyther
3008f04b4c misc: Create a pkg-config file
Make it more easy to find GNU lightning. Create and install
a pkg-config file.
2014-11-01 18:52:33 -02:00
Holger Hans Peter Freyther
073396bb70 misc: Enable silent rules to make warnings stick out 2014-11-01 18:52:31 -02:00
Holger Hans Peter Freyther
2229200c44 misc: Make jit_note and related functions take a const argument
Make jit_memcpy, jit_memmove, jit_data take const pointers to
allow jit_note to be used with a const string (e.g. a string
literal, __FILE__ or __func__). This is needed for GNU Smalltalk
to silence compiler warnings.

Sadly "const jit_pointer_t" is not the same as "typedef const void *"
so I introduced a new typedef for a const jit pointer. The other
option would be to replace jit_pointer_t with void*.
2014-11-01 18:52:27 -02:00
pcpa
44519452d9 Add assertion to check for register allocation leaks
* 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.
2014-10-26 18:25:41 -02:00
pcpa
ddd7a7550b x86: Correct not released temporary register
* lib/jit_x86-cpu.c: Correct a register allocation leak in
	_bmsi and _bmci.
2014-10-26 15:23:29 -02:00
pcpa
9cdcfcc38f Do not fail gratuitously in jit_init_debug
* lib/jit_disasm.c: Do not cause an fatal error if init_jit
	fails in the jit_init_debug call.
2014-10-25 14:53:05 -02:00