Commit 0acf55e0 authored by simonmar's avatar simonmar

[project @ 1999-11-05 12:28:05 by simonmar]

_ccall_GC wibbles
parent d1650dab
......@@ -787,8 +787,8 @@ pprCCall op@(CCallOp op_str is_asm may_gc cconv) args results vol_regs
where
(pp_saves, pp_restores) = ppr_vol_regs vol_regs
(pp_save_context, pp_restore_context)
| may_gc = ( text "do { I_ id; SaveThreadState(); id = suspendThread(BaseReg);"
, text "BaseReg = resumeThread(id); LoadThreadState();} while(0);"
| may_gc = ( text "{ I_ id; SUSPEND_THREAD(id);"
, text "RESUME_THREAD(id);}"
)
| otherwise = ( pp_basic_saves $$ pp_saves,
pp_basic_restores $$ pp_restores)
......
/* -----------------------------------------------------------------------------
* $Id: Stg.h,v 1.18 1999/11/02 15:05:52 simonmar Exp $
* $Id: Stg.h,v 1.19 1999/11/05 12:28:05 simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -22,9 +22,11 @@
* be in vanilla C.
*/
#ifdef NOT_IN_STG_CODE
#define NO_REGS /* don't define fixed registers */
# ifndef NO_REGS
# define NO_REGS /* don't define fixed registers */
# endif
#else
#define IN_STG_CODE
# define IN_STG_CODE
#endif
/* Configuration */
......
/* -----------------------------------------------------------------------------
* $Id: StgMacros.h,v 1.15 1999/11/02 17:04:28 simonmar Exp $
* $Id: StgMacros.h,v 1.16 1999/11/05 12:28:05 simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -412,6 +412,7 @@ EDI_(stg_gen_chk_info);
Misc
-------------------------------------------------------------------------- */
/* set the tag register (if we have one) */
#define SET_TAG(t) /* nothing */
......@@ -660,7 +661,7 @@ extern DLL_IMPORT_DATA const StgPolyInfoTable seq_frame_info;
we have one).
-------------------------------------------------------------------------- */
#ifndef NO_REGS
#ifdef IN_STG_CODE
static __inline__ void
SaveThreadState(void)
......@@ -702,7 +703,11 @@ LoadThreadState (void)
# endif
}
#endif /* NO_REGS */
#endif
/* -----------------------------------------------------------------------------
Support for _ccall_GC_ and _casm_GC.
-------------------------------------------------------------------------- */
/*
* Suspending/resuming threads for doing external C-calls (_ccall_GC).
......@@ -711,5 +716,19 @@ LoadThreadState (void)
StgInt suspendThread ( StgRegTable *cap );
StgRegTable * resumeThread ( StgInt );
#define SUSPEND_THREAD(token) \
SaveThreadState(); \
token = suspendThread(BaseReg);
#ifdef SMP
#define RESUME_THREAD(token) \
BaseReg = resumeThread(token); \
LoadThreadState();
#else
#define RESUME_THREAD(token) \
(void)resumeThread(token); \
LoadThreadState();
#endif
#endif /* STGMACROS_H */
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