зеркало из https://github.com/github/ruby.git
* proc.c: use RUBY_VM_IFUNC_P() to recognize IFUNC or not.
* vm.c: ditto. * vm_dump.c: ditto. * vm_insnhelper.c: ditto. * vm_core.h: use RB_TYPE_P() instead of BUILTIN_TYPE(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
46cdb8f187
Коммит
ed130faf28
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
Wed Mar 11 03:48:01 2015 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* proc.c: use RUBY_VM_IFUNC_P() to recognize IFUNC or not.
|
||||||
|
|
||||||
|
* vm.c: ditto.
|
||||||
|
|
||||||
|
* vm_dump.c: ditto.
|
||||||
|
|
||||||
|
* vm_insnhelper.c: ditto.
|
||||||
|
|
||||||
|
* vm_core.h: use RB_TYPE_P() instead of BUILTIN_TYPE().
|
||||||
|
|
||||||
Wed Mar 11 03:21:37 2015 Koichi Sasada <ko1@atdot.net>
|
Wed Mar 11 03:21:37 2015 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* vm_insnhelper.h: define struct THROW_DATA to represent
|
* vm_insnhelper.h: define struct THROW_DATA to represent
|
||||||
|
|
8
proc.c
8
proc.c
|
@ -722,7 +722,7 @@ proc_call(int argc, VALUE *argv, VALUE procval)
|
||||||
GetProcPtr(procval, proc);
|
GetProcPtr(procval, proc);
|
||||||
|
|
||||||
iseq = proc->block.iseq;
|
iseq = proc->block.iseq;
|
||||||
if (BUILTIN_TYPE(iseq) == T_NODE || iseq->param.flags.has_block) {
|
if (RUBY_VM_IFUNC_P(iseq) || iseq->param.flags.has_block) {
|
||||||
if (rb_block_given_p()) {
|
if (rb_block_given_p()) {
|
||||||
rb_proc_t *passed_proc;
|
rb_proc_t *passed_proc;
|
||||||
RB_GC_GUARD(passed_procval) = rb_block_proc();
|
RB_GC_GUARD(passed_procval) = rb_block_proc();
|
||||||
|
@ -846,7 +846,7 @@ rb_block_min_max_arity(rb_block_t *block, int *max)
|
||||||
{
|
{
|
||||||
rb_iseq_t *iseq = block->iseq;
|
rb_iseq_t *iseq = block->iseq;
|
||||||
if (iseq) {
|
if (iseq) {
|
||||||
if (BUILTIN_TYPE(iseq) != T_NODE) {
|
if (!RUBY_VM_IFUNC_P(iseq)) {
|
||||||
return rb_iseq_min_max_arity(iseq, max);
|
return rb_iseq_min_max_arity(iseq, max);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1685,7 +1685,7 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod)
|
||||||
rb_proc_t *proc;
|
rb_proc_t *proc;
|
||||||
body = proc_dup(body);
|
body = proc_dup(body);
|
||||||
GetProcPtr(body, proc);
|
GetProcPtr(body, proc);
|
||||||
if (BUILTIN_TYPE(proc->block.iseq) != T_NODE) {
|
if (!RUBY_VM_IFUNC_P(proc->block.iseq)) {
|
||||||
proc->block.iseq->defined_method_id = id;
|
proc->block.iseq->defined_method_id = id;
|
||||||
RB_OBJ_WRITE(proc->block.iseq->self, &proc->block.iseq->klass, mod);
|
RB_OBJ_WRITE(proc->block.iseq->self, &proc->block.iseq->klass, mod);
|
||||||
proc->is_lambda = TRUE;
|
proc->is_lambda = TRUE;
|
||||||
|
@ -2464,7 +2464,7 @@ proc_binding(VALUE self)
|
||||||
|
|
||||||
GetProcPtr(self, proc);
|
GetProcPtr(self, proc);
|
||||||
iseq = proc->block.iseq;
|
iseq = proc->block.iseq;
|
||||||
if (RB_TYPE_P((VALUE)iseq, T_NODE)) {
|
if (RUBY_VM_IFUNC_P(iseq)) {
|
||||||
if (!IS_METHOD_PROC_NODE((NODE *)iseq)) {
|
if (!IS_METHOD_PROC_NODE((NODE *)iseq)) {
|
||||||
rb_raise(rb_eArgError, "Can't create Binding from C level Proc");
|
rb_raise(rb_eArgError, "Can't create Binding from C level Proc");
|
||||||
}
|
}
|
||||||
|
|
4
vm.c
4
vm.c
|
@ -413,7 +413,7 @@ env_mark(void * const ptr)
|
||||||
RUBY_MARK_UNLESS_NULL(env->block.proc);
|
RUBY_MARK_UNLESS_NULL(env->block.proc);
|
||||||
|
|
||||||
if (env->block.iseq) {
|
if (env->block.iseq) {
|
||||||
if (BUILTIN_TYPE(env->block.iseq) == T_NODE) {
|
if (RUBY_VM_IFUNC_P(env->block.iseq)) {
|
||||||
RUBY_MARK_UNLESS_NULL((VALUE)env->block.iseq);
|
RUBY_MARK_UNLESS_NULL((VALUE)env->block.iseq);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -801,7 +801,7 @@ invoke_block_from_c(rb_thread_t *th, const rb_block_t *block,
|
||||||
if (SPECIAL_CONST_P(block->iseq)) {
|
if (SPECIAL_CONST_P(block->iseq)) {
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
else if (BUILTIN_TYPE(block->iseq) != T_NODE) {
|
else if (!RUBY_VM_IFUNC_P(block->iseq)) {
|
||||||
VALUE ret;
|
VALUE ret;
|
||||||
const rb_iseq_t *iseq = block->iseq;
|
const rb_iseq_t *iseq = block->iseq;
|
||||||
const rb_control_frame_t *cfp;
|
const rb_control_frame_t *cfp;
|
||||||
|
|
|
@ -910,7 +910,7 @@ rb_block_t *rb_vm_control_frame_block_ptr(const rb_control_frame_t *cfp);
|
||||||
#define RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp) \
|
#define RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp) \
|
||||||
(!RUBY_VM_VALID_CONTROL_FRAME_P((cfp), RUBY_VM_END_CONTROL_FRAME(th)))
|
(!RUBY_VM_VALID_CONTROL_FRAME_P((cfp), RUBY_VM_END_CONTROL_FRAME(th)))
|
||||||
|
|
||||||
#define RUBY_VM_IFUNC_P(ptr) (BUILTIN_TYPE(ptr) == T_NODE)
|
#define RUBY_VM_IFUNC_P(ptr) RB_TYPE_P((VALUE)(ptr), T_NODE)
|
||||||
#define RUBY_VM_NORMAL_ISEQ_P(ptr) \
|
#define RUBY_VM_NORMAL_ISEQ_P(ptr) \
|
||||||
((ptr) && !RUBY_VM_IFUNC_P(ptr))
|
((ptr) && !RUBY_VM_IFUNC_P(ptr))
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ control_frame_dump(rb_thread_t *th, rb_control_frame_t *cfp)
|
||||||
const char *magic, *iseq_name = "-", *selfstr = "-", *biseq_name = "-";
|
const char *magic, *iseq_name = "-", *selfstr = "-", *biseq_name = "-";
|
||||||
VALUE tmp;
|
VALUE tmp;
|
||||||
|
|
||||||
if (cfp->block_iseq != 0 && BUILTIN_TYPE(cfp->block_iseq) != T_NODE) {
|
if (cfp->block_iseq != 0 && !RUBY_VM_IFUNC_P(cfp->block_iseq)) {
|
||||||
biseq_name = ""; /* RSTRING(cfp->block_iseq->location.label)->ptr; */
|
biseq_name = ""; /* RSTRING(cfp->block_iseq->location.label)->ptr; */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2110,7 +2110,7 @@ vm_invoke_block(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_info_t *ci
|
||||||
}
|
}
|
||||||
iseq = block->iseq;
|
iseq = block->iseq;
|
||||||
|
|
||||||
if (BUILTIN_TYPE(iseq) != T_NODE) {
|
if (!RUBY_VM_IFUNC_P(iseq)) {
|
||||||
int opt_pc;
|
int opt_pc;
|
||||||
const int arg_size = iseq->param.size;
|
const int arg_size = iseq->param.size;
|
||||||
int is_lambda = block_proc_is_lambda(block->proc);
|
int is_lambda = block_proc_is_lambda(block->proc);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче