Skip to content
Permalink
Browse files
Revert "[Truffle] Use declarative guards for checking classes in the …
…IC."

This reverts commit f2b1582.
  • Loading branch information
chrisseaton committed Jan 9, 2015
1 parent 7e01a86 commit bb62232e1d9bf9958bb780ae0425800520cab4a1
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 36 deletions.
@@ -103,13 +103,24 @@ public CachedBoxedDispatchNode(CachedBoxedDispatchNode prev) {
indirectCallNode = prev.indirectCallNode;
}

@Specialization(guards = {"guardClass", "guardName"})
@Specialization(guards = "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 {
@@ -159,14 +170,6 @@ 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,
@@ -83,13 +83,24 @@ public CachedBoxedMethodMissingDispatchNode(CachedBoxedMethodMissingDispatchNode
indirectCallNode = prev.indirectCallNode;
}

@Specialization(guards = {"guardClass", "guardName"})
@Specialization(guards = "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 {
@@ -166,14 +177,6 @@ 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,
@@ -45,13 +45,24 @@ public CachedBoxedReturnMissingDispatchNode(CachedBoxedReturnMissingDispatchNode
unmodifiedAssumption = prev.unmodifiedAssumption;
}

@Specialization(guards = {"guardClass", "guardName"})
@Specialization(guards = "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 {
@@ -78,14 +89,6 @@ 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,
@@ -69,13 +69,24 @@ public CachedUnboxedDispatchNode(CachedUnboxedDispatchNode prev) {
indirectCallNode = prev.indirectCallNode;
}

@Specialization(guards = {"!isRubyBasicObject", "guardClass", "guardName"})
@Specialization(guards = {"!isRubyBasicObject", "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 {
@@ -123,14 +134,6 @@ 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 bb62232

Please sign in to comment.