Refactored all of the desugaring code to no longer depend on memory being initialized to 0. Everything is about 12% faster now.

This commit is contained in:
Dan Hirsch 2013-05-25 03:35:42 +02:00
parent d71215d494
commit ec404ca8fe
36 changed files with 411 additions and 417 deletions

View file

@ -33,20 +33,16 @@ static bool ab_isValidCF(void *env) {
return ab->p->vtable->isValidCF(ab->p->env);
}
static HCFChoice* desugar_ab(HAllocator *mm__, void *env) {
static void desugar_ab(HAllocator *mm__, HCFStack *stk__, void *env) {
HAttrBool *a = (HAttrBool*)env;
HCFSequence *seq = h_new(HCFSequence, 1);
seq->items = h_new(HCFChoice*, 2);
seq->items[0] = h_desugar(mm__, a->p);
seq->items[1] = NULL;
HCFChoice *ret = h_new(HCFChoice, 1);
ret->type = HCF_CHOICE;
ret->seq = h_new(HCFSequence*, 2);
ret->seq[0] = seq;
ret->seq[1] = NULL;
ret->pred = a->pred;
ret->reshape = h_act_first;
return ret;
HCFS_BEGIN_CHOICE() {
HCFS_BEGIN_SEQ() {
HCFS_DESUGAR(a->p);
} HCFS_END_SEQ();
HCFS_THIS_CHOICE->pred = a->pred;
HCFS_THIS_CHOICE->reshape = h_act_first;
} HCFS_END_CHOICE();
}
static bool h_svm_action_attr_bool(HArena *arena, HSVMContext *ctx, void* arg) {