1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-21 19:20:21 +02:00

Adapt PowerPC port to work in Darwin 32 bit and Linux 64 bit.

* include/lightning.h: Add check for __powerpc__ defined
	in Linux, while Darwin defines __ppc__.

	* include/lightning/jit_ppc.h: Adjust register definitions
	for Darwin 32 bit and Linux 64 bit ppc usage and/or ABI.

	* include/lightning/jit_private.h: Add proper check for
	Linux __powerpc__ and an data definition for an workaround
	to properly handle code that starts with a jump to a "main"
	label.

	* lib/jit_disasm.c: Add extra disassembler initialization
	for __powerpc64__.

	* lib/jit_ppc-cpu.c: Add extra macros and functions, and
	correct/adapt previous ones to handle powerpc64.

	* lib/jit_ppc-fpu.c: Adapt for 64 bit wordsize. Basically
	add conversion from/to int32/int64 and proper handling of
	load/store offsets too large for 32 bit.

	* lib/jit_ppc.c: Add calls to 64 bit codes and adaptation
	for the PowerPC 64 bit Linux ABI.

	* lib/jit_arm.c, lib/jit_mips.c, lib/jit_sparc, lib/jit_x86.c,
	lib/lightning.c: Correct off by one error when restarting jit
	of a function due to finding too late that needs to spill/reload
	some register. Problem was found by accident on a very special
	condition during PowerPC 64 code adaptation.
This commit is contained in:
pcpa 2013-03-10 15:36:25 -03:00
parent 19123bae5d
commit 7ef8060fb2
13 changed files with 1038 additions and 123 deletions

View file

@ -587,6 +587,11 @@ _jit_clear_state(jit_state_t *_jit)
_jitc->data_info.ptr = NULL;
#endif
#if __powerpc64__
free(_jitc->prolog.ptr);
_jitc->prolog.ptr = NULL;
#endif
free(_jitc);
}
@ -1402,7 +1407,9 @@ _jit_emit(jit_state_t *_jit)
for (;;) {
if ((code = emit_code()) == NULL) {
for (node = _jitc->head; node; node = node->next) {
if (node->code == jit_code_label && node->link)
if (node->link &&
(node->code == jit_code_label ||
node->code == jit_code_epilog))
node->flag &= ~jit_flag_patch;
}
++mult;
@ -1439,7 +1446,7 @@ _jit_emit(jit_state_t *_jit)
result = mprotect(_jit->code.ptr, _jit->code.length, PROT_READ | PROT_EXEC);
assert(result == 0);
return (code);
return (_jit->code.ptr);
}
/* Compute initial reglive and regmask set values of a basic block.
@ -2605,7 +2612,7 @@ _patch_register(jit_state_t *_jit, jit_node_t *node, jit_node_t *link,
# include "jit_mips.c"
#elif defined(__arm__)
# include "jit_arm.c"
#elif defined(__ppc__)
#elif defined(__ppc__) || defined(__powerpc__)
# include "jit_ppc.c"
#elif defined(__sparc__)
# include "jit_sparc.c"