summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-07 01:25:05 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-07 01:25:05 +0000
commit44aef0b53f3e73ec987a668a3284d5e28bdb8121 (patch)
tree4cbe7f49ca7c1b4be5f345870ef3d99126803a31 /compile.c
parent8ee7d0767f7940baeae60ffa95afde93f3378c93 (diff)
* this commit is a result of refactoring. only renaming functions,
moving definitions place, add/remove prototypes, deleting unused variables and removing yarv.h. This commit doesn't change any behavior of ruby/vm. * yarv.h, common.mk: remove yarv.h (contents are moved to yarvcore.h). * error.c, eval_intern.h: include yarvcore.h instead yarv.h * rename some functions: * debug.[ch]: debug_*() -> ruby_debug_*() * iseq.c: iseq_*() -> rb_iseq_*(), ruby_iseq_disasm() * iseq.c: node_name() -> ruby_node_name() * vm.c: yarv_check_redefinition_opt_method() -> rb_vm_check_redefinition_opt_method() * some refactoring with checking -Wall. * array.c: remove rb_ary_ptr() (unused) and remove unused local variables. * object.c: add a prototype of rb_mod_module_exec(). * eval_intern.h (ruby_cref): set it inline. * eval_load.c (rb_load), yarvcore.c: yarv_load() -> rb_load_internal(). * parse.y: add a prototype of rb_parse_in_eval() (in eval.c). * process.c: add a prototype of rb_thread_stop_timer_thread() (in thread.c). * thread.c: remove raw_gets() function (unused) and fix some format mismatch (format mismatchs have remained yet. this is todo). * thread.c (rb_thread_wait_fd_rw): fix typo on label name. * thread_pthread.ci: comment out codes with USE_THREAD_CACHE. * vm.c (rb_svar, rb_backref_get, rb_backref_get, rb_lastline_get, rb_lastline_set) : moved from yarvcore.c. * vm.c (yarv_init_redefined_flag): add a prototype and rename yarv_opt_method_table to vm_opt_method_table. * vm.c (rb_thread_eval): moved from yarvcore.c. * yarvcore.c: remove unused global variables and fix to use nsdr(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/compile.c b/compile.c
index eb4101447e..06446bb36d 100644
--- a/compile.c
+++ b/compile.c
@@ -27,6 +27,8 @@
#define va_init_list(a,b) va_start(a)
#endif
+VALUE iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt);
+
/* types */
#define ISEQ_ELEMENT_NONE INT2FIX(0x00)
@@ -83,7 +85,6 @@ static long gl_tmp = 0;
static void debug_list(LINK_ANCHOR *anchor);
#endif
-static void dump_disasm_anchor(LINK_ANCHOR *anc);
static void dump_disasm_list(LINK_ELEMENT *elem);
static int insn_data_length(INSN *iobj);
@@ -688,7 +689,6 @@ static VALUE
new_child_iseq(rb_iseq_t *iseq, NODE *node,
VALUE name, VALUE parent, VALUE type)
{
- VALUE args[6];
VALUE ret;
debugs("[new_child_iseq]> ---------------------------------------\n");
@@ -750,7 +750,7 @@ iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
GC_CHECK();
if (CPDEBUG > 1) {
- VALUE str = iseq_disasm(iseq->self);
+ VALUE str = ruby_iseq_disasm(iseq->self);
printf("%s\n", StringValueCStr(str));
fflush(stdout);
}
@@ -2002,12 +2002,12 @@ compile_branch_condition(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * cond,
case NODE_LIT: /* NODE_LIT is always not true */
case NODE_TRUE:
case NODE_STR:
- /* printf("useless conditon eliminate (%s)\n", node_name(nd_type(cond))); */
+ /* printf("useless conditon eliminate (%s)\n", ruby_node_name(nd_type(cond))); */
ADD_INSNL(ret, nd_line(cond), jump, then_label);
break;
case NODE_FALSE:
case NODE_NIL:
- /* printf("useless conditon eliminate (%s)\n", node_name(nd_type(cond))); */
+ /* printf("useless conditon eliminate (%s)\n", ruby_node_name(nd_type(cond))); */
ADD_INSNL(ret, nd_line(cond), jump, else_label);
break;
default:
@@ -2249,7 +2249,7 @@ compile_massign(rb_iseq_t *iseq, LINK_ANCHOR *ret,
COMPILE(ret, "rhs to ary (splat/default)", rhsn);
ADD_INSN2(ret, nd_line(rhsn), expandarray, INT2FIX(llen),
INT2FIX(lhs_splat));
- /* rb_bug("unknown rhs: %s", node_name(nd_type(rhsn))); */
+ /* rb_bug("unknown rhs: %s", ruby_node_name(nd_type(rhsn))); */
}
}
else {
@@ -2469,7 +2469,7 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
ADD_CATCH_ENTRY(CATCH_TYPE_ENSURE, lstart, lend, ensure, lfinish);
return 1;
- /* rb_bug("unimplemented defined: %s", node_name(nd_type(node))); */
+ /* rb_bug("unimplemented defined: %s", ruby_node_name(nd_type(node))); */
} /* end of default */
}
@@ -2571,7 +2571,6 @@ setup_arg(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *node, VALUE *flag)
{
VALUE argc = INT2FIX(0);
NODE *argn = node->nd_args;
- NODE *argp = 0;
DECL_ANCHOR(arg_block);
DECL_ANCHOR(args_push);
@@ -2718,7 +2717,6 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
case NODE_CASE:{
NODE *vals;
- NODE *val;
NODE *tempnode = node;
LABEL *endlabel, *elselabel;
DECL_ANCHOR(head);
@@ -2736,7 +2734,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
type = nd_type(node);
if (type != NODE_WHEN) {
- COMPILE_ERROR(("NODE_CASE: unexpected node. must be NODE_WHEN, but %s", node_name(type)));
+ COMPILE_ERROR(("NODE_CASE: unexpected node. must be NODE_WHEN, but %s", ruby_node_name(type)));
}
endlabel = NEW_LABEL(nd_line(node));
@@ -2772,7 +2770,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSNL(cond_seq, nd_line(val), branchif, l1);
}
else {
- rb_bug("NODE_CASAE: unknown node (%s)", node_name(nd_type(vals)));
+ rb_bug("NODE_CASAE: unknown node (%s)", ruby_node_name(nd_type(vals)));
}
}
else {
@@ -3768,7 +3766,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
default:
- rb_bug("can't make hash with this node: %s", node_name(type));
+ rb_bug("can't make hash with this node: %s", ruby_node_name(type));
}
ADD_INSN1(ret, nd_line(node), newhash, size);
@@ -4531,7 +4529,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
default:
- COMPILE_ERROR(("BUG: unknown node (default): %s", node_name(type)));
+ COMPILE_ERROR(("BUG: unknown node (default): %s", ruby_node_name(type)));
return Qnil;
}
@@ -4630,12 +4628,6 @@ insn_data_to_s_detail(INSN *iobj)
}
static void
-dump_disasm_anchor(LINK_ANCHOR *anc)
-{
- dump_disasm_list(FIRST_ELEMENT(anc));
-}
-
-static void
dump_disasm_list(struct iseq_link_element *link)
{
int pos = 0;
@@ -4729,8 +4721,6 @@ get_exception_sym2type(VALUE sym)
return 0;
}
-VALUE iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt);
-
static int
iseq_build_exception(rb_iseq_t *iseq, struct st_table *labels_table,
VALUE exception)