summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-19 01:06:56 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-19 01:06:56 +0000
commitc4c3f238d78f58242682b8c8428da63b3c018e54 (patch)
tree5f405dbd887f81f0a2e05123a8650bfc5de022cb
parent80980a98b10c0fae6b041e4b85fb888467b2dfaa (diff)
* iseq.c:
rename ruby_iseq_disasm_insn() -> rb_iseq_disasm_insn(). rename ruby_iseq_disasm() -> rb_iseq_disasm(). * compile.c: rename ruby_iseq_compile() -> rb_iseq_compile_node(). rename ruby_iseq_translate_threaded_code() -> rb_iseq_translate_threaded_code(). rename ruby_insns_name_array() -> rb_insns_name_array(). rename ruby_iseq_build_from_ary() -> rb_iseq_build_from_ary(). * iseq.c, compile.c: remove ruby_insn_make_insn_table() and make static function insn_make_insn_table(). * iseq.h, ruby.c, vm.c, vm_core.h, vm_eval.c, vm_dump.c, blockinlining.c: ditto. Rename strange "ruby_" prefix to "rb_" prefix. This changes may affect only core because renamed functions require a pointer of rb_iseq_t which is not exposed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog22
-rw-r--r--blockinlining.c2
-rw-r--r--compile.c28
-rw-r--r--iseq.c40
-rw-r--r--iseq.h9
-rw-r--r--ruby.c2
-rw-r--r--vm.c4
-rw-r--r--vm_core.h4
-rw-r--r--vm_dump.c2
-rw-r--r--vm_eval.c3
10 files changed, 69 insertions, 47 deletions
diff --git a/ChangeLog b/ChangeLog
index 4c34c3e9a5..ee50f0276a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+Mon Jan 19 09:53:43 2009 Koichi Sasada <ko1@atdot.net>
+
+ * iseq.c:
+ rename ruby_iseq_disasm_insn() -> rb_iseq_disasm_insn().
+ rename ruby_iseq_disasm() -> rb_iseq_disasm().
+
+ * compile.c:
+ rename ruby_iseq_compile() -> rb_iseq_compile_node().
+ rename ruby_iseq_translate_threaded_code() ->
+ rb_iseq_translate_threaded_code().
+ rename ruby_insns_name_array() -> rb_insns_name_array().
+ rename ruby_iseq_build_from_ary() -> rb_iseq_build_from_ary().
+
+ * iseq.c, compile.c: remove ruby_insn_make_insn_table() and make
+ static function insn_make_insn_table().
+
+ * iseq.h, ruby.c, vm.c, vm_core.h, vm_eval.c, vm_dump.c,
+ blockinlining.c: ditto.
+ Rename strange "ruby_" prefix to "rb_" prefix.
+ This changes may affect only core because renamed functions
+ require a pointer of rb_iseq_t which is not exposed.
+
Mon Jan 19 09:21:04 2009 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/socket/mkconstants.rb: define macros with default value in
diff --git a/blockinlining.c b/blockinlining.c
index a65906632e..27b99ff6d4 100644
--- a/blockinlining.c
+++ b/blockinlining.c
@@ -42,7 +42,7 @@ iseq_special_block(rb_iseq_t *iseq, void *builder)
parent, iseq->type,
GC_GUARDED_PTR(builder));
if (0) {
- printf("%s\n", RSTRING_PTR(ruby_iseq_disasm(iseqval)));
+ printf("%s\n", RSTRING_PTR(rb_iseq_disasm(iseqval)));
}
iseq->cached_special_block = iseqval;
iseq->cached_special_block_builder = builder;
diff --git a/compile.c b/compile.c
index 0cd765c867..60cf14a4af 100644
--- a/compile.c
+++ b/compile.c
@@ -415,7 +415,7 @@ iseq_add_mark_object_compile_time(rb_iseq_t *iseq, VALUE v)
}
VALUE
-ruby_iseq_compile(VALUE self, NODE *node)
+rb_iseq_compile_node(VALUE self, NODE *node)
{
DECL_ANCHOR(ret);
rb_iseq_t *iseq;
@@ -503,7 +503,7 @@ ruby_iseq_compile(VALUE self, NODE *node)
}
int
-ruby_iseq_translate_threaded_code(rb_iseq_t *iseq)
+rb_iseq_translate_threaded_code(rb_iseq_t *iseq)
{
#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
extern const void **vm_get_insns_address_table(void);
@@ -961,10 +961,10 @@ iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
iseq_set_optargs_table(iseq);
debugs("[compile step 5 (iseq_translate_threaded_code)] \n");
- ruby_iseq_translate_threaded_code(iseq);
+ rb_iseq_translate_threaded_code(iseq);
if (compile_debug > 1) {
- VALUE str = ruby_iseq_disasm(iseq->self);
+ VALUE str = rb_iseq_disasm(iseq->self);
printf("%s\n", StringValueCStr(str));
fflush(stdout);
}
@@ -5000,7 +5000,7 @@ dump_disasm_list(struct iseq_link_element *link)
}
VALUE
-ruby_insns_name_array(void)
+rb_insns_name_array(void)
{
VALUE ary = rb_ary_new();
int i;
@@ -5090,6 +5090,20 @@ iseq_build_exception(rb_iseq_t *iseq, struct st_table *labels_table,
return COMPILE_OK;
}
+static struct st_table *
+insn_make_insn_table(void)
+{
+ struct st_table *table;
+ int i;
+ table = st_init_numtable();
+
+ for (i=0; i<VM_INSTRUCTION_SIZE; i++) {
+ st_insert(table, ID2SYM(rb_intern(insn_name(i))), i);
+ }
+
+ return table;
+}
+
static int
iseq_build_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
VALUE body, struct st_table *labels_table)
@@ -5105,7 +5119,7 @@ iseq_build_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
static struct st_table *insn_table;
if (insn_table == 0) {
- insn_table = ruby_insn_make_insn_table();
+ insn_table = insn_make_insn_table();
}
for (i=0; i<len; i++) {
@@ -5226,7 +5240,7 @@ iseq_build_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
static inline VALUE CHECK_INTEGER(VALUE v) {NUM2LONG(v); return v;}
VALUE
-ruby_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
+rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
VALUE exception, VALUE body)
{
int i;
diff --git a/iseq.c b/iseq.c
index a96c9c1eef..28c1a39f98 100644
--- a/iseq.c
+++ b/iseq.c
@@ -331,7 +331,7 @@ rb_iseq_new_with_bopt_and_opt(NODE *node, VALUE name, VALUE filename,
iseq->self = self;
prepare_iseq_build(iseq, name, filename, parent, type, bopt, option);
- ruby_iseq_compile(self, node);
+ rb_iseq_compile_node(self, node);
cleanup_iseq_build(iseq);
return self;
}
@@ -431,7 +431,7 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
prepare_iseq_build(iseq, name, filename,
parent, iseq_type, 0, &option);
- ruby_iseq_build_from_ary(iseq, locals, args, exception, body);
+ rb_iseq_build_from_ary(iseq, locals, args, exception, body);
cleanup_iseq_build(iseq);
return iseqval;
@@ -739,7 +739,7 @@ insn_operand_intern(rb_iseq_t *iseq,
break;
default:
- rb_bug("ruby_iseq_disasm: unknown operand type: %c", type);
+ rb_bug("rb_iseq_disasm: unknown operand type: %c", type);
}
return ret;
}
@@ -749,8 +749,8 @@ insn_operand_intern(rb_iseq_t *iseq,
* Iseq -> Iseq inspect object
*/
VALUE
-ruby_iseq_disasm_insn(VALUE ret, VALUE *iseq, int pos,
- rb_iseq_t *iseqdat, VALUE child)
+rb_iseq_disasm_insn(VALUE ret, VALUE *iseq, int pos,
+ rb_iseq_t *iseqdat, VALUE child)
{
int insn = iseq[pos];
int len = insn_len(insn);
@@ -831,7 +831,7 @@ catch_type(int type)
}
VALUE
-ruby_iseq_disasm(VALUE self)
+rb_iseq_disasm(VALUE self)
{
rb_iseq_t *iseqdat = iseq_check(self);
VALUE *iseq;
@@ -867,7 +867,7 @@ ruby_iseq_disasm(VALUE self)
catch_type((int)entry->type), (int)entry->start,
(int)entry->end, (int)entry->sp, (int)entry->cont);
if (entry->iseq) {
- rb_str_concat(str, ruby_iseq_disasm(entry->iseq));
+ rb_str_concat(str, rb_iseq_disasm(entry->iseq));
}
}
if (iseqdat->catch_table_size != 0) {
@@ -920,12 +920,12 @@ ruby_iseq_disasm(VALUE self)
/* show each line */
for (i = 0; i < size;) {
- i += ruby_iseq_disasm_insn(str, iseq, i, iseqdat, child);
+ i += rb_iseq_disasm_insn(str, iseq, i, iseqdat, child);
}
for (i = 0; i < RARRAY_LEN(child); i++) {
VALUE isv = rb_ary_entry(child, i);
- rb_str_concat(str, ruby_iseq_disasm(isv));
+ rb_str_concat(str, rb_iseq_disasm(isv));
}
return str;
@@ -943,7 +943,7 @@ iseq_s_disasm(VALUE klass, VALUE body)
if ((node = rb_method_body(body)) != 0) {
if (nd_type(node) == RUBY_VM_METHOD_NODE) {
VALUE iseqval = (VALUE)node->nd_body;
- ret = ruby_iseq_disasm(iseqval);
+ ret = rb_iseq_disasm(iseqval);
}
}
@@ -1248,20 +1248,6 @@ iseq_data_to_ary(rb_iseq_t *iseq)
return val;
}
-struct st_table *
-ruby_insn_make_insn_table(void)
-{
- struct st_table *table;
- int i;
- table = st_init_numtable();
-
- for (i=0; i<VM_INSTRUCTION_SIZE; i++) {
- st_insert(table, ID2SYM(rb_intern(insn_name(i))), i);
- }
-
- return table;
-}
-
VALUE
rb_iseq_clone(VALUE iseqval, VALUE newcbase)
{
@@ -1415,7 +1401,7 @@ rb_iseq_build_for_ruby2cext(
iseq->iseq[i+1] = (VALUE)func;
}
- ruby_iseq_translate_threaded_code(iseq);
+ rb_iseq_translate_threaded_code(iseq);
#define ALLOC_AND_COPY(dst, src, type, size) do { \
if (size) { \
@@ -1445,8 +1431,8 @@ Init_ISeq(void)
rb_cISeq = rb_define_class_under(rb_cRubyVM, "InstructionSequence", rb_cObject);
rb_define_alloc_func(rb_cISeq, iseq_alloc);
rb_define_method(rb_cISeq, "inspect", iseq_inspect, 0);
- rb_define_method(rb_cISeq, "disasm", ruby_iseq_disasm, 0);
- rb_define_method(rb_cISeq, "disassemble", ruby_iseq_disasm, 0);
+ rb_define_method(rb_cISeq, "disasm", rb_iseq_disasm, 0);
+ rb_define_method(rb_cISeq, "disassemble", rb_iseq_disasm, 0);
rb_define_method(rb_cISeq, "to_a", iseq_to_a, 0);
rb_define_method(rb_cISeq, "eval", iseq_eval, 0);
diff --git a/iseq.h b/iseq.h
index fecdbc5ecb..981b1fca00 100644
--- a/iseq.h
+++ b/iseq.h
@@ -13,11 +13,10 @@
#define RUBY_COMPILE_H
/* compile.c */
-VALUE ruby_iseq_compile(VALUE self, NODE *node);
-int ruby_iseq_translate_threaded_code(rb_iseq_t *iseq);
-VALUE ruby_insns_name_array(void);
-VALUE ruby_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
- VALUE exception, VALUE body);
+VALUE rb_iseq_compile_node(VALUE self, NODE *node);
+int rb_iseq_translate_threaded_code(rb_iseq_t *iseq);
+VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
+ VALUE exception, VALUE body);
/* iseq.c */
VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
diff --git a/ruby.c b/ruby.c
index c64a7608eb..7ffdc5a277 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1420,7 +1420,7 @@ process_options(VALUE arg)
});
if (opt->dump & DUMP_BIT(insns)) {
- rb_io_write(rb_stdout, ruby_iseq_disasm(iseq));
+ rb_io_write(rb_stdout, rb_iseq_disasm(iseq));
rb_io_flush(rb_stdout);
return Qtrue;
}
diff --git a/vm.c b/vm.c
index 55a2c84b4a..9048b768ef 100644
--- a/vm.c
+++ b/vm.c
@@ -41,6 +41,8 @@ char ruby_vm_redefined_flag[BOP_LAST_];
rb_thread_t *ruby_current_thread = 0;
rb_vm_t *ruby_current_vm = 0;
+VALUE rb_insns_name_array(void);
+
void vm_analysis_operand(int insn, int n, VALUE op);
void vm_analysis_register(int reg, int isset);
void vm_analysis_insn(int insn);
@@ -1890,7 +1892,7 @@ Init_VM(void)
#endif
/* ::VM::InsnNameArray */
- rb_define_const(rb_cRubyVM, "INSTRUCTION_NAMES", ruby_insns_name_array());
+ rb_define_const(rb_cRubyVM, "INSTRUCTION_NAMES", rb_insns_name_array());
/* debug functions ::VM::SDR(), ::VM::NSDR() */
#if VMDEBUG
diff --git a/vm_core.h b/vm_core.h
index 7ccd0de16d..8586c6f03e 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -436,8 +436,8 @@ VALUE rb_iseq_new_main(NODE *node, VALUE filename);
VALUE rb_iseq_new_with_bopt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE);
VALUE rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, const rb_compile_option_t*);
VALUE rb_iseq_compile(VALUE src, VALUE file, VALUE line);
-VALUE ruby_iseq_disasm(VALUE self);
-VALUE ruby_iseq_disasm_insn(VALUE str, VALUE *iseqval, int pos, rb_iseq_t *iseq, VALUE child);
+VALUE rb_iseq_disasm(VALUE self);
+VALUE rb_iseq_disasm_insn(VALUE str, VALUE *iseqval, int pos, rb_iseq_t *iseq, VALUE child);
const char *ruby_node_name(int node);
int rb_iseq_first_lineno(rb_iseq_t *iseq);
diff --git a/vm_dump.c b/vm_dump.c
index aa49b0a54e..5de8f3099d 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -365,7 +365,7 @@ vm_debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp)
int pc = cfp->pc - iseq->iseq_encoded;
printf("%3"PRIdPTRDIFF" ", VM_CFP_CNT(th, cfp));
- ruby_iseq_disasm_insn(0, seq, pc, iseq, 0);
+ rb_iseq_disasm_insn(0, seq, pc, iseq, 0);
}
#if VMDEBUG > 3
diff --git a/vm_eval.c b/vm_eval.c
index 53ec3ac18d..2038ed067c 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -729,8 +729,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
th->base_block = 0;
if (0) { /* for debug */
- extern VALUE ruby_iseq_disasm(VALUE);
- printf("%s\n", RSTRING_PTR(ruby_iseq_disasm(iseqval)));
+ printf("%s\n", RSTRING_PTR(rb_iseq_disasm(iseqval)));
}
/* save new env */