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: b4675ec121b5
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 807119e1528c
Choose a head ref
  • 2 commits
  • 9 files changed
  • 1 contributor

Commits on Apr 30, 2015

  1. Copy the full SHA
    15bf2b2 View commit details
  2. Copy the full SHA
    807119e View commit details
109 changes: 74 additions & 35 deletions tool/truffle-findbugs-exclude.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FindBugsFilter>

<!-- Let the DSL do whatever it wants -->

<Match>
<Class name="~.*NodeFactory.*" />
</Match>
<Match>
<Class name="org.jruby.truffle.nodes.core.MutexNodes$UnlockNode" />
<Bug pattern="IMSE_DONT_CATCH_IMSE" />
</Match>
<Match>
<Class name="org.jruby.truffle.nodes.rubinius.VMPrimitiveNodes$VMGCStartPrimitiveNode" />
<Bug pattern="DM_GC" />
</Match>

<!-- Sometimes we really do want to exit - but we should rethink for multi-tennant -->

<Match>
<Class name="org.jruby.truffle.nodes.core.KernelNodes$ExecNode" />
<Bug pattern="DM_EXIT" />
@@ -24,55 +22,57 @@
<Bug pattern="DM_EXIT" />
</Match>
<Match>
<Class name="org.jruby.truffle.nodes.core.FixnumNodes$EqualNode" />
<Bug pattern="FE_FLOATING_POINT_EQUALITY" />
</Match>
<Match>
<Class name="org.jruby.truffle.nodes.core.BignumNodes$EqualNode" />
<Bug pattern="FE_FLOATING_POINT_EQUALITY" />
</Match>
<Match>
<Class name="org.jruby.truffle.nodes.core.FloatNodes$EqualNode" />
<Bug pattern="FE_FLOATING_POINT_EQUALITY" />
<Class name="org.jruby.truffle.runtime.subsystems.SimpleShell" />
<Bug pattern="DM_EXIT" />
</Match>
<Match>
<Class name="org.jruby.truffle.translator.BodyTranslator" />
<Class name="org.jruby.truffle.nodes.TopLevelRaiseHandler" />
<Bug pattern="DM_EXIT" />
</Match>

<!-- Sometimes we really do want to run GC -->

<Match>
<Class name="org.jruby.truffle.runtime.core.RubyException" />
<Bug pattern="NM_CLASS_NOT_EXCEPTION" />
<Class name="org.jruby.truffle.nodes.rubinius.VMPrimitiveNodes$VMGCStartPrimitiveNode" />
<Bug pattern="DM_GC" />
</Match>

<!-- Sometimes we really do want to compare floating point equality -->

<Match>
<Class name="org.jruby.truffle.nodes.core.FileNodes$EachLineNode" />
<Bug pattern="OS_OPEN_STREAM" />
<Class name="org.jruby.truffle.nodes.core.FixnumNodes$PowNode" />
<Bug pattern="FE_FLOATING_POINT_EQUALITY" />
</Match>
<Match>
<Class name="~org\.jruby\.truffle\..*" />
<Bug pattern="EI_EXPOSE_REP2" />
<Class name="org.jruby.truffle.nodes.core.FloatNodes$PowNode" />
<Bug pattern="FE_FLOATING_POINT_EQUALITY" />
</Match>
<Match>
<Class name="org.jruby.truffle.nodes.core.KernelNodes$BacktickNode" />
<Bug pattern="OS_OPEN_STREAM" />
<Class name="org.jruby.truffle.runtime.util.ArrayUtils" />
<Bug pattern="FE_FLOATING_POINT_EQUALITY" />
</Match>
<Match>
<Class name="org.jruby.truffle.nodes.core.FixnumNodes$PowNode" />
<Class name="org.jruby.truffle.nodes.core.FixnumNodes$EqualNode" />
<Bug pattern="FE_FLOATING_POINT_EQUALITY" />
</Match>
<Match>
<Class name="org.jruby.truffle.nodes.core.FloatNodes$PowNode" />
<Class name="org.jruby.truffle.nodes.core.BignumNodes$EqualNode" />
<Bug pattern="FE_FLOATING_POINT_EQUALITY" />
</Match>
<Match>
<Class name="org.jruby.truffle.runtime.util.ArrayUtils" />
<Class name="org.jruby.truffle.nodes.core.FloatNodes$EqualNode" />
<Bug pattern="FE_FLOATING_POINT_EQUALITY" />
</Match>

<!-- Stuff where we're genuinely doing something complicated and we do know what we're doing -->

<Match>
<Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON" />
<Class name="org.jruby.truffle.nodes.core.MutexNodes$UnlockNode" />
<Bug pattern="IMSE_DONT_CATCH_IMSE" />
</Match>
<Match>
<Class name="org.jruby.truffle.runtime.subsystems.SimpleShell" />
<Bug pattern="DM_EXIT" />
<Class name="org.jruby.truffle.nodes.core.KernelNodes$BacktickNode" />
<Bug pattern="OS_OPEN_STREAM" />
</Match>
<Match>
<Class name="org.jruby.truffle.nodes.debug.AssertConstantNode" />
@@ -90,12 +90,51 @@
<Class name="org.jruby.truffle.nodes.debug.AssertNotCompiledNode" />
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" />
</Match>
<Match>
<Class name="~org\.jruby\.truffle\.runtime\.DebugOperations.*" />
<Bug pattern="URF_UNREAD_FIELD" />
</Match>

<!-- Stuff we just don't agree with -->

<Match>
<Class name="org.jruby.truffle.runtime.core.RubyException" />
<Bug pattern="NM_CLASS_NOT_EXCEPTION" />
</Match>

<!-- This is just the way the Truffle framework works -->

<Match>
<Class name="~org\.jruby\.truffle\..*" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
<Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON" />
</Match>
<Match>
<Class name="org.jruby.truffle.nodes.RubyCallNode" />
<Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS" />
</Match>

<!-- Risks we're happy with for the sake of performance -->

<Match>
<Class name="~org\.jruby\.truffle\.runtime\.DebugOperations.*" />
<Bug pattern="URF_UNREAD_FIELD" />
<Class name="org.jruby.truffle.pack.runtime.PackResult" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>

<!-- Hacks that should go away at some point -->

<Match>
<Class name="org.jruby.truffle.runtime.RubyContext" />
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" />
</Match>

<!-- These we really should fix sooner rather than later -->

<Match>
<Class name="org.jruby.truffle.translator.BodyTranslator" />
<Bug pattern="DM_EXIT" />
</Match>

</FindBugsFilter>
Original file line number Diff line number Diff line change
@@ -204,9 +204,6 @@ private static RubyRootNode makeGenericMethod(RubyContext context, MethodDetails
}
}

// TODO CS 12 Feb 15 - doesn't work any more I'm afraid as the guards use parameter names now
//verifyNoAmbiguousDefaultArguments(methodDetails);

final CheckArityNode checkArity = new CheckArityNode(context, sourceSection, arity);
RubyNode sequence = SequenceNode.sequence(context, sourceSection, checkArity, methodNode);

@@ -226,50 +223,6 @@ private static RubyRootNode makeGenericMethod(RubyContext context, MethodDetails
return new RubyRootNode(context, sourceSection, null, sharedMethodInfo, exceptionTranslatingNode);
}

