}
#endif
-/* -----------------------------------------------------------------------------
- ** temporary **
-
- classes CCallable and CReturnable don't really exist, but the
- compiler insists on generating dictionaries containing references
- to GHC_ZcCCallable_static_info etc., so we provide dummy symbols
- for these. Some C compilers can't cope with zero-length static arrays,
- so we have to make these one element long.
- --------------------------------------------------------------------------- */
-
-section "rodata" {
- GHC_ZCCCallable_static_info: W_ 0;
-}
-
-section "rodata" {
- GHC_ZCCReturnable_static_info: W_ 0;
+// noDuplicate# tries to ensure that none of the thunks under
+// evaluation by the current thread are also under evaluation by
+// another thread. It relies on *both* threads doing noDuplicate#;
+// the second one will get blocked if they are duplicating some work.
+noDuplicatezh_fast
+{
+ SAVE_THREAD_STATE();
+ ASSERT(StgTSO_what_next(CurrentTSO) == ThreadRunGHC::I16);
+ foreign "C" threadPaused (MyCapability() "ptr", CurrentTSO "ptr") [];
+
+ if (StgTSO_what_next(CurrentTSO) == ThreadKilled::I16) {
+ R1 = ThreadFinished;
+ jump StgReturn;
+ } else {
+ LOAD_THREAD_STATE();
+ ASSERT(StgTSO_what_next(CurrentTSO) == ThreadRunGHC::I16);
+ jump %ENTRY_CODE(Sp(0));
+ }
}