1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* compile.c (ruby_iseq_compile, ruby_iseq_translate_threaded_code),

(ruby_insns_name_array, ruby_iseq_build_from_ary): prefixed with
  ruby_.

* iseq.c (ruby_iseq_load, ruby_insn_make_insn_table): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-12-05 03:35:48 +00:00
parent cc1401e504
commit 794eb7bc49
5 changed files with 42 additions and 29 deletions

View file

@ -1,3 +1,11 @@
Fri Dec 5 12:35:46 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* compile.c (ruby_iseq_compile, ruby_iseq_translate_threaded_code),
(ruby_insns_name_array, ruby_iseq_build_from_ary): prefixed with
ruby_.
* iseq.c (ruby_iseq_load, ruby_insn_make_insn_table): ditto.
Fri Dec 5 10:01:43 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* string.c (rb_str_cmp_m): fixed rdoc. pointed out by <Thomas

View file

@ -415,7 +415,7 @@ iseq_add_mark_object_compile_time(rb_iseq_t *iseq, VALUE v)
}
VALUE
iseq_compile(VALUE self, NODE *node)
ruby_iseq_compile(VALUE self, NODE *node)
{
DECL_ANCHOR(ret);
rb_iseq_t *iseq;
@ -502,7 +502,7 @@ iseq_compile(VALUE self, NODE *node)
}
int
iseq_translate_threaded_code(rb_iseq_t *iseq)
ruby_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);
@ -960,7 +960,7 @@ iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
iseq_set_optargs_table(iseq);
debugs("[compile step 5 (iseq_translate_threaded_code)] \n");
iseq_translate_threaded_code(iseq);
ruby_iseq_translate_threaded_code(iseq);
if (compile_debug > 1) {
VALUE str = ruby_iseq_disasm(iseq->self);
@ -4974,14 +4974,14 @@ dump_disasm_list(struct iseq_link_element *link)
}
VALUE
insns_name_array(void)
ruby_insns_name_array(void)
{
VALUE ary = rb_ary_new();
int i;
for (i = 0; i < sizeof(insn_name_info) / sizeof(insn_name_info[0]); i++) {
rb_ary_push(ary, rb_str_new2(insn_name_info[i]));
rb_ary_push(ary, rb_obj_freeze(rb_str_new2(insn_name_info[i])));
}
return ary;
return rb_obj_freeze(ary);
}
static LABEL *
@ -5051,7 +5051,7 @@ iseq_build_exception(rb_iseq_t *iseq, struct st_table *labels_table,
eiseqval = 0;
}
else {
eiseqval = iseq_load(0, ptr[1], iseq->self, Qnil);
eiseqval = ruby_iseq_load(ptr[1], iseq->self, Qnil);
}
lstart = register_label(iseq, labels_table, ptr[2]);
@ -5064,8 +5064,6 @@ iseq_build_exception(rb_iseq_t *iseq, struct st_table *labels_table,
return COMPILE_OK;
}
struct st_table *insn_make_insn_table(void);
static int
iseq_build_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
VALUE body, struct st_table *labels_table)
@ -5081,7 +5079,7 @@ iseq_build_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
static struct st_table *insn_table;
if (insn_table == 0) {
insn_table = insn_make_insn_table();
insn_table = ruby_insn_make_insn_table();
}
for (i=0; i<len; i++) {
@ -5137,7 +5135,7 @@ iseq_build_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
{
if (op != Qnil) {
if (TYPE(op) == T_ARRAY) {
argv[j] = iseq_load(0, op, iseq->self, Qnil);
argv[j] = ruby_iseq_load(op, iseq->self, Qnil);
}
else if (CLASS_OF(op) == rb_cISeq) {
argv[j] = op;
@ -5202,8 +5200,8 @@ iseq_build_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
static inline VALUE CHECK_INTEGER(VALUE v) {NUM2LONG(v); return v;}
VALUE
iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
VALUE exception, VALUE body)
ruby_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
VALUE exception, VALUE body)
{
int i;
ID *tbl;

25
iseq.c
View file

@ -19,10 +19,6 @@
#include "insns.inc"
#include "insns_info.inc"
/* compile.c */
void iseq_compile(VALUE self, NODE *node);
int iseq_translate_threaded_code(rb_iseq_t *iseq);
VALUE rb_cISeq;
static void
@ -326,7 +322,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);
iseq_compile(self, node);
ruby_iseq_compile(self, node);
cleanup_iseq_build(iseq);
return self;
}
@ -348,17 +344,14 @@ rb_iseq_new_with_bopt(NODE *node, VALUE name, VALUE filename,
bopt, &COMPILE_OPTION_DEFAULT);
}
VALUE iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
VALUE exception, VALUE body);
#define CHECK_ARRAY(v) rb_convert_type(v, T_ARRAY, "Array", "to_ary")
#define CHECK_STRING(v) rb_convert_type(v, T_STRING, "String", "to_str")
#define CHECK_SYMBOL(v) rb_convert_type(v, T_SYMBOL, "Symbol", "to_sym")
static inline VALUE CHECK_INTEGER(VALUE v) {NUM2LONG(v); return v;}
VALUE
static VALUE
iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
{
VALUE iseqval = iseq_alloc(rb_cISeq);
VALUE iseqval = iseq_alloc(self);
VALUE magic, version1, version2, format_type, misc;
VALUE name, filename;
@ -428,7 +421,7 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
prepare_iseq_build(iseq, name, filename,
parent, iseq_type, 0, &option);
iseq_build_from_ary(iseq, locals, args, exception, body);
ruby_iseq_build_from_ary(iseq, locals, args, exception, body);
cleanup_iseq_build(iseq);
return iseqval;
@ -443,6 +436,12 @@ iseq_s_load(int argc, VALUE *argv, VALUE self)
return iseq_load(self, data, 0, opt);
}
VALUE
ruby_iseq_load(VALUE data, VALUE parent, VALUE opt)
{
return iseq_load(rb_cISeq, data, parent, opt);
}
static NODE *
compile_string(VALUE str, VALUE file, VALUE line)
{
@ -1237,7 +1236,7 @@ iseq_data_to_ary(rb_iseq_t *iseq)
}
struct st_table *
insn_make_insn_table(void)
ruby_insn_make_insn_table(void)
{
struct st_table *table;
int i;
@ -1383,7 +1382,7 @@ rb_iseq_build_for_ruby2cext(
iseq->iseq[i+1] = (VALUE)func;
}
iseq_translate_threaded_code(iseq);
ruby_iseq_translate_threaded_code(iseq);
#define ALLOC_AND_COPY(dst, src, type, size) do { \
if (size) { \

11
iseq.h
View file

@ -12,7 +12,16 @@
#ifndef RUBY_COMPILE_H
#define RUBY_COMPILE_H
VALUE iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt);
/* 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);
/* iseq.c */
VALUE ruby_iseq_load(VALUE data, VALUE parent, VALUE opt);
struct st_table *ruby_insn_make_insn_table(void);
#define ISEQ_TYPE_TOP INT2FIX(1)
#define ISEQ_TYPE_METHOD INT2FIX(2)

3
vm.c
View file

@ -1737,7 +1737,6 @@ m_core_set_postexe(VALUE self, VALUE iseqval)
return Qnil;
}
VALUE insns_name_array(void);
extern VALUE *rb_gc_stack_start;
extern size_t rb_gc_stack_maxsize;
#ifdef __ia64
@ -1845,7 +1844,7 @@ Init_VM(void)
#endif
/* ::VM::InsnNameArray */
rb_define_const(rb_cRubyVM, "INSTRUCTION_NAMES", insns_name_array());
rb_define_const(rb_cRubyVM, "INSTRUCTION_NAMES", ruby_insns_name_array());
/* debug functions ::VM::SDR(), ::VM::NSDR() */
#if VMDEBUG