* eval.c, eval_intern.h, include/ruby/intern.h, include/ruby/ruby.h,

vm.c, vm_core.h, vm_insnhelper.c: remove pointless "const".



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2008-05-22 16:19:14 +00:00
Родитель 846ea1727f
Коммит a45cd8a01c
9 изменённых файлов: 183 добавлений и 206 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Fri May 23 01:15:09 2008 Koichi Sasada <ko1@atdot.net>
* eval.c, eval_intern.h, include/ruby/intern.h, include/ruby/ruby.h,
vm.c, vm_core.h, vm_insnhelper.c: remove pointless "const".
Thu May 22 23:45:17 2008 Yusuke Endoh <mame@tsg.ne.jp>
* compile.c (get_destination_insn, get_next_insn, get_prev_insn):

40
eval.c
Просмотреть файл

@ -14,7 +14,7 @@
#include "eval_intern.h"
VALUE proc_invoke(VALUE, VALUE, VALUE, VALUE);
VALUE rb_binding_new();
VALUE rb_binding_new(void);
VALUE rb_f_block_given_p(void);
@ -34,7 +34,7 @@ static VALUE exception_error;
static VALUE eval_string(VALUE, VALUE, VALUE, const char *, int);
static inline VALUE rb_yield_0(const int argc, const VALUE * const argv);
static inline VALUE rb_yield_0(int argc, const VALUE *argv);
static VALUE rb_call(VALUE, VALUE, ID, int, const VALUE *, int);
#include "eval_error.c"
@ -909,13 +909,13 @@ rb_need_block()
}
static inline VALUE
rb_yield_0(const int argc, const VALUE * const argv)
rb_yield_0(int argc, const VALUE * argv)
{
return vm_yield(GET_THREAD(), argc, argv);
}
VALUE
rb_yield(const VALUE val)
rb_yield(VALUE val)
{
volatile VALUE tmp = val;
if (val == Qundef) {
@ -928,7 +928,7 @@ rb_yield(const VALUE val)
}
VALUE
rb_yield_values(const int n, ...)
rb_yield_values(int n, ...)
{
int i;
VALUE *argv;
@ -950,13 +950,13 @@ rb_yield_values(const int n, ...)
}
VALUE
rb_yield_values2(const int argc, VALUE * const argv)
rb_yield_values2(int argc, const VALUE *argv)
{
return rb_yield_0(argc, argv);
}
VALUE
rb_yield_splat(const VALUE values)
rb_yield_splat(VALUE values)
{
VALUE tmp = rb_check_array_type(values);
volatile VALUE v;
@ -1000,8 +1000,8 @@ rb_f_loop(void)
}
VALUE
rb_iterate(VALUE (* const it_proc) (VALUE), const VALUE data1,
VALUE (* const bl_proc) (ANYARGS), VALUE const data2)
rb_iterate(VALUE (* it_proc) (VALUE), VALUE data1,
VALUE (* bl_proc) (ANYARGS), VALUE data2)
{
int state;
volatile VALUE retval = Qnil;
@ -1069,9 +1069,9 @@ struct iter_method_arg {
};
static VALUE
iterate_method(const VALUE obj)
iterate_method(VALUE obj)
{
const struct iter_method_arg * const arg =
const struct iter_method_arg * arg =
(struct iter_method_arg *) obj;
return rb_call(CLASS_OF(arg->obj), arg->obj, arg->mid,
@ -1079,8 +1079,8 @@ iterate_method(const VALUE obj)
}
VALUE
rb_block_call(const VALUE obj, const ID mid, const int argc, VALUE * const argv,
VALUE (*const bl_proc) (ANYARGS), const VALUE data2)
rb_block_call(VALUE obj, ID mid, int argc, VALUE * argv,
VALUE (*bl_proc) (ANYARGS), VALUE data2)
{
struct iter_method_arg arg;
@ -1092,17 +1092,17 @@ rb_block_call(const VALUE obj, const ID mid, const int argc, VALUE * const argv,
}
VALUE
rb_each(const VALUE obj)
rb_each(VALUE obj)
{
return rb_call(CLASS_OF(obj), obj, idEach, 0, 0, CALL_FCALL);
}
VALUE
rb_rescue2(VALUE (* const b_proc) (ANYARGS), const VALUE data1,
VALUE (* const r_proc) (ANYARGS), VALUE data2, ...)
rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1,
VALUE (* r_proc) (ANYARGS), VALUE data2, ...)
{
int state;
rb_thread_t * const th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
volatile VALUE result;
volatile VALUE e_info = th->errinfo;
@ -1160,15 +1160,15 @@ rb_rescue2(VALUE (* const b_proc) (ANYARGS), const VALUE data1,
}
VALUE
rb_rescue(VALUE (* const b_proc)(ANYARGS), const VALUE data1,
VALUE (* const r_proc)(ANYARGS), const VALUE data2)
rb_rescue(VALUE (* b_proc)(ANYARGS), VALUE data1,
VALUE (* r_proc)(ANYARGS), VALUE data2)
{
return rb_rescue2(b_proc, data1, r_proc, data2, rb_eStandardError,
(VALUE)0);
}
VALUE
rb_protect(VALUE (* const proc) (VALUE), const VALUE data, int * const state)
rb_protect(VALUE (* proc) (VALUE), VALUE data, int * state)
{
VALUE result = Qnil; /* OK */
int status;

Просмотреть файл

@ -222,21 +222,19 @@ NORETURN(void rb_fiber_start(void));
NORETURN(void rb_raise_jump(VALUE));
NORETURN(void rb_print_undef(VALUE, ID, int));
NORETURN(void vm_localjump_error(const char * const, const VALUE, const int));
NORETURN(void vm_jump_tag_but_local_jump(const int, const VALUE));
NORETURN(void vm_localjump_error(const char *,VALUE, int));
NORETURN(void vm_jump_tag_but_local_jump(int, VALUE));
NODE *vm_cref_push(rb_thread_t * const th, const VALUE, const int);
NODE *vm_set_special_cref(rb_thread_t *th, VALUE *lfp, NODE * cref_stack);
VALUE vm_make_jump_tag_but_local_jump(const int state, VALUE val);
NODE *vm_cref_push(rb_thread_t * th, VALUE, int);
NODE *vm_set_special_cref(rb_thread_t *th, VALUE *lfp, NODE *cref_stack);
VALUE vm_make_jump_tag_but_local_jump(int state, VALUE val);
NODE *ruby_cref(void);
rb_control_frame_t *vm_get_ruby_level_cfp(rb_thread_t *th, rb_control_frame_t *cfp);
VALUE rb_obj_is_proc(VALUE);
void rb_vm_check_redefinition_opt_method(NODE * const node);
VALUE rb_vm_call_cfunc(const VALUE recv, VALUE (* const func)(VALUE),
const VALUE arg, rb_block_t * const blockptr,
const VALUE filename);
void rb_vm_check_redefinition_opt_method(const NODE *node);
VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, const rb_block_t *blockptr, VALUE filename);
void rb_thread_terminate_all(void);
void rb_vm_set_eval_stack(rb_thread_t * const, const VALUE iseq, NODE * const cref);
void rb_vm_set_eval_stack(rb_thread_t *, VALUE iseq, const NODE *cref);
VALUE rb_vm_top_self();
VALUE rb_vm_cbase(void);

Просмотреть файл

@ -277,7 +277,7 @@ VALUE rb_obj_method(VALUE, VALUE);
VALUE rb_method_call(int, VALUE*, VALUE);
int rb_mod_method_arity(VALUE, ID);
int rb_obj_method_arity(VALUE, ID);
VALUE rb_protect(VALUE (* const)(VALUE), const VALUE, int* const);
VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*);
void rb_set_end_proc(void (*)(VALUE), VALUE);
void rb_mark_end_proc(void);
void rb_exec_end_proc(void);
@ -438,9 +438,9 @@ int rb_symname_p(const char*);
int rb_sym_interned_p(VALUE);
void rb_gc_mark_symbols(void);
VALUE rb_backref_get(void);
void rb_backref_set(const VALUE);
void rb_backref_set(VALUE);
VALUE rb_lastline_get(void);
void rb_lastline_set(const VALUE);
void rb_lastline_set(VALUE);
VALUE rb_sym_all_symbols(void);
/* process.c */
void rb_last_status_set(int status, rb_pid_t pid);
@ -662,7 +662,7 @@ VALUE rb_str_succ(VALUE);
VALUE rb_time_succ(VALUE);
void Init_stack(VALUE*);
void rb_frame_pop(void);
int rb_frame_method_id_and_class(ID * const idp, VALUE * const klassp);
int rb_frame_method_id_and_class(ID *idp, VALUE *klassp);
#if defined(__cplusplus)
#if 0

Просмотреть файл

@ -788,7 +788,7 @@ VALUE rb_funcall(VALUE, ID, int, ...);
VALUE rb_funcall2(VALUE, ID, int, const VALUE*);
VALUE rb_funcall3(VALUE, ID, int, const VALUE*);
int rb_scan_args(int, const VALUE*, const char*, ...);
VALUE rb_call_super(const int, const VALUE* const);
VALUE rb_call_super(int, const VALUE*);
VALUE rb_gv_set(const char*, VALUE);
VALUE rb_gv_get(const char*);
@ -817,17 +817,17 @@ PRINTF_ARGS(void rb_compile_warn(const char *, int, const char*, ...), 3, 4);
typedef VALUE rb_block_call_func(VALUE, VALUE, int, VALUE*);
VALUE rb_each(const VALUE);
VALUE rb_yield(const VALUE);
VALUE rb_yield_values(const int n, ...);
VALUE rb_yield_values2(const int n, VALUE * const argv);
VALUE rb_yield_splat(const VALUE);
VALUE rb_each(VALUE);
VALUE rb_yield(VALUE);
VALUE rb_yield_values(int n, ...);
VALUE rb_yield_values2(int n, const VALUE *argv);
VALUE rb_yield_splat(VALUE);
int rb_block_given_p(void);
void rb_need_block(void);
VALUE rb_iterate(VALUE(* const)(VALUE),const VALUE,VALUE(* const)(ANYARGS),const VALUE);
VALUE rb_block_call(const VALUE,const ID,const int,VALUE* const,VALUE(* const)(ANYARGS),const VALUE);
VALUE rb_rescue(VALUE(* const)(ANYARGS),const VALUE,VALUE(* const)(ANYARGS),const VALUE);
VALUE rb_rescue2(VALUE(* const)(ANYARGS),const VALUE,VALUE(* const)(ANYARGS),VALUE,...);
VALUE rb_iterate(VALUE(*)(VALUE),VALUE,VALUE(*)(ANYARGS),VALUE);
VALUE rb_block_call(VALUE,ID,int,VALUE*,VALUE(*)(ANYARGS),VALUE);
VALUE rb_rescue(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE);
VALUE rb_rescue2(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE,...);
VALUE rb_ensure(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE);
VALUE rb_catch(const char*,VALUE(*)(ANYARGS),VALUE);
VALUE rb_catch_obj(VALUE,VALUE(*)(ANYARGS),VALUE);

Просмотреть файл

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2008-05-22"
#define RUBY_RELEASE_DATE "2008-05-23"
#define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20080522
#define RUBY_RELEASE_CODE 20080523
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 5
#define RUBY_RELEASE_DAY 22
#define RUBY_RELEASE_DAY 23
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];

157
vm.c
Просмотреть файл

@ -49,7 +49,7 @@ rb_vm_change_state(void)
/* control stack frame */
static inline VALUE
rb_vm_set_finish_env(rb_thread_t * const th)
rb_vm_set_finish_env(rb_thread_t * th)
{
vm_push_frame(th, 0, FRAME_MAGIC_FINISH,
Qnil, th->cfp->lfp[0], 0,
@ -59,7 +59,7 @@ rb_vm_set_finish_env(rb_thread_t * const th)
}
void
rb_vm_set_top_stack(rb_thread_t * const th, const VALUE iseqval)
rb_vm_set_top_stack(rb_thread_t * th, VALUE iseqval)
{
rb_iseq_t *iseq;
GetISeqPtr(iseqval, iseq);
@ -77,7 +77,7 @@ rb_vm_set_top_stack(rb_thread_t * const th, const VALUE iseqval)
}
void
rb_vm_set_eval_stack(rb_thread_t * const th, const VALUE iseqval, NODE * const cref)
rb_vm_set_eval_stack(rb_thread_t * th, VALUE iseqval, const NODE *cref)
{
rb_iseq_t *iseq;
rb_block_t * const block = th->base_block;
@ -162,7 +162,7 @@ env_alloc(void)
return obj;
}
static VALUE check_env_value(const VALUE envval);
static VALUE check_env_value(VALUE envval);
static int
check_env(rb_env_t * const env)
@ -186,7 +186,7 @@ check_env(rb_env_t * const env)
}
static VALUE
check_env_value(const VALUE envval)
check_env_value(VALUE envval)
{
rb_env_t *env;
GetEnvPtr(envval, env);
@ -200,7 +200,7 @@ check_env_value(const VALUE envval)
static VALUE
vm_make_env_each(rb_thread_t * const th, rb_control_frame_t * const cfp,
VALUE * const envptr, VALUE * const endptr)
VALUE *envptr, VALUE * const endptr)
{
VALUE envval, penvval = 0;
rb_env_t *env;
@ -317,7 +317,7 @@ vm_collect_local_variables_in_heap(rb_thread_t * const th,
}
VALUE
vm_make_env_object(rb_thread_t * const th, rb_control_frame_t *cfp)
vm_make_env_object(rb_thread_t * th, rb_control_frame_t *cfp)
{
VALUE envval;
@ -348,9 +348,8 @@ vm_stack_to_heap(rb_thread_t * const th)
/* Proc */
static VALUE
vm_make_proc_from_block(rb_thread_t * const th,
rb_control_frame_t * const cfp,
rb_block_t * const block)
vm_make_proc_from_block(rb_thread_t *th, rb_control_frame_t *cfp,
rb_block_t *block)
{
VALUE procval;
rb_control_frame_t *bcfp;
@ -367,8 +366,8 @@ vm_make_proc_from_block(rb_thread_t * const th,
}
VALUE
vm_make_proc(rb_thread_t * const th,
rb_control_frame_t * const cfp, rb_block_t * const block)
vm_make_proc(rb_thread_t *th,
rb_control_frame_t *cfp, const rb_block_t *block)
{
VALUE procval, envval, blockprocval = 0;
rb_proc_t *proc;
@ -415,9 +414,8 @@ vm_make_proc(rb_thread_t * const th,
/* C -> Ruby: method */
VALUE
vm_call0(rb_thread_t * const th, const VALUE klass, const VALUE recv,
const VALUE id, const ID oid, const int argc, const VALUE * const argv,
NODE * const body, const int nosuper)
vm_call0(rb_thread_t * th, VALUE klass, VALUE recv, VALUE id, ID oid,
int argc, const VALUE *argv, const NODE *body, int nosuper)
{
VALUE val;
rb_block_t *blockptr = 0;
@ -540,7 +538,7 @@ vm_call_super(rb_thread_t * const th, const int argc, const VALUE * const argv)
}
VALUE
rb_call_super(const int argc, const VALUE * const argv)
rb_call_super(int argc, const VALUE *argv)
{
PASS_PASSED_BLOCK();
return vm_call_super(GET_THREAD(), argc, argv);
@ -549,9 +547,9 @@ rb_call_super(const int argc, const VALUE * const argv)
/* C -> Ruby: block */
static inline VALUE
invoke_block_from_c(rb_thread_t * const th, rb_block_t * const block,
const VALUE self, const int argc, const VALUE * const argv,
rb_block_t * const blockptr, NODE * const cref)
invoke_block_from_c(rb_thread_t *th, rb_block_t *block,
VALUE self, int argc, const VALUE *argv,
rb_block_t *blockptr, const NODE *cref)
{
if (BUILTIN_TYPE(block->iseq) != T_NODE) {
rb_iseq_t *iseq = block->iseq;
@ -588,7 +586,7 @@ invoke_block_from_c(rb_thread_t * const th, rb_block_t * const block,
}
static inline rb_block_t *
check_block(rb_thread_t * const th)
check_block(rb_thread_t *th)
{
rb_block_t *blockptr = GC_GUARDED_PTR_REF(th->cfp->lfp[0]);
@ -600,24 +598,22 @@ check_block(rb_thread_t * const th)
}
VALUE
vm_yield_with_cref(rb_thread_t * const th, const int argc,
const VALUE * const argv, NODE * const cref)
vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const NODE *cref)
{
rb_block_t *blockptr = check_block(th);
return invoke_block_from_c(th, blockptr, blockptr->self, argc, argv, 0, cref);
}
VALUE
vm_yield(rb_thread_t * const th, const int argc, const VALUE * const argv)
vm_yield(rb_thread_t *th, int argc, const VALUE *argv)
{
rb_block_t * const blockptr = check_block(th);
rb_block_t *blockptr = check_block(th);
return invoke_block_from_c(th, blockptr, blockptr->self, argc, argv, 0, 0);
}
VALUE
vm_invoke_proc(rb_thread_t * const th, rb_proc_t * const proc,
const VALUE self, const int argc, const VALUE * const argv,
rb_block_t * const blockptr)
vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self,
int argc, const VALUE *argv, rb_block_t * blockptr)
{
VALUE val = Qundef;
int state;
@ -659,8 +655,7 @@ vm_invoke_proc(rb_thread_t * const th, rb_proc_t * const proc,
/* special variable */
VALUE
vm_cfp_svar_get(rb_thread_t * const th, rb_control_frame_t *cfp,
const VALUE key)
vm_cfp_svar_get(rb_thread_t *th, rb_control_frame_t *cfp, VALUE key)
{
while (cfp->pc == 0) {
cfp++;
@ -669,8 +664,7 @@ vm_cfp_svar_get(rb_thread_t * const th, rb_control_frame_t *cfp,
}
void
vm_cfp_svar_set(rb_thread_t * const th, rb_control_frame_t *cfp,
const VALUE key, const VALUE val)
vm_cfp_svar_set(rb_thread_t *th, rb_control_frame_t *cfp, VALUE key, const VALUE val)
{
while (cfp->pc == 0) {
cfp++;
@ -679,16 +673,16 @@ vm_cfp_svar_set(rb_thread_t * const th, rb_control_frame_t *cfp,
}
static VALUE
vm_svar_get(const VALUE key)
vm_svar_get(VALUE key)
{
rb_thread_t * const th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
return vm_cfp_svar_get(th, th->cfp, key);
}
static void
vm_svar_set(const VALUE key, const VALUE val)
vm_svar_set(VALUE key, VALUE val)
{
rb_thread_t * const th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
vm_cfp_svar_set(th, th->cfp, key, val);
}
@ -699,7 +693,7 @@ rb_backref_get(void)
}
void
rb_backref_set(const VALUE val)
rb_backref_set(VALUE val)
{
vm_svar_set(1, val);
}
@ -711,7 +705,7 @@ rb_lastline_get(void)
}
void
rb_lastline_set(const VALUE val)
rb_lastline_set(VALUE val)
{
vm_svar_set(0, val);
}
@ -741,10 +735,9 @@ vm_get_sourceline(rb_control_frame_t *cfp)
}
static VALUE
vm_backtrace_each(rb_thread_t * const th,
rb_control_frame_t * const limit_cfp,
rb_control_frame_t *cfp,
char * file, int line_no, const VALUE ary)
vm_backtrace_each(rb_thread_t *th,
rb_control_frame_t *limit_cfp, rb_control_frame_t *cfp,
const char * file, int line_no, VALUE ary)
{
VALUE str;
@ -773,7 +766,7 @@ vm_backtrace_each(rb_thread_t * const th,
}
VALUE
vm_backtrace(rb_thread_t * const th, int lev)
vm_backtrace(rb_thread_t *th, int lev)
{
VALUE ary;
rb_control_frame_t *cfp = th->cfp;
@ -838,7 +831,7 @@ debug_cref(NODE *cref)
#endif
NODE *
vm_cref_push(rb_thread_t * const th, const VALUE klass, const int noex)
vm_cref_push(rb_thread_t *th, VALUE klass, int noex)
{
NODE *cref = NEW_BLOCK(klass);
rb_control_frame_t *cfp = vm_get_ruby_level_cfp(th, th->cfp);
@ -850,7 +843,7 @@ vm_cref_push(rb_thread_t * const th, const VALUE klass, const int noex)
}
static inline VALUE
vm_get_cbase(rb_iseq_t * const iseq, VALUE * const lfp, VALUE * const dfp)
vm_get_cbase(const rb_iseq_t *iseq, const VALUE *lfp, const VALUE *dfp)
{
NODE *cref = vm_get_cref(iseq, lfp, dfp);
VALUE klass = Qundef;
@ -876,8 +869,7 @@ rb_vm_cbase(void)
/* jump */
static VALUE
make_localjump_error(const char *mesg,
const VALUE value, const int reason)
make_localjump_error(const char *mesg, VALUE value, int reason)
{
extern VALUE rb_eLocalJumpError;
VALUE exc = rb_exc_new2(rb_eLocalJumpError, mesg);
@ -909,15 +901,14 @@ make_localjump_error(const char *mesg,
}
void
vm_localjump_error(const char * const mesg, const VALUE value,
const int reason)
vm_localjump_error(const char *mesg, VALUE value, int reason)
{
VALUE exc = make_localjump_error(mesg, value, reason);
rb_exc_raise(exc);
}
VALUE
vm_make_jump_tag_but_local_jump(const int state, VALUE val)
vm_make_jump_tag_but_local_jump(int state, VALUE val)
{
VALUE result = Qnil;
@ -949,7 +940,7 @@ vm_make_jump_tag_but_local_jump(const int state, VALUE val)
}
void
vm_jump_tag_but_local_jump(const int state, const VALUE val)
vm_jump_tag_but_local_jump(int state, VALUE val)
{
VALUE exc = vm_make_jump_tag_but_local_jump(state, val);
if (val != Qnil) {
@ -958,13 +949,13 @@ vm_jump_tag_but_local_jump(const int state, const VALUE val)
JUMP_TAG(state);
}
NORETURN(static void vm_iter_break(rb_thread_t * const th));
NORETURN(static void vm_iter_break(rb_thread_t *th));
static void
vm_iter_break(rb_thread_t * const th)
vm_iter_break(rb_thread_t *th)
{
rb_control_frame_t * const cfp = th->cfp;
VALUE * const dfp = GC_GUARDED_PTR_REF(*cfp->dfp);
rb_control_frame_t *cfp = th->cfp;
VALUE *dfp = GC_GUARDED_PTR_REF(*cfp->dfp);
th->state = TAG_BREAK;
th->errinfo = (VALUE)NEW_THROW_OBJECT(Qnil, (VALUE)dfp, TAG_BREAK);
@ -983,7 +974,7 @@ VALUE ruby_vm_redefined_flag = 0;
static st_table *vm_opt_method_table = 0;
void
rb_vm_check_redefinition_opt_method(NODE * const node)
rb_vm_check_redefinition_opt_method(const NODE *node)
{
VALUE bop;
@ -993,7 +984,7 @@ rb_vm_check_redefinition_opt_method(NODE * const node)
}
static void
add_opt_method(const VALUE klass, const ID mid, const VALUE bop)
add_opt_method(VALUE klass, ID mid, VALUE bop)
{
NODE *node;
if (st_lookup(RCLASS_M_TBL(klass), mid, (void *)&node) &&
@ -1140,7 +1131,7 @@ vm_init_redefined_flag(void)
VALUE
vm_eval_body(rb_thread_t * const th)
vm_eval_body(rb_thread_t *th)
{
int state;
VALUE result, err;
@ -1348,9 +1339,9 @@ vm_eval_body(rb_thread_t * const th)
/* misc */
VALUE
rb_iseq_eval(const VALUE iseqval)
rb_iseq_eval(VALUE iseqval)
{
rb_thread_t * const th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
VALUE val;
volatile VALUE tmp;
@ -1365,8 +1356,8 @@ rb_iseq_eval(const VALUE iseqval)
}
int
rb_thread_method_id_and_class(rb_thread_t * const th,
ID * const idp, VALUE * const klassp)
rb_thread_method_id_and_class(rb_thread_t *th,
ID *idp, VALUE *klassp)
{
rb_control_frame_t *cfp = th->cfp;
rb_iseq_t *iseq = cfp->iseq;
@ -1395,7 +1386,7 @@ rb_thread_method_id_and_class(rb_thread_t * const th,
}
int
rb_frame_method_id_and_class(ID * const idp, VALUE * const klassp)
rb_frame_method_id_and_class(ID *idp, VALUE *klassp)
{
return rb_thread_method_id_and_class(GET_THREAD(), idp, klassp);
}
@ -1425,9 +1416,8 @@ rb_thread_current_status(rb_thread_t *th)
}
VALUE
rb_vm_call_cfunc(const VALUE recv, VALUE (* const func)(VALUE),
const VALUE arg, rb_block_t * const blockptr,
const VALUE filename)
rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg,
const rb_block_t *blockptr, VALUE filename)
{
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *reg_cfp = th->cfp;
@ -1443,7 +1433,7 @@ rb_vm_call_cfunc(const VALUE recv, VALUE (* const func)(VALUE),
}
int
rb_vm_cfunc_funcall_p(rb_control_frame_t * const cfp)
rb_vm_cfunc_funcall_p(rb_control_frame_t * cfp)
{
if (vm_cfunc_flags(cfp) & (VM_CALL_FCALL_BIT | VM_CALL_VCALL_BIT))
return Qtrue;
@ -1453,7 +1443,7 @@ rb_vm_cfunc_funcall_p(rb_control_frame_t * const cfp)
/* vm */
static void
vm_free(void * const ptr)
vm_free(void *ptr)
{
RUBY_FREE_ENTER("vm");
if (ptr) {
@ -1470,8 +1460,7 @@ vm_free(void * const ptr)
}
static int
vm_mark_each_thread_func(st_data_t const key, st_data_t const value,
st_data_t const dummy)
vm_mark_each_thread_func(st_data_t key, st_data_t value, st_data_t dummy)
{
VALUE thval = (VALUE)key;
rb_gc_mark(thval);
@ -1488,7 +1477,7 @@ mark_event_hooks(rb_event_hook_t *hook)
}
void
rb_vm_mark(void * const ptr)
rb_vm_mark(void *ptr)
{
RUBY_MARK_ENTER("vm");
RUBY_GC_INFO("-------------------------------------------------\n");
@ -1515,7 +1504,7 @@ rb_vm_mark(void * const ptr)
}
static void
vm_init2(rb_vm_t * const vm)
vm_init2(rb_vm_t *vm)
{
MEMZERO(vm, rb_vm_t, 1);
}
@ -1530,7 +1519,7 @@ VALUE *thread_recycle_stack_slot[RECYCLE_MAX];
int thread_recycle_stack_count = 0;
static VALUE *
thread_recycle_stack(const int size)
thread_recycle_stack(int size)
{
if (thread_recycle_stack_count) {
return thread_recycle_stack_slot[--thread_recycle_stack_count];
@ -1545,7 +1534,7 @@ thread_recycle_stack(const int size)
#endif
void
rb_thread_recycle_stack_release(VALUE * const stack)
rb_thread_recycle_stack_release(VALUE *stack)
{
#if USE_THREAD_DATA_RECYCLE
if (thread_recycle_stack_count < RECYCLE_MAX) {
@ -1570,7 +1559,7 @@ thread_recycle_struct(void)
#endif
static void
thread_free(void * const ptr)
thread_free(void *ptr)
{
rb_thread_t *th;
RUBY_FREE_ENTER("thread");
@ -1608,10 +1597,10 @@ thread_free(void * const ptr)
RUBY_FREE_LEAVE("thread");
}
void rb_gc_mark_machine_stack(rb_thread_t * const th);
void rb_gc_mark_machine_stack(rb_thread_t *th);
void
rb_thread_mark(void * const ptr)
rb_thread_mark(void *ptr)
{
rb_thread_t *th = NULL;
RUBY_MARK_ENTER("thread");
@ -1665,7 +1654,7 @@ rb_thread_mark(void * const ptr)
}
static VALUE
thread_alloc(const VALUE klass)
thread_alloc(VALUE klass)
{
VALUE volatile obj;
#ifdef USE_THREAD_RECYCLE
@ -1680,7 +1669,7 @@ thread_alloc(const VALUE klass)
}
static void
th_init2(rb_thread_t * const th)
th_init2(rb_thread_t *th)
{
/* allocate thread stack */
th->stack_size = RUBY_VM_THREAD_STACK_SIZE;
@ -1700,13 +1689,13 @@ th_init2(rb_thread_t * const th)
}
static void
th_init(rb_thread_t * const th)
th_init(rb_thread_t *th)
{
th_init2(th);
}
static VALUE
ruby_thread_init(const VALUE self)
ruby_thread_init(VALUE self)
{
rb_thread_t *th;
rb_vm_t *vm = GET_THREAD()->vm;
@ -1722,7 +1711,7 @@ ruby_thread_init(const VALUE self)
}
VALUE
rb_thread_alloc(const VALUE klass)
rb_thread_alloc(VALUE klass)
{
VALUE self = thread_alloc(klass);
ruby_thread_init(self);
@ -1870,8 +1859,8 @@ void
Init_BareVM(void)
{
/* VM bootstrap: phase 1 */
rb_vm_t * const vm = malloc(sizeof(*vm));
rb_thread_t * const th = malloc(sizeof(*th));
rb_vm_t * vm = malloc(sizeof(*vm));
rb_thread_t * th = malloc(sizeof(*th));
MEMZERO(th, rb_thread_t, 1);
rb_thread_set_current_raw(th);
@ -1896,7 +1885,7 @@ Init_BareVM(void)
/* top self */
static VALUE
main_to_s(const VALUE obj)
main_to_s(VALUE obj)
{
return rb_str_new2("main");
}

Просмотреть файл

@ -586,7 +586,7 @@ typedef rb_control_frame_t *
/* VM related object allocate functions */
/* TODO: should be static functions */
VALUE rb_thread_alloc(const VALUE klass);
VALUE rb_thread_alloc(VALUE klass);
VALUE rb_proc_alloc(VALUE klass);
/* for debug */
@ -598,28 +598,22 @@ void rb_vm_bugreport(void);
/* functions about thread/vm execution */
VALUE rb_iseq_eval(const VALUE iseqval);
VALUE rb_iseq_eval(VALUE iseqval);
void rb_enable_interrupt(void);
void rb_disable_interrupt(void);
int rb_thread_method_id_and_class(rb_thread_t * const th, ID * const idp,
VALUE * const klassp);
int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, VALUE *klassp);
VALUE vm_eval_body(rb_thread_t * const th);
VALUE vm_invoke_proc(rb_thread_t *const th, rb_proc_t * const proc,
const VALUE self, const int argc, const VALUE * const argv,
rb_block_t * const blockptr);
VALUE vm_make_proc(rb_thread_t * const th, rb_control_frame_t *const cfp,
rb_block_t * const block);
VALUE vm_make_env_object(rb_thread_t * const th, rb_control_frame_t *cfp);
VALUE vm_backtrace(rb_thread_t * const, int);
VALUE vm_eval_body(rb_thread_t *th);
VALUE vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self,
int argc, const VALUE *argv, rb_block_t *blockptr);
VALUE vm_make_proc(rb_thread_t *th, rb_control_frame_t *cfp, const rb_block_t *block);
VALUE vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp);
VALUE vm_backtrace(rb_thread_t *, int);
VALUE vm_yield(rb_thread_t * const th, const int argc,
const VALUE * const argv);
VALUE vm_yield_with_cref(rb_thread_t * const th, const int argc,
const VALUE * const argv, NODE * const cref);
VALUE vm_call0(rb_thread_t * const th, const VALUE klass, const VALUE recv,
const VALUE id, const ID oid, const int argc,
const VALUE * const argv, NODE *const body, const int nosuper);
VALUE vm_yield(rb_thread_t *th, int argc, const VALUE *argv);
VALUE vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const NODE *cref);
VALUE vm_call0(rb_thread_t *th, VALUE klass, VALUE recv, VALUE id, ID oid,
int argc, const VALUE *argv, const NODE *body, int nosuper);
int vm_get_sourceline(rb_control_frame_t *);

Просмотреть файл

@ -21,10 +21,10 @@
#endif
static inline rb_control_frame_t *
vm_push_frame(rb_thread_t * const th, const rb_iseq_t * const iseq,
const VALUE type, const VALUE self, const VALUE specval,
const VALUE * const pc, VALUE *sp, VALUE *lfp,
int const local_size)
vm_push_frame(rb_thread_t * th, const rb_iseq_t * iseq,
VALUE type, VALUE self, VALUE specval,
const VALUE *pc, VALUE *sp, VALUE *lfp,
int local_size)
{
rb_control_frame_t * const cfp = th->cfp = th->cfp - 1;
int i;
@ -70,7 +70,7 @@ vm_push_frame(rb_thread_t * const th, const rb_iseq_t * const iseq,
}
static inline void
vm_pop_frame(rb_thread_t * const th)
vm_pop_frame(rb_thread_t *th)
{
#if COLLECT_PROFILE
rb_control_frame_t *cfp = th->cfp;
@ -99,9 +99,8 @@ vm_pop_frame(rb_thread_t * const th)
/* method dispatch */
static inline int
vm_callee_setup_arg(rb_thread_t * const th, const rb_iseq_t * const iseq,
const int orig_argc, VALUE * const orig_argv,
rb_block_t ** const block)
vm_callee_setup_arg(rb_thread_t *th, const rb_iseq_t * iseq,
int orig_argc, VALUE * orig_argv, rb_block_t **block)
{
const int m = iseq->argc;
@ -174,7 +173,7 @@ vm_callee_setup_arg(rb_thread_t * const th, const rb_iseq_t * const iseq,
/* block arguments */
if (block && iseq->arg_block != -1) {
VALUE blockval = Qnil;
rb_block_t * const blockptr = *block;
const rb_block_t *blockptr = *block;
if (argc != 0) {
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
@ -205,9 +204,8 @@ vm_callee_setup_arg(rb_thread_t * const th, const rb_iseq_t * const iseq,
}
static inline int
caller_setup_args(const rb_thread_t * const th,
rb_control_frame_t * const cfp, const VALUE flag, int argc,
rb_iseq_t * const blockiseq, rb_block_t ** const block)
caller_setup_args(const rb_thread_t *th, rb_control_frame_t *cfp, VALUE flag,
int argc, rb_iseq_t *blockiseq, rb_block_t **block)
{
rb_block_t *blockptr = 0;
@ -270,8 +268,8 @@ caller_setup_args(const rb_thread_t * const th,
}
static inline VALUE
call_cfunc(VALUE (* const func)(), const VALUE recv,
const int len, const int argc, const VALUE * const argv)
call_cfunc(VALUE (*func)(), VALUE recv,
int len, int argc, const VALUE *argv)
{
/* printf("len: %d, argc: %d\n", len, argc); */
@ -358,9 +356,9 @@ call_cfunc(VALUE (* const func)(), const VALUE recv,
}
static inline VALUE
vm_call_cfunc(rb_thread_t * const th, rb_control_frame_t * const reg_cfp,
const int num, const ID id, const VALUE recv, const VALUE klass,
const VALUE flag, const NODE * const mn, const rb_block_t * const blockptr)
vm_call_cfunc(rb_thread_t *th, rb_control_frame_t *reg_cfp,
int num, ID id, VALUE recv, VALUE klass,
VALUE flag, const NODE *mn, const rb_block_t *blockptr)
{
VALUE val;
@ -388,7 +386,7 @@ vm_call_cfunc(rb_thread_t * const th, rb_control_frame_t * const reg_cfp,
}
static inline int
vm_cfunc_flags(const rb_control_frame_t * const cfp)
vm_cfunc_flags(const rb_control_frame_t *cfp)
{
if (RUBYVM_CFUNC_FRAME_P(cfp))
return cfp->flag >> FRAME_MAGIC_MASK_BITS;
@ -396,9 +394,8 @@ vm_cfunc_flags(const rb_control_frame_t * const cfp)
}
static inline VALUE
vm_call_bmethod(rb_thread_t * const th, const ID id, const VALUE procval,
const VALUE recv, const VALUE klass, const int argc, VALUE *argv,
rb_block_t * const blockptr)
vm_call_bmethod(rb_thread_t *th, ID id, VALUE procval, VALUE recv,
VALUE klass, int argc, VALUE *argv, rb_block_t *blockptr)
{
rb_control_frame_t *cfp = th->cfp;
rb_proc_t *proc;
@ -414,8 +411,8 @@ vm_call_bmethod(rb_thread_t * const th, const ID id, const VALUE procval,
}
static inline VALUE
vm_method_missing(rb_thread_t * const th, const ID id, const VALUE recv,
const int num, rb_block_t * const blockptr, const int opt)
vm_method_missing(rb_thread_t *th, ID id, VALUE recv,
int num, rb_block_t *blockptr, int opt)
{
rb_control_frame_t * const reg_cfp = th->cfp;
VALUE *argv = STACK_ADDR_FROM_TOP(num + 1);
@ -651,8 +648,8 @@ block_proc_is_lambda(const VALUE procval)
}
static inline VALUE
vm_yield_with_cfunc(rb_thread_t *const th, rb_block_t * const block,
const VALUE self, const int argc, const VALUE * const argv)
vm_yield_with_cfunc(rb_thread_t *th, rb_block_t *block,
VALUE self, int argc, const VALUE *argv)
{
NODE *ifunc = (NODE *) block->iseq;
VALUE val;
@ -680,9 +677,9 @@ vm_yield_with_cfunc(rb_thread_t *const th, rb_block_t * const block,
}
static inline int
vm_yield_setup_args(rb_thread_t * const th, const rb_iseq_t * const iseq,
const int orig_argc, VALUE * const argv,
rb_block_t *blockptr, const int lambda)
vm_yield_setup_args(rb_thread_t * const th, const rb_iseq_t *iseq,
int orig_argc, VALUE *argv,
rb_block_t *blockptr, int lambda)
{
if (0) { /* for debug */
printf(" argc: %d\n", orig_argc);
@ -799,8 +796,7 @@ vm_yield_setup_args(rb_thread_t * const th, const rb_iseq_t * const iseq,
}
static VALUE
vm_invoke_block(rb_thread_t * const th, rb_control_frame_t *const reg_cfp,
const rb_num_t num, const rb_num_t flag)
vm_invoke_block(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_num_t num, rb_num_t flag)
{
rb_block_t * const block = GET_BLOCK_PTR();
rb_iseq_t *iseq;
@ -840,7 +836,7 @@ vm_invoke_block(rb_thread_t * const th, rb_control_frame_t *const reg_cfp,
/* svar */
static inline NODE *
lfp_svar_place(rb_thread_t * const th, VALUE * const lfp)
lfp_svar_place(rb_thread_t *th, VALUE *lfp)
{
NODE *svar;
@ -862,7 +858,7 @@ lfp_svar_place(rb_thread_t * const th, VALUE * const lfp)
}
static VALUE
lfp_svar_get(rb_thread_t * const th, VALUE * const lfp, const VALUE key)
lfp_svar_get(rb_thread_t *th, VALUE *lfp, VALUE key)
{
NODE *svar = lfp_svar_place(th, lfp);
@ -885,8 +881,7 @@ lfp_svar_get(rb_thread_t * const th, VALUE * const lfp, const VALUE key)
}
static void
lfp_svar_set(rb_thread_t * const th, VALUE * const lfp,
const VALUE key, const VALUE val)
lfp_svar_set(rb_thread_t *th, VALUE *lfp, VALUE key, VALUE val)
{
NODE *svar = lfp_svar_place(th, lfp);
@ -909,8 +904,7 @@ lfp_svar_set(rb_thread_t * const th, VALUE * const lfp,
}
static inline VALUE
vm_getspecial(rb_thread_t * const th, VALUE * const lfp,
const VALUE key, const rb_num_t type)
vm_getspecial(rb_thread_t *th, VALUE *lfp, VALUE key, rb_num_t type)
{
VALUE val;
@ -950,8 +944,7 @@ vm_getspecial(rb_thread_t * const th, VALUE * const lfp,
}
static NODE *
vm_get_cref(const rb_iseq_t * const iseq,
const VALUE * const lfp, const VALUE *dfp)
vm_get_cref(const rb_iseq_t *iseq, const VALUE *lfp, const VALUE *dfp)
{
NODE *cref = 0;
@ -975,7 +968,7 @@ vm_get_cref(const rb_iseq_t * const iseq,
static inline void
vm_check_if_namespace(const VALUE klass)
vm_check_if_namespace(VALUE klass)
{
switch (TYPE(klass)) {
case T_CLASS:
@ -988,14 +981,14 @@ vm_check_if_namespace(const VALUE klass)
}
static inline VALUE
vm_get_ev_const(rb_thread_t * const th, const rb_iseq_t * const iseq,
const VALUE orig_klass, const ID id, const int is_defined)
vm_get_ev_const(rb_thread_t *th, const rb_iseq_t *iseq,
VALUE orig_klass, ID id, int is_defined)
{
VALUE val;
if (orig_klass == Qnil) {
/* in current lexical scope */
const NODE * const root_cref = vm_get_cref(iseq, th->cfp->lfp, th->cfp->dfp);
const NODE *root_cref = vm_get_cref(iseq, th->cfp->lfp, th->cfp->dfp);
const NODE *cref = root_cref;
VALUE klass = orig_klass;
@ -1069,9 +1062,8 @@ vm_get_cvar_base(NODE *cref)
}
static inline void
vm_define_method(rb_thread_t * const th, const VALUE obj, const ID id,
rb_iseq_t * const miseq, const rb_num_t is_singleton,
NODE * const cref)
vm_define_method(rb_thread_t *th, VALUE obj, ID id, rb_iseq_t *miseq,
rb_num_t is_singleton, NODE *cref)
{
NODE *newbody;
VALUE klass = cref->nd_clss;
@ -1110,7 +1102,7 @@ vm_define_method(rb_thread_t * const th, const VALUE obj, const ID id,
}
static inline NODE *
vm_method_search(const VALUE id, const VALUE klass, const IC ic)
vm_method_search(VALUE id, VALUE klass, IC ic)
{
NODE *mn;
@ -1134,7 +1126,7 @@ vm_method_search(const VALUE id, const VALUE klass, const IC ic)
}
static inline VALUE
vm_search_normal_superclass(VALUE klass, const VALUE recv)
vm_search_normal_superclass(VALUE klass, VALUE recv)
{
if (BUILTIN_TYPE(klass) == T_CLASS) {
klass = RCLASS_SUPER(klass);
@ -1153,9 +1145,9 @@ vm_search_normal_superclass(VALUE klass, const VALUE recv)
}
static void
vm_search_superclass(rb_control_frame_t *const reg_cfp, rb_iseq_t * ip,
const VALUE recv, const VALUE sigval,
ID * const idp, VALUE * const klassp)
vm_search_superclass(rb_control_frame_t *reg_cfp, rb_iseq_t *ip,
VALUE recv, VALUE sigval,
ID *idp, VALUE *klassp)
{
ID id;
VALUE klass;
@ -1201,8 +1193,8 @@ vm_search_superclass(rb_control_frame_t *const reg_cfp, rb_iseq_t * ip,
}
static VALUE
vm_throw(rb_thread_t *const th, rb_control_frame_t * const reg_cfp,
const rb_num_t throw_state, const VALUE throwobj)
vm_throw(rb_thread_t *th, rb_control_frame_t *reg_cfp,
rb_num_t throw_state, VALUE throwobj)
{
rb_num_t state = throw_state & 0xff;
rb_num_t flag = throw_state & 0x8000;
@ -1347,8 +1339,7 @@ vm_throw(rb_thread_t *const th, rb_control_frame_t * const reg_cfp,
}
static inline void
vm_expandarray(rb_control_frame_t * const cfp, VALUE ary,
const int num, const int flag)
vm_expandarray(rb_control_frame_t *cfp, VALUE ary, int num, int flag)
{
int is_splat = flag & 0x01;
int space_size = num + is_splat;
@ -1409,7 +1400,7 @@ vm_expandarray(rb_control_frame_t * const cfp, VALUE ary,
}
static inline int
check_cfunc(const NODE * const mn, const void * const func)
check_cfunc(const NODE *mn, const void *func)
{
if (mn && nd_type(mn->nd_body) == NODE_CFUNC &&
mn->nd_body->nd_cfnc == func) {
@ -1421,7 +1412,7 @@ check_cfunc(const NODE * const mn, const void * const func)
}
static inline VALUE
opt_eq_func(const VALUE recv, const VALUE obj, const IC ic)
opt_eq_func(VALUE recv, VALUE obj, IC ic)
{
VALUE val = Qundef;