Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7d6a4e1170a2
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: feee7af6e194
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Aug 26, 2015

  1. [Truffle] Fix typo.

    eregon committed Aug 26, 2015
    Copy the full SHA
    58a42b2 View commit details
  2. Copy the full SHA
    feee7af View commit details
Original file line number Diff line number Diff line change
@@ -16,6 +16,8 @@
import com.oracle.truffle.api.nodes.IndirectCallNode;
import com.oracle.truffle.api.nodes.InvalidAssumptionException;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.object.Shape;

import org.jruby.truffle.nodes.RubyGuards;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
@@ -24,7 +26,7 @@

public class CachedBoxedDispatchNode extends CachedDispatchNode {

private final DynamicObject expectedClass;
private final Shape expectedShape;
private final Assumption unmodifiedAssumption;

private final InternalMethod method;
@@ -35,6 +37,7 @@ public CachedBoxedDispatchNode(
RubyContext context,
Object cachedName,
DispatchNode next,
Shape expectedShape,
DynamicObject expectedClass,
InternalMethod method,
boolean indirect,
@@ -43,7 +46,7 @@ public CachedBoxedDispatchNode(

assert RubyGuards.isRubyClass(expectedClass);

this.expectedClass = expectedClass;
this.expectedShape = expectedShape;
this.unmodifiedAssumption = Layouts.MODULE.getFields(expectedClass).getUnmodifiedAssumption();
this.next = next;
this.method = method;
@@ -68,7 +71,7 @@ public CachedBoxedDispatchNode(
public boolean guard(Object methodName, Object receiver) {
return guardName(methodName) &&
(receiver instanceof DynamicObject) &&
Layouts.BASIC_OBJECT.getMetaClass(((DynamicObject) receiver)) == expectedClass;
((DynamicObject) receiver).getShape() == expectedShape;
}

@Override
@@ -137,7 +140,7 @@ public Object executeDispatch(
public String toString() {
return String.format("CachedBoxedDispatchNode(:%s, %s@%x, %s)",
getCachedNameAsSymbol().toString(),
Layouts.MODULE.getFields(expectedClass).getName(), expectedClass.hashCode(),
expectedShape, expectedShape.hashCode(),
method == null ? "null" : method.toString());
}

Original file line number Diff line number Diff line change
@@ -197,7 +197,7 @@ private DispatchNode doDynamicObject(
if (RubyGuards.isRubySymbol(receiverObject)) {
return new CachedBoxedSymbolDispatchNode(getContext(), methodName, first, method, indirect, getDispatchAction());
} else {
return new CachedBoxedDispatchNode(getContext(), methodName, first,
return new CachedBoxedDispatchNode(getContext(), methodName, first, ((DynamicObject) receiverObject).getShape(),
getContext().getCoreLibrary().getMetaClass(receiverObject), method, indirect, getDispatchAction());
}
}
Original file line number Diff line number Diff line change
@@ -174,7 +174,7 @@
* indirection so you may want to cache the result (against the shape).
*
* You can also use the getter and setter against the {@code DynamicObjectFactory} that
* {@code createFooShape} returns, with the setter reutrning a new factory. This allows
* {@code createFooShape} returns, with the setter returning a new factory. This allows
* objects to be created with modified shape properties, and is much more efficient than
* using the instance setter after creating the object.
*