summaryrefslogtreecommitdiffhomepage
path: root/src/codegen.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-11-15 02:45:52 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2013-11-15 02:45:52 +0900
commit71354b91cb48ff3a5c1e3c09492d18a3c30efcb9 (patch)
treeb5d7040f11c3703d51c8dee1d6e2a0f57a9e4046 /src/codegen.c
parent16b34d187ae668eaf203efaeccc1d7c5a05142f5 (diff)
downloadmruby-71354b91cb48ff3a5c1e3c09492d18a3c30efcb9.tar.gz
mruby-71354b91cb48ff3a5c1e3c09492d18a3c30efcb9.zip
enum mrb_vtype varies on compile time configuration, namely MRB_NAN_BOXING
Diffstat (limited to 'src/codegen.c')
-rw-r--r--src/codegen.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/codegen.c b/src/codegen.c
index a27bd612e..2072d278a 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -316,7 +316,7 @@ genop_peep(codegen_scope *s, mrb_code i, int val)
if (c0 == OP_STRING) {
int i = GETARG_Bx(i0);
- if (s->irep->pool[i].type == MRB_TT_STRING &&
+ if (s->irep->pool[i].type == IREP_TT_STRING &&
s->irep->pool[i].value.s->len == 0) {
s->pc--;
return;
@@ -405,7 +405,7 @@ new_lit(codegen_scope *s, mrb_value val)
mrb_int len;
pv = &s->irep->pool[i];
- if (pv->type != MRB_TT_STRING) continue;
+ if (pv->type != IREP_TT_STRING) continue;
if ((len = pv->value.s->len) != RSTRING_LEN(val)) continue;
if (memcmp(pv->value.s->buf, RSTRING_PTR(val), len) == 0)
return i;
@@ -414,14 +414,14 @@ new_lit(codegen_scope *s, mrb_value val)
case MRB_TT_FLOAT:
for (i=0; i<s->irep->plen; i++) {
pv = &s->irep->pool[i];
- if (pv->type != MRB_TT_FLOAT) continue;
+ if (pv->type != IREP_TT_FLOAT) continue;
if (pv->value.f == mrb_float(val)) return i;
}
break;
case MRB_TT_FIXNUM:
for (i=0; i<s->irep->plen; i++) {
pv = &s->irep->pool[i];
- if (pv->type != MRB_TT_FIXNUM) continue;
+ if (pv->type != IREP_TT_FIXNUM) continue;
if (pv->value.i == mrb_fixnum(val)) return i;
}
break;
@@ -437,18 +437,20 @@ new_lit(codegen_scope *s, mrb_value val)
pv = &s->irep->pool[s->irep->plen];
i = s->irep->plen++;
- pv->type = mrb_type(val);
- switch (pv->type) {
+ switch (mrb_type(val)) {
case MRB_TT_STRING:
+ pv->type = IREP_TT_STRING;
pv->value.s = (struct irep_pool_string*)codegen_malloc(s, sizeof(struct irep_pool_string) + RSTRING_LEN(val));
pv->value.s->len = RSTRING_LEN(val);
memcpy(pv->value.s->buf, RSTRING_PTR(val), RSTRING_LEN(val));
break;
case MRB_TT_FLOAT:
+ pv->type = IREP_TT_FLOAT;
pv->value.f = mrb_float(val);
break;
case MRB_TT_FIXNUM:
+ pv->type = IREP_TT_FIXNUM;
pv->value.i = mrb_fixnum(val);
break;
default: