* vm_core.h (ruby_vm_throw_flags): constants for throw.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-07-20 00:08:23 +00:00
Родитель 46b70c8da5
Коммит 1b8ff4f799
3 изменённых файлов: 15 добавлений и 8 удалений

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

@ -3725,11 +3725,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
level++;
if (ip->compile_data->redo_label != 0) {
level = 0x8000;
level = VM_THROW_NO_ESCAPE_FLAG;
goto break_by_insn;
}
else if (ip->type == ISEQ_TYPE_BLOCK) {
level <<= 16;
level <<= VM_THROW_LEVEL_SHIFT;
goto break_by_insn;
}
else if (ip->type == ISEQ_TYPE_EVAL) {
@ -3785,7 +3785,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
level = 0x8000;
level = VM_THROW_NO_ESCAPE_FLAG;
if (ip->compile_data->redo_label != 0) {
/* while loop */
break;
@ -3846,7 +3846,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
else {
const rb_iseq_t *ip = iseq;
unsigned long level = 0x8000;
const unsigned long level = VM_THROW_NO_ESCAPE_FLAG;
while (ip) {
if (!ip->compile_data) {

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

@ -145,6 +145,12 @@ enum ruby_tag_type {
#define TAG_FATAL RUBY_TAG_FATAL
#define TAG_MASK RUBY_TAG_MASK
enum ruby_vm_throw_flags {
VM_THROW_NO_ESCAPE_FLAG = 0x8000,
VM_THROW_LEVEL_SHIFT = 16,
VM_THROW_STATE_MASK = 0xff
};
/* iseq data type */
struct iseq_compile_data_ensure_node_stack;

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

@ -830,7 +830,8 @@ vm_throw_continue(rb_thread_t *th, VALUE err)
}
static VALUE
vm_throw_start(rb_thread_t * const th, rb_control_frame_t * const reg_cfp, int state, const int flag, const rb_num_t level, const VALUE throwobj)
vm_throw_start(rb_thread_t *const th, rb_control_frame_t *const reg_cfp, enum ruby_tag_type state,
const int flag, const rb_num_t level, const VALUE throwobj)
{
rb_control_frame_t *escape_cfp = NULL;
const rb_control_frame_t * const eocfp = RUBY_VM_END_CONTROL_FRAME(th); /* end of control frame pointer */
@ -966,9 +967,9 @@ static VALUE
vm_throw(rb_thread_t *th, rb_control_frame_t *reg_cfp,
rb_num_t throw_state, VALUE throwobj)
{
const int state = (int)(throw_state & 0xff);
const int flag = (int)(throw_state & 0x8000);
const rb_num_t level = throw_state >> 16;
const int state = (int)(throw_state & VM_THROW_STATE_MASK);
const int flag = (int)(throw_state & VM_THROW_NO_ESCAPE_FLAG);
const rb_num_t level = throw_state >> VM_THROW_LEVEL_SHIFT;
if (state != 0) {
return vm_throw_start(th, reg_cfp, state, flag, level, throwobj);