PPC JIT fixup
This commit is contained in:
parent
0e590d3a76
commit
aacb98f51b
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
#ifdef MZ_USE_JIT
|
#ifdef MZ_USE_JIT
|
||||||
|
|
||||||
|
#define DEFINE_LIGHTNING_FUNCS
|
||||||
|
|
||||||
#include "jit.h"
|
#include "jit.h"
|
||||||
|
|
||||||
#ifdef MZ_PRECISE_GC
|
#ifdef MZ_PRECISE_GC
|
||||||
|
@ -2828,8 +2830,6 @@ int scheme_generate(Scheme_Object *obj, mz_jit_state *jitter, int is_tail, int w
|
||||||
/* procedure codegen */
|
/* procedure codegen */
|
||||||
/*========================================================================*/
|
/*========================================================================*/
|
||||||
|
|
||||||
#define NATIVE_ARG_COUNT 3
|
|
||||||
|
|
||||||
static void generate_function_prolog(mz_jit_state *jitter, void *code, int max_let_depth)
|
static void generate_function_prolog(mz_jit_state *jitter, void *code, int max_let_depth)
|
||||||
{
|
{
|
||||||
int in;
|
int in;
|
||||||
|
|
|
@ -51,7 +51,19 @@ END_XFORM_ARITH;
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MZ_USE_JIT_PPC
|
||||||
|
# ifndef DEFINE_LIGHTNING_FUNCS
|
||||||
|
# define SUPPRESS_LIGHTNING_FUNCS
|
||||||
|
# endif
|
||||||
|
# define DEFINE_LIGHTNING_FUNCS_STATIC /* empty */
|
||||||
|
# define jit_notify_freed_code scheme_jit_notify_freed_code
|
||||||
|
# define jit_flush_code scheme_jit_flush_code
|
||||||
|
# define _jit_prolog scheme_jit_prolog
|
||||||
|
# define _jit_epilog scheme_jit_epilog
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "lightning/lightning.h"
|
#include "lightning/lightning.h"
|
||||||
|
#define _jit (jitter->js)
|
||||||
|
|
||||||
#ifdef MZ_USE_JIT_X86_64
|
#ifdef MZ_USE_JIT_X86_64
|
||||||
# define JIT_LOG_WORD_SIZE 3
|
# define JIT_LOG_WORD_SIZE 3
|
||||||
|
@ -62,6 +74,8 @@ END_XFORM_ARITH;
|
||||||
#define WORDS_TO_BYTES(x) ((x) << JIT_LOG_WORD_SIZE)
|
#define WORDS_TO_BYTES(x) ((x) << JIT_LOG_WORD_SIZE)
|
||||||
#define MAX_TRY_SHIFT 30
|
#define MAX_TRY_SHIFT 30
|
||||||
|
|
||||||
|
#define NATIVE_ARG_COUNT 3
|
||||||
|
|
||||||
#define JIT_LOG_DOUBLE_SIZE 3
|
#define JIT_LOG_DOUBLE_SIZE 3
|
||||||
#define JIT_DOUBLE_SIZE (1 << JIT_LOG_DOUBLE_SIZE)
|
#define JIT_DOUBLE_SIZE (1 << JIT_LOG_DOUBLE_SIZE)
|
||||||
|
|
||||||
|
@ -631,7 +645,10 @@ int check_location;
|
||||||
# define jit_unshuffle_saved_regs() /* empty */
|
# define jit_unshuffle_saved_regs() /* empty */
|
||||||
# define mz_push_locals() /* empty */
|
# define mz_push_locals() /* empty */
|
||||||
# define mz_pop_locals() /* empty */
|
# define mz_pop_locals() /* empty */
|
||||||
static void _jit_prolog_again(mz_jit_state *jitter, int n, int ret_addr_reg)
|
# ifdef SUPPRESS_LIGHTNING_FUNCS
|
||||||
|
void scheme_jit_prolog_again(mz_jit_state *jitter, int n, int ret_addr_reg);
|
||||||
|
# else
|
||||||
|
void scheme_jit_prolog_again(mz_jit_state *jitter, int n, int ret_addr_reg)
|
||||||
{
|
{
|
||||||
/* This must be consistent with _jit_prolog in many ways: */
|
/* This must be consistent with _jit_prolog in many ways: */
|
||||||
int frame_size;
|
int frame_size;
|
||||||
|
@ -658,6 +675,8 @@ static void _jit_prolog_again(mz_jit_state *jitter, int n, int ret_addr_reg)
|
||||||
STWrm(ret_addr_reg, frame_size + 4, 1); /* stw r0, x+4(r1) */
|
STWrm(ret_addr_reg, frame_size + 4, 1); /* stw r0, x+4(r1) */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
|
# define _jit_prolog_again scheme_jit_prolog_again
|
||||||
#else
|
#else
|
||||||
/* From frame pointer, -1 is saved frame pointer, -2 is saved ESI/R12,
|
/* From frame pointer, -1 is saved frame pointer, -2 is saved ESI/R12,
|
||||||
and -3 is saved EDI/R13. On entry to a procedure, prolog pushes 4
|
and -3 is saved EDI/R13. On entry to a procedure, prolog pushes 4
|
||||||
|
@ -989,7 +1008,6 @@ static void emit_indentation(mz_jit_state *jitter)
|
||||||
/* jitstate */
|
/* jitstate */
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
#define _jit (jitter->js)
|
|
||||||
#ifdef SIXTY_FOUR_BIT_INTEGERS
|
#ifdef SIXTY_FOUR_BIT_INTEGERS
|
||||||
# define JIT_BUFFER_PAD_SIZE 200
|
# define JIT_BUFFER_PAD_SIZE 200
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -825,7 +825,7 @@ int scheme_do_generate_common(mz_jit_state *jitter, void *_data)
|
||||||
(void)jit_bnei_l(refloop, JIT_V1, 0);
|
(void)jit_bnei_l(refloop, JIT_V1, 0);
|
||||||
CHECK_LIMIT();
|
CHECK_LIMIT();
|
||||||
|
|
||||||
jit_movi_p(JIT_R0, SCHEME_MULTIPLE_VALUES);
|
(void)jit_movi_p(JIT_R0, SCHEME_MULTIPLE_VALUES);
|
||||||
|
|
||||||
mz_epilog(JIT_R1);
|
mz_epilog(JIT_R1);
|
||||||
CHECK_LIMIT();
|
CHECK_LIMIT();
|
||||||
|
|
|
@ -2860,7 +2860,7 @@ int scheme_generate_inlined_nary(mz_jit_state *jitter, Scheme_App_Rec *app, int
|
||||||
jit_movi_l(JIT_R0, 0);
|
jit_movi_l(JIT_R0, 0);
|
||||||
jit_stxi_l(((int)&((Scheme_Thread *)0x0)->ku.multiple.count), JIT_R2, JIT_R0);
|
jit_stxi_l(((int)&((Scheme_Thread *)0x0)->ku.multiple.count), JIT_R2, JIT_R0);
|
||||||
jit_stxi_p(((int)&((Scheme_Thread *)0x0)->ku.multiple.array), JIT_R2, JIT_R0);
|
jit_stxi_p(((int)&((Scheme_Thread *)0x0)->ku.multiple.array), JIT_R2, JIT_R0);
|
||||||
jit_movi_p(JIT_R0, SCHEME_MULTIPLE_VALUES);
|
(void)jit_movi_p(JIT_R0, SCHEME_MULTIPLE_VALUES);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -34,7 +34,18 @@
|
||||||
#ifndef __lightning_funcs_h
|
#ifndef __lightning_funcs_h
|
||||||
#define __lightning_funcs_h
|
#define __lightning_funcs_h
|
||||||
|
|
||||||
static void
|
#ifndef DEFINE_LIGHTNING_FUNCS_STATIC
|
||||||
|
# define DEFINE_LIGHTNING_FUNCS_STATIC static
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SUPPRESS_LIGHTNING_FUNCS
|
||||||
|
void jit_notify_freed_code(void);
|
||||||
|
void jit_flush_code(void *start, void *end);
|
||||||
|
void _jit_prolog(jit_state *jit, int n);
|
||||||
|
void _jit_epilog(jit_state *jit);
|
||||||
|
#else
|
||||||
|
|
||||||
|
DEFINE_LIGHTNING_FUNCS_STATIC void
|
||||||
jit_notify_freed_code(void)
|
jit_notify_freed_code(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -43,7 +54,7 @@ jit_notify_freed_code(void)
|
||||||
#error Go get GNU C, I do not know how to flush the cache
|
#error Go get GNU C, I do not know how to flush the cache
|
||||||
#error with this compiler.
|
#error with this compiler.
|
||||||
#else
|
#else
|
||||||
static void
|
DEFINE_LIGHTNING_FUNCS_STATIC void
|
||||||
jit_flush_code(void *start, void *end)
|
jit_flush_code(void *start, void *end)
|
||||||
{
|
{
|
||||||
#ifndef LIGHTNING_CROSS
|
#ifndef LIGHTNING_CROSS
|
||||||
|
@ -90,7 +101,7 @@ jit_flush_code(void *start, void *end)
|
||||||
|
|
||||||
#define _jit (*jit)
|
#define _jit (*jit)
|
||||||
|
|
||||||
static void
|
DEFINE_LIGHTNING_FUNCS_STATIC void
|
||||||
_jit_epilog(jit_state *jit)
|
_jit_epilog(jit_state *jit)
|
||||||
{
|
{
|
||||||
int n = _jitl.nbArgs;
|
int n = _jitl.nbArgs;
|
||||||
|
@ -135,7 +146,7 @@ _jit_epilog(jit_state *jit)
|
||||||
offset = 32 is enough to hold eight 4 bytes arguments. This is less
|
offset = 32 is enough to hold eight 4 bytes arguments. This is less
|
||||||
than perfect but is a reasonable work around for now.
|
than perfect but is a reasonable work around for now.
|
||||||
Better solution must be investigated. */
|
Better solution must be investigated. */
|
||||||
static void
|
DEFINE_LIGHTNING_FUNCS_STATIC void
|
||||||
_jit_prolog(jit_state *jit, int n)
|
_jit_prolog(jit_state *jit, int n)
|
||||||
{
|
{
|
||||||
int frame_size;
|
int frame_size;
|
||||||
|
@ -170,4 +181,6 @@ _jit_prolog(jit_state *jit, int n)
|
||||||
|
|
||||||
#undef _jit
|
#undef _jit
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __lightning_funcs_h */
|
#endif /* __lightning_funcs_h */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user