Skip to content

Commit

Permalink
Showing 4 changed files with 36 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -103,24 +103,13 @@ public CachedBoxedDispatchNode(CachedBoxedDispatchNode prev) {
indirectCallNode = prev.indirectCallNode;
}

@Specialization(guards = "guardName")
@Specialization(guards = {"guardClass", "guardName"})
public Object dispatch(
VirtualFrame frame,
RubyBasicObject receiverObject,
Object methodName,
Object blockObject,
Object argumentsObjects) {
// Check the lookup node is what we expect

if (receiverObject.getMetaClass() != expectedClass) {
return next.executeDispatch(
frame,
receiverObject,
methodName,
CompilerDirectives.unsafeCast(blockObject, RubyProc.class, true, false),
argumentsObjects);
}

// Check the class has not been modified

try {
@@ -170,6 +159,14 @@ public Object dispatch(
}
}

protected final boolean guardClass(
RubyBasicObject receiverObject,
Object methodName,
Object blockObject,
Object argumentsObjects) {
return receiverObject.getMetaClass() == expectedClass;
}

@Fallback
public Object dispatch(
VirtualFrame frame,
Original file line number Diff line number Diff line change
@@ -83,24 +83,13 @@ public CachedBoxedMethodMissingDispatchNode(CachedBoxedMethodMissingDispatchNode
indirectCallNode = prev.indirectCallNode;
}

@Specialization(guards = "guardName")
@Specialization(guards = {"guardClass", "guardName"})
public Object dispatch(
VirtualFrame frame,
RubyBasicObject receiverObject,
Object methodName,
Object blockObject,
Object argumentsObjects) {
// Check the lookup node is what we expect

if (receiverObject.getMetaClass() != expectedClass) {
return next.executeDispatch(
frame,
receiverObject,
methodName,
CompilerDirectives.unsafeCast(blockObject, RubyProc.class, true, false),
argumentsObjects);
}

// Check the class has not been modified

try {
@@ -177,6 +166,14 @@ public Object dispatch(
}
}

protected final boolean guardClass(
RubyBasicObject receiverObject,
Object methodName,
Object blockObject,
Object argumentsObjects) {
return receiverObject.getMetaClass() == expectedClass;
}

@Fallback
public Object dispatch(
VirtualFrame frame,
Original file line number Diff line number Diff line change
@@ -45,24 +45,13 @@ public CachedBoxedReturnMissingDispatchNode(CachedBoxedReturnMissingDispatchNode
unmodifiedAssumption = prev.unmodifiedAssumption;
}

@Specialization(guards = "guardName")
@Specialization(guards = {"guardClass", "guardName"})
public Object dispatch(
VirtualFrame frame,
RubyBasicObject receiverObject,
Object methodName,
Object blockObject,
Object argumentsObjects) {
// Check the lookup node is what we expect

if (receiverObject.getMetaClass() != expectedClass) {
return next.executeDispatch(
frame,
receiverObject,
methodName,
CompilerDirectives.unsafeCast(blockObject, RubyProc.class, true, false),
argumentsObjects);
}

// Check the class has not been modified

try {
@@ -89,6 +78,14 @@ public Object dispatch(
}
}

protected final boolean guardClass(
RubyBasicObject receiverObject,
Object methodName,
Object blockObject,
Object argumentsObjects) {
return receiverObject.getMetaClass() == expectedClass;
}

@Fallback
public Object dispatch(
VirtualFrame frame,
Original file line number Diff line number Diff line change
@@ -69,24 +69,13 @@ public CachedUnboxedDispatchNode(CachedUnboxedDispatchNode prev) {
indirectCallNode = prev.indirectCallNode;
}

@Specialization(guards = {"!isRubyBasicObject", "guardName"})
@Specialization(guards = {"!isRubyBasicObject", "guardClass", "guardName"})
public Object dispatch(
VirtualFrame frame,
Object receiverObject,
Object methodName,
Object blockObject,
Object argumentsObjects) {
// Check the class is what we expect

if (receiverObject.getClass() != expectedClass) {
return next.executeDispatch(
frame,
receiverObject,
methodName,
blockObject,
argumentsObjects);
}

// Check the class has not been modified

try {
@@ -134,6 +123,14 @@ public Object dispatch(
}
}

protected final boolean guardClass(
Object receiverObject,
Object methodName,
Object blockObject,
Object argumentsObjects) {
return receiverObject.getClass() == expectedClass;
}

@Fallback
public Object fallback(
VirtualFrame frame,

0 comments on commit f2b1582

Please sign in to comment.