[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lightning] jit_allocai

From: Paolo Bonzini
Subject: [Lightning] jit_allocai
Date: Fri, 03 Nov 2006 17:25:40 +0100
User-agent: Thunderbird (Macintosh/20060909)

Are you willing to give a stab at implementing jit_allocai? The interface should be that jit_allocai(N) returns a value RET usable as an offset in jit_ldxi(reg, JIT_FP, OFS), where RET <= OFS < RET + N.

If you do that for the SPARC (which I cannot test) and provide a testcase (maybe in the form of modifying rpn.c so that it does not use pushr/popr anymore?), I'll take care of x86 and PPC.

Patching the SAVE instruction should be as easy as this:

--- orig/lightning/sparc/core.h
+++ mod/lightning/sparc/core.h
@@ -62,6 +62,7 @@
struct jit_local_state {
  int  nextarg_put;    /* Next %o reg. to be written */
  int  nextarg_get;    /* Next %i reg. to be read */
+  jit_insn *save;      /* Pointer to SAVE instruction */
+   int delta;
  jit_insn delay;

@@ -240,7 +241,7 @@ struct jit_local_state {
#define jit_patch_at(delay_pc, pv)     jit_patch_ (((delay_pc) - 1) , (pv))
#define jit_popr_i(rs) (LDmr(JIT_SP, 0, (rs)), ADDrir(JIT_SP, 8, JIT_SP))
#define jit_prepare_i(num)             (_jitl.nextarg_put += (num))
-#define jit_prolog(numargs) (SAVErir(JIT_SP, -120, JIT_SP), _jitl.nextarg_get = _Ri(0)) +#define jit_prolog(numargs) ( = (jit_insn *) _jit.x.pc, = -120, SAVErir(JIT_SP, -120, JIT_SP), _jitl.nextarg_get = _Ri(0)) #define jit_pushr_i(rs) (STrm((rs), JIT_SP, -8), SUBrir(JIT_SP, 8, JIT_SP)) #define jit_pusharg_i(rs) (--_jitl.nextarg_put, MOVrr((rs), _Ro(_jitl.nextarg_put)))
#define jit_ret()                      (RET(), RESTORE())

and then doing this:

#define JIT_FP      _Ri(6)
#define jit_allocai (bytes) (* -= (bytes), -= (bytes))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]