X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FPrimOps.cmm;h=0cf26b2b7fbd957a473aea1b86e7552510433f8e;hb=fff1f6194c3c39de53cd645bda9865fb131b1c68;hp=029b2b751a84b6de2a256a98dda77057dde9eb3e;hpb=17c8229adf9f268097e4c87053d940a918c3a26f;p=ghc-hetmet.git diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index 029b2b7..0cf26b2 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -34,7 +34,7 @@ import pthread_mutex_unlock; import base_ControlziExceptionziBase_nestedAtomically_closure; import EnterCriticalSection; import LeaveCriticalSection; -import ghczmprim_GHCziBool_False_closure; +import ghczmprim_GHCziTypes_False_closure; #if !defined(mingw32_HOST_OS) import sm_mutex; #endif @@ -109,6 +109,11 @@ stg_newAlignedPinnedByteArrayzh n = R1; alignment = R2; + /* we always supply at least word-aligned memory, so there's no + need to allow extra space for alignment if the requirement is less + than a word. This also prevents mischief with alignment == 0. */ + if (alignment <= SIZEOF_W) { alignment = 1; } + bytes = n; /* payload_words is what we will tell the profiler we had to allocate */ @@ -1318,7 +1323,7 @@ loop2: foreign "C" tryWakeupThread_(MyCapability() "ptr", tso) []; unlockClosure(mvar, stg_MVAR_DIRTY_info); - RET_P(val); + RET_NP(1,val); } @@ -1447,7 +1452,7 @@ loop: /* No further takes, the MVar is now full. */ StgMVar_value(mvar) = val; unlockClosure(mvar, stg_MVAR_DIRTY_info); - jump %ENTRY_CODE(Sp(0)); + RET_N(1); } if (StgHeader_info(q) == stg_IND_info || StgHeader_info(q) == stg_MSG_NULL_info) { @@ -1485,7 +1490,7 @@ loop2: foreign "C" tryWakeupThread_(MyCapability() "ptr", tso) []; unlockClosure(mvar, stg_MVAR_DIRTY_info); - jump %ENTRY_CODE(Sp(0)); + RET_N(1); } @@ -2009,17 +2014,28 @@ stg_getSparkzh W_ spark; #ifndef THREADED_RTS - RET_NP(0,ghczmprim_GHCziBool_False_closure); + RET_NP(0,ghczmprim_GHCziTypes_False_closure); #else (spark) = foreign "C" findSpark(MyCapability()); if (spark != 0) { RET_NP(1,spark); } else { - RET_NP(0,ghczmprim_GHCziBool_False_closure); + RET_NP(0,ghczmprim_GHCziTypes_False_closure); } #endif } +stg_numSparkszh +{ + W_ n; +#ifdef THREADED_RTS + (n) = foreign "C" dequeElements(Capability_sparks(MyCapability())); +#else + n = 0; +#endif + RET_N(n); +} + stg_traceEventzh { W_ msg;