@@ -5142,6 +5142,11 @@ lrtsOpenTerm lrts =
5142
5142
(ctorOpenTerm " Prelude.Nil1" [tp])
5143
5143
lrts
5144
5144
5145
+ -- | Make the type @List1 LetRecType@ of recursive function frames
5146
+ frameTypeOpenTerm :: OpenTerm
5147
+ frameTypeOpenTerm = dataTypeOpenTerm " Prelude.List1" [dataTypeOpenTerm
5148
+ " Prelude.LetRecType" [] ]
5149
+
5145
5150
-- | FIXME HERE NOW: docs
5146
5151
tcTranslateAddCFGs ::
5147
5152
HasPtrWidth w => SharedContext -> ModuleName -> PermEnv -> ChecksFlag ->
@@ -5164,16 +5169,22 @@ tcTranslateAddCFGs sc mod_name env checks endianness dlevel cfgs_and_perms =
5164
5169
(" With type:\n " ++ permPrettyString emptyPPInfo fun_perm) $
5165
5170
tcCFG ? ptrWidth tmp_env1 endianness dlevel fun_perm cfg
5166
5171
5167
- -- Next, generate a list of all the LetRecTypes in all of the functions,
5168
- -- along with a list of indices into that list of where the LRTs of each
5169
- -- function are in that list
5172
+ -- Next, generate a frame, i.e., a list of all the LetRecTypes in all of the
5173
+ -- functions, along with a list of indices into that list of where the LRTs
5174
+ -- of each function are in that list, and make a definition for the frame
5170
5175
let gen_lrts_ixs (i:: Natural ) (SomeTypedCFG _ _ tcfg : tcfgs') =
5171
5176
let lrts = translateCFGLRTs env tcfg in
5172
5177
(i, lrts) : gen_lrts_ixs (i + fromIntegral (length lrts)) tcfgs'
5173
5178
gen_lrts_ixs _ [] = []
5174
5179
let (fun_ixs, lrtss) = unzip $ gen_lrts_ixs 0 tcfgs
5175
5180
let lrts = concat lrtss
5176
- let frame = lrtsOpenTerm lrts
5181
+ frame_tm <- completeNormOpenTerm sc $ lrtsOpenTerm lrts
5182
+ let frame_ident =
5183
+ mkSafeIdent mod_name (someCFGAndPermToName (head cfgs_and_perms)
5184
+ ++ " __frame" )
5185
+ frame_tp <- completeNormOpenTerm sc frameTypeOpenTerm
5186
+ scInsertDef sc mod_name frame_ident frame_tp frame_tm
5187
+ let frame = globalOpenTerm frame_ident
5177
5188
let stack = singleFunStack frame
5178
5189
5179
5190
-- Now, generate a SAW core tuple of all the bodies of mutually recursive
0 commit comments