Fiddled with the code supplying the mobile types to MTAlloc

This commit is contained in:
Neil Brown 2009-03-20 21:20:43 +00:00
parent 03f1b2d115
commit f5fa5e5caf

View File

@ -1472,14 +1472,24 @@ cgenRecordTypeSpec n attr fs
when (A.packedRecord attr || A.mobileRecord attr) $ tell [" occam_struct_packed "] when (A.packedRecord attr || A.mobileRecord attr) $ tell [" occam_struct_packed "]
genName n genName n
tell [";"] tell [";"]
tell ["const word "] if null [t | (_, A.Mobile t) <- fs]
genName n then do tell ["const word "]
tell ["_mttype[", show (length mtEntries), "] = {"] genName n
seqComma mtEntries tell ["_mttype = MT_SIMPLE | MT_MAKE_TYPE(MT_DATA);"]
tell ["};"] tell ["const int "]
tell ["const int "] genName n
genName n tell ["_mtsize = sizeof("]
tell ["_mtsize = ", show (length mtEntries), ";"] genName n
tell [");"]
-- Not quite certain CCSP handles these descriptors:
else do tell ["const word "]
genName n
tell ["_mttype[", show (length mtEntries), "] = {"]
seqComma mtEntries
tell ["};"]
tell ["const int "]
genName n
tell ["_mtsize = ", show (length mtEntries), ";"]
where where
mtEntries :: [CGen ()] mtEntries :: [CGen ()]
mtEntries = concatMap (mt . snd) fs mtEntries = concatMap (mt . snd) fs
@ -2042,7 +2052,9 @@ mobileElemType (A.Record n)
genName n genName n
tell ["_mttype"] tell ["_mttype"]
mobileElemType A.Int = mobileElemType cIntReplacement mobileElemType A.Int = mobileElemType cIntReplacement
mobileElemType t = tell ["MT_NUM_", showOccam t] mobileElemType t = tell ["MT_SIMPLE|MT_MAKE_TYPE(MT_DATA)"]
-- Looks like CCSP may not support NUM with MTAlloc:
-- tell ["MT_MAKE_NUM(MT_NUM_", showOccam t,")"]
cgenClearMobile :: Meta -> A.Variable -> CGen () cgenClearMobile :: Meta -> A.Variable -> CGen ()
cgenClearMobile _ v cgenClearMobile _ v