summaryrefslogtreecommitdiff
path: root/src/runtime/c/pgf/evaluator.h
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2014-10-08 12:57:29 +0000
committerkr.angelov <kr.angelov@gmail.com>2014-10-08 12:57:29 +0000
commit9c2f71b07a5de7d6d4d13dc3c72d9b9ddc2f37dc (patch)
treecc468098d8b2f567121b860662311b9eb8d18492 /src/runtime/c/pgf/evaluator.h
parent67781996b639e9c31acd4a25b229222139686f07 (diff)
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
Diffstat (limited to 'src/runtime/c/pgf/evaluator.h')
-rw-r--r--src/runtime/c/pgf/evaluator.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/runtime/c/pgf/evaluator.h b/src/runtime/c/pgf/evaluator.h
index ac314f602..09b0afb2a 100644
--- a/src/runtime/c/pgf/evaluator.h
+++ b/src/runtime/c/pgf/evaluator.h
@@ -1,8 +1,6 @@
#ifndef PGF_EVALUATOR_H_
#define PGF_EVALUATOR_H_
-typedef void *PgfFunction;
-
typedef struct {
PgfFunction code;
} PgfClosure;
@@ -17,7 +15,7 @@ typedef struct {
PgfEvalGates* eval_gates; // cached from pgf->abstr->eval_gates
GuPool* pool;
GuExn* err;
- PgfIndirection globals[]; // derived from gu_seq_data(pgf->abstr->eval_gates->defrules)
+ PgfIndirection cafs[]; // derived from gu_seq_data(pgf->abstr->eval_gates->cafs)
} PgfEvalState;
typedef struct PgfEnv PgfEnv;
@@ -35,7 +33,7 @@ typedef struct {
typedef struct {
PgfClosure header;
- PgfAbsFun* absfun;
+ PgfClosure* con;
PgfClosure* args[];
} PgfValue;
@@ -75,6 +73,7 @@ struct PgfEvalGates {
PgfFunction evaluate_value_lit;
PgfFunction evaluate_value_pap;
PgfFunction evaluate_value_lambda;
+ PgfFunction evaluate_caf;
PgfFunction update_closure;
PgfFunction update_pap;
@@ -84,7 +83,7 @@ struct PgfEvalGates {
PgfClosure* (*enter)(PgfEvalState* state, PgfClosure* closure);
GuFinalizer fin;
- GuSeq* defrules;
+ GuSeq* cafs;
};
PgfClosure*