mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
remove flags from irep
This commit is contained in:
@@ -14,7 +14,6 @@ extern "C" {
|
||||
typedef struct mrb_irep {
|
||||
int idx;
|
||||
|
||||
int flags;
|
||||
int nlocals;
|
||||
int nregs;
|
||||
|
||||
@@ -25,9 +24,6 @@ typedef struct mrb_irep {
|
||||
int ilen, plen, slen;
|
||||
} mrb_irep;
|
||||
|
||||
#define MRB_IREP_NOFREE 3
|
||||
#define MRB_ISEQ_NOFREE 1
|
||||
|
||||
void mrb_add_irep(mrb_state *mrb, int n);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
@@ -114,7 +114,6 @@ make_cdump_irep(mrb_state *mrb, int irep_no, FILE *f)
|
||||
SOURCE_CODE0 (" ai = mrb->arena_idx;");
|
||||
SOURCE_CODE0 (" irep = mrb->irep[idx] = mrb_malloc(mrb, sizeof(mrb_irep));");
|
||||
SOURCE_CODE0 (" irep->idx = idx++;");
|
||||
SOURCE_CODE (" irep->flags = %d | MRB_ISEQ_NOFREE;", irep->flags);
|
||||
SOURCE_CODE (" irep->nlocals = %d;", irep->nlocals);
|
||||
SOURCE_CODE (" irep->nregs = %d;", irep->nregs);
|
||||
SOURCE_CODE (" irep->ilen = %d;", irep->ilen);
|
||||
|
||||
@@ -2055,7 +2055,6 @@ scope_finish(codegen_scope *s, int idx)
|
||||
irep = mrb->irep[idx] = (mrb_irep *)mrb_malloc(mrb, sizeof(mrb_irep));
|
||||
|
||||
irep->idx = idx;
|
||||
irep->flags = 0;
|
||||
if (s->iseq) {
|
||||
irep->iseq = (mrb_code *)codegen_realloc(s, s->iseq, sizeof(mrb_code)*s->pc);
|
||||
irep->ilen = s->pc;
|
||||
|
||||
@@ -284,15 +284,22 @@ mrb_init_heap(mrb_state *mrb)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void obj_free(mrb_state *mrb, struct RBasic *obj);
|
||||
|
||||
void
|
||||
mrb_free_heap(mrb_state *mrb)
|
||||
{
|
||||
struct heap_page *page = mrb->heaps;
|
||||
struct heap_page *tmp;
|
||||
RVALUE *p, *e;
|
||||
|
||||
while (page) {
|
||||
tmp = page;
|
||||
page = page->next;
|
||||
for (p = tmp->objects, e=p+MRB_HEAP_PAGE_SIZE; p<e; p++) {
|
||||
if (p->as.free.tt != MRB_TT_FREE)
|
||||
obj_free(mrb, &p->as.basic);
|
||||
}
|
||||
mrb_free(mrb, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,6 @@ mrb_init_proc(mrb_state *mrb)
|
||||
|
||||
*call_iseq = MKOP_A(OP_CALL, 0);
|
||||
call_irep->idx = -1;
|
||||
call_irep->flags = MRB_IREP_NOFREE;
|
||||
call_irep->iseq = call_iseq;
|
||||
call_irep->ilen = 1;
|
||||
|
||||
|
||||
+1
-4
@@ -63,10 +63,7 @@ mrb_close(mrb_state *mrb)
|
||||
mrb_free(mrb, mrb->stbase);
|
||||
mrb_free(mrb, mrb->cibase);
|
||||
for (i=0; i<mrb->irep_len; i++) {
|
||||
if (mrb->irep[i]->flags & MRB_IREP_NOFREE) continue;
|
||||
if ((mrb->irep[i]->flags & MRB_ISEQ_NOFREE) == 0) {
|
||||
mrb_free(mrb, mrb->irep[i]->iseq);
|
||||
}
|
||||
mrb_free(mrb, mrb->irep[i]->iseq);
|
||||
mrb_free(mrb, mrb->irep[i]->pool);
|
||||
mrb_free(mrb, mrb->irep[i]->syms);
|
||||
mrb_free(mrb, mrb->irep[i]);
|
||||
|
||||
Reference in New Issue
Block a user