now we statically allocate closures for all top-level functions and all nullary constructors. closures are dynamically allocated only for CAFs. this reduces memory use and time to allocate dynamic closures

This commit is contained in:
kr.angelov
2014-10-08 12:57:29 +00:00
parent 67781996b6
commit 9c2f71b07a
6 changed files with 90 additions and 59 deletions

View File

@@ -442,7 +442,12 @@ pgf_read_absfun(PgfReader* rdr, PgfAbstr* abstr)
switch (tag) {
case 0:
absfun->defns = NULL;
absfun->closure_id = 0;
if (absfun->arity == 0) {
absfun->closure.code = abstr->eval_gates->evaluate_value;
absfun->closure.con = &absfun->closure.code;
} else {
absfun->closure.code = NULL;
}
break;
case 1: {
GuLength length = pgf_read_len(rdr);