summaryrefslogtreecommitdiff
path: root/compile.c
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 /compile.c
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
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c28
1 files changed, 21 insertions, 7 deletions
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;