yarv-diff:138
From: ko1 atdot.net
Date: 21 Nov 2005 12:22:33 -0000
Subject: [yarv-diff:138] r297 - trunk
Author: ko1
Date: 2005-11-21 21:22:32 +0900 (Mon, 21 Nov 2005)
New Revision: 297
Modified:
trunk/ChangeLog
trunk/compile.c
trunk/compile.h
trunk/yarvcore.c
Log:
* compile.c, compile.h, yarvcore.c : remove "iseqobj"
variables and rename to "iseq"
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2005-11-20 22:36:09 UTC (rev 296)
+++ trunk/ChangeLog 2005-11-21 12:22:32 UTC (rev 297)
@@ -4,6 +4,13 @@
# from Mon, 03 May 2004 01:24:19 +0900
#
+
+2005-11-21(Mon) 21:21:33 +0900 Koichi Sasada <ko1 atdot.net>
+
+ * compile.c, compile.h, yarvcore.c : remove "iseqobj"
+ variables and rename to "iseq"
+
+
2005-11-21(Mon) 07:31:50 +0900 Koichi Sasada <ko1 atdot.net>
* compile.c : fix block parameter error
Modified: trunk/compile.c
===================================================================
--- trunk/compile.c 2005-11-20 22:36:09 UTC (rev 296)
+++ trunk/compile.c 2005-11-21 12:22:32 UTC (rev 297)
@@ -75,25 +75,25 @@
static void ADD_ELEM(LINK_ANCHOR *anchor, LINK_ELEMENT* elem);
-static INSN *new_insn_body(yarv_iseq_t *iseqobj, int line_no,
- int insn_id, int argc, ...);
-static LABEL *new_label_body(yarv_iseq_t *iseqobj, int line);
+static INSN *new_insn_body(yarv_iseq_t *iseq, int line_no,
+ int insn_id, int argc, ...);
+static LABEL *new_label_body(yarv_iseq_t *iseq, int line);
static int iseq_compile_each(VALUE self, LINK_ANCHOR *anchor, NODE* n, int);
static int iseq_setup(VALUE self, LINK_ANCHOR *anchor);
-static int iseq_optimize(yarv_iseq_t *iseqobj, LINK_ANCHOR *anchor);
-static int iseq_insns_unification(yarv_iseq_t *iseqobj, LINK_ANCHOR *anchor);
-static int set_sequence_stackcaching(yarv_iseq_t *iseqobj, LINK_ANCHOR *anchor);
-static int set_sequence(yarv_iseq_t *iseqobj, LINK_ANCHOR *anchor);
+static int iseq_optimize(yarv_iseq_t *iseq, LINK_ANCHOR *anchor);
+static int iseq_insns_unification(yarv_iseq_t *iseq, LINK_ANCHOR *anchor);
+static int set_sequence_stackcaching(yarv_iseq_t *iseq, LINK_ANCHOR *anchor);
+static int set_sequence(yarv_iseq_t *iseq, LINK_ANCHOR *anchor);
-static int set_exception_table(yarv_iseq_t *iseqobj);
-static int set_localtbl(yarv_iseq_t *iseqobj, ID* tbl);
-static int set_localtbl_eval(yarv_iseq_t *iseqobj, ID* tbl);
-static int set_arguments(VALUE self, yarv_iseq_t *iseqobj, LINK_ANCHOR *anchor, NODE *node);
-static NODE* set_block_local_tbl(VALUE self, yarv_iseq_t *iseqobj, NODE *node, LINK_ANCHOR *anchor);
-static int set_exception_tbl(yarv_iseq_t *iseqobj);
-static int set_optargs_table(yarv_iseq_t *iseqobj);
+static int set_exception_table(yarv_iseq_t *iseq);
+static int set_localtbl(yarv_iseq_t *iseq, ID* tbl);
+static int set_localtbl_eval(yarv_iseq_t *iseq, ID* tbl);
+static int set_arguments(VALUE self, yarv_iseq_t *iseq, LINK_ANCHOR *anchor, NODE *node);
+static NODE* set_block_local_tbl(VALUE self, yarv_iseq_t *iseq, NODE *node, LINK_ANCHOR *anchor);
+static int set_exception_tbl(yarv_iseq_t *iseq);
+static int set_optargs_table(yarv_iseq_t *iseq);
#include "optinsn.inc"
#include "optunifs.inc"
@@ -104,18 +104,18 @@
VALUE iseq_compile(VALUE self, VALUE narg){
DECL_ANCHOR(list_anchor);
- yarv_iseq_t *iseqobj;
+ yarv_iseq_t *iseq;
NODE *node = (NODE*)narg;
debugs("[compile step 1 (traverse each node)]\n");
- GetISeqVal(self, iseqobj);
+ GetISeqVal(self, iseq);
- iseqobj->node = node;
+ iseq->node = node;
- if(iseqobj->type == ISEQ_TYPE_BLOCK){
- node = set_block_local_tbl(self, iseqobj, node, list_anchor);
+ if(iseq->type == ISEQ_TYPE_BLOCK){
+ node = set_block_local_tbl(self, iseq, node, list_anchor);
}
if(node && nd_type(node) == NODE_SCOPE){
@@ -123,8 +123,8 @@
NODE *sn_body = node->nd_next; /* sn: scope node */
NODE *ndargs = 0;
- if(iseqobj->type != ISEQ_TYPE_BLOCK){
- set_localtbl(iseqobj, ((NODE*)node)->nd_tbl);
+ if(iseq->type != ISEQ_TYPE_BLOCK){
+ set_localtbl(iseq, ((NODE*)node)->nd_tbl);
}
if(sn_body){
@@ -133,15 +133,15 @@
if(nd_type(sn_body->nd_head) == NODE_ARGS){
/* some method attribute process */
ndargs = sn_body->nd_head;
- set_arguments(self, iseqobj, list_anchor, ndargs);
+ set_arguments(self, iseq, list_anchor, ndargs);
/* with sn_body->nd_head */
- if(iseqobj->type == ISEQ_TYPE_METHOD){
- iseqobj->rewind_frame_size = iseqobj->local_size + MREWIND_DSIZE();
+ if(iseq->type == ISEQ_TYPE_METHOD){
+ iseq->rewind_frame_size = iseq->local_size + MREWIND_DSIZE();
COMPILE(list_anchor, "normal method", sn_body->nd_next);
}
- else if(iseqobj->type == ISEQ_TYPE_CLASS){
- iseqobj->rewind_frame_size = iseqobj->local_size + REWIND_DSIZE();
+ else if(iseq->type == ISEQ_TYPE_CLASS){
+ iseq->rewind_frame_size = iseq->local_size + REWIND_DSIZE();
COMPILE(list_anchor, "class/module", sn_body->nd_next);
}
else{
@@ -152,12 +152,12 @@
else{
/* normal block */
- if(iseqobj->type == ISEQ_TYPE_CLASS){
- iseqobj->rewind_frame_size = iseqobj->local_size + REWIND_DSIZE();
+ if(iseq->type == ISEQ_TYPE_CLASS){
+ iseq->rewind_frame_size = iseq->local_size + REWIND_DSIZE();
COMPILE(list_anchor, "class/module", sn_body);
}
- else if(iseqobj->type == ISEQ_TYPE_BLOCK){
- iseqobj->rewind_frame_size = iseqobj->local_size + REWIND_DSIZE();
+ else if(iseq->type == ISEQ_TYPE_BLOCK){
+ iseq->rewind_frame_size = iseq->local_size + REWIND_DSIZE();
COMPILE(list_anchor, "normal block", sn_body);
}
else{
@@ -170,16 +170,16 @@
/* some method attribute process */
debugs("empty method\n");
- set_arguments(self, iseqobj, list_anchor, sn_body);
+ set_arguments(self, iseq, list_anchor, sn_body);
ADD_INSN(list_anchor, nd_line(sn_body), putnil);
- iseqobj->rewind_frame_size = iseqobj->local_size + MREWIND_DSIZE();
+ iseq->rewind_frame_size = iseq->local_size + MREWIND_DSIZE();
break;
default:
COMPILE(list_anchor, "other scope", sn_body);
- iseqobj->rewind_frame_size = iseqobj->local_size + REWIND_DSIZE();
+ iseq->rewind_frame_size = iseq->local_size + REWIND_DSIZE();
break;
}
}
@@ -187,42 +187,42 @@
/* sn_body == 0 */
ADD_INSN(list_anchor, 0, putnil);
- iseqobj->rewind_frame_size = iseqobj->local_size + REWIND_DSIZE();
+ iseq->rewind_frame_size = iseq->local_size + REWIND_DSIZE();
}
}
else{
- if(iseqobj->type == ISEQ_TYPE_BLOCK){
+ if(iseq->type == ISEQ_TYPE_BLOCK){
VALUE tmp;
- LABEL *start = iseqobj->compile_data->start_label = NEW_LABEL(0);
- LABEL *end = iseqobj->compile_data->end_label = NEW_LABEL(0);
+ LABEL *start = iseq->compile_data->start_label = NEW_LABEL(0);
+ LABEL *end = iseq->compile_data->end_label = NEW_LABEL(0);
- iseqobj->rewind_frame_size = iseqobj->local_size + REWIND_DSIZE();
+ iseq->rewind_frame_size = iseq->local_size + REWIND_DSIZE();
ADD_CATCH_ENTRY(CATCH_TYPE_REDO, start, end, 0, 0, start);
ADD_CATCH_ENTRY(CATCH_TYPE_NEXT, start, end, 0, 0, end);
- ADD_LABEL(list_anchor, iseqobj->compile_data->start_label);
+ ADD_LABEL(list_anchor, iseq->compile_data->start_label);
COMPILE(list_anchor, "block body", node);
- ADD_LABEL(list_anchor, iseqobj->compile_data->end_label);
+ ADD_LABEL(list_anchor, iseq->compile_data->end_label);
}
- else if(iseqobj->type == ISEQ_TYPE_TOP){
- set_localtbl(iseqobj, GET_THREAD()->top_local_tbl);
- iseqobj->rewind_frame_size = iseqobj->local_size + REWIND_DSIZE();
+ else if(iseq->type == ISEQ_TYPE_TOP){
+ set_localtbl(iseq, GET_THREAD()->top_local_tbl);
+ iseq->rewind_frame_size = iseq->local_size + REWIND_DSIZE();
COMPILE(list_anchor, "top level node", node);
}
- else if(iseqobj->type == ISEQ_TYPE_EVAL){
- iseqobj->rewind_frame_size = iseqobj->local_size + REWIND_DSIZE();
- set_localtbl_eval(iseqobj, GET_THREAD()->top_local_tbl);
+ else if(iseq->type == ISEQ_TYPE_EVAL){
+ iseq->rewind_frame_size = iseq->local_size + REWIND_DSIZE();
+ set_localtbl_eval(iseq, GET_THREAD()->top_local_tbl);
COMPILE(list_anchor, "eval node", node);
}
- else if(iseqobj->type == ISEQ_TYPE_RESCUE){
- set_exception_tbl(iseqobj);
- iseqobj->rewind_frame_size = iseqobj->local_size + REWIND_DSIZE();
+ else if(iseq->type == ISEQ_TYPE_RESCUE){
+ set_exception_tbl(iseq);
+ iseq->rewind_frame_size = iseq->local_size + REWIND_DSIZE();
COMPILE(list_anchor, "rescue", node);
}
- else if(iseqobj->type == ISEQ_TYPE_ENSURE){
- set_exception_tbl(iseqobj);
- iseqobj->rewind_frame_size = iseqobj->local_size + REWIND_DSIZE();
+ else if(iseq->type == ISEQ_TYPE_ENSURE){
+ set_exception_tbl(iseq);
+ iseq->rewind_frame_size = iseq->local_size + REWIND_DSIZE();
COMPILE_POPED(list_anchor, "ensure", node);
}
else if(node == 0){
@@ -235,14 +235,14 @@
GC_CHECK();
- if(iseqobj->type == ISEQ_TYPE_RESCUE ||
- iseqobj->type == ISEQ_TYPE_ENSURE){
+ if(iseq->type == ISEQ_TYPE_RESCUE ||
+ iseq->type == ISEQ_TYPE_ENSURE){
ADD_INSN2(list_anchor, 0, getdynamic, I2F(1), I2F(0));
ADD_INSN1(list_anchor, 0, throw, I2F(0) /* continue throw */);
}
else{
- ADD_INSN(list_anchor, iseqobj->compile_data->last_line, end);
+ ADD_INSN(list_anchor, iseq->compile_data->last_line, end);
}
return iseq_setup(self, list_anchor);
@@ -284,10 +284,10 @@
static void *
-compile_data_alloc(yarv_iseq_t *iseqobj, int size)
+compile_data_alloc(yarv_iseq_t *iseq, int size)
{
void *ptr = 0;
- struct iseq_compile_data_storage *storage = iseqobj->compile_data->storage_current;
+ struct iseq_compile_data_storage *storage = iseq->compile_data->storage_current;
if(storage->pos + size > storage->size){
unsigned long alloc_size = storage->size * 2;
@@ -299,7 +299,7 @@
}
storage->next = (void *)ALLOC_N(char, alloc_size +
sizeof(struct iseq_compile_data_storage));
- storage = iseqobj->compile_data->storage_current = storage->next;
+ storage = iseq->compile_data->storage_current = storage->next;
storage->next = 0;
storage->pos = 0;
@@ -313,15 +313,15 @@
}
static INSN *
-compile_data_alloc_insn(yarv_iseq_t *iseqobj)
+compile_data_alloc_insn(yarv_iseq_t *iseq)
{
- return (INSN*)compile_data_alloc(iseqobj, sizeof(INSN));
+ return (INSN*)compile_data_alloc(iseq, sizeof(INSN));
}
static LABEL *
-compile_data_alloc_label(yarv_iseq_t *iseqobj)
+compile_data_alloc_label(yarv_iseq_t *iseq)
{
- return (LABEL*)compile_data_alloc(iseqobj, sizeof(LABEL));
+ return (LABEL*)compile_data_alloc(iseq, sizeof(LABEL));
}
/*
@@ -557,9 +557,9 @@
#endif
static LABEL *
-new_label_body(yarv_iseq_t *iseqobj, int line)
+new_label_body(yarv_iseq_t *iseq, int line)
{
- LABEL *labelobj = compile_data_alloc_label(iseqobj);
+ LABEL *labelobj = compile_data_alloc_label(iseq);
static int label_no = 0;
labelobj->link.type = ISEQ_ELEMENT_LABEL;
@@ -571,10 +571,10 @@
}
static INSN *
-new_insn_core(yarv_iseq_t *iseqobj, int line_no,
+new_insn_core(yarv_iseq_t *iseq, int line_no,
int insn_id, int argc, VALUE *argv)
{
- INSN *insnobj = compile_data_alloc_insn(iseqobj);
+ INSN *insnobj = compile_data_alloc_insn(iseq);
insnobj->link.type = ISEQ_ELEMENT_INSN;
insnobj->link.next = 0;
@@ -587,7 +587,7 @@
}
static INSN *
-new_insn_body(yarv_iseq_t *iseqobj, int line_no,
+new_insn_body(yarv_iseq_t *iseq, int line_no,
int insn_id, int argc, ...)
{
VALUE *operands = 0;
@@ -595,23 +595,23 @@
if(argc > 0){
int i;
va_init_list(argv, argc);
- operands = (VALUE *)compile_data_alloc(iseqobj, sizeof(VALUE) * argc);
+ operands = (VALUE *)compile_data_alloc(iseq, sizeof(VALUE) * argc);
for(i=0; i<argc; i++){
VALUE v = va_arg(argv, VALUE);
operands[i] = v;
/* TODO: need GC mark? */
//if(!SPECIAL_CONST_P(v)){
- // rb_ary_push(iseqobj->iseq_mark_ary, v);
+ // rb_ary_push(iseq->iseq_mark_ary, v);
//}
}
va_end(argv);
}
- return new_insn_core(iseqobj, line_no, insn_id, argc, operands);
+ return new_insn_core(iseq, line_no, insn_id, argc, operands);
}
static INSN *
-new_insn_send(yarv_iseq_t *iseqobj, int line_no,
+new_insn_send(yarv_iseq_t *iseq, int line_no,
VALUE id, VALUE argc, VALUE block, VALUE flag)
{
INSN *iobj = 0;
@@ -623,60 +623,60 @@
if(0){
}
else if(mid == idPLUS){
- iobj = new_insn_body(iseqobj, line_no, BIN(opt_plus), 0);
+ iobj = new_insn_body(iseq, line_no, BIN(opt_plus), 0);
}
else if(mid == idMINUS){
- iobj = new_insn_body(iseqobj, line_no, BIN(opt_minus), 0);
+ iobj = new_insn_body(iseq, line_no, BIN(opt_minus), 0);
}
else if(mid == idMULT){
- iobj = new_insn_body(iseqobj, line_no, BIN(opt_mult), 0);
+ iobj = new_insn_body(iseq, line_no, BIN(opt_mult), 0);
}
else if(mid == idDIV){
- iobj = new_insn_body(iseqobj, line_no, BIN(opt_div), 0);
+ iobj = new_insn_body(iseq, line_no, BIN(opt_div), 0);
}
else if(mid == idMOD){
- iobj = new_insn_body(iseqobj, line_no, BIN(opt_mod), 0);
+ iobj = new_insn_body(iseq, line_no, BIN(opt_mod), 0);
}
else if(mid == idEq){
- iobj = new_insn_body(iseqobj, line_no, BIN(opt_eq), 0);
+ iobj = new_insn_body(iseq, line_no, BIN(opt_eq), 0);
}
else if(mid == idLT){
- iobj = new_insn_body(iseqobj, line_no, BIN(opt_lt), 0);
+ iobj = new_insn_body(iseq, line_no, BIN(opt_lt), 0);
}
else if(mid == idLTLT){
- iobj = new_insn_body(iseqobj, line_no, BIN(opt_ltlt), 0);
+ iobj = new_insn_body(iseq, line_no, BIN(opt_ltlt), 0);
}
else if(mid == idAREF){
- iobj = new_insn_body(iseqobj, line_no, BIN(opt_aref), 0);
+ iobj = new_insn_body(iseq, line_no, BIN(opt_aref), 0);
}
}
else if(argc == I2F(0)){
if(mid == idLength){
- iobj = new_insn_body(iseqobj, line_no, BIN(opt_length), 0);
+ iobj = new_insn_body(iseq, line_no, BIN(opt_length), 0);
}
}
else if(argc == I2F(2)){
if(mid == idASET){
- iobj = new_insn_body(iseqobj, line_no, BIN(opt_aset), 0);
+ iobj = new_insn_body(iseq, line_no, BIN(opt_aset), 0);
}
}
}
#endif
if(iobj == 0){
- VALUE *operands = (VALUE *)compile_data_alloc(iseqobj, sizeof(VALUE) * 5);
+ VALUE *operands = (VALUE *)compile_data_alloc(iseq, sizeof(VALUE) * 5);
operands[0] = id;
operands[1] = argc;
operands[2] = block;
operands[3] = flag;
operands[4] = 0;
- iobj = new_insn_core(iseqobj, line_no, BIN(send), 5, operands);
+ iobj = new_insn_core(iseq, line_no, BIN(send), 5, operands);
}
return iobj;
}
static VALUE
-new_child_iseq(VALUE self, yarv_iseq_t *iseqobj,
- NODE *node, VALUE name, VALUE parent, VALUE type)
+new_child_iseq(yarv_iseq_t *iseq, NODE *node,
+ VALUE name, VALUE parent, VALUE type)
{
VALUE args[5];
VALUE ret;
@@ -684,22 +684,22 @@
debugs("[new_child_iseq]> ---------------------------------------\n");
args[0] = (VALUE)node;
args[1] = name;
- args[2] = iseq_filename(self);
+ args[2] = iseq_filename(iseq->self);
args[3] = parent;
args[4] = type;
ret = rb_class_new_instance(5, args, cYarvISeq);
debugs("[new_child_iseq]< ---------------------------------------\n");
- rb_ary_push(iseqobj->compile_data->mark_ary, ret);
+ rb_ary_push(iseq->compile_data->mark_ary, ret);
return ret;
}
static int
iseq_setup(VALUE self, LINK_ANCHOR *anchor)
{
- yarv_iseq_t *iseqobj;
- GetISeqVal(self, iseqobj);
+ yarv_iseq_t *iseq;
+ GetISeqVal(self, iseq);
// debugs("[compile step 2] (iseq_array_to_linkedlist)\n");
// iseq_array_to_linkedlist_each(anchor, seq_ary);
@@ -709,35 +709,35 @@
GC_CHECK();
debugs("[compile step 3.1 (iseq_optimize)]\n");
- iseq_optimize(iseqobj, anchor);
+ iseq_optimize(iseq, anchor);
if(CPDEBUG > 5)dump_disasm_list(FIRST_ELEMENT(anchor));
GC_CHECK();
debugs("[compile step 3.2 (iseq_insns_unification)]\n");
- iseq_insns_unification(iseqobj, anchor);
+ iseq_insns_unification(iseq, anchor);
if(CPDEBUG > 5)dump_disasm_list(FIRST_ELEMENT(anchor));
GC_CHECK();
debugs("[compile step 3.3 (set_sequence_stackcaching)]\n");
- set_sequence_stackcaching(iseqobj, anchor);
+ set_sequence_stackcaching(iseq, anchor);
if(CPDEBUG > 5)dump_disasm_list(FIRST_ELEMENT(anchor));
GC_CHECK();
debugs("[compile step 4 (set_sequence)]\n");
- set_sequence(iseqobj, anchor);
+ set_sequence(iseq, anchor);
if(CPDEBUG > 5)dump_disasm_list(FIRST_ELEMENT(anchor));
GC_CHECK();
GC_CHECK();
debugs("[compile step 4.1 (set_exception_table)]\n");
- set_exception_table(iseqobj);
+ set_exception_table(iseq);
debugs("[compile step 5] (set_optargs_table)\n");
- set_optargs_table(iseqobj);
+ set_optargs_table(iseq);
debugs("[compile step 6] (iseq_translate_direct_threaded_code)\n");
- iseq_translate_direct_threaded_code(iseqobj);
+ iseq_translate_direct_threaded_code(iseq);
GC_CHECK();
if(CPDEBUG > 1){
@@ -753,47 +753,47 @@
VALUE
iseq_assemble_setup(VALUE self, VALUE args, VALUE locals, VALUE insn_ary)
{
- yarv_iseq_t *iseqobj;
+ yarv_iseq_t *iseq;
int alen = RARRAY(args)->len, llen = RARRAY(locals)->len;
int i;
- GetISeqVal(self, iseqobj);
+ GetISeqVal(self, iseq);
- /* setup iseqobj (args, locals) */
- iseqobj->argc = RARRAY(args)->len;
+ /* setup iseq (args, locals) */
+ iseq->argc = RARRAY(args)->len;
/* TODO: rest and opt should be supported */
- iseqobj->arg_simple = 1;
+ iseq->arg_simple = 1;
- if(iseqobj->local_tbl){
- ruby_xfree(iseqobj->local_tbl);
+ if(iseq->local_tbl){
+ ruby_xfree(iseq->local_tbl);
}
- iseqobj->local_tbl = (ID*)ALLOC_N(ID*, alen + llen);
- iseqobj->local_size = alen + llen;
+ iseq->local_tbl = (ID*)ALLOC_N(ID*, alen + llen);
+ iseq->local_size = alen + llen;
for(i=0; i<alen; i++){
- iseqobj->local_tbl[i] = SYM2ID(RARRAY(args)->ptr[i]);
+ iseq->local_tbl[i] = SYM2ID(RARRAY(args)->ptr[i]);
}
for(i=0; i<llen; i++){
- iseqobj->local_tbl[i+alen] = SYM2ID(RARRAY(locals)->ptr[i]);
+ iseq->local_tbl[i+alen] = SYM2ID(RARRAY(locals)->ptr[i]);
}
- iseqobj->catch_table_ary = rb_ary_new();
- // return iseq_setup(self, insn_ary, iseqobj);
+ iseq->catch_table_ary = rb_ary_new();
+ // return iseq_setup(self, insn_ary, iseq);
return Qnil;
}
int
-set_exception_tbl(yarv_iseq_t *iseqobj)
+set_exception_tbl(yarv_iseq_t *iseq)
{
static ID id_dollar_bang;
if(!id_dollar_bang){
id_dollar_bang = rb_intern("$!");
}
- iseqobj->local_tbl = (ID*)ALLOC_N(ID*, 1);
- iseqobj->local_size = 1;
- iseqobj->local_tbl[0] = id_dollar_bang;
+ iseq->local_tbl = (ID*)ALLOC_N(ID*, 1);
+ iseq->local_size = 1;
+ iseq->local_tbl[0] = id_dollar_bang;
return COMPILE_OK;
}
@@ -823,7 +823,7 @@
}
static NODE*
-search_block_local_parameters(yarv_iseq_t *iseqobj, NODE *node)
+search_block_local_parameters(yarv_iseq_t *iseq, NODE *node)
{
int i;
NODE *nelem;
@@ -835,7 +835,7 @@
(VALUE)node->nd_var != 1){
switch(nd_type(node->nd_var)){
case NODE_DASGN_CURR:
- iseqobj->argc = 1;
+ iseq->argc = 1;
rb_ary_push(vars, ID2SYM(node->nd_var->nd_vid));
debugi("block 1arg", node->nd_var->nd_vid);
break;
@@ -843,8 +843,8 @@
int i;
nelem = node->nd_var->nd_head;
if(nelem != 0){
- iseqobj->argc = node->nd_var->nd_head->nd_alen;
- for(i=0; i<iseqobj->argc; i++, nelem = nelem->nd_next){
+ iseq->argc = node->nd_var->nd_head->nd_alen;
+ for(i=0; i<iseq->argc; i++, nelem = nelem->nd_next){
if(nd_type(nelem->nd_head) == NODE_DASGN_CURR){
rb_ary_push(vars, ID2SYM(nelem->nd_head->nd_vid));
debugi("block arg", nelem->nd_head->nd_vid);
@@ -852,7 +852,7 @@
else{
char buff[0x20];
ID id;
- int idx = iseqobj->argc - RARRAY(vars)->len;
+ int idx = iseq->argc - RARRAY(vars)->len;
snprintf(buff, 0x20, "#blp%d", idx);
id = rb_intern(buff);
rb_ary_push(vars, ID2SYM(id));
@@ -878,12 +878,12 @@
default:
rb_ary_push(vars, ID2SYM(rb_intern("#blp")));
debugi("block 1arg (auto)", rb_intern("#blp"));
- iseqobj->argc = 1;
+ iseq->argc = 1;
break;
}
}
else{
- iseqobj->argc = 0;
+ iseq->argc = 0;
}
rb_ary_concat(vars, local_vars);
node = node->nd_body;
@@ -909,19 +909,19 @@
int i, size = RARRAY(vars)->len;
if(size > 0){
- iseqobj->local_tbl = ALLOC_N(ID, size);
+ iseq->local_tbl = ALLOC_N(ID, size);
for(i=0; i<size; i++){
- iseqobj->local_tbl[i] = SYM2ID(RARRAY(vars)->ptr[i]);
- debugi("block param", iseqobj->local_tbl[i]);
+ iseq->local_tbl[i] = SYM2ID(RARRAY(vars)->ptr[i]);
+ debugi("block param", iseq->local_tbl[i]);
}
}
- iseqobj->local_size = size;
+ iseq->local_size = size;
}
return node;
}
static int
-set_block_initializer(VALUE self, yarv_iseq_t *iseqobj, NODE *node, LINK_ANCHOR *anchor)
+set_block_initializer(VALUE self, yarv_iseq_t *iseq, NODE *node, LINK_ANCHOR *anchor)
{
DECL_ANCHOR(anc);
LINK_ELEMENT *elem;
@@ -938,16 +938,16 @@
}
static NODE*
-set_block_local_tbl(VALUE self, yarv_iseq_t *iseqobj, NODE *node, LINK_ANCHOR *anchor)
+set_block_local_tbl(VALUE self, yarv_iseq_t *iseq, NODE *node, LINK_ANCHOR *anchor)
{
NODE *rnode;
/* argument check */
- if(iseqobj->type != ISEQ_TYPE_BLOCK){
+ if(iseq->type != ISEQ_TYPE_BLOCK){
rb_bug("set_block_local_tbl: unexpected iseq type");
}
- rnode = search_block_local_parameters(iseqobj, node);
+ rnode = search_block_local_parameters(iseq, node);
if((VALUE)node->nd_var == 1){
/* TODO */
@@ -964,8 +964,8 @@
/* idx-th param, current level*/
ADD_INSN2(anchor, nd_line(node),
- getdynamic, I2F(iseqobj->local_size - i), I2F(0));
- set_block_initializer(self, iseqobj, nargs->nd_head, anchor);
+ getdynamic, I2F(iseq->local_size - i), I2F(0));
+ set_block_initializer(self, iseq, nargs->nd_head, anchor);
}
i++;
nargs = nargs->nd_next;
@@ -973,13 +973,13 @@
}
if((int)node->nd_var->nd_args > 0){
- iseqobj->argc++;
- iseqobj->arg_rest = i + 1;
+ iseq->argc++;
+ iseq->arg_rest = i + 1;
if(nd_type(node->nd_var->nd_args) != NODE_DASGN_CURR){
ADD_INSN2(anchor, nd_line(node), getdynamic,
- I2F(iseqobj->local_size - i), I2F(0));
- set_block_initializer(self, iseqobj, node->nd_var->nd_args, anchor);
+ I2F(iseq->local_size - i), I2F(0));
+ set_block_initializer(self, iseq, node->nd_var->nd_args, anchor);
}
}
break;
@@ -991,25 +991,25 @@
/* for 1.x compatibility */
default:{
/* first param, current level*/
- ADD_INSN2(anchor, nd_line(node), getdynamic, I2F(iseqobj->local_size), I2F(0));
- set_block_initializer(self, iseqobj, nargs, anchor);
+ ADD_INSN2(anchor, nd_line(node), getdynamic, I2F(iseq->local_size), I2F(0));
+ set_block_initializer(self, iseq, nargs, anchor);
break;
}
}
}
if(nd_type(node) == NODE_FOR){
- iseqobj->compile_data->for_iseq = 1;
+ iseq->compile_data->for_iseq = 1;
}
return rnode;
}
static int
-get_dyna_var_idx_at_raw(yarv_iseq_t *iseqobj, ID id)
+get_dyna_var_idx_at_raw(yarv_iseq_t *iseq, ID id)
{
int i;
- for(i=0; i<iseqobj->local_size; i++){
- if(iseqobj->local_tbl[i] == id){
+ for(i=0; i<iseq->local_size; i++){
+ if(iseq->local_tbl[i] == id){
return i;
}
}
@@ -1019,25 +1019,25 @@
static int
get_dyna_var_idx_at(VALUE self, ID id)
{
- yarv_iseq_t *iseqobj;
- GetISeqVal(self, iseqobj);
- return get_dyna_var_idx_at_raw(iseqobj, id);
+ yarv_iseq_t *iseq;
+ GetISeqVal(self, iseq);
+ return get_dyna_var_idx_at_raw(iseq, id);
}
static int
get_dyna_var_idx(VALUE self, ID id, int *level, int *ls)
{
- yarv_iseq_t *iseqobj;
+ yarv_iseq_t *iseq;
int lv = 0, idx;
- GetISeqVal(self, iseqobj);
+ GetISeqVal(self, iseq);
- while(iseqobj){
- if((idx = get_dyna_var_idx_at_raw(iseqobj, id)) >= 0){
+ while(iseq){
+ if((idx = get_dyna_var_idx_at_raw(iseq, id)) >= 0){
*level = lv;
- *ls = iseqobj->local_size;
+ *ls = iseq->local_size;
return idx;
}
- iseqobj = iseqobj->parent_iseq;
+ iseq = iseq->parent_iseq;
lv++;
}
return -1;
@@ -1047,21 +1047,22 @@
*/
static int
-set_arguments(VALUE self, yarv_iseq_t *iseqobj, LINK_ANCHOR *optargs, NODE *node)
+set_arguments(VALUE self, yarv_iseq_t *iseq,
+ LINK_ANCHOR *optargs, NODE *node)
{
int i, j;
if(node){
/* normal method */
if(node->nd_frml){
- iseqobj->argc = RARRAY(node->nd_frml)->len;
+ iseq->argc = RARRAY(node->nd_frml)->len;
}
else{
- iseqobj->argc = 0;
+ iseq->argc = 0;
}
if(node->nd_rest){
- iseqobj->arg_rest = node->nd_rest->nd_cnt - 2 + 1;
+ iseq->arg_rest = node->nd_rest->nd_cnt - 2 + 1;
}
/* optional initializer */
@@ -1085,35 +1086,35 @@
ADD_LABEL(optargs, label);
i+=1;
- iseqobj->arg_opts = i;
- iseqobj->arg_opt_tbl = ALLOC_N(VALUE, i);
- MEMCPY(iseqobj->arg_opt_tbl, RARRAY(labels)->ptr, VALUE, i);
+ iseq->arg_opts = i;
+ iseq->arg_opt_tbl = ALLOC_N(VALUE, i);
+ MEMCPY(iseq->arg_opt_tbl, RARRAY(labels)->ptr, VALUE, i);
for(j=0; j<i; j++){
- iseqobj->arg_opt_tbl[j] &= ~1;
+ iseq->arg_opt_tbl[j] &= ~1;
}
}
else{
- iseqobj->arg_opts = 0;
+ iseq->arg_opts = 0;
}
}
else{
- iseqobj->argc = 0;
- iseqobj->arg_rest = 0;
- iseqobj->arg_opts = 0;
+ iseq->argc = 0;
+ iseq->arg_rest = 0;
+ iseq->arg_opts = 0;
}
- if(iseqobj->arg_rest != 0 ||
- iseqobj->arg_opts != 0){
- iseqobj->arg_simple = 0;
+ if(iseq->arg_rest != 0 ||
+ iseq->arg_opts != 0){
+ iseq->arg_simple = 0;
}
else{
- iseqobj->arg_simple = 1;
+ iseq->arg_simple = 1;
}
return COMPILE_OK;
}
static int
-set_localtbl(yarv_iseq_t *iseqobj, ID* tbl)
+set_localtbl(yarv_iseq_t *iseq, ID* tbl)
{
int size;
if(tbl){
@@ -1122,16 +1123,16 @@
else{
size = 1;
}
- iseqobj->local_tbl = (ID*)ALLOC_N(ID*, size);
+ iseq->local_tbl = (ID*)ALLOC_N(ID*, size);
if(tbl && size > 1){
- MEMCPY(iseqobj->local_tbl + 1, tbl + 3, ID*, size - 1);
+ MEMCPY(iseq->local_tbl + 1, tbl + 3, ID*, size - 1);
}
- iseqobj->local_size = size;
+ iseq->local_size = size;
return COMPILE_OK;
}
static int
-set_localtbl_eval(yarv_iseq_t *iseqobj, ID* tbl)
+set_localtbl_eval(yarv_iseq_t *iseq, ID* tbl)
{
int size;
if(tbl){
@@ -1141,10 +1142,10 @@
size = 0;
}
if(tbl){
- iseqobj->local_tbl = (ID*)ALLOC_N(ID*, size);
- MEMCPY(iseqobj->local_tbl, tbl + 1, ID*, size);
+ iseq->local_tbl = (ID*)ALLOC_N(ID*, size);
+ MEMCPY(iseq->local_tbl, tbl + 1, ID*, size);
}
- iseqobj->local_size = size;
+ iseq->local_size = size;
return COMPILE_OK;
}
@@ -1152,7 +1153,7 @@
ruby insn object array -> raw instruction sequence
*/
static int
-set_sequence(yarv_iseq_t *iseqobj, LINK_ANCHOR *anchor)
+set_sequence(yarv_iseq_t *iseq, LINK_ANCHOR *anchor)
{
LABEL *lobj;
INSN *iobj;
@@ -1252,10 +1253,11 @@
if(lobj->set != Qtrue){
rb_bug("unknown label");
}
- rb_hash_aset(map, RARRAY(pair)->ptr[0], INT2FIX(lobj->position - (pos + len)));
+ rb_hash_aset(map, RARRAY(pair)->ptr[0],
+ INT2FIX(lobj->position - (pos + len)));
}
generated_iseq[pos+1+j] = map;
- rb_ary_push(iseqobj->iseq_mark_ary, map);
+ rb_ary_push(iseq->iseq_mark_ary, map);
break;
}
case 'U': /* ulong */
@@ -1268,7 +1270,7 @@
generated_iseq[pos+1+j] = v;
/* to mark ruby object */
if(!SPECIAL_CONST_P(v)){
- rb_ary_push(iseqobj->iseq_mark_ary, v);
+ rb_ary_push(iseq->iseq_mark_ary, v);
}
}
break;
@@ -1276,7 +1278,7 @@
{
VALUE v = (VALUE)NEW_INLINE_CACHE_ENTRY();
generated_iseq[pos+1+j] = v;
- rb_ary_push(iseqobj->iseq_mark_ary, v);
+ rb_ary_push(iseq->iseq_mark_ary, v);
break;
}
case 'I': /* ID */
@@ -1307,11 +1309,11 @@
}
{
- iseqobj->iseq = (void*)generated_iseq;
- iseqobj->size = pos;
- iseqobj->insn_info_tbl = insn_info_tbl;
- iseqobj->insn_info_size= k;
- iseqobj->stack_max = stack_max;
+ iseq->iseq = (void*)generated_iseq;
+ iseq->size = pos;
+ iseq->insn_info_tbl = insn_info_tbl;
+ iseq->insn_info_size= k;
+ iseq->stack_max = stack_max;
}
return COMPILE_OK;
}
@@ -1324,28 +1326,28 @@
}
static int
-set_exception_table(yarv_iseq_t *iseqobj)
+set_exception_table(yarv_iseq_t *iseq)
{
VALUE *tptr, *ptr;
int tlen, i;
struct catch_table_entry *entry;
- tlen = RARRAY(iseqobj->catch_table_ary)->len;
- tptr = RARRAY(iseqobj->catch_table_ary)->ptr;
+ tlen = RARRAY(iseq->catch_table_ary)->len;
+ tptr = RARRAY(iseq->catch_table_ary)->ptr;
- iseqobj->catch_table = ALLOC_N(struct catch_table_entry, tlen);
- iseqobj->catch_table_size = tlen;
+ iseq->catch_table = ALLOC_N(struct catch_table_entry, tlen);
+ iseq->catch_table_size = tlen;
for(i=0; i<tlen; i++){
ptr = RARRAY(tptr[i])->ptr;
- entry = &iseqobj->catch_table[i];
+ entry = &iseq->catch_table[i];
entry->type = ptr[0];
entry->start = label_get_position(ptr[1] & ~1);
entry->end = label_get_position(ptr[2] & ~1);
entry->iseq = ptr[3];
if(entry->iseq != 0){
- rb_ary_push(iseqobj->iseq_mark_ary, entry->iseq);
+ rb_ary_push(iseq->iseq_mark_ary, entry->iseq);
}
entry->sp = FIX2INT(ptr[4]);
@@ -1357,7 +1359,7 @@
}
}
//
- iseqobj->catch_table_ary = 0; /* free */
+ iseq->catch_table_ary = 0; /* free */
return COMPILE_OK;
}
@@ -1367,15 +1369,15 @@
* =>
*/
static int
-set_optargs_table(yarv_iseq_t *iseqobj)
+set_optargs_table(yarv_iseq_t *iseq)
{
int i;
- if(iseqobj->arg_opts != 0){
- for(i=0; i< iseqobj->arg_opts; i++){
- // dp((VALUE)iseqobj->arg_opt_tbl[i]);
- iseqobj->arg_opt_tbl[i] =
- label_get_position((VALUE)iseqobj->arg_opt_tbl[i]);
+ if(iseq->arg_opts != 0){
+ for(i=0; i< iseq->arg_opts; i++){
+ // dp((VALUE)iseq->arg_opt_tbl[i]);
+ iseq->arg_opt_tbl[i] =
+ label_get_position((VALUE)iseq->arg_opt_tbl[i]);
}
}
return COMPILE_OK;
@@ -1426,7 +1428,7 @@
}
static int
-iseq_optimize(yarv_iseq_t *iseqobj, LINK_ANCHOR *anchor)
+iseq_optimize(yarv_iseq_t *iseq, LINK_ANCHOR *anchor)
{
LINK_ELEMENT *list;
list = FIRST_ELEMENT(anchor);
@@ -1457,7 +1459,7 @@
continue;
}
else if(diobj->insn_id == BIN(end)){
- INSN *eiobj = new_insn_core(iseqobj, iobj->line_no, BIN(end),
+ INSN *eiobj = new_insn_core(iseq, iobj->line_no, BIN(end),
diobj->operand_size, diobj->operands);
/* replace */
REPLACE_ELEM((LINK_ELEMENT *)iobj,
@@ -1524,7 +1526,7 @@
}
static INSN*
-new_unified_insn(yarv_iseq_t *iseqobj,
+new_unified_insn(yarv_iseq_t *iseq,
int insn_id, int size, LINK_ELEMENT *seq_list)
{
INSN *iobj = 0;
@@ -1541,7 +1543,7 @@
}
if(argc > 0){
- ptr = operands = (VALUE *)compile_data_alloc(iseqobj, sizeof(VALUE) * argc);
+ ptr = operands = (VALUE *)compile_data_alloc(iseq, sizeof(VALUE) * argc);
}
/* copy operands */
@@ -1553,7 +1555,7 @@
list = list->next;
}
- return new_insn_core(iseqobj, iobj->line_no, insn_id, argc, operands);
+ return new_insn_core(iseq, iobj->line_no, insn_id, argc, operands);
}
@@ -1563,7 +1565,7 @@
* It's future work (if compile time was bottle neck).
*/
static int
-iseq_insns_unification(yarv_iseq_t *iseqobj, LINK_ANCHOR *anchor)
+iseq_insns_unification(yarv_iseq_t *iseq, LINK_ANCHOR *anchor)
{
#if OPT_INSTRUCTIONS_UNIFICATION
LINK_ELEMENT *list;
@@ -1588,7 +1590,7 @@
li = li->next;
}
/* matched */
- niobj = new_unified_insn(iseqobj, unified[0], unified[1]-1, list);
+ niobj = new_unified_insn(iseq, unified[0], unified[1]-1, list);
/* insert to list */
niobj->link.prev = (LINK_ELEMENT *)iobj->link.prev;
@@ -1674,7 +1676,7 @@
#endif
static int
-set_sequence_stackcaching(yarv_iseq_t *iseqobj, LINK_ANCHOR *anchor)
+set_sequence_stackcaching(yarv_iseq_t *iseq, LINK_ANCHOR *anchor)
{
#if OPT_STACK_CACHING
LINK_ELEMENT *list;
@@ -1699,7 +1701,7 @@
case BIN(nop):{
/* exception merge point */
if(state != SCS_AX){
- INSN *rpobj = new_insn_body(iseqobj, 0, BIN(reput), 0);
+ INSN *rpobj = new_insn_body(iseq, 0, BIN(reput), 0);
/* replace this insn */
REPLACE_ELEM(list, (LINK_ELEMENT *)rpobj);
@@ -1765,7 +1767,7 @@
static int
-compile_dstr(VALUE self, yarv_iseq_t *iseqobj, LINK_ANCHOR *ret, NODE *node)
+compile_dstr(VALUE self, yarv_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node)
{
NODE *list = node->nd_next;
VALUE lit = node->nd_lit;
@@ -1795,14 +1797,14 @@
static yarv_iseq_t *
get_root_iseq_object(yarv_iseq_t *iop)
{
- yarv_iseq_t *iseqobj = iop;
- while(iseqobj){
- if(iseqobj->parent_iseq &&
- iseqobj->type != ISEQ_TYPE_CLASS){
- iseqobj = iseqobj->parent_iseq;
+ yarv_iseq_t *iseq = iop;
+ while(iseq){
+ if(iseq->parent_iseq &&
+ iseq->type != ISEQ_TYPE_CLASS){
+ iseq = iseq->parent_iseq;
}
else{
- return iseqobj;
+ return iseq;
}
}
/* unreachable */
@@ -1811,34 +1813,34 @@
}
static int
-get_root_iseq_localsize(yarv_iseq_t *iseqobj)
+get_root_iseq_localsize(yarv_iseq_t *iseq)
{
- iseqobj = get_root_iseq_object(iseqobj);
- return iseqobj->local_size;
+ iseq = get_root_iseq_object(iseq);
+ return iseq->local_size;
}
static int
-compile_branch_condition(VALUE self, yarv_iseq_t *iseqobj,
+compile_branch_condition(VALUE self, yarv_iseq_t *iseq,
LINK_ANCHOR *ret, NODE *cond,
LABEL *then_label, LABEL *else_label)
{
switch(nd_type(cond)){
case NODE_NOT:
- compile_branch_condition(self, iseqobj, ret, cond->nd_body, else_label, then_label);
+ compile_branch_condition(self, iseq, ret, cond->nd_body, else_label, then_label);
break;
case NODE_AND:{
LABEL *label = NEW_LABEL(nd_line(cond));
- compile_branch_condition(self, iseqobj, ret, cond->nd_1st, label, else_label);
+ compile_branch_condition(self, iseq, ret, cond->nd_1st, label, else_label);
ADD_LABEL(ret, label);
- compile_branch_condition(self, iseqobj, ret, cond->nd_2nd, then_label, else_label);
+ compile_branch_condition(self, iseq, ret, cond->nd_2nd, then_label, else_label);
break;
}
case NODE_OR:{
LABEL *label = NEW_LABEL(nd_line(cond));
- compile_branch_condition(self, iseqobj, ret, cond->nd_1st, then_label, label);
+ compile_branch_condition(self, iseq, ret, cond->nd_1st, then_label, label);
ADD_LABEL(ret, label);
- compile_branch_condition(self, iseqobj, ret, cond->nd_2nd, then_label, else_label);
+ compile_branch_condition(self, iseq, ret, cond->nd_2nd, then_label, else_label);
break;
}
case NODE_LIT: /* NODE_LIT is always not true */
@@ -1862,7 +1864,7 @@
}
static int
-compile_array(VALUE self, yarv_iseq_t *iseqobj,
+compile_array(VALUE self, yarv_iseq_t *iseq,
LINK_ANCHOR *ret, NODE *node_root, VALUE opt_p)
{
NODE *node = node_root;
@@ -1885,7 +1887,7 @@
node = node->nd_next;
}
- rb_ary_push(iseqobj->compile_data->mark_ary, ary);
+ rb_ary_push(iseq->compile_data->mark_ary, ary);
ADD_INSN1(ret, nd_line(node_root), duparray, ary);
}
else{
@@ -1913,7 +1915,7 @@
}
static int
-make_masgn_lhs(VALUE self, yarv_iseq_t *iseqobj,
+make_masgn_lhs(VALUE self, yarv_iseq_t *iseq,
LINK_ANCHOR *ret, NODE *node)
{
@@ -1956,12 +1958,12 @@
}
static int
-compile_massign(VALUE self, yarv_iseq_t *iseqobj, LINK_ANCHOR *ret,
+compile_massign(VALUE self, yarv_iseq_t *iseq, LINK_ANCHOR *ret,
NODE *rhsn, NODE *splatn, NODE *lhsn, int llen)
{
if(lhsn != 0){
- compile_massign(self, iseqobj, ret, rhsn, splatn, lhsn->nd_next, llen + 1);
- make_masgn_lhs(self, iseqobj, ret, lhsn->nd_head);
+ compile_massign(self, iseq, ret, rhsn, splatn, lhsn->nd_next, llen + 1);
+ make_masgn_lhs(self, iseq, ret, lhsn->nd_head);
}
else{
int lhs_splat = 0;
@@ -2056,14 +2058,14 @@
}
if(lhs_splat){
- make_masgn_lhs(self, iseqobj, ret, splatn);
+ make_masgn_lhs(self, iseq, ret, splatn);
}
}
return COMPILE_OK;
}
static int
-compile_colon2(VALUE self, yarv_iseq_t *iseqobj, NODE *node,
+compile_colon2(VALUE self, yarv_iseq_t *iseq, NODE *node,
LINK_ANCHOR *pref, LINK_ANCHOR *body)
{
switch(nd_type(node)){
@@ -2078,7 +2080,7 @@
ADD_INSN1(body, nd_line(node), getconstant, ID2SYM(node->nd_mid));
break;
case NODE_COLON2:
- compile_colon2(self, iseqobj, node->nd_head, pref, body);
+ compile_colon2(self, iseq, node->nd_head, pref, body);
debugi("compile_colon2 - colon2", node->nd_mid);
ADD_INSN1(body, nd_line(node), getconstant, ID2SYM(node->nd_mid));
break;
@@ -2091,7 +2093,7 @@
}
static int
-defined_expr(VALUE self, yarv_iseq_t *iseqobj,
+defined_expr(VALUE self, yarv_iseq_t *iseq,
LINK_ANCHOR *ret, NODE *node, LABEL *lfinish, VALUE needstr)
{
char *estr = 0;
@@ -2141,7 +2143,7 @@
case NODE_COLON2:
if(rb_is_const_id(node->nd_mid)){
LABEL *lcont = NEW_LABEL(nd_line(node));
- defined_expr(self, iseqobj, ret, node->nd_head, lfinish, Qfalse);
+ defined_expr(self, iseq, ret, node->nd_head, lfinish, Qfalse);
ADD_INSNL(ret, nd_line(node), if, lcont);
ADD_INSN (ret, nd_line(node), putnil);
@@ -2153,7 +2155,7 @@
}
else{
LABEL *lcont = NEW_LABEL(nd_line(node));
- defined_expr(self, iseqobj, ret, node->nd_head, lfinish, Qfalse);
+ defined_expr(self, iseq, ret, node->nd_head, lfinish, Qfalse);
ADD_INSNL(ret, nd_line(node), if, lcont);
ADD_INSN (ret, nd_line(node), putnil);
@@ -2177,7 +2179,7 @@
if(nd_type(node) == NODE_CALL){
LABEL *lcont = NEW_LABEL(nd_line(node));
- defined_expr(self, iseqobj, ret, node->nd_recv, lfinish, Qfalse);
+ defined_expr(self, iseq, ret, node->nd_recv, lfinish, Qfalse);
ADD_INSNL(ret, nd_line(node), if, lcont);
ADD_INSN (ret, nd_line(node), putnil);
ADD_INSNL(ret, nd_line(node), jump, lfinish);
@@ -2211,7 +2213,7 @@
if(needstr != Qfalse){
VALUE str = rb_str_new2(estr);
ADD_INSN1(ret, nd_line(node), putstring, str);
- rb_ary_push(iseqobj->compile_data->mark_ary, str);
+ rb_ary_push(iseq->compile_data->mark_ary, str);
}
else{
ADD_INSN1(ret, nd_line(node), putobject, Qtrue);
@@ -2287,9 +2289,9 @@
VALUE tmp; /* reserved for macro */
int type;
- yarv_iseq_t *iseqobj;
+ yarv_iseq_t *iseq;
- GetISeqVal(self, iseqobj);
+ GetISeqVal(self, iseq);
GC_CHECK();
@@ -2302,7 +2304,7 @@
}
return COMPILE_OK;
}
- iseqobj->compile_data->last_line = nd_line(node);
+ iseq->compile_data->last_line = nd_line(node);
debug_nodeprint(node);
type = nd_type(node);
@@ -2350,7 +2352,7 @@
else_label = NEW_LABEL(nd_line(node));
end_label = NEW_LABEL(nd_line(node));
- compile_branch_condition(self, iseqobj, cond_seq, node->nd_cond, then_label, else_label);
+ compile_branch_condition(self, iseq, cond_seq, node->nd_cond, then_label, else_label);
COMPILE_(then_seq, "then", node->nd_body, poped);
COMPILE_(else_seq, "else", node->nd_else, poped);
@@ -2461,7 +2463,7 @@
ADD_INSN (ret, nd_line(tempnode), dup);
ADD_INSN2(ret, nd_line(tempnode), opt_case_dispatch,
special_literals, elselabel);
- rb_ary_push(iseqobj->compile_data->mark_ary, special_literals);
+ rb_ary_push(iseq->compile_data->mark_ary, special_literals);
}
ADD_SEQ (ret, cond_seq);
@@ -2518,23 +2520,23 @@
case NODE_OPT_N:
case NODE_WHILE:
case NODE_UNTIL:{
- LABEL *prev_start_label = iseqobj->compile_data->start_label;
- LABEL *prev_end_label = iseqobj->compile_data->end_label;
- LABEL *prev_redo_label = iseqobj->compile_data->redo_label;
- VALUE prev_loopval_popped = iseqobj->compile_data->loopval_popped;
+ LABEL *prev_start_label = iseq->compile_data->start_label;
+ LABEL *prev_end_label = iseq->compile_data->end_label;
+ LABEL *prev_redo_label = iseq->compile_data->redo_label;
+ VALUE prev_loopval_popped = iseq->compile_data->loopval_popped;
struct iseq_compile_data_ensure_node_stack *enlp =
- iseqobj->compile_data->ensure_node_stack;
+ iseq->compile_data->ensure_node_stack;
- LABEL * next_label = iseqobj->compile_data->start_label =
+ LABEL * next_label = iseq->compile_data->start_label =
NEW_LABEL(nd_line(node)); /* next */
- LABEL * redo_label = iseqobj->compile_data->redo_label =
+ LABEL * redo_label = iseq->compile_data->redo_label =
NEW_LABEL(nd_line(node)); /* redo */
- LABEL * break_label = iseqobj->compile_data->end_label =
+ LABEL * break_label = iseq->compile_data->end_label =
NEW_LABEL(nd_line(node)); /* break */
LABEL * end_label = NEW_LABEL(nd_line(node));
- iseqobj->compile_data->loopval_popped = poped;
- iseqobj->compile_data->ensure_node_stack = 0;
+ iseq->compile_data->loopval_popped = poped;
+ iseq->compile_data->ensure_node_stack = 0;
if(type == NODE_OPT_N || node->nd_state){
ADD_INSNL(ret, nd_line(node), jump, next_label);
@@ -2545,12 +2547,12 @@
ADD_LABEL(ret, next_label); /* next */
if(type == NODE_WHILE){
- compile_branch_condition(self, iseqobj, ret,
+ compile_branch_condition(self, iseq, ret,
node->nd_cond, redo_label, end_label);
}
else if(type == NODE_UNTIL){
/* untile */
- compile_branch_condition(self, iseqobj, ret,
+ compile_branch_condition(self, iseq, ret,
node->nd_cond, end_label, redo_label);
}
else{
@@ -2570,16 +2572,16 @@
ADD_CATCH_ENTRY(CATCH_TYPE_NEXT, redo_label, break_label, 0, 0, next_label);
ADD_CATCH_ENTRY(CATCH_TYPE_REDO, redo_label, break_label, 0, 0, redo_label);
- iseqobj->compile_data->start_label = prev_start_label;
- iseqobj->compile_data->end_label = prev_end_label;
- iseqobj->compile_data->redo_label = prev_redo_label;
- iseqobj->compile_data->loopval_popped = prev_loopval_popped;
- iseqobj->compile_data->ensure_node_stack = enlp;
+ iseq->compile_data->start_label = prev_start_label;
+ iseq->compile_data->end_label = prev_end_label;
+ iseq->compile_data->redo_label = prev_redo_label;
+ iseq->compile_data->loopval_popped = prev_loopval_popped;
+ iseq->compile_data->ensure_node_stack = enlp;
break;
}
case NODE_ITER:
case NODE_FOR:{
- VALUE prevblock = iseqobj->compile_data->current_block;
+ VALUE prevblock = iseq->compile_data->current_block;
LABEL * retry_label = NEW_LABEL(nd_line(node));
LABEL * retry_end_l = NEW_LABEL(nd_line(node));
@@ -2587,25 +2589,25 @@
if(nd_type(node) == NODE_FOR){
COMPILE(ret, "iter caller (for)", node->nd_iter);
- iseqobj->compile_data->current_block =
- NEW_CHILD_ISEQOBJ(node, make_name_for_block(iseqobj),
+ iseq->compile_data->current_block =
+ NEW_CHILD_ISEQVAL(node, make_name_for_block(iseq),
self, ISEQ_TYPE_BLOCK);
ADD_SEND_R(ret, nd_line(node), ID2SYM(idEach), INT2FIX(0),
- iseqobj->compile_data->current_block, INT2FIX(0));
+ iseq->compile_data->current_block, INT2FIX(0));
if(poped){
ADD_INSN(ret, nd_line(node), pop);
}
}
else{
- iseqobj->compile_data->current_block =
- NEW_CHILD_ISEQOBJ(node, make_name_for_block(iseqobj),
+ iseq->compile_data->current_block =
+ NEW_CHILD_ISEQVAL(node, make_name_for_block(iseq),
self, ISEQ_TYPE_BLOCK);
COMPILE_(ret, "iter caller", node->nd_iter, poped);
}
ADD_LABEL(ret, retry_end_l);
- rb_ary_push(iseqobj->iseq_mark_ary, iseqobj->compile_data->current_block);
- iseqobj->compile_data->current_block = prevblock;
+ rb_ary_push(iseq->iseq_mark_ary, iseq->compile_data->current_block);
+ iseq->compile_data->current_block = prevblock;
ADD_CATCH_ENTRY(CATCH_TYPE_RETRY, retry_label, retry_end_l, 0, 0, retry_label);
break;
@@ -2613,21 +2615,21 @@
case NODE_BREAK:{
unsigned long level = 0;
- if(iseqobj->compile_data->redo_label != 0){
+ if(iseq->compile_data->redo_label != 0){
/* while/until */
COMPILE_(ret, "break val(while/until)", node->nd_stts,
- iseqobj->compile_data->loopval_popped);
- add_ensure_iseq(ret, iseqobj, self);
- ADD_INSNL(ret, nd_line(node), jump, iseqobj->compile_data->end_label);
+ iseq->compile_data->loopval_popped);
+ add_ensure_iseq(ret, iseq, self);
+ ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->end_label);
}
- else if(iseqobj->type == ISEQ_TYPE_BLOCK){
+ else if(iseq->type == ISEQ_TYPE_BLOCK){
break_by_insn:
/* escape from block */
COMPILE(ret, "break val (block)", node->nd_stts);
ADD_INSN1(ret, nd_line(node), throw, I2F(level | 0x02) /* TAG_BREAK */);
}
else{
- yarv_iseq_t *ip = iseqobj->parent_iseq;
+ yarv_iseq_t *ip = iseq->parent_iseq;
while(ip){
level++;
@@ -2651,17 +2653,17 @@
case NODE_NEXT:{
unsigned long level = 0;
- if(iseqobj->compile_data->redo_label != 0){
- add_ensure_iseq(ret, iseqobj, self);
- ADD_INSNL(ret, nd_line(node), jump, iseqobj->compile_data->start_label);
+ if(iseq->compile_data->redo_label != 0){
+ add_ensure_iseq(ret, iseq, self);
+ ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->start_label);
}
- else if(iseqobj->compile_data->end_label){
+ else if(iseq->compile_data->end_label){
COMPILE(ret, "next val", node->nd_stts);
- add_ensure_iseq(ret, iseqobj, self);
- ADD_INSNL(ret, nd_line(node), jump, iseqobj->compile_data->end_label);
+ add_ensure_iseq(ret, iseq, self);
+ ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->end_label);
}
else{
- yarv_iseq_t *ip = iseqobj->parent_iseq;
+ yarv_iseq_t *ip = iseq->parent_iseq;
while(ip){
level = 0x8000;
if(ip->type == ISEQ_TYPE_BLOCK){
@@ -2677,7 +2679,7 @@
}
if(ip != 0){
COMPILE(ret, "next val", node->nd_stts);
- add_ensure_iseq(ret, iseqobj, self);
+ add_ensure_iseq(ret, iseq, self);
ADD_INSN1(ret, nd_line(node), throw, I2F(level | 0x03) /* TAG_NEXT */);
}
else{
@@ -2687,15 +2689,15 @@
break;
}
case NODE_REDO:{
- if(iseqobj->compile_data->redo_label){
- add_ensure_iseq(ret, iseqobj, self);
- ADD_INSNL(ret, nd_line(node), jump, iseqobj->compile_data->redo_label);
+ if(iseq->compile_data->redo_label){
+ add_ensure_iseq(ret, iseq, self);
+ ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->redo_label);
}
- else if(iseqobj->compile_data->start_label){
- ADD_INSNL(ret, nd_line(node), jump, iseqobj->compile_data->start_label);
+ else if(iseq->compile_data->start_label){
+ ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->start_label);
}
else{
- yarv_iseq_t *ip = iseqobj->parent_iseq;
+ yarv_iseq_t *ip = iseq->parent_iseq;
unsigned long level = 0x8000 | 0x4000;
while(ip){
if(ip->type == ISEQ_TYPE_BLOCK){
@@ -2707,7 +2709,7 @@
ip = ip->parent_iseq;
}
if(ip != 0){
- add_ensure_iseq(ret, iseqobj, self);
+ add_ensure_iseq(ret, iseq, self);
ADD_INSN1(ret, nd_line(node), throw, I2F(level | 0x05) /* TAG_REDO */);
}
else{
@@ -2717,8 +2719,8 @@
break;
}
case NODE_RETRY:{
- if(iseqobj->type == ISEQ_TYPE_BLOCK ||
- iseqobj->type == ISEQ_TYPE_RESCUE){
+ if(iseq->type == ISEQ_TYPE_BLOCK ||
+ iseq->type == ISEQ_TYPE_RESCUE){
ADD_INSN (ret, nd_line(node), putnil);
ADD_INSN1(ret, nd_line(node), throw, I2F(0x04) /* TAG_RETRY */);
}
@@ -2735,7 +2737,7 @@
LABEL *lstart = NEW_LABEL(nd_line(node));
LABEL *lend = NEW_LABEL(nd_line(node));
LABEL *lcont = NEW_LABEL(nd_line(node));
- VALUE rescue = NEW_CHILD_ISEQOBJ(node->nd_resq, rb_str_new2("rescue"),
+ VALUE rescue = NEW_CHILD_ISEQVAL(node->nd_resq, rb_str_new2("rescue"),
self, ISEQ_TYPE_RESCUE);
ADD_LABEL(ret, lstart);
@@ -2790,23 +2792,23 @@
}
case NODE_ENSURE:{
DECL_ANCHOR(ensr);
- VALUE ensure = NEW_CHILD_ISEQOBJ(node->nd_ensr, rb_str_new2("ensure"),
+ VALUE ensure = NEW_CHILD_ISEQVAL(node->nd_ensr, rb_str_new2("ensure"),
self, ISEQ_TYPE_ENSURE);
LABEL * lstart = NEW_LABEL(nd_line(node));
LABEL * lend = NEW_LABEL(nd_line(node));
LABEL * lcont = NEW_LABEL(nd_line(node));
- VALUE prev_in_ensure = iseqobj->compile_data->in_ensure;
+ VALUE prev_in_ensure = iseq->compile_data->in_ensure;
struct iseq_compile_data_ensure_node_stack enl = {
node->nd_ensr,
- iseqobj->compile_data->ensure_node_stack /* prev */
+ iseq->compile_data->ensure_node_stack /* prev */
};
- iseqobj->compile_data->in_ensure = Qtrue;
+ iseq->compile_data->in_ensure = Qtrue;
COMPILE_POPED(ensr, "ensure ensr", node->nd_ensr);
- iseqobj->compile_data->in_ensure = prev_in_ensure;
- iseqobj->compile_data->ensure_node_stack = &enl;
+ iseq->compile_data->in_ensure = prev_in_ensure;
+ iseq->compile_data->ensure_node_stack = &enl;
ADD_LABEL(ret, lstart);
COMPILE_(ret, "ensure head", node->nd_head, poped);
@@ -2820,7 +2822,7 @@
ADD_LABEL(ret, lcont);
ADD_CATCH_ENTRY(CATCH_TYPE_ENSURE, lstart, lend, ensure, 0, lcont);
- iseqobj->compile_data->ensure_node_stack = enl.prev;
+ iseq->compile_data->ensure_node_stack = enl.prev;
break;
}
@@ -2854,7 +2856,7 @@
}
case NODE_MASGN:{
- compile_massign(self, iseqobj, ret,
+ compile_massign(self, iseq, ret,
node->nd_value, /* rhsn */
node->nd_args, /* splat */
node->nd_head, /* lhsn */
@@ -2866,7 +2868,7 @@
}
case NODE_LASGN:{
- int idx = get_root_iseq_localsize(iseqobj) + 2 - node->nd_cnt;
+ int idx = get_root_iseq_localsize(iseq) + 2 - node->nd_cnt;
debugs("lvar: %d\n", idx);
COMPILE(ret, "lvalue", node->nd_value);
@@ -2889,8 +2891,8 @@
idx = get_dyna_var_idx(self, node->nd_vid, &lv, &ls);
if(nd_type(node) == NODE_DASGN_CURR &&
lv > 0 &&
- iseqobj->type != ISEQ_TYPE_RESCUE &&
- iseqobj->compile_data->for_iseq != 1){
+ iseq->type != ISEQ_TYPE_RESCUE &&
+ iseq->compile_data->for_iseq != 1){
rb_bug("NODE_DASGN_CURR, but lv == %d (line: %d)", lv, nd_line(node));
}
@@ -2964,7 +2966,7 @@
*/
COMPILE(ret, "NODE_OP_ASGN1 recv", node->nd_recv);
- compile_array(self, iseqobj, args, node->nd_args->nd_next, Qfalse);
+ compile_array(self, iseq, args, node->nd_args->nd_next, Qfalse);
POP_ELEMENT(args); POP_ELEMENT(args);
argc = node->nd_args->nd_alen - 2;
@@ -3126,8 +3128,8 @@
VALUE argc;
VALUE flag = 0;
VALUE block = 0;
- VALUE parent_block = iseqobj->compile_data->current_block;
- iseqobj->compile_data->current_block = Qfalse;
+ VALUE parent_block = iseq->compile_data->current_block;
+ iseq->compile_data->current_block = Qfalse;
#if SUPPORT_JOKE
@@ -3159,8 +3161,8 @@
SYMBOL_P(node->nd_args->nd_head->nd_lit)){
label_sym = label = node->nd_args->nd_head->nd_lit;
- if((label = rb_hash_aref(iseqobj->compile_data, label_sym)) == Qnil){
- rb_hash_aset(iseqobj->compile_data, label_sym,
+ if((label = rb_hash_aref(iseq->compile_data, label_sym)) == Qnil){
+ rb_hash_aset(iseq->compile_data, label_sym,
label = NEW_LABEL(nd_line(node)));
}
}
@@ -3203,7 +3205,7 @@
}
argc = I2F(argc+1);
- compile_array(self, iseqobj, args, node->nd_args->nd_head, Qfalse);
+ compile_array(self, iseq, args, node->nd_args->nd_head, Qfalse);
POP_ELEMENT(args);
// argc = I2F(LIST_SIZE(args) + 1);
@@ -3212,7 +3214,7 @@
flag |= VM_CALL_ARGS_SPLAT_BIT;
}
else{
- compile_array(self, iseqobj, args, node->nd_args, Qfalse);
+ compile_array(self, iseq, args, node->nd_args, Qfalse);
argc = OPERAND_AT(POP_ELEMENT(args), 0);
}
}
@@ -3266,7 +3268,7 @@
flag |= VM_CALL_ARGS_SPLAT_BIT;
}
else if(nd_type(node->nd_args) == NODE_ARGSCAT){
- compile_array(self, iseqobj, args, node->nd_args->nd_head, Qfalse);
+ compile_array(self, iseq, args, node->nd_args->nd_head, Qfalse);
POP_ELEMENT(args);
argc = LIST_SIZE(args) + 1;
@@ -3275,7 +3277,7 @@
flag |= VM_CALL_ARGS_SPLAT_BIT;
}
else{
- compile_array(self, iseqobj, args, node->nd_args, Qfalse);
+ compile_array(self, iseq, args, node->nd_args, Qfalse);
argc = OPERAND_AT(POP_ELEMENT(args), 0);
}
}
@@ -3301,7 +3303,7 @@
break;
}
case NODE_ARRAY:{
- compile_array(self, iseqobj, ret, node, Qtrue);
+ compile_array(self, iseq, ret, node, Qtrue);
if(poped){
ADD_INSN(ret, nd_line(node), pop);
}
@@ -3332,7 +3334,7 @@
switch(type){
case NODE_ARRAY:{
- compile_array(self, iseqobj, list, node->nd_head, Qfalse);
+ compile_array(self, iseq, list, node->nd_head, Qfalse);
size = OPERAND_AT(POP_ELEMENT(list), 0);
ADD_SEQ (ret, list);
break;
@@ -3353,7 +3355,7 @@
break;
}
case NODE_RETURN:{
- yarv_iseq_t *is = iseqobj;
+ yarv_iseq_t *is = iseq;
while(is){
if(is->type == ISEQ_TYPE_TOP ||
@@ -3365,11 +3367,11 @@
COMPILE(ret, "return nd_stts(return val)", node->nd_stts);
if(is->type == ISEQ_TYPE_METHOD){
- add_ensure_iseq(ret, iseqobj, self);
+ add_ensure_iseq(ret, iseq, self);
ADD_INSN(ret, nd_line(node), end);
}
else{
- add_ensure_iseq(ret, iseqobj, self);
+ add_ensure_iseq(ret, iseq, self);
ADD_INSN1(ret, nd_line(node), throw, I2F(0x01) /* TAG_RETURN */);
}
// TODO: more restricted check needed?
@@ -3384,8 +3386,8 @@
int argc;
unsigned long flag = 0;
- if(iseqobj->type == ISEQ_TYPE_TOP ||
- iseqobj->type == ISEQ_TYPE_CLASS){
+ if(iseq->type == ISEQ_TYPE_TOP ||
+ iseq->type == ISEQ_TYPE_CLASS){
COMPILE_ERROR(("can't put yield"));
}
@@ -3399,7 +3401,7 @@
COMPILE(args, "yield with an arg", node->nd_head);
}
else{
- compile_array(self, iseqobj, args, node->nd_head, Qfalse);
+ compile_array(self, iseq, args, node->nd_head, Qfalse);
POP_ELEMENT(args);
}
debugs("argc: %d\n", argc);
@@ -3410,7 +3412,7 @@
flag |= VM_CALL_ARGS_SPLAT_BIT;
}
- compile_array(self, iseqobj, args, node->nd_head->nd_head, Qfalse);
+ compile_array(self, iseq, args, node->nd_head->nd_head, Qfalse);
POP_ELEMENT(args);
argc = LIST_SIZE(args) + 1;
@@ -3443,7 +3445,7 @@
}
case NODE_LVAR:{
if(!poped){
- int idx = get_root_iseq_localsize(iseqobj) + 2 - node->nd_cnt;
+ int idx = get_root_iseq_localsize(iseq) + 2 - node->nd_cnt;
debugs("idx: %d\n", idx);
ADD_INSN1(ret, nd_line(node), getlocal, I2F(idx));
}
@@ -3557,7 +3559,7 @@
break;
}
case NODE_DSTR:{
- compile_dstr(self, iseqobj, ret, node);
+ compile_dstr(self, iseq, ret, node);
if(poped){
ADD_INSN(ret, nd_line(node), pop);
@@ -3576,7 +3578,7 @@
}
case NODE_DXSTR:{
ADD_INSN(ret, nd_line(node), putself);
- compile_dstr(self, iseqobj, ret, node);
+ compile_dstr(self, iseq, ret, node);
ADD_SEND(ret, nd_line(node), ID2SYM(idBackquote), INT2FIX(1));
if(poped){
@@ -3596,7 +3598,7 @@
break;
}
case NODE_DREGX:{
- compile_dstr(self, iseqobj, ret, node);
+ compile_dstr(self, iseq, ret, node);
ADD_INSN1(ret, nd_line(node), toregexp, I2F(node->nd_cflag));
if(poped){
@@ -3613,7 +3615,7 @@
ADD_INSN2(ret, nd_line(node), onceinlinecache, NEW_INLINE_CACHE_ENTRY(), lend);
ADD_INSN (ret, nd_line(node), pop);
- compile_dstr(self, iseqobj, ret, node);
+ compile_dstr(self, iseq, ret, node);
ADD_INSN1(ret, nd_line(node), toregexp, I2F(node->nd_cflag));
ADD_INSN1(ret, nd_line(node), setinlinecache, lstart);
@@ -3656,51 +3658,51 @@
break;
}
case NODE_BLOCK_ARG:{
- iseqobj->arg_block = node->nd_cnt - 2 + 1;
- iseqobj->arg_simple = 0;
+ iseq->arg_block = node->nd_cnt - 2 + 1;
+ iseq->arg_simple = 0;
break;
}
case NODE_BLOCK_PASS:{
- VALUE prevblock = iseqobj->compile_data->current_block;
+ VALUE prevblock = iseq->compile_data->current_block;
LABEL * retry_label = NEW_LABEL(nd_line(node));
LABEL * retry_end_l = NEW_LABEL(nd_line(node));
DECL_ANCHOR(current_block);
COMPILE(current_block, "block pass proc", node->nd_body);
- iseqobj->compile_data->current_block = (VALUE)current_block | 1;
+ iseq->compile_data->current_block = (VALUE)current_block | 1;
ADD_LABEL(ret, retry_label);
COMPILE_ (ret, "iter caller (NODE_BLOCK_PASS)", node->nd_iter, poped);
ADD_LABEL(ret, retry_end_l);
- iseqobj->compile_data->current_block = prevblock;
+ iseq->compile_data->current_block = prevblock;
ADD_CATCH_ENTRY(CATCH_TYPE_RETRY, retry_label, retry_end_l, 0, 0, retry_label);
break;
}
case NODE_DEFN:{
- VALUE iseq = NEW_ISEQOBJ(node->nd_defn,
- rb_str_new2(rb_id2name(node->nd_mid)),
- ISEQ_TYPE_METHOD);
+ VALUE iseqval = NEW_ISEQVAL(node->nd_defn,
+ rb_str_new2(rb_id2name(node->nd_mid)),
+ ISEQ_TYPE_METHOD);
- debugp_param("defn/iseq", iseq);
+ debugp_param("defn/iseq", iseqval);
- ADD_INSN2(ret, nd_line(node), methoddef, ID2SYM(node->nd_mid), iseq);
+ ADD_INSN2(ret, nd_line(node), methoddef, ID2SYM(node->nd_mid), iseqval);
if(!poped){
ADD_INSN(ret, nd_line(node), putnil);
}
- debugp_param("defn", iseq);
+ debugp_param("defn", iseqval);
break;
}
case NODE_DEFS:{
- VALUE iseq = NEW_ISEQOBJ(node->nd_defn,
- rb_str_new2(rb_id2name(node->nd_mid)),
+ VALUE iseqval = NEW_ISEQVAL(node->nd_defn,
+ rb_str_new2(rb_id2name(node->nd_mid)),
ISEQ_TYPE_METHOD);
- debugp_param("defs/iseq", iseq);
+ debugp_param("defs/iseq", iseqval);
COMPILE(ret, "defs: recv", node->nd_recv);
- ADD_INSN2(ret, nd_line(node), singletonmethoddef, ID2SYM(node->nd_mid), iseq);
+ ADD_INSN2(ret, nd_line(node), singletonmethoddef, ID2SYM(node->nd_mid), iseqval);
if(!poped){
ADD_INSN(ret, nd_line(node), putnil);
}
@@ -3740,14 +3742,14 @@
break;
}
case NODE_CLASS:{
- VALUE iseq =
- NEW_CHILD_ISEQOBJ(node->nd_body,
+ VALUE iseqval =
+ NEW_CHILD_ISEQVAL(node->nd_body,
make_name_with_str("<class:%s>", rb_id2name(node->nd_cpath->nd_mid)),
self, ISEQ_TYPE_CLASS);
COMPILE(ret, "cbase", node->nd_cpath->nd_head);
COMPILE(ret, "super", node->nd_super);
- ADD_INSN2(ret, nd_line(node), classdef, ID2SYM(node->nd_cpath->nd_mid), iseq);
+ ADD_INSN2(ret, nd_line(node), classdef, ID2SYM(node->nd_cpath->nd_mid), iseqval);
ADD_INSN (ret, nd_line(node), popcref);
if(poped){
@@ -3756,13 +3758,13 @@
break;
}
case NODE_MODULE:{
- VALUE iseq =
- NEW_CHILD_ISEQOBJ(node->nd_body,
+ VALUE iseqval =
+ NEW_CHILD_ISEQVAL(node->nd_body,
make_name_with_str("<module:%s>", rb_id2name(node->nd_cpath->nd_mid)),
self, ISEQ_TYPE_CLASS);
COMPILE (ret, "mbase", node->nd_cpath->nd_head);
- ADD_INSN2(ret, nd_line(node), moduledef, ID2SYM(node->nd_cpath->nd_mid), iseq);
+ ADD_INSN2(ret, nd_line(node), moduledef, ID2SYM(node->nd_cpath->nd_mid), iseqval);
ADD_INSN (ret, nd_line(node), popcref);
if(poped){
ADD_INSN(ret, nd_line(node), pop);
@@ -3770,11 +3772,11 @@
break;
}
case NODE_SCLASS:{
- VALUE iseq = NEW_ISEQOBJ(node->nd_body, rb_str_new2("singletonclass"),
- ISEQ_TYPE_CLASS);
+ VALUE iseqval = NEW_ISEQVAL(node->nd_body, rb_str_new2("singletonclass"),
+ ISEQ_TYPE_CLASS);
COMPILE (ret, "sclass#recv", node->nd_recv);
- ADD_INSN1(ret, nd_line(node), singletonclassdef, iseq);
+ ADD_INSN1(ret, nd_line(node), singletonclassdef, iseqval);
ADD_INSN (ret, nd_line(node), popcref);
if(poped){
ADD_INSN(ret, nd_line(node), pop);
@@ -3789,7 +3791,7 @@
DECL_ANCHOR(pref);
DECL_ANCHOR(body);
- compile_colon2(self, iseqobj, node, pref, body);
+ compile_colon2(self, iseq, node, pref, body);
ADD_SEQ (ret, pref);
ADD_LABEL(ret, lstart);
ADD_INSN2(ret, nd_line(node), getinlinecache, NEW_INLINE_CACHE_ENTRY(), lend);
@@ -3914,7 +3916,7 @@
}
case NODE_ERRINFO:{
if(!poped){
- if(iseqobj->type == ISEQ_TYPE_RESCUE){
+ if(iseq->type == ISEQ_TYPE_RESCUE){
ADD_INSN2(ret, nd_line(node), getdynamic, I2F(1), I2F(0));
}
else{
@@ -3926,13 +3928,13 @@
case NODE_DEFINED:{
if(!poped){
LABEL * lfinish = NEW_LABEL(nd_line(node));
- defined_expr(self, iseqobj, ret, node->nd_head, lfinish, Qtrue);
+ defined_expr(self, iseq, ret, node->nd_head, lfinish, Qtrue);
ADD_LABEL(ret, lfinish);
}
break;
}
case NODE_POSTEXE:{
- ADD_INSN1(ret, nd_line(node), postexe, iseqobj->compile_data->current_block);
+ ADD_INSN1(ret, nd_line(node), postexe, iseq->compile_data->current_block);
break;
}
#ifdef C_ALLOCA
@@ -3958,7 +3960,7 @@
break;
}
case NODE_DSYM:{
- compile_dstr(self, iseqobj, ret, node);
+ compile_dstr(self, iseq, ret, node);
if(!poped){
ADD_SEND(ret, nd_line(node), ID2SYM(idIntern), I2F(0));
}
@@ -3973,7 +3975,7 @@
VALUE argc;
if(node->nd_args){
- compile_array(self, iseqobj, args, node->nd_args, Qfalse);
+ compile_array(self, iseq, args, node->nd_args, Qfalse);
argc = OPERAND_AT(POP_ELEMENT(args), 0);
}
else{
Modified: trunk/compile.h
===================================================================
--- trunk/compile.h 2005-11-20 22:36:09 UTC (rev 296)
+++ trunk/compile.h 2005-11-21 12:22:32 UTC (rev 297)
@@ -62,10 +62,13 @@
#else
-static inline ID r_id(id){
+static inline ID
+r_id(ID id){
return id;
}
-static inline VALUE r_value(value){
+
+static inline VALUE
+r_value(VALUE value){
return value;
}
@@ -88,16 +91,16 @@
/* create new label */
-#define NEW_LABEL(l) new_label_body(iseqobj, l)
+#define NEW_LABEL(l) new_label_body(iseq, l)
#define iseq_filename(iseq) \
(((yarv_iseq_t*)DATA_PTR(iseq))->file_name)
-#define NEW_ISEQOBJ(node, name, type) \
- NEW_CHILD_ISEQOBJ(node, name, 0, type)
+#define NEW_ISEQVAL(node, name, type) \
+ NEW_CHILD_ISEQVAL(node, name, 0, type)
-#define NEW_CHILD_ISEQOBJ(node, name, parent, type) \
- new_child_iseq(self, iseqobj, node, (VALUE)name, (VALUE)parent, (VALUE)type)
+#define NEW_CHILD_ISEQVAL(node, name, parent, type) \
+ new_child_iseq(iseq, node, (VALUE)name, (VALUE)parent, (VALUE)type)
/* add instructions */
#define ADD_SEQ(seq1, seq2) \
@@ -105,25 +108,25 @@
/* add an instruction */
#define ADD_INSN(seq, line, insn) \
- ADD_ELEM(seq, (LINK_ELEMENT *) new_insn_body(iseqobj, line, BIN(insn), 0))
+ ADD_ELEM(seq, (LINK_ELEMENT *) new_insn_body(iseq, line, BIN(insn), 0))
/* add an instruction with label operand */
#define ADD_INSNL(seq, line, insn, label) \
ADD_ELEM(seq, (LINK_ELEMENT *) \
- new_insn_body(iseqobj, line, BIN(insn), 1, (VALUE)label))
+ new_insn_body(iseq, line, BIN(insn), 1, (VALUE)label))
/* add an instruction with some operands (1, 2, 3, 5) */
#define ADD_INSN1(seq, line, insn, op1) \
ADD_ELEM(seq, (LINK_ELEMENT *) \
- new_insn_body(iseqobj, line, BIN(insn), 1, (VALUE)op1))
+ new_insn_body(iseq, line, BIN(insn), 1, (VALUE)op1))
#define ADD_INSN2(seq, line, insn, op1, op2) \
ADD_ELEM(seq, (LINK_ELEMENT *) \
- new_insn_body(iseqobj, line, BIN(insn), 2, (VALUE)op1, (VALUE)op2))
+ new_insn_body(iseq, line, BIN(insn), 2, (VALUE)op1, (VALUE)op2))
#define ADD_INSN3(seq, line, insn, op1, op2, op3) \
ADD_ELEM(seq, (LINK_ELEMENT *) \
- new_insn_body(iseqobj, line, BIN(insn), 3, (VALUE)op1, (VALUE)op2, (VALUE)op3))
+ new_insn_body(iseq, line, BIN(insn), 3, (VALUE)op1, (VALUE)op2, (VALUE)op3))
/* Specific Insn factory */
#define ADD_SEND(seq, line, id, argc) \
@@ -134,22 +137,22 @@
#define ADD_SEND_R(seq, line, id, argc, block, flag) \
ADD_ELEM(seq, (LINK_ELEMENT *) \
- new_insn_send(iseqobj, line, \
+ new_insn_send(iseq, line, \
(VALUE)id, (VALUE)argc, (VALUE)block, (VALUE)flag))
/* add label */
#define ADD_LABEL(seq, label) \
ADD_ELEM(seq, (LINK_ELEMENT *)label)
-#define ADD_CATCH_ENTRY(type, ls, le, iseq, sp, lc) \
- (tmp = rb_ary_new(), \
- rb_ary_push(tmp, type), \
- rb_ary_push(tmp, (VALUE) ls | 1), \
- rb_ary_push(tmp, (VALUE) le | 1), \
- rb_ary_push(tmp, iseq), \
- rb_ary_push(tmp, I2F(sp)), \
- rb_ary_push(tmp, (VALUE) lc | 1), \
- rb_ary_push(iseqobj->catch_table_ary, tmp))
+#define ADD_CATCH_ENTRY(type, ls, le, iseqv, sp, lc) \
+ (tmp = rb_ary_new(), \
+ rb_ary_push(tmp, type), \
+ rb_ary_push(tmp, (VALUE) ls | 1), \
+ rb_ary_push(tmp, (VALUE) le | 1), \
+ rb_ary_push(tmp, iseqv), \
+ rb_ary_push(tmp, I2F(sp)), \
+ rb_ary_push(tmp, (VALUE) lc | 1), \
+ rb_ary_push(iseq->catch_table_ary, tmp))
/* compile node */
#define COMPILE(anchor, desc, node) \
@@ -179,9 +182,9 @@
{ \
VALUE tmp = GET_THREAD()->errinfo; \
if(CPDEBUG)rb_bug strs; \
- GET_THREAD()->errinfo = iseqobj->compile_data->err_info; \
+ GET_THREAD()->errinfo = iseq->compile_data->err_info; \
rb_compile_error strs; \
- iseqobj->compile_data->err_info = GET_THREAD()->errinfo; \
+ iseq->compile_data->err_info = GET_THREAD()->errinfo; \
GET_THREAD()->errinfo = tmp; \
ret = 0; \
break; \
Modified: trunk/yarvcore.c
===================================================================
--- trunk/yarvcore.c 2005-11-20 22:36:09 UTC (rev 296)
+++ trunk/yarvcore.c 2005-11-21 12:22:32 UTC (rev 297)
@@ -464,12 +464,12 @@
}
static VALUE
-cleanup_iseq_build(yarv_iseq_t *iseqobj)
+cleanup_iseq_build(yarv_iseq_t *iseq)
{
VALUE err;
- err = iseqobj->compile_data->err_info;
- compile_data_free(iseqobj->compile_data);
- iseqobj->compile_data = 0;
+ err = iseq->compile_data->err_info;
+ compile_data_free(iseq->compile_data);
+ iseq->compile_data = 0;
if(ruby_nerrs > 0){
ruby_nerrs = 0;
@@ -505,12 +505,12 @@
iseq_inspect(VALUE self)
{
char buff[0x100];
- yarv_iseq_t *iseqobj;
+ yarv_iseq_t *iseq;
- GetISeqVal(self, iseqobj);
+ GetISeqVal(self, iseq);
snprintf(buff, sizeof(buff), "<ISeq:%s@%s>",
- RSTRING(iseqobj->name)->ptr,
- RSTRING(iseqobj->file_name)->ptr);
+ RSTRING(iseq->name)->ptr,
+ RSTRING(iseq->file_name)->ptr);
return rb_str_new2(buff);
}
--
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml