summaryrefslogtreecommitdiffhomepage
path: root/src/dump.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-11-07 04:20:46 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2013-11-07 04:20:46 +0900
commit677a2ac22633473fb286d7297a8585c01fe7394b (patch)
treeb0052f5b50bfb490c9780c6dd0645a2742aaf655 /src/dump.c
parente92d4e2680716d3e16a264e46394cb6e458699f9 (diff)
downloadmruby-677a2ac22633473fb286d7297a8585c01fe7394b.tar.gz
mruby-677a2ac22633473fb286d7297a8585c01fe7394b.zip
irep->pool not to be GCed
Diffstat (limited to 'src/dump.c')
-rw-r--r--src/dump.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/dump.c b/src/dump.c
index 65b60b17c..2c9e85302 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -79,20 +79,19 @@ get_pool_block_size(mrb_state *mrb, mrb_irep *irep)
for (pool_no = 0; pool_no < irep->plen; pool_no++) {
int ai = mrb_gc_arena_save(mrb);
- switch (mrb_type(irep->pool[pool_no])) {
+ switch (irep->pool[pool_no].type) {
case MRB_TT_FIXNUM:
- str = mrb_fixnum_to_str(mrb, irep->pool[pool_no], 10);
+ str = mrb_fixnum_to_str(mrb, mrb_fixnum_value(irep->pool[pool_no].value.i), 10);
size += RSTRING_LEN(str);
break;
case MRB_TT_FLOAT:
- len = mrb_float_to_str(buf, mrb_float(irep->pool[pool_no]));
+ len = mrb_float_to_str(buf, irep->pool[pool_no].value.f);
size += len;
break;
case MRB_TT_STRING:
- str = mrb_str_to_str(mrb, irep->pool[pool_no]);
- size += RSTRING_LEN(str);
+ size += irep->pool[pool_no].value.s->len;
break;
default:
@@ -120,24 +119,23 @@ write_pool_block(mrb_state *mrb, mrb_irep *irep, uint8_t *buf)
for (pool_no = 0; pool_no < irep->plen; pool_no++) {
int ai = mrb_gc_arena_save(mrb);
- cur += uint8_to_bin(mrb_type(irep->pool[pool_no]), cur); /* data type */
+ cur += uint8_to_bin(irep->pool[pool_no].type, cur); /* data type */
- switch (mrb_type(irep->pool[pool_no])) {
+ switch (irep->pool[pool_no].type) {
case MRB_TT_FIXNUM:
- str = mrb_fixnum_to_str(mrb, irep->pool[pool_no], 10);
+ str = mrb_fixnum_to_str(mrb, mrb_fixnum_value(irep->pool[pool_no].value.i), 10);
char_ptr = RSTRING_PTR(str);
len = RSTRING_LEN(str);
break;
case MRB_TT_FLOAT:
- len = mrb_float_to_str(char_buf, mrb_float(irep->pool[pool_no]));
+ len = mrb_float_to_str(char_buf, irep->pool[pool_no].value.f);
char_ptr = &char_buf[0];
break;
case MRB_TT_STRING:
- str = irep->pool[pool_no];
- char_ptr = RSTRING_PTR(str);
- len = RSTRING_LEN(str);
+ char_ptr = irep->pool[pool_no].value.s->buf;
+ len = irep->pool[pool_no].value.s->len;
break;
default: