* eval_intern.h, yarvcore.h: move declaration of sysstack_error

to yarvcore.h.
* iseq.c: fix symbol name (:toplevel -> :top).
* lib/vm/instruction.rb, template/vm.inc.tmpl: replacable
  current file name.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2007-07-01 23:57:04 +00:00
parent 1ccf555a70
commit 9c708baa2d
6 changed files with 39 additions and 28 deletions

View File

@ -1,3 +1,13 @@
Mon Jul 2 08:53:47 2007 Koichi Sasada <ko1@atdot.net>
* eval_intern.h, yarvcore.h: move declaration of sysstack_error
to yarvcore.h.
* iseq.c: fix symbol name (:toplevel -> :top).
* lib/vm/instruction.rb, template/vm.inc.tmpl: replacable
current file name.
Mon Jul 2 05:29:07 2007 Koichi Sasada <ko1@atdot.net> Mon Jul 2 05:29:07 2007 Koichi Sasada <ko1@atdot.net>
* compile.c, iseq.c: fix iseq some of load/store process. * compile.c, iseq.c: fix iseq some of load/store process.

View File

@ -178,7 +178,6 @@ char *strrchr _((const char *, const char));
} }
extern VALUE exception_error; extern VALUE exception_error;
extern VALUE sysstack_error;
void rb_thread_cleanup _((void)); void rb_thread_cleanup _((void));
void rb_thread_wait_other_threads _((void)); void rb_thread_wait_other_threads _((void));

10
iseq.c
View File

@ -358,7 +358,7 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
if (type_map == 0) { if (type_map == 0) {
type_map = st_init_numtable(); type_map = st_init_numtable();
st_insert(type_map, ID2SYM(rb_intern("toplevel")), ISEQ_TYPE_TOP); st_insert(type_map, ID2SYM(rb_intern("top")), ISEQ_TYPE_TOP);
st_insert(type_map, ID2SYM(rb_intern("method")), ISEQ_TYPE_METHOD); st_insert(type_map, ID2SYM(rb_intern("method")), ISEQ_TYPE_METHOD);
st_insert(type_map, ID2SYM(rb_intern("block")), ISEQ_TYPE_BLOCK); st_insert(type_map, ID2SYM(rb_intern("block")), ISEQ_TYPE_BLOCK);
st_insert(type_map, ID2SYM(rb_intern("class")), ISEQ_TYPE_CLASS); st_insert(type_map, ID2SYM(rb_intern("class")), ISEQ_TYPE_CLASS);
@ -1125,7 +1125,7 @@ iseq_data_to_ary(rb_iseq_t *iseq)
static VALUE insn_syms[YARV_MAX_INSTRUCTION_SIZE]; static VALUE insn_syms[YARV_MAX_INSTRUCTION_SIZE];
struct st_table *labels_table = st_init_numtable(); struct st_table *labels_table = st_init_numtable();
DECL_SYMBOL(toplevel); DECL_SYMBOL(top);
DECL_SYMBOL(method); DECL_SYMBOL(method);
DECL_SYMBOL(block); DECL_SYMBOL(block);
DECL_SYMBOL(class); DECL_SYMBOL(class);
@ -1133,12 +1133,12 @@ iseq_data_to_ary(rb_iseq_t *iseq)
DECL_SYMBOL(ensure); DECL_SYMBOL(ensure);
DECL_SYMBOL(eval); DECL_SYMBOL(eval);
if (sym_toplevel == 0) { if (sym_top == 0) {
int i; int i;
for (i=0; i<YARV_MAX_INSTRUCTION_SIZE; i++) { for (i=0; i<YARV_MAX_INSTRUCTION_SIZE; i++) {
insn_syms[i] = ID2SYM(rb_intern(insn_name(i))); insn_syms[i] = ID2SYM(rb_intern(insn_name(i)));
} }
INIT_SYMBOL(toplevel); INIT_SYMBOL(top);
INIT_SYMBOL(method); INIT_SYMBOL(method);
INIT_SYMBOL(block); INIT_SYMBOL(block);
INIT_SYMBOL(class); INIT_SYMBOL(class);
@ -1149,7 +1149,7 @@ iseq_data_to_ary(rb_iseq_t *iseq)
/* type */ /* type */
switch(iseq->type) { switch(iseq->type) {
case ISEQ_TYPE_TOP: type = sym_toplevel; break; case ISEQ_TYPE_TOP: type = sym_top; break;
case ISEQ_TYPE_METHOD: type = sym_method; break; case ISEQ_TYPE_METHOD: type = sym_method; break;
case ISEQ_TYPE_BLOCK: type = sym_block; break; case ISEQ_TYPE_BLOCK: type = sym_block; break;
case ISEQ_TYPE_CLASS: type = sym_class; break; case ISEQ_TYPE_CLASS: type = sym_class; break;

View File

@ -839,7 +839,7 @@ module RubyVM
file = insn.body.instance_variable_get(:@file) file = insn.body.instance_variable_get(:@file)
ret << "#line #{line+1} \"#{file}\"" << "\n" ret << "#line #{line+1} \"#{file}\"" << "\n"
ret << insn.body ret << insn.body
ret << '#line __CURRENT_LINE__ "vm.inc"' << "\n" ret << '#line __CURRENT_LINE__ "__CURRENT_FILE__"' << "\n"
else else
ret << insn.body ret << insn.body
end end

View File

@ -12,17 +12,17 @@
*/ */
<%= <%=
ret = '' line = 15
offset = 15 vm_body.gsub(/\n|__CURRENT_LINE__|__CURRENT_FILE__/){|e|
line_no = 0 case e
vm_body.each_line{|line| when '__CURRENT_LINE__'
if line =~ /^\#line __CURRENT_LINE__/ line.to_s
ret << line.sub(/__CURRENT_LINE__/, "#{line_no+offset}") when '__CURRENT_FILE__'
"vm.inc"
else else
ret <<line line += 1
e
end end
line_no += 1
} }
ret
%> %>

View File

@ -687,6 +687,8 @@ int vm_get_sourceline(rb_control_frame_t *);
VALUE yarvcore_eval_parsed(NODE *node, VALUE file); VALUE yarvcore_eval_parsed(NODE *node, VALUE file);
VALUE yarvcore_eval(VALUE self, VALUE str, VALUE file, VALUE line); VALUE yarvcore_eval(VALUE self, VALUE str, VALUE file, VALUE line);
RUBY_EXTERN VALUE sysstack_error;
/* for thread */ /* for thread */
#if RUBY_VM_THREAD_MODEL == 2 #if RUBY_VM_THREAD_MODEL == 2