private static boolean verifyNoAmbiguousDefaultArguments(MethodDetails methodDetails) {
boolean success = true;

if (methodDetails.getMethodAnnotation().optional() > 0) {
int opt = methodDetails.getMethodAnnotation().optional();
int argc = methodDetails.getNodeFactory().getExecutionSignature().size();
Class<?> node = methodDetails.getNodeFactory().getNodeClass();

boolean undefined = false, object = false;

for (int i = 1; i <= opt; i++) {
for (Method method : node.getDeclaredMethods()) {
if (method.isAnnotationPresent(Specialization.class)) {
// use getParameterTypes().length to ignore optional VirtualFrame in front.
Class<?> c = method.getParameterTypes()[method.getParameterTypes().length - i];
if (c == UndefinedPlaceholder.class) {
undefined |= true;
} else if (c == Object.class) {
String[] guards = method.getAnnotation(Specialization.class).guards();
boolean guarded = false;
for (String guard : guards) {
if (guard.equals("!isUndefinedPlaceholder(arguments[" + (argc - i) + "])")) {
guarded = true;
}
}
object |= (guarded == false);
}
}
}

if (undefined && object) {
success = false;
System.err.println("Ambiguous default argument " + (argc - i) + " in " + node.getCanonicalName());
}
}
}

if (!success) {
throw new RuntimeException("Found ambiguous arguments");
}

return success;
}

public static class MethodDetails {

private final CoreClass classAnnotation;
Original file line number Diff line number Diff line change
@@ -24,16 +24,12 @@
public abstract class TruffleInteropNodes {

@CoreMethod(names = "interop_to_ruby_primitive", isModuleFunction = true, needsSelf = false, required = 1)
public abstract static class InteropToRubyPrimitive extends CoreMethodNode {
public abstract static class InteropToRubyNode extends CoreMethodNode {

public InteropToRubyPrimitive(RubyContext context, SourceSection sourceSection) {
public InteropToRubyNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public InteropToRubyPrimitive(InteropToRubyPrimitive prev) {
this(prev.getContext(), prev.getSourceSection());
}

@Specialization
public int convert(byte value) {
return value;
Original file line number Diff line number Diff line change
@@ -84,7 +84,6 @@ public CachedBoxedDispatchNode(

if ((callNode.isCallTargetCloningAllowed() && method.getSharedMethodInfo().shouldAlwaysSplit())
|| (method.getDeclaringModule() != null
&& method.getDeclaringModule().getName() != null
&& method.getDeclaringModule().getName().equals("TruffleInterop"))) {
insert(callNode);
callNode.cloneCallTarget();
Original file line number Diff line number Diff line change
@@ -29,14 +29,8 @@
})
public abstract class ReadDoubleNode extends PackNode {

private final RubyContext context;

@Child private ToDoubleNode toDoubleNode;

public ReadDoubleNode(RubyContext context) {
this.context = context;
}

@Specialization(guards = "isNull(source)")
public double read(VirtualFrame frame, Object source) {
CompilerDirectives.transferToInterpreter();
Original file line number Diff line number Diff line change
@@ -99,9 +99,6 @@ public Object write(VirtualFrame frame, ByteList bytes) {

if ((lengthToUse & 1) != 0) {
writeBytes(frame, (byte) (currentByte & 0xff));
if(padLength > 0) {
padLength--;
}
}

return null;
Original file line number Diff line number Diff line change
@@ -124,6 +124,8 @@ public PackNode parse(PackTokenizer tokenizer, boolean inParens) {
size = 64;
signedness = Signedness.SIGNED;
break;
default:
break;
}

if (tokenizer.peek('_') || tokenizer.peek('!')) {
@@ -214,6 +216,8 @@ public PackNode parse(PackTokenizer tokenizer, boolean inParens) {
case 'a':
padOnNull = false;
break;
default:
break;
}
} else {
takeAll = false;
@@ -354,36 +358,36 @@ public PackNode parse(PackTokenizer tokenizer, boolean inParens) {
case 'd':
node = writeInteger(64, Signedness.UNSIGNED, nativeEndianness(),
AsLongNodeGen.create(
ReadDoubleNodeGen.create(context, new SourceNode())));
ReadDoubleNodeGen.create(new SourceNode())));
break;
case 'F':
case 'f':
node = writeInteger(32, Signedness.UNSIGNED, nativeEndianness(),
AsLongNodeGen.create(
AsSinglePrecisionNodeGen.create(
ReadDoubleNodeGen.create(context, new SourceNode()))));
ReadDoubleNodeGen.create(new SourceNode()))));
break;
case 'E':
node = writeInteger(64, Signedness.UNSIGNED, Endianness.LITTLE,
AsLongNodeGen.create(
ReadDoubleNodeGen.create(context, new SourceNode())));
ReadDoubleNodeGen.create(new SourceNode())));
break;
case 'e':
node = writeInteger(32, Signedness.UNSIGNED, Endianness.LITTLE,
AsLongNodeGen.create(
AsSinglePrecisionNodeGen.create(
ReadDoubleNodeGen.create(context, new SourceNode()))));
ReadDoubleNodeGen.create(new SourceNode()))));
break;
case 'G':
node = writeInteger(64, Signedness.UNSIGNED, Endianness.BIG,
AsLongNodeGen.create(
ReadDoubleNodeGen.create(context, new SourceNode())));
ReadDoubleNodeGen.create(new SourceNode())));
break;
case 'g':
node = writeInteger(32, Signedness.UNSIGNED, Endianness.BIG,
AsLongNodeGen.create(
AsSinglePrecisionNodeGen.create(
ReadDoubleNodeGen.create(context, new SourceNode()))));
ReadDoubleNodeGen.create(new SourceNode()))));
break;
case 'P':
case 'p':
Original file line number Diff line number Diff line change
@@ -15,12 +15,12 @@

