Commit 2b8f3628 authored by sewardj's avatar sewardj

[project @ 2001-08-07 09:02:02 by sewardj]

Do suspendThread/resumeThread round ccalls so that ccall_gc is supported.
parent 2f3ae06e
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
* Copyright (c) 1994-2000. * Copyright (c) 1994-2000.
* *
* $RCSfile: Interpreter.c,v $ * $RCSfile: Interpreter.c,v $
* $Revision: 1.26 $ * $Revision: 1.27 $
* $Date: 2001/08/03 15:05:52 $ * $Date: 2001/08/07 09:02:02 $
* ---------------------------------------------------------------------------*/ * ---------------------------------------------------------------------------*/
#include "Rts.h" #include "Rts.h"
...@@ -54,13 +54,18 @@ ...@@ -54,13 +54,18 @@
#define BCO_LIT(n) (W_)literals[n] #define BCO_LIT(n) (W_)literals[n]
#define BCO_ITBL(n) itbls[n] #define BCO_ITBL(n) itbls[n]
#define LOAD_STACK_POINTERS \ #define LOAD_STACK_POINTERS \
iSp = cap->rCurrentTSO->sp; iSu = cap->rCurrentTSO->su; iSp = cap->rCurrentTSO->sp; \
iSu = cap->rCurrentTSO->su; \
/* We don't change this ... */ \
iSpLim = cap->rCurrentTSO->stack + RESERVED_STACK_WORDS;
#define SAVE_STACK_POINTERS \ #define SAVE_STACK_POINTERS \
cap->rCurrentTSO->sp = iSp; cap->rCurrentTSO->su = iSu; cap->rCurrentTSO->sp = iSp; \
cap->rCurrentTSO->su = iSu;
#define RETURN(retcode) \ #define RETURN(retcode) \
SAVE_STACK_POINTERS; return retcode; SAVE_STACK_POINTERS; return retcode;
...@@ -169,9 +174,6 @@ StgThreadReturnCode interpretBCO ( Capability* cap ) ...@@ -169,9 +174,6 @@ StgThreadReturnCode interpretBCO ( Capability* cap )
LOAD_STACK_POINTERS; LOAD_STACK_POINTERS;
/* We don't change this ... */
iSpLim = cap->rCurrentTSO->stack + RESERVED_STACK_WORDS;
/* Main object-entering loop. Object to be entered is on top of /* Main object-entering loop. Object to be entered is on top of
stack. */ stack. */
nextEnter: nextEnter:
...@@ -762,9 +764,14 @@ StgThreadReturnCode interpretBCO ( Capability* cap ) ...@@ -762,9 +764,14 @@ StgThreadReturnCode interpretBCO ( Capability* cap )
} }
} }
case bci_CCALL: { case bci_CCALL: {
StgInt tok;
int o_itbl = BCO_NEXT; int o_itbl = BCO_NEXT;
void(*marshall_fn)(void*) = (void (*)(void*))BCO_LIT(o_itbl); void(*marshall_fn)(void*) = (void (*)(void*))BCO_LIT(o_itbl);
SAVE_STACK_POINTERS;
tok = suspendThread(cap);
marshall_fn ( (void*)(& StackWord(0) ) ); marshall_fn ( (void*)(& StackWord(0) ) );
cap = resumeThread(tok);
LOAD_STACK_POINTERS;
goto nextInsn; goto nextInsn;
} }
case bci_JMP: { case bci_JMP: {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment