Browse Source

PPC: Add support for shifted MULTRES.

Mike Pall 15 years ago
parent
commit
8a87395d8d
2 changed files with 6 additions and 1 deletions
  1. 1 1
      src/lj_dispatch.c
  2. 5 0
      src/lj_frame.h

+ 1 - 1
src/lj_dispatch.c

@@ -355,7 +355,7 @@ void LJ_FASTCALL lj_dispatch_ins(lua_State *L, const BCIns *pc)
   global_State *g = G(L);
   BCReg slots;
   setcframe_pc(cf, pc);
-  slots = cur_topslot(pt, pc, cframe_multres(cf));
+  slots = cur_topslot(pt, pc, cframe_multres_n(cf));
   L->top = L->base + slots;  /* Fix top. */
 #if LJ_HASJIT
   {

+ 5 - 0
src/lj_frame.h

@@ -67,6 +67,7 @@ enum {
 #define CFRAME_OFS_MULTRES	(5*4)
 #define CFRAME_SIZE		(12*4)
 #define CFRAME_SIZE_JIT		CFRAME_SIZE
+#define CFRAME_SHIFT_MULTRES	0
 #elif LJ_TARGET_X64
 #if _WIN64
 #define CFRAME_OFS_PREV		(13*8)
@@ -77,6 +78,7 @@ enum {
 #define CFRAME_OFS_MULTRES	(21*4)
 #define CFRAME_SIZE		(10*8)
 #define CFRAME_SIZE_JIT		(CFRAME_SIZE + 9*16 + 4*8)
+#define CFRAME_SHIFT_MULTRES	0
 #else
 #define CFRAME_OFS_PREV		(4*8)
 #define CFRAME_OFS_PC		(7*4)
@@ -86,6 +88,7 @@ enum {
 #define CFRAME_OFS_MULTRES	(1*4)
 #define CFRAME_SIZE		(10*8)
 #define CFRAME_SIZE_JIT		(CFRAME_SIZE + 16)
+#define CFRAME_SHIFT_MULTRES	0
 #endif
 #elif LJ_TARGET_PPCSPE
 #define CFRAME_OFS_ERRF		28
@@ -96,6 +99,7 @@ enum {
 #define CFRAME_OFS_MULTRES	8
 #define CFRAME_SIZE		176
 #define CFRAME_SIZE_JIT		CFRAME_SIZE
+#define CFRAME_SHIFT_MULTRES	3
 #else
 #error "Missing CFRAME_* definitions for this architecture"
 #endif
@@ -108,6 +112,7 @@ enum {
 #define cframe_nres(cf)		(*(int32_t *)(((char *)(cf))+CFRAME_OFS_NRES))
 #define cframe_prev(cf)		(*(void **)(((char *)(cf))+CFRAME_OFS_PREV))
 #define cframe_multres(cf)  (*(uint32_t *)(((char *)(cf))+CFRAME_OFS_MULTRES))
+#define cframe_multres_n(cf)	(cframe_multres((cf)) >> CFRAME_SHIFT_MULTRES)
 #define cframe_L(cf) \
   (&gcref(*(GCRef *)(((char *)(cf))+CFRAME_OFS_L))->th)
 #define cframe_pc(cf) \