diff options
author | simonmar <unknown> | 1999-11-05 12:28:06 +0000 |
---|---|---|
committer | simonmar <unknown> | 1999-11-05 12:28:06 +0000 |
commit | 0acf55e051292a01ca35b4401d7a357a5a73f9b4 (patch) | |
tree | 70c8642d58fc01e335029457e6c7f56b1dc26a1c | |
parent | d1650dab94b30dff6785874cddd4e758f6de292e (diff) | |
download | haskell-0acf55e051292a01ca35b4401d7a357a5a73f9b4.tar.gz |
[project @ 1999-11-05 12:28:05 by simonmar]
_ccall_GC wibbles
-rw-r--r-- | ghc/compiler/absCSyn/PprAbsC.lhs | 4 | ||||
-rw-r--r-- | ghc/includes/Stg.h | 8 | ||||
-rw-r--r-- | ghc/includes/StgMacros.h | 25 |
3 files changed, 29 insertions, 8 deletions
diff --git a/ghc/compiler/absCSyn/PprAbsC.lhs b/ghc/compiler/absCSyn/PprAbsC.lhs index ae61d06fd6..197bee54cc 100644 --- a/ghc/compiler/absCSyn/PprAbsC.lhs +++ b/ghc/compiler/absCSyn/PprAbsC.lhs @@ -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) diff --git a/ghc/includes/Stg.h b/ghc/includes/Stg.h index 756e8fb51a..19c37116c6 100644 --- a/ghc/includes/Stg.h +++ b/ghc/includes/Stg.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $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 */ diff --git a/ghc/includes/StgMacros.h b/ghc/includes/StgMacros.h index 2d46443b8f..8ca1f919e6 100644 --- a/ghc/includes/StgMacros.h +++ b/ghc/includes/StgMacros.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $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 */ |