public class PackFrameDescriptor {

public static FrameDescriptor FRAME_DESCRIPTOR = new FrameDescriptor();
public static FrameSlot SOURCE_SLOT = FRAME_DESCRIPTOR.addFrameSlot("source", FrameSlotKind.Object);
public static FrameSlot SOURCE_LENGTH_SLOT = FRAME_DESCRIPTOR.addFrameSlot("source-length", FrameSlotKind.Int);
public static FrameSlot SOURCE_POSITION_SLOT = FRAME_DESCRIPTOR.addFrameSlot("source-position", FrameSlotKind.Int);
public static FrameSlot OUTPUT_SLOT = FRAME_DESCRIPTOR.addFrameSlot("output", FrameSlotKind.Object);
public static FrameSlot OUTPUT_POSITION_SLOT = FRAME_DESCRIPTOR.addFrameSlot("output-position", FrameSlotKind.Int);
public static FrameSlot TAINT_SLOT = FRAME_DESCRIPTOR.addFrameSlot("taint", FrameSlotKind.Boolean);
public static final FrameDescriptor FRAME_DESCRIPTOR = new FrameDescriptor();
public static final FrameSlot SOURCE_SLOT = FRAME_DESCRIPTOR.addFrameSlot("source", FrameSlotKind.Object);
public static final FrameSlot SOURCE_LENGTH_SLOT = FRAME_DESCRIPTOR.addFrameSlot("source-length", FrameSlotKind.Int);
public static final FrameSlot SOURCE_POSITION_SLOT = FRAME_DESCRIPTOR.addFrameSlot("source-position", FrameSlotKind.Int);
public static final FrameSlot OUTPUT_SLOT = FRAME_DESCRIPTOR.addFrameSlot("output", FrameSlotKind.Object);
public static final FrameSlot OUTPUT_POSITION_SLOT = FRAME_DESCRIPTOR.addFrameSlot("output-position", FrameSlotKind.Int);
public static final FrameSlot TAINT_SLOT = FRAME_DESCRIPTOR.addFrameSlot("taint", FrameSlotKind.Boolean);

}
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ public class RaiseException extends RuntimeException {

// TODO CS 1-Mar-15 shouldn't this be a ControlFlowException?

private transient final RubyException rubyException;
private final RubyException rubyException;

public RaiseException(RubyException rubyException) {
this.rubyException = rubyException;