1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-13 23:27:12 +00:00

Replace StkOffset related macros with StackOffset inline functions

This commit is contained in:
Nick Briggs 2022-09-28 15:17:53 -07:00
parent fcc62953d8
commit 344351acba
3 changed files with 17 additions and 21 deletions

View File

@ -68,7 +68,7 @@
{ DLword midpunt; \
midpunt = LOLOC(LAddrFromNative(CURRENTFX)); \
PVar=(DLword *) \
Addr68k_from_StkOffset( \
NativeAligned2FromStackOffset( \
(GETWORD(((DLword *)InterfacePage) + (fxnum)))) \
+ FRAMESIZE; \
GETWORD(((DLword *)InterfacePage) + (fxnum)) = midpunt ; \
@ -88,7 +88,7 @@
#define BEFORE_CONTEXTSW \
{ CurrentStackPTR += 2; \
CURRENTFX->nextblock=StkOffset_from_68K(CurrentStackPTR); \
CURRENTFX->nextblock=StackOffsetFromNative(CurrentStackPTR); \
GETWORD(CurrentStackPTR)=STK_FSB_WORD; \
GETWORD(CurrentStackPTR+1)= (((UNSIGNED)EndSTKP-(UNSIGNED)(CurrentStackPTR))>>1); \
if (GETWORD(CurrentStackPTR+1) == 0) error("0-long free block."); \
@ -97,7 +97,7 @@
#define AFTER_CONTEXTSW \
{ DLword *ac_ptr68k,*ac_freeptr; \
ac_ptr68k = (DLword*)Addr68k_from_StkOffset(CURRENTFX->nextblock); \
ac_ptr68k = (DLword*)NativeAligned2FromStackOffset(CURRENTFX->nextblock); \
if(GETWORD(ac_ptr68k) != STK_FSB_WORD) error("pre_moveframe: MP9316"); \
CHECK_FX(CURRENTFX); \
ac_freeptr=ac_ptr68k; \

View File

@ -307,7 +307,7 @@ typedef struct stackp {
#define SET_FASTP_NIL(fx68k) \
{ \
if (FASTP(fx68k)) { \
((FX *)(fx68k))->blink = StkOffset_from_68K(DUMMYBF(fx68k)); \
((FX *)(fx68k))->blink = StackOffsetFromNative(DUMMYBF(fx68k)); \
((FX *)(fx68k))->clink = ((FX *)(fx68k))->alink; \
SLOWP(fx68k) = T; \
} \
@ -411,7 +411,7 @@ typedef struct stackp {
if (check_stack_rooms(fx68k) > 1000) { \
warn("moveframe:there is more than 100 words SPACE for FX"); \
printf("# When calling "); \
tos_on_stack = (LispPTR *)Addr68k_from_StkOffset((fx68k)->nextblock - 2); \
tos_on_stack = (LispPTR *)NativeAligned4FromStackOffset((fx68k)->nextblock - 2); \
print_atomname(*tos_on_stack); \
printf("\n"); \
stack_check(0); \

View File

@ -202,9 +202,8 @@
BCE_CURRENTFX->pc = ((UNSIGNED)PCMAC - (UNSIGNED)FuncObj) + FN_OPCODE_SIZE; \
FN_STACK_CHECK; \
{ \
UNSIGNED newivar; \
newivar = (UNSIGNED)(IVARL = (DLword *)(CSTKPTR - (argcount) + 1)); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StkOffset_from_68K(newivar); \
IVARL = (DLword *)(CSTKPTR - (argcount) + 1); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StackOffsetFromNative(IVARL); \
} \
HARD_PUSH(TOPOFSTACK); /* save TOS */ \
if (LOCFNCELL->na >= 0) { \
@ -218,7 +217,7 @@
} /* if end */ \
/* Set up BF */ \
HARD_PUSH(BF_MARK32 | NEXTBLOCK); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StkOffset_from_68K(PVAR)); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StackOffsetFromNative(PVAR)); \
((struct frameex2 *)CSTKPTR)->fnheader = SWAP_FNHEAD(defcell_word); \
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *)CSTKPTR; \
@ -258,9 +257,8 @@
BCE_CURRENTFX->pc = ((UNSIGNED)PCMAC - (UNSIGNED)FuncObj) + FNX_OPCODE_SIZE; \
FN_STACK_CHECK; \
{ \
UNSIGNED newivar; \
newivar = (UNSIGNED)(IVARL = (DLword *)(CSTKPTR - num_args + 1)); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StkOffset_from_68K(newivar); \
IVARL = (DLword *)(CSTKPTR - num_args + 1); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StackOffsetFromNative(IVARL); \
} \
HARD_PUSH(TOPOFSTACK); /* save TOS */ \
if (LOCFNCELL->na >= 0) { \
@ -274,7 +272,7 @@
} /* if end */ \
/* Set up BF */ \
HARD_PUSH(BF_MARK32 | NEXTBLOCK); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StkOffset_from_68K(PVAR)); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StackOffsetFromNative(PVAR)); \
((struct frameex2 *)CSTKPTR)->fnheader = SWAP_FNHEAD(defcell->defpointer); \
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *)CSTKPTR; \
@ -372,9 +370,8 @@
FN_STACK_CHECK; \
APPLY_POP_PUSH_TEST; \
{ \
UNSIGNED newivar; \
newivar = (UNSIGNED)(IVARL = (DLword *)(CSTKPTR + (1 - fn_num_args - needpush))); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StkOffset_from_68K(newivar); \
IVARL = (DLword *)(CSTKPTR + (1 - fn_num_args - needpush)); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StackOffsetFromNative(IVARL); \
} \
HARD_PUSH(TOPOFSTACK); /* save TOS */ \
if (LOCFNCELL->na >= 0) { \
@ -389,7 +386,7 @@
/* Set up BF */ \
HARD_PUSH(BF_MARK32 | NEXTBLOCK); \
} /* NEXTBLOCK BLOCK */ \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StkOffset_from_68K(PVAR)); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StackOffsetFromNative(PVAR)); \
((struct frameex2 *)CSTKPTR)->fnheader = SWAP_FNHEAD(defcell->defpointer); \
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *)CSTKPTR; \
@ -441,9 +438,8 @@
FN_STACK_CHECK; \
CSTKPTRL -= 2; \
{ \
UNSIGNED newivar; \
newivar = (UNSIGNED)(IVARL = (DLword *)(CSTKPTR - num_args)); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StkOffset_from_68K(newivar); \
IVARL = (DLword *)(CSTKPTR - num_args); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StackOffsetFromNative(IVARL);\
} \
if (LOCFNCELL->na >= 0) { \
int RESTARGS; \
@ -456,7 +452,7 @@
} /* if end */ \
/* Set up BF */ \
HARD_PUSH(BF_MARK32 | NEXTBLOCK); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StkOffset_from_68K(PVAR)); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StackOffsetFromNative(PVAR)); \
((struct frameex2 *)CSTKPTR)->fnheader = SWAP_FNHEAD(Fn_DefCell); \
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *)CSTKPTR; \