Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send-pop optimisation #2100

Open
wants to merge 20 commits into
base: master
from
Open
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

omit branch inside of vm_sendish

Now that opt_bailout is introduced, a method that is entirely pure can
have that instruction at the very beginning of its sequence.  Why not
just invoke such methods as usual and let the instruction do the job.
This adds some overhead (frame manipulations previously entirely
skipped can now occur) and removes another (purity calculations for
non-skippable method calls now eliminated).  So let's see the
trade-offs.
  • Loading branch information...
shyouhei committed Mar 13, 2019
commit 40183787825676c6cce90b1b560ad8b46adfece5
@@ -8,12 +8,7 @@
%;
#line <%= __LINE__ + 1 %> <%=cstr __FILE__ %>

#ifdef INSIDE_VM_INSNHELPER_C
MJIT_FUNC_EXPORTED
#else
static
#endif
rb_snum_t
static rb_snum_t
sp_inc_of_sendish(const struct rb_call_info *ci)
{
/* Send-ish instructions will:
@@ -32,12 +27,7 @@ sp_inc_of_sendish(const struct rb_call_info *ci)
return 0 - argb - argc - recv + retn;
}

#ifdef INSIDE_VM_INSNHELPER_C
MJIT_FUNC_EXPORTED
#else
static
#endif
rb_snum_t
static rb_snum_t
sp_inc_of_invokeblock(const struct rb_call_info *ci)
{
/* sp_inc of invokeblock is almost identical to that of sendish
@@ -3362,20 +3362,6 @@ vm_sendish(

method_explorer(GET_CFP(), ci, cc, recv);

if (popped &&
vm_whether_we_can_skip_this_call_site_p(cc, block_handler)) {
/* We are going to skip execution and "emulate" stack
* manipulations */
extern rb_snum_t sp_inc_of_invokeblock(const struct rb_call_info *);
extern rb_snum_t sp_inc_of_sendish(const struct rb_call_info *);
rb_snum_t (*calc)(const struct rb_call_info *) =
(cc->call == vm_invokeblock_i) ?
sp_inc_of_invokeblock :
sp_inc_of_sendish;
INC_SP(calc(ci));
return Qundef; /* dummy retval (not used) */
}

val = cc->call(ec, GET_CFP(), &calling, ci, cc);

if (val != Qundef) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.