auto-extend constant pool array
This commit is contained in:
parent
9fadf16fdb
commit
a315f518d2
|
@ -22,10 +22,10 @@
|
||||||
#define PIC_HEAP_PAGE_SIZE (10000)
|
#define PIC_HEAP_PAGE_SIZE (10000)
|
||||||
#define PIC_STACK_SIZE 1024
|
#define PIC_STACK_SIZE 1024
|
||||||
#define PIC_RESCUE_SIZE 30
|
#define PIC_RESCUE_SIZE 30
|
||||||
#define PIC_IREP_SIZE 256
|
|
||||||
#define PIC_GLOBALS_SIZE 1024
|
#define PIC_GLOBALS_SIZE 1024
|
||||||
#define PIC_MACROS_SIZE 1024
|
#define PIC_MACROS_SIZE 1024
|
||||||
#define PIC_SYM_POOL_SIZE 128
|
#define PIC_SYM_POOL_SIZE 128
|
||||||
|
#define PIC_IREP_SIZE 256
|
||||||
#define PIC_POOL_SIZE 1024
|
#define PIC_POOL_SIZE 1024
|
||||||
#define PIC_ISEQ_SIZE 1024
|
#define PIC_ISEQ_SIZE 1024
|
||||||
|
|
||||||
|
|
|
@ -457,10 +457,11 @@ codegen(codegen_state *state, pic_value obj, bool tailpos)
|
||||||
pic_error(pic, "syntax error");
|
pic_error(pic, "syntax error");
|
||||||
}
|
}
|
||||||
|
|
||||||
pidx = scope->plen++;
|
if (scope->plen >= scope->pcapa) {
|
||||||
if (pidx >= scope->pcapa) {
|
scope->pool = (pic_value *)pic_realloc(pic, scope->pool, scope->pcapa * 2);
|
||||||
pic_abort(pic, "constant pool overflow");
|
scope->pcapa *= 2;
|
||||||
}
|
}
|
||||||
|
pidx = scope->plen++;
|
||||||
scope->pool[pidx] = pic_car(pic, pic_cdr(pic, obj));
|
scope->pool[pidx] = pic_car(pic, pic_cdr(pic, obj));
|
||||||
scope->code[scope->clen].insn = OP_PUSHCONST;
|
scope->code[scope->clen].insn = OP_PUSHCONST;
|
||||||
scope->code[scope->clen].u.i = pidx;
|
scope->code[scope->clen].u.i = pidx;
|
||||||
|
@ -693,10 +694,11 @@ codegen(codegen_state *state, pic_value obj, bool tailpos)
|
||||||
case PIC_TT_VECTOR:
|
case PIC_TT_VECTOR:
|
||||||
case PIC_TT_BLOB: {
|
case PIC_TT_BLOB: {
|
||||||
int pidx;
|
int pidx;
|
||||||
pidx = scope->plen++;
|
if (scope->plen >= scope->pcapa) {
|
||||||
if (pidx >= scope->pcapa) {
|
scope->pool = (pic_value *)pic_realloc(pic, scope->pool, scope->pcapa * 2);
|
||||||
pic_abort(pic, "constant pool overflow");
|
scope->pcapa *= 2;
|
||||||
}
|
}
|
||||||
|
pidx = scope->plen++;
|
||||||
scope->pool[pidx] = obj;
|
scope->pool[pidx] = obj;
|
||||||
scope->code[scope->clen].insn = OP_PUSHCONST;
|
scope->code[scope->clen].insn = OP_PUSHCONST;
|
||||||
scope->code[scope->clen].u.i = pidx;
|
scope->code[scope->clen].u.i = pidx;
|
||||||
|
|
Loading…
Reference in New Issue