1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-06 15:40:29 +02:00
Commit graph

299 commits

Author SHA1 Message Date
pcpa
93e3ff38e1 ALPHA: Correct class of argument float registers
* 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.
2014-08-16 20:19:02 -03:00
pcpa
a597e3575d ARM: Correct wrong table of instruction sizes in software float
* lib/jit_arm-sz.c: Regenerate table of known maximum
	instruction sizes for the software float fallback,
	that implements "virtual" float registers in the stack
	and operations as calls to libgcc.

	* size.c: Correct typo in the generated jit_arm-sz.c file.
2014-08-16 20:08:07 -03:00
pcpa
73c2fc830e Do not filter -sz.c files in gitignore 2014-08-10 11:49:31 -03:00
pcpa
05b88d9d45 ALPHA: Implement lightning Alpha port.
* 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.
2014-08-10 11:48:35 -03:00
pcpa
53dd28d682 Always mark return registers as live in epilog
* lib/lightning.c: Always mark JIT_RET and JIT_FRET as
	live in a function epilog. This is required because
	on some ports a complex sequence, allocating one or more
	registers, may be required to jump from a ret* to the
	epilog, and the lightning api does not have annotations
	to know if a function returns a value, or the type of
	the return value.
2014-08-10 11:39:53 -03:00
pcpa
f79f9777b1 Correct change of possibly wrong bitmask in jit_update
* lib/lightning.c: Change the correct live bitmask of
	return registers after a function call in jit_update.
2014-08-10 11:36:08 -03:00
pcpa
dbf2847e47 Do not have assertions with a long type test
* lib/lightning.c: Change assertions to have an int
	result and correct a bad bit mask assertion.
2014-08-10 11:33:00 -03:00
pcpa
b23322100c AARCH64: Correct assertion test
* lib/jit_aarch64.c: Correct bad setup for assertion
	of consistency before a patch.
2014-08-10 11:26:18 -03:00
pcpa
cf2be67c5a MIPS: Correct use of wrong test register
* lib/jit_mips-cpu.c: Correct typo in the jit_bmsr
	implementation that was using the wrong test result
	register.
2014-08-10 11:21:57 -03:00
pcpa
0d9ac79a12 Do not pass null for free, memcpy and memmove
* lib/jit_memory.c: Do not call free on NULL pointers.

	* include/lightning/jit_private.h, lib/jit_note.c,
	lib/lightning.c: Add a wrapper to memcpy and memmove
	to not actually call those functions with a zero size
	argument, and likely also a null src or dst.
2014-07-29 10:29:49 -03:00
pcpa
a8c180a926 Remove the global but not advertised jit_progname variable
* include/lightning/jit_private.h, lib/jit_disasm.c,
	lib/lightning.c: Remove the global jit_progname variable.
	It was being only used in jit_init_debug, that is called
	from init_jit, so, just pass an argument.
2014-07-27 16:48:52 -03:00
pcpa
0d96d24073 Add note about jit_set_memory_functions call.
* doc/body.texi: Add note that jit_set_memory_functions
	should be called before init_jit, because init_jit
	itself may call the memory wrappers.
2014-07-27 16:45:03 -03:00
pcpa
354146b4ca ARM: Do not leave early init_jit if /proc is not mounted.
* lib/jit_arm.c: Do not get confused with default settings
	if /proc is not mounted on Linux specific code path.
2014-04-22 14:39:10 -03:00
pcpa
abf1b6e678 Do not export private definitions and types.
* include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
	include/lightning/jit_hppa.h, include/lightning/jit_ia64.h,
	include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
	include/lightning/jit_private.h, include/lightning/jit_s390x.h,
	include/lightning/jit_sparc.h, include/lightning/jit_x86.h:
	Do not add jit_regset_t, JIT_RA0, and JIT_FA0 to the installed
	header file. These types and definitions are supposed to be
	only used internally.
2014-04-09 14:46:30 -03:00
pcpa
0fac1b11ea GNU lightning 2.0.4 release 2014-04-05 19:38:25 -03:00
pcpa
6726b2b8f5 ARM: Do not emit a nop stack adjust instruction.
lib/jit_arm-cpu.c: Only adjust stack pointer in prolog if
	need stack space, that is, do not emit a nop instruction
	subtracting zero from the stack pointer.
2014-04-05 17:14:04 -03:00
pcpa
16384ff2fe Correct crash on arm in the doc/printf example.
* lib/jit_disasm.c: Correct a crash in the doc/printf example
	on arm due to releasing the data_info information in
	jit_clear_state. This is a special case for arm only, and
	actually, only armv5 or older uses the data_info buffer,
	or when forcing arm instruction set mode besides thumb
	available.
2014-04-04 19:53:14 -03:00
pcpa
a7cde4ba18 Document the lightning customization functions.
* doc/body.texi: Write detailed description and examples for
	jit_get_memory_functions, jit_set_memory_functions,
	jit_get_code, jit_set_code, jit_get_data and jit_set_data.
2014-03-12 18:23:15 -03:00
pcpa
33ee2337c7 Implement the new jit_set_data interface.
* include/lightning.h, include/lightning/jit_private.h,
	lib/lightning.c: Implement the new jit_set_data() interface,
	and the new jit_get_data() helper. Like jit_set_code(),
	jit_realize() should be called before jit_set_data().
	The most common usage should be jit_set_data(JIT_DISABLE_DATA
	| JIT_DISABLE_NOTE), to force synthesize any float/double
	constant in the stack and not generate any debug information.

	* lib/jit_note.c: Minor change to debug note generation as
	now it uses an alternate temporary data buffer during constants
	and debug generation to accommodate the possibility of the user
	setting an alternate data buffer.

	* lib/jit_hppa-fpu.c, lib/jit_s390x.c, lib/jit_s390x-cpu.c,
	lib/jit_s390x-fpu.c, lib/jit_sparc.c, lib/jit_sparc-fpu.c,
	lib/jit_x86-sse.c, lib/jit_x86-x87.c: Implement jit_set_data.

	* lib/jit_hppa-sz.c, lib/jit_sparc-sz.c, lib/jit_x86-sz.c,
	lib/jit_s390x-sz.c: Update for several instructions that now
	have a different maximum length due to jit_set_data.

	* lib/jit_mips-fpu.c: Implement jit_set_data, but missing
	validation on n32 and n64 abis (and/or big endian).

	* lib/jit_mips-sz.c: Update for changes in o32.

	* lib/jit_ppc-fpu.c: Implement jit_set_data, but missing
	validation on Darwin PPC.

	* lib/jit_ppc-sz.c: Update for changes in powerpc 32 and
	64 bit.

	* lib/jit_ia64-fpu.c: Implement untested jit_set_data.

	* TODO: Add note to list ports that were not tested for the
	new jit_set_data() feature, due to no longer having access
	to them.

	* check/nodata.c: New file implementing a simple test exercising
	several different conditions created by jit_set_data().

	* check/check.nodata.sh: New file implementing a wrapper
	over the existing *.tst files, that runs all tests without
	using a data buffer for constants; only meaningful (and
	enabled) on architectures that used to store float/double
	constants on a read only data buffer.

	* configure.ac, check/Makefile.am: Update for the new test
	cases.

	* check/lightning.c: Implement the new "-d" option that
	sets an internal flag to call jit_set_data() disable
	constants and debug, that is, using only a pure code
	buffer.
2014-03-12 14:50:31 -03:00
pcpa
79bc3d03dd Implement the new jit_set_code interface.
* include/lightning.h, include/lightning/jit_private.h,
	lib/lightning.c: Implement the new jit_set_code() interface,
	that allows instructing lightning to use an alternate code
	buffer. The new jit_realize() function should be called
	before jit_set_code(), and usually call jit_get_code()
	to query the amount of bytes expected to be required for
	the code.

	* lib/jit_size.c: Minor update to have less chances of
	miscalculating the code buffer by starting the counter
	with the size of the longest instruction instead of zero,
	as code emit fails if at any moment less than the longest
	instruction bytes are available.

	* check/setcode.c: New file implementing some basic tests
	of the new jit_set_code() interface.

	* check/Makefile.am: Update for newer test case.
2014-03-11 11:40:42 -03:00
pcpa
a9433b5a2c Implement and document the new jit_indirect call.
* include/lightning.h, lib/lightning.c: Add the new
	jit_indirect() call, that returns a special label node,
	and tells lightning that the label may be the target of
	an indirect jump.

	* doc/body.texi: Document the new jit_indirect() call, and
	add examples of different ways to create labels and branches.
2014-03-06 18:20:29 -03:00
pcpa
c146f06793 x86_64: Change x86_64 to also save/restore %rbx in inline asm.
*  lib/jit_x86.c: Rewrite previous patch to inline save/restore
	because clobbering %ebx in x86 is treated as an error
	(jit_x86.c:239:5: error: PIC register clobbered by 'ebx' in 'asm').
2014-02-23 17:31:12 -03:00
pcpa
dbb9fe1e81 x86_64: Correct wrong inline assembly in jit_get_cpu
* 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.
2014-02-19 15:29:26 -03:00
pcpa
6e75c0352d Rewrite jit_regset_scan1 for easier optimization.
* include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
	include/lightning/jit_hppa.h, include/lightning/jit_ia64.h,
	include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
	include/lightning/jit_s390x.h, include/lightning/jit_sparc.h,
	include/lightning/jit_x86.h: Change jit_regset_t to an
	unsigned type, to allow safe right shift.

	* lib/lightning.c: Rewrite jit_regset_scan1 to allow easier
	compiler optimization.
2014-02-19 14:38:14 -03:00
pcpa
b1d3217b63 GNU lightning 2.0.3 release 2014-01-08 17:48:33 -02:00
pcpa
8567d28d60 x86: Correct wrong x87 optimization.
* lib/jit_x86-x87.c: Correct wrong optimization when
	loading the log(2) constant.
2013-12-03 15:11:11 -02:00
pcpa
0b0d63d892 x86: Ensure the x87 stack is empty when calling a function.
* 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.
2013-12-03 15:09:48 -02:00
pcpa
c162b9d836 x86: Correct wrong x87 float indexed store code generation.
* lib/jit_x86-x87.c: Correct wrong code generation due
	to comparing the base and not the value register with
	%st(0) in stxi_f.
2013-12-02 19:17:03 -02:00
pcpa
4e5368d291 Correct wrong call in ldi_f if address does not fit in 32 bit.
This would only happen in x86_64, where x87 registers are not used
neither "exported".
2013-12-02 18:15:14 -02:00
pcpa
479c2eda3c x86: Use aligned offset for x87 to/from sse move.
* lib/jit_x86-x87.c, lib/jit_x86.c: Use 8 bytes aligned
	stack offset for float/double x87 to/from sse move.
2013-12-02 17:58:00 -02:00
pcpa
6fa5123855 ARM: Minor changes that should allow building on non gnu-linux/gcc.
* configure.ac, lib/jit_arm-swf.c, lib/jit_arm.c: Add
	changes that should at least allow building lightning
	on Apple iOS7.
2013-11-27 15:05:27 -02:00
pcpa
67d994cc5e Sync after regenerating version.texi. 2013-11-27 13:44:49 -02:00
pcpa
f65ceb6c33 GNU lightning 2.0.2 release 2013-11-04 14:06:33 -02:00
pcpa
a264ccee75 Add assertion to detect double patching.
This triggers the bug at the right point, otherwise, double patching
may be quite hard to track.
2013-10-16 01:13:46 -03:00
pcpa
fe3aee2706 PPC: Correct wrong ldxi_l simplification in 64 bit mode
* lib/jit_ppc-cpu.c: Correct wrong shortcut for ldxi_l with
	a zero offset, that was calling ldr_i instead of ldr_l.
2013-10-08 16:39:14 -03:00
pcpa
2d4bac43a9 ARM: Do not use ldrt/strt by default
* 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.
2013-10-08 12:26:52 -03:00
pcpa
72f3e65a6d ARM: Correct wrong offset for load/store of floats.
* 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-08 01:20:19 -03:00
pcpa
0e94048174 Rerun tests on supported backends after bogus self test correction
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.
2013-10-07 17:04:00 -03:00
pcpa
52bfc67192 MIPS: Build and pass all test cases on mips64.
* 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.
2013-10-04 00:01:31 -03:00
pcpa
485584546a Correct source of the self test case and a missed check failure. 2013-10-03 19:05:52 -03:00
pcpa
36a60d7aa3 Correct wrong dates in ChangeLog 2013-10-02 23:19:54 -03:00
pcpa
565c3a064e MIPS: Correct abi detection.
* include/lightning/jit_mips.h: Add proper mips abi detection.
2013-10-02 23:18:06 -03:00
pcpa
f42a251ff1 Correct misplaced check for already visited blocks 2013-10-01 13:51:01 -03:00
pcpa
1bd169cfa3 X86: %r12 may be used as an index register.
* 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.
2013-09-30 13:30:21 -03:00
pcpa
ff73547603 IA64: Force sync of instructions in get-jit-size build mode. 2013-09-28 14:19:33 -03:00
pcpa
0ad5e08ee5 ARM: Correct build when disassembler is disabled. 2013-09-27 13:19:49 -03:00
pcpa
ae6101f662 IA64: Correct some wrong checks value range checks.
* 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.
2013-09-25 00:30:42 -03:00
pcpa
2e209eb61d GNU lightning 2.0.1 release 2013-09-24 18:20:41 -03:00
pcpa
b768fab8b1 Add code to calculate code buffer size based on devel time information.
* 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.
2013-09-24 03:31:54 -03:00
pcpa
95e3fbc8bc Add the new jit_pointer_p predicate interface.
* 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.
2013-09-14 14:43:05 -03:00