X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FPrimOps.cmm;h=cd9a5bf2fe755cda285311b24776bee0241f1599;hb=70b761657f7707075302d7fa9f1ddba41247539e;hp=dc60ff2457ec14267485584ca7886be6f35686ff;hpb=8a317b223ac681f99e75f9a4a89380c92d283049;p=ghc-hetmet.git diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index dc60ff2..cd9a5bf 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -91,24 +91,17 @@ newPinnedByteArrayzh_fast n = R1; payload_words = ROUNDUP_BYTES_TO_WDS(n); - // We want an 8-byte aligned array. allocatePinned() gives us + // We want a 16-byte aligned array. allocatePinned() gives us // 8-byte aligned memory by default, but we want to align the // *goods* inside the ArrWords object, so we have to check the // size of the ArrWords header and adjust our size accordingly. - words = BYTES_TO_WDS(SIZEOF_StgArrWords) + payload_words; - if ((SIZEOF_StgArrWords & 7) != 0) { - words = words + 1; - } + words = payload_words + ((SIZEOF_StgArrWords + 15) & ~15); ("ptr" p) = foreign "C" allocatePinned(words) []; TICK_ALLOC_PRIM(SIZEOF_StgArrWords,WDS(payload_words),0); - // Again, if the ArrWords header isn't a multiple of 8 bytes, we - // have to push the object forward one word so that the goods - // fall on an 8-byte boundary. - if ((SIZEOF_StgArrWords & 7) != 0) { - p = p + WDS(1); - } + // Push the pointer forward so that the goods fall on a 16-byte boundary. + p = p + ((p + SIZEOF_StgArrWords) & 15); SET_HDR(p, stg_ARR_WORDS_info, W_[CCCS]); StgArrWords_words(p) = payload_words; @@ -2362,6 +2355,26 @@ getApStackValzh_fast RET_NP(ok,val); } +/* ----------------------------------------------------------------------------- + Misc. primitives + -------------------------------------------------------------------------- */ + +// Write the cost center stack of the first argument on stderr; return +// the second. Possibly only makes sense for already evaluated +// things? +traceCcszh_fast +{ + W_ ccs; + +#ifdef PROFILING + ccs = StgHeader_ccs(UNTAG(R1)); + foreign "C" fprintCCS_stderr(ccs "ptr") [R2]; +#endif + + R1 = R2; + ENTER(); +} + getSparkzh_fast { W_ spark;