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: 3a4ceac9b5f9
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4c7a3f562425
Choose a head ref
  • 3 commits
  • 5 files changed
  • 1 contributor

Commits on Apr 7, 2016

  1. Copy the full SHA
    8b7326c View commit details
  2. Copy the full SHA
    a7bd4cc View commit details
  3. 4
    Copy the full SHA
    4c7a3f5 View commit details
8 changes: 8 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/core/CoreLibrary.java
Original file line number Diff line number Diff line change
@@ -1381,6 +1381,14 @@ public DynamicObject internalError(String message, Node currentNode) {
return internalError(message, currentNode, null);
}

public DynamicObject internalErrorAssertConstantNotConstant(Node currentNode) {
return internalError("Value in Truffle::Primitive.assert_constant was not constant", currentNode);
}

public DynamicObject internalErrorAssertNotCompiledCompiled(Node currentNode) {
return internalError("Call to Truffle::Primitive.assert_not_compiled was compiled", currentNode);
}

public DynamicObject internalError(String message, Node currentNode, Throwable javaThrowable) {
CompilerAsserts.neverPartOfCompilation();
return ExceptionNodes.createRubyException(context.getCoreLibrary().getRubyTruffleErrorClass(), StringOperations.createString(context, StringOperations.encodeRope("internal implementation error - " + message, UTF8Encoding.INSTANCE)), context.getCallStack().getBacktrace(currentNode, javaThrowable));
Original file line number Diff line number Diff line change
@@ -29,13 +29,15 @@ public AssertConstantNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object assertCompilationConstant(Object value) {
final boolean[] compilationConstant = new boolean[]{CompilerDirectives.isCompilationConstant(value)};
final boolean[] compilationConstant = new boolean[]{ CompilerDirectives.isCompilationConstant(value) };

// If we didn't cause the value to escape, the transfer would float above the isCompilationConstant

sideEffect = compilationConstant;

if (!compilationConstant[0]) {
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new RaiseException(coreLibrary().internalError("Value in Truffle::Primitive.assert_constant was not constant", this));
throw new RaiseException(coreLibrary().internalErrorAssertConstantNotConstant(this));
}

return value;
Original file line number Diff line number Diff line change
@@ -28,13 +28,15 @@ public AssertNotCompiledNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public DynamicObject assertNotCompiled() {
final boolean[] compiled = new boolean[]{CompilerDirectives.inCompiledCode()};
final boolean[] compiled = new boolean[]{ CompilerDirectives.inCompiledCode() };

// If we didn't cause the value to escape, the transfer would float above the isCompilationConstant

sideEffect = compiled;

if (compiled[0]) {
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new RaiseException(coreLibrary().internalError("Call to Truffle::Primitive.assert_not_compiled was compiled", this));
throw new RaiseException(coreLibrary().internalErrorAssertNotCompiledCompiled(this));
}

return nil();
Original file line number Diff line number Diff line change
@@ -45,7 +45,6 @@ public class AttachmentsManager {

private final RubyContext context;
private final LineToProbesMap lineToProbesMap;
private final Map<LineLocation, List<Instrument>> attachments = new HashMap<>();

public AttachmentsManager(RubyContext context) {
this.context = context;
50 changes: 18 additions & 32 deletions truffle/src/main/java/org/jruby/truffle/stdlib/ObjSpaceNodes.java
Original file line number Diff line number Diff line change
@@ -9,7 +9,8 @@
*/
package org.jruby.truffle.stdlib;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;
@@ -33,31 +34,6 @@ public MemsizeOfNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@Specialization(guards = "isNil(nil)")
public int memsizeOf(Object nil) {
return 0;
}

@Specialization
public int memsizeOf(boolean object) {
return 0;
}

@Specialization
public int memsizeOf(int object) {
return 0;
}

@Specialization
public int memsizeOf(long object) {
return 0;
}

@Specialization
public int memsizeOf(double object) {
return 0;
}

@Specialization(guards = "isRubyArray(object)")
public int memsizeOfArray(DynamicObject object) {
return 1 + object.getShape().getPropertyListInternal(false).size() + Layouts.ARRAY.getSize(object);
@@ -78,12 +54,22 @@ public int memsizeOfMatchData(DynamicObject object) {
return 1 + object.getShape().getPropertyListInternal(false).size() + Layouts.MATCH_DATA.getValues(object).length;
}

@Specialization(guards = {"!isNil(object)", "!isRubyArray(object)", "!isRubyHash(object)",
"!isRubyString(object)", "!isRubyMatchData(object)"})
@Specialization(guards = {
"!isNil(object)",
"!isRubyArray(object)",
"!isRubyHash(object)",
"!isRubyString(object)",
"!isRubyMatchData(object)"
})
public int memsizeOfObject(DynamicObject object) {
return 1 + object.getShape().getPropertyListInternal(false).size();
}

@Fallback
public int memsize(Object object) {
return 0;
}

}

@CoreMethod(names = "adjacent_objects", isModuleFunction = true, required = 1)
@@ -93,7 +79,7 @@ public AdjacentObjectsNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
@Specialization
public DynamicObject adjacentObjects(DynamicObject object) {
final Set<DynamicObject> objects = ObjectGraph.getAdjacentObjects(object);
@@ -109,7 +95,7 @@ public RootObjectsNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
@Specialization
public DynamicObject rootObjects() {
final Set<DynamicObject> objects = ObjectGraph.stopAndGetRootObjects(this, getContext());
@@ -125,7 +111,7 @@ public TraceAllocationsStartNode(RubyContext context, SourceSection sourceSectio
super(context, sourceSection);
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
@Specialization
public DynamicObject traceAllocationsStart() {
getContext().getObjectSpaceManager().traceAllocationsStart();
@@ -141,7 +127,7 @@ public TraceAllocationsStopNode(RubyContext context, SourceSection sourceSection
super(context, sourceSection);
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
@Specialization
public DynamicObject traceAllocationsStop() {
getContext().getObjectSpaceManager().traceAllocationsStop();