GitHub

@@ -70,7 +70,7 @@ typedef struct scope {

7070

uint32_t icapa;

71717272

mrb_irep *irep;

73-

mrb_pool_value *pool;

73+

mrb_irep_pool *pool;

7474

mrb_sym *syms;

7575

mrb_irep **reps;

7676

struct mrb_irep_catch_handler *catch_table;

@@ -126,9 +126,9 @@ codegen_error(codegen_scope *s, const char *message)

126126

if (s->irep) {

127127

mrb_free(s->mrb, s->iseq);

128128

for (int i=0; i<s->irep->plen; i++) {

129-

mrb_pool_value *pv = &s->pool[i];

130-

if ((pv->tt & 0x3) == IREP_TT_STR || pv->tt == IREP_TT_BIGINT) {

131-

mrb_free(s->mrb, (void*)pv->u.str);

129+

mrb_irep_pool *p = &s->pool[i];

130+

if ((p->tt & 0x3) == IREP_TT_STR || p->tt == IREP_TT_BIGINT) {

131+

mrb_free(s->mrb, (void*)p->u.str);

132132

}

133133

}

134134

mrb_free(s->mrb, s->pool);

@@ -776,14 +776,14 @@ get_int_operand(codegen_scope *s, struct mrb_insn_data *data, mrb_int *n)

776776777777

case OP_LOADL:

778778

{

779-

mrb_pool_value *pv = &s->pool[data->b];

779+

mrb_irep_pool *p = &s->pool[data->b];

780780781-

if (pv->tt == IREP_TT_INT32) {

782-

*n = (mrb_int)pv->u.i32;

781+

if (p->tt == IREP_TT_INT32) {

782+

*n = (mrb_int)p->u.i32;

783783

}

784784

#ifdef MRB_INT64

785-

else if (pv->tt == IREP_TT_INT64) {

786-

*n = (mrb_int)pv->u.i64;

785+

else if (p->tt == IREP_TT_INT64) {

786+

*n = (mrb_int)p->u.i64;

787787

}

788788

#endif

789789

else {

@@ -989,12 +989,12 @@ pop_n_(codegen_scope *s, int n)

989989

#define pop_n(n) pop_n_(s,n)

990990

#define cursp() (s->sp)

991991992-

static mrb_pool_value*

992+

static mrb_irep_pool*

993993

lit_pool_extend(codegen_scope *s)

994994

{

995995

if (s->irep->plen == s->pcapa) {

996996

s->pcapa *= 2;

997-

s->pool = (mrb_pool_value*)codegen_realloc(s, s->pool, sizeof(mrb_pool_value)*s->pcapa);

997+

s->pool = (mrb_irep_pool*)codegen_realloc(s, s->pool, sizeof(mrb_irep_pool)*s->pcapa);

998998

}

99999910001000

return &s->pool[s->irep->plen++];

@@ -1005,7 +1005,7 @@ new_litbint(codegen_scope *s, const char *p, int base, mrb_bool neg)

10051005

{

10061006

int i;

10071007

size_t plen;

1008-

mrb_pool_value *pv;

1008+

mrb_irep_pool *pv;

1009100910101010

plen = strlen(p);

10111011

if (plen > 255) {

@@ -1039,30 +1039,30 @@ static int

10391039

new_lit_str(codegen_scope *s, const char *str, mrb_int len)

10401040

{

10411041

int i;

1042-

mrb_pool_value *pv;

1042+

mrb_irep_pool *pool;

1043104310441044

for (i=0; i<s->irep->plen; i++) {

1045-

pv = &s->pool[i];

1046-

if (pv->tt & IREP_TT_NFLAG) continue;

1047-

mrb_int plen = pv->tt>>2;

1045+

pool = &s->pool[i];

1046+

if (pool->tt & IREP_TT_NFLAG) continue;

1047+

mrb_int plen = pool->tt>>2;

10481048

if (len != plen) continue;

1049-

if (memcmp(pv->u.str, str, plen) == 0)

1049+

if (memcmp(pool->u.str, str, plen) == 0)

10501050

return i;

10511051

}

105210521053-

pv = lit_pool_extend(s);

1053+

pool = lit_pool_extend(s);

1054105410551055

if (mrb_ro_data_p(str)) {

1056-

pv->tt = (uint32_t)(len<<2) | IREP_TT_SSTR;

1057-

pv->u.str = str;

1056+

pool->tt = (uint32_t)(len<<2) | IREP_TT_SSTR;

1057+

pool->u.str = str;

10581058

}

10591059

else {

10601060

char *p;

1061-

pv->tt = (uint32_t)(len<<2) | IREP_TT_STR;

1061+

pool->tt = (uint32_t)(len<<2) | IREP_TT_STR;

10621062

p = (char*)codegen_realloc(s, NULL, len+1);

10631063

memcpy(p, str, len);

10641064

p[len] = '\0';

1065-

pv->u.str = p;

1065+

pool->u.str = p;

10661066

}

1067106710681068

return i;

@@ -1078,29 +1078,29 @@ static int

10781078

new_lit_int(codegen_scope *s, mrb_int num)

10791079

{

10801080

int i;

1081-

mrb_pool_value *pv;

1081+

mrb_irep_pool *pool;

1082108210831083

for (i=0; i<s->irep->plen; i++) {

1084-

pv = &s->pool[i];

1085-

if (pv->tt == IREP_TT_INT32) {

1086-

if (num == pv->u.i32) return i;

1084+

pool = &s->pool[i];

1085+

if (pool->tt == IREP_TT_INT32) {

1086+

if (num == pool->u.i32) return i;

10871087

}

10881088

#ifdef MRB_64BIT

1089-

else if (pv->tt == IREP_TT_INT64) {

1090-

if (num == pv->u.i64) return i;

1089+

else if (pool->tt == IREP_TT_INT64) {

1090+

if (num == pool->u.i64) return i;

10911091

}

10921092

continue;

10931093

#endif

10941094

}

109510951096-

pv = lit_pool_extend(s);

1096+

pool = lit_pool_extend(s);

1097109710981098

#ifdef MRB_INT64

1099-

pv->tt = IREP_TT_INT64;

1100-

pv->u.i64 = num;

1099+

pool->tt = IREP_TT_INT64;

1100+

pool->u.i64 = num;

11011101

#else

1102-

pv->tt = IREP_TT_INT32;

1103-

pv->u.i32 = num;

1102+

pool->tt = IREP_TT_INT32;

1103+

pool->u.i32 = num;

11041104

#endif

1105110511061106

return i;

@@ -1111,20 +1111,20 @@ static int

11111111

new_lit_float(codegen_scope *s, mrb_float num)

11121112

{

11131113

int i;

1114-

mrb_pool_value *pv;

1114+

mrb_irep_pool *pool;

1115111511161116

for (i=0; i<s->irep->plen; i++) {

11171117

mrb_float f;

1118-

pv = &s->pool[i];

1119-

if (pv->tt != IREP_TT_FLOAT) continue;

1120-

f = pv->u.f;

1118+

pool = &s->pool[i];

1119+

if (pool->tt != IREP_TT_FLOAT) continue;

1120+

f = pool->u.f;

11211121

if (f == num && !signbit(f) == !signbit(num)) return i;

11221122

}

112311231124-

pv = lit_pool_extend(s);

1124+

pool = lit_pool_extend(s);

112511251126-

pv->tt = IREP_TT_FLOAT;

1127-

pv->u.f = num;

1126+

pool->tt = IREP_TT_FLOAT;

1127+

pool->u.f = num;

1128112811291129

return i;

11301130

}

@@ -3862,7 +3862,7 @@ scope_new(mrb_state *mrb, codegen_scope *prev, node *nlv)

38623862

s->iseq = (mrb_code*)mrb_malloc(mrb, sizeof(mrb_code)*s->icapa);

3863386338643864

s->pcapa = 32;

3865-

s->pool = (mrb_pool_value*)mrb_malloc(mrb, sizeof(mrb_pool_value)*s->pcapa);

3865+

s->pool = (mrb_irep_pool*)mrb_malloc(mrb, sizeof(mrb_irep_pool)*s->pcapa);

3866386638673867

s->scapa = 256;

38683868

s->syms = (mrb_sym*)mrb_malloc(mrb, sizeof(mrb_sym)*s->scapa);

@@ -3928,7 +3928,7 @@ scope_finish(codegen_scope *s)

39283928

}

39293929

mrb_free(s->mrb, s->catch_table);

39303930

s->catch_table = NULL;

3931-

irep->pool = (const mrb_pool_value*)codegen_realloc(s, s->pool, sizeof(mrb_pool_value)*irep->plen);

3931+

irep->pool = (const mrb_irep_pool*)codegen_realloc(s, s->pool, sizeof(mrb_irep_pool)*irep->plen);

39323932

irep->syms = (const mrb_sym*)codegen_realloc(s, s->syms, sizeof(mrb_sym)*irep->slen);

39333933

irep->reps = (const mrb_irep**)codegen_realloc(s, s->reps, sizeof(mrb_irep*)*irep->rlen);

39343934

if (s->filename_sym) {

Read the original on github.com ↗