summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-08-29 11:45:36 +0900
committerYukihiro Matsumoto <[email protected]>2012-08-29 11:45:36 +0900
commit950204bc4d419fc3b2a0842eccf1d253735e7839 (patch)
tree61850a6bfabfaf237200054918f35d64a5a1bbb5 /src
parent4848c1f0c76872d78b1c86066e5da3c71f759630 (diff)
downloadmruby-950204bc4d419fc3b2a0842eccf1d253735e7839.tar.gz
mruby-950204bc4d419fc3b2a0842eccf1d253735e7839.zip
remove flags from irep
Diffstat (limited to 'src')
-rw-r--r--src/cdump.c1
-rw-r--r--src/codegen.c1
-rw-r--r--src/gc.c7
-rw-r--r--src/proc.c1
-rw-r--r--src/state.c5
5 files changed, 8 insertions, 7 deletions
diff --git a/src/cdump.c b/src/cdump.c
index f21a735ab..ba05a1899 100644
--- a/src/cdump.c
+++ b/src/cdump.c
@@ -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);
diff --git a/src/codegen.c b/src/codegen.c
index cb625f77a..17608e10f 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -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;
diff --git a/src/gc.c b/src/gc.c
index 006edea8e..46699aea3 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -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);
}
}
diff --git a/src/proc.c b/src/proc.c
index e5c233e1b..44c712a95 100644
--- a/src/proc.c
+++ b/src/proc.c
@@ -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;
diff --git a/src/state.c b/src/state.c
index d17181eb8..57f052569 100644
--- a/src/state.c
+++ b/src/state.c
@@ -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]);