diff options
author | Ben.Lippmeier@anu.edu.au <unknown> | 2009-01-21 05:23:34 +0000 |
---|---|---|
committer | Ben.Lippmeier@anu.edu.au <unknown> | 2009-01-21 05:23:34 +0000 |
commit | 7a4d66554399710b474a4497cbbe4bc5846f4f04 (patch) | |
tree | 8de1f1b5057cca78638b89e784e137b46e66caed /rts/RtsAPI.c | |
parent | 87b5b19f2166dab386aab7d58aae9bb25264b92b (diff) | |
download | haskell-7a4d66554399710b474a4497cbbe4bc5846f4f04.tar.gz |
SPARC NCG: Add a SPARC version of rts_mkInt64 that handles misaligned closure payloads.
Diffstat (limited to 'rts/RtsAPI.c')
-rw-r--r-- | rts/RtsAPI.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/rts/RtsAPI.c b/rts/RtsAPI.c index d0bdead1c9..9fa0e01427 100644 --- a/rts/RtsAPI.c +++ b/rts/RtsAPI.c @@ -74,6 +74,31 @@ rts_mkInt32 (Capability *cap, HsInt32 i) return p; } + +#ifdef sparc_HOST_ARCH +/* The closures returned by allocateLocal are only guaranteed to be 32 bit + aligned, because that's the size of pointers. SPARC v9 can't do + misaligned loads/stores, so we have to write the 64bit word in chunks */ + +HaskellObj +rts_mkInt64 (Capability *cap, HsInt64 i_) +{ + StgInt64 i = (StgInt64)i_; + StgInt32 *tmp; + + StgClosure *p = (StgClosure *)allocateLocal(cap,CONSTR_sizeW(0,2)); + SET_HDR(p, I64zh_con_info, CCS_SYSTEM); + + tmp = (StgInt32*)&(p->payload[0]); + + tmp[0] = (StgInt32)((StgInt64)i >> 32); + tmp[1] = (StgInt32)i; /* truncate high 32 bits */ + + return p; +} + +#else + HaskellObj rts_mkInt64 (Capability *cap, HsInt64 i) { @@ -85,6 +110,9 @@ rts_mkInt64 (Capability *cap, HsInt64 i) return p; } +#endif /* sparc_HOST_ARCH */ + + HaskellObj rts_mkWord (Capability *cap, HsWord i) { |