Skip to content

Commit

Permalink
Fixed custom call site dispatch.
Browse files Browse the repository at this point in the history
This abstruse mechanism will be cleaned up with the call site and inline cache
rewrite.
  • Loading branch information
brixen committed Apr 3, 2016
1 parent 90bbc42 commit cfd3f08
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions machine/builtin/call_site.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,15 @@ namespace rubinius {
Executable* meth = dispatch.method;
Module* mod = dispatch.module;

return meth->execute(state, meth, mod, args);
if(meth->custom_call_site_p()) {
CallSiteInformation info(call_site->executable(), call_site->ip());
state->set_call_site_information(&info);
Object* res = meth->execute(state, meth, mod, args);
state->set_call_site_information(NULL);
return res;
} else {
return meth->execute(state, meth, mod, args);
}
}

Object* CallSite::empty_cache_private(STATE, CallSite* call_site,
Expand All @@ -85,7 +93,15 @@ namespace rubinius {
Executable* meth = dispatch.method;
Module* mod = dispatch.module;

return meth->execute(state, meth, mod, args);
if(meth->custom_call_site_p()) {
CallSiteInformation info(call_site->executable(), call_site->ip());
state->set_call_site_information(&info);
Object* res = meth->execute(state, meth, mod, args);
state->set_call_site_information(NULL);
return res;
} else {
return meth->execute(state, meth, mod, args);
}
}

Object* CallSite::empty_cache_vcall(STATE, CallSite* call_site, Arguments& args) {
Expand All @@ -111,7 +127,15 @@ namespace rubinius {
Executable* meth = dispatch.method;
Module* mod = dispatch.module;

return meth->execute(state, meth, mod, args);
if(meth->custom_call_site_p()) {
CallSiteInformation info(call_site->executable(), call_site->ip());
state->set_call_site_information(&info);
Object* res = meth->execute(state, meth, mod, args);
state->set_call_site_information(NULL);
return res;
} else {
return meth->execute(state, meth, mod, args);
}
}

Object* CallSite::empty_cache_super(STATE, CallSite* call_site,
Expand Down Expand Up @@ -163,7 +187,15 @@ namespace rubinius {
Executable* meth = dispatch.method;
Module* mod = dispatch.module;

return meth->execute(state, meth, mod, args);
if(meth->custom_call_site_p()) {
CallSiteInformation info(call_site->executable(), call_site->ip());
state->set_call_site_information(&info);
Object* res = meth->execute(state, meth, mod, args);
state->set_call_site_information(NULL);
return res;
} else {
return meth->execute(state, meth, mod, args);
}
}

void CallSite::empty_cache_updater(STATE, CallSite* call_site, Class* klass, Dispatch& dispatch) {
Expand Down

0 comments on commit cfd3f08

Please sign in to comment.