Skip to content

Commit

Permalink
[Truffle] Do not try to know the caller class if we ignore the visibi…
Browse files Browse the repository at this point in the history
…lity.

* Ideally visbility checking and lookup should be separated.
  • Loading branch information
eregon committed Oct 29, 2014
1 parent 2c10c1e commit bc642f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -65,7 +65,7 @@ public Object dispatchReadConstant(
return constant.getValue();
}

final RubyClass callerClass = box.box(RubyArguments.getSelf(frame.getArguments())).getMetaClass();
final RubyClass callerClass = ignoreVisibility ? null : box.box(RubyArguments.getSelf(frame.getArguments())).getMetaClass();

final RubyMethod missingMethod = lookup(callerClass, receiverObject, "const_missing", ignoreVisibility,
dispatchAction);
Expand Down Expand Up @@ -111,7 +111,7 @@ public Object dispatch(
// Need to be much more fine grained with TruffleBoundary here
CompilerDirectives.transferToInterpreter();

final RubyClass callerClass = box.box(RubyArguments.getSelf(frame.getArguments())).getMetaClass();
final RubyClass callerClass = ignoreVisibility ? null : box.box(RubyArguments.getSelf(frame.getArguments())).getMetaClass();

final RubyMethod method = lookup(callerClass, receiverObject, methodName.toString(),
ignoreVisibility, dispatchAction);
Expand Down
Expand Up @@ -92,7 +92,7 @@ private Object doUnboxedObject(
Dispatch.DispatchAction dispatchAction,
Object methodReceiverObject) {
final RubyBasicObject boxedReceiverObject = getContext().getCoreLibrary().box(receiverObject);
final RubyClass callerClass = getContext().getCoreLibrary().box(RubyArguments.getSelf(frame.getArguments())).getMetaClass();
final RubyClass callerClass = ignoreVisibility ? null : getContext().getCoreLibrary().box(RubyArguments.getSelf(frame.getArguments())).getMetaClass();

if (dispatchAction == Dispatch.DispatchAction.CALL_METHOD || dispatchAction == Dispatch.DispatchAction.RESPOND_TO_METHOD) {
final RubyMethod method = lookup(callerClass, boxedReceiverObject, methodName.toString(), ignoreVisibility,
Expand Down Expand Up @@ -164,7 +164,7 @@ private Object doRubyBasicObject(
Dispatch.DispatchAction dispatchAction,
Object methodReceiverObject) {
final RubyBasicObject boxedReceiverObject = getContext().getCoreLibrary().box(receiverObject);
final RubyClass callerClass = getContext().getCoreLibrary().box(RubyArguments.getSelf(frame.getArguments())).getMetaClass();
final RubyClass callerClass = ignoreVisibility ? null : getContext().getCoreLibrary().box(RubyArguments.getSelf(frame.getArguments())).getMetaClass();

if (dispatchAction == Dispatch.DispatchAction.CALL_METHOD || dispatchAction == Dispatch.DispatchAction.RESPOND_TO_METHOD) {
final RubyMethod method = lookup(callerClass, boxedReceiverObject, methodName.toString(), ignoreVisibility,
Expand Down

0 comments on commit bc642f4

Please sign in to comment.