Commit b09ab92b authored by Simon Marlow's avatar Simon Marlow

Windows: remove the {Enter,Leave}CricialSection wrappers

The C-- parser was missing the "stdcall" calling convention for
foreign calls, but once added we can call {Enter,Leave}CricialSection
directly.
parent 7605f65c
......@@ -891,6 +891,7 @@ foreignCall
foreignCall conv_string results_code expr_code args_code vols safety ret
= do convention <- case conv_string of
"C" -> return CCallConv
"stdcall" -> return StdCallConv
"C--" -> return CmmCallConv
_ -> fail ("unknown calling convention: " ++ conv_string)
return $ do
......
......@@ -16,8 +16,8 @@
#if CMINUSMINUS
#define ACQUIRE_LOCK(mutex) pthread_mutex_lock(mutex)
#define RELEASE_LOCK(mutex) pthread_mutex_unlock(mutex)
#define ACQUIRE_LOCK(mutex) foreign "C" pthread_mutex_lock(mutex)
#define RELEASE_LOCK(mutex) foreign "C" pthread_mutex_unlock(mutex)
#define ASSERT_LOCK_HELD(mutex) /* nothing */
#else
......@@ -85,8 +85,8 @@ typedef pthread_key_t ThreadLocalKey;
/* We jump through a hoop here to get a CCall EnterCriticalSection
and LeaveCriticalSection, as that's what C-- wants. */
#define ACQUIRE_LOCK(mutex) CCallEnterCriticalSection(mutex)
#define RELEASE_LOCK(mutex) CCallLeaveCriticalSection(mutex)
#define ACQUIRE_LOCK(mutex) foreign "stdcall" EnterCriticalSection(mutex)
#define RELEASE_LOCK(mutex) foreign "stdcall" LeaveCriticalSection(mutex)
#define ASSERT_LOCK_HELD(mutex) /* nothing */
#else
......
......@@ -873,7 +873,7 @@ stg_block_blackhole_finally
// The last thing we do is release sched_lock, which is
// preventing other threads from accessing blackhole_queue and
// picking up this thread before we are finished with it.
foreign "C" RELEASE_LOCK(sched_mutex "ptr");
RELEASE_LOCK(sched_mutex "ptr");
#endif
jump StgReturn;
}
......
......@@ -229,7 +229,7 @@ atomicModifyMutVarzh_fast
HP_CHK_GEN_TICKY(SIZE, R1_PTR & R2_PTR, atomicModifyMutVarzh_fast);
#if defined(THREADED_RTS)
foreign "C" ACQUIRE_LOCK(atomic_modify_mutvar_mutex "ptr") [R1,R2];
ACQUIRE_LOCK(atomic_modify_mutvar_mutex "ptr") [R1,R2];
#endif
x = StgMutVar_var(R1);
......@@ -260,7 +260,7 @@ atomicModifyMutVarzh_fast
StgThunk_payload(r,0) = z;
#if defined(THREADED_RTS)
foreign "C" RELEASE_LOCK(atomic_modify_mutvar_mutex "ptr") [];
RELEASE_LOCK(atomic_modify_mutvar_mutex "ptr") [];
#endif
RET_P(r);
......
......@@ -304,7 +304,7 @@ INFO_TABLE(stg_BLACKHOLE,0,1,BLACKHOLE,"BLACKHOLE","BLACKHOLE")
LDV_ENTER(R1);
#if defined(THREADED_RTS)
foreign "C" ACQUIRE_LOCK(sched_mutex "ptr");
ACQUIRE_LOCK(sched_mutex "ptr");
// released in stg_block_blackhole_finally
#endif
......@@ -369,7 +369,7 @@ INFO_TABLE(stg_CAF_BLACKHOLE,0,1,CAF_BLACKHOLE,"CAF_BLACKHOLE","CAF_BLACKHOLE")
#endif
#if defined(THREADED_RTS)
foreign "C" ACQUIRE_LOCK(sched_mutex "ptr");
ACQUIRE_LOCK(sched_mutex "ptr");
// released in stg_block_blackhole_finally
#endif
......
......@@ -232,14 +232,6 @@ forkOS_createThread ( HsStablePtr entry )
(unsigned*)&pId) == 0);
}
void CCallEnterCriticalSection(LPCRITICAL_SECTION s) {
EnterCriticalSection(s);
}
void CCallLeaveCriticalSection(LPCRITICAL_SECTION s) {
LeaveCriticalSection(s);
}
#else /* !defined(THREADED_RTS) */
int
......
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