1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-17 11:10:18 +02:00
Commit graph

484 commits

Author SHA1 Message Date
Paulo Andrade
a3063df782 ia64: Do not use a dangling pointer for double to integer copy
* lib/jit_ia64-fpu.c, lib/jit_ia64.c: Correct movi_d_w
	and movi_f_w implementation to work when not using a
	data buffer. This causes the check varargs.tst to
	work when passing "-d" to the lightning test tool.
2015-05-10 18:33:05 -03:00
Paulo Andrade
f48e07b58b ia64: Implement cache flush.
* lib/jit_ia64.c: Implement inline assembly cache flush,
	required on multiprocessor systems.
2015-05-10 16:22:26 -03:00
pcpa
a5ab4c7718 mips: Add initial jit_va_ calls to mips
* lib/jit_mips-cpu.c, lib/jit_mips-fpu.c, lib/jit_mips.c:
	Add base support to jit vararg functions to the mips backend.
	Currently only supported on the o32 abi, until access to a
	n32 system is arranged.
2015-05-06 20:02:17 -03:00
pcpa
b42bb8b7a1 Remove wrong comment after cut and paste 2015-05-05 20:57:18 -03:00
pcpa
cc217f0608 ppc: Add initial jit_va_ calls to ppc
* lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c, lib/jit_ppc.c:
	Add base support to jit vararg functions to the PowerPC backend.
2015-05-05 20:55:05 -03:00
pcpa
2c8b5e530c s390: Add initial jit_va_ calls to s390
* lib/jit_s390-cpu.c, lib/jit_s390-fpu.c, lib/jit_s390.c:
	Add base support to jit vararg functions to the s390 backend.
2015-05-02 21:15:16 -03:00
pcpa
8cb302f337 arm: Add initial jit_va_ calls to arm
* lib/jit_arm-cpu.c, lib/jit_arm-swf.c, lib/jit_arm-vfp.c,
	lib/jit_arm.c: Add base support to jit vararg
	functions to the arm backend.
2015-05-01 14:05:00 -03:00
pcpa
0986ae8a86 aarch64: Add initial jit_va_ calls to aarch64
* lib/jit_aarch64-cpu.c, lib/jit_aarch64-fpu.c,
	lib/jit_aarch64.c: Add base support to jit vararg
	functions to the aarch64 backend.
2015-04-30 17:40:14 -03:00
pcpa
6329945281 Correct update of on stack vararg double argument pointer 2015-04-30 14:04:32 -03:00
pcpa
e4fe5186e6 Update the correct fp offset and add assertions 2015-04-30 10:17:17 -03:00
pcpa
d639674549 Add initial support to implement vararg jit functions
* 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.
2015-04-27 21:12:32 -03:00
pcpa
a15f261afc Update copyright date 2015-04-26 14:33:41 -03:00
pcpa
1507bc7ee5 Properly correct read of freed memory 2015-03-08 16:22:10 -03:00
pcpa
20955b2bfc Correct read of freed memory 2015-03-01 11:38:41 -03:00
pcpa
531a88aeeb Add missing ellipsis in allocar.tst 2015-02-17 17:39:58 -02:00
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