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

* vm_evalbody.ci, insns.def, vm.c, tool/insns2vm.rb (rb_num_t):

renamed to get rid of name clash.  [ruby-dev:30504]

* yarvcore.c (ruby_thread_init): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-05-03 09:09:14 +00:00
parent fba2420be4
commit d942a9a1ee
6 changed files with 44 additions and 37 deletions

View file

@ -1,3 +1,10 @@
Thu May 3 18:10:12 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_evalbody.ci, insns.def, vm.c, tool/insns2vm.rb (rb_num_t):
renamed to get rid of name clash. [ruby-dev:30504]
* yarvcore.c (ruby_thread_init): ditto.
Wed May 2 18:52:58 2007 Koichi Sasada <ko1@atdot.net> Wed May 2 18:52:58 2007 Koichi Sasada <ko1@atdot.net>
* vm.c, yarvcore.h, yarvcore.c, insns.def: fix to mark VM stack * vm.c, yarvcore.h, yarvcore.c, insns.def: fix to mark VM stack

View file

@ -81,7 +81,7 @@ setlocal
*/ */
DEFINE_INSN DEFINE_INSN
getspecial getspecial
(num_t idx, num_t type) (rb_num_t idx, rb_num_t type)
() ()
(VALUE val) (VALUE val)
{ {
@ -122,7 +122,7 @@ getspecial
*/ */
DEFINE_INSN DEFINE_INSN
setspecial setspecial
(num_t idx) (rb_num_t idx)
(VALUE obj) (VALUE obj)
() ()
{ {
@ -139,7 +139,7 @@ setspecial
*/ */
DEFINE_INSN DEFINE_INSN
getdynamic getdynamic
(dindex_t idx, num_t level) (dindex_t idx, rb_num_t level)
() ()
(VALUE val) (VALUE val)
{ {
@ -160,7 +160,7 @@ getdynamic
*/ */
DEFINE_INSN DEFINE_INSN
setdynamic setdynamic
(dindex_t idx, num_t level) (dindex_t idx, rb_num_t level)
(VALUE val) (VALUE val)
() ()
{ {
@ -406,7 +406,7 @@ putstring
*/ */
DEFINE_INSN DEFINE_INSN
concatstrings concatstrings
(num_t num) (rb_num_t num)
(...) (...)
(VALUE val) // inc += 1 - num; (VALUE val) // inc += 1 - num;
{ {
@ -442,7 +442,7 @@ tostring
*/ */
DEFINE_INSN DEFINE_INSN
toregexp toregexp
(num_t flag) (rb_num_t flag)
(VALUE str) (VALUE str)
(VALUE val) (VALUE val)
{ {
@ -456,7 +456,7 @@ toregexp
*/ */
DEFINE_INSN DEFINE_INSN
newarray newarray
(num_t num) (rb_num_t num)
(...) (...)
(VALUE val) // inc += 1 - num; (VALUE val) // inc += 1 - num;
{ {
@ -489,7 +489,7 @@ duparray
*/ */
DEFINE_INSN DEFINE_INSN
expandarray expandarray
(num_t num, num_t flag) (rb_num_t num, rb_num_t flag)
(..., VALUE ary) (..., VALUE ary)
(...) // inc += (num > 0) ? num - 1 + (flag ? 1 : 0) : num + 1 - (flag ? 1 : 0); (...) // inc += (num > 0) ? num - 1 + (flag ? 1 : 0) : num + 1 - (flag ? 1 : 0);
{ {
@ -650,7 +650,7 @@ checkincludearray
*/ */
DEFINE_INSN DEFINE_INSN
newhash newhash
(num_t num) (rb_num_t num)
(...) (...)
(VALUE val) // inc += 1 - num; (VALUE val) // inc += 1 - num;
{ {
@ -673,7 +673,7 @@ newhash
*/ */
DEFINE_INSN DEFINE_INSN
newrange newrange
(num_t flag) (rb_num_t flag)
(VALUE low, VALUE high) (VALUE low, VALUE high)
(VALUE val) (VALUE val)
{ {
@ -740,7 +740,7 @@ dup
*/ */
DEFINE_INSN DEFINE_INSN
dupn dupn
(num_t n) (rb_num_t n)
(...) (...)
(...) // inc += n; (...) // inc += n;
{ {
@ -788,7 +788,7 @@ reput
*/ */
DEFINE_INSN DEFINE_INSN
topn topn
(num_t n) (rb_num_t n)
(...) (...)
(VALUE val) // inc += 1; (VALUE val) // inc += 1;
{ {
@ -802,7 +802,7 @@ topn
*/ */
DEFINE_INSN DEFINE_INSN
setn setn
(num_t n) (rb_num_t n)
(..., VALUE val) (..., VALUE val)
(VALUE val) // inc += 0 (VALUE val) // inc += 0
{ {
@ -835,7 +835,7 @@ emptstack
*/ */
DEFINE_INSN DEFINE_INSN
definemethod definemethod
(ID id, ISEQ body, num_t is_singleton) (ID id, ISEQ body, rb_num_t is_singleton)
(VALUE obj) (VALUE obj)
() ()
{ {
@ -888,7 +888,7 @@ undef
*/ */
DEFINE_INSN DEFINE_INSN
defined defined
(num_t type, VALUE obj, VALUE needstr) (rb_num_t type, VALUE obj, VALUE needstr)
(VALUE v) (VALUE v)
(VALUE val) (VALUE val)
{ {
@ -1019,7 +1019,7 @@ postexe
*/ */
DEFINE_INSN DEFINE_INSN
trace trace
(num_t nf) (rb_num_t nf)
() ()
() ()
{ {
@ -1042,7 +1042,7 @@ trace
*/ */
DEFINE_INSN DEFINE_INSN
defineclass defineclass
(ID id, ISEQ klass_iseq, num_t define_type) (ID id, ISEQ klass_iseq, rb_num_t define_type)
(VALUE cbase, VALUE super) (VALUE cbase, VALUE super)
(VALUE val) (VALUE val)
{ {
@ -1145,7 +1145,7 @@ defineclass
*/ */
DEFINE_INSN DEFINE_INSN
send send
(ID op_id, num_t op_argc, ISEQ blockiseq, num_t op_flag, IC ic) (ID op_id, rb_num_t op_argc, ISEQ blockiseq, rb_num_t op_flag, IC ic)
(...) (...)
(VALUE val) // inc += - (op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0)); (VALUE val) // inc += - (op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));
{ {
@ -1153,8 +1153,8 @@ send
VALUE recv; VALUE recv;
VALUE klass; VALUE klass;
rb_block_t *blockptr = 0; rb_block_t *blockptr = 0;
num_t num = op_argc; rb_num_t num = op_argc;
num_t flag = op_flag; rb_num_t flag = op_flag;
ID id = op_id; ID id = op_id;
macro_eval_setup_send_arguments(num, blockptr, flag, blockiseq); macro_eval_setup_send_arguments(num, blockptr, flag, blockiseq);
@ -1287,7 +1287,7 @@ send
*/ */
DEFINE_INSN DEFINE_INSN
invokesuper invokesuper
(num_t op_argc, ISEQ blockiseq, num_t flag) (rb_num_t op_argc, ISEQ blockiseq, rb_num_t flag)
(...) (...)
(VALUE val) // inc += - op_argc; (VALUE val) // inc += - op_argc;
{ {
@ -1312,7 +1312,7 @@ invokesuper
*/ */
DEFINE_INSN DEFINE_INSN
invokeblock invokeblock
(num_t num, num_t flag) (rb_num_t num, rb_num_t flag)
(...) (...)
(VALUE val) // inc += 1 - num; (VALUE val) // inc += 1 - num;
{ {
@ -1414,13 +1414,13 @@ finish
*/ */
DEFINE_INSN DEFINE_INSN
throw throw
(num_t throw_state) (rb_num_t throw_state)
(VALUE throwobj) (VALUE throwobj)
(VALUE val) (VALUE val)
{ {
num_t state = throw_state & 0xff; rb_num_t state = throw_state & 0xff;
num_t flag = throw_state & 0x8000; rb_num_t flag = throw_state & 0x8000;
num_t level = throw_state >> 16; rb_num_t level = throw_state >> 16;
val = Qnil; /* dummy */ val = Qnil; /* dummy */
if (state != 0) { if (state != 0) {

View file

@ -135,12 +135,12 @@ class InsnsDef
ret = "int inc = 0;\n" ret = "int inc = 0;\n"
@opes.each_with_index{|(t, v), i| @opes.each_with_index{|(t, v), i|
if t == 'num_t' if t == 'rb_num_t'
ret << " unsigned long #{v} = FIX2INT(opes[#{i}]);\n" ret << " unsigned long #{v} = FIX2INT(opes[#{i}]);\n"
end end
} }
@defopes.each_with_index{|((t, var), val), i| @defopes.each_with_index{|((t, var), val), i|
if t == 'num_t' && val != '*' if t == 'rb_num_t' && val != '*'
ret << " unsigned long #{var} = #{val};\n" ret << " unsigned long #{var} = #{val};\n"
end end
} }
@ -916,7 +916,7 @@ class InsnsDef
case op case op
when /^OFFSET/ when /^OFFSET/
"TS_OFFSET" "TS_OFFSET"
when /^num_t/ when /^rb_num_t/
"TS_NUM" "TS_NUM"
when /^lindex_t/ when /^lindex_t/
"TS_LINDEX" "TS_LINDEX"
@ -1037,7 +1037,7 @@ class InsnsDef
val = op[1] val = op[1]
case type case type
when /^long/, /^num_t/, /^lindex_t/, /^dindex_t/ when /^long/, /^rb_num_t/, /^lindex_t/, /^dindex_t/
"INT2FIX(#{val})" "INT2FIX(#{val})"
when /^VALUE/ when /^VALUE/
val val

6
vm.c
View file

@ -30,11 +30,11 @@ VALUE rb_cEnv;
#define EVALBODY_HELPER_FUNCTION static inline #define EVALBODY_HELPER_FUNCTION static inline
typedef unsigned long num_t; typedef unsigned long rb_num_t;
typedef unsigned long lindex_t; typedef unsigned long lindex_t;
typedef unsigned long dindex_t; typedef unsigned long dindex_t;
typedef num_t GENTRY; typedef rb_num_t GENTRY;
void vm_analysis_operand(int insn, int n, VALUE op); void vm_analysis_operand(int insn, int n, VALUE op);
void vm_analysis_register(int reg, int isset); void vm_analysis_register(int reg, int isset);
@ -1263,7 +1263,7 @@ eval_get_cvar_base(rb_thread_t *th, rb_iseq_t *iseq)
EVALBODY_HELPER_FUNCTION void EVALBODY_HELPER_FUNCTION void
eval_define_method(rb_thread_t *th, VALUE obj, eval_define_method(rb_thread_t *th, VALUE obj,
ID id, rb_iseq_t *miseq, num_t is_singleton, NODE *cref) ID id, rb_iseq_t *miseq, rb_num_t is_singleton, NODE *cref)
{ {
NODE *newbody; NODE *newbody;
int noex = cref->nd_visi; int noex = cref->nd_visi;

View file

@ -78,7 +78,7 @@ th_eval(rb_thread_t *th, VALUE initial)
ID tmp_id; ID tmp_id;
rb_block_t *tmp_blockptr; rb_block_t *tmp_blockptr;
num_t tmp_num; rb_num_t tmp_num;
#if OPT_TOKEN_THREADED_CODE || OPT_DIRECT_THREADED_CODE #if OPT_TOKEN_THREADED_CODE || OPT_DIRECT_THREADED_CODE
#include "vmtc.inc" #include "vmtc.inc"

View file

@ -359,7 +359,7 @@ th_init(rb_thread_t *th)
extern VALUE ruby_top_self; extern VALUE ruby_top_self;
static VALUE static VALUE
thread_init(VALUE self) ruby_thread_init(VALUE self)
{ {
rb_thread_t *th; rb_thread_t *th;
rb_vm_t *vm = GET_THREAD()->vm; rb_vm_t *vm = GET_THREAD()->vm;
@ -378,7 +378,7 @@ VALUE
rb_thread_alloc(VALUE klass) rb_thread_alloc(VALUE klass)
{ {
VALUE self = thread_alloc(klass); VALUE self = thread_alloc(klass);
thread_init(self); ruby_thread_init(self);
return self; return self;
} }
@ -463,7 +463,7 @@ Init_VM(void)
/* ::Thread */ /* ::Thread */
rb_cThread = rb_define_class("Thread", rb_cObject); rb_cThread = rb_define_class("Thread", rb_cObject);
rb_undef_alloc_func(rb_cThread); rb_undef_alloc_func(rb_cThread);
rb_define_method(rb_cThread, "initialize", thread_init, 0); rb_define_method(rb_cThread, "initialize", ruby_thread_init, 0);
/* ::VM::USAGE_ANALISYS_* */ /* ::VM::USAGE_ANALISYS_* */
rb_define_const(rb_cVM, "USAGE_ANALISYS_INSN", rb_hash_new()); rb_define_const(rb_cVM, "USAGE_ANALISYS_INSN", rb_hash_new());