Realised that allocating mobile arrays as arrays of bytes screws up the resize intrinsic, and gave it a helping hand

This commit is contained in:
Neil Brown 2009-03-23 21:28:28 +00:00
parent d3f4ff1a9a
commit 10b4cd7cfc
2 changed files with 8 additions and 3 deletions

View File

@ -1971,6 +1971,11 @@ cgenIntrinsicProc m "ASSERT" [A.ActualExpression e] = call genAssert m e
cgenIntrinsicProc _ "RESCHEDULE" [] = call genReschedule cgenIntrinsicProc _ "RESCHEDULE" [] = call genReschedule
cgenIntrinsicProc m s as = case lookup s intrinsicProcs of cgenIntrinsicProc m s as = case lookup s intrinsicProcs of
Just amtns -> do tell ["occam_", [if c == '.' then '_' else c | c <- s], "(wptr,"] Just amtns -> do tell ["occam_", [if c == '.' then '_' else c | c <- s], "(wptr,"]
when (s == "RESIZE.MOBILE.ARRAY.1D") $
do let mob = head as
A.Mobile (A.Array _ t) <- astTypeOf mob
call genBytesIn m t (Left False)
tell [","]
seqComma [call genActual (A.Formal am t (A.Name emptyMeta n)) a seqComma [call genActual (A.Formal am t (A.Name emptyMeta n)) a
| ((am, t, n), a) <- zip amtns as] | ((am, t, n), a) <- zip amtns as]
tell [");"] tell [");"]

View File

@ -50,9 +50,9 @@ static inline void tock_init_chan_array (Channel *pointTo, Channel **pointFrom,
//}}} //}}}
//{{{ mobile intrinsics //{{{ mobile intrinsics
static inline void occam_RESIZE_MOBILE_ARRAY_1D (Workspace wptr, mt_array_t ** pptr, const int count) occam_unused; static inline void occam_RESIZE_MOBILE_ARRAY_1D (Workspace wptr, const int element_size, mt_array_t ** pptr, const int count) occam_unused;
static inline void occam_RESIZE_MOBILE_ARRAY_1D (Workspace wptr, mt_array_t ** pptr, const int count) { static inline void occam_RESIZE_MOBILE_ARRAY_1D (Workspace wptr, const int element_size, mt_array_t ** pptr, const int count) {
*pptr = MTResize1D (wptr, *pptr, count); *pptr = MTResize1D (wptr, *pptr, count*element_size);
(*pptr)->dimensions[0] = count; (*pptr)->dimensions[0] = count;
} }