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,7 +1472,17 @@ cgenRecordTypeSpec n attr fs
when (A.packedRecord attr || A.mobileRecord attr) $ tell [" occam_struct_packed "]
genName n
tell [";"]
tell ["const word "]
if null [t | (_, A.Mobile t) <- fs]
then do tell ["const word "]
genName n
tell ["_mttype = MT_SIMPLE | MT_MAKE_TYPE(MT_DATA);"]
tell ["const int "]
genName n
tell ["_mtsize = sizeof("]
genName n
tell [");"]
-- Not quite certain CCSP handles these descriptors:
else do tell ["const word "]
genName n
tell ["_mttype[", show (length mtEntries), "] = {"]
seqComma mtEntries
@ -2042,7 +2052,9 @@ mobileElemType (A.Record n)
genName n
tell ["_mttype"]
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 _ v