Skip to content

Instantly share code, notes, and snippets.

@shyouhei
Created July 13, 2020 02:57
Show Gist options
  • Save shyouhei/91c0862ff68a4c5b4fd338f8d79ad21f to your computer and use it in GitHub Desktop.
Save shyouhei/91c0862ff68a4c5b4fd338f8d79ad21f to your computer and use it in GitHub Desktop.
#ifndef MJIT_PCH
#define MJIT_PCH
#include "/tmp/_ruby_mjit_hp30916u0.h"
#endif
/* glob@<internal:dir>:135 */
VALUE
_mjit2(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp)
{
VALUE stack[4];
static const rb_iseq_t *original_iseq = (const rb_iseq_t *)0x557a1afd2340;
static const VALUE *const original_body_iseq = (VALUE *)0x557a1b0e2130;
switch (reg_cfp->pc - reg_cfp->iseq->body->iseq_encoded) {
case 0:
goto label_0;
case 3:
goto label_3;
}
label_0: /* putobject_INT2FIX_0_ */
{
MAYBE_UNUSED(unsigned int) stack_size = 0;
MAYBE_UNUSED(VALUE) val;
val = INT2FIX(0);
{
/* */
}
stack[0] = val;
}
label_1: /* setlocal_WC_0 */
{
MAYBE_UNUSED(unsigned int) stack_size = 1;
MAYBE_UNUSED(VALUE) val;
MAYBE_UNUSED(lindex_t) idx;
MAYBE_UNUSED(rb_num_t) level;
level = 0;
idx = (lindex_t)0x7;
val = stack[0];
{
vm_env_write(vm_get_ep(GET_EP(), level), -(int)idx, val);
RB_DEBUG_COUNTER_INC(lvar_set);
(void)RB_DEBUG_COUNTER_INC_IF(lvar_set_dynamic, level > 0);
}
}
label_3: /* checkkeyword */
{
MAYBE_UNUSED(unsigned int) stack_size = 0;
MAYBE_UNUSED(VALUE) ret;
MAYBE_UNUSED(lindex_t) keyword_index, kw_bits_index;
kw_bits_index = (lindex_t)0x3;
keyword_index = (lindex_t)0x0;
{
ret = vm_check_keyword(kw_bits_index, keyword_index, GET_EP());
}
stack[0] = ret;
}
label_6: /* branchif */
{
MAYBE_UNUSED(unsigned int) stack_size = 1;
MAYBE_UNUSED(OFFSET) dst;
MAYBE_UNUSED(VALUE) val;
dst = (OFFSET)0x4;
val = stack[0];
reg_cfp->pc = original_body_iseq + 8;
{
if (RTEST(val)) {
RUBY_VM_CHECK_INTS(ec);
goto label_12;
}
}
if (UNLIKELY(!mjit_call_p)) {
reg_cfp->sp = vm_base_ptr(reg_cfp) + 0;
RB_DEBUG_COUNTER_INC(mjit_cancel_invalidate_all);
goto cancel;
}
}
label_8: /* getlocal_WC_0 */
{
MAYBE_UNUSED(unsigned int) stack_size = 0;
MAYBE_UNUSED(VALUE) val;
MAYBE_UNUSED(lindex_t) idx;
MAYBE_UNUSED(rb_num_t) level;
level = 0;
idx = (lindex_t)0x7;
{
val = *(vm_get_ep(GET_EP(), level) - idx);
RB_DEBUG_COUNTER_INC(lvar_get);
(void)RB_DEBUG_COUNTER_INC_IF(lvar_get_dynamic, level > 0);
}
stack[0] = val;
}
label_10: /* setlocal_WC_0 */
{
MAYBE_UNUSED(unsigned int) stack_size = 1;
MAYBE_UNUSED(VALUE) val;
MAYBE_UNUSED(lindex_t) idx;
MAYBE_UNUSED(rb_num_t) level;
level = 0;
idx = (lindex_t)0x6;
val = stack[0];
{
vm_env_write(vm_get_ep(GET_EP(), level), -(int)idx, val);
RB_DEBUG_COUNTER_INC(lvar_set);
(void)RB_DEBUG_COUNTER_INC_IF(lvar_set_dynamic, level > 0);
}
}
label_12: /* getlocal_WC_0 */
{
MAYBE_UNUSED(unsigned int) stack_size = 0;
MAYBE_UNUSED(VALUE) val;
MAYBE_UNUSED(lindex_t) idx;
MAYBE_UNUSED(rb_num_t) level;
level = 0;
idx = (lindex_t)0x8;
{
val = *(vm_get_ep(GET_EP(), level) - idx);
RB_DEBUG_COUNTER_INC(lvar_get);
(void)RB_DEBUG_COUNTER_INC_IF(lvar_get_dynamic, level > 0);
}
stack[0] = val;
}
label_14: /* getlocal_WC_0 */
{
MAYBE_UNUSED(unsigned int) stack_size = 1;
MAYBE_UNUSED(VALUE) val;
MAYBE_UNUSED(lindex_t) idx;
MAYBE_UNUSED(rb_num_t) level;
level = 0;
idx = (lindex_t)0x6;
{
val = *(vm_get_ep(GET_EP(), level) - idx);
RB_DEBUG_COUNTER_INC(lvar_get);
(void)RB_DEBUG_COUNTER_INC_IF(lvar_get_dynamic, level > 0);
}
stack[1] = val;
}
label_16: /* getlocal_WC_0 */
{
MAYBE_UNUSED(unsigned int) stack_size = 2;
MAYBE_UNUSED(VALUE) val;
MAYBE_UNUSED(lindex_t) idx;
MAYBE_UNUSED(rb_num_t) level;
level = 0;
idx = (lindex_t)0x5;
{
val = *(vm_get_ep(GET_EP(), level) - idx);
RB_DEBUG_COUNTER_INC(lvar_get);
(void)RB_DEBUG_COUNTER_INC_IF(lvar_get_dynamic, level > 0);
}
stack[2] = val;
}
label_18: /* getlocal_WC_0 */
{
MAYBE_UNUSED(unsigned int) stack_size = 3;
MAYBE_UNUSED(VALUE) val;
MAYBE_UNUSED(lindex_t) idx;
MAYBE_UNUSED(rb_num_t) level;
level = 0;
idx = (lindex_t)0x4;
{
val = *(vm_get_ep(GET_EP(), level) - idx);
RB_DEBUG_COUNTER_INC(lvar_get);
(void)RB_DEBUG_COUNTER_INC_IF(lvar_get_dynamic, level > 0);
}
stack[3] = val;
}
label_20: /* invokebuiltin */
{
VALUE val;
typedef VALUE (*func)(rb_execution_context_t *, VALUE, VALUE, VALUE, VALUE, VALUE);
const VALUE *argv = STACK_ADDR_FROM_TOP(4);
func f = (func)93982893178912; /* == dir_s_glob */
val = f(ec, GET_SELF(), argv[0], argv[1], argv[2], argv[3]);
stack[0] = val;
}
label_22: /* leave */
if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(ec))) {
reg_cfp->sp = vm_base_ptr(reg_cfp) + 1;
reg_cfp->pc = original_body_iseq + 22;
RB_DEBUG_COUNTER_INC(mjit_cancel_leave);
goto cancel;
}
ec->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(reg_cfp);
return stack[0];
goto label_12;
send_cancel:
RB_DEBUG_COUNTER_INC(mjit_cancel_send_inline);
rb_mjit_recompile_send(original_iseq);
goto cancel;
ivar_cancel:
RB_DEBUG_COUNTER_INC(mjit_cancel_ivar_inline);
rb_mjit_recompile_ivar(original_iseq);
goto cancel;
exivar_cancel:
RB_DEBUG_COUNTER_INC(mjit_cancel_exivar_inline);
rb_mjit_recompile_exivar(original_iseq);
goto cancel;
cancel:
RB_DEBUG_COUNTER_INC(mjit_cancel);
*(vm_base_ptr(reg_cfp) + 0) = stack[0];
*(vm_base_ptr(reg_cfp) + 1) = stack[1];
*(vm_base_ptr(reg_cfp) + 2) = stack[2];
*(vm_base_ptr(reg_cfp) + 3) = stack[3];
return Qundef;
} // end of _mjit2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment