Mercurial > hg > graal-compiler
changeset 4618:d8e84cf186a4
Merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Thu, 16 Feb 2012 14:53:04 +0100 |
parents | 113d66f7454d (current diff) 6a44a26ed9e6 (diff) |
children | a09b44a28e7f |
files | graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Node.java graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java |
diffstat | 696 files changed, 47186 insertions(+), 356 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiResolvedMethod.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiResolvedMethod.java Thu Feb 16 14:53:04 2012 +0100 @@ -55,6 +55,12 @@ int compiledCodeSize(); /** + * Gets an estimate how complex it is to compile this method. + * @return A value >= 0, where higher means more complex. + */ + int compilationComplexity(); + + /** * Gets the symbol used to link this method if it is native, otherwise {@code null}. */ String jniSymbol();
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java Thu Feb 16 14:53:04 2012 +0100 @@ -163,7 +163,9 @@ if (GraalOptions.EscapeAnalysis && !plan.isPhaseDisabled(EscapeAnalysisPhase.class)) { new EscapeAnalysisPhase(target, runtime, assumptions, plan).apply(graph); new PhiStampPhase().apply(graph); - new CanonicalizerPhase(target, runtime, assumptions).apply(graph); + if (GraalOptions.OptCanonicalizer) { + new CanonicalizerPhase(target, runtime, assumptions).apply(graph); + } } if (GraalOptions.OptGVN) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Thu Feb 16 14:53:04 2012 +0100 @@ -45,23 +45,25 @@ public static boolean InlineMonomorphicCalls = true; public static boolean InlinePolymorphicCalls = true; public static boolean InlineMegamorphicCalls = true; - public static int InliningPolicy = 0; + public static int InliningPolicy = 4; + public static int WeightComputationPolicy = 2; public static int MaximumTrivialSize = 6; public static int MaximumInlineLevel = 30; public static int MaximumDesiredSize = 6000; public static int MaximumRecursiveInlining = 1; + public static int SmallCompiledCodeSize = 1500; // WeightBasedInliningPolicy (0) public static boolean ParseBeforeInlining = ____; public static float InliningSizePenaltyExp = 20; public static float MaximumInlineWeight = 1.25f; public static float InliningSizePenalty = 1; - // StaticSizeBasedInliningPolicy (1), DynamicSizeBasedInliningPolicy (2), GreedySizeBasedInlining (3) + // StaticSizeBasedInliningPolicy (1), MinimumCodeSizeBasedInlining (2), + // DynamicSizeBasedInliningPolicy (3), GreedySizeBasedInlining (3) public static int MaximumInlineSize = 35; public static float NestedInliningSizeRatio = 0.9f; public static float BoostInliningForEscapeAnalysis = 2f; + public static int MaximumGreedyInlineSize = 250; public static float ProbabilityCapForInlining = 1f; - public static int MaximumGreedyInlineSize = 250; - public static int SmallCompiledCodeSize = 1500; // escape analysis settings public static boolean EscapeAnalysis = true;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Thu Feb 16 14:53:04 2012 +0100 @@ -53,11 +53,13 @@ private CiAssumptions assumptions; private final PhasePlan plan; + private final WeightComputationPolicy weightComputationPolicy; private final InliningPolicy inliningPolicy; // Metrics private static final DebugMetric metricInliningPerformed = Debug.metric("InliningPerformed"); private static final DebugMetric metricInliningConsidered = Debug.metric("InliningConsidered"); + private static final DebugMetric metricInliningStoppedByMaxDesiredSize = Debug.metric("InliningStoppedByMaxDesiredSize"); public InliningPhase(CiTarget target, GraalRuntime runtime, Collection<? extends Invoke> hints, CiAssumptions assumptions, PhasePlan plan) { this.target = target; @@ -65,6 +67,7 @@ this.hints = hints; this.assumptions = assumptions; this.plan = plan; + this.weightComputationPolicy = createWeightComputationPolicy(); this.inliningPolicy = createInliningPolicy(); } @@ -114,6 +117,10 @@ } } } + + if (GraalOptions.Debug && graph.getNodeCount() >= GraalOptions.MaximumDesiredSize) { + metricInliningStoppedByMaxDesiredSize.increment(); + } } private void scanInvokes(Iterable<? extends Node> newNodes, int level, StructuredGraph graph) { @@ -154,14 +161,16 @@ new DeadCodeEliminationPhase().apply(newGraph); new ComputeProbabilityPhase().apply(newGraph); } - new CanonicalizerPhase(target, runtime, assumptions).apply(newGraph); + if (GraalOptions.OptCanonicalizer) { + new CanonicalizerPhase(target, runtime, assumptions).apply(newGraph); + } return newGraph; } @Override public double inliningWeight(RiResolvedMethod caller, RiResolvedMethod method, Invoke invoke) { boolean preferred = hints != null && hints.contains(invoke); - return inliningPolicy.computeWeight(caller, method, invoke, preferred); + return weightComputationPolicy.computeWeight(caller, method, invoke, preferred); } public static int graphComplexity(StructuredGraph graph) { @@ -198,7 +207,7 @@ return count - 1; } - private InliningPolicy createInliningPolicy() { + private static InliningPolicy createInliningPolicy() { switch(GraalOptions.InliningPolicy) { case 0: return new WeightBasedInliningPolicy(); case 1: return new C1StaticSizeBasedInliningPolicy(); @@ -211,12 +220,96 @@ } } + private WeightComputationPolicy createWeightComputationPolicy() { + switch(GraalOptions.WeightComputationPolicy) { + case 0: return new ExecutionCountBasedWeightComputationPolicy(); + case 1: return new BytecodeSizeBasedWeightComputationPolicy(); + case 2: return new ComplexityBasedWeightComputationPolicy(); + default: + GraalInternalError.shouldNotReachHere(); + return null; + } + } + private interface InliningPolicy { - double computeWeight(RiResolvedMethod caller, RiResolvedMethod method, Invoke invoke, boolean preferredInvoke); boolean isWorthInlining(StructuredGraph callerGraph, InlineInfo info); } - private class WeightBasedInliningPolicy implements InliningPolicy { + private static class WeightBasedInliningPolicy implements InliningPolicy { + @Override + public boolean isWorthInlining(StructuredGraph callerGraph, InlineInfo info) { + if (GraalOptions.SmallCompiledCodeSize >= 0 && info.compiledCodeSize() > GraalOptions.SmallCompiledCodeSize) { + return false; + } + + double penalty = Math.pow(GraalOptions.InliningSizePenaltyExp, callerGraph.getNodeCount() / (double) GraalOptions.MaximumDesiredSize) / GraalOptions.InliningSizePenaltyExp; + if (info.weight > GraalOptions.MaximumInlineWeight / (1 + penalty * GraalOptions.InliningSizePenalty)) { + Debug.log("not inlining (cut off by weight): %e", info.weight); + return false; + } + return true; + } + } + + private static class C1StaticSizeBasedInliningPolicy implements InliningPolicy { + @Override + public boolean isWorthInlining(StructuredGraph callerGraph, InlineInfo info) { + double maxSize = Math.max(GraalOptions.MaximumTrivialSize, Math.pow(GraalOptions.NestedInliningSizeRatio, info.level) * GraalOptions.MaximumInlineSize); + return info.weight <= maxSize; + } + } + + private static class MinimumCodeSizeBasedInliningPolicy implements InliningPolicy { + @Override + public boolean isWorthInlining(StructuredGraph callerGraph, InlineInfo info) { + assert GraalOptions.ProbabilityAnalysis; + if (GraalOptions.SmallCompiledCodeSize >= 0 && info.compiledCodeSize() > GraalOptions.SmallCompiledCodeSize) { + return false; + } + + double inlineWeight = Math.min(GraalOptions.ProbabilityCapForInlining, info.invoke.probability()); + double maxSize = Math.pow(GraalOptions.NestedInliningSizeRatio, info.level) * GraalOptions.MaximumInlineSize * inlineWeight; + maxSize = Math.max(GraalOptions.MaximumTrivialSize, maxSize); + return info.weight <= maxSize; + } + } + + private static class DynamicSizeBasedInliningPolicy implements InliningPolicy { + @Override + public boolean isWorthInlining(StructuredGraph callerGraph, InlineInfo info) { + assert GraalOptions.ProbabilityAnalysis; + if (GraalOptions.SmallCompiledCodeSize >= 0 && info.compiledCodeSize() > GraalOptions.SmallCompiledCodeSize) { + return false; + } + + double inlineBoost = Math.min(GraalOptions.ProbabilityCapForInlining, info.invoke.probability()) + Math.log10(Math.max(1, info.invoke.probability() - GraalOptions.ProbabilityCapForInlining + 1)); + double maxSize = Math.pow(GraalOptions.NestedInliningSizeRatio, info.level) * GraalOptions.MaximumInlineSize; + maxSize = maxSize + maxSize * inlineBoost; + maxSize = Math.min(GraalOptions.MaximumGreedyInlineSize, Math.max(GraalOptions.MaximumTrivialSize, maxSize)); + return info.weight <= maxSize; + } + } + + private static class GreedySizeBasedInliningPolicy implements InliningPolicy { + @Override + public boolean isWorthInlining(StructuredGraph callerGraph, InlineInfo info) { + assert GraalOptions.ProbabilityAnalysis; + if (GraalOptions.SmallCompiledCodeSize >= 0 && info.compiledCodeSize() > GraalOptions.SmallCompiledCodeSize) { + return false; + } + + double inlineRatio = Math.min(GraalOptions.ProbabilityCapForInlining, info.invoke.probability()); + double maxSize = Math.pow(GraalOptions.NestedInliningSizeRatio, info.level) * GraalOptions.MaximumGreedyInlineSize * inlineRatio; + maxSize = Math.max(maxSize, GraalOptions.MaximumInlineSize); + return info.weight <= maxSize; + } + } + + private interface WeightComputationPolicy { + double computeWeight(RiResolvedMethod caller, RiResolvedMethod method, Invoke invoke, boolean preferredInvoke); + } + + private class ExecutionCountBasedWeightComputationPolicy implements WeightComputationPolicy { @Override public double computeWeight(RiResolvedMethod caller, RiResolvedMethod method, Invoke invoke, boolean preferredInvoke) { double ratio; @@ -261,7 +354,9 @@ if (plan != null) { plan.runPhases(PhasePosition.AFTER_PARSING, newGraph); } - new CanonicalizerPhase(target, runtime, assumptions).apply(newGraph); + if (GraalOptions.OptCanonicalizer) { + new CanonicalizerPhase(target, runtime, assumptions).apply(newGraph); + } count = graphComplexity(newGraph); parsedMethods.put(method, count); } else { @@ -273,36 +368,9 @@ return count / normalSize; } - - @Override - public boolean isWorthInlining(StructuredGraph callerGraph, InlineInfo info) { - double penalty = Math.pow(GraalOptions.InliningSizePenaltyExp, callerGraph.getNodeCount() / (double) GraalOptions.MaximumDesiredSize) / GraalOptions.InliningSizePenaltyExp; - if (info.weight > GraalOptions.MaximumInlineWeight / (1 + penalty * GraalOptions.InliningSizePenalty)) { - Debug.log("not inlining (cut off by weight): %e", info.weight); - return false; - } - return true; - } } - private class C1StaticSizeBasedInliningPolicy implements InliningPolicy { - @Override - public double computeWeight(RiResolvedMethod caller, RiResolvedMethod method, Invoke invoke, boolean preferredInvoke) { - double codeSize = method.codeSize(); - if (preferredInvoke) { - codeSize = codeSize / GraalOptions.BoostInliningForEscapeAnalysis; - } - return codeSize; - } - - @Override - public boolean isWorthInlining(StructuredGraph callerGraph, InlineInfo info) { - double maxSize = Math.max(GraalOptions.MaximumTrivialSize, Math.pow(GraalOptions.NestedInliningSizeRatio, info.level) * GraalOptions.MaximumInlineSize); - return info.weight <= maxSize; - } - } - - private class MinimumCodeSizeBasedInliningPolicy implements InliningPolicy { + private static class BytecodeSizeBasedWeightComputationPolicy implements WeightComputationPolicy { @Override public double computeWeight(RiResolvedMethod caller, RiResolvedMethod method, Invoke invoke, boolean preferredInvoke) { double codeSize = method.codeSize(); @@ -311,64 +379,16 @@ } return codeSize; } - - @Override - public boolean isWorthInlining(StructuredGraph callerGraph, InlineInfo info) { - assert GraalOptions.ProbabilityAnalysis; - if (info.compiledCodeSize() <= GraalOptions.SmallCompiledCodeSize) { - double inlineWeight = Math.min(GraalOptions.ProbabilityCapForInlining, info.invoke.probability()); - double maxSize = Math.pow(GraalOptions.NestedInliningSizeRatio, info.level) * GraalOptions.MaximumInlineSize * inlineWeight; - maxSize = Math.max(GraalOptions.MaximumTrivialSize, maxSize); - return info.weight <= maxSize; - } - return false; - } } - private class DynamicSizeBasedInliningPolicy implements InliningPolicy { + private static class ComplexityBasedWeightComputationPolicy implements WeightComputationPolicy { @Override public double computeWeight(RiResolvedMethod caller, RiResolvedMethod method, Invoke invoke, boolean preferredInvoke) { - double codeSize = method.codeSize(); + double complexity = method.compilationComplexity(); if (preferredInvoke) { - codeSize = codeSize / GraalOptions.BoostInliningForEscapeAnalysis; - } - return codeSize; - } - - @Override - public boolean isWorthInlining(StructuredGraph callerGraph, InlineInfo info) { - assert GraalOptions.ProbabilityAnalysis; - if (info.compiledCodeSize() <= GraalOptions.SmallCompiledCodeSize) { - double inlineBoost = Math.min(GraalOptions.ProbabilityCapForInlining, info.invoke.probability()); - double maxSize = Math.pow(GraalOptions.NestedInliningSizeRatio, info.level) * GraalOptions.MaximumInlineSize; - maxSize = maxSize + maxSize * inlineBoost; - maxSize = Math.max(GraalOptions.MaximumTrivialSize, maxSize); - return info.weight <= maxSize; + complexity = complexity / GraalOptions.BoostInliningForEscapeAnalysis; } - return false; - } - } - - private class GreedySizeBasedInliningPolicy implements InliningPolicy { - @Override - public double computeWeight(RiResolvedMethod caller, RiResolvedMethod method, Invoke invoke, boolean preferredInvoke) { - double codeSize = method.codeSize(); - if (preferredInvoke) { - codeSize = codeSize / GraalOptions.BoostInliningForEscapeAnalysis; - } - return codeSize; - } - - @Override - public boolean isWorthInlining(StructuredGraph callerGraph, InlineInfo info) { - assert GraalOptions.ProbabilityAnalysis; - if (info.compiledCodeSize() <= GraalOptions.SmallCompiledCodeSize) { - double inlineRatio = Math.min(GraalOptions.ProbabilityCapForInlining, info.invoke.probability()); - double maxSize = Math.pow(GraalOptions.NestedInliningSizeRatio, info.level) * GraalOptions.MaximumGreedyInlineSize * inlineRatio; - maxSize = Math.max(maxSize, GraalOptions.MaximumInlineSize); - return info.weight <= maxSize; - } - return false; + return complexity; } } }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/IntrinsificationPhase.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/IntrinsificationPhase.java Thu Feb 16 14:53:04 2012 +0100 @@ -47,22 +47,31 @@ } } - public static void tryIntrinsify(Invoke invoke, GraalRuntime runtime) { + public static boolean canIntrinsify(Invoke invoke, RiResolvedMethod target, GraalRuntime runtime) { + return getIntrinsicGraph(invoke, target, runtime) != null; + } + + private static void tryIntrinsify(Invoke invoke, GraalRuntime runtime) { RiResolvedMethod target = invoke.callTarget().targetMethod(); if (target != null) { tryIntrinsify(invoke, target, runtime); } } - public static void tryIntrinsify(Invoke invoke, RiResolvedMethod target, GraalRuntime runtime) { + private static void tryIntrinsify(Invoke invoke, RiResolvedMethod target, GraalRuntime runtime) { + StructuredGraph intrinsicGraph = getIntrinsicGraph(invoke, target, runtime); + if (intrinsicGraph != null) { + Debug.log(" > Intrinsify %s", target); + InliningUtil.inline(invoke, intrinsicGraph, true); + } + } + + private static StructuredGraph getIntrinsicGraph(Invoke invoke, RiResolvedMethod target, GraalRuntime runtime) { StructuredGraph intrinsicGraph = (StructuredGraph) target.compilerStorage().get(Graph.class); if (intrinsicGraph == null) { // TODO (ph) remove once all intrinsics are available via RiMethod intrinsicGraph = runtime.intrinsicGraph(invoke.stateAfter().method(), invoke.bci(), target, invoke.callTarget().arguments()); } - if (intrinsicGraph != null) { - Debug.log(" > Intrinsify %s", target); - InliningUtil.inline(invoke, intrinsicGraph, true); - } + return intrinsicGraph; } }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java Thu Feb 16 14:53:04 2012 +0100 @@ -29,6 +29,7 @@ import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ri.*; import com.oracle.max.graal.compiler.*; +import com.oracle.max.graal.compiler.phases.*; import com.oracle.max.graal.cri.*; import com.oracle.max.graal.debug.*; import com.oracle.max.graal.graph.*; @@ -126,6 +127,7 @@ @Override public void inline(StructuredGraph compilerGraph, GraalRuntime runtime, final InliningCallback callback) { StructuredGraph graph = getGraph(concrete, callback); + assert !IntrinsificationPhase.canIntrinsify(invoke, concrete, runtime); InliningUtil.inline(invoke, graph, true); } @@ -179,6 +181,7 @@ Debug.log("inlining 1 method using 1 type check"); StructuredGraph calleeGraph = getGraph(concrete, callback); + assert !IntrinsificationPhase.canIntrinsify(invoke, concrete, runtime); InliningUtil.inline(invoke, calleeGraph, false); } @@ -234,9 +237,9 @@ // receiver null check must be the first node InliningUtil.receiverNullCheck(invoke); if (numberOfMethods > 1 || shouldFallbackToInvoke()) { - inlineMultipleMethods(graph, callback, numberOfMethods, hasReturnValue); + inlineMultipleMethods(graph, runtime, callback, numberOfMethods, hasReturnValue); } else { - inlineSingleMethod(graph, callback); + inlineSingleMethod(graph, runtime, callback); } Debug.log("inlining %d methods with %d type checks and falling back to %s if violated", numberOfMethods, types.length, shouldFallbackToInvoke() ? "invocation" : "deoptimization"); @@ -246,7 +249,7 @@ return notRecordedTypeProbability > 0; } - private void inlineMultipleMethods(StructuredGraph graph, InliningCallback callback, int numberOfMethods, boolean hasReturnValue) { + private void inlineMultipleMethods(StructuredGraph graph, GraalRuntime runtime, InliningCallback callback, int numberOfMethods, boolean hasReturnValue) { FixedNode continuation = invoke.next(); // setup merge and phi nodes for results and exceptions @@ -315,12 +318,14 @@ for (int i = 0; i < calleeEntryNodes.length; i++) { BeginNode node = calleeEntryNodes[i]; Invoke invokeForInlining = (Invoke) node.next(); - StructuredGraph calleeGraph = getGraph(concretes.get(i), callback); + RiResolvedMethod concrete = concretes.get(i); + StructuredGraph calleeGraph = getGraph(concrete, callback); + assert !IntrinsificationPhase.canIntrinsify(invokeForInlining, concrete, runtime); InliningUtil.inline(invokeForInlining, calleeGraph, false); } } - private void inlineSingleMethod(StructuredGraph graph, InliningCallback callback) { + private void inlineSingleMethod(StructuredGraph graph, GraalRuntime runtime, InliningCallback callback) { assert concretes.size() == 1 && types.length > 1 && !shouldFallbackToInvoke() && notRecordedTypeProbability == 0; MergeNode calleeEntryNode = graph.add(new MergeNode()); @@ -335,7 +340,9 @@ pred.setNext(dispatchOnType); calleeEntryNode.setNext(invoke.node()); - StructuredGraph calleeGraph = getGraph(concretes.get(0), callback); + RiResolvedMethod concrete = concretes.get(0); + StructuredGraph calleeGraph = getGraph(concrete, callback); + assert !IntrinsificationPhase.canIntrinsify(invoke, concrete, runtime); InliningUtil.inline(invoke, calleeGraph, false); }
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Node.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Node.java Thu Feb 16 14:53:04 2012 +0100 @@ -120,7 +120,7 @@ nodeClass = NodeClass.get(getClass()); } - int id() { + protected int id() { return id; }
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotMethodResolvedImpl.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotMethodResolvedImpl.java Thu Feb 16 14:53:04 2012 +0100 @@ -30,6 +30,7 @@ import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ri.*; import com.oracle.max.criutils.*; +import com.oracle.max.graal.java.*; /** * Implementation of RiMethod for resolved HotSpot methods. @@ -59,6 +60,7 @@ private byte[] code; private boolean canBeInlined; private CiGenericCallback callback; + private int compilationComplexity; private HotSpotMethodResolvedImpl() { super(null); @@ -198,6 +200,22 @@ } @Override + public int compilationComplexity() { + if (compilationComplexity <= 0 && codeSize() > 0) { + BytecodeStream s = new BytecodeStream(code()); + int result = 0; + int currentBC; + while ((currentBC = s.currentBC()) != Bytecodes.END) { + result += Bytecodes.compilationComplexity(currentBC); + s.next(); + } + assert result > 0; + compilationComplexity = result; + } + return compilationComplexity; + } + + @Override public RiProfilingInfo profilingInfo() { if (methodData == null) { methodData = compiler.getVMEntries().RiMethod_methodData(this); @@ -266,8 +284,6 @@ } } - - @Override public Annotation[][] getParameterAnnotations() { if (isConstructor()) {
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/snippets/IntrinsifyArrayCopyPhase.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/snippets/IntrinsifyArrayCopyPhase.java Thu Feb 16 14:53:04 2012 +0100 @@ -26,6 +26,7 @@ import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ri.*; +import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.phases.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.cri.*; @@ -122,7 +123,7 @@ InliningUtil.inline(methodCallTarget.invoke(), snippetGraph, false); } } - if (hits) { + if (GraalOptions.OptCanonicalizer && hits) { new CanonicalizerPhase(null, runtime, null).apply(graph); } }
--- a/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/Bytecodes.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/Bytecodes.java Thu Feb 16 14:53:04 2012 +0100 @@ -342,226 +342,231 @@ } /** - * A array that maps from a bytecode value to a {@link String} for the corresponding instruction mnemonic. + * An array that maps from a bytecode value to a {@link String} for the corresponding instruction mnemonic. * This will include the root instruction for the three-byte extended instructions. */ private static final String[] nameArray = new String[256]; /** - * A array that maps from a bytecode value to the set of {@link Flags} for the corresponding instruction. + * An array that maps from a bytecode value to the set of {@link Flags} for the corresponding instruction. */ private static final int[] flagsArray = new int[256]; /** - * A array that maps from a bytecode value to the length in bytes for the corresponding instruction. + * An array that maps from a bytecode value to the length in bytes for the corresponding instruction. */ private static final int[] lengthArray = new int[256]; + /** + * An array that maps from a bytecode value to the estimated complexity of the bytecode in terms of generated machine code. + */ + private static final int[] compilationComplexityArray = new int[256]; + // Checkstyle: stop static { - def(NOP , "nop" , "b" ); - def(ACONST_NULL , "aconst_null" , "b" ); - def(ICONST_M1 , "iconst_m1" , "b" ); - def(ICONST_0 , "iconst_0" , "b" ); - def(ICONST_1 , "iconst_1" , "b" ); - def(ICONST_2 , "iconst_2" , "b" ); - def(ICONST_3 , "iconst_3" , "b" ); - def(ICONST_4 , "iconst_4" , "b" ); - def(ICONST_5 , "iconst_5" , "b" ); - def(LCONST_0 , "lconst_0" , "b" ); - def(LCONST_1 , "lconst_1" , "b" ); - def(FCONST_0 , "fconst_0" , "b" ); - def(FCONST_1 , "fconst_1" , "b" ); - def(FCONST_2 , "fconst_2" , "b" ); - def(DCONST_0 , "dconst_0" , "b" ); - def(DCONST_1 , "dconst_1" , "b" ); - def(BIPUSH , "bipush" , "bc" ); - def(SIPUSH , "sipush" , "bcc" ); - def(LDC , "ldc" , "bi" , TRAP); - def(LDC_W , "ldc_w" , "bii" , TRAP); - def(LDC2_W , "ldc2_w" , "bii" , TRAP); - def(ILOAD , "iload" , "bi" , LOAD); - def(LLOAD , "lload" , "bi" , LOAD); - def(FLOAD , "fload" , "bi" , LOAD); - def(DLOAD , "dload" , "bi" , LOAD); - def(ALOAD , "aload" , "bi" , LOAD); - def(ILOAD_0 , "iload_0" , "b" , LOAD); - def(ILOAD_1 , "iload_1" , "b" , LOAD); - def(ILOAD_2 , "iload_2" , "b" , LOAD); - def(ILOAD_3 , "iload_3" , "b" , LOAD); - def(LLOAD_0 , "lload_0" , "b" , LOAD); - def(LLOAD_1 , "lload_1" , "b" , LOAD); - def(LLOAD_2 , "lload_2" , "b" , LOAD); - def(LLOAD_3 , "lload_3" , "b" , LOAD); - def(FLOAD_0 , "fload_0" , "b" , LOAD); - def(FLOAD_1 , "fload_1" , "b" , LOAD); - def(FLOAD_2 , "fload_2" , "b" , LOAD); - def(FLOAD_3 , "fload_3" , "b" , LOAD); - def(DLOAD_0 , "dload_0" , "b" , LOAD); - def(DLOAD_1 , "dload_1" , "b" , LOAD); - def(DLOAD_2 , "dload_2" , "b" , LOAD); - def(DLOAD_3 , "dload_3" , "b" , LOAD); - def(ALOAD_0 , "aload_0" , "b" , LOAD); - def(ALOAD_1 , "aload_1" , "b" , LOAD); - def(ALOAD_2 , "aload_2" , "b" , LOAD); - def(ALOAD_3 , "aload_3" , "b" , LOAD); - def(IALOAD , "iaload" , "b" , TRAP); - def(LALOAD , "laload" , "b" , TRAP); - def(FALOAD , "faload" , "b" , TRAP); - def(DALOAD , "daload" , "b" , TRAP); - def(AALOAD , "aaload" , "b" , TRAP); - def(BALOAD , "baload" , "b" , TRAP); - def(CALOAD , "caload" , "b" , TRAP); - def(SALOAD , "saload" , "b" , TRAP); - def(ISTORE , "istore" , "bi" , STORE); - def(LSTORE , "lstore" , "bi" , STORE); - def(FSTORE , "fstore" , "bi" , STORE); - def(DSTORE , "dstore" , "bi" , STORE); - def(ASTORE , "astore" , "bi" , STORE); - def(ISTORE_0 , "istore_0" , "b" , STORE); - def(ISTORE_1 , "istore_1" , "b" , STORE); - def(ISTORE_2 , "istore_2" , "b" , STORE); - def(ISTORE_3 , "istore_3" , "b" , STORE); - def(LSTORE_0 , "lstore_0" , "b" , STORE); - def(LSTORE_1 , "lstore_1" , "b" , STORE); - def(LSTORE_2 , "lstore_2" , "b" , STORE); - def(LSTORE_3 , "lstore_3" , "b" , STORE); - def(FSTORE_0 , "fstore_0" , "b" , STORE); - def(FSTORE_1 , "fstore_1" , "b" , STORE); - def(FSTORE_2 , "fstore_2" , "b" , STORE); - def(FSTORE_3 , "fstore_3" , "b" , STORE); - def(DSTORE_0 , "dstore_0" , "b" , STORE); - def(DSTORE_1 , "dstore_1" , "b" , STORE); - def(DSTORE_2 , "dstore_2" , "b" , STORE); - def(DSTORE_3 , "dstore_3" , "b" , STORE); - def(ASTORE_0 , "astore_0" , "b" , STORE); - def(ASTORE_1 , "astore_1" , "b" , STORE); - def(ASTORE_2 , "astore_2" , "b" , STORE); - def(ASTORE_3 , "astore_3" , "b" , STORE); - def(IASTORE , "iastore" , "b" , TRAP); - def(LASTORE , "lastore" , "b" , TRAP); - def(FASTORE , "fastore" , "b" , TRAP); - def(DASTORE , "dastore" , "b" , TRAP); - def(AASTORE , "aastore" , "b" , TRAP); - def(BASTORE , "bastore" , "b" , TRAP); - def(CASTORE , "castore" , "b" , TRAP); - def(SASTORE , "sastore" , "b" , TRAP); - def(POP , "pop" , "b" ); - def(POP2 , "pop2" , "b" ); - def(DUP , "dup" , "b" ); - def(DUP_X1 , "dup_x1" , "b" ); - def(DUP_X2 , "dup_x2" , "b" ); - def(DUP2 , "dup2" , "b" ); - def(DUP2_X1 , "dup2_x1" , "b" ); - def(DUP2_X2 , "dup2_x2" , "b" ); - def(SWAP , "swap" , "b" ); - def(IADD , "iadd" , "b" , COMMUTATIVE | ASSOCIATIVE); - def(LADD , "ladd" , "b" , COMMUTATIVE | ASSOCIATIVE); - def(FADD , "fadd" , "b" , COMMUTATIVE | ASSOCIATIVE); - def(DADD , "dadd" , "b" , COMMUTATIVE | ASSOCIATIVE); - def(ISUB , "isub" , "b" ); - def(LSUB , "lsub" , "b" ); - def(FSUB , "fsub" , "b" ); - def(DSUB , "dsub" , "b" ); - def(IMUL , "imul" , "b" , COMMUTATIVE | ASSOCIATIVE); - def(LMUL , "lmul" , "b" , COMMUTATIVE | ASSOCIATIVE); - def(FMUL , "fmul" , "b" , COMMUTATIVE | ASSOCIATIVE); - def(DMUL , "dmul" , "b" , COMMUTATIVE | ASSOCIATIVE); - def(IDIV , "idiv" , "b" , TRAP); - def(LDIV , "ldiv" , "b" , TRAP); - def(FDIV , "fdiv" , "b" ); - def(DDIV , "ddiv" , "b" ); - def(IREM , "irem" , "b" , TRAP); - def(LREM , "lrem" , "b" , TRAP); - def(FREM , "frem" , "b" ); - def(DREM , "drem" , "b" ); - def(INEG , "ineg" , "b" ); - def(LNEG , "lneg" , "b" ); - def(FNEG , "fneg" , "b" ); - def(DNEG , "dneg" , "b" ); - def(ISHL , "ishl" , "b" ); - def(LSHL , "lshl" , "b" ); - def(ISHR , "ishr" , "b" ); - def(LSHR , "lshr" , "b" ); - def(IUSHR , "iushr" , "b" ); - def(LUSHR , "lushr" , "b" ); - def(IAND , "iand" , "b" , COMMUTATIVE | ASSOCIATIVE); - def(LAND , "land" , "b" , COMMUTATIVE | ASSOCIATIVE); - def(IOR , "ior" , "b" , COMMUTATIVE | ASSOCIATIVE); - def(LOR , "lor" , "b" , COMMUTATIVE | ASSOCIATIVE); - def(IXOR , "ixor" , "b" , COMMUTATIVE | ASSOCIATIVE); - def(LXOR , "lxor" , "b" , COMMUTATIVE | ASSOCIATIVE); - def(IINC , "iinc" , "bic" , LOAD | STORE); - def(I2L , "i2l" , "b" ); - def(I2F , "i2f" , "b" ); - def(I2D , "i2d" , "b" ); - def(L2I , "l2i" , "b" ); - def(L2F , "l2f" , "b" ); - def(L2D , "l2d" , "b" ); - def(F2I , "f2i" , "b" ); - def(F2L , "f2l" , "b" ); - def(F2D , "f2d" , "b" ); - def(D2I , "d2i" , "b" ); - def(D2L , "d2l" , "b" ); - def(D2F , "d2f" , "b" ); - def(I2B , "i2b" , "b" ); - def(I2C , "i2c" , "b" ); - def(I2S , "i2s" , "b" ); - def(LCMP , "lcmp" , "b" ); - def(FCMPL , "fcmpl" , "b" ); - def(FCMPG , "fcmpg" , "b" ); - def(DCMPL , "dcmpl" , "b" ); - def(DCMPG , "dcmpg" , "b" ); - def(IFEQ , "ifeq" , "boo" , FALL_THROUGH | BRANCH); - def(IFNE , "ifne" , "boo" , FALL_THROUGH | BRANCH); - def(IFLT , "iflt" , "boo" , FALL_THROUGH | BRANCH); - def(IFGE , "ifge" , "boo" , FALL_THROUGH | BRANCH); - def(IFGT , "ifgt" , "boo" , FALL_THROUGH | BRANCH); - def(IFLE , "ifle" , "boo" , FALL_THROUGH | BRANCH); - def(IF_ICMPEQ , "if_icmpeq" , "boo" , COMMUTATIVE | FALL_THROUGH | BRANCH); - def(IF_ICMPNE , "if_icmpne" , "boo" , COMMUTATIVE | FALL_THROUGH | BRANCH); - def(IF_ICMPLT , "if_icmplt" , "boo" , FALL_THROUGH | BRANCH); - def(IF_ICMPGE , "if_icmpge" , "boo" , FALL_THROUGH | BRANCH); - def(IF_ICMPGT , "if_icmpgt" , "boo" , FALL_THROUGH | BRANCH); - def(IF_ICMPLE , "if_icmple" , "boo" , FALL_THROUGH | BRANCH); - def(IF_ACMPEQ , "if_acmpeq" , "boo" , COMMUTATIVE | FALL_THROUGH | BRANCH); - def(IF_ACMPNE , "if_acmpne" , "boo" , COMMUTATIVE | FALL_THROUGH | BRANCH); - def(GOTO , "goto" , "boo" , STOP | BRANCH); - def(JSR , "jsr" , "boo" , STOP | BRANCH); - def(RET , "ret" , "bi" , STOP); - def(TABLESWITCH , "tableswitch" , "" , STOP); - def(LOOKUPSWITCH , "lookupswitch" , "" , STOP); - def(IRETURN , "ireturn" , "b" , TRAP | STOP); - def(LRETURN , "lreturn" , "b" , TRAP | STOP); - def(FRETURN , "freturn" , "b" , TRAP | STOP); - def(DRETURN , "dreturn" , "b" , TRAP | STOP); - def(ARETURN , "areturn" , "b" , TRAP | STOP); - def(RETURN , "return" , "b" , TRAP | STOP); - def(GETSTATIC , "getstatic" , "bjj" , TRAP | FIELD_READ); - def(PUTSTATIC , "putstatic" , "bjj" , TRAP | FIELD_WRITE); - def(GETFIELD , "getfield" , "bjj" , TRAP | FIELD_READ); - def(PUTFIELD , "putfield" , "bjj" , TRAP | FIELD_WRITE); - def(INVOKEVIRTUAL , "invokevirtual" , "bjj" , TRAP | INVOKE); - def(INVOKESPECIAL , "invokespecial" , "bjj" , TRAP | INVOKE); - def(INVOKESTATIC , "invokestatic" , "bjj" , TRAP | INVOKE); - def(INVOKEINTERFACE , "invokeinterface" , "bjja_", TRAP | INVOKE); - def(XXXUNUSEDXXX , "xxxunusedxxx" , "" ); - def(NEW , "new" , "bii" , TRAP); - def(NEWARRAY , "newarray" , "bc" , TRAP); - def(ANEWARRAY , "anewarray" , "bii" , TRAP); - def(ARRAYLENGTH , "arraylength" , "b" , TRAP); - def(ATHROW , "athrow" , "b" , TRAP | STOP); - def(CHECKCAST , "checkcast" , "bii" , TRAP); - def(INSTANCEOF , "instanceof" , "bii" , TRAP); - def(MONITORENTER , "monitorenter" , "b" , TRAP); - def(MONITOREXIT , "monitorexit" , "b" , TRAP); - def(WIDE , "wide" , "" ); - def(MULTIANEWARRAY , "multianewarray" , "biic" , TRAP); - def(IFNULL , "ifnull" , "boo" , FALL_THROUGH | BRANCH); - def(IFNONNULL , "ifnonnull" , "boo" , FALL_THROUGH | BRANCH); - def(GOTO_W , "goto_w" , "boooo", STOP | BRANCH); - def(JSR_W , "jsr_w" , "boooo", STOP | BRANCH); - def(BREAKPOINT , "breakpoint" , "b" , TRAP); + def(NOP , "nop" , "b" , 0); + def(ACONST_NULL , "aconst_null" , "b" , 0); + def(ICONST_M1 , "iconst_m1" , "b" , 0); + def(ICONST_0 , "iconst_0" , "b" , 0); + def(ICONST_1 , "iconst_1" , "b" , 0); + def(ICONST_2 , "iconst_2" , "b" , 0); + def(ICONST_3 , "iconst_3" , "b" , 0); + def(ICONST_4 , "iconst_4" , "b" , 0); + def(ICONST_5 , "iconst_5" , "b" , 0); + def(LCONST_0 , "lconst_0" , "b" , 0); + def(LCONST_1 , "lconst_1" , "b" , 0); + def(FCONST_0 , "fconst_0" , "b" , 0); + def(FCONST_1 , "fconst_1" , "b" , 0); + def(FCONST_2 , "fconst_2" , "b" , 0); + def(DCONST_0 , "dconst_0" , "b" , 0); + def(DCONST_1 , "dconst_1" , "b" , 0); + def(BIPUSH , "bipush" , "bc" , 0); + def(SIPUSH , "sipush" , "bcc" , 0); + def(LDC , "ldc" , "bi" , 0, TRAP); + def(LDC_W , "ldc_w" , "bii" , 0, TRAP); + def(LDC2_W , "ldc2_w" , "bii" , 0, TRAP); + def(ILOAD , "iload" , "bi" , 0, LOAD); + def(LLOAD , "lload" , "bi" , 0, LOAD); + def(FLOAD , "fload" , "bi" , 0, LOAD); + def(DLOAD , "dload" , "bi" , 0, LOAD); + def(ALOAD , "aload" , "bi" , 0, LOAD); + def(ILOAD_0 , "iload_0" , "b" , 0, LOAD); + def(ILOAD_1 , "iload_1" , "b" , 0, LOAD); + def(ILOAD_2 , "iload_2" , "b" , 0, LOAD); + def(ILOAD_3 , "iload_3" , "b" , 0, LOAD); + def(LLOAD_0 , "lload_0" , "b" , 0, LOAD); + def(LLOAD_1 , "lload_1" , "b" , 0, LOAD); + def(LLOAD_2 , "lload_2" , "b" , 0, LOAD); + def(LLOAD_3 , "lload_3" , "b" , 0, LOAD); + def(FLOAD_0 , "fload_0" , "b" , 0, LOAD); + def(FLOAD_1 , "fload_1" , "b" , 0, LOAD); + def(FLOAD_2 , "fload_2" , "b" , 0, LOAD); + def(FLOAD_3 , "fload_3" , "b" , 0, LOAD); + def(DLOAD_0 , "dload_0" , "b" , 0, LOAD); + def(DLOAD_1 , "dload_1" , "b" , 0, LOAD); + def(DLOAD_2 , "dload_2" , "b" , 0, LOAD); + def(DLOAD_3 , "dload_3" , "b" , 0, LOAD); + def(ALOAD_0 , "aload_0" , "b" , 0, LOAD); + def(ALOAD_1 , "aload_1" , "b" , 0, LOAD); + def(ALOAD_2 , "aload_2" , "b" , 0, LOAD); + def(ALOAD_3 , "aload_3" , "b" , 0, LOAD); + def(IALOAD , "iaload" , "b" , 0, TRAP); + def(LALOAD , "laload" , "b" , 0, TRAP); + def(FALOAD , "faload" , "b" , 0, TRAP); + def(DALOAD , "daload" , "b" , 0, TRAP); + def(AALOAD , "aaload" , "b" , 0, TRAP); + def(BALOAD , "baload" , "b" , 0, TRAP); + def(CALOAD , "caload" , "b" , 0, TRAP); + def(SALOAD , "saload" , "b" , 0, TRAP); + def(ISTORE , "istore" , "bi" , 0, STORE); + def(LSTORE , "lstore" , "bi" , 0, STORE); + def(FSTORE , "fstore" , "bi" , 0, STORE); + def(DSTORE , "dstore" , "bi" , 0, STORE); + def(ASTORE , "astore" , "bi" , 0, STORE); + def(ISTORE_0 , "istore_0" , "b" , 0, STORE); + def(ISTORE_1 , "istore_1" , "b" , 0, STORE); + def(ISTORE_2 , "istore_2" , "b" , 0, STORE); + def(ISTORE_3 , "istore_3" , "b" , 0, STORE); + def(LSTORE_0 , "lstore_0" , "b" , 0, STORE); + def(LSTORE_1 , "lstore_1" , "b" , 0, STORE); + def(LSTORE_2 , "lstore_2" , "b" , 0, STORE); + def(LSTORE_3 , "lstore_3" , "b" , 0, STORE); + def(FSTORE_0 , "fstore_0" , "b" , 0, STORE); + def(FSTORE_1 , "fstore_1" , "b" , 0, STORE); + def(FSTORE_2 , "fstore_2" , "b" , 0, STORE); + def(FSTORE_3 , "fstore_3" , "b" , 0, STORE); + def(DSTORE_0 , "dstore_0" , "b" , 0, STORE); + def(DSTORE_1 , "dstore_1" , "b" , 0, STORE); + def(DSTORE_2 , "dstore_2" , "b" , 0, STORE); + def(DSTORE_3 , "dstore_3" , "b" , 0, STORE); + def(ASTORE_0 , "astore_0" , "b" , 0, STORE); + def(ASTORE_1 , "astore_1" , "b" , 0, STORE); + def(ASTORE_2 , "astore_2" , "b" , 0, STORE); + def(ASTORE_3 , "astore_3" , "b" , 0, STORE); + def(IASTORE , "iastore" , "b" , 3, TRAP); + def(LASTORE , "lastore" , "b" , 3, TRAP); + def(FASTORE , "fastore" , "b" , 3, TRAP); + def(DASTORE , "dastore" , "b" , 3, TRAP); + def(AASTORE , "aastore" , "b" , 4, TRAP); + def(BASTORE , "bastore" , "b" , 3, TRAP); + def(CASTORE , "castore" , "b" , 3, TRAP); + def(SASTORE , "sastore" , "b" , 3, TRAP); + def(POP , "pop" , "b" , 0); + def(POP2 , "pop2" , "b" , 0); + def(DUP , "dup" , "b" , 0); + def(DUP_X1 , "dup_x1" , "b" , 0); + def(DUP_X2 , "dup_x2" , "b" , 0); + def(DUP2 , "dup2" , "b" , 0); + def(DUP2_X1 , "dup2_x1" , "b" , 0); + def(DUP2_X2 , "dup2_x2" , "b" , 0); + def(SWAP , "swap" , "b" , 0); + def(IADD , "iadd" , "b" , 1, COMMUTATIVE | ASSOCIATIVE); + def(LADD , "ladd" , "b" , 1, COMMUTATIVE | ASSOCIATIVE); + def(FADD , "fadd" , "b" , 1, COMMUTATIVE | ASSOCIATIVE); + def(DADD , "dadd" , "b" , 1, COMMUTATIVE | ASSOCIATIVE); + def(ISUB , "isub" , "b" , 1); + def(LSUB , "lsub" , "b" , 1); + def(FSUB , "fsub" , "b" , 1); + def(DSUB , "dsub" , "b" , 1); + def(IMUL , "imul" , "b" , 1, COMMUTATIVE | ASSOCIATIVE); + def(LMUL , "lmul" , "b" , 1, COMMUTATIVE | ASSOCIATIVE); + def(FMUL , "fmul" , "b" , 1, COMMUTATIVE | ASSOCIATIVE); + def(DMUL , "dmul" , "b" , 1, COMMUTATIVE | ASSOCIATIVE); + def(IDIV , "idiv" , "b" , 1, TRAP); + def(LDIV , "ldiv" , "b" , 1, TRAP); + def(FDIV , "fdiv" , "b" , 1); + def(DDIV , "ddiv" , "b" , 1); + def(IREM , "irem" , "b" , 1, TRAP); + def(LREM , "lrem" , "b" , 1, TRAP); + def(FREM , "frem" , "b" , 1); + def(DREM , "drem" , "b" , 1); + def(INEG , "ineg" , "b" , 1); + def(LNEG , "lneg" , "b" , 1); + def(FNEG , "fneg" , "b" , 1); + def(DNEG , "dneg" , "b" , 1); + def(ISHL , "ishl" , "b" , 1); + def(LSHL , "lshl" , "b" , 1); + def(ISHR , "ishr" , "b" , 1); + def(LSHR , "lshr" , "b" , 1); + def(IUSHR , "iushr" , "b" , 1); + def(LUSHR , "lushr" , "b" , 1); + def(IAND , "iand" , "b" , 1, COMMUTATIVE | ASSOCIATIVE); + def(LAND , "land" , "b" , 1, COMMUTATIVE | ASSOCIATIVE); + def(IOR , "ior" , "b" , 1, COMMUTATIVE | ASSOCIATIVE); + def(LOR , "lor" , "b" , 1, COMMUTATIVE | ASSOCIATIVE); + def(IXOR , "ixor" , "b" , 1, COMMUTATIVE | ASSOCIATIVE); + def(LXOR , "lxor" , "b" , 1, COMMUTATIVE | ASSOCIATIVE); + def(IINC , "iinc" , "bic" , 1, LOAD | STORE); + def(I2L , "i2l" , "b" , 1); + def(I2F , "i2f" , "b" , 1); + def(I2D , "i2d" , "b" , 1); + def(L2I , "l2i" , "b" , 1); + def(L2F , "l2f" , "b" , 1); + def(L2D , "l2d" , "b" , 1); + def(F2I , "f2i" , "b" , 1); + def(F2L , "f2l" , "b" , 1); + def(F2D , "f2d" , "b" , 1); + def(D2I , "d2i" , "b" , 1); + def(D2L , "d2l" , "b" , 1); + def(D2F , "d2f" , "b" , 1); + def(I2B , "i2b" , "b" , 1); + def(I2C , "i2c" , "b" , 1); + def(I2S , "i2s" , "b" , 1); + def(LCMP , "lcmp" , "b" , 1); + def(FCMPL , "fcmpl" , "b" , 1); + def(FCMPG , "fcmpg" , "b" , 1); + def(DCMPL , "dcmpl" , "b" , 1); + def(DCMPG , "dcmpg" , "b" , 1); + def(IFEQ , "ifeq" , "boo" , 2, FALL_THROUGH | BRANCH); + def(IFNE , "ifne" , "boo" , 2, FALL_THROUGH | BRANCH); + def(IFLT , "iflt" , "boo" , 2, FALL_THROUGH | BRANCH); + def(IFGE , "ifge" , "boo" , 2, FALL_THROUGH | BRANCH); + def(IFGT , "ifgt" , "boo" , 2, FALL_THROUGH | BRANCH); + def(IFLE , "ifle" , "boo" , 2, FALL_THROUGH | BRANCH); + def(IF_ICMPEQ , "if_icmpeq" , "boo" , 2, COMMUTATIVE | FALL_THROUGH | BRANCH); + def(IF_ICMPNE , "if_icmpne" , "boo" , 2, COMMUTATIVE | FALL_THROUGH | BRANCH); + def(IF_ICMPLT , "if_icmplt" , "boo" , 2, FALL_THROUGH | BRANCH); + def(IF_ICMPGE , "if_icmpge" , "boo" , 2, FALL_THROUGH | BRANCH); + def(IF_ICMPGT , "if_icmpgt" , "boo" , 2, FALL_THROUGH | BRANCH); + def(IF_ICMPLE , "if_icmple" , "boo" , 2, FALL_THROUGH | BRANCH); + def(IF_ACMPEQ , "if_acmpeq" , "boo" , 2, COMMUTATIVE | FALL_THROUGH | BRANCH); + def(IF_ACMPNE , "if_acmpne" , "boo" , 2, COMMUTATIVE | FALL_THROUGH | BRANCH); + def(GOTO , "goto" , "boo" , 1, STOP | BRANCH); + def(JSR , "jsr" , "boo" , 0, STOP | BRANCH); + def(RET , "ret" , "bi" , 0, STOP); + def(TABLESWITCH , "tableswitch" , "" , 4, STOP); + def(LOOKUPSWITCH , "lookupswitch" , "" , 4, STOP); + def(IRETURN , "ireturn" , "b" , 1, TRAP | STOP); + def(LRETURN , "lreturn" , "b" , 1, TRAP | STOP); + def(FRETURN , "freturn" , "b" , 1, TRAP | STOP); + def(DRETURN , "dreturn" , "b" , 1, TRAP | STOP); + def(ARETURN , "areturn" , "b" , 1, TRAP | STOP); + def(RETURN , "return" , "b" , 1, TRAP | STOP); + def(GETSTATIC , "getstatic" , "bjj" , 2, TRAP | FIELD_READ); + def(PUTSTATIC , "putstatic" , "bjj" , 2, TRAP | FIELD_WRITE); + def(GETFIELD , "getfield" , "bjj" , 2, TRAP | FIELD_READ); + def(PUTFIELD , "putfield" , "bjj" , 2, TRAP | FIELD_WRITE); + def(INVOKEVIRTUAL , "invokevirtual" , "bjj" , 7, TRAP | INVOKE); + def(INVOKESPECIAL , "invokespecial" , "bjj" , 5, TRAP | INVOKE); + def(INVOKESTATIC , "invokestatic" , "bjj" , 5, TRAP | INVOKE); + def(INVOKEINTERFACE , "invokeinterface" , "bjja_", 7, TRAP | INVOKE); + def(XXXUNUSEDXXX , "xxxunusedxxx" , "" , 0); + def(NEW , "new" , "bii" , 6, TRAP); + def(NEWARRAY , "newarray" , "bc" , 6, TRAP); + def(ANEWARRAY , "anewarray" , "bii" , 6, TRAP); + def(ARRAYLENGTH , "arraylength" , "b" , 2, TRAP); + def(ATHROW , "athrow" , "b" , 5, TRAP | STOP); + def(CHECKCAST , "checkcast" , "bii" , 3, TRAP); + def(INSTANCEOF , "instanceof" , "bii" , 4, TRAP); + def(MONITORENTER , "monitorenter" , "b" , 5, TRAP); + def(MONITOREXIT , "monitorexit" , "b" , 5, TRAP); + def(WIDE , "wide" , "" , 0); + def(MULTIANEWARRAY , "multianewarray" , "biic" , 6, TRAP); + def(IFNULL , "ifnull" , "boo" , 2, FALL_THROUGH | BRANCH); + def(IFNONNULL , "ifnonnull" , "boo" , 2, FALL_THROUGH | BRANCH); + def(GOTO_W , "goto_w" , "boooo", 1, STOP | BRANCH); + def(JSR_W , "jsr_w" , "boooo", 0, STOP | BRANCH); + def(BREAKPOINT , "breakpoint" , "b" , 0, TRAP); } // Checkstyle: resume @@ -622,6 +627,15 @@ } /** + * Gets the compilation complexity for a given opcode. + * @param opcode an opcode + * @return a value >= 0 + */ + public static int compilationComplexity(int opcode) { + return compilationComplexityArray[opcode & 0xff]; + } + + /** * Gets the lower-case mnemonic for a given opcode. * * @param opcode an opcode @@ -836,8 +850,8 @@ * @param format encodes the length of the instruction * @param flagsArray the set of {@link Flags} associated with the instruction */ - private static void def(int opcode, String name, String format) { - def(opcode, name, format, 0); + private static void def(int opcode, String name, String format, int compilationComplexity) { + def(opcode, name, format, compilationComplexity, 0); } /** @@ -847,11 +861,12 @@ * @param format encodes the length of the instruction * @param flags the set of {@link Flags} associated with the instruction */ - private static void def(int opcode, String name, String format, int flags) { + private static void def(int opcode, String name, String format, int compilationComplexity, int flags) { assert nameArray[opcode] == null : "opcode " + opcode + " is already bound to name " + nameArray[opcode]; nameArray[opcode] = name; int instructionLength = format.length(); lengthArray[opcode] = instructionLength; + compilationComplexityArray[opcode] = compilationComplexity; Bytecodes.flagsArray[opcode] = flags; assert !isConditionalBranch(opcode) || isBranch(opcode) : "a conditional branch must also be a branch";
--- a/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java Thu Feb 16 14:53:04 2012 +0100 @@ -1423,7 +1423,7 @@ if (config.eagerResolving()) { catchType = lookupType(block.handler.catchTypeCPI(), INSTANCEOF); } - boolean initialized = (catchType instanceof RiResolvedType) && ((RiResolvedType) catchType).isInitialized(); + boolean initialized = (catchType instanceof RiResolvedType); if (initialized && config.getSkippedExceptionTypes() != null) { RiResolvedType resolvedCatchType = (RiResolvedType) catchType; for (RiResolvedType skippedType : config.getSkippedExceptionTypes()) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/ConvertJTT.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt; + +import java.io.*; +import java.nio.charset.*; +import java.nio.file.*; +import java.util.*; + +/** + * Simple Utility to convert java tester tests from the proprietary test format into JUnit - tests. + */ +public class ConvertJTT { + + public static void main(String[] args) throws IOException { + String targetPath = "graalvm/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/jtt"; + String sourcePath = "maxine/com.oracle.max.vm/test/jtt"; + + File target = new File(targetPath); + for (File dir : new File(sourcePath).listFiles()) { + if (dir.isDirectory()) { + String packageName = dir.getName(); + if (packageName.equals("exbytecode") || packageName.equals("max")) { + continue; + } + File targetDir = new File(target, packageName); + for (File file : dir.listFiles()) { + if (file.getName().endsWith(".java")) { + targetDir.mkdirs(); + try { + processFile(file.toPath(), new File(targetDir, file.getName()).toPath(), packageName); + } catch (RuntimeException e) { + e.printStackTrace(); + System.out.println("in file " + file.getAbsolutePath()); + } + } + } + } + } + } + + public static class Run { + + public String input; + public String output; + + public Run(String input, String output) { + this.input = input; + this.output = output; + } + + @Override + public String toString() { + return String.format("%16s = %s", input, output); + } + } + + private static void processFile(Path file, Path target, String packageName) throws IOException { + List<String> lines = Files.readAllLines(file, Charset.forName("UTF-8")); + Iterator<String> iter = lines.iterator(); + + ArrayList<String> output = new ArrayList<>(); + ArrayList<Run> runs = new ArrayList<>(); + + String line; + boolean javaHarness = false; + while (iter.hasNext()) { + line = iter.next(); + if (line.startsWith(" * Copyright (c) ")) { + output.add(" * Copyright (c) " + line.substring(17, 21) + ", 2012, Oracle and/or its affiliates. All rights reserved."); + } else if (line.contains("@Runs:")) { + line = line.substring(line.indexOf("@Runs:") + 6).trim(); + if (line.endsWith(";")) { + line = line.substring(0, line.length() - 1); + } + String[] runStrings; + if (charCount(line, ';') == charCount(line, '=') - 1) { + runStrings = line.split(";"); + } else if (charCount(line, ',') == charCount(line, '=') - 1) { + runStrings = line.split(","); + } else if (charCount(line, ',', ';') == charCount(line, '=') - 1) { + runStrings = line.split("[,;]"); + } else { + throw new RuntimeException("invalid run line: " + line); + } + for (String runString : runStrings) { + String[] split = runString.split("="); + if (split.length != 2) { + throw new RuntimeException("invalid run string: " + runString); + } + Run run = new Run(split[0].trim(), split[1].trim()); + runs.add(run); + } + } else if (line.contains("@Harness:")) { + if (line.contains("@Harness: java")) { + javaHarness = true; + } + } else if (line.startsWith("package jtt.")) { + output.add("package com.oracle.max.graal.jtt." + packageName + ";"); + output.add(""); + output.add("import org.junit.*;"); + } else if (line.contains("@NEVER_INLINE")) { + output.add("// " + line); + } else if (line.startsWith("import com.sun.max.annotate.")) { + // do nothing + } else if (line.equals("}")) { + if (runs != null) { + int n = 0; + for (Run run : runs) { + processRun(output, run, n++); + } + runs = null; + } + output.add(line); + } else { +// line = line.replace(oldClassName, newClassName); + line = line.replace(" jtt.", " com.oracle.max.graal.jtt."); + output.add(line); + } + } + if (!javaHarness) { + throw new RuntimeException("no java harness"); + } + if (runs != null) { + throw new RuntimeException("no ending brace found"); + } + + Files.write(target, output, Charset.forName("UTF-8")); + } + + private static void processRun(ArrayList<String> output, Run run, int n) { + if (run.output.startsWith("!")) { + output.add(" @Test(expected = " + run.output.substring(1).replace("jtt.", "com.oracle.max.graal.jtt.").replace('$', '.') + ".class)"); + output.add(" public void run" + n + "() throws Throwable {"); + output.add(" test(" + parameters(run.input) + ");"); + output.add(" }"); + output.add(""); + } else { + output.add(" @Test"); + output.add(" public void run" + n + "() throws Throwable {"); + String result = parameters(run.output); + if (result.endsWith("f") || result.endsWith("d") || result.endsWith("F") || result.endsWith("D")) { + output.add(" Assert.assertEquals(" + result + ", test(" + parameters(run.input) + "), 0);"); + } else { + output.add(" Assert.assertEquals(" + result + ", test(" + parameters(run.input) + "));"); + } + output.add(" }"); + output.add(""); + } + } + + private static String parameters(String params) { + if (params.startsWith("(")) { + StringBuilder str = new StringBuilder(); + String[] split = params.substring(1, params.length() - 1).split(","); + for (int i = 0; i < split.length; i++) { + str.append(i == 0 ? "" : ", ").append(parameters(split[i].trim())); + } + return str.toString(); + } else if (params.startsWith("`")) { + return params.substring(1); + } else { + if (params.length() <= 1) { + return params; + } else { + if (params.endsWith("s")) { + return "((short) " + params.substring(0, params.length() - 1) + ")"; + } else if (params.endsWith("c")) { + return "((char) " + params.substring(0, params.length() - 1) + ")"; + } else if (params.endsWith("b")) { + return "((byte) " + params.substring(0, params.length() - 1) + ")"; + } + } + return params.replace("jtt.", "com.oracle.max.graal.jtt."); + } + } + + private static int charCount(String str, char ch1) { + int count = 0; + for (int i = 0; i < str.length(); i++) { + if (str.charAt(i) == ch1) { + count++; + } + } + return count; + } + + private static int charCount(String str, char ch1, char ch2) { + int count = 0; + for (int i = 0; i < str.length(); i++) { + if (str.charAt(i) == ch1 || str.charAt(i) == ch2) { + count++; + } + } + return count; + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_aaload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_aaload { + + static Object[] array = {null, null, ""}; + + public static Object test(int arg) { + return array[arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(null, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(null, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("", test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_aaload_1.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_aaload_1 { + + static Object[][] array = {{null}, {null}, {""}}; + + public static Object test(int arg) { + return array[arg][0]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(null, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(null, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("", test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_aastore.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_aastore { + + static Object[] param = {new Object(), null, "h"}; + static Object[] array1 = {null, null, null}; + static String[] array2 = {null, null, null}; + + public static int test(boolean a, int indx) { + Object[] array = a ? array1 : array2; + Object val; + val = param[indx]; + array[indx] = val; + return indx; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(true, 0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(true, 1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(true, 2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1, test(false, 1)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(2, test(false, 2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_aload_0.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_aload_0 { + + public static Object test(Object arg) { + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(null, test(null)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("x", test("x")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_aload_1.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_aload_1 { + + @SuppressWarnings("unused") + public static Object test(int i, Object arg) { + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(null, test(1, null)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("x", test(1, "x")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_aload_2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_aload_2 { + + @SuppressWarnings("unused") + public static Object test(int i, int j, Object arg) { + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(null, test(1, 1, null)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("x", test(1, 1, "x")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_aload_3.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_aload_3 { + + @SuppressWarnings("unused") + public static Object test(int i, int j, int k, Object arg) { + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("x", test(1, 1, 1, "x")); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(null, test(1, 1, 1, null)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_anewarray.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_anewarray { + + @SuppressWarnings("unused") + public static int test(int a) { + final BC_anewarray[] v = new BC_anewarray[3]; + if (v != null) { + return a; + } + return -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_areturn.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_areturn { + + public static Object test(Object a) { + return a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(null, test(null)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("", test("")); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("this", test("this")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_arraylength.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_arraylength { + + static int[] array1 = {1, 2, 3}; + static char[] array2 = {'a', 'b', 'c', 'd'}; + static Object[] array3 = new Object[5]; + static Object[][] array4 = new Object[5][5]; + + public static int test(int arg) { + if (arg == 1) { + return array1.length; + } + if (arg == 2) { + return array2.length; + } + if (arg == 3) { + return array3.length; + } + if (arg == 4) { + return array4[0].length; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3, test(1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(4, test(2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(5, test(3)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(5, test(4)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(42, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_athrow.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_athrow { + + static Throwable throwable = new Throwable(); + + public static int test(int arg) throws Throwable { + if (arg == 2) { + throw throwable; + } + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test(expected = java.lang.Throwable.class) + public void run2() throws Throwable { + test(2); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(3, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_baload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_baload { + + static boolean[] array = {true, false, true, false}; + + public static boolean test(int arg) { + return array[arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_bastore.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_bastore { + + static boolean[] array = {false, false, false, false}; + + public static boolean test(int arg, boolean val) { + array[arg] = val; + return array[arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0, true)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1, false)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2, true)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3, false)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_caload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_caload { + + static char[] array = {'\000', 'a', ' ', 10000}; + + public static char test(int arg) { + return array[arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((char) 0), test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((char) 97), test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((char) 32), test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(((char) 10000), test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_castore.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_castore { + + static char[] array = {0, 0, 0, 0}; + + public static char test(int arg, char val) { + array[arg] = val; + return array[arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((char) 97), test(0, ((char) 97))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((char) 65), test(1, ((char) 65))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((char) 42), test(2, ((char) 42))); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(((char) 120), test(3, ((char) 120))); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_checkcast01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_checkcast01 { + + static Object object2 = new Object(); + static Object object3 = ""; + static Object object4 = new BC_checkcast01(); + + public static int test(int arg) { + Object obj; + if (arg == 2) { + obj = object2; + } else if (arg == 3) { + obj = object3; + } else if (arg == 4) { + obj = object4; + } else { + obj = null; + } + final BC_checkcast01 bc = (BC_checkcast01) obj; + if (bc != null) { + return arg; + } + return -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-1, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(4, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_checkcast02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_checkcast02 { + + static Object[] o1 = {new Object()}; + static String[] o2 = {""}; + static BC_checkcast02[] o3 = {new BC_checkcast02()}; + + public static int test(int arg) { + Object obj = null; + if (arg == 0) { + obj = o1; + } + if (arg == 1) { + obj = o2; + } + if (arg == 2) { + obj = o3; + } + Object[] r = (Object[]) obj; + return r == null ? -1 : -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-1, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-1, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_d2f.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_d2f { + + public static float test(double d) { + return (float) d; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0f, test(0.0d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1.0f, test(1.0d), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1.06f, test(-1.06d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_d2i01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_d2i01 { + + public static int test(double d) { + return (int) d; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0.0d)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1.0d)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test(-1.06d)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-156, test(-156.82743d)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_d2i02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_d2i02 { + + private static double[] inputs = {-1.3e44d, Double.NEGATIVE_INFINITY, Double.NaN, Double.POSITIVE_INFINITY, 1.3e44d}; + + public static int test(int i) { + return (int) inputs[i]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-2147483648, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-2147483648, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(2147483647, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(2147483647, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_d2l01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_d2l01 { + + public static long test(double d) { + return (long) d; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(0.0d)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1L, test(1.0d)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1L, test(-1.06d)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-156L, test(-156.82743d)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_d2l02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_d2l02 { + + private static double[] inputs = {-1.3e44d, Double.NEGATIVE_INFINITY, Double.NaN, Double.POSITIVE_INFINITY, 1.3e44d}; + + public static long test(int i) { + return (long) inputs[i]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-9223372036854775808L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-9223372036854775808L, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0L, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(9223372036854775807L, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(9223372036854775807L, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dadd.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dadd { + + public static double test(double a, double b) { + return a + b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0d, test(0.0d, 0.0d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2.0d, test(1.0d, 1.0d), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(307.54d, test(253.11d, 54.43d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_daload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_daload { + + static double[] array = {0.0, -1.1, 4.32, 6.06}; + + public static double test(int arg) { + return array[arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0d, test(0), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1.1d, test(1), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(4.32d, test(2), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(6.06d, test(3), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dastore.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dastore { + + static double[] array = {0, 0, 0, 0}; + + public static double test(int arg, double val) { + array[arg] = val; + return array[arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.01d, test(0, 0.01d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1.4d, test(1, -1.4d), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0.01d, test(2, 0.01d), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-1.4d, test(3, -1.4d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dcmp01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dcmp01 { + + public static boolean test(double a, double b) { + return a < b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0d, -0.1d)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(78.00d, 78.001d)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dcmp02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dcmp02 { + + public static boolean test(double a) { + return (a / a) < 0.0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-1.0d)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1.0d)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0d)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(-0.0d)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dcmp03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dcmp03 { + + public static boolean test(double a) { + return (a / a) > 0.0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-1.0d)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1.0d)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0d)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(-0.0d)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dcmp04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dcmp04 { + + public static boolean test(double a) { + return (a / a) <= 0.0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-1.0d)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1.0d)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0d)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(-0.0d)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dcmp05.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dcmp05 { + + public static boolean test(double a) { + return (a / a) >= 0.0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-1.0d)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1.0d)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0d)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dcmp06.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dcmp06 { + + public static boolean test(double a) { + return 0.0 < (a / a); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-1.0d)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1.0d)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0d)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dcmp07.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dcmp07 { + + public static boolean test(double a) { + return 0.0 > (a / a); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-1.0d)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1.0d)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0d)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dcmp08.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dcmp08 { + + public static boolean test(double a) { + return 0.0 <= (a / a); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-1.0d)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1.0d)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0d)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dcmp09.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dcmp09 { + + public static boolean test(double a) { + return 0.0 >= (a / a); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-1.0d)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1.0d)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0d)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dcmp10.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dcmp10 { + + public static boolean test(int x) { + double a = 0; + double b = 0; + switch (x) { + case 0: + a = Double.POSITIVE_INFINITY; + b = 1; + break; + case 1: + a = 1; + b = Double.POSITIVE_INFINITY; + break; + case 2: + a = Double.NEGATIVE_INFINITY; + b = 1; + break; + case 3: + a = 1; + b = Double.NEGATIVE_INFINITY; + break; + case 4: + a = Double.NEGATIVE_INFINITY; + b = Double.NEGATIVE_INFINITY; + break; + case 5: + a = Double.NEGATIVE_INFINITY; + b = Double.POSITIVE_INFINITY; + break; + case 6: + a = Double.NaN; + b = Double.POSITIVE_INFINITY; + break; + case 7: + a = 1; + b = Double.NaN; + break; + case 8: + a = 1; + b = -0.0d / 0.0d; + break; + } + return a <= b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ddiv.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ddiv { + + public static double test(double a, double b) { + return a / b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(31.1D, test(311.0D, 10D), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dmul.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dmul { + + public static double test(double a, double b) { + return a * b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3110.0D, test(311.0D, 10D), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(22.4D, test(11.2D, 2.0D), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dneg.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dneg { + + public static double test(double a, double b, int which) { + double result1 = -a; + double result2 = -b; + double result = 0.0; + if (which == 0) { + result = result1; + } else { + result = result2; + } + return result; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-0.0d, test(0.0d, 1.0d, 0), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1.01d, test(-1.01d, -2.01d, 0), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-7263.8734d, test(7263.8734d, 8263.8734d, 0), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-1.0d, test(0.0d, 1.0d, 1), 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(2.01d, test(-1.01d, -2.01d, 1), 0); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(-8263.8734d, test(7263.8734d, 8263.8734d, 1), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dneg2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dneg2 { + +// @NEVER_INLINE + public static double test(double a) { + return 1 / (-a); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(java.lang.Double.POSITIVE_INFINITY, test(-0.0d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(java.lang.Double.NEGATIVE_INFINITY, test(0.0d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_drem.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +public class BC_drem { + + public static double test(double a, double b) { + return a % b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1.0D, test(311.0D, 10D), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1.2D, test(11.2D, 2.0D), 0.000000000000001); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dreturn.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dreturn { + + public static double test(double a) { + return a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0d, test(0.0d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1.1d, test(1.1d), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1.4d, test(-1.4d), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(256.33d, test(256.33d), 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(1000.001d, test(1000.001d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dsub.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dsub { + + public static double test(double a, double b) { + return a - b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0d, test(0.0d, 0.0d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0.0d, test(1.0d, 1.0d), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(198.68d, test(253.11d, 54.43d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_dsub2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_dsub2 { + + public static double test(double a) { + return 1.0 / (0.0 - a); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(java.lang.Double.POSITIVE_INFINITY, test(0.0d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_f2d.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_f2d { + + public static double test(float d) { + return d; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0d, test(0.0f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1.0d, test(1.0f), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-2.00d, test(-2.00f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_f2i01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_f2i01 { + + public static int test(float d) { + return (int) d; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0.0f)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1.0f)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test(-1.06f)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-156, test(-156.82743f)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_f2i02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_f2i02 { + + private static float[] inputs = {-1.3e22f, Float.NEGATIVE_INFINITY, Float.NaN, Float.POSITIVE_INFINITY, 1.3e22f}; + + public static int test(int i) { + return (int) inputs[i]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-2147483648, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-2147483648, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(2147483647, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(2147483647, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_f2l01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_f2l01 { + + public static long test(float d) { + return (long) d; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(0.0f)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1L, test(1.0f)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1L, test(-1.06f)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-156L, test(-156.82743f)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_f2l02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_f2l02 { + + private static float[] inputs = {-1.3e22f, Float.NEGATIVE_INFINITY, Float.NaN, Float.POSITIVE_INFINITY, 1.3e22f}; + + public static long test(int i) { + return (long) inputs[i]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-9223372036854775808L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-9223372036854775808L, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0L, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(9223372036854775807L, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(9223372036854775807L, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fadd.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fadd { + + public static float test(float a, float b) { + return a + b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0f, test(0.0f, 0.0f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2.0f, test(1.0f, 1.0f), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(307.54f, test(253.11f, 54.43f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_faload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_faload { + + static float[] array = {0.0f, -1.1f, 4.32f, 6.06f}; + + public static float test(int arg) { + return array[arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0f, test(0), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1.1f, test(1), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(4.32f, test(2), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(6.06f, test(3), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fastore.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fastore { + + static float[] array = {0, 0, 0, 0}; + + public static float test(int arg, float val) { + array[arg] = val; + return array[arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.01f, test(0, 0.01f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1.4f, test(1, -1.4f), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0.01f, test(2, 0.01f), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-1.4f, test(3, -1.4f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fcmp01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fcmp01 { + + public static boolean test(float a, float b) { + return a < b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0f, -0.1f)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(78.00f, 78.001f)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fcmp02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fcmp02 { + + public static boolean test(float a) { + return (a / a) < 0.0f; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-1.0f)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1.0f)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0f)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fcmp03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fcmp03 { + + public static boolean test(float a) { + return (a / a) > 0.0f; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-1.0f)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1.0f)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0f)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fcmp04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fcmp04 { + + public static boolean test(float a) { + return (a / a) <= 0.0f; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-1.0f)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1.0f)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0f)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fcmp05.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fcmp05 { + + public static boolean test(float a) { + return (a / a) >= 0.0f; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-1.0f)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1.0f)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0f)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fcmp06.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fcmp06 { + + public static boolean test(float a) { + return 0.0f < (a / a); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-1.0f)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1.0f)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0f)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fcmp07.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fcmp07 { + + public static boolean test(float a) { + return 0.0f > (a / a); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-1.0f)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1.0f)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0f)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fcmp08.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fcmp08 { + + public static boolean test(float a) { + return 0.0f <= (a / a); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-1.0f)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1.0f)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0f)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fcmp09.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fcmp09 { + + public static boolean test(float a) { + return 0.0f >= (a / a); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-1.0f)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1.0f)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.0f)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fcmp10.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fcmp10 { + + public static boolean test(int x) { + float a = 0; + float b = 0; + switch (x) { + case 0: + a = Float.POSITIVE_INFINITY; + b = 1; + break; + case 1: + a = 1; + b = Float.POSITIVE_INFINITY; + break; + case 2: + a = Float.NEGATIVE_INFINITY; + b = 1; + break; + case 3: + a = 1; + b = Float.NEGATIVE_INFINITY; + break; + case 4: + a = Float.NEGATIVE_INFINITY; + b = Float.NEGATIVE_INFINITY; + break; + case 5: + a = Float.NEGATIVE_INFINITY; + b = Float.POSITIVE_INFINITY; + break; + case 6: + a = Float.NaN; + b = Float.POSITIVE_INFINITY; + break; + case 7: + a = 1; + b = Float.NaN; + break; + case 8: + a = 1; + b = -0.0f / 0.0f; + break; + } + return a <= b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fdiv.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fdiv { + + public static float test(float a, float b) { + return a / b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(31.1f, test(311.0f, 10f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fload { + + public static float test(float arg) { + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-1f, test(-1f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1.01f, test(-1.01f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fload_2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fload_2 { + + @SuppressWarnings("unused") + public static float test(float i, float arg) { + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-1f, test(0f, -1f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1.01f, test(0f, -1.01f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fmul.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fmul { + + public static float test(float a, float b) { + return a * b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3110.0f, test(311.0f, 10f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(22.4f, test(11.2f, 2.0f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fneg.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fneg { + + public static float test(float a) { + return -a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-0.0f, test(0.0f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1.01f, test(-1.01f), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-7263.8734f, test(7263.8734f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_frem.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +public class BC_frem { + + public static float test(float a, float b) { + return a % b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1.0f, test(311.0f, 10f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0.5f, test(12.5f, 6.0f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_freturn.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_freturn { + + public static float test(float a) { + return a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0f, test(0.0f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1.1f, test(1.1f), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1.4f, test(-1.4f), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(256.33f, test(256.33f), 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(1000.001f, test(1000.001f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_fsub.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_fsub { + + public static float test(float a, float b) { + return a - b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0f, test(0.0f, 0.0f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0.0f, test(1.0f, 1.0f), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(198.68f, test(253.11f, 54.43f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_getfield.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_getfield { + + private static BC_getfield object = new BC_getfield(); + + private int field = 13; + + public static int test() { + return object.field; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(13, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_getstatic_b.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_getstatic_b { + + private static byte field = 11; + + public static byte test() { + return field; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((byte) 11), test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_getstatic_c.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_getstatic_c { + + private static char field = 11; + + public static char test() { + return field; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((char) 11), test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_getstatic_d.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_getstatic_d { + + private static double field = 11; + + public static double test() { + return field; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11d, test(), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_getstatic_f.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_getstatic_f { + + private static float field = 11; + + public static float test() { + return field; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11f, test(), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_getstatic_i.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_getstatic_i { + + private static int field = 11; + + public static int test() { + return field; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_getstatic_l.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_getstatic_l { + + private static long field = 11; + + public static long test() { + return field; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11L, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_getstatic_s.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_getstatic_s { + + private static short field = 11; + + public static short test() { + return field; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((short) 11), test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_getstatic_z.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_getstatic_z { + + private static boolean field = true; + + public static boolean test() { + return field; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_i2b.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_i2b { + + public static byte test(int a) { + return (byte) a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((byte) -1), test(-1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((byte) 2), test(2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((byte) -1), test(255)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(((byte) -128), test(128)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_i2c.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_i2c { + + public static char test(int a) { + return (char) a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((char) 65535), test(-1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((char) 645), test(645)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((char) 65535), test(65535)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_i2d.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_i2d { + + public static double test(int a) { + return a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0d, test(0), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1.0d, test(1), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-34.0d, test(-34), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_i2f.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_i2f { + + public static float test(int a) { + return a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0f, test(0), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1.0f, test(1), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-34.0f, test(-34), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_i2l.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_i2l { + + public static long test(int a) { + return a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1L, test(1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2L, test(2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(3L, test(3)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-1L, test(-1)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-2147483647L, test(-2147483647)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(-2147483648L, test(-2147483648)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(2147483647L, test(2147483647)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_i2s.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_i2s { + + public static short test(int a) { + return (short) a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((short) -1), test(-1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((short) 34), test(34)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((short) -1), test(65535)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(((short) -32768), test(32768)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iadd.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iadd { + + public static int test(int a, int b) { + return a + b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3, test(1, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(0, -1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(100, test(33, 67)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(1, -1)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-2147483647, test(-2147483648, 1)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(-2147483648, test(2147483647, 1)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(2147483647, test(-2147483647, -2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iadd2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iadd2 { + + public static int test(byte a, byte b) { + return a + b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3, test(((byte) 1), ((byte) 2))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(((byte) 0), ((byte) -1))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(100, test(((byte) 33), ((byte) 67))); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(((byte) 1), ((byte) -1))); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-127, test(((byte) -128), ((byte) 1))); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(128, test(((byte) 127), ((byte) 1))); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iadd3.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iadd3 { + + public static int test(short a, short b) { + return a + b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3, test(((short) 1), ((short) 2))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(((short) 0), ((short) -1))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(100, test(((short) 33), ((short) 67))); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(((short) 1), ((short) -1))); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-127, test(((short) -128), ((short) 1))); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(128, test(((short) 127), ((short) 1))); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(-32767, test(((short) -32768), ((short) 1))); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(32768, test(((short) 32767), ((short) 1))); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iaload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iaload { + + static int[] array = {0, -1, 4, 1000000000}; + + public static int test(int arg) { + return array[arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(4, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1000000000, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iand.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iand { + + public static int test(int a, int b) { + return a & b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(1, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(0, -1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(31, test(31, 63)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(4, test(6, 4)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0, test(-2147483648, 1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iastore.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iastore { + + static int[] array = {0, 0, 0, 0}; + + public static int test(int arg, int val) { + array[arg] = val; + return array[arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0, 0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(1, -1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(11, test(2, 11)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-14, test(3, -14)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iconst.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iconst { + + public static int test(int arg) { + if (arg == 0) { + return 0; + } + if (arg == 1) { + return 1; + } + if (arg == 2) { + return 2; + } + if (arg == 3) { + return 3; + } + if (arg == 4) { + return 4; + } + if (arg == 5) { + return 5; + } + return 375; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(3, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(4, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(5, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(375, test(6)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_idiv.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_idiv { + + public static int test(int a, int b) { + return a / b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(1, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-2, test(2, -1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(64, test(256, 4)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(19, test(135, 7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_idiv2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_idiv2 { + + public static int test(int a, int b) { + return a / b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-2147483648, test(-2147483648, -1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-2147483648, test(-2147483648, 1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ifeq.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ifeq { + + public static int test(int a) { + int n = 0; + if (a == 0) { + n += 1; + } else { + n -= 1; + } + if (a != 0) { + n -= 1; + } else { + n += 1; + } + return n; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(2, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-2, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ifeq_2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ifeq_2 { + + public static boolean test(int a) { + return a == 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ifeq_3.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ifeq_3 { + + public static boolean test(int a) { + return a != 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ifge.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ifge { + + public static int test(int a) { + int n = 0; + if (a >= 0) { + n += 1; + } else { + n -= 1; + } + if (a < 0) { + n -= 1; + } else { + n += 1; + } + return n; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(2, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-2, test(-1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ifge_2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ifge_2 { + + public static boolean test(int a, int b) { + return a >= b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0, 1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1, 0)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(1, 1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(0, -100)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(-1, 0)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(-12, -12)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ifge_3.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ifge_3 { + + public static boolean test(int a, int b) { + return a < b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0, 1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1, 0)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(1, 1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(0, -100)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(-1, 0)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(-12, -12)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ifgt.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ifgt { + + public static int test(int a) { + int n = 0; + if (a > 0) { + n += 1; + } else { + n -= 1; + } + if (a <= 0) { + n -= 1; + } else { + n += 1; + } + return n; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-2, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-2, test(-1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ificmplt1.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ificmplt1 { + + public static int test(int a) { + return a < 1 ? 12 : 13; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(12, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(13, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(13, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ificmplt2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ificmplt2 { + + public static int test(int a) { + return a > 1 ? 13 : 12; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(12, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(12, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(13, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ificmpne1.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ificmpne1 { + + public static int test(int a) { + return a == 1 ? 12 : 13; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(13, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(12, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(13, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ificmpne2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ificmpne2 { + + public static int test(int a) { + return a != 1 ? 13 : 12; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(13, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(12, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(13, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ifle.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ifle { + + public static int test(int a) { + int n = 0; + if (a <= 0) { + n += 1; + } else { + n -= 1; + } + if (a > 0) { + n -= 1; + } else { + n += 1; + } + return n; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(2, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-2, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(-1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iflt.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iflt { + + public static int test(int a) { + int n = 0; + if (a < 0) { + n += 1; + } else { + n -= 1; + } + if (a >= 0) { + n -= 1; + } else { + n += 1; + } + return n; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-2, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-2, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(-1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ifne.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ifne { + + public static int test(int a) { + int n = 0; + if (a != 0) { + n += 1; + } else { + n -= 1; + } + if (a == 0) { + n -= 1; + } else { + n += 1; + } + return n; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-2, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ifnonnull.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ifnonnull { + + public static int test(Object a) { + int n = 0; + if (a == null) { + n += 1; + } else { + n -= 1; + } + if (a != null) { + n -= 1; + } else { + n += 1; + } + return n; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(2, test(null)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-2, test("")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ifnonnull_2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ifnonnull_2 { + + public static boolean test(Object a) { + return a != null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(null)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test("")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ifnonnull_3.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ifnonnull_3 { + + public static int test(Object a) { + if (a != null) { + return 1; + } + return 2; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(2, test(null)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test("")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ifnull.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ifnull { + + public static int test(Object a) { + int n = 0; + if (a != null) { + n += 1; + } else { + n -= 1; + } + if (a == null) { + n -= 1; + } else { + n += 1; + } + return n; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-2, test(null)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test("")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ifnull_2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ifnull_2 { + + public static boolean test(Object a) { + return a == null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(null)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test("")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ifnull_3.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ifnull_3 { + + public static int test(Object a) { + if (a == null) { + return 1; + } + return 2; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1, test(null)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test("")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iinc_1.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iinc_1 { + + public static int test(int a) { + int arg = a; + arg += 1; + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(2, test(1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(3, test(2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(5, test(4)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(-1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iinc_2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iinc_2 { + + public static int test(int a) { + int arg = a; + arg += 2; + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3, test(1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(4, test(2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(6, test(4)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(-2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iinc_3.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iinc_3 { + + public static int test(int a) { + int arg = a; + arg += 51; + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(52, test(1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(53, test(2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(55, test(4)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(50, test(-1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iinc_4.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iinc_4 { + + public static int test(int a) { + int arg = a; + arg += 512; + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(513, test(1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(514, test(2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(516, test(4)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(511, test(-1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iload_0.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iload_0 { + + public static int test(int arg) { + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(-1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1000345, test(1000345)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iload_0_1.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iload_0_1 { + + public static int test(int arg) { + return arg + 1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(-1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(3, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1000346, test(1000345)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iload_0_2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iload_0_2 { + + public static int test(int arg) { + int i = arg; + return i; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(-1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1000345, test(1000345)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iload_1.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iload_1 { + + @SuppressWarnings("unused") + public static int test(int i, int arg) { + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(1, 0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(1, -1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(1, 2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1000345, test(1, 1000345)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iload_1_1.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iload_1_1 { + + public static int test(int i) { + int arg = 0; + return i + arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(-1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1000345, test(1000345)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iload_2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iload_2 { + + @SuppressWarnings("unused") + public static int test(int i, int j, int arg) { + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(1, 1, 0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(1, 1, -1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(1, 1, 2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1000345, test(1, 1, 1000345)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iload_3.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iload_3 { + + @SuppressWarnings("unused") + public static int test(int i, int j, int k, int arg) { + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(1, 1, 1, 0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(1, 1, 1, -1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(1, 1, 1, 2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1000345, test(1, 1, 1, 1000345)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_imul.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_imul { + + public static int test(int a, int b) { + return a * b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(2, test(1, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(0, -1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2211, test(33, 67)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-1, test(1, -1)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-2147483648, test(-2147483648, 1)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(-2147483647, test(2147483647, -1)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(-2147483648, test(-2147483648, -1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ineg.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ineg { + + public static int test(int a) { + return -a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(-1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-7263, test(7263)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-2147483648, test(-2147483648)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_instanceof.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_instanceof { + + static Object object2 = new Object(); + static Object object3 = ""; + static Object object4 = new BC_instanceof(); + + public static boolean test(int arg) { + Object obj; + if (arg == 2) { + obj = object2; + } else if (arg == 3) { + obj = object3; + } else if (arg == 4) { + obj = object4; + } else { + obj = null; + } + return obj instanceof BC_instanceof; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_invokeinterface.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_invokeinterface { + + public interface ITest { + + int id(int a); + } + + static class IClass implements ITest { + + public int id(int a) { + return a; + } + } + + static ITest object = new IClass(); + + public static int test(int a) { + return object.id(a); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(3, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-4, test(-4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_invokespecial.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_invokespecial { + + static BC_invokespecial object = new BC_invokespecial(); + + public static int test(int a) { + return object.id(a); + } + + @SuppressWarnings("static-method") + private int id(int i) { + return i; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(3, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-4, test(-4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_invokespecial2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_invokespecial2 { + + static BC_invokespecial2 object = new BC_invokespecial2(); + + public static int test(int a) { + return 3 + object.id(a); + } + + @SuppressWarnings("static-method") + private int id(int i) { + return 4 + i; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(7, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(8, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(9, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(10, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(3, test(-4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_invokestatic.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_invokestatic { + + public static int test(int a) { + return id(a); + } + + public static int id(int i) { + return i; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(3, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-4, test(-4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_invokevirtual.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_invokevirtual { + + static BC_invokevirtual object = new BC_invokevirtual(); + + public static int test(int a) { + return object.id(a); + } + + public int id(int i) { + return i; + } + + public static void main(String[] args) { + test(0); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(3, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-4, test(-4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ior.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ior { + + public static int test(int a, int b) { + return a | b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3, test(1, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(0, -1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(63, test(31, 63)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(6, test(6, 4)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-2147483647, test(-2147483648, 1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_irem.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_irem { + + public static int test(int a, int b) { + return a % b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1, test(1, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(2, -1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0, test(256, 4)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(2, test(135, 7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_irem2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_irem2 { + + public static int test(int a, int b) { + return a % b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(-2147483648, -1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(-2147483648, 1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_irem3.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_irem3 { + + public static int test(int a) { + return a % 1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(-1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0, test(1000)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(-2147483648)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0, test(2147483647)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ireturn.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ireturn { + + public static int test(int a) { + return a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test(-1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(256, test(256)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ishl.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ishl { + + public static int test(int a, int b) { + return a << b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(4, test(1, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(0, -1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(62, test(31, 1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(96, test(6, 4)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0, test(-2147483648, 1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ishr.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ishr { + + public static int test(int a, int b) { + return a >> b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(1, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(16, test(67, 2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(15, test(31, 1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(6, 4)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-32768, test(-2147483648, 16)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_isub.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_isub { + + public static int test(int a, int b) { + return a - b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3, test(1, -2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(0, 1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(100, test(33, -67)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(1, 1)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-2147483647, test(-2147483648, -1)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(-2147483648, test(2147483647, -1)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(2147483647, test(-2147483647, 2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_iushr.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_iushr { + + public static int test(int a, int b) { + return a >>> b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(1, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(16, test(67, 2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(15, test(31, 1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(6, 4)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(32768, test(-2147483648, 16)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ixor.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ixor { + + public static int test(int a, int b) { + return a ^ b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3, test(1, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(0, -1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(32, test(31, 63)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(2, test(6, 4)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-2147483647, test(-2147483648, 1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_l2d.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_l2d { + + public static double test(long a) { + return a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0D, test(0L), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1.0D, test(1L), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-74652389.00D, test(-74652389L), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_l2f.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_l2f { + + public static float test(long a) { + return a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0f, test(0L), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1.0f, test(1L), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-74652389.00f, test(-74652389L), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_l2i.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + * TODO: test roundoff behavior + */ +public class BC_l2i { + + public static int test(long a) { + return (int) a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1, test(1L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test(2L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(3, test(3L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-1, test(-1L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-2147483647, test(-2147483647L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(-2147483648, test(-2147483648L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(2147483647, test(2147483647L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_l2i_2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_l2i_2 { + + static Object[] array = {null}; + + public static Object test(long a) { + long arg = a; + arg = arg << 32; + return array[(int) arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(null, test(1L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(null, test(123456789L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ladd.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ladd { + + public static long test(long a, long b) { + return a + b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3L, test(1L, 2L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1L, test(0L, -1L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(100L, test(33L, 67L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0L, test(1L, -1L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-2147483647L, test(-2147483648L, 1L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(2147483648L, test(2147483647L, 1L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(-2147483649L, test(-2147483647L, -2L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ladd2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ladd2 { + + public static long test(int a, int b) { + return a + (long) b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3L, test(1, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1L, test(0, -1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(100L, test(33, 67)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0L, test(1, -1)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-2147483647L, test(-2147483648, 1)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(2147483648L, test(2147483647, 1)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(-2147483649L, test(-2147483647, -2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_laload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_laload { + + static long[] array = {0L, -1L, 4L, 1000000000000L}; + + public static long test(int arg) { + return array[arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1L, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(4L, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1000000000000L, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_land.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_land { + + public static long test(long a, long b) { + return a & b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(1L, 2L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0L, test(0L, -1L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(31L, test(31L, 63L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(4L, test(6L, 4L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0L, test(-2147483648L, 1L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lastore.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lastore { + + static long[] array = {0, 0, 0, 0}; + + public static long test(int arg, long val) { + final long[] array2 = arg == -2 ? null : BC_lastore.array; + array2[arg] = val; + return array2[arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(0, 0L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1L, test(1, -1L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(11L, test(2, 11L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-14L, test(3, -14L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lcmp.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lcmp { + + public static boolean test(long a, long b) { + return a < b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0L, -1L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(77L, 78L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(-1L, 0L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ldc_01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ldc_01 { + + public static int test() { + return -123; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-123, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ldc_02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ldc_02 { + + public static float test() { + return -2.4f; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-2.4f, test(), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ldc_03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ldc_03 { + + public static long test() { + return -123L; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-123L, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ldc_04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ldc_04 { + + public static String test() { + return "xyz"; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("xyz", test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ldc_05.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ldc_05 { + + public static double test() { + return -2.33d; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-2.33d, test(), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ldc_06.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ldc_06 { + + public static String test() { + return test2().getName(); + } + + static Class<BC_ldc_06> test2() { + return BC_ldc_06.class; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("com.oracle.max.graal.jtt.bytecode.BC_ldc_06", test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ldiv.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ldiv { + + public static long test(long a, long b) { + return a / b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(1L, 2L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-2L, test(2L, -1L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(64L, test(256L, 4L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(19L, test(135L, 7L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_ldiv2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_ldiv2 { + + public static long test(long a, long b) { + return a / b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-9223372036854775808L, test(-9223372036854775808L, -1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-9223372036854775808L, test(-9223372036854775808L, 1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lload_0.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lload_0 { + + public static long test(long arg) { + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1L, test(1L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-3L, test(-3L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(10000L, test(10000L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lload_01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +@SuppressWarnings("unused") +public class BC_lload_01 { + + public static long test(int i) { + return test1(null); + } + + public static int test1(Object o0) { + long x = 1; + return 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0L, test(-3)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0L, test(100)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lload_1.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lload_1 { + + @SuppressWarnings("unused") + public static long test(int i, long arg) { + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1L, test(1, 1L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-3L, test(1, -3L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(10000L, test(1, 10000L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lload_2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lload_2 { + + @SuppressWarnings("unused") + public static long test(int i, int j, long arg) { + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1L, test(1, 1, 1L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-3L, test(1, 1, -3L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(10000L, test(1, 1, 10000L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lload_3.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lload_3 { + + @SuppressWarnings("unused") + public static long test(int i, int j, int k, long arg) { + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1L, test(1, 1, 1, 1L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-3L, test(1, 1, 1, -3L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(10000L, test(1, 1, 1, 10000L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lmul.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lmul { + + public static long test(long a, long b) { + return a * b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(2L, test(1L, 2L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0L, test(0L, -1L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2211L, test(33L, 67L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-1L, test(1L, -1L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-2147483648L, test(-2147483648L, 1L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(-2147483647L, test(2147483647L, -1L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(2147483648L, test(-2147483648L, -1L)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(1000000000000L, test(1000000L, 1000000L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lneg.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lneg { + + public static long test(long a) { + return -a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(0L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1L, test(-1L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-7263L, test(7263L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(2147483648L, test(-2147483648L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lookupswitch01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lookupswitch01 { + + public static int test(int a) { + switch (a) { + case 67: + return 0; + case 97: + return 1; + case 107: + return 2; + case 133: + return 3; + case 212: + return 4; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(42, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(42, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(42, test(66)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(67)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(42, test(68)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(42, test(96)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(1, test(97)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(42, test(98)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(42, test(106)); + } + + @Test + public void run9() throws Throwable { + Assert.assertEquals(2, test(107)); + } + + @Test + public void run10() throws Throwable { + Assert.assertEquals(42, test(108)); + } + + @Test + public void run11() throws Throwable { + Assert.assertEquals(42, test(132)); + } + + @Test + public void run12() throws Throwable { + Assert.assertEquals(3, test(133)); + } + + @Test + public void run13() throws Throwable { + Assert.assertEquals(42, test(134)); + } + + @Test + public void run14() throws Throwable { + Assert.assertEquals(42, test(211)); + } + + @Test + public void run15() throws Throwable { + Assert.assertEquals(4, test(212)); + } + + @Test + public void run16() throws Throwable { + Assert.assertEquals(42, test(213)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lookupswitch02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lookupswitch02 { + + public static int test(int a) { + final int b = a; + switch (b) { + case 67: + return 0; + case 97: + return 1; + case 107: + return 2; + case 133: + return 3; + case 212: + return 4; + case -122: + return 5; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(42, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(42, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(42, test(66)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(67)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(42, test(68)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(42, test(96)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(1, test(97)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(42, test(98)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(42, test(106)); + } + + @Test + public void run9() throws Throwable { + Assert.assertEquals(2, test(107)); + } + + @Test + public void run10() throws Throwable { + Assert.assertEquals(42, test(108)); + } + + @Test + public void run11() throws Throwable { + Assert.assertEquals(42, test(132)); + } + + @Test + public void run12() throws Throwable { + Assert.assertEquals(3, test(133)); + } + + @Test + public void run13() throws Throwable { + Assert.assertEquals(42, test(134)); + } + + @Test + public void run14() throws Throwable { + Assert.assertEquals(42, test(211)); + } + + @Test + public void run15() throws Throwable { + Assert.assertEquals(4, test(212)); + } + + @Test + public void run16() throws Throwable { + Assert.assertEquals(42, test(213)); + } + + @Test + public void run17() throws Throwable { + Assert.assertEquals(42, test(-121)); + } + + @Test + public void run18() throws Throwable { + Assert.assertEquals(5, test(-122)); + } + + @Test + public void run19() throws Throwable { + Assert.assertEquals(42, test(-123)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lookupswitch03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lookupswitch03 { + + public static int test(int a) { + final int b = a + 10; + switch (b) { + case 77: + return 0; + case 107: + return 1; + case 117: + return 2; + case 143: + return 3; + case 222: + return 4; + case -112: + return 5; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(42, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(42, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(42, test(66)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(67)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(42, test(68)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(42, test(96)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(1, test(97)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(42, test(98)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(42, test(106)); + } + + @Test + public void run9() throws Throwable { + Assert.assertEquals(2, test(107)); + } + + @Test + public void run10() throws Throwable { + Assert.assertEquals(42, test(108)); + } + + @Test + public void run11() throws Throwable { + Assert.assertEquals(42, test(132)); + } + + @Test + public void run12() throws Throwable { + Assert.assertEquals(3, test(133)); + } + + @Test + public void run13() throws Throwable { + Assert.assertEquals(42, test(134)); + } + + @Test + public void run14() throws Throwable { + Assert.assertEquals(42, test(211)); + } + + @Test + public void run15() throws Throwable { + Assert.assertEquals(4, test(212)); + } + + @Test + public void run16() throws Throwable { + Assert.assertEquals(42, test(213)); + } + + @Test + public void run17() throws Throwable { + Assert.assertEquals(42, test(-121)); + } + + @Test + public void run18() throws Throwable { + Assert.assertEquals(5, test(-122)); + } + + @Test + public void run19() throws Throwable { + Assert.assertEquals(42, test(-123)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lookupswitch04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lookupswitch04 { + + public static int test(int a) { + final int b = a + 8; + final int c = b + 2; + switch (c) { + case 77: + return 0; + case 107: + return 1; + case 117: + return 2; + case 143: + return 3; + case 222: + return 4; + case -112: + return 5; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(42, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(42, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(42, test(66)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(67)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(42, test(68)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(42, test(96)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(1, test(97)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(42, test(98)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(42, test(106)); + } + + @Test + public void run9() throws Throwable { + Assert.assertEquals(2, test(107)); + } + + @Test + public void run10() throws Throwable { + Assert.assertEquals(42, test(108)); + } + + @Test + public void run11() throws Throwable { + Assert.assertEquals(42, test(132)); + } + + @Test + public void run12() throws Throwable { + Assert.assertEquals(3, test(133)); + } + + @Test + public void run13() throws Throwable { + Assert.assertEquals(42, test(134)); + } + + @Test + public void run14() throws Throwable { + Assert.assertEquals(42, test(211)); + } + + @Test + public void run15() throws Throwable { + Assert.assertEquals(4, test(212)); + } + + @Test + public void run16() throws Throwable { + Assert.assertEquals(42, test(213)); + } + + @Test + public void run17() throws Throwable { + Assert.assertEquals(42, test(-121)); + } + + @Test + public void run18() throws Throwable { + Assert.assertEquals(5, test(-122)); + } + + @Test + public void run19() throws Throwable { + Assert.assertEquals(42, test(-123)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lookupswitch05.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lookupswitch05 { + + public static Object test(int a) { + switch (a) { + default: + return new String(); + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("", test(0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lor.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lor { + + public static long test(long a, long b) { + return a | b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3L, test(1L, 2L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1L, test(0L, -1L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(63L, test(31L, 63L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(6L, test(6L, 4L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-2147483647L, test(-2147483648L, 1L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lrem.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lrem { + + public static long test(long a, long b) { + return a % b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1L, test(1L, 2L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0L, test(2L, -1L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0L, test(256L, 4L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(2L, test(135L, 7L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lrem2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lrem2 { + + public static long test(long a, long b) { + return a % b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(-9223372036854775808L, -1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0L, test(-9223372036854775808L, 1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lreturn.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lreturn { + + public static long test(long a) { + return a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(0L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1L, test(1L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1L, test(-1L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(256L, test(256L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(1000000000000L, test(1000000000000L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lshl.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lshl { + + public static long test(long a, int b) { + return a << b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(4L, test(1L, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0L, test(0L, -1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(62L, test(31L, 1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(96L, test(6L, 4)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-4294967296L, test(-2147483648L, 1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lshr.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lshr { + + public static long test(long a, int b) { + return a >> b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(1L, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(16L, test(67L, 2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(15L, test(31L, 1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0L, test(6L, 4)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-32768L, test(-2147483648L, 16)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lsub.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lsub { + + public static long test(long a, long b) { + return a - b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3L, test(1L, -2L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1L, test(0L, 1L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(100L, test(33L, -67L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0L, test(1L, 1L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-2147483647L, test(-2147483648L, -1L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(2147483648L, test(2147483647L, -1L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(-2147483649L, test(-2147483647L, 2L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lushr.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lushr { + + public static long test(long a, int b) { + return a >>> b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(1L, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(16L, test(67L, 2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(15L, test(31L, 1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0L, test(6L, 4)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(281474976677888L, test(-2147483648L, 16)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_lxor.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_lxor { + + public static long test(long a, long b) { + return a ^ b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3L, test(1L, 2L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1L, test(0L, -1L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(32L, test(31L, 63L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(2L, test(6L, 4L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-2147483647L, test(-2147483648L, 1L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_monitorenter.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_monitorenter { + + static BC_monitorenter object = new BC_monitorenter(); + + public static int test(int arg) { + synchronized (object) { + return arg; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-2, test(-2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_monitorenter02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_monitorenter02 { + + static BC_monitorenter02 object = new BC_monitorenter02(); + + public static int test(int arg, int arg2) { + int result = arg; + synchronized (object) { + result = arg / arg2; + } + synchronized (object) { + result = arg / arg2; + } + return result; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0, 1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1, 1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-2, test(-2, 1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_multianewarray01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_multianewarray01 { + + public static int test(int a) { + final BC_multianewarray01[][] v = new BC_multianewarray01[3][3]; + return v != null ? a : -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_multianewarray02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_multianewarray02 { + + public static int test(int a) { + final BC_multianewarray02[][][][] v = new BC_multianewarray02[3][3][3][3]; + return v != null ? a : -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_multianewarray03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_multianewarray03 { + + public static int test(int a) { + final BC_multianewarray03[][][][] v = new BC_multianewarray03[a][a][a][a]; + return v.length + v[0].length + v[0][0].length + v[0][0][0].length; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(4, test(1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(8, test(2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_multianewarray04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_multianewarray04 { + + public static int test(int a) { + int i = 1; + + i += test_byte(a); + i += test_boolean(a); + i += test_char(a); + i += test_short(a); + i += test_int(a); + i += test_float(a); + i += test_long(a); + i += test_double(a); + + return i; + } + + private static int test_double(int a) { + double[][] b2 = new double[a][a]; + double[][][] b3 = new double[a][a][a]; + double[][][][] b4 = new double[a][a][a][a]; + double[][][][][] b5 = new double[a][a][a][a][a]; + double[][][][][][] b6 = new double[a][a][a][a][a][a]; + return b2.length + b3.length + b4.length + b5.length + b6.length; + } + + private static int test_long(int a) { + long[][] b2 = new long[a][a]; + long[][][] b3 = new long[a][a][a]; + long[][][][] b4 = new long[a][a][a][a]; + long[][][][][] b5 = new long[a][a][a][a][a]; + long[][][][][][] b6 = new long[a][a][a][a][a][a]; + return b2.length + b3.length + b4.length + b5.length + b6.length; + } + + private static int test_float(int a) { + float[][] b2 = new float[a][a]; + float[][][] b3 = new float[a][a][a]; + float[][][][] b4 = new float[a][a][a][a]; + float[][][][][] b5 = new float[a][a][a][a][a]; + float[][][][][][] b6 = new float[a][a][a][a][a][a]; + return b2.length + b3.length + b4.length + b5.length + b6.length; + } + + private static int test_int(int a) { + int[][] b2 = new int[a][a]; + int[][][] b3 = new int[a][a][a]; + int[][][][] b4 = new int[a][a][a][a]; + int[][][][][] b5 = new int[a][a][a][a][a]; + int[][][][][][] b6 = new int[a][a][a][a][a][a]; + return b2.length + b3.length + b4.length + b5.length + b6.length; + } + + private static int test_short(int a) { + short[][] b2 = new short[a][a]; + short[][][] b3 = new short[a][a][a]; + short[][][][] b4 = new short[a][a][a][a]; + short[][][][][] b5 = new short[a][a][a][a][a]; + short[][][][][][] b6 = new short[a][a][a][a][a][a]; + return b2.length + b3.length + b4.length + b5.length + b6.length; + } + + private static int test_char(int a) { + char[][] b2 = new char[a][a]; + char[][][] b3 = new char[a][a][a]; + char[][][][] b4 = new char[a][a][a][a]; + char[][][][][] b5 = new char[a][a][a][a][a]; + char[][][][][][] b6 = new char[a][a][a][a][a][a]; + return b2.length + b3.length + b4.length + b5.length + b6.length; + } + + private static int test_boolean(int a) { + boolean[][] b2 = new boolean[a][a]; + boolean[][][] b3 = new boolean[a][a][a]; + boolean[][][][] b4 = new boolean[a][a][a][a]; + boolean[][][][][] b5 = new boolean[a][a][a][a][a]; + boolean[][][][][][] b6 = new boolean[a][a][a][a][a][a]; + return b2.length + b3.length + b4.length + b5.length + b6.length; + } + + private static int test_byte(int a) { + byte[][] b2 = new byte[a][a]; + byte[][][] b3 = new byte[a][a][a]; + byte[][][][] b4 = new byte[a][a][a][a]; + byte[][][][][] b5 = new byte[a][a][a][a][a]; + byte[][][][][][] b6 = new byte[a][a][a][a][a][a]; + return b2.length + b3.length + b4.length + b5.length + b6.length; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(41, test(1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(81, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_new.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_new { + + @SuppressWarnings("unused") + public static int test(int a) { + new BC_new(); + return a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_newarray.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_newarray { + + public static int test(int a) { + if (new boolean[3] == null) { + return -1; + } + if (new char[3] == null) { + return -1; + } + if (new float[3] == null) { + return -1; + } + if (new double[3] == null) { + return -1; + } + if (new byte[3] == null) { + return -1; + } + if (new short[3] == null) { + return -1; + } + if (new int[3] == null) { + return -1; + } + if (new long[3] == null) { + return -1; + } + + return a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_putfield.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_putfield { + + private static BC_putfield object = new BC_putfield(); + + private int field; + + public static int test(int arg) { + object.field = arg; + return object.field; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-4, test(-4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_putstatic.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_putstatic { + + private static int field; + + public static int test(int a) { + field = a; + return field; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(3, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-4, test(-4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_saload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_saload { + + static short[] array = {0, -1, 4, 10000}; + + public static short test(int arg) { + return array[arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((short) 0), test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((short) -1), test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((short) 4), test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(((short) 10000), test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_sastore.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_sastore { + + static short[] array = {0, 0, 0, 0}; + + public static short test(int arg, short val) { + array[arg] = val; + return array[arg]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((short) 0), test(0, ((short) 0))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((short) -1), test(1, ((short) -1))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((short) 11), test(2, ((short) 11))); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(((short) -14), test(3, ((short) -14))); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_tableswitch.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_tableswitch { + + public static int test(int a) { + switch (a) { + case 0: + return 10; + case 1: + return 20; + case 2: + return 30; + case 4: + return 40; + case 5: + return 50; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(42, test(-1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(10, test(0)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(20, test(1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(30, test(2)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(42, test(3)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(40, test(4)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(50, test(5)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(42, test(6)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_tableswitch2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_tableswitch2 { + + public static int test(int a) { + switch (a) { + case 5: + return 55; + case 6: + return 66; + case 7: + return 77; + } + return 11; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11, test(-1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11, test(0)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(11, test(1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(55, test(5)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(66, test(6)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(77, test(7)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(11, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_tableswitch3.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_tableswitch3 { + + public static int test(int a) { + switch (a) { + case -2: + return 22; + case -1: + return 11; + case 0: + return 33; + case 1: + return 77; + } + return 99; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11, test(-1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(22, test(-2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(99, test(-3)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(99, test(-4)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(77, test(1)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(99, test(2)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(99, test(10)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_tableswitch4.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_tableswitch4 { + + public static int test(int a) { + switch (a) { + case -5: + return 55; + case -4: + return 44; + case -3: + return 33; + } + return 11; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11, test(-1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11, test(0)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(11, test(1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(55, test(-5)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(44, test(-4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(33, test(-3)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(11, test(-8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_wide01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_wide01 { + + @SuppressWarnings("unused") + public static int test(int arg) { + + // Checkstyle: stop + long i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15; + long j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; + long k0, k1, k2, k3, k4, k5, k6, k7, k8, k9, k10, k11, k12, k13, k14, k15; + long l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15; + long m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15; + long n0, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15; + long o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15; + long p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15; + long q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14, q15; + long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15; + // Checkstyle: resume + + int i255 = 10; + return arg + i255 + 1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(12, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/bytecode/BC_wide02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.bytecode; + +import org.junit.*; + +/* + */ +public class BC_wide02 { + + @SuppressWarnings("unused") + public static int test(int arg) { + + // Checkstyle: stop + long i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15; + long j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; + long k0, k1, k2, k3, k4, k5, k6, k7, k8, k9, k10, k11, k12, k13, k14, k15; + long l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15; + long m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15; + long n0, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15; + long o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15; + long p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15; + long q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14, q15; + long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15; + // Checkstyle: resume + + int i255 = 9; + i255++; + return arg + i255 + 1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(12, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_aaload0.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_aaload0 { + + static Object[] array = {null, null, ""}; + + public static Object test(int arg) { + final Object[] obj = arg == -2 ? null : array; + return obj[arg]; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(-2); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(null, test(0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_aaload1.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class BC_aaload1 { + + static Object[] array = {null, null, ""}; + + public static Object test(int arg) { + final Object[] obj = arg == -2 ? null : array; + try { + return obj[arg]; + } catch (NullPointerException e) { + return null; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(null, test(-2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(null, test(0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_aastore0.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_aastore0 { + + static Object[] param = {new Object(), null, "h"}; + static Object[] arr = {null, null, null}; + static String[] arr2 = {null, null, null}; + + public static int test(boolean a, int indx) { + Object[] array = a ? arr : arr2; + Object val; + if (indx == -2) { + array = null; + val = null; + } else { + val = param[indx]; + } + array[indx] = val; + return indx; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(true, -2); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(true, -1); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0, test(true, 0)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1, test(true, 1)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(2, test(true, 2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run5() throws Throwable { + test(true, 3); + } + + @Test(expected = java.lang.ArrayStoreException.class) + public void run6() throws Throwable { + test(false, 0); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(1, test(false, 1)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(2, test(false, 2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run9() throws Throwable { + test(false, 3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_aastore1.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class BC_aastore1 { + + static Object[] param = {new Object(), null, "h"}; + static Object[] arr = {null, null, null}; + static String[] arr2 = {null, null, null}; + + public static int test(boolean a, int indx) { + try { + Object[] array = a ? arr : arr2; + Object val; + if (indx == -2) { + array = null; + val = null; + } else { + val = param[indx]; + } + array[indx] = val; + return indx; + } catch (NullPointerException e) { + return 5; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(5, test(true, -2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(true, -1); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0, test(true, 0)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1, test(true, 1)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(2, test(true, 2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run5() throws Throwable { + test(true, 3); + } + + @Test(expected = java.lang.ArrayStoreException.class) + public void run6() throws Throwable { + test(false, 0); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(1, test(false, 1)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(2, test(false, 2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run9() throws Throwable { + test(false, 3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_anewarray.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class BC_anewarray { + + @SuppressWarnings("unused") + public static int test(int a) { + final BC_anewarray[] v = new BC_anewarray[a]; + if (v != null) { + return a; + } + return -1; + } + + @Test(expected = java.lang.NegativeArraySizeException.class) + public void run0() throws Throwable { + test(-1); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_arraylength.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_arraylength { + + static int[] arr = {1, 2, 3}; + static char[] arr2 = {'a', 'b', 'c', 'd'}; + static Object[] arr3 = new Object[5]; + + @SuppressWarnings("all") + public static int test(int arg) { + if (arg == 0) { + int[] array = null; + return array.length; + } + if (arg == 1) { + return arr.length; + } + if (arg == 2) { + return arr2.length; + } + if (arg == 3) { + return arr3.length; + } + return 42; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(3, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(4, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(5, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(42, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_athrow0.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_athrow0 { + + static Throwable throwable = new Throwable(); + + public static int test(int arg) throws Throwable { + if (arg == 2) { + throw throwable; + } + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test(expected = java.lang.Throwable.class) + public void run1() throws Throwable { + test(2); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_athrow1.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class BC_athrow1 { + + static Throwable throwable = new Throwable(); + + public static int test(int arg) throws Throwable { + if (arg == 2) { + throw throwable; + } + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test(expected = java.lang.Throwable.class) + public void run2() throws Throwable { + test(2); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(3, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_athrow2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_athrow2 { + + static Throwable throwable = new Throwable(); + + public static int test(int arg) throws Throwable { + if (arg == 2) { + throw throwable; + } else if (arg == 3) { + throw null; + } + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test(expected = java.lang.Throwable.class) + public void run1() throws Throwable { + test(2); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run2() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_athrow3.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_athrow3 { + + static Throwable throwable = new Throwable(); + + public static int test(int arg) throws Throwable { + if (arg == 2) { + throw2(); + } else if (arg == 3) { + throw1(); + } + return arg; + } + + private static void throw2() throws Throwable { + throw throwable; + } + + private static void throw1() throws Throwable { + throw null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test(expected = java.lang.Throwable.class) + public void run1() throws Throwable { + test(2); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run2() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_baload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_baload { + + static boolean[] arr = {true, false, true, false}; + + public static boolean test(int arg) { + final boolean[] array = arg == -2 ? null : arr; + return array[arg]; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(-2); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_bastore.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_bastore { + + static boolean[] arr = {false, false, false, false}; + + public static boolean test(int arg, boolean val) { + final boolean[] array = arg == -2 ? null : arr; + array[arg] = val; + return array[arg]; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(-2, true); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1, false); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(0, true)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(4, true); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_caload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_caload { + + static char[] arr = {'\000', 'a', ' ', 10000}; + + public static char test(int arg) { + final char[] array = arg == -2 ? null : arr; + return array[arg]; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(-2); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((char) 0), test(0)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_castore.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_castore { + + static char[] arr = {0, 0, 0, 0}; + + public static char test(int arg, char val) { + final char[] array = arg == -2 ? null : arr; + array[arg] = val; + return array[arg]; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(-2, ((char) 97)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1, ((char) 99)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((char) 97), test(0, ((char) 97))); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(4, ((char) 97)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_checkcast.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class BC_checkcast { + + static Object object2 = new Object(); + static Object object3 = ""; + static Object object4 = new BC_checkcast(); + + public static int test(int arg) { + Object obj = null; + if (arg == 2) { + obj = object2; + } + if (arg == 3) { + obj = object3; + } + if (arg == 4) { + obj = object4; + } + final BC_checkcast bc = (BC_checkcast) obj; + if (bc == null) { + return arg; + } + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test(expected = java.lang.ClassCastException.class) + public void run1() throws Throwable { + test(2); + } + + @Test(expected = java.lang.ClassCastException.class) + public void run2() throws Throwable { + test(3); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(4, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_checkcast1.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class BC_checkcast1 { + + static Object object2 = new Object(); + static Object object3 = ""; + static Object object4 = new BC_checkcast1(); + + public static int test(int arg) { + Object obj = null; + if (arg == 2) { + obj = object2; + } + if (arg == 3) { + obj = object3; + } + if (arg == 4) { + obj = object4; + } + final BC_checkcast1 bc = (BC_checkcast1) obj; + if (bc == null) { + return arg; + } + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test(expected = java.lang.ClassCastException.class) + public void run1() throws Throwable { + test(2); + } + + @Test(expected = java.lang.ClassCastException.class) + public void run2() throws Throwable { + test(3); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(4, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_checkcast2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class BC_checkcast2 { + + static Object object2 = new Object(); + static Object object3 = ""; + static Object object4 = new com.oracle.max.graal.jtt.except.BC_checkcast2(); + + public static int test(int arg) { + Object obj; + if (arg == 2) { + obj = object2; + } else if (arg == 3) { + obj = object3; + } else if (arg == 4) { + obj = object4; + } else { + obj = null; + } + final BC_checkcast2 bc = (BC_checkcast2) obj; + if (bc != null) { + return arg; + } + return -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-1, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(1)); + } + + @Test(expected = java.lang.ClassCastException.class) + public void run2() throws Throwable { + test(2); + } + + @Test(expected = java.lang.ClassCastException.class) + public void run3() throws Throwable { + test(3); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(4, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_checkcast3.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class BC_checkcast3 { + + static Object[] o1 = {new Object()}; + static String[] o2 = {""}; + static BC_checkcast3[] o3 = {new BC_checkcast3()}; + + public static int test(int arg) { + Object obj = null; + if (arg == 0) { + obj = o1; + } + if (arg == 1) { + obj = o2; + } + if (arg == 2) { + obj = o3; + } + Object[] r = (BC_checkcast3[]) obj; + return r == null ? -1 : -1; + } + + @Test(expected = java.lang.ClassCastException.class) + public void run0() throws Throwable { + test(0); + } + + @Test(expected = java.lang.ClassCastException.class) + public void run1() throws Throwable { + test(1); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-1, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_checkcast4.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +@SuppressWarnings("static-method") +public final class BC_checkcast4 { + + static Object object2 = new Object(); + static Object object3 = ""; + static Object object4 = new BC_checkcast4(); + + public static int test(int arg) { + Object obj; + if (arg == 2) { + obj = object2; + } else if (arg == 3) { + obj = object3; + } else if (arg == 4) { + obj = object4; + } else { + obj = null; + } + final BC_checkcast4 bc = (BC_checkcast4) obj; + if (bc != null) { + return arg; + } + return -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-1, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(1)); + } + + @Test(expected = java.lang.ClassCastException.class) + public void run2() throws Throwable { + test(2); + } + + @Test(expected = java.lang.ClassCastException.class) + public void run3() throws Throwable { + test(3); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(4, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_checkcast5.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class BC_checkcast5 { + + static Object object2 = new Object(); + static Object object3 = ""; + static Object object4 = new BC_checkcast5(); + + public static int test(int arg) { + Object obj; + if (arg == 2) { + obj = object2; + } else if (arg == 3) { + obj = object3; + } else if (arg == 4) { + obj = object4; + } else { + obj = null; + } + try { + final BC_checkcast5 bc = (BC_checkcast5) obj; + if (bc != null) { + return arg; + } + } catch (ClassCastException e) { + return -5; + } + return -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-1, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-5, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-5, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(4, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_checkcast6.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +@SuppressWarnings("static-method") +public final class BC_checkcast6 { + + static Object object2 = new Object(); + static Object object3 = ""; + static Object object4 = new BC_checkcast6(); + + public static int test(int arg) { + Object obj; + if (arg == 2) { + obj = object2; + } else if (arg == 3) { + obj = object3; + } else if (arg == 4) { + obj = object4; + } else { + obj = null; + } + try { + final BC_checkcast6 bc = (BC_checkcast6) obj; + if (bc != null) { + return arg; + } + } catch (ClassCastException e) { + return -5; + } + return -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-1, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-5, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-5, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(4, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_daload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_daload { + + static double[] arr = {0.0, -1.1, 4.32, 6.06}; + + public static double test(int arg) { + final double[] array = arg == -2 ? null : arr; + return array[arg]; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(-2); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0.0d, test(0), 0); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_dastore.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_dastore { + + static double[] arr = {0, 0, 0, 0}; + + public static double test(int arg, double val) { + final double[] array = arg == -2 ? null : arr; + array[arg] = val; + return array[arg]; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(-2, 0.01d); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1, -1.4d); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0.01d, test(0, 0.01d), 0); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(4, 0.01d); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_faload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_faload { + + static float[] arr = {0.0f, -1.1f, 4.32f, 6.06f}; + + public static float test(int arg) { + final float[] array = arg == -2 ? null : arr; + return array[arg]; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(-2); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0.0f, test(0), 0); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_fastore.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_fastore { + + static float[] arr = {0, 0, 0, 0}; + + public static float test(int arg, float val) { + final float[] array = arg == -2 ? null : arr; + array[arg] = val; + return array[arg]; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(-2, 0.01f); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1, -1.4f); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0.01f, test(0, 0.01f), 0); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(4, 0.01f); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_getfield.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_getfield { + + private static BC_getfield object = new BC_getfield(); + + private int field = 13; + + public static int test(int arg) { + final BC_getfield obj = (arg == 3) ? null : object; + return obj.field; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(13, test(0)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run1() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_iaload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_iaload { + + static int[] arr = {0, -1, 4, 1000000000}; + + public static int test(int arg) { + final int[] array = arg == -2 ? null : arr; + return array[arg]; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(-2); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_iastore.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_iastore { + + static int[] arr = {0, 0, 0, 0}; + + public static int test(int arg, int val) { + final int[] array = arg == -2 ? null : arr; + array[arg] = val; + return array[arg]; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(-2, 0); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1, 3); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0, test(0, 0)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(4, 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_idiv.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ + +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_idiv { + + public static int test(int a, int b) { + return a / b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(1, 2)); + } + + @Test(expected = java.lang.ArithmeticException.class) + public void run1() throws Throwable { + test(11, 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_idiv2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ + +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_idiv2 { + + public static int test(int a, int b) { + try { + return a / b; + } catch (Exception e) { + return -11; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(1, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-11, test(11, 0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_invokespecial01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +@SuppressWarnings("static-method") +public class BC_invokespecial01 { + + private static final BC_invokespecial01 obj = new BC_invokespecial01(); + + public static boolean test(int arg) { + BC_invokespecial01 object = null; + if (arg == 0) { + object = obj; + } + return object.method(); + } + + private boolean method() { + return true; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run1() throws Throwable { + test(1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_invokevirtual01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class BC_invokevirtual01 { + + private static final BC_invokevirtual01 obj = new BC_invokevirtual01(); + + public static boolean test(int arg) { + BC_invokevirtual01 object = null; + if (arg == 0) { + object = obj; + } + return object.method(); + } + + public boolean method() { + return true; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run1() throws Throwable { + test(1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_invokevirtual02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +@SuppressWarnings("static-method") +public class BC_invokevirtual02 { + + private static final BC_invokevirtual02 obj = new BC_invokevirtual02(); + + public static boolean test(int arg) { + BC_invokevirtual02 object = null; + if (arg == 0) { + object = obj; + } + return object.method(); + } + + public final boolean method() { + return true; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run1() throws Throwable { + test(1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_irem.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ + +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_irem { + + public static int test(int a, int b) { + return a % b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1, test(1, 2)); + } + + @Test(expected = java.lang.ArithmeticException.class) + public void run1() throws Throwable { + test(11, 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_laload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_laload { + + static long[] arr = {0L, -1L, 4L, 1000000000000L}; + + public static long test(int arg) { + final long[] array = arg == -2 ? null : arr; + return array[arg]; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(-2); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0L, test(0)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_lastore.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_lastore { + + static long[] arr = {0, 0, 0, 0}; + + public static long test(int arg, long val) { + final long[] array = arg == -2 ? null : arr; + array[arg] = val; + return array[arg]; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(-2, 0L); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1, 3L); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0L, test(0, 0L)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(4, 0L); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_ldiv.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ + +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_ldiv { + + public static long test(long a, long b) { + return a / b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(1L, 2L)); + } + + @Test(expected = java.lang.ArithmeticException.class) + public void run1() throws Throwable { + test(11L, 0L); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_ldiv2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ + +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_ldiv2 { + + public static long test(long a, long b) { + try { + return a / b; + } catch (Exception e) { + return -11; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(1L, 2L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-11L, test(11L, 0L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_lrem.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ + +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_lrem { + + public static long test(long a, long b) { + return a % b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1L, test(1L, 2L)); + } + + @Test(expected = java.lang.ArithmeticException.class) + public void run1() throws Throwable { + test(11L, 0L); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_monitorenter.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class BC_monitorenter { + + static com.oracle.max.graal.jtt.bytecode.BC_monitorenter object = new com.oracle.max.graal.jtt.bytecode.BC_monitorenter(); + + public static boolean test(boolean arg) { + final Object o = arg ? object : null; + synchronized (o) { + return arg; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(true)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run1() throws Throwable { + test(false); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_multianewarray.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class BC_multianewarray { + + @SuppressWarnings("unused") + public static int test(int a, int b) { + final BC_multianewarray[][] v = new BC_multianewarray[a][b]; + if (v != null) { + return a; + } + return -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0, 0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1, 1)); + } + + @Test(expected = java.lang.NegativeArraySizeException.class) + public void run2() throws Throwable { + test(-1, 0); + } + + @Test(expected = java.lang.NegativeArraySizeException.class) + public void run3() throws Throwable { + test(0, -1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_newarray.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class BC_newarray { + + public static int test(int a) { + if (new boolean[a] == null) { + return -1; + } + if (new char[a] == null) { + return -1; + } + if (new float[a] == null) { + return -1; + } + if (new double[a] == null) { + return -1; + } + if (new byte[a] == null) { + return -1; + } + if (new short[a] == null) { + return -1; + } + if (new int[a] == null) { + return -1; + } + if (new long[a] == null) { + return -1; + } + + return a; + } + + @Test(expected = java.lang.NegativeArraySizeException.class) + public void run0() throws Throwable { + test(-1); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(1, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_putfield.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_putfield { + + private static BC_putfield object = new BC_putfield(); + + private int field; + + public static int test(int arg) { + final BC_putfield obj = arg == 3 ? null : object; + obj.field = arg; + return obj.field; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run1() throws Throwable { + test(3); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-4, test(-4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_saload.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_saload { + + static short[] arr = {0, -1, 4, 10000}; + + public static short test(int arg) { + final short[] array = arg == -2 ? null : arr; + return array[arg]; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(-2); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((short) 0), test(0)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/BC_sastore.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class BC_sastore { + + static short[] arr = {0, 0, 0, 0}; + + public static short test(int arg, short val) { + final short[] array = arg == -2 ? null : arr; + array[arg] = val; + return array[arg]; + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(-2, ((short) 0)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(-1, ((short) 3)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((short) 0), test(0, ((short) 0))); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(4, ((short) 0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_Loop01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_Loop01 { + + public static int test(int arg) { + int accum = 0; + for (int i = 0; i < arg; i++) { + try { + accum += div(20, i); + } catch (ArithmeticException e) { + accum -= 100; + } + } + return accum; + } + + static int div(int a, int b) { + return a / (b % 3); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-170, test(4)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-150, test(5)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-140, test(6)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-240, test(7)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-700, test(30)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_Loop02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_Loop02 { + + public static int test(int arg) { + int accum = 0; + for (int i = 0; i < arg; i++) { + try { + accum += div(20, i); + } catch (IllegalArgumentException e) { + accum -= 100; + } + } + return accum; + } + + static int div(int a, int b) { + if (b % 3 == 0) { + throw new IllegalArgumentException(); + } + return a / (b % 3); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-170, test(4)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-150, test(5)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-140, test(6)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-240, test(7)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-700, test(30)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_Loop03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_Loop03 { + + public static int test(int arg) { + int accum = 0; + for (int i = 0; i < arg; i++) { + try { + accum += div(20, i); + } catch (Catch_Loop03_Exception1 e) { + accum -= 100; + } + } + return accum; + } + + static int div(int a, int b) { + if (b % 3 == 0) { + throw new Catch_Loop03_Exception1(); + } + return a / (b % 3); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-170, test(4)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-150, test(5)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-140, test(6)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-240, test(7)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-700, test(30)); + } + +} + +@SuppressWarnings("serial") +class Catch_Loop03_Exception1 extends RuntimeException { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_NASE_1.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_NASE_1 { + + @SuppressWarnings("unused") + public static int test(int a) { + try { + int[] v = new int[a]; + if (v != null) { + return v.length; + } + return -1; + } catch (NegativeArraySizeException e) { + return 100; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(100, test(-1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(100, test(-34)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(20, test(20)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_NASE_2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_NASE_2 { + + @SuppressWarnings("unused") + public static int test(int a) { + try { + Catch_NASE_2[] v = new Catch_NASE_2[a]; + if (v != null) { + return v.length; + } + return -1; + } catch (NegativeArraySizeException e) { + return 100; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(100, test(-1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(100, test(-34)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(20, test(20)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_NPE_00.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_NPE_00 { + + public static int test(int a) { + int[] array = a > 0 ? new int[3] : null; + try { + return array.length; + } catch (NullPointerException npe) { + return -1; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-1, test(-3)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(0)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(3, test(1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(3, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_NPE_01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_NPE_01 { + + public static int test(int a) { + try { + if (a >= 0) { + throw new NullPointerException(); + } + } catch (NullPointerException npe) { + return a; + } + return -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test(-2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_NPE_02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_NPE_02 { + + public static int test(int a) { + try { + throwNPE(a); + } catch (NullPointerException npe) { + return a; + } + return -1; + } + + private static void throwNPE(int a) { + if (a >= 0) { + throw new NullPointerException(); + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test(-2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_NPE_03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_NPE_03 { + + @SuppressWarnings("all") + public static int test(int a) { + try { + if (a >= 0) { + final Object o = null; + return o.hashCode(); + } + } catch (NullPointerException npe) { + return a; + } + return -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test(-2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_NPE_04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_NPE_04 { + + private int field = 45; + + @SuppressWarnings("all") + public static int test(int a) { + try { + if (a >= 0) { + final Catch_NPE_04 obj = null; + return obj.field; + } + } catch (NullPointerException npe) { + return a; + } + return -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test(-2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_NPE_05.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_NPE_05 { + + private int field = 45; + + public static int test(int a) { + try { + return throwNPE(a); + } catch (NullPointerException npe) { + return a; + } + } + + @SuppressWarnings("all") + private static int throwNPE(int a) { + if (a >= 0) { + final Catch_NPE_05 obj = null; + return obj.field; + } + return -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test(-2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_NPE_06.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_NPE_06 { + + public static int test(String string) { + try { + return string.hashCode(); + } catch (NullPointerException npe) { + return -1; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test("")); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(null)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_NPE_07.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ + +public class Catch_NPE_07 { + + @SuppressWarnings("serial") + public static class MyThrowable extends Throwable { + } + + @SuppressWarnings("unused") + public static int foo(Throwable t) { + try { + throw t; + } catch (Throwable t1) { + if (t1 == null) { + return -1; + } + if (t1 instanceof NullPointerException) { + return 0; + } + if (t1 instanceof MyThrowable) { + return 1; + } + return -2; + } + } + + public static int test(int i) { + Throwable t = (i == 0) ? null : new MyThrowable(); + try { + return foo(t); + } catch (Throwable t1) { + return -3; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_NPE_08.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_NPE_08 { + + public static int test(int a) { + try { + throwNPE(a); + } catch (NullPointerException npe) { + return a; + } + return -1; + } + + @SuppressWarnings("unused") + private static void throwNPE(int a) { + throw null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-2, test(-2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_NPE_09.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_NPE_09 { + + public static int test(int a) { + int r = 0; + try { + r = 0; + throwNPE(a); + r = 1; + throwNPE(a - 1); + } catch (NullPointerException e) { + return r + 10; + } + return r; + } + + private static void throwNPE(int a) { + if (a == 0) { + throw null; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(1, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_NPE_10.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_NPE_10 { + + public static int test(int a) { + int r = 0; + try { + r = 0; + if (a == 0) { + throw null; + } + r = 1; + if (a - 1 == 0) { + throw null; + } + } catch (NullPointerException e) { + return r + 10; + } + return r; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(1, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_NPE_11.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_NPE_11 { + + public static int test(int a) { + int r = 0; + try { + r = 0; + throwE(a); + r = 1; + throwE(a - 1); + } catch (ArithmeticException e) { + return r + 10; + } + return r; + } + + private static int throwE(int a) { + return 1 / a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(1, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_StackOverflowError_01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_StackOverflowError_01 { + + private static void recurse() { + recurse(); + } + + public static int test() throws StackOverflowError { + recurse(); + return -1; + } + + @Test(expected = java.lang.StackOverflowError.class) + public void run0() throws Throwable { + test(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_StackOverflowError_02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_StackOverflowError_02 { + + private static void recurse() { + recurse(); + } + + public static int test() { + try { + recurse(); + } catch (StackOverflowError stackOverflowError) { + // tests that the guard page was reset and a second SOE can be handled + recurse(); + } + return -1; + } + + @Test(expected = java.lang.StackOverflowError.class) + public void run0() throws Throwable { + test(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_StackOverflowError_03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/** + * Some basic checking of the stack trace produced after a StackOverflowError. + */ +public class Catch_StackOverflowError_03 { + + private static final int PASS = 0; + private static final int FAIL = 1; + + private static void recurseA() { + recurseB(); + } + + private static void recurseB() { + recurseA(); + } + + public static int test() { + try { + recurseA(); + } catch (StackOverflowError stackOverflowError) { + // Check that a method does not appear to be calling itself in the stack trace + // and check that recurse* is only called by either recurse* or test + StackTraceElement[] elements = null; + elements = stackOverflowError.getStackTrace(); + if (elements.length == 0) { + // Not much we can do about this perfectly legal situation + return PASS; + } + String lastMethodName = elements[0].getMethodName(); + for (int i = 1; i < elements.length; ++i) { + String methodName = elements[i].getMethodName(); + + // Skip top-of-stack until we find a method with name "recurse*". + if (!methodName.startsWith("recurse")) { + continue; + } + + // We reached the test method => done. + if (methodName.equals("test")) { + break; + } + + // Stack elements must alternate between recurseA and recurseB + if (lastMethodName.equals(methodName) || (!methodName.equals("recurseA") && !methodName.equals("recurseB"))) { + return FAIL; + } + + lastMethodName = methodName; + } + + return PASS; + } + + return FAIL; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_Two01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_Two01 { + + public static String test(int arg) { + try { + throwSomething(arg); + } catch (NullPointerException e) { + return e.getClass().getName(); + } catch (ArithmeticException e) { + return e.getClass().getName(); + } + return "none"; + } + + private static void throwSomething(int arg) { + if (arg == 0) { + throw new NullPointerException(); + } + if (arg == 1) { + throw new ArithmeticException(); + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("java.lang.NullPointerException", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("java.lang.ArithmeticException", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("none", test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_Two02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_Two02 { + + public static String test(int arg) { + try { + throwSomething(arg + 10); + } catch (NullPointerException e) { + return e.getClass().getName(); + } catch (ArithmeticException e) { + return e.getClass().getName(); + } + return "none" + (arg + 10); + } + + private static void throwSomething(int arg) { + if (arg == 10) { + throw new NullPointerException(); + } + if (arg == 11) { + throw new ArithmeticException(); + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("java.lang.NullPointerException", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("java.lang.ArithmeticException", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("none13", test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_Two03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_Two03 { + + public static String test(int arg) { + int r = 0; + try { + r = 1; + throwSomething(r + arg); + r = 2; + throwSomething(r + arg); + r = 3; + throwSomething(r + arg); + r = 4; + } catch (NullPointerException e) { + return e.getClass().getName() + r; + } catch (ArithmeticException e) { + return e.getClass().getName() + r; + } + return "none" + r; + } + + private static void throwSomething(int arg) { + if (arg == 5) { + throw new NullPointerException(); + } + if (arg == 6) { + throw new ArithmeticException(); + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("none4", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("none4", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("java.lang.NullPointerException3", test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_Unresolved.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_Unresolved { + + public static boolean executed; + + public static int test(int arg) { + executed = false; + try { + helper1(arg); + helper2(arg); + } catch (Catch_Unresolved_Exception1 e) { + return 1; + } catch (Catch_Unresolved_Exception2 e) { + return 2; + } + return 0; + } + + private static void helper1(int arg) { + if (executed) { + throw new IllegalStateException("helper1 may only be called once"); + } + executed = true; + if (arg == 1) { + throw new Catch_Unresolved_Exception1(); + } else if (arg == 2) { + throw new Catch_Unresolved_Exception2(); + } + } + + private static void helper2(int arg) { + if (arg != 0) { + throw new IllegalStateException("helper2 can only be called if arg==0"); + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + +} + +@SuppressWarnings("serial") +class Catch_Unresolved_Exception1 extends RuntimeException { +} + +@SuppressWarnings("serial") +class Catch_Unresolved_Exception2 extends RuntimeException { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_Unresolved01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_Unresolved01 { + + public static boolean executed; + + public static int test(int arg) { + executed = false; + try { + helper1(arg); + } catch (Catch_Unresolved_Exception3 e) { + return 1; + } catch (Catch_Unresolved_Exception4 e) { + return 2; + } + return 0; + } + + private static void helper1(int arg) { + if (executed) { + throw new IllegalStateException("helper1 may only be called once"); + } + executed = true; + if (arg == 1) { + throw new Catch_Unresolved_Exception3(); + } else if (arg == 2) { + throw new Catch_Unresolved_Exception4(); + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + +} + +@SuppressWarnings("serial") +class Catch_Unresolved_Exception3 extends RuntimeException { +} + +@SuppressWarnings("serial") +class Catch_Unresolved_Exception4 extends RuntimeException { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_Unresolved02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_Unresolved02 { + + public static boolean executed; + public static int value; + + public static int test(int arg) { + executed = false; + int result = 0; + try { + result = value + helper1(arg) + helper2(arg); + } catch (Catch_Unresolved02_Exception1 e) { + return 1 + result; + } catch (Catch_Unresolved02_Exception2 e) { + return 2 + result; + } + return result; + } + + private static int helper1(int arg) { + if (executed) { + throw new IllegalStateException("helper1 may only be called once"); + } + executed = true; + if (arg == 1) { + throw new Catch_Unresolved02_Exception1(); + } else if (arg == 2) { + throw new Catch_Unresolved02_Exception2(); + } + return 0; + } + + private static int helper2(int arg) { + if (arg != 0) { + throw new IllegalStateException("helper2 can only be called if arg==0"); + } + return 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + +} + +@SuppressWarnings("serial") +class Catch_Unresolved02_Exception1 extends RuntimeException { +} + +@SuppressWarnings("serial") +class Catch_Unresolved02_Exception2 extends RuntimeException { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Catch_Unresolved03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Catch_Unresolved03 { + + public static boolean executed; + public static int value; + + public static int test(int arg) { + executed = false; + int result = 0; + try { + result = value + helper1(arg) + helper2(arg); + } catch (Catch_Unresolved03_Exception1 e) { + if (arg == 1) { + return 1; + } + return new Catch_Unresolved03_UnresolvedClass().value(); + } + return result; + } + + private static int helper1(int arg) { + if (executed) { + throw new IllegalStateException("helper1 may only be called once"); + } + executed = true; + if (arg == 1 || arg == 2) { + throw new Catch_Unresolved03_Exception1(); + } + return 0; + } + + private static int helper2(int arg) { + if (arg != 0) { + throw new IllegalStateException("helper2 can only be called if arg==0"); + } + return 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + +} + +@SuppressWarnings("serial") +class Catch_Unresolved03_Exception1 extends RuntimeException { +} + +class Catch_Unresolved03_UnresolvedClass { + + public int value() { + return 2; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Except_Locals.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class Except_Locals { + + public static int test(String a, String b) { + int x = 0; + try { + x = 1; + a.toString(); + x = 2; + b.toString(); + } catch (NullPointerException e) { + // System.out.println(x); + return x; + } + return -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1, test(null, null)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test("", null)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test("", "")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Except_Synchronized01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Except_Synchronized01 { + + static final Except_Synchronized01 object = new Except_Synchronized01(); + + final int x = 1; + + public static int test(int i) throws Exception { + if (i == 0) { + return 0; + } + return object.test2(i); + } + + @SuppressWarnings("all") + public synchronized int test2(int i) throws Exception { + try { + Except_Synchronized01 object = null; + return object.x; + } catch (NullPointerException e) { + return 2; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Except_Synchronized02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class Except_Synchronized02 { + + static final Except_Synchronized02 object = new Except_Synchronized02(); + + final int x = 1; + + public static int test(int i) throws Exception { + if (i == 0) { + return 0; + } + return object.test2(i); + } + + @SuppressWarnings("all") + public synchronized int test2(int i) throws Exception { + while (true) { + try { + Except_Synchronized02 object = null; + return object.x; + } catch (NullPointerException e) { + return 2; + } + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Except_Synchronized03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Except_Synchronized03 { + + static final Except_Synchronized03 object = new Except_Synchronized03(); + + int x = 1; + + public static int test(int i) throws Exception { + if (i == 0) { + return 0; + } + return object.test2(i); + } + + @SuppressWarnings("all") + public synchronized int test2(int i) throws Exception { + while (true) { + try { + synchronized (this) { + Except_Synchronized03 object = null; + return object.x; + } + } catch (NullPointerException e) { + return 2; + } + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Except_Synchronized04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class Except_Synchronized04 { + + static final Except_Synchronized04 object = new Except_Synchronized04(); + + final int x = 1; + + public static int test(int i) throws Exception { + if (i == 0) { + return 0; + } + return object.test2(i); + } + + @SuppressWarnings("all") + public int test2(int i) throws Exception { + try { + synchronized (Except_Synchronized04.class) { + Except_Synchronized04 object = null; + return object.x; + } + } catch (NullPointerException e) { + return 2; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Except_Synchronized05.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +@SuppressWarnings("static-method") +public class Except_Synchronized05 { + + Object field; + + public static int test(int arg) { + Except_Synchronized05 obj = new Except_Synchronized05(); + int a = obj.bar(arg) != null ? 1 : 0; + int b = obj.baz(arg) != null ? 1 : 0; + return a + b; + } + + public synchronized Object bar(int arg) { + try { + String f = foo1(arg); + if (f == null) { + field = new Object(); + } + } catch (NullPointerException e) { + // do nothing + } + return field; + } + + public Object baz(int arg) { + synchronized (this) { + try { + String f = foo1(arg); + if (f == null) { + field = new Object(); + } + } catch (NullPointerException e) { + // do nothing + } + return field; + } + } + + private String foo1(int arg) { + if (arg == 0) { + throw null; + } + return null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Finally01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Finally01 { + + @SuppressWarnings("all") + public static int test(int arg) { + try { + return 0; + } finally { + return -1; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-1, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Finally02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class Finally02 { + + public static int test() { + try { + a(); + } finally { + b(); + } + + return c(); + } + +// @NEVER_INLINE + static int a() { + return 0; + } + +// @NEVER_INLINE + static int b() { + return -3; + } + + static int c() { + return -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-1, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/StackTrace_AIOOBE_00.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class StackTrace_AIOOBE_00 { + + private static int[] array = new int[3]; + + public static int test(int a) { + try { + return array[a]; + } catch (ArrayIndexOutOfBoundsException npe) { + for (StackTraceElement e : npe.getStackTrace()) { + if (e.getClassName().equals(StackTrace_AIOOBE_00.class.getName()) && e.getMethodName().equals("test")) { + return -1; + } + } + } + return -2; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test(-2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-1, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/StackTrace_CCE_00.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class StackTrace_CCE_00 { + + static Object object2 = new Object(); + static Object object3 = ""; + static Object object4 = new StackTrace_CCE_00(); + + public static int test(int arg) { + Object obj = null; + if (arg == 2) { + obj = object2; + } + if (arg == 3) { + obj = object3; + } + if (arg == 4) { + obj = object4; + } + try { + final StackTrace_CCE_00 bc = (StackTrace_CCE_00) obj; + if (bc == null) { + return arg; + } + return arg; + } catch (ClassCastException npe) { + for (StackTraceElement e : npe.getStackTrace()) { + if (e.getClassName().equals(StackTrace_CCE_00.class.getName()) && e.getMethodName().equals("test")) { + return -100; + } + } + return -200; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-100, test(2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-100, test(3)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(4, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/StackTrace_NPE_00.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class StackTrace_NPE_00 { + + public static int test(int a) { + int[] array = a > 0 ? new int[3] : null; + try { + return array.length; + } catch (NullPointerException npe) { + for (StackTraceElement e : npe.getStackTrace()) { + if (e.getClassName().equals(StackTrace_NPE_00.class.getName())) { + return -1; + } + } + return -2; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-1, test(-3)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(0)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(3, test(1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(3, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/StackTrace_NPE_01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class StackTrace_NPE_01 { + + @SuppressWarnings("all") + public static int test(int a) { + try { + if (a >= 0) { + final Object o = null; + return o.hashCode(); + } + } catch (NullPointerException npe) { + for (StackTraceElement e : npe.getStackTrace()) { + if (e.getClassName().equals(StackTrace_NPE_01.class.getName()) && e.getMethodName().equals("test")) { + return a; + } + } + } + return -1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test(-2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/StackTrace_NPE_02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class StackTrace_NPE_02 { + + private static String[] trace = {"test1", "test"}; + + public static int test(int a) { + try { + if (a >= 0) { + return test1(); + } + } catch (NullPointerException npe) { + String thisClass = StackTrace_NPE_02.class.getName(); + StackTraceElement[] stackTrace = npe.getStackTrace(); + for (int i = 0; i < stackTrace.length; i++) { + StackTraceElement e = stackTrace[i]; + if (e.getClassName().equals(thisClass)) { + for (int j = 0; j < trace.length; j++) { + StackTraceElement f = stackTrace[i + j]; + if (!f.getClassName().equals(thisClass)) { + return -2; + } + if (!f.getMethodName().equals(trace[j])) { + return -3; + } + } + return 0; + } + } + } + return -1; + } + + @SuppressWarnings("all") + private static int test1() { + final Object o = null; + return o.hashCode(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test(-2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/StackTrace_NPE_03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +/* + */ +public class StackTrace_NPE_03 { + + private static String[] trace = {"test2", "test1", "test"}; + + public static int test(int a) { + try { + if (a >= 0) { + return test1(); + } + } catch (NullPointerException npe) { + String thisClass = StackTrace_NPE_03.class.getName(); + StackTraceElement[] stackTrace = npe.getStackTrace(); + for (int i = 0; i < stackTrace.length; i++) { + StackTraceElement e = stackTrace[i]; + if (e.getClassName().equals(thisClass)) { + for (int j = 0; j < trace.length; j++) { + StackTraceElement f = stackTrace[i + j]; + if (!f.getClassName().equals(thisClass)) { + return -2; + } + if (!f.getMethodName().equals(trace[j])) { + return -3; + } + } + return 0; + } + } + } + return -1; + } + + private static int test1() { + return test2(); + } + + private static int test2() { + throw new NullPointerException(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test(-2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Throw_InCatch01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class Throw_InCatch01 { + + public static boolean test(int i) throws Exception { + if (i == 0) { + return true; + } + try { + throw new Exception(); + } catch (Exception e) { + throw e; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test(expected = java.lang.Exception.class) + public void run1() throws Throwable { + test(1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Throw_InCatch02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class Throw_InCatch02 { + + public static boolean test(int i) throws Exception { + if (i == 0) { + return true; + } + try { + throwE(); + } catch (Exception e) { + throwE(e); + } + return false; + } + + private static void throwE(Exception e) throws Exception { + throw e; + } + + private static void throwE() throws Exception { + throw new Exception(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test(expected = java.lang.Exception.class) + public void run1() throws Throwable { + test(1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Throw_InCatch03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class Throw_InCatch03 { + + public static boolean test(int i) throws Exception { + if (i == 0) { + return true; + } + try { + throwE(); + } catch (Exception e) { + throw e; + } + return false; + } + + private static void throwE() throws Exception { + throw new Exception(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test(expected = java.lang.Exception.class) + public void run1() throws Throwable { + test(1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Throw_InNested.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class Throw_InNested { + + public static int test(int i) throws Exception { + return 42 + test2(i); + } + + public static int test2(int i) throws Exception { + try { + return test3(i); + } catch (Exception e) { + return 5; + } + } + + private static int test3(int i) { + if (i == 0) { + throw new RuntimeException(); + } + return i; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(47, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(43, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Throw_NPE_01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class Throw_NPE_01 { + + public static int test(int i) throws Exception { + int a = test2(i); + a = a + 1; + return a; + } + + public static int test2(int i) { + if (i < 0) { + throw null; + } + return i; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test(1)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run2() throws Throwable { + test(-1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Throw_Synchronized01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class Throw_Synchronized01 { + + public static synchronized boolean test(int i) throws Exception { + return i == 0 || test2(i); + } + + @SuppressWarnings("unused") + public static boolean test2(int i) throws Exception { + throw new Exception(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test(expected = java.lang.Exception.class) + public void run1() throws Throwable { + test(1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Throw_Synchronized02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class Throw_Synchronized02 { + + public static synchronized boolean test(int i) throws Exception { + if (i == 0) { + return true; + } + throw new Exception(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test(expected = java.lang.Exception.class) + public void run1() throws Throwable { + test(1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Throw_Synchronized03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class Throw_Synchronized03 { + + public static synchronized boolean test(int i) throws Exception { + if (i == 0) { + return true; + } + return test2(i); + } + + @SuppressWarnings("unused") + public static synchronized boolean test2(int i) throws Exception { + throw new Exception(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test(expected = java.lang.Exception.class) + public void run1() throws Throwable { + test(1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Throw_Synchronized04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class Throw_Synchronized04 { + + static final Throw_Synchronized04 object = new Throw_Synchronized04(); + + public static boolean test(int i) throws Exception { + if (i == 0) { + return true; + } + return object.test2(i); + } + + @SuppressWarnings("unused") + public synchronized boolean test2(int i) throws Exception { + throw new Exception(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test(expected = java.lang.Exception.class) + public void run1() throws Throwable { + test(1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/except/Throw_Synchronized05.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.except; + +import org.junit.*; + +public class Throw_Synchronized05 { + + static final Throw_Synchronized05 object = new Throw_Synchronized05(); + + public static boolean test(int i) throws Exception { + if (i == 0) { + return true; + } + return object.test2(i); + } + + @SuppressWarnings("unused") + public synchronized boolean test2(int i) throws Exception { + try { + throw new Exception(); + } catch (Exception e) { + // do nothing and then rethrow + throw e; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test(expected = java.lang.Exception.class) + public void run1() throws Throwable { + test(1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_allocate01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_allocate01 { + + public static int test(int count) { + int sum = 0; + for (int i = 0; i < count; i++) { + sum += i; + } + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(1, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(3, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(3160, test(80)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_allocate02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_allocate02 { + + public static int test(int count) { + int sum = 0; + for (int i = 0; i < count; i++) { + final Integer j = new Integer(i); + sum += j; + } + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(4950, test(100)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_allocate03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_allocate03 { + + public static int test(int count) { + @SuppressWarnings("unused") + final int sum = 0; + String text = ""; + for (int i = 0; i < count; i++) { + text += '.'; + } + return text.length(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(100, test(100)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_allocate04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_allocate04 { + + public static int test(int count) { + int[] a = new int[count]; + + for (int i = 0; i < a.length; i++) { + a[i] = i; + } + + int i = 0; + int iwrap = count - 1; + int sum = 0; + + while (i < count) { + sum += (a[i] + a[iwrap]) / 2; + iwrap = i; + i++; + } + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3120, test(80)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_array01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_array01 { + + public static int[] array = new int[40]; + + public static int test(int count) { + int sum = 0; + for (int i = 0; i < count; i++) { + array[i] = i; + sum += array[i]; + } + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(780, test(40)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_array02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_array02 { + + public static byte[] b = new byte[40]; + public static char[] c = new char[40]; + public static short[] s = new short[40]; + public static int[] iArray = new int[40]; + public static long[] l = new long[40]; + public static float[] f = new float[40]; + public static double[] d = new double[40]; + + public static int test(int count) { + int sum = 0; + for (int x = 0; x < count; x++) { + b[x] = (byte) x; + c[x] = (char) x; + s[x] = (short) x; + iArray[x] = x; + l[x] = x; + f[x] = x; + d[x] = x; + sum += b[x] + c[x] + s[x] + iArray[x] + l[x] + f[x] + d[x]; + } + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(5460, test(40)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_array03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_array03 { + + public static byte[] b = new byte[40]; + public static char[] c = new char[40]; + + public static int test(int count) { + int sum = 0; + for (int i = 0; i < count; i++) { + sum += b.length + c.length; + } + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3200, test(40)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_array04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_array04 { + + public static byte[] b = new byte[40]; + public static char[] c = new char[40]; + + public static int test(int count) { + int sum = 0; + + for (int i = 0; i < b.length; i++) { + b[i] = (byte) i; + c[i] = (char) i; + } + + for (int j = 0; j < 10; j++) { + try { + for (int i = 0; i < count; i++) { + sum += b[i] + c[i]; + } + } catch (IndexOutOfBoundsException e) { + sum += j; + } + } + + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(15645, test(80)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_control01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_control01 { + + public static int test(int count) { + int i1 = 1; + int i2 = 2; + int i3 = 3; + int i4 = 4; + + for (int i = 0; i < count; i++) { + i1 = i2; + i2 = i3; + i3 = i4; + i4 = i1; + + i1 = i2; + i2 = i3; + i3 = i4; + i4 = i1; + + i1 = i2; + i2 = i3; + i3 = i4; + i4 = i1; + + i1 = i2; + i2 = i3; + i3 = i4; + i4 = i1; + } + + return i1 + i2 * 10 + i3 * 100 + i4 * 1000; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(2432, test(40)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(3243, test(80)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_control02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_control02 { + + public static int test(int count) { + int sum = 0; + for (int i = 0; i < count; i++) { + switch (i) { + case 30: + sum += 30; + break; + case 31: + sum += 31; + break; + case 32: + sum += 32; + break; + case 33: + sum += 33; + break; + case 34: + sum += 34; + break; + case 35: + sum += 35; + break; + case 36: + sum += 36; + break; + case 37: + sum += 37; + break; + case 38: + sum += 38; + break; + case 39: + sum += 39; + break; + case 40: + sum += 40; + break; + case 41: + sum += 41; + break; + case 42: + sum += 42; + break; + default: + sum += 1; + break; + } + } + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(515, test(60)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(555, test(100)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_convert01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_convert01 { + + public static int test(int count) { + double sum = 0; + for (int i = 0; i < count; i++) { + sum = (int) sum + i; + } + return (int) sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(4950, test(100)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_count.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + * Runs: 10 = 55; 20 = 210; 30 = 465; 40 = 820; + */ +@SuppressWarnings("unused") +public class HP_count { + + public static int test(int count) { + float unusedFloat = 0; + double dub = 0; + int sum = 0; + double unusedDouble = 0; + for (int i = 0; i <= count; i++) { + if (i > 20) { + sum += i; + } else { + sum += i; + } + dub += sum; + } + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(820, test(40)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_dead01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_dead01 { + + public static int test(int count) { + int sum = 0; + for (int i = 0; i <= count; i++) { + int a = i + i; + int b = i / 2 * i - 10; + @SuppressWarnings("unused") + int c = a + b; + int d = a; + sum += d; + } + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(110, test(10)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(420, test(20)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(930, test(30)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1640, test(40)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_demo01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_demo01 { + + public static int test(int count) { + int sum = 0; + + for (int i = 0; i < count; i++) { + int[] ia = new int[count]; + long[] la = new long[count]; + float[] fa = new float[count]; + double[] da = new double[count]; + sum += ia[i] = (int) (la[i] = (long) (fa[i] = (float) (da[i] = i))); + } + + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3160, test(80)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_field01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_field01 { + + public static int a; + public static int b; + public static int c; + + public static int test(int count) { + for (int i = 0; i <= count; i++) { + if (i > 5) { + a += i; + } else if (i > 7) { + b += i; + } else { + c += i; + } + } + return a + b + c; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(820, test(40)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_field02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + * Runs: 10 = 55; 20 = 210; 30 = 465; 40 = 820; + */ +public class HP_field02 { + + public int a; + public int b; + public int c; + + public static int test(int count) { + return new HP_field02().run(count); + } + + public int run(int count) { + for (int i = 0; i <= count; i++) { + if (i > 5) { + a += i; + } else if (i > 7) { + b += i; + } else { + c += i; + } + } + return a + b + c; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(820, test(40)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_field03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_field03 { + + public static byte b; + public static char c; + public static short s; + public static int i; + public static long l; + public static float f; + public static double d; + + public static int test(int count) { + for (int x = 0; x <= count; x++) { + b += x; + c += x; + s += x; + i += x; + l += x; + f += x; + d += x; + } + return (int) (b + c + s + i + l + f + d); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(2019980, test(1000)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_field04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_field04 { + + public byte b; + public char c; + public short s; + public int i; + public long l; + public float f; + public double d; + + public static int test(int count) { + return new HP_field04().run(count); + } + + public int run(int count) { + for (int x = 0; x <= count; x++) { + b += x; + c += x; + s += x; + i += x; + l += x; + f += x; + d += x; + } + return (int) (b + c + s + i + l + f + d); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(4972, test(40)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2019980, test(1000)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_idea.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,456 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop + +package com.oracle.max.graal.jtt.hotpath; + +import java.util.*; + +import org.junit.*; + +/* + */ +@SuppressWarnings("static-method") +public class HP_idea { + + public boolean test() { + buildTestData(); + Do(); + return verify(); + } + + // Declare class data. Byte buffer plain1 holds the original + // data for encryption, crypt1 holds the encrypted data, and + // plain2 holds the decrypted data, which should match plain1 + // byte for byte. + + int array_rows; + + byte[] plain1; // Buffer for plaintext data. + byte[] crypt1; // Buffer for encrypted data. + byte[] plain2; // Buffer for decrypted data. + + short[] userkey; // Key for encryption/decryption. + int[] Z; // Encryption subkey (userkey derived). + int[] DK; // Decryption subkey (userkey derived). + + void Do() { + cipher_idea(plain1, crypt1, Z); // Encrypt plain1. + cipher_idea(crypt1, plain2, DK); // Decrypt. + } + + /* + * buildTestData + * + * Builds the data used for the test -- each time the test is run. + */ + + void buildTestData() { + // Create three byte arrays that will be used (and reused) for + // encryption/decryption operations. + + plain1 = new byte[array_rows]; + crypt1 = new byte[array_rows]; + plain2 = new byte[array_rows]; + + Random rndnum = new Random(136506717L); // Create random number generator. + + // Allocate three arrays to hold keys: userkey is the 128-bit key. + // Z is the set of 16-bit encryption subkeys derived from userkey, + // while DK is the set of 16-bit decryption subkeys also derived + // from userkey. NOTE: The 16-bit values are stored here in + // 32-bit int arrays so that the values may be used in calculations + // as if they are unsigned. Each 64-bit block of plaintext goes + // through eight processing rounds involving six of the subkeys + // then a final output transform with four of the keys; (8 * 6) + // + 4 = 52 subkeys. + + userkey = new short[8]; // User key has 8 16-bit shorts. + Z = new int[52]; // Encryption subkey (user key derived). + DK = new int[52]; // Decryption subkey (user key derived). + + // Generate user key randomly; eight 16-bit values in an array. + + for (int i = 0; i < 8; i++) { + // Again, the random number function returns int. Converting + // to a short type preserves the bit pattern in the lower 16 + // bits of the int and discards the rest. + + userkey[i] = (short) rndnum.nextInt(); + } + + // Compute encryption and decryption subkeys. + + calcEncryptKey(); + calcDecryptKey(); + + // Fill plain1 with "text." + for (int i = 0; i < array_rows; i++) { + plain1[i] = (byte) i; + + // Converting to a byte + // type preserves the bit pattern in the lower 8 bits of the + // int and discards the rest. + } + } + + /* + * calcEncryptKey + * + * Builds the 52 16-bit encryption subkeys Z[] from the user key and stores in 32-bit int array. The routing + * corrects an error in the source code in the Schnier book. Basically, the sense of the 7- and 9-bit shifts are + * reversed. It still works reversed, but would encrypted code would not decrypt with someone else's IDEA code. + */ + + private void calcEncryptKey() { + int j; // Utility variable. + + for (int i = 0; i < 52; i++) { + // Zero out the 52-int Z array. + Z[i] = 0; + } + + for (int i = 0; i < 8; i++) // First 8 subkeys are userkey itself. + { + Z[i] = userkey[i] & 0xffff; // Convert "unsigned" + // short to int. + } + + // Each set of 8 subkeys thereafter is derived from left rotating + // the whole 128-bit key 25 bits to left (once between each set of + // eight keys and then before the last four). Instead of actually + // rotating the whole key, this routine just grabs the 16 bits + // that are 25 bits to the right of the corresponding subkey + // eight positions below the current subkey. That 16-bit extent + // straddles two array members, so bits are shifted left in one + // member and right (with zero fill) in the other. For the last + // two subkeys in any group of eight, those 16 bits start to + // wrap around to the first two members of the previous eight. + + for (int i = 8; i < 52; i++) { + j = i % 8; + if (j < 6) { + Z[i] = ((Z[i - 7] >>> 9) | (Z[i - 6] << 7)) // Shift and combine. + & 0xFFFF; // Just 16 bits. + continue; // Next iteration. + } + + if (j == 6) // Wrap to beginning for second chunk. + { + Z[i] = ((Z[i - 7] >>> 9) | (Z[i - 14] << 7)) & 0xFFFF; + continue; + } + + // j == 7 so wrap to beginning for both chunks. + + Z[i] = ((Z[i - 15] >>> 9) | (Z[i - 14] << 7)) & 0xFFFF; + } + } + + /* + * calcDecryptKey + * + * Builds the 52 16-bit encryption subkeys DK[] from the encryption- subkeys Z[]. DK[] is a 32-bit int array holding + * 16-bit values as unsigned. + */ + + private void calcDecryptKey() { + int j, k; // Index counters. + int t1, t2, t3; // Temps to hold decrypt subkeys. + + t1 = inv(Z[0]); // Multiplicative inverse (mod x10001). + t2 = -Z[1] & 0xffff; // Additive inverse, 2nd encrypt subkey. + t3 = -Z[2] & 0xffff; // Additive inverse, 3rd encrypt subkey. + + DK[51] = inv(Z[3]); // Multiplicative inverse (mod x10001). + DK[50] = t3; + DK[49] = t2; + DK[48] = t1; + + j = 47; // Indices into temp and encrypt arrays. + k = 4; + for (int i = 0; i < 7; i++) { + t1 = Z[k++]; + DK[j--] = Z[k++]; + DK[j--] = t1; + t1 = inv(Z[k++]); + t2 = -Z[k++] & 0xffff; + t3 = -Z[k++] & 0xffff; + DK[j--] = inv(Z[k++]); + DK[j--] = t2; + DK[j--] = t3; + DK[j--] = t1; + } + + t1 = Z[k++]; + DK[j--] = Z[k++]; + DK[j--] = t1; + t1 = inv(Z[k++]); + t2 = -Z[k++] & 0xffff; + t3 = -Z[k++] & 0xffff; + DK[j--] = inv(Z[k++]); + DK[j--] = t3; + DK[j--] = t2; + DK[j--] = t1; + } + + /* + * cipher_idea + * + * IDEA encryption/decryption algorithm. It processes plaintext in 64-bit blocks, one at a time, breaking the block + * into four 16-bit unsigned subblocks. It goes through eight rounds of processing using 6 new subkeys each time, + * plus four for last step. The source text is in array text1, the destination text goes into array text2 The + * routine represents 16-bit subblocks and subkeys as type int so that they can be treated more easily as unsigned. + * Multiplication modulo 0x10001 interprets a zero sub-block as 0x10000; it must to fit in 16 bits. + */ + + private void cipher_idea(byte[] text1, byte[] text2, int[] key) { + + int i1 = 0; // Index into first text array. + int i2 = 0; // Index into second text array. + int ik; // Index into key array. + int x1, x2, x3, x4, t1, t2; // Four "16-bit" blocks, two temps. + int r; // Eight rounds of processing. + + for (int i = 0; i < text1.length; i += 8) { + + ik = 0; // Restart key index. + r = 8; // Eight rounds of processing. + + // Load eight plain1 bytes as four 16-bit "unsigned" integers. + // Masking with 0xff prevents sign extension with cast to int. + + x1 = text1[i1++] & 0xff; // Build 16-bit x1 from 2 bytes, + x1 |= (text1[i1++] & 0xff) << 8; // assuming low-order byte first. + x2 = text1[i1++] & 0xff; + x2 |= (text1[i1++] & 0xff) << 8; + x3 = text1[i1++] & 0xff; + x3 |= (text1[i1++] & 0xff) << 8; + x4 = text1[i1++] & 0xff; + x4 |= (text1[i1++] & 0xff) << 8; + + do { + // 1) Multiply (modulo 0x10001), 1st text sub-block + // with 1st key sub-block. + + x1 = (int) ((long) x1 * key[ik++] % 0x10001L & 0xffff); + + // 2) Add (modulo 0x10000), 2nd text sub-block + // with 2nd key sub-block. + + x2 = x2 + key[ik++] & 0xffff; + + // 3) Add (modulo 0x10000), 3rd text sub-block + // with 3rd key sub-block. + + x3 = x3 + key[ik++] & 0xffff; + + // 4) Multiply (modulo 0x10001), 4th text sub-block + // with 4th key sub-block. + + x4 = (int) ((long) x4 * key[ik++] % 0x10001L & 0xffff); + + // 5) XOR results from steps 1 and 3. + + t2 = x1 ^ x3; + + // 6) XOR results from steps 2 and 4. + // Included in step 8. + + // 7) Multiply (modulo 0x10001), result of step 5 + // with 5th key sub-block. + + t2 = (int) ((long) t2 * key[ik++] % 0x10001L & 0xffff); + + // 8) Add (modulo 0x10000), results of steps 6 and 7. + + t1 = t2 + (x2 ^ x4) & 0xffff; + + // 9) Multiply (modulo 0x10001), result of step 8 + // with 6th key sub-block. + + t1 = (int) ((long) t1 * key[ik++] % 0x10001L & 0xffff); + + // 10) Add (modulo 0x10000), results of steps 7 and 9. + + t2 = t1 + t2 & 0xffff; + + // 11) XOR results from steps 1 and 9. + + x1 ^= t1; + + // 14) XOR results from steps 4 and 10. (Out of order). + + x4 ^= t2; + + // 13) XOR results from steps 2 and 10. (Out of order). + + t2 ^= x2; + + // 12) XOR results from steps 3 and 9. (Out of order). + + x2 = x3 ^ t1; + + x3 = t2; // Results of x2 and x3 now swapped. + + } while (--r != 0); // Repeats seven more rounds. + + // Final output transform (4 steps). + + // 1) Multiply (modulo 0x10001), 1st text-block + // with 1st key sub-block. + + x1 = (int) ((long) x1 * key[ik++] % 0x10001L & 0xffff); + + // 2) Add (modulo 0x10000), 2nd text sub-block + // with 2nd key sub-block. It says x3, but that is to undo swap + // of subblocks 2 and 3 in 8th processing round. + + x3 = x3 + key[ik++] & 0xffff; + + // 3) Add (modulo 0x10000), 3rd text sub-block + // with 3rd key sub-block. It says x2, but that is to undo swap + // of subblocks 2 and 3 in 8th processing round. + + x2 = x2 + key[ik++] & 0xffff; + + // 4) Multiply (modulo 0x10001), 4th text-block + // with 4th key sub-block. + + x4 = (int) ((long) x4 * key[ik++] % 0x10001L & 0xffff); + + // Repackage from 16-bit sub-blocks to 8-bit byte array text2. + + text2[i2++] = (byte) x1; + text2[i2++] = (byte) (x1 >>> 8); + text2[i2++] = (byte) x3; // x3 and x2 are switched + text2[i2++] = (byte) (x3 >>> 8); // only in name. + text2[i2++] = (byte) x2; + text2[i2++] = (byte) (x2 >>> 8); + text2[i2++] = (byte) x4; + text2[i2++] = (byte) (x4 >>> 8); + + } // End for loop. + + } // End routine. + + /* + * mul + * + * Performs multiplication, modulo (2**16)+1. This code is structured on the assumption that untaken branches are + * cheaper than taken branches, and that the compiler doesn't schedule branches. Java: Must work with 32-bit int and + * one 64-bit long to keep 16-bit values and their products "unsigned." The routine assumes that both a and b could + * fit in 16 bits even though they come in as 32-bit ints. Lots of "& 0xFFFF" masks here to keep things 16-bit. + * Also, because the routine stores mod (2**16)+1 results in a 2**16 space, the result is truncated to zero whenever + * the result would zero, be 2**16. And if one of the multiplicands is 0, the result is not zero, but (2**16) + 1 + * minus the other multiplicand (sort of an additive inverse mod 0x10001). + * + * NOTE: The java conversion of this routine works correctly, but is half the speed of using Java's modulus division + * function (%) on the multiplication with a 16-bit masking of the result--running in the Symantec Caje IDE. So it's + * not called for now; the test uses Java % instead. + */ + + /* + * private int mul(int a, int b) throws ArithmeticException { long p; // Large enough to catch 16-bit multiply // + * without hitting sign bit. if (a != 0) { if(b != 0) { p = (long) a * b; b = (int) p & 0xFFFF; // Lower 16 bits. a + * = (int) p >>> 16; // Upper 16 bits. + * + * return (b - a + (b < a ? 1 : 0) & 0xFFFF); } else return ((1 - a) & 0xFFFF); // If b = 0, then same as // 0x10001 + * - a. } else // If a = 0, then return return((1 - b) & 0xFFFF); // same as 0x10001 - b. } + */ + + /* + * inv + * + * Compute multiplicative inverse of x, modulo (2**16)+1 using extended Euclid's GCD (greatest common divisor) + * algorithm. It is unrolled twice to avoid swapping the meaning of the registers. And some subtracts are changed to + * adds. Java: Though it uses signed 32-bit ints, the interpretation of the bits within is strictly unsigned 16-bit. + */ + + private int inv(int x) { + int x2 = x; + int t0, t1; + int q, y; + + if (x2 <= 1) { + return (x2); // 0 and 1 are self-inverse. + } + + t1 = 0x10001 / x2; // (2**16+1)/x; x is >= 2, so fits 16 bits. + y = 0x10001 % x2; + if (y == 1) { + return ((1 - t1) & 0xFFFF); + } + + t0 = 1; + do { + q = x2 / y; + x2 = x2 % y; + t0 += q * t1; + if (x2 == 1) { + return (t0); + } + q = y / x2; + y = y % x2; + t1 += q * t0; + } while (y != 1); + + return ((1 - t1) & 0xFFFF); + } + + boolean verify() { + boolean error; + for (int i = 0; i < array_rows; i++) { + error = (plain1[i] != plain2[i]); + if (error) { + return false; + } + } + return true; + } + + /* + * freeTestData + * + * Nulls arrays and forces garbage collection to free up memory. + */ + + void freeTestData() { + plain1 = null; + crypt1 = null; + plain2 = null; + userkey = null; + Z = null; + DK = null; + } + + public HP_idea() { + array_rows = 3000; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_inline01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_inline01 { + + public static int test(int count) { + int sum = 0; + for (int i = 0; i < count; i++) { + sum += foo(i); + } + return sum; + } + + public static int foo(int x) { + if (x < 15) { + return bar(x); + } + return bar(x + 1); + } + + public static int bar(int x) { + return x + 1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(215, test(20)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_inline02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_inline02 { + + public static int test(int count) { + int sum = 0; + for (int i = 0; i < count; i++) { + sum += foo(i, sum); + } + return sum; + } + + public static int foo(int x, int y) { + if (x < 18) { + return bar(x, x - y); + } + return bar(x, x + y); + } + + public static int bar(int x, int y) { + if (x < 15) { + return car(x, x + y); + } + return x - 1; + } + + @SuppressWarnings("unused") + public static int car(int x, int y) { + if (x < 13) { + return x + 1; + } + return x - 1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(196, test(20)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_invoke01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop + +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_invoke01 { + + private static int sum; + + public static int test(int count) { + sum = 0; + final Instruction[] instructions = new Instruction[]{new Instruction.Add(), new Instruction.Sub(), new Instruction.Mul(), new Instruction.Div()}; + final Visitor v = new Visitor(); + for (int i = 0; i < count; i++) { + instructions[i % 4].accept(v); + } + return sum; + } + + public static abstract class Instruction { + + public abstract void accept(Visitor v); + + public static abstract class Binary extends Instruction { + + } + + public static class Add extends Binary { + + @Override + public void accept(Visitor v) { + v.visit(this); + } + } + + public static class Sub extends Binary { + + @Override + public void accept(Visitor v) { + v.visit(this); + } + } + + public static class Mul extends Binary { + + @Override + public void accept(Visitor v) { + v.visit(this); + } + } + + public static class Div extends Binary { + + @Override + public void accept(Visitor v) { + v.visit(this); + } + } + } + + @SuppressWarnings("unused") + public static class Visitor { + + public void visit(Instruction.Add i) { + sum += 7; + } + + public void visit(Instruction.Sub i) { + sum += 194127; + } + + public void visit(Instruction.Mul i) { + sum += 18991; + } + + public void visit(Instruction.Div i) { + sum += 91823; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3049480, test(40)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(6098960, test(80)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_life.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import java.util.*; + +import org.junit.*; + +/* + */ +public class HP_life { + + public static int test(int generations) { + reset(); + for (int i = 0; i < generations; ++i) { + step(); + } + int sum = 0; + for (int row = 0; row < rows; ++row) { + for (int col = 0; col < cols; ++col) { + boolean value = cell(row, col); + // System.out.print(value ? "1" : "0"); + sum += (row * 15223242 + col * 21623234) ^ ((value ? 1 : 0) * 15323142); + } + } + return sum; + } + + private static final int rows = 20; + private static final int cols = 20; + private static boolean cells[] = new boolean[rows * cols]; + + private static boolean cell(int row, int col) { + return ((row >= 0) && (row < rows) && (col >= 0) && (col < cols) && cells[row * cols + col]); + } + + private static boolean step() { + boolean next[] = new boolean[rows * cols]; + boolean changed = false; + for (int row = rows - 1; row >= 0; --row) { + int row_offset = row * cols; + for (int col = cols - 1; col >= 0; --col) { + int count = 0; + if (cell(row - 1, col - 1)) { + count++; + } + if (cell(row - 1, col)) { + count++; + } + if (cell(row - 1, col + 1)) { + count++; + } + if (cell(row, col - 1)) { + count++; + } + if (cell(row, col + 1)) { + count++; + } + if (cell(row + 1, col - 1)) { + count++; + } + if (cell(row + 1, col)) { + count++; + } + if (cell(row + 1, col + 1)) { + count++; + } + boolean old_state = cells[row_offset + col]; + boolean new_state = (!old_state && count == 3) || (old_state && (count == 2 || count == 3)); + if (!changed && new_state != old_state) { + changed = true; + } + next[row_offset + col] = new_state; + } + } + cells = next; + return changed; + } + + private static void reset() { + Random random = new Random(0); + boolean cells2[] = HP_life.cells; + for (int offset = 0; offset < cells2.length; ++offset) { + cells2[offset] = random.nextDouble() > 0.5; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-1756613086, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_nest01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_nest01 { + + public static int test(int count) { + int sum = 0; + for (int i = 0; i < count; i++) { + sum += i; + for (int j = 0; j < count; j++) { + sum += j; + } + for (int j = 0; j < count; j++) { + sum += j; + } + } + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3255, test(15)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_nest02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_nest02 { + + public static int test(int count) { + int sum = 0; + for (int i = 0; i < count; i++) { + sum += i; + sum = foo(count, sum); + sum = foo(count, sum); + } + return sum; + } + + private static int foo(int count, int s) { + int sum = s; + for (int j = 0; j < count; j++) { + sum += j; + } + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3255, test(15)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_scope01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_scope01 { + + public static int test(int count) { + int sum = 0; + + for (int k = 0; k < count; k++) { + { + int i = 1; + sum += i; + } + { + float f = 3; + sum += f; + } + { + long l = 7; + sum += l; + } + { + double d = 11; + sum += d; + } + } + + for (int k = 0; k < count; k++) { + if (k < 20) { + int i = 1; + sum += i; + } else { + float f = 3; + sum += f; + } + } + + for (int k = 0; k < count; k++) { + int i = 3; + for (int j = 0; j < count; j++) { + float f = 7; + sum += i + f; + } + } + + for (int k = 0; k < count; k++) { + for (int j = 0; j < count; j++) { + float f = 7; + sum += j + f; + } + int i = 3; + sum += i; + } + + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(59480, test(40)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_scope02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_scope02 { + + public static int test(int count) { + int sum = 0; + // Although sum is not explicitly read in the tree below it is implicitly read + // by the guard bail-out. + for (int i = 0; i < count; i++) { + if (i > 20) { + break; // We need to write back either the original value of sum, or the previous iteration's value. + } + sum = i; + } + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(20, test(40)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(20, test(22)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_series.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop + +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_series { + + public static double test(int count) { + final int arrayRows = count; + final double[][] testArray = new double[2][arrayRows]; + double omega; // Fundamental frequency. + testArray[0][0] = TrapezoidIntegrate(0.0, // Lower bound. + 2.0, // Upper bound. + 1000, // # of steps. + 0.0, // No omega*n needed. + 0) / 2.0; // 0 = term A[0]. + omega = 3.1415926535897932; + for (int i = 1; i < arrayRows; i++) { + testArray[0][i] = TrapezoidIntegrate(0.0, 2.0, 1000, omega * i, 1); // 1 = cosine + // term. + testArray[1][i] = TrapezoidIntegrate(0.0, 2.0, 1000, omega * i, 2); // 2 = sine + // term. + } + final double ref[][] = {{2.8729524964837996, 0.0}, {1.1161046676147888, -1.8819691893398025}, {0.34429060398168704, -1.1645642623320958}, {0.15238898702519288, -0.8143461113044298}}; + double error = 0.0; + double sum = 0.0; + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 2; j++) { + error += Math.abs(testArray[j][i] - ref[i][j]); + sum += testArray[j][i]; + } + } + return sum + error; + } + + private static double TrapezoidIntegrate(double x0, // Lower bound. + double x1, // Upper bound. + int ns, // # of steps. + double omegan, // omega * n. + int select) // Term type. + { + int nsteps = ns; + double x; // Independent variable. + double dx; // Step size. + double rvalue; // Return value. + + x = x0; + dx = (x1 - x0) / nsteps; + rvalue = thefunction(x0, omegan, select) / 2.0; + if (nsteps != 1) { + --nsteps; // Already done 1 step. + while (--nsteps > 0) { + x += dx; + rvalue += thefunction(x, omegan, select); + } + } + rvalue = (rvalue + thefunction(x1, omegan, select) / 2.0) * dx; + return (rvalue); + } + + private static double thefunction(double x, // Independent variable. + double omegan, // Omega * term. + int select) // Choose type. + { + switch (select) { + case 0: + return (Math.pow(x + 1.0, x)); + case 1: + return (Math.pow(x + 1.0, x) * Math.cos(omegan * x)); + case 2: + return (Math.pow(x + 1.0, x) * Math.sin(omegan * x)); + } + return (0.0); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.6248571921291398d, test(100), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotpath/HP_trees01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +// Checkstyle: stop +package com.oracle.max.graal.jtt.hotpath; + +import org.junit.*; + +/* + */ +public class HP_trees01 { + + public static int test(int count) { + int sum = 0; + for (int i = 0; i < count; i++) { + if (i < 100) { + sum += 1; + } else if (i < 200) { + sum += 3; + } else if (i < 300) { + sum += 5; + } else if (i < 400) { + sum += 7; + } else if (i < 500) { + sum += 11; + } + + if (i % 5 == 0) { + sum += 1; + } else if (i % 5 == 1) { + sum += 3; + } else if (i % 5 == 2) { + sum += 5; + } else if (i % 5 == 3) { + sum += 7; + } else if (i % 5 == 4) { + sum += 11; + } + } + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(8100, test(1000)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotspot/Test6186134.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.hotspot; + +import java.util.*; + +import org.junit.*; + +public class Test6186134 { + + public static class TestClass { + + int num = 0; + + public TestClass(int n) { + num = n; + } + + public boolean more() { + return num-- > 0; + } + + public ArrayList test1() { + ArrayList<Object> res = new ArrayList<>(); + int maxResults = Integer.MAX_VALUE; + int n = 0; + boolean more = more(); + while ((n++ < maxResults) && more) { + res.add(new Object()); + more = more(); + } + return res; + } + + } + + public static int test(int n) { + for (int i = 0; i < n; i++) { + TestClass t = new TestClass(10); + int size = t.test1().size(); + if (size != 10) { + return 97; + } + } + return 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(100)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotspot/Test6196102.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.hotspot; + +import org.junit.*; + +/** + * @test + * @bug 6196102 + * @summary Integer seems to be greater than Integer.MAX_VALUE + * + * @run main Test6196102 + */ + +public class Test6196102 { + + public static String test() { + int i1 = 0; + int i2 = Integer.MAX_VALUE; + + while (i1 >= 0) { + i1++; + if (i1 > i2) { + return "E R R O R: " + i1; + } + } + return "ok"; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("ok", test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotspot/Test6753639.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.hotspot; + +import org.junit.*; + +/** + * @test + * @bug 6753639 + * @summary Strange optimisation in for loop with cyclic integer condition + * + * @run main/othervm -Xbatch Test6753639 + */ + +public class Test6753639 { + + public static int test() { + int end = Integer.MAX_VALUE; + int count = 0; + for (int i = Integer.MAX_VALUE - 5; i <= end; i++) { + count++; + if (count > 100000) { + return 95; + } + } + return 97; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(95, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotspot/Test6850611.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.hotspot; + +import org.junit.*; + +/** + * @test + * @bug 6850611 + * @summary int / long arithmetic seems to be broken in 1.6.0_14 HotSpot Server VM (Win XP) + * + * @run main Test6850611 + */ + +public class Test6850611 { + + public static int test() { + // for (int j = 0; j < 5; ++j) { + long x = 0; + for (int i = Integer.MIN_VALUE; i < Integer.MAX_VALUE; ++i) { + x += i; + } + if (x != -4294967295L) { + return 97; + } + // } + return 95; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(95, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotspot/Test6959129.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.hotspot; + +import org.junit.*; + +/** + * @test + * @bug 6959129 + * @summary COMPARISON WITH INTEGER.MAX_INT DOES NOT WORK CORRECTLY IN THE CLIENT VM. + * + * This test will not run properly without assertions + * + * @run main/othervm -ea Test6959129 + */ + +public class Test6959129 { + + public static int test() { + int min = Integer.MAX_VALUE - 30000; + int max = Integer.MAX_VALUE; + try { + maxMoves(min, max); + } catch (AssertionError e) { + return 95; + } + return 97; + } + + /** + * Imperative implementation that returns the length hailstone moves for a given number. + */ + public static long hailstoneLengthImp(long n2) { + long n = n2; + long moves = 0; + while (n != 1) { + assert n > 1; + if (isEven(n)) { + n = n / 2; + } else { + n = 3 * n + 1; + } + ++moves; + } + return moves; + } + + private static boolean isEven(long n) { + return n % 2 == 0; + } + + /** + * Returns the maximum length of the hailstone sequence for numbers between min to max. + * + * For rec1 - Assume that min is bigger than max. + */ + public static long maxMoves(int min, int max) { + long maxmoves = 0; + for (int n = min; n <= max; n++) { + long moves = hailstoneLengthImp(n); + if (moves > maxmoves) { + maxmoves = moves; + } + } + return maxmoves; + } + + // @Test + public void run0() throws Throwable { + Assert.assertEquals(95, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/hotspot/Test7005594.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.hotspot; + +/** + * @test + * @bug 7005594 + * @summary Array overflow not handled correctly with loop optimzations + * + * @run shell Test7005594.sh + * @##Disabled huge heap##Runs: 0 = 95 + */ + +public class Test7005594 { + + private static int test0(byte[] a) { + int result = 0; + for (int i = 0; i < a.length; i += ((0x7fffffff >> 1) + 1)) { + result += a[i]; + } + return result; + } + + public static int test() { + byte[] a = new byte[(0x7fffffff >> 1) + 2]; + try { + test0(a); + } catch (ArrayIndexOutOfBoundsException e) { + return 95; + } + return 97; + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/jdk/Class_getName.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.jdk; + +import org.junit.*; + +/* + */ +public class Class_getName { + + public static String test(int a) { + if (a == 0) { + return String.class.getName(); + } + return ""; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("java.lang.String", test(0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/jdk/EnumMap01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.jdk; + +import java.util.*; + +import org.junit.*; + +/* + */ +public class EnumMap01 { + + private static final EnumMap<Enum, String> map = new EnumMap<>(Enum.class); + + static { + map.put(Enum.A, "A"); + map.put(Enum.B, "B"); + map.put(Enum.C, "C"); + } + + public static String test(int i) { + return map.get(Enum.values()[i]); + } + + private enum Enum { + A, B, C + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("A", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("B", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("C", test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/jdk/EnumMap02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.jdk; + +import java.util.*; + +import org.junit.*; + +/* + */ +public class EnumMap02 { + + public static String test(int i) { + EnumMap<Enum, String> map = new EnumMap<>(Enum.class); + map.put(Enum.A, "A"); + map.put(Enum.B, "B"); + map.put(Enum.C, "C"); + return map.get(Enum.values()[i]); + } + + private enum Enum { + A, B, C + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("A", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("B", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("C", test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/jdk/System_currentTimeMillis01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.jdk; + +import org.junit.*; + +/* + */ +public class System_currentTimeMillis01 { + + public static int test() { + long start = System.currentTimeMillis(); + for (int i = 0; i < 10000000; i++) { + if (System.currentTimeMillis() - start > 0) { + return 1; + } + } + return 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/jdk/System_currentTimeMillis02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.jdk; + +import org.junit.*; + +/* + */ +public class System_currentTimeMillis02 { + + public static boolean test() { + long start = System.currentTimeMillis(); + long delta = 0; + for (int i = 0; delta == 0 && i < 5000000; i++) { + delta = System.currentTimeMillis() - start; + // do nothing. + } + // better get at least 40 millisecond resolution. + return delta >= 1 && delta < 40; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/jdk/System_nanoTime01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.jdk; + +import org.junit.*; + +/* + */ +public class System_nanoTime01 { + + public static int test() { + long start = System.nanoTime(); + for (int i = 0; i < 10000000; i++) { + if (System.nanoTime() - start > 0) { + return 1; + } + } + return 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/jdk/System_nanoTime02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.jdk; + +import org.junit.*; + +/* + */ +public class System_nanoTime02 { + + public static boolean test() { + long minDelta = Long.MAX_VALUE; + + // the first call to System.nanoTime might take a long time due to call resolution + for (int c = 0; c < 10; c++) { + long start = System.nanoTime(); + long delta = 0; + int i; + for (i = 0; delta == 0 && i < 50000; i++) { + delta = System.nanoTime() - start; + // do nothing. + } + if (delta < minDelta) { + minDelta = delta; + } + } + + // better get at least 30 microsecond resolution. + return minDelta > 1 && minDelta < 30000; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/jdk/System_setOut.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.jdk; + +import java.io.*; + +import org.junit.*; + +/* + */ +public class System_setOut { + + public static int test(int n) throws Exception { + PrintStream oldOut = System.out; + int sum = 0; + for (int i = 0; i < 10; i++) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(n * 10); + PrintStream newOut = new PrintStream(ba); + System.setOut(newOut); + doPrint(n); + sum += ba.size(); + } + + System.setOut(oldOut); + return sum; + } + +// @NEVER_INLINE + private static void doPrint(int n) { + for (int i = 0; i < n; i++) { + System.out.print('x'); + } + } + + public static void main(String[] args) throws Exception { + System.out.println(test(10000)); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(100000, test(10000)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/jdk/Thread_setName.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.jdk; + +import org.junit.*; + +/* + */ +public class Thread_setName { + + public static String test(String name) { + String oldName = Thread.currentThread().getName(); + Thread.currentThread().setName(name); + String name2 = Thread.currentThread().getName(); + Thread.currentThread().setName(oldName); + return name2; + } + + public static void main(String[] args) throws Exception { + System.out.println(test("abc")); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("abc", test("abc")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/jdk/UnsafeAccess01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.jdk; + +import java.lang.reflect.*; + +import org.junit.*; + +import sun.misc.*; + +/* + */ +public class UnsafeAccess01 { + + @SuppressWarnings("unused") + private int field = 42; + + public static int test() throws SecurityException, NoSuchFieldException, IllegalAccessException { + final Unsafe unsafe = getUnsafe(); + + final UnsafeAccess01 object = new UnsafeAccess01(); + final Field field = UnsafeAccess01.class.getDeclaredField("field"); + final long offset = unsafe.objectFieldOffset(field); + final int value = unsafe.getInt(object, offset); + return value; + } + + private static Unsafe getUnsafe() throws NoSuchFieldException, IllegalAccessException { + final Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe"); + unsafeField.setAccessible(true); + return (Unsafe) unsafeField.get(null); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(42, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Boxed_TYPE_01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class Boxed_TYPE_01 { + + public static String test(int i) { + if (i == 0) { + return Boolean.TYPE.getName(); + } + if (i == 1) { + return Byte.TYPE.getName(); + } + if (i == 2) { + return Character.TYPE.getName(); + } + if (i == 3) { + return Double.TYPE.getName(); + } + if (i == 4) { + return Float.TYPE.getName(); + } + if (i == 5) { + return Integer.TYPE.getName(); + } + if (i == 6) { + return Long.TYPE.getName(); + } + if (i == 7) { + return Short.TYPE.getName(); + } + if (i == 8) { + return Void.TYPE.getName(); + } + return null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("boolean", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("byte", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("char", test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals("double", test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals("float", test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals("int", test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals("long", test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals("short", test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals("void", test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Bridge_method01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class Bridge_method01 { + + private abstract static class Wrap<T> { + + abstract T get(); + } + + private static class IWrap extends Wrap<Integer> { + + @Override + Integer get() { + return 1; + } + } + + private static Wrap<Integer> wrapped = new IWrap(); + + public static int test() { + return wrapped.get(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/ClassLoader_loadClass01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import java.net.*; + +import org.junit.*; + +/* + */ +@SuppressWarnings("static-method") +public final class ClassLoader_loadClass01 { + + public static String test(int i) throws ClassNotFoundException { + final URLClassLoader classLoader = new URLClassLoader(new URL[0], String.class.getClassLoader()); + if (i == 0) { + return classLoader.loadClass("java.lang.String").toString(); + } else if (i == 1) { + return classLoader.loadClass("[Ljava.lang.String;").toString(); + } else if (i == 2) { + return classLoader.loadClass("java.lang.String[]").toString(); + } + return null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("class java.lang.String", test(0)); + } + + @Test(expected = java.lang.ClassNotFoundException.class) + public void run1() throws Throwable { + test(1); + } + + @Test(expected = java.lang.ClassNotFoundException.class) + public void run2() throws Throwable { + test(2); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(null, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_Literal01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_Literal01 { + + public static String test(int i) { + if (i == 0) { + return Object.class.toString(); + } + if (i == 1) { + return String.class.toString(); + } + if (i == 2) { + return Class.class.toString(); + } + if (i == 3) { + return Class_Literal01.class.toString(); + } + return null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("class java.lang.Object", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("class java.lang.String", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("class java.lang.Class", test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals("class com.oracle.max.graal.jtt.lang.Class_Literal01", test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(null, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_asSubclass01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_asSubclass01 { + + public static int test(int i) { + if (i == 0) { + if (Object.class.asSubclass(String.class) == null) { + return -1; + } + } + if (i == 1) { + if (String.class.asSubclass(Object.class) == null) { + return -1; + } + } + if (i == 2) { + if (Object.class.asSubclass(Class_asSubclass01.class) == null) { + return -1; + } + } + if (i == 3) { + if (Class_asSubclass01.class.asSubclass(Object.class) == null) { + return -1; + } + } + return i; + } + + @Test(expected = java.lang.ClassCastException.class) + public void run0() throws Throwable { + test(0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test(expected = java.lang.ClassCastException.class) + public void run2() throws Throwable { + test(2); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(3, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(4, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_cast01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_cast01 { + + static final String string = ""; + static final Object object = new Object(); + static final Class_cast01 thisObject = new Class_cast01(); + + public static int test(int i) { + if (i == 0) { + if (Object.class.cast(string) == null) { + return -1; + } + } + if (i == 1) { + if (String.class.cast(object) == null) { + return -1; + } + } + if (i == 2) { + if (Object.class.cast(thisObject) == null) { + return -1; + } + } + if (i == 3) { + if (Class_cast01.class.cast(object) == null) { + return -1; + } + } + return i; + } + + @Test(expected = java.lang.ClassCastException.class) + public void run0() throws Throwable { + test(1); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test(expected = java.lang.ClassCastException.class) + public void run2() throws Throwable { + test(3); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(2, test(2)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(4, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_cast02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_cast02 { + + static final String string = ""; + static final Object object = new Object(); + static final Class_cast02 thisObject = new Class_cast02(); + + public static int test(int i) { + if (i == 0) { + if (Object.class.cast(null) == null) { + return -1; + } + } + if (i == 1) { + if (String.class.cast(null) == null) { + return -1; + } + } + if (i == 2) { + if (Object.class.cast(null) == null) { + return -1; + } + } + if (i == 3) { + if (Class_cast02.class.cast(null) == null) { + return -1; + } + } + return i; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-1, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-1, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-1, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(4, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_forName01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_forName01 { + + public static String test(int i) throws ClassNotFoundException { + if (i == 0) { + return Class.forName("java.lang.Object").toString(); + } + if (i == 1) { + return Class.forName("java.lang.String").toString(); + } + if (i == 2) { + return Class.forName("com.oracle.max.graal.jtt.lang.Class_forName01").toString(); + } + if (i == 3) { + return Class.forName("xyxzz.xyzyzyz.XXYYY").toString(); + } + return null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("class java.lang.Object", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("class java.lang.String", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("class com.oracle.max.graal.jtt.lang.Class_forName01", test(2)); + } + + @Test(expected = java.lang.ClassNotFoundException.class) + public void run3() throws Throwable { + test(3); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(null, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_forName02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_forName02 { + + public static String test(int i) throws ClassNotFoundException { + String clname = null; + Class cl = null; + if (i == 0) { + clname = "java.lang.Object"; + cl = Object.class; + } else if (i == 1) { + clname = "java.lang.String"; + cl = String.class; + } else if (i == 2) { + clname = "com.oracle.max.graal.jtt.lang.Class_forName02"; + cl = Class_forName02.class; + } else if (i == 3) { + clname = "xyzz.zyxy.XYXY"; + cl = Class_forName02.class; + } + if (clname != null) { + return Class.forName(clname, false, cl.getClassLoader()).toString(); + } + return null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("class java.lang.Object", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("class java.lang.String", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("class com.oracle.max.graal.jtt.lang.Class_forName02", test(2)); + } + + @Test(expected = java.lang.ClassNotFoundException.class) + public void run3() throws Throwable { + test(3); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(null, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_forName03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import java.net.*; + +import org.junit.*; + +/* + */ +@SuppressWarnings("static-method") +public final class Class_forName03 { + + public static String test(int i) throws ClassNotFoundException { + String clname = null; + Class cl = null; + if (i == 0) { + clname = "java.lang.Object[]"; + cl = Object.class; + } else if (i == 1) { + clname = "[Ljava.lang.String;"; + cl = String.class; + } else if (i == 2) { + clname = "[Ljava/lang/String;"; + cl = String.class; + } else if (i == 3) { + clname = "[I"; + cl = Class_forName03.class; + } else if (i == 4) { + clname = "[java.lang.Object;"; + cl = Class_forName03.class; + } + if (clname != null) { + return Class.forName(clname, false, new URLClassLoader(new URL[0], cl.getClassLoader())).toString(); + } + return null; + } + + @Test(expected = java.lang.ClassNotFoundException.class) + public void run0() throws Throwable { + test(0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("class [Ljava.lang.String;", test(1)); + } + + @Test(expected = java.lang.ClassNotFoundException.class) + public void run2() throws Throwable { + test(2); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals("class [I", test(3)); + } + + @Test(expected = java.lang.ClassNotFoundException.class) + public void run4() throws Throwable { + test(4); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(null, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_forName04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +@SuppressWarnings("static-method") +public final class Class_forName04 { + + public static String test(int i) throws ClassNotFoundException { + String clname = null; + if (i == 0) { + clname = "java.lang.Object[]"; + } else if (i == 1) { + clname = "[Ljava.lang.String;"; + } else if (i == 2) { + clname = "[Ljava/lang/String;"; + } else if (i == 3) { + clname = "[I"; + } else if (i == 4) { + clname = "[java.lang.Object;"; + } + if (clname != null) { + return Class.forName(clname).toString(); + } + return null; + } + + @Test(expected = java.lang.ClassNotFoundException.class) + public void run0() throws Throwable { + test(0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("class [Ljava.lang.String;", test(1)); + } + + @Test(expected = java.lang.ClassNotFoundException.class) + public void run2() throws Throwable { + test(2); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals("class [I", test(3)); + } + + @Test(expected = java.lang.ClassNotFoundException.class) + public void run4() throws Throwable { + test(4); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(null, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_forName05.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import java.net.*; + +import org.junit.*; + +/* + */ +@SuppressWarnings("static-method") +public final class Class_forName05 { + + public static String test(int i) throws ClassNotFoundException { + final URLClassLoader classLoader = new URLClassLoader(new URL[0], String.class.getClassLoader()); + if (i == 0) { + return Class.forName("java.lang.String", false, classLoader).toString(); + } else if (i == 1) { + return Class.forName("[Ljava.lang.String;", false, classLoader).toString(); + } + return null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("class java.lang.String", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("class [Ljava.lang.String;", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(null, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_getComponentType01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_getComponentType01 { + + public static String test(int i) { + Class cl = Object.class; + if (i == 0) { + cl = int.class; + } else if (i == 1) { + cl = int[].class; + } else if (i == 2) { + cl = Object.class; + } else if (i == 3) { + cl = Object[].class; + } else if (i == 4) { + cl = Class_getComponentType01.class; + } else if (i == 5) { + cl = Cloneable.class; + } else if (i == 6) { + cl = Object[][].class; + } else if (i == 7) { + cl = void.class; + } + cl = cl.getComponentType(); + if (cl == null) { + return null; + } + return cl.getName(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(null, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("int", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(null, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals("java.lang.Object", test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(null, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(null, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals("[Ljava.lang.Object;", test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(null, test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(null, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_getInterfaces01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ + +@SuppressWarnings("static-method") +public final class Class_getInterfaces01 { + + public static String test(int i) { + switch (i) { + case 0: + return toString(I1.class); + case 1: + return toString(I2.class); + case 2: + return toString(C1.class); + case 3: + return toString(C2.class); + case 4: + return toString(C12.class); + default: + return null; + } + } + + private static String toString(Class< ? > klass) { + final Class< ? >[] classes = klass.getInterfaces(); + final StringBuilder sb = new StringBuilder(); + boolean first = true; + for (Class< ? > c : classes) { + if (!first) { + sb.append(' '); + } else { + first = false; + } + sb.append(c.getName()); + } + return sb.toString(); + } + + interface I1 { + + } + + interface I2 extends I1 { + + } + + static class C1 implements I1 { + + } + + static class C2 implements I2 { + + } + + static class C12 implements I1, I2 { + + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("com.oracle.max.graal.jtt.lang.Class_getInterfaces01$I1", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("com.oracle.max.graal.jtt.lang.Class_getInterfaces01$I1", test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals("com.oracle.max.graal.jtt.lang.Class_getInterfaces01$I2", test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals("com.oracle.max.graal.jtt.lang.Class_getInterfaces01$I1 com.oracle.max.graal.jtt.lang.Class_getInterfaces01$I2", test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_getName01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_getName01 { + + public static String test(int i) { + if (i == 0) { + return Object.class.getName(); + } else if (i == 1) { + return Class.class.getName(); + } else if (i == 2) { + return Class_getName01.class.getName(); + } else if (i == 3) { + return "a string".getClass() == String.class ? "true" : "false"; + } + return null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("java.lang.Object", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("java.lang.Class", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("com.oracle.max.graal.jtt.lang.Class_getName01", test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals("true", test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(null, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_getName02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_getName02 { + + public static String test(int i) { + if (i == 0) { + return int.class.getName(); + } + if (i == 1) { + return int[].class.getName(); + } + if (i == 2) { + return Object[][].class.getName(); + } + return null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("int", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("[I", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("[[Ljava.lang.Object;", test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(null, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_getSimpleName01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_getSimpleName01 { + + public static String test(int i) { + if (i == 0) { + return Object.class.getSimpleName(); + } + if (i == 1) { + return Class.class.getSimpleName(); + } + if (i == 2) { + return Class_getSimpleName01.class.getSimpleName(); + } + return null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("Object", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("Class", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("Class_getSimpleName01", test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(null, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_getSimpleName02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_getSimpleName02 { + + public static String test(int i) { + if (i == 0) { + return int.class.getSimpleName(); + } + if (i == 1) { + return int[].class.getSimpleName(); + } + if (i == 2) { + return Object[][].class.getSimpleName(); + } + return null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("int", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("int[]", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("Object[][]", test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(null, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_getSuperClass01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_getSuperClass01 { + + public static String test(int i) { + Class cl = Object.class; + if (i == 0) { + cl = int.class; + } else if (i == 1) { + cl = Object.class; + } else if (i == 2) { + cl = int[].class; + } else if (i == 3) { + cl = Cloneable.class; + } else if (i == 4) { + cl = Integer.class; + } else if (i == 5) { + cl = Class.class; + } else if (i == 6) { + cl = Class_getSuperClass01.class; + } + cl = cl.getSuperclass(); + if (cl == null) { + return null; + } + return cl.getName(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(null, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(null, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("java.lang.Object", test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(null, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals("java.lang.Number", test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals("java.lang.Object", test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals("java.lang.Object", test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(null, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_isArray01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_isArray01 { + + public static boolean test(int i) { + if (i == 0) { + return int.class.isArray(); + } + if (i == 1) { + return int[].class.isArray(); + } + if (i == 2) { + return Object.class.isArray(); + } + if (i == 3) { + return Object[].class.isArray(); + } + if (i == 4) { + return Class_isArray01.class.isArray(); + } + if (i == 5) { + return Cloneable.class.isArray(); + } + if (i == 6) { + return Runnable.class.isArray(); + } + if (i == 7) { + return void.class.isArray(); + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_isAssignableFrom01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_isAssignableFrom01 { + + public static boolean test(int i) { + Class source = Object.class; + if (i == 0) { + source = int.class; + } + if (i == 1) { + source = int[].class; + } + if (i == 2) { + source = float.class; + } + if (i == 3) { + source = byte.class; + } + if (i == 4) { + source = Runnable.class; + } + if (i == 5) { + source = Class_isAssignableFrom01.class; + } + if (i == 6) { + source = Object[].class; + } + return int.class.isAssignableFrom(source); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_isAssignableFrom02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_isAssignableFrom02 { + + public static boolean test(int i) { + Class source = Object.class; + if (i == 0) { + source = int.class; + } + if (i == 1) { + source = int[].class; + } + if (i == 2) { + source = float.class; + } + if (i == 3) { + source = byte.class; + } + if (i == 4) { + source = Runnable.class; + } + if (i == 5) { + source = Class_isAssignableFrom02.class; + } + if (i == 6) { + source = Object[].class; + } + return Object.class.isAssignableFrom(source); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_isAssignableFrom03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_isAssignableFrom03 implements Cloneable { + + public static boolean test(int i) { + Class source = Object.class; + if (i == 0) { + source = int.class; + } + if (i == 1) { + source = int[].class; + } + if (i == 2) { + source = float.class; + } + if (i == 3) { + source = Cloneable.class; + } + if (i == 4) { + source = Runnable.class; + } + if (i == 5) { + source = Class_isAssignableFrom03.class; + } + if (i == 6) { + source = Object[].class; + } + return Cloneable.class.isAssignableFrom(source); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_isInstance01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_isInstance01 { + + static final String string = ""; + static final Object obj = new Object(); + static final Class_isInstance01 thisObject = new Class_isInstance01(); + + public static boolean test(int i) { + Object object = null; + if (i == 0) { + object = obj; + } + if (i == 1) { + object = string; + } + if (i == 2) { + object = thisObject; + } + return Object.class.isInstance(object); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_isInstance02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_isInstance02 { + + static final String string = ""; + static final Object obj = new Object(); + static final Class_isInstance02 thisObject = new Class_isInstance02(); + + public static boolean test(int i) { + Object object = null; + if (i == 0) { + object = obj; + } + if (i == 1) { + object = string; + } + if (i == 2) { + object = thisObject; + } + return String.class.isInstance(object); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_isInstance03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_isInstance03 { + + static final String string = ""; + static final Object obj = new Object(); + static final Class_isInstance03 thisObject = new Class_isInstance03(); + + public static boolean test(int i) { + Object object = null; + if (i == 0) { + object = obj; + } + if (i == 1) { + object = string; + } + if (i == 2) { + object = thisObject; + } + return Class_isInstance03.class.isInstance(object); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_isInstance04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_isInstance04 { + + static final String string = ""; + static final Object[] oarray = {}; + static final String[] sarray = {}; + + public static boolean test(int i) { + Object object = null; + if (i == 0) { + object = oarray; + } + if (i == 1) { + object = string; + } + if (i == 2) { + object = sarray; + } + return String[].class.isInstance(object); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_isInstance05.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_isInstance05 { + + static final String string = ""; + static final Object obj = new Object(); + static final int[] array = {}; + + public static boolean test(int i) { + Object object = null; + if (i == 0) { + object = obj; + } + if (i == 1) { + object = string; + } + if (i == 2) { + object = array; + } + return int[].class.isInstance(object); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_isInstance06.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_isInstance06 implements Cloneable { + + static final String string = ""; + static final Object obj = new Object(); + static final String[] sarray = {}; + static final Object thisObject = new Class_isInstance06(); + + public static boolean test(int i) { + Object object = null; + if (i == 0) { + object = obj; + } + if (i == 1) { + object = string; + } + if (i == 2) { + object = sarray; + } + if (i == 3) { + object = thisObject; + } + return Cloneable.class.isInstance(object); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_isInterface01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_isInterface01 { + + public static boolean test(int i) { + if (i == 0) { + return int.class.isInterface(); + } + if (i == 1) { + return int[].class.isInterface(); + } + if (i == 2) { + return Object.class.isInterface(); + } + if (i == 3) { + return Object[].class.isInterface(); + } + if (i == 4) { + return Class_isInterface01.class.isInterface(); + } + if (i == 5) { + return Cloneable.class.isInterface(); + } + if (i == 6) { + return Runnable.class.isInterface(); + } + if (i == 7) { + return void.class.isInterface(); + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Class_isPrimitive01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_isPrimitive01 { + + public static boolean test(int i) { + if (i == 0) { + return int.class.isPrimitive(); + } + if (i == 1) { + return int[].class.isPrimitive(); + } + if (i == 2) { + return Object.class.isPrimitive(); + } + if (i == 3) { + return Object[].class.isPrimitive(); + } + if (i == 4) { + return Class_isPrimitive01.class.isPrimitive(); + } + if (i == 5) { + return Cloneable.class.isPrimitive(); + } + if (i == 6) { + return Runnable.class.isPrimitive(); + } + if (i == 7) { + return void.class.isPrimitive(); + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Double_01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class Double_01 { + + public static boolean test() { + return Double.doubleToLongBits(Double.longBitsToDouble(0x7ff8000000000088L)) == 0x7ff8000000000000L; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Double_toString.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +@SuppressWarnings("static-method") +public final class Double_toString { + + public static String test() { + double z1 = 0.4363485526704198; + double z2 = -0.43536514763046896; + double z3 = z1 + z2; + return Double.toString(z3); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("9.834050399508132E-4", test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Float_01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +public class Float_01 { + + public static boolean test(float f) { + return /* Float.isNaN(f); */f != f; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(1.0f)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(2.0f)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(0.5f)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(java.lang.Float.NaN)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Float_02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class Float_02 { + + public static boolean test(float f) { + return f != 1.0f; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(1.0f)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(2.0f)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(0.5f)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(java.lang.Float.NaN)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Float_03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class Float_03 { + + public static boolean test() { + return Float.floatToIntBits(Float.intBitsToFloat(0x7fc00088)) == 0x7fc00000; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Int_greater01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Int_greater01 { + + public static boolean test(int i) { + if (i > 0) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-2147483648)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(-2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(-1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(2147483647)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Int_greater02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Int_greater02 { + + public static boolean test(int i) { + if (i > 5) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-2147483648)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(-2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(-1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(4)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(5)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(6)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(true, test(2147483647)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Int_greater03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Int_greater03 { + + public static boolean test(int i) { + if (i > -5) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-2147483648)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(-6)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(-5)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(-4)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(-1)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(true, test(2147483647)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Int_greaterEqual01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Int_greaterEqual01 { + + public static boolean test(int i) { + if (i >= 0) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-2147483648)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(-2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(-1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(2147483647)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Int_greaterEqual02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Int_greaterEqual02 { + + public static boolean test(int i) { + if (i >= 5) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-2147483648)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(-2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(-1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(4)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(6)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(true, test(2147483647)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Int_greaterEqual03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Int_greaterEqual03 { + + public static boolean test(int i) { + if (i >= -5) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-2147483648)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(-6)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(-5)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(-4)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(-1)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(true, test(2147483647)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Int_less01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Int_less01 { + + public static boolean test(int i) { + if (i < 0) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-2147483648)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(-2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(-1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(2)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(2147483647)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Int_less02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Int_less02 { + + public static boolean test(int i) { + if (i < 5) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-2147483648)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(-2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(-1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(2147483647)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Int_less03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Int_less03 { + + public static boolean test(int i) { + if (i < -5) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-2147483648)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(-6)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(-5)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(-4)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(-1)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(2)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(2147483647)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Int_lessEqual01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Int_lessEqual01 { + + public static boolean test(int i) { + if (i <= 0) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-2147483648)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(-2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(-1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(2)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(2147483647)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Int_lessEqual02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Int_lessEqual02 { + + public static boolean test(int i) { + if (i <= 5) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-2147483648)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(-2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(-1)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(2147483647)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Int_lessEqual03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Int_lessEqual03 { + + public static boolean test(int i) { + if (i <= -5) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-2147483648)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(-6)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(-5)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(-4)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(-1)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(2)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(2147483647)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/JDK_ClassLoaders01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class JDK_ClassLoaders01 { + + public static boolean test(int i) { + if (i == 0) { + return Object.class.getClassLoader() == null; + } + if (i == 1) { + return Class.class.getClassLoader() == null; + } + if (i == 2) { + return String.class.getClassLoader() == null; + } + if (i == 3) { + return Thread.class.getClassLoader() == null; + } + if (i == 4) { + return System.class.getClassLoader() == null; + } + if (i == 5) { + return ClassLoader.class.getClassLoader() == null; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(6)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/JDK_ClassLoaders02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * + * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product + * that is described in this document. In particular, and without limitation, these intellectual property + * rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or + * more additional patents or pending patent applications in the U.S. and in other countries. + * + * U.S. Government Rights - Commercial software. Government users are subject to the Sun + * Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its + * supplements. + * + * Use is subject to license terms. Sun, Sun Microsystems, the Sun logo, Java and Solaris are trademarks or + * registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks + * are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the + * U.S. and other countries. + * + * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open + * Company, Ltd. + */ +package com.oracle.max.graal.jtt.lang; + +import java.net.*; + +import org.junit.*; + +/* + */ +public class JDK_ClassLoaders02 { + + public static boolean test() { + ClassLoader classLoader = JDK_ClassLoaders02.class.getClassLoader(); + return classLoader == null || classLoader instanceof URLClassLoader; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Long_greater01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +@SuppressWarnings("static-method") +public final class Long_greater01 { + + public static boolean test(long i) { + if (i > 0L) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-9223372036854775808L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(-2L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(-1L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(0L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(1L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(2L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(9223372036854775807L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Long_greater02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Long_greater02 { + + public static boolean test(long i) { + if (i > 5L) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-9223372036854775808L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(-2L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(-1L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(0L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(1L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(4L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(5L)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(6L)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(true, test(9223372036854775807L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Long_greater03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Long_greater03 { + + public static boolean test(long i) { + if (i > -5L) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-9223372036854775808L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(-6L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(-5L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(-4L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(-1L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(0L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(1L)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(2L)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(true, test(9223372036854775807L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Long_greaterEqual01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Long_greaterEqual01 { + + public static boolean test(long i) { + if (i >= 0L) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-9223372036854775808L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(-2L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(-1L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(0L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(1L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(2L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(9223372036854775807L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Long_greaterEqual02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Long_greaterEqual02 { + + public static boolean test(long i) { + if (i >= 5L) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-9223372036854775808L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(-2L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(-1L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(0L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(1L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(4L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(5L)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(6L)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(true, test(9223372036854775807L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Long_greaterEqual03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Long_greaterEqual03 { + + public static boolean test(long i) { + if (i >= -5L) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(-9223372036854775808L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(-6L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(-5L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(-4L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(-1L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(0L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(1L)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(2L)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(true, test(9223372036854775807L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Long_less01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Long_less01 { + + public static boolean test(long i) { + if (i < 0L) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-9223372036854775808L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(-2L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(-1L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(0L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(1L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(2L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(9223372036854775807L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Long_less02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Long_less02 { + + public static boolean test(long i) { + if (i < 5L) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-9223372036854775808L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(-2L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(-1L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(0L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(5L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(6L)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(9223372036854775807L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Long_less03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Long_less03 { + + public static boolean test(long i) { + if (i < -5L) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-9223372036854775808L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(-6L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(-5L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(-4L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(-1L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(0L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(1L)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(2L)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(9223372036854775807L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Long_lessEqual01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Long_lessEqual01 { + + public static boolean test(long i) { + if (i <= 0L) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-2L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(-9223372036854775808L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(-2L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(-1L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(0L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(1L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(2L)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(9223372036854775807L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Long_lessEqual02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Long_lessEqual02 { + + public static boolean test(long i) { + if (i <= 5L) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-9223372036854775808L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(-2L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(-1L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(0L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(6L)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(9223372036854775807L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Long_lessEqual03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Long_lessEqual03 { + + public static boolean test(long i) { + if (i <= -5L) { + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-9223372036854775808L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(-6L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(-5L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(-4L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(-1L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(0L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(false, test(1L)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(2L)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(9223372036854775807L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Long_reverseBytes01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class Long_reverseBytes01 { + + public static long test(long val) { + return Long.reverseBytes(val); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0x877665544332211L, test(0x1122334455667708L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Long_reverseBytes02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class Long_reverseBytes02 { + + public static long test(long val) { + return (((val >> 56) & 0xff) << 0) | (((val >> 48) & 0xff) << 8) | (((val >> 40) & 0xff) << 16) | (((val >> 32) & 0xff) << 24) | (((val >> 24) & 0xff) << 32) | (((val >> 16) & 0xff) << 40) | + (((val >> 8) & 0xff) << 48) | (((val >> 0) & 0xff) << 56); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0x877665544332211L, test(0x1122334455667708L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Math_abs.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class Math_abs { + + @SuppressWarnings("serial") + public static class NaN extends Throwable { + } + + public static double test(double arg) throws NaN { + double v = Math.abs(arg); + if (Double.isNaN(v)) { + // NaN can't be tested against itself + throw new NaN(); + } + return v; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(5.0d, test(5.0d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(5.0d, test(-5.0d), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0.0d, test(0.0d), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0.0d, test(-0.0d), 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(java.lang.Double.POSITIVE_INFINITY, test(java.lang.Double.NEGATIVE_INFINITY), 0); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(java.lang.Double.POSITIVE_INFINITY, test(java.lang.Double.POSITIVE_INFINITY), 0); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_abs.NaN.class) + public void run6() throws Throwable { + test(java.lang.Double.NaN); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Math_cos.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class Math_cos { + + @SuppressWarnings("serial") + public static class NaN extends Throwable { + } + + public static double test(double arg) throws NaN { + double v = Math.cos(arg); + if (Double.isNaN(v)) { + // NaN can't be tested against itself + throw new NaN(); + } + return v; + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_cos.NaN.class) + public void run0() throws Throwable { + test(java.lang.Double.NaN); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_cos.NaN.class) + public void run1() throws Throwable { + test(java.lang.Double.NEGATIVE_INFINITY); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_cos.NaN.class) + public void run2() throws Throwable { + test(java.lang.Double.POSITIVE_INFINITY); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Math_log.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class Math_log { + + @SuppressWarnings("serial") + public static class NaN extends Throwable { + } + + public static double test(double arg) throws NaN { + double v = Math.log(arg); + if (Double.isNaN(v)) { + // NaN can't be tested against itself + throw new NaN(); + } + return v; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1.0d, test(java.lang.Math.E), 0); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_log.NaN.class) + public void run1() throws Throwable { + test(java.lang.Double.NaN); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_log.NaN.class) + public void run2() throws Throwable { + test(-1.0d); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_log.NaN.class) + public void run3() throws Throwable { + test(java.lang.Double.NEGATIVE_INFINITY); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(java.lang.Double.POSITIVE_INFINITY, test(java.lang.Double.POSITIVE_INFINITY), 0); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(java.lang.Double.NEGATIVE_INFINITY, test(0.0d), 0); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(java.lang.Double.NEGATIVE_INFINITY, test(-0.0d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Math_log10.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class Math_log10 { + + @SuppressWarnings("serial") + public static class NaN extends Throwable { + } + + public static double test(double arg) throws NaN { + double v = Math.log10(arg); + if (Double.isNaN(v)) { + // NaN can't be tested against itself + throw new NaN(); + } + return v; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0d, test(1.0d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1.0d, test(10.0d), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2.0d, test(100.0d), 0); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_log10.NaN.class) + public void run3() throws Throwable { + test(java.lang.Double.NaN); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_log10.NaN.class) + public void run4() throws Throwable { + test(-1.0d); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_log10.NaN.class) + public void run5() throws Throwable { + test(java.lang.Double.NEGATIVE_INFINITY); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(java.lang.Double.POSITIVE_INFINITY, test(java.lang.Double.POSITIVE_INFINITY), 0); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(java.lang.Double.NEGATIVE_INFINITY, test(0.0d), 0); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(java.lang.Double.NEGATIVE_INFINITY, test(-0.0d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Math_pow.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class Math_pow { + + public static double test(double pow) { + return Math.pow(2.0d, pow); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(4.0d, test(2d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(8.574187700290345d, test(3.1d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Math_sin.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class Math_sin { + + @SuppressWarnings("serial") + public static class NaN extends Throwable { + } + + public static double test(double arg) throws NaN { + double v = Math.sin(arg); + if (Double.isNaN(v)) { + // NaN can't be tested against itself + throw new NaN(); + } + return v; + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_sin.NaN.class) + public void run0() throws Throwable { + test(java.lang.Double.NaN); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_sin.NaN.class) + public void run1() throws Throwable { + test(java.lang.Double.NEGATIVE_INFINITY); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_sin.NaN.class) + public void run2() throws Throwable { + test(java.lang.Double.POSITIVE_INFINITY); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-0.0d, test(-0.0d), 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0.0d, test(0.0d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Math_sqrt.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class Math_sqrt { + + @SuppressWarnings("serial") + public static class NaN extends Throwable { + } + + public static double test(double arg) throws NaN { + double v = Math.sqrt(arg); + if (Double.isNaN(v)) { + // NaN can't be tested against itself + throw new NaN(); + } + return v; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(2.0d, test(4.0d), 0); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_sqrt.NaN.class) + public void run1() throws Throwable { + test(java.lang.Double.NaN); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_sqrt.NaN.class) + public void run2() throws Throwable { + test(-1.0d); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_sqrt.NaN.class) + public void run3() throws Throwable { + test(java.lang.Double.NEGATIVE_INFINITY); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(java.lang.Double.POSITIVE_INFINITY, test(java.lang.Double.POSITIVE_INFINITY), 0); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(0.0d, test(0.0d), 0); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(-0.0d, test(-0.0d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Math_tan.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class Math_tan { + + @SuppressWarnings("serial") + public static class NaN extends Throwable { + } + + public static double test(double arg) throws NaN { + double v = Math.tan(arg); + if (Double.isNaN(v)) { + // NaN can't be tested against itself + throw new NaN(); + } + return v; + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_tan.NaN.class) + public void run0() throws Throwable { + test(java.lang.Double.NaN); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_tan.NaN.class) + public void run1() throws Throwable { + test(java.lang.Double.NEGATIVE_INFINITY); + } + + @Test(expected = com.oracle.max.graal.jtt.lang.Math_tan.NaN.class) + public void run2() throws Throwable { + test(java.lang.Double.POSITIVE_INFINITY); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-0.0d, test(-0.0d), 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0.0d, test(0.0d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Object_clone01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +public class Object_clone01 { + + static final Object_clone01 field = new Object_clone01(); + + public static boolean test(int i) throws CloneNotSupportedException { + return field.tryClone(i); + } + + @SuppressWarnings("unused") + private boolean tryClone(int i) throws CloneNotSupportedException { + return this == this.clone(); + } + + @Test(expected = java.lang.CloneNotSupportedException.class) + public void run0() throws Throwable { + test(0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Object_clone02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +public class Object_clone02 implements Cloneable { + + static final Object_clone02 field = new Object_clone02(); + + public static boolean test(int i) throws CloneNotSupportedException { + return field.tryClone(i); + } + + @SuppressWarnings("unused") + private boolean tryClone(int i) throws CloneNotSupportedException { + return this == this.clone(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Object_equals01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Object_equals01 { + + public static Object_equals01 field = new Object_equals01(); + + public static boolean test(int i) { + final Object obj1 = new Object(); + final Object obj2 = new Object(); + switch (i) { + case 0: + return obj1.equals(field); + case 1: + return obj1.equals(obj2); + case 2: + return obj1.equals(null); + case 3: + return obj1.equals(obj1); + case 4: + return field.equals(field); + case 5: + return obj2.equals(field); + case 6: + return obj2.equals(obj2); + case 7: + return obj2.equals(null); + case 8: + return obj2.equals(obj1); + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(false, test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Object_getClass01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Object_getClass01 { + + static final Object object = new Object(); + static final Object string = new String(); + static final Object_getClass01 thisObject = new Object_getClass01(); + + public static String test(int i) { + if (i == 0) { + return object.getClass().toString(); + } + if (i == 1) { + return string.getClass().toString(); + } + if (i == 2) { + return thisObject.getClass().toString(); + } + if (i == 3) { + return thisObject.getClass().getClass().toString(); + } + return null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("class java.lang.Object", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("class java.lang.String", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("class com.oracle.max.graal.jtt.lang.Object_getClass01", test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals("class java.lang.Class", test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(null, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Object_hashCode01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Object_hashCode01 { + + public static boolean test() { + final Object o1 = new Object(); + final Object o2 = new Object(); + return o1.hashCode() != 0 || o2.hashCode() != 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Object_notify01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Object_notify01 { + + static final Object object = new Object(); + + public static boolean test() { + object.notify(); + return true; + } + + @Test(expected = java.lang.IllegalMonitorStateException.class) + public void run0() throws Throwable { + test(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Object_notify02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Object_notify02 { + + static final Object object = new Object(); + + public static boolean test() { + synchronized (object) { + object.notify(); + } + return true; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Object_notifyAll01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Object_notifyAll01 { + + static final Object obj = new Object(); + + public static boolean test() { + obj.notifyAll(); + return true; + } + + @Test(expected = java.lang.IllegalMonitorStateException.class) + public void run0() throws Throwable { + test(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Object_notifyAll02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Object_notifyAll02 { + + static final Object object = new Object(); + + public static boolean test() { + synchronized (object) { + object.notifyAll(); + } + return true; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Object_toString01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +public class Object_toString01 { + + static final String string = "Object_toString01"; + static final Object object = new Object(); + + public static boolean test(int i) { + if (i == 0) { + return object.toString() != null; + } + if (i == 1) { + return new Object_toString01().toString() == string; + } + return false; + } + + @Override + public String toString() { + return string; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Object_toString02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +public class Object_toString02 { + + static final Object obj = new Object_toString02(); + + public static String test(int i) { + Object object = null; + if (i == 0) { + object = obj; + } else if (i == 1) { + object = "string"; + } else if (i == 2) { + object = "string".getClass(); + } + return object.toString(); + } + + @Override + public String toString() { + return "XYZ"; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("XYZ", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("string", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("class java.lang.String", test(2)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run3() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Object_wait01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Object_wait01 { + + static final Object object = new Object(); + + public static boolean test() throws InterruptedException { + object.wait(); + return true; + } + + @Test(expected = java.lang.IllegalMonitorStateException.class) + public void run0() throws Throwable { + test(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Object_wait02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Object_wait02 { + + static final Object object = new Object(); + + public static boolean test() throws InterruptedException { + synchronized (object) { + object.wait(1); + } + return true; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/Object_wait03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Object_wait03 { + + static final Object object = new Object(); + + public static boolean test() throws InterruptedException { + synchronized (object) { + object.wait(1, 1); + } + return true; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/ProcessEnvironment_init.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import java.util.*; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class ProcessEnvironment_init { + + private static HashMap<Object, Object> theEnvironment; + public static Map<Object, Object> theUnmodifiableEnvironment; + + public static int test(int v) { + + byte[][] environ = environ(); + theEnvironment = new HashMap<>(environ.length / 2 + 3); + + for (int i = environ.length - 1; i > 0; i -= 2) { + theEnvironment.put(Variable.valueOf(environ[i - 1]), Value.valueOf(environ[i])); + } + + theUnmodifiableEnvironment = Collections.unmodifiableMap(new StringEnvironment(theEnvironment)); + + return v; + } + + @SuppressWarnings("serial") + private static final class StringEnvironment extends HashMap<Object, Object> { + + @SuppressWarnings("unused") + public StringEnvironment(HashMap<Object, Object> theenvironment) { + } + } + + private static final class Variable { + + @SuppressWarnings("unused") + public static Object valueOf(byte[] bs) { + return new Object(); + } + } + + private static final class Value { + + @SuppressWarnings("unused") + public static Object valueOf(byte[] bs) { + return new Object(); + } + } + + private static byte[][] environ() { + return new byte[3][3]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(7, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/StringCoding_Scale.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +public class StringCoding_Scale { + + public static float maxCharPerByte = 1.0f; + + public static int test(int i) { + return scale(i, maxCharPerByte); + } + + // Copy of java.lang.StringCode.scale + private static int scale(int len, float expansionFactor) { + // We need to perform double, not float, arithmetic; otherwise + // we lose low order bits when len is larger than 2**24. + return (int) (len * (double) expansionFactor); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(2, test(2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0, test(0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/String_intern01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class String_intern01 { + + public static boolean test() { + // Checkstyle: stop + return "id".intern() == "id"; + // Checkstyle: resume + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/String_intern02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class String_intern02 { + + public static boolean test(int i) { + return ("id" + i).intern() == ("id" + i).intern(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/String_intern03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class String_intern03 { + + public static boolean test(int i) { + return ("id" + i).intern().equals("id" + i); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/String_valueOf01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class String_valueOf01 { + + public static String test(int i) { + Object result = null; + if (i == 1) { + result = "string"; + } + return String.valueOf(result); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("null", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("string", test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/lang/System_identityHashCode01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.lang; + +import org.junit.*; + +/* + */ +public class System_identityHashCode01 { + + private static final Object object0 = new Object(); + private static final Object object1 = new Object(); + private static final Object object2 = new Object(); + + private static final int hash0 = System.identityHashCode(object0); + private static final int hash1 = System.identityHashCode(object1); + private static final int hash2 = System.identityHashCode(object2); + + public static boolean test(int i) { + if (i == 0) { + return hash0 == System.identityHashCode(object0); + } + if (i == 1) { + return hash1 == System.identityHashCode(object1); + } + if (i == 2) { + return hash2 == System.identityHashCode(object2); + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/DegeneratedLoop.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class DegeneratedLoop { + + public static String test(int a) { + int arg = a; + for (;;) { + try { + arg++; + break; + } catch (Unresolved iioe) { + } + } + return "ok-" + arg; + } + + @SuppressWarnings("serial") + public static class Unresolved extends RuntimeException { + + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("ok-1", test(0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/Loop01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class Loop01 { + + public static boolean test() { + int x = 1; + + for (int i = 0; i < 10; i++) { + int y = m(); + if (x == 1) { + return true; + } + x = y; + } + return false; + } + + private static int m() { + return 2; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/Loop02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class Loop02 { + + public static boolean test(int arg) { + int x = arg; + + for (int i = 0; i < 10; i++) { + int y = m(); + if (x == 1) { + return true; + } + x = y; + } + return false; + } + + private static int m() { + return 2; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/Loop03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class Loop03 { + + public static int test(int count) { + int i1 = 1; + int i2 = 2; + int i4 = 4; + + for (int i = 0; i < count; i++) { + i1 = i2; + i2 = 7; + i4 = i1; + } + return i1 + i2 * 10 + i4 * 1000; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(7077, test(10)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/Loop04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class Loop04 { + + public static int test(int count) { + int i1 = 1; + int i2 = 2; + int i3 = 3; + int i4 = 4; + + for (int i = 0; i < count; i++) { + i1 = i2; + i2 = i3; + i3 = i4; + i4 = i1; + } + return i1 + i2 * 10 + i3 * 100 + i4 * 1000; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(4321, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2432, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2432, test(10)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/Loop05.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class Loop05 { + + @SuppressWarnings("unused") + public static String test(int a) { + int arg = a; + int count = 0; + while (--arg > 0) { + count++; + new Object(); + } + return "ok" + count; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("ok0", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("ok9", test(10)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("ok24", test(25)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/Loop06.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class Loop06 { + + public static String test(int a) { + int arg = a; + int count = 0; + while (--arg > 0) { + count++; + foo(); + } + return "ok" + count; + } + + static void foo() { + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("ok0", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("ok9", test(10)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("ok24", test(25)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/Loop07.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class Loop07 { + + public static String test(int arg) { + int count = arg; + for (int i = 0; i < arg; i++) { + count++; + } + return "ok" + count; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("ok0", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("ok20", test(10)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("ok50", test(25)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/Loop08.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class Loop08 { + + public static int test(int arg) { + int a = 0; + for (int i = 0; i < arg; i++) { + a += i; + } + return a; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(45, test(10)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(300, test(25)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/Loop09.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class Loop09 { + + private static int cnt; + + public static String test(int arg) { + cnt = 0; + int count = arg; + for (int i = 0; i < arg; i++) { + count++; + foo(); + } + return "ok" + count + "-" + cnt; + } + + static void foo() { + cnt++; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("ok0-0", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("ok20-10", test(10)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("ok50-25", test(25)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/Loop11.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class Loop11 { + + public static int test(int a) { + int arg = a; + int v = 0; + while (arg-- > 0) { + v = 1; + } + return v; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(1, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/Loop12.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class Loop12 { + + private static int[] source = new int[]{10, 15, 20, 25, 30}; + + public static int test(int arg) { + int i = 0; + if (source[i] != arg) { + while (++i <= 5 && source[i] != arg) { + // nothing + } + } + return i; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(10)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(15)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(4, test(30)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/Loop13.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class Loop13 { + + public static class Loop { + + private int index; + private Object[] nodes = new Object[]{null, null, new Object(), null, null, new Object(), null}; + private int size = nodes.length; + + public Loop(int start) { + index = start; + } + + public void test0() { + if (index < size) { + do { + index++; + } while (index < size && nodes[index] == null); + } + } + + public int getIndex() { + return index; + } + + } + + public static int test(int arg) { + Loop loop = new Loop(arg); + loop.test0(); + return loop.getIndex(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(2, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(5, test(3)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(7, test(6)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(7, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/Loop14.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class Loop14 { + + private static int value; + + public static int test(int arg) { + return calc(arg); + } + + public static int calc(int arg) { + int result = 0; + for (int k = 0; k < arg; ++k) { + value = 5; + for (int i = 0; i < arg; ++i) { + for (int j = 0; j < arg; ++j) { + } + result += value; + } + } + return result; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(5, test(1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(5, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/LoopInline.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + * This test is meaningful only if you run it with 'forced' inlinning because running it in the harness with -Xcomp will not trigger any normal inlining + */ +public class LoopInline { + + public static int test(int arg) { + int count = 0; + for (int i = 0; i < arg; i++) { + count += foo(i); + if (count > 15) { + count -= foo(3); + break; + } + } + return count; + } + + public static int foo(int t) { + int sum = 0; + for (int i = 0; i < t; i++) { + sum += i; + if (i == 4) { + sum += foo2(sum); + break; + } + } + return sum; + } + + public static int foo2(int i) { + int j = i; + int sum = 0; + while (j > 0) { + sum += j * j; + j--; + } + return sum; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(402, test(10)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/LoopNewInstance.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class LoopNewInstance { + + public static Blop initBlop = new Blop(); + + @SuppressWarnings("unused") + public static int test(int arg) { + for (int i = 0; i < arg; i++) { + new Blop(); + } + return count; + } + + private static int count = 0; + + private static class Blop { + + private boolean exists; + + public Blop() { + if (!exists) { + count++; + } + exists = true; + } + } + + @Test + public void run0() throws Throwable { + count = 0; + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + count = 0; + Assert.assertEquals(5, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/LoopPhi.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ + +public class LoopPhi { + + public static int test(int arg) { + for (int i = 0; i < arg; i++) { + test(1, 1, 1, 1, 1, 1); + } + return test(1, 1, 1, 1, 1, 1); + } + + public static int test(int j1, int j2, int j3, int j4, int j5, int j6) { + int i1 = j1; + int i2 = j2; + int i3 = j3; + int i4 = j4; + int i5 = j5; + int i6 = j6; + + if (i1 == 0) { + i1 = 2; + } else { + i2 = 2; + } + for (int i = 0; i < 10; i++) { + if (i == 0) { + i3 = 2; + } else { + i4 = 2; + } + + for (int j = 0; j < 10; j++) { + if (j == 0) { + i5 = 2; + } else { + i6 = 2; + } + } + } + + return i1 + i2 + i3 + i4 + i5 + i6; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11, test(50000)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/loop/LoopSwitch01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.loop; + +import org.junit.*; + +/* + */ +public class LoopSwitch01 { + + static int count = 0; + + @SuppressWarnings("unused") + public static String test() { + String line; + while ((line = string()) != null) { + switch (line.charAt(0)) { + case 'a': + new Object(); + break; + case 'b': + new Object(); + break; + default: + new Object(); + break; + } + } + return "ok" + count; + } + + private static String string() { + if (count == 0) { + return null; + } + count--; + return "" + ('a' + count); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("ok0", test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/ArrayCompare01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class ArrayCompare01 { + + static final long[] a1 = {1, 2, 3, -5}; + static final long[] a2 = {1, 2, 3, -5}; + static final long[] a3 = {1, 2, 4, -5}; + + public static boolean test(int arg) { + if (arg == 0) { + return compare(a1, a2); + } + if (arg == 1) { + return compare(a1, a3); + } + return false; + } + + static boolean compare(long[] a, long[] b) { + if (a.length == b.length) { + for (int i = 0; i < a.length; i++) { + if (a[i] != b[i]) { + return false; + } + } + return true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/ArrayCompare02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class ArrayCompare02 { + + static final long[] a1 = {1, 1, 1, 1, 1, 1}; + static final long[] a2 = {1, 1, 1, 2, 1, 1}; + static final long[] a3 = {1, 1, 2, 2, 3, 3}; + + public static boolean test(int arg) { + if (arg == 0) { + return compare(a1); + } + if (arg == 1) { + return compare(a2); + } + if (arg == 2) { + return compare(a3); + } + return false; + } + + static boolean compare(long[] a) { + return a[0] == a[1] & a[2] == a[3] & a[4] == a[5]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BC_invokevirtual2.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BC_invokevirtual2 { + + static Unresolved object; + + public static class Unresolved { + + public int id(int i) { + return i; + } + } + + private static Unresolved object() { + if (object == null) { + object = new Unresolved(); + } + return object; + } + + public static int test(int a) { + return object().id(a); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(3, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-4, test(-4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigByteParams01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BigByteParams01 { + + public static int test(int num) { + int sum = 0; + if (num == 0) { + sum += testA((byte) 0, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testA((byte) 1, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testA((byte) 2, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testA((byte) 3, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testA((byte) 4, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testA((byte) 5, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testA((byte) 6, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testA((byte) 7, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testA((byte) 8, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + } else if (num == 1) { + sum += testB(0, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testB(1, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testB(2, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testB(3, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testB(4, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testB(5, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testB(6, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testB(7, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + sum += testB(8, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + } else if (num == 2) { + for (int i = 0; i < 9; i++) { + sum += testA(i, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + } + } else if (num == 3) { + for (int i = 0; i < 9; i++) { + sum += testB(i, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9); + } + } + return sum; + } + + private static int testA(int choice, byte p0, byte p1, byte p2, byte p3, byte p4, byte p5, byte p6, byte p7, byte p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + private static long testB(int choice, long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(45, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(45, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(45, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(45, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigDoubleParams02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BigDoubleParams02 { + + public static double test(int choice, double p0, double p1, double p2, double p3, double p4, double p5, double p6, double p7, double p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1d, test(0, 1d, 2d, 3d, 4d, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2d, test(1, 1d, 2d, 3d, 4d, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(3d, test(2, 1d, 2d, 3d, 4d, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(4d, test(3, 1d, 2d, 3d, 4d, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(5d, test(4, 1d, 2d, 3d, 4d, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(6d, test(5, 1d, 2d, 3d, 4d, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(7d, test(6, 1d, 2d, 3d, 4d, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(8d, test(7, 1d, 2d, 3d, 4d, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(9d, test(8, 1d, 2d, 3d, 4d, 5d, 6d, 7d, 8d, 9d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigFloatParams01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BigFloatParams01 { + + public static double test(int num) { + double sum = 0; + if (num == 0) { + sum += testA(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(1, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(2, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(3, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(4, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(5, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(6, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(7, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(8, 1, 2, 3, 4, 5, 6, 7, 8, 9); + } else if (num == 1) { + sum += testB(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(1, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(2, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(3, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(4, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(5, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(6, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(7, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(8, 1, 2, 3, 4, 5, 6, 7, 8, 9); + } else if (num == 2) { + for (int i = 0; i < 9; i++) { + sum += testA(i, 1, 2, 3, 4, 5, 6, 7, 8, 9); + } + } else if (num == 3) { + for (int i = 0; i < 9; i++) { + sum += testB(i, 1, 2, 3, 4, 5, 6, 7, 8, 9); + } + } + return sum; + } + + private static float testA(int choice, float p0, float p1, float p2, float p3, float p4, float p5, float p6, float p7, float p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + private static double testB(int choice, double p0, double p1, double p2, double p3, double p4, double p5, double p6, double p7, double p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(45D, test(0), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(45D, test(1), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(45D, test(2), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(45D, test(3), 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0D, test(4), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigFloatParams02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BigFloatParams02 { + + public static float test(int choice, float p0, float p1, float p2, float p3, float p4, float p5, float p6, float p7, float p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1f, test(0, 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2f, test(1, 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(3f, test(2, 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(4f, test(3, 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(5f, test(4, 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(6f, test(5, 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(7f, test(6, 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(8f, test(7, 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(9f, test(8, 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigIntParams01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BigIntParams01 { + + public static int test(int num) { + int sum = 0; + if (num == 0) { + sum += testA(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(1, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(2, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(3, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(4, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(5, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(6, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(7, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(8, 1, 2, 3, 4, 5, 6, 7, 8, 9); + } else if (num == 1) { + sum += testB(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(1, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(2, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(3, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(4, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(5, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(6, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(7, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testB(8, 1, 2, 3, 4, 5, 6, 7, 8, 9); + } else if (num == 2) { + for (int i = 0; i < 9; i++) { + sum += testA(i, 1, 2, 3, 4, 5, 6, 7, 8, 9); + } + } else if (num == 3) { + for (int i = 0; i < 9; i++) { + sum += testB(i, 1, 2, 3, 4, 5, 6, 7, 8, 9); + } + } + return sum; + } + + private static int testA(int choice, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + private static long testB(int choice, long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(45, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(45, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(45, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(45, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigIntParams02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BigIntParams02 { + + public static int test(int choice, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1, test(0, 1, 2, 3, 4, 5, 6, 7, -8, -9)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test(1, 1, 2, 3, 4, 5, 6, 7, -8, -9)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(3, test(2, 1, 2, 3, 4, 5, 6, 7, -8, -9)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(4, test(3, 1, 2, 3, 4, 5, 6, 7, -8, -9)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(5, test(4, 1, 2, 3, 4, 5, 6, 7, -8, -9)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(6, test(5, 1, 2, 3, 4, 5, 6, 7, -8, -9)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(7, test(6, 1, 2, 3, 4, 5, 6, 7, -8, -9)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(-8, test(7, 1, 2, 3, 4, 5, 6, 7, -8, -9)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(-9, test(8, 1, 2, 3, 4, 5, 6, 7, -8, -9)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigInterfaceParams01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BigInterfaceParams01 { + + public static String test(boolean b, String p0, String p1, String p2, String p3, String p4, String p5, String p6, String p7, String p8, String p9) { + I i = b ? new A() : new B(); + return i.test(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); + } + + interface I { + + String test(String p0, String p1, String p2, String p3, String p4, String p5, String p6, String p7, String p8, String p9); + } + + static class A implements I { + + public String test(String p0, String p1, String p2, String p3, String p4, String p5, String p6, String p7, String p8, String p9) { + return "A" + p0 + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9; + } + } + + static class B implements I { + + public String test(String p0, String p1, String p2, String p3, String p4, String p5, String p6, String p7, String p8, String p9) { + return "B" + p0 + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("A0123456789", test(true, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9")); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("B0123456789", test(false, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigLongParams02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BigLongParams02 { + + public static long test(int choice, long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1L, test(0, 1L, 2L, 3L, 4L, 5L, 6L, 7L, -8L, -9L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2L, test(1, 1L, 2L, 3L, 4L, 5L, 6L, 7L, -8L, -9L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(3L, test(2, 1L, 2L, 3L, 4L, 5L, 6L, 7L, -8L, -9L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(4L, test(3, 1L, 2L, 3L, 4L, 5L, 6L, 7L, -8L, -9L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(5L, test(4, 1L, 2L, 3L, 4L, 5L, 6L, 7L, -8L, -9L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(6L, test(5, 1L, 2L, 3L, 4L, 5L, 6L, 7L, -8L, -9L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(7L, test(6, 1L, 2L, 3L, 4L, 5L, 6L, 7L, -8L, -9L)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(-8L, test(7, 1L, 2L, 3L, 4L, 5L, 6L, 7L, -8L, -9L)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(-9L, test(8, 1L, 2L, 3L, 4L, 5L, 6L, 7L, -8L, -9L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigMixedParams01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BigMixedParams01 { + + public static double test(int num) { + double sum = 0; + if (num == 0) { + sum += testA(0, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); + sum += testA(1, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); + sum += testA(2, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); + sum += testA(3, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); + sum += testA(4, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); + sum += testA(5, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); + sum += testA(6, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); + sum += testA(7, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); + sum += testA(8, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); + } else if (num == 1) { + sum += testB(0, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); + sum += testB(1, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); + sum += testB(2, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); + sum += testB(3, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); + sum += testB(4, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); + sum += testB(5, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); + sum += testB(6, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); + sum += testB(7, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); + sum += testB(8, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); + } else if (num == 2) { + for (int i = 0; i < 9; i++) { + sum += testA(i, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); + } + } else if (num == 3) { + for (int i = 0; i < 9; i++) { + sum += testB(i, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); + } + } + return sum; + } + + @SuppressWarnings("unused") + private static float testA(int choice, int i0, int i1, int i2, int i3, float p0, float p1, float p2, float p3, int i4, int i5, float p4, float p5, float p6, float p7, float p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + @SuppressWarnings("unused") + private static double testB(int choice, int i0, int i1, int i2, double p0, double p1, double p2, double p3, int i3, int i4, double p4, double p5, double p6, double p7, double p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(45D, test(0), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(45D, test(1), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(45D, test(2), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(45D, test(3), 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0D, test(4), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigMixedParams02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BigMixedParams02 { + + @SuppressWarnings("unused") + public static float test(int choice, int i0, int i1, int i2, int i3, float p0, float p1, float p2, float p3, int i4, int i5, float p4, float p5, float p6, float p7, float p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1f, test(0, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2f, test(1, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(3f, test(2, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(4f, test(3, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(5f, test(4, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(6f, test(5, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(7f, test(6, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(8f, test(7, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f), 0); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(9f, test(8, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigMixedParams03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BigMixedParams03 { + + @SuppressWarnings("unused") + public static double test(int choice, int i0, int i1, int i2, int i3, double p0, double p1, double p2, double p3, int i4, int i5, double p4, double p5, double p6, double p7, double p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1d, test(0, -1, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2d, test(1, -1, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(3d, test(2, -1, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(4d, test(3, -1, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(5d, test(4, -1, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(6d, test(5, -1, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(7d, test(6, -1, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(8d, test(7, -1, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d), 0); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(9d, test(8, -1, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigObjectParams01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BigObjectParams01 { + + @SuppressWarnings("unused") + public static String test(String p0, String p1, String p2, String p3, String p4, String p5, String p6, String p7, String p8, String p9) { + return p0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("0", test("0", "1", "2", "3", "4", "5", "6", "7", "8", "9")); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("a", test("a", null, null, null, null, null, null, null, null, null)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigObjectParams02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BigObjectParams02 { + + public static String test(String p0, String p1, String p2, String p3, String p4, String p5, String p6, String p7, String p8, String p9) { + return p0 + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("0123456789", test("0", "1", "2", "3", "4", "5", "6", "7", "8", "9")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigParamsAlignment.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + */ +/* + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +public class BigParamsAlignment { + + public static int test(int num) { + int sum = 0; + if (num == 0) { + sum += testA(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(1, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(2, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(3, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(4, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(5, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(6, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(7, 1, 2, 3, 4, 5, 6, 7, 8, 9); + sum += testA(8, 1, 2, 3, 4, 5, 6, 7, 8, 9); + } else if (num == 1) { + sum += testB(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + sum += testB(1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + sum += testB(2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + sum += testB(3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + sum += testB(4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + sum += testB(5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + sum += testB(6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + sum += testB(7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + sum += testB(8, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + sum += testB(9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + } else if (num == 2) { + for (int i = 0; i < 9; i++) { + sum += testA(i, 1, 2, 3, 4, 5, 6, 7, 8, 9); + } + } else if (num == 3) { + for (int i = 0; i < 10; i++) { + sum += testB(i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + } + } else if (num == 4) { + for (int i = 0; i < 11; i++) { + sum += testC(i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); + } + } else if (num == 5) { + for (int i = 0; i < 12; i++) { + sum += testD(i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); + } + } + return sum; + } + + private static int testA(int choice, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + private static int testB(int choice, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + case 9: + return p9; + } + return 42; + } + + private static int testC(int choice, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + case 9: + return p9; + case 10: + return p10; + } + return 42; + } + + private static int testD(int choice, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10, int p11) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + case 9: + return p9; + case 10: + return p10; + case 11: + return p11; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(45, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(55, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(45, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(55, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(66, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(78, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(0, test(6)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigShortParams01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BigShortParams01 { + + public static int test(int num) { + int sum = 0; + if (num == 0) { + sum += testA((short) 0, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testA((short) 1, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testA((short) 2, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testA((short) 3, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testA((short) 4, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testA((short) 5, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testA((short) 6, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testA((short) 7, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testA((short) 8, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + } else if (num == 1) { + sum += testB(0, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testB(1, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testB(2, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testB(3, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testB(4, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testB(5, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testB(6, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testB(7, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + sum += testB(8, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + } else if (num == 2) { + for (int i = 0; i < 9; i++) { + sum += testA(i, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + } + } else if (num == 3) { + for (int i = 0; i < 9; i++) { + sum += testB(i, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7, (short) 8, (short) 9); + } + } + return sum; + } + + private static int testA(int choice, short p0, short p1, short p2, short p3, short p4, short p5, short p6, short p7, short p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + private static long testB(int choice, long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long p8) { + switch (choice) { + case 0: + return p0; + case 1: + return p1; + case 2: + return p2; + case 3: + return p3; + case 4: + return p4; + case 5: + return p5; + case 6: + return p6; + case 7: + return p7; + case 8: + return p8; + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(45, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(45, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(45, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(45, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/BigVirtualParams01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class BigVirtualParams01 { + + public static String test(boolean b, String p0, String p1, String p2, String p3, String p4, String p5, String p6, String p7, String p8, String p9) { + I i = b ? new A() : new B(); + return i.test(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); + } + + abstract static class I { + + abstract String test(String p0, String p1, String p2, String p3, String p4, String p5, String p6, String p7, String p8, String p9); + } + + static class A extends I { + + @Override + public String test(String p0, String p1, String p2, String p3, String p4, String p5, String p6, String p7, String p8, String p9) { + return "A" + p0 + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9; + } + } + + static class B extends I { + + @Override + public String test(String p0, String p1, String p2, String p3, String p4, String p5, String p6, String p7, String p8, String p9) { + return "B" + p0 + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("A0123456789", test(true, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9")); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("B0123456789", test(false, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/Bubblesort.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +public class Bubblesort { + + public static int test(int num) { + final int[] array = {23, 8, -9, 5, 882, 0, 0, 1}; + + for (int i = 0; i < array.length; i++) { + for (int j = i + 1; j < array.length; j++) { + if (array[j] < array[i]) { + final int tmp = array[i]; + array[i] = array[j]; + array[j] = tmp; + } + } + } + return array[num]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-9, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(5, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(8, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(23, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(882, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/Fibonacci.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class Fibonacci { + + public static int test(int num) { + if (num <= 0) { + return 0; + } + int n1 = 0; + int n2 = 1; + for (int i = 1; i < num; i++) { + final int next = n2 + n1; + n1 = n2; + n2 = next; + } + return n2; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(1, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(2, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(3, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(5, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(8, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(13, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/InvokeVirtual_01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +public class InvokeVirtual_01 { + + static class A { + + int plus(int a) { + return a; + } + } + + static class B extends A { + + @Override + int plus(int a) { + return a + 10; + } + } + + static class C extends A { + + @Override + int plus(int a) { + return a + 20; + } + } + + static A aObject = new A(); + static A bObject = new B(); + static A cObject = new C(); + + public static int test(int a) { + if (a == 0) { + return aObject.plus(a); + } + if (a == 1) { + return bObject.plus(a); + } + if (a == 2) { + return cObject.plus(a); + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(22, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(42, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/InvokeVirtual_02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +public class InvokeVirtual_02 { + + static class A { + + long plus(long a) { + return a; + } + } + + static class B extends A { + + @Override + long plus(long a) { + return a + 10; + } + } + + static class C extends A { + + @Override + long plus(long a) { + return a + 20; + } + } + + static A objectA = new A(); + static A objectB = new B(); + static A objectC = new C(); + + public static long test(long a) { + if (a == 0) { + return objectA.plus(a); + } + if (a == 1) { + return objectB.plus(a); + } + if (a == 2) { + return objectC.plus(a); + } + return 42; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(0L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11L, test(1L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(22L, test(2L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(42L, test(3L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/Matrix01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class Matrix01 { + + public static class Matrix { + + final int id; + + Matrix(int id) { + this.id = id; + } + } + + public static int test(int arg) { + if (arg == 0) { + return matrix1(3) + matrix1(5); + } + if (arg == 1) { + return matrix2(3) + matrix2(5); + } + if (arg == 2) { + return matrix3(3) + matrix3(5); + } + if (arg == 3) { + return matrix4(3) + matrix4(5); + } + if (arg == 4) { + return matrix5(3) + matrix5(5); + } + return 42; + } + + static int matrix1(int size) { + Matrix[] matrix = new Matrix[size]; + fillMatrix(matrix, size); + int count = 0; + for (Matrix m : matrix) { + if (m != null) { + count++; + } + } + return count; + } + + static int matrix2(int size) { + Matrix[][] matrix = new Matrix[size][size]; + fillMatrix(matrix, size * size); + int count = 0; + for (Matrix[] n : matrix) { + for (Matrix m : n) { + if (m != null) { + count++; + } + } + } + return count; + } + + static int matrix3(int size) { + Matrix[][][] matrix = new Matrix[size][5][size]; + fillMatrix(matrix, size * size * size); + int count = 0; + for (Matrix[][] o : matrix) { + for (Matrix[] n : o) { + for (Matrix m : n) { + if (m != null) { + count++; + } + } + } + } + return count; + } + + static int matrix4(int size) { + Matrix[][][][] matrix = new Matrix[size][2][size][3]; + fillMatrix(matrix, size * size * size * size); + int count = 0; + for (Matrix[][][] p : matrix) { + for (Matrix[][] o : p) { + for (Matrix[] n : o) { + for (Matrix m : n) { + if (m != null) { + count++; + } + } + } + } + } + return count; + } + + static int matrix5(int size) { + Matrix[][][][][] matrix = new Matrix[size][size][3][4][size]; + fillMatrix(matrix, size * size * size * size * size); + int count = 0; + for (Matrix[][][][] q : matrix) { + for (Matrix[][][] p : q) { + for (Matrix[][] o : p) { + for (Matrix[] n : o) { + for (Matrix m : n) { + if (m != null) { + count++; + } + } + } + } + } + } + return count; + } + + static void fillMatrix(Object[] matrix, int total) { + for (int i = 0; i < 10000; i += 7) { + int number = i % total; + set(matrix, number); + } + } + + static void set(Object[] matrix, int number) { + int val = number; + Object[] array = matrix; + while (!(array instanceof Matrix[])) { + int index = val % array.length; + val = val / array.length; + array = (Object[]) array[index]; + } + ((Matrix[]) array)[val % array.length] = new Matrix(number); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(8, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(34, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(152, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(204, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(1547, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(42, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/ReferenceMap01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class ReferenceMap01 { + + public static Integer val1 = new Integer(3); + public static Integer val2 = new Integer(4); + + @SuppressWarnings("unused") + private static String foo(String[] a) { + String[] args = new String[]{"78"}; + Integer i1 = new Integer(1); + Integer i2 = new Integer(2); + Integer i3 = val1; + Integer i4 = val2; + Integer i5 = new Integer(5); + Integer i6 = new Integer(6); + Integer i7 = new Integer(7); + Integer i8 = new Integer(8); + Integer i9 = new Integer(9); + Integer i10 = new Integer(10); + Integer i11 = new Integer(11); + Integer i12 = new Integer(12); + + System.gc(); + int sum = i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9 + i10 + i11 + i12; + return args[0] + sum; + } + + public static int test() { + return Integer.valueOf(foo(new String[]{"asdf"})); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(7878, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/StrangeFrames.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +@SuppressWarnings("unused") +public class StrangeFrames { + + public static boolean test(int arg) { + empty(); + oneOperandStackSlot(); + twoOperandStackSlots(); + oneLocalSlot(); + return true; + } + + static void empty() { + // do nothing. + } + + static void oneOperandStackSlot() { + new StrangeFrames(); + } + + static void twoOperandStackSlots() { + two(new StrangeFrames(), new StrangeFrames()); + } + + static void oneLocalSlot() { + int a; + } + + static void two(Object a, Object b) { + Object c = b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/String_format01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class String_format01 { + + public static String test(String s) { + return String.format("Hello %s", s); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("Hello World", test("World")); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("Hello New World Order", test("New World Order")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/String_format02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class String_format02 { + + public static String test(int val) { + return String.format("Hello %d", val); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("Hello 0", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("Hello -11", test(-11)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("Hello -2147483648", test(-2147483648)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals("Hello 2147483647", test(2147483647)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/VarArgs_String01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class VarArgs_String01 { + + public static String test(int arg) { + if (arg == 4) { + return get(0); + } + return get(arg, "a", null, "test"); + } + + private static String get(int index, String... args) { + return args[index]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("a", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(null, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("test", test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run4() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/VarArgs_boolean01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class VarArgs_boolean01 { + + public static boolean test(int arg) { + if (arg == 4) { + return get(0); + } + return get(arg, true, false, true); + } + + private static boolean get(int index, boolean... args) { + return args[index]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run4() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/VarArgs_byte01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class VarArgs_byte01 { + + public static byte test(int arg) { + if (arg == 4) { + return get(0); + } + return get(arg, (byte) 1, (byte) 2, (byte) 3); + } + + private static byte get(int index, byte... args) { + return args[index]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((byte) 1), test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((byte) 2), test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((byte) 3), test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run4() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/VarArgs_char01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class VarArgs_char01 { + + public static char test(int arg) { + if (arg == 4) { + return get(0); + } + return get(arg, 'a', 'b', 'c'); + } + + private static char get(int index, char... args) { + return args[index]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((char) 97), test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((char) 98), test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((char) 99), test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run4() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/VarArgs_double01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class VarArgs_double01 { + + public static double test(int arg) { + if (arg == 4) { + return get(0); + } + return get(arg, 0.0d, 1.0d, 2.0d); + } + + private static double get(int index, double... args) { + return args[index]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0d, test(0), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1.0d, test(1), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2.0d, test(2), 0); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run4() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/VarArgs_float01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class VarArgs_float01 { + + public static float test(int arg) { + if (arg == 4) { + return get(0); + } + return get(arg, 0.0f, 1.0f, 2.0f); + } + + private static float get(int index, float... args) { + return args[index]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0.0f, test(0), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1.0f, test(1), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2.0f, test(2), 0); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run4() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/VarArgs_int01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class VarArgs_int01 { + + public static int test(int arg) { + if (arg == 4) { + return get(0); + } + return get(arg, 0, 1, 2); + } + + private static int get(int index, int... args) { + return args[index]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run4() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/VarArgs_long01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class VarArgs_long01 { + + public static long test(int arg) { + if (arg == 4) { + return get(0); + } + return get(arg, 0L, 1L, 2L); + } + + private static long get(int index, long... args) { + return args[index]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1L, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2L, test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run4() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/micro/VarArgs_short01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.micro; + +import org.junit.*; + +/* + */ +public class VarArgs_short01 { + + public static short test(int arg) { + if (arg == 4) { + return get(0); + } + return get(arg, (short) 0, (short) 1, (short) 2); + } + + private static short get(int index, short... args) { + return args[index]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((short) 0), test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((short) 1), test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((short) 2), test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run4() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/ABCE_01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class ABCE_01 { + + public static int[] array = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + + public static int test(int a) { + int arg = a; + for (int i = 0; i < array.length; i++) { + arg += array[i]; + } + return arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(55, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(65, test(10)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/ABCE_02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class ABCE_02 { + + public static int[] array = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + + public static int test(int arg) { + int r = 0; + for (int i = 0; i < arg; i++) { + r += array[i]; + } + return r; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(55, test(10)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run2() throws Throwable { + test(20); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/ABCE_03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class ABCE_03 { + + private static final int[] ARRAY1 = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + private static final int[] ARRAY2 = new int[]{1}; + + public static int test(int arg) { + int[] array = arg == 0 ? ARRAY2 : ARRAY1; + int r = 0; + for (int i = 0; i < arg; i++) { + r += array[i]; + } + return r; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(55, test(10)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run2() throws Throwable { + test(20); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/ArrayCopy01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests calls to the array copy method. + */ +public class ArrayCopy01 { + + public static Object[] src = new Object[]{null, null}; + public static Object[] dest = new Object[]{null, null}; + + public static int test(int srcPos, int destPos, int length) { + System.arraycopy(src, srcPos, dest, destPos, length); + return 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0, 0, 0)); + } + + @Test(expected = java.lang.IndexOutOfBoundsException.class) + public void run1() throws Throwable { + test(0, 0, -1); + } + + @Test(expected = java.lang.IndexOutOfBoundsException.class) + public void run2() throws Throwable { + test(-1, 0, 0); + } + + @Test(expected = java.lang.IndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(0, -1, 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0, test(0, 0, 2)); + } + + @Test(expected = java.lang.IndexOutOfBoundsException.class) + public void run5() throws Throwable { + test(0, 1, 2); + } + + @Test(expected = java.lang.IndexOutOfBoundsException.class) + public void run6() throws Throwable { + test(1, 0, 2); + } + + @Test(expected = java.lang.IndexOutOfBoundsException.class) + public void run7() throws Throwable { + test(1, 1, -1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/ArrayLength01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of array length operations. + */ +public class ArrayLength01 { + + public static final int SIZE = 8; + public static final byte[] arr = new byte[5]; + + public static int test(int arg) { + if (arg == 0) { + return arr.length; + } + if (arg == 1) { + return new byte[6].length; + } + if (arg == 2) { + return new Object[7].length; + } + if (arg == 3) { + return new Class[SIZE][].length; + } + if (arg == 4) { + return new int[arg].length; + } + return 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(5, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(6, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(7, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(8, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(4, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/BC_idiv_16.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class BC_idiv_16 { + + public static int test(int i, int arg) { + if (i == 0) { + final int constant = 16; + return arg / constant; + } + return arg / 16; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0, 0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(0, 16)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(1, test(0, 17)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(0, -1)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-1, test(0, -16)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(-1, test(0, -17)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(-64, test(0, -1024)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(0, test(1, 0)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(1, test(1, 16)); + } + + @Test + public void run9() throws Throwable { + Assert.assertEquals(1, test(1, 17)); + } + + @Test + public void run10() throws Throwable { + Assert.assertEquals(0, test(1, -1)); + } + + @Test + public void run11() throws Throwable { + Assert.assertEquals(-1, test(1, -16)); + } + + @Test + public void run12() throws Throwable { + Assert.assertEquals(-1, test(1, -17)); + } + + @Test + public void run13() throws Throwable { + Assert.assertEquals(-64, test(1, -1024)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/BC_idiv_4.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class BC_idiv_4 { + + public static int test(int arg) { + return arg / 4; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(4)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(1, test(5)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0, test(-1)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-1, test(-4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(-1, test(-5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(-64, test(-256)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/BC_imul_16.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class BC_imul_16 { + + public static int test(int i, int arg) { + if (i == 0) { + final int mult = 16; + return arg * mult; + } + return arg * 16; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0, 0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(256, test(0, 16)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(272, test(0, 17)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-16, test(0, -1)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-256, test(0, -16)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(-272, test(0, -17)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(-16, test(0, 2147483647)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(0, test(0, -2147483648)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(0, test(1, 0)); + } + + @Test + public void run9() throws Throwable { + Assert.assertEquals(256, test(1, 16)); + } + + @Test + public void run10() throws Throwable { + Assert.assertEquals(272, test(1, 17)); + } + + @Test + public void run11() throws Throwable { + Assert.assertEquals(-16, test(1, -1)); + } + + @Test + public void run12() throws Throwable { + Assert.assertEquals(-256, test(1, -16)); + } + + @Test + public void run13() throws Throwable { + Assert.assertEquals(-272, test(1, -17)); + } + + @Test + public void run14() throws Throwable { + Assert.assertEquals(-16, test(1, 2147483647)); + } + + @Test + public void run15() throws Throwable { + Assert.assertEquals(0, test(1, -2147483648)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/BC_imul_4.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class BC_imul_4 { + + public static int test(int arg) { + return arg * 4; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(16, test(4)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(20, test(5)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-4, test(-1)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-16, test(-4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(-20, test(-5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(-1024, test(-256)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/BC_ldiv_16.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class BC_ldiv_16 { + + public static long test(long arg) { + return arg / 16; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(0L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1L, test(16L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(1L, test(17L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0L, test(-1L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-1L, test(-16L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(-1L, test(-17L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(-64L, test(-1024L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/BC_ldiv_4.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class BC_ldiv_4 { + + public static long test(long arg) { + return arg / 4; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(0L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1L, test(4L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(1L, test(5L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0L, test(-1L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-1L, test(-4L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(-1L, test(-5L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(-64L, test(-256L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/BC_lmul_16.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class BC_lmul_16 { + + public static long test(long arg) { + return arg * 16; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(0L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(256L, test(16L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(272L, test(17L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-16L, test(-1L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-256L, test(-16L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(-272L, test(-17L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(-16384L, test(-1024L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/BC_lmul_4.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class BC_lmul_4 { + + public static long test(long arg) { + return arg * 4; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0L, test(0L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(16L, test(4L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(20L, test(5L)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-4L, test(-1L)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(-16L, test(-4L)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(-20L, test(-5L)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(-1024L, test(-256L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/BC_lshr_C16.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class BC_lshr_C16 { + + public static long test(long a) { + return a >> 16; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1330945L, test(87224824140L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/BC_lshr_C24.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class BC_lshr_C24 { + + public static long test(long a) { + return a >> 24; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(5199L, test(87224824140L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/BC_lshr_C32.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class BC_lshr_C32 { + + public static long test(long a) { + return a >> 32; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(20L, test(87224824140L)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/BlockSkip01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class BlockSkip01 { + + public static boolean test(int arg) { + int x = 1; + + if (arg > 2) { + x = 2; + } else { + x = 1; + } + return m(x) == 2; + } + + private static int m(int x) { + return x + 1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Cmov01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Cmov01 { + + public static boolean test(int a, int b) { + boolean result = a < b || a == b; + return result; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(-1, -1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1, 10)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(1, 0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Cmov02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Cmov02 { + + public static int test(double a, double b, int v1, int v2) { + return a < b ? v1 : v2; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1, test(1.0, 1.1, 1, 2)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test(1.0, -1.1, 1, 2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(1.0, java.lang.Double.NaN, 1, 2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Conditional01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import java.util.*; + +import org.junit.*; + +/* + */ +@SuppressWarnings("unused") +public class Conditional01 { + + private static final int RAM_SIZE = 0x100; + + public static int test(int arg) { + Conditional01 c = new Conditional01(); + Random rnd = new Random(); + for (int i = 0; i < arg; i++) { + CPC i2 = new CPC(); + i2.r1 = new Register(); + i2.r1.val = i; + i2.r1.num = i + RAM_SIZE - 20; + i2.r2 = new Register(); + i2.r2.val = rnd.nextInt(); + i2.r2.num = rnd.nextInt(RAM_SIZE); + try { + c.visit(i2); + } catch (RuntimeException re) { + + } + } + return c.cyclesConsumed; + } + + private static class Register { + + int val; + int num; + } + + private static class CPC { + + public Register r1; + public Register r2; + + } + + private int nextPC; + private int pc; + private boolean aC; + private boolean aH; + private boolean aN; + private boolean aZ; + private boolean aV; + private boolean aS; + private int cyclesConsumed; + private int[] sram = new int[RAM_SIZE]; + + public void visit(CPC i) { + nextPC = pc + 2; + int tmp0 = getRegisterByte(i.r1); + int tmp1 = getRegisterByte(i.r2); + int tmp2 = bit(aC); + int tmp3 = tmp0 - tmp1 - tmp2; + boolean tmp4 = ((tmp0 & 128) != 0); + boolean tmp5 = ((tmp1 & 128) != 0); + boolean tmp6 = ((tmp3 & 128) != 0); + boolean tmp7 = ((tmp0 & 8) != 0); + boolean tmp8 = ((tmp1 & 8) != 0); + boolean tmp9 = ((tmp3 & 8) != 0); + aH = !tmp7 && tmp8 || tmp8 && tmp9 || tmp9 && !tmp7; + aC = !tmp4 && tmp5 || tmp5 && tmp6 || tmp6 && !tmp4; + aN = tmp6; + aZ = low(tmp3) == 0 && aZ; + aV = tmp4 && !tmp5 && !tmp6 || !tmp4 && tmp5 && tmp6; + aS = (aN != aV); + cyclesConsumed++; + } + + public int getRegisterByte(Register r1) { + if ((r1.val % 10) == 0) { + return sram[r1.num]; + } + return r1.val; + } + + public int low(int tmp3) { + return tmp3 & 0x01; + } + + public int bit(boolean c2) { + return c2 ? 1 : 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(10, test(10)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(20, test(20)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(38, test(40)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/DeadCode01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class DeadCode01 { + + public static int test(int a) { + int arg = a; + int p = arg; + if (p > 2) { + p += 1; + arg += 10; + } else { + p += 2; + arg += 20; + if (p > 3) { + p += 1; + arg += 10; + if (p > 4) { + p += 1; + arg += 10; + } else { + p += 2; + arg += 20; + } + } else { + p += 2; + arg += 20; + } + } + return p; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(4, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(5, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(6, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(4, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(5, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(7, test(6)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/DeadCode02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class DeadCode02 { + + public static int test() { + int i = 0; + while (true) { + i++; + if (test2()) { + break; + } + } + return i; + } + + public static boolean test2() { + return true; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_Cast01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class Fold_Cast01 { + + static final Object object = new Fold_Cast01(); + + int field = 9; + + public static int test(int arg) { + if (arg == 0) { + return ((Fold_Cast01) object).field; + } + if (arg == 1) { + Object obj = new Fold_Cast01(); + return ((Fold_Cast01) obj).field; + } + if (arg == 2) { + return ((Fold_Cast01) null).field; + } + return 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(9, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(9, test(1)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run2() throws Throwable { + test(2); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_Convert01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class Fold_Convert01 { + + public static int test(int arg) { + if (arg == 0) { + return i2b(); + } + if (arg == 1) { + return i2s(); + } + if (arg == 2) { + return i2c(); + } + return 0; + } + + public static int i2b() { + int x = 0x00000080; + return (byte) x; + } + + public static int i2s() { + int x = 0x00008000; + return (short) x; + } + + public static int i2c() { + int x = 0xffffffff; + return (char) x; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(-128, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-32768, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(65535, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_Convert02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class Fold_Convert02 { + public static long test(long arg) { + if (arg == 0) { + return i2l(); + } + if (arg == 1) { + return f2l(); + } + if (arg == 2) { + return d2l(); + } + return 0; + } + public static long i2l() { + int x = 0x80000000; + return x; + } + public static long f2l() { + float x = -33.1f; + return (long) x; + } + public static long d2l() { + double x = -78.1d; + return (long) x; + } + @Test + public void run0() throws Throwable { + Assert.assertEquals(-2147483648L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-33L, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-78L, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_Convert03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of float conversions + */ +public class Fold_Convert03 { + + public static float test(float arg) { + if (arg == 0) { + return i2f(); + } + if (arg == 1) { + return l2f(); + } + if (arg == 2) { + return d2f(); + } + return 0; + } + + public static float i2f() { + int x = 1024; + return x; + } + + public static float l2f() { + long x = -33; + return x; + } + + public static float d2f() { + double x = -78.1d; + return (float) x; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1024f, test(0), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-33f, test(1), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(-78.1f, test(2), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_Convert04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of float conversions + */ +public class Fold_Convert04 { + + public static double test(double arg) { + if (arg == 0) { + return l2d(); + } + if (arg == 1) { + return f2d(); + } + return 0; + } + + public static double l2d() { + long x = 1024; + return x; + } + + public static double f2d() { + float x = -1.25f; + return x; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1024d, test(0), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(-1.25d, test(1), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_Double01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of float operations. + */ +public class Fold_Double01 { + + public static double test(double arg) { + if (arg == 0) { + return add(); + } + if (arg == 1) { + return sub(); + } + if (arg == 2) { + return mul(); + } + if (arg == 3) { + return div(); + } + if (arg == 4) { + return mod(); + } + return 0; + } + + public static double add() { + double x = 3; + return x + 7; + } + + public static double sub() { + double x = 15; + return x - 4; + } + + public static double mul() { + double x = 6; + return x * 2; + } + + public static double div() { + double x = 26; + return x / 2; + } + + public static double mod() { + double x = 29; + return x % 15; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10d, test(0d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11d, test(1d), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12d, test(2d), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(13d, test(3d), 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(14d, test(4d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_Double02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer comparisons. + */ +public class Fold_Double02 { + + public static boolean test(int arg) { + if (arg == 0) { + return equ(); + } + if (arg == 1) { + return neq(); + } + if (arg == 2) { + return geq(); + } + if (arg == 3) { + return ge(); + } + if (arg == 4) { + return ltq(); + } + if (arg == 5) { + return lt(); + } + return false; + } + + static boolean equ() { + double x = 34; + return x == 34; + } + + static boolean neq() { + double x = 34; + return x != 33; + } + + static boolean geq() { + double x = 34; + return x >= 33; + } + + static boolean ge() { + double x = 34; + return x > 35; + } + + static boolean ltq() { + double x = 34; + return x <= 32; + } + + static boolean lt() { + double x = 34; + return x < 31; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_Double03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Fold_Double03 { + + private static final double MINUS_ZERO = 1 / Double.NEGATIVE_INFINITY; + + public static double test(int t, double a) { + double v; + if (t == 0) { + v = a * 0.0; + } else { + v = a * MINUS_ZERO; + } + return 1 / v; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(java.lang.Double.POSITIVE_INFINITY, test(0, 5.0), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(java.lang.Double.NEGATIVE_INFINITY, test(1, 5.0), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(java.lang.Double.NEGATIVE_INFINITY, test(0, -5.0), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(java.lang.Double.POSITIVE_INFINITY, test(1, -5.0), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_Float01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of float operations. + */ +public class Fold_Float01 { + + public static float test(float arg) { + if (arg == 0) { + return add(); + } + if (arg == 1) { + return sub(); + } + if (arg == 2) { + return mul(); + } + if (arg == 3) { + return div(); + } + if (arg == 4) { + return mod(); + } + return 0; + } + + public static float add() { + float x = 3; + return x + 7; + } + + public static float sub() { + float x = 15; + return x - 4; + } + + public static float mul() { + float x = 6; + return x * 2; + } + + public static float div() { + float x = 26; + return x / 2; + } + + public static float mod() { + float x = 29; + return x % 15; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10f, test(0f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11f, test(1f), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12f, test(2f), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(13f, test(3f), 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(14f, test(4f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_Float02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer comparisons. + */ +public class Fold_Float02 { + + public static boolean test(int arg) { + if (arg == 0) { + return equ(); + } + if (arg == 1) { + return neq(); + } + if (arg == 2) { + return geq(); + } + if (arg == 3) { + return ge(); + } + if (arg == 4) { + return ltq(); + } + if (arg == 5) { + return lt(); + } + return false; + } + + static boolean equ() { + float x = 34; + return x == 34; + } + + static boolean neq() { + float x = 34; + return x != 33; + } + + static boolean geq() { + float x = 34; + return x >= 33; + } + + static boolean ge() { + float x = 34; + return x > 35; + } + + static boolean ltq() { + float x = 34; + return x <= 32; + } + + static boolean lt() { + float x = 34; + return x < 31; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_InstanceOf01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class Fold_InstanceOf01 { + + static final Object object = new Fold_InstanceOf01(); + + public static boolean test(int arg) { + if (arg == 0) { + return object instanceof Fold_InstanceOf01; + } + if (arg == 1) { + Object obj = new Fold_InstanceOf01(); + return obj instanceof Fold_InstanceOf01; + } + if (arg == 2) { + return null instanceof Fold_InstanceOf01; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_Int01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class Fold_Int01 { + + public static int test(int arg) { + if (arg == 0) { + return add(); + } + if (arg == 1) { + return sub(); + } + if (arg == 2) { + return mul(); + } + if (arg == 3) { + return div(); + } + if (arg == 4) { + return mod(); + } + if (arg == 5) { + return and(); + } + if (arg == 6) { + return or(); + } + if (arg == 7) { + return xor(); + } + return 0; + } + + public static int add() { + int x = 3; + return x + 7; + } + + public static int sub() { + int x = 15; + return x - 4; + } + + public static int mul() { + int x = 6; + return x * 2; + } + + public static int div() { + int x = 26; + return x / 2; + } + + public static int mod() { + int x = 29; + return x % 15; + } + + public static int and() { + int x = 31; + return x & 15; + } + + public static int or() { + int x = 16; + return x | 16; + } + + public static int xor() { + int x = 0; + return x ^ 17; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(13, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(14, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(15, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(16, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(17, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_Int02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer comparisons. + */ +public class Fold_Int02 { + + public static boolean test(int arg) { + if (arg == 0) { + return equ(); + } + if (arg == 1) { + return neq(); + } + if (arg == 2) { + return geq(); + } + if (arg == 3) { + return ge(); + } + if (arg == 4) { + return ltq(); + } + if (arg == 5) { + return lt(); + } + return false; + } + + static boolean equ() { + int x = 34; + return x == 34; + } + + static boolean neq() { + int x = 34; + return x != 33; + } + + static boolean geq() { + int x = 34; + return x >= 33; + } + + static boolean ge() { + int x = 34; + return x > 35; + } + + static boolean ltq() { + int x = 34; + return x <= 32; + } + + static boolean lt() { + int x = 34; + return x < 31; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_Long01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class Fold_Long01 { + + public static long test(long arg) { + if (arg == 0) { + return add(); + } + if (arg == 1) { + return sub(); + } + if (arg == 2) { + return mul(); + } + if (arg == 3) { + return div(); + } + if (arg == 4) { + return mod(); + } + if (arg == 5) { + return and(); + } + if (arg == 6) { + return or(); + } + if (arg == 7) { + return xor(); + } + return 0; + } + + public static long add() { + long x = 3; + return x + 7; + } + + public static long sub() { + long x = 15; + return x - 4; + } + + public static long mul() { + long x = 6; + return x * 2; + } + + public static long div() { + long x = 26; + return x / 2; + } + + public static long mod() { + long x = 29; + return x % 15; + } + + public static long and() { + long x = 31; + return x & 15; + } + + public static long or() { + long x = 16; + return x | 16; + } + + public static long xor() { + long x = 0; + return x ^ 17; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11L, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12L, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(13L, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(14L, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(15L, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(16L, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(17L, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_Long02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer comparisons. + */ +public class Fold_Long02 { + + public static boolean test(int arg) { + if (arg == 0) { + return equ(); + } + if (arg == 1) { + return neq(); + } + if (arg == 2) { + return geq(); + } + if (arg == 3) { + return ge(); + } + if (arg == 4) { + return ltq(); + } + if (arg == 5) { + return lt(); + } + return false; + } + + static boolean equ() { + long x = 34; + return x == 34; + } + + static boolean neq() { + long x = 34; + return x != 33; + } + + static boolean geq() { + long x = 34; + return x >= 33; + } + + static boolean ge() { + long x = 34; + return x > 35; + } + + static boolean ltq() { + long x = 34; + return x <= 32; + } + + static boolean lt() { + long x = 34; + return x < 31; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(false, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Fold_Math01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Fold_Math01 { + + public static double test(int arg) { + switch (arg) { + case 0: + return abs(); + case 1: + return sin(); + case 2: + return cos(); + case 3: + return tan(); + case 4: + return atan2(); + case 5: + return sqrt(); + case 6: + return log(); + case 7: + return log10(); + case 8: + return pow(); + case 9: + return exp(); + case 10: + return min(); + case 11: + return max(); + } + return 42; + } + + private static double abs() { + return Math.abs(-10.0d); + } + + private static double sin() { + return Math.sin(0.15d); + } + + private static double cos() { + return Math.cos(0.15d); + } + + private static double tan() { + return Math.tan(0.15d); + } + + private static double atan2() { + return Math.atan2(0.15d, 3.1d); + } + + private static double sqrt() { + return Math.sqrt(144d); + } + + private static double log() { + return Math.log(3.15d); + } + + private static double log10() { + return Math.log10(0.15d); + } + + private static double pow() { + return Math.pow(2.15d, 6.1d); + } + + private static double exp() { + return Math.log(3.15d); + } + + private static int min() { + return Math.min(2, -1); + } + + private static int max() { + return Math.max(2, -1); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10d, test(0), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0.14943813247359922d, test(1), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(0.9887710779360422d, test(2), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(0.15113521805829508d, test(3), 0); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0.04834938665190287d, test(4), 0); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(12.0d, test(5), 0); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(1.1474024528375417d, test(6), 0); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(-0.8239087409443188d, test(7), 0); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(106.62882057436371d, test(8), 0); + } + + @Test + public void run9() throws Throwable { + Assert.assertEquals(1.1474024528375417d, test(9), 0); + } + + @Test + public void run10() throws Throwable { + Assert.assertEquals(-1.0d, test(10), 0); + } + + @Test + public void run11() throws Throwable { + Assert.assertEquals(2.0d, test(11), 0); + } + + @Test + public void run12() throws Throwable { + Assert.assertEquals(42d, test(12), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Inline01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Inline01 { + + public static int test(int arg) { + return arg + nobranch(true) + nobranch(false) + nobranch(true) + nobranch(false); + } + + static int nobranch(boolean f) { + if (f) { + return 0; + } + return 1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(2, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(3, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Inline02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Inline02 { + + public static int test(int arg) { + return arg + nobranch(true, arg) + nobranch(false, arg) + nobranch(true, arg) + nobranch(false, arg); + } + + static int nobranch(boolean f, int v) { + if (f) { + return v; + } + return 1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(2, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(5, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(8, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/LLE_01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Test case for local load elimination. It makes sure that the second field store is not eliminated, because + * it is recognized that the first store changes the field "field1", so it is no longer guaranteed that it + * has its default value 0. + */ +public class LLE_01 { + + int field1; + + public static int test() { + LLE_01 o = new LLE_01(); + o.field1 = 1; + o.field1 = 0; + return o.field1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/List_reorder_bug.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +@SuppressWarnings("unused") +public class List_reorder_bug { + + static class List { + + List(int id) { + this.id = id; + } + + List next; + int id; + boolean bool = true; + } + + private static List list; + + public static boolean test(int i) { + list = new List(5); + list.next = new List(6); + new List_reorder_bug().match(new Object(), 27, 6, 0); + return list.next == null; + } + + private void match(Object a, int src, int id, int seq) { + print("match: " + src + ", " + id); + List item = list; + List itemPrev = null; + while (item != null) { + if (item.id == id) { + if (item.bool) { + outcall(item.id); + } + if (itemPrev != null) { + itemPrev.next = item.next; + } else { + list = item.next; + } + + item.next = null; + return; + } + + itemPrev = item; + item = item.next; + } + } + + static int globalId; + + private static void outcall(int id) { + globalId = id; + } + + String s; + + private void print(String s2) { + this.s = s2; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/NCE_01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Test case for null check elimination. + */ +public class NCE_01 { + + public static NCE_01 object = new NCE_01(); + + int field1 = 22; + int field2 = 23; + + public static int test() { + NCE_01 o = object; + int i = o.field1; + // expected null check elimination here + return o.field2 + i; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(45, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/NCE_02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Test case for null check elimination. + */ +public class NCE_02 { + + public static NCE_02 object = new NCE_02(); + + int field1; + int field2 = 23; + + public static int test() { + NCE_02 o = object; + o.field1 = 11; + // expect non-null + o.field1 = 22; + // expect non-null + return o.field2; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(23, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/NCE_03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Test case for null check elimination. + */ +public class NCE_03 { + + private static boolean cond = true; + public static NCE_03 object = new NCE_03(); + + int field1; + int field2 = 23; + + public static int test() { + NCE_03 o = object; + o.field1 = 11; + if (cond) { + // expect non-null + o.field1 = 22; + } + // expect non-null + return o.field2; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(23, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/NCE_04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Test case for null check elimination. + */ +public class NCE_04 { + + private static boolean cond = true; + public static NCE_04 object = new NCE_04(); + + int field1; + int field2 = 23; + + public static int test() { + NCE_04 o = object; + if (cond) { + o.field1 = 22; + } else { + o.field1 = 11; + } + // expect non-null + return o.field2; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(23, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/NCE_FlowSensitive01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class NCE_FlowSensitive01 { + + public static String test(String arg) { + if (arg != null) { + return arg.toString(); + } + return null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(null, test(null)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("x", test("x")); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("yay", test("yay")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/NCE_FlowSensitive02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class NCE_FlowSensitive02 { + + @SuppressWarnings("all") + public static String test(String arg) { + if (arg != null) { + return arg.toString(); + } + return arg.toString(); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run0() throws Throwable { + test(null); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("x", test("x")); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("yay", test("yay")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/NCE_FlowSensitive03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class NCE_FlowSensitive03 { + + public static String test(String arg) { + if ("x".equals(arg)) { + if (arg == null) { + return "null"; + } + } else { + if (arg == null) { + return "null"; + } + } + // arg cannot be null here + return arg.toString(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("null", test(null)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("x", test("x")); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("yay", test("yay")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/NCE_FlowSensitive04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class NCE_FlowSensitive04 { + + public static String test(String arg2) { + String arg = arg2; + if (arg == null) { + arg = "null"; + } + // arg cannot be null here + return arg.toString(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("null", test(null)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("x", test("x")); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("yay", test("yay")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/NCE_FlowSensitive05.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class NCE_FlowSensitive05 { + + public static String test(Object arg) { + + // An artificial loop to trigger iterative NCE. + while (arg != null) { + System.out.println(arg); + } + + // The upcast must still include the null check. + return (String) arg; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(null, test(null)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Narrow_byte01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Narrow_byte01 { + + public static byte val; + + public static byte test(byte b) { + val = b; + return val; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((byte) 0), test(((byte) 0))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((byte) 1), test(((byte) 1))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((byte) -1), test(((byte) -1))); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(((byte) 110), test(((byte) 110))); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Narrow_byte02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Narrow_byte02 { + + static class Byte { + + byte foo; + } + + static Byte val = new Byte(); + + public static byte test(byte b) { + val.foo = b; + return val.foo; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((byte) 0), test(((byte) 0))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((byte) 1), test(((byte) 1))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((byte) -1), test(((byte) -1))); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(((byte) 110), test(((byte) 110))); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Narrow_byte03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Narrow_byte03 { + + static byte[] val = new byte[4]; + + public static byte test(byte b) { + val[0] = b; + return val[0]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((byte) 0), test(((byte) 0))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((byte) 1), test(((byte) 1))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((byte) -1), test(((byte) -1))); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(((byte) 110), test(((byte) 110))); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Narrow_char01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Narrow_char01 { + + public static char val; + + public static char test(char b) { + val = b; + return val; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((char) 0), test(((char) 0))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((char) 1), test(((char) 1))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((char) 255), test(((char) 255))); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(((char) 65000), test(((char) 65000))); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Narrow_char02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Narrow_char02 { + + static class Char { + + char foo; + } + + static Char val = new Char(); + + public static char test(char b) { + val.foo = b; + return val.foo; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((char) 0), test(((char) 0))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((char) 1), test(((char) 1))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((char) 255), test(((char) 255))); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(((char) 65000), test(((char) 65000))); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Narrow_char03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Narrow_char03 { + + static char[] val = new char[4]; + + public static char test(char b) { + val[0] = b; + return val[0]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((char) 0), test(((char) 0))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((char) 1), test(((char) 1))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((char) 255), test(((char) 255))); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(((char) 65000), test(((char) 65000))); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Narrow_short01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Narrow_short01 { + + public static short val; + + public static short test(short b) { + val = b; + return val; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((short) 0), test(((short) 0))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((short) 1), test(((short) 1))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((short) -1), test(((short) -1))); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(((short) 23110), test(((short) 23110))); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Narrow_short02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Narrow_short02 { + + static class Short { + + short foo; + } + + static Short val = new Short(); + + public static short test(short b) { + val.foo = b; + return val.foo; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((short) 0), test(((short) 0))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((short) 1), test(((short) 1))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((short) -1), test(((short) -1))); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(((short) 23110), test(((short) 23110))); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Narrow_short03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Narrow_short03 { + + static short[] val = new short[4]; + + public static short test(short b) { + val[0] = b; + return val[0]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((short) 0), test(((short) 0))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((short) 1), test(((short) 1))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((short) -1), test(((short) -1))); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(((short) 23110), test(((short) 23110))); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Phi01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Phi01 { + + public static class Phi { + + int f; + + Phi(int f) { + this.f = f; + } + } + + public static int test(int arg) { + return test2(new Phi(arg), arg); + } + +// @NEVER_INLINE + private static int test2(Phi p, int a) { + int arg = a; + if (arg > 2) { + p.f += 1; + arg += 1; + } else { + p.f += 2; + arg += 2; + if (arg > 3) { + p.f += 1; + arg += 1; + if (arg > 4) { + p.f += 1; + arg += 1; + } else { + p.f += 2; + arg += 2; + } + } else { + p.f += 2; + arg += 2; + } + } + return arg + p.f; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(8, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(10, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(8, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(10, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(14, test(6)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Phi02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Phi02 { + + public static class Phi { + + int f; + + Phi(int f) { + this.f = f; + } + } + + public static int test(int arg) { + return test2(new Phi(arg), arg); + } + +// @NEVER_INLINE + private static int test2(Phi p, int a) { + int arg = a; + if (arg > 2) { + inc(p, 1); + arg += 1; + } else { + inc(p, 2); + arg += 2; + if (arg > 3) { + inc(p, 1); + arg += 1; + if (arg > 4) { + inc(p, 1); + arg += 1; + } else { + inc(p, 2); + arg += 2; + } + } else { + inc(p, 2); + arg += 2; + } + } + return arg + p.f; + } + +// @NEVER_INLINE + private static void inc(Phi p, int inc) { + p.f += inc; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(8, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(10, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(8, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(10, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(14, test(6)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Phi03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class Phi03 { + + public static class Phi { + + int f; + + Phi(int f) { + this.f = f; + } + } + + public static int test(int arg) { + return test2(new Phi(arg), arg); + } + +// @NEVER_INLINE + private static int test2(Phi p, int a) { + int arg = a; + if (arg > 2) { + inc(p, 1); + arg += 1; + } else { + inc(p, 2); + arg += 2; + if (arg > 3) { + inc(p, 1); + arg += 1; + if (arg > 4) { + inc(p, 1); + arg += 1; + } else { + inc(p, 2); + arg += 2; + } + } else { + inc(p, 2); + arg += 2; + } + } + return p.f; + } + +// @NEVER_INLINE + private static void inc(Phi p, int inc) { + p.f += inc; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(4, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(5, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(6, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(4, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(5, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(7, test(6)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Reduce_Convert01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization integer conversions. + */ +public class Reduce_Convert01 { + + public static int test(int arg) { + if (arg == 0) { + return i2b(arg + 10); + } + if (arg == 1) { + return i2s(arg + 10); + } + if (arg == 2) { + return i2c(arg + 10); + } + return 0; + } + + public static int i2b(int arg) { + int x = (byte) arg; + return (byte) x; + } + + public static int i2s(int arg) { + int x = (short) arg; + return (short) x; + } + + public static int i2c(int arg) { + int x = (char) arg; + return (char) x; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Reduce_Double01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization of double operations. + */ +public class Reduce_Double01 { + + public static double test(double arg) { + if (arg == 0) { + return add(10); + } + if (arg == 1) { + return sub(11); + } + if (arg == 2) { + return mul(12); + } + if (arg == 3) { + return div(13); + } + return 0; + } + + public static double add(double x) { + return x + 0; + } + + public static double sub(double x) { + return x - 0; + } + + public static double mul(double x) { + return x * 1; + } + + public static double div(double x) { + return x / 1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10d, test(0d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11d, test(1d), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12d, test(2d), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(13d, test(3d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Reduce_Float01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization of float operations. + */ +public class Reduce_Float01 { + + public static float test(float arg) { + if (arg == 0) { + return add(10); + } + if (arg == 1) { + return sub(11); + } + if (arg == 2) { + return mul(12); + } + if (arg == 3) { + return div(13); + } + return 0; + } + + public static float add(float x) { + return x + 0; + } + + public static float sub(float x) { + return x - 0; + } + + public static float mul(float x) { + return x * 1; + } + + public static float div(float x) { + return x / 1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10f, test(0f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11f, test(1f), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12f, test(2f), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(13f, test(3f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Reduce_Int01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class Reduce_Int01 { + + public static int test(int arg) { + if (arg == 0) { + return add(10); + } + if (arg == 1) { + return sub(11); + } + if (arg == 2) { + return mul(12); + } + if (arg == 3) { + return div(13); + } + if (arg == 4) { + return mod(); + } + if (arg == 5) { + return and(15); + } + if (arg == 6) { + return or(16); + } + if (arg == 7) { + return xor(17); + } + return 0; + } + + public static int add(int x) { + return x + 0; + } + + public static int sub(int x) { + return x - 0; + } + + public static int mul(int x) { + return x * 1; + } + + public static int div(int x) { + return x / 1; + } + + public static int mod() { + return 14; + } + + public static int and(int x) { + return x & -1; + } + + public static int or(int x) { + return x | 0; + } + + public static int xor(int x) { + return x ^ 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(13, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(14, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(15, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(16, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(17, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Reduce_Int02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class Reduce_Int02 { + + public static int test(int arg) { + if (arg == 0) { + return add(10); + } + if (arg == 1) { + return sub(); + } + if (arg == 2) { + return mul(12); + } + if (arg == 3) { + return div(); + } + if (arg == 4) { + return mod(); + } + if (arg == 5) { + return and(15); + } + if (arg == 6) { + return or(16); + } + if (arg == 7) { + return xor(17); + } + return 0; + } + + public static int add(int x) { + return 0 + x; + } + + public static int sub() { + return 11; + } + + public static int mul(int x) { + return 1 * x; + } + + public static int div() { + return 13; + } + + public static int mod() { + return 14; + } + + public static int and(int x) { + return -1 & x; + } + + public static int or(int x) { + return 0 | x; + } + + public static int xor(int x) { + return 0 ^ x; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(13, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(14, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(15, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(16, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(17, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Reduce_Int03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class Reduce_Int03 { + + public static int test(int arg) { + if (arg == 0) { + return add(5); + } + if (arg == 1) { + return sub(10); + } + if (arg == 2) { + return mul(5); + } + if (arg == 3) { + return div(5); + } + if (arg == 4) { + return mod(5); + } + if (arg == 5) { + return and(15); + } + if (arg == 6) { + return or(16); + } + if (arg == 7) { + return xor(17); + } + return 0; + } + + public static int add(int x) { + return x + x; + } + + public static int sub(int x) { + return x - x; + } + + public static int mul(int x) { + return x * x; + } + + public static int div(int x) { + return x / x; + } + + public static int mod(int x) { + return x % x; + } + + public static int and(int x) { + return x & x; + } + + public static int or(int x) { + return x | x; + } + + public static int xor(int x) { + return x ^ x; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(25, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(15, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(16, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(0, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Reduce_Int04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class Reduce_Int04 { + + public static int test(int arg) { + if (arg == 0) { + return mul0(arg + 10); + } + if (arg == 1) { + return mul1(arg + 9); + } + return 0; + } + + public static int mul0(int x) { + return x * 4; + } + + public static int mul1(int x) { + return x * 65536; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(40, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(655360, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Reduce_IntShift01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization of integer operations. + */ +public class Reduce_IntShift01 { + + public static int test(int arg) { + if (arg == 0) { + return shift0(arg + 10); + } + if (arg == 1) { + return shift1(arg + 10); + } + if (arg == 2) { + return shift2(arg + 10); + } + if (arg == 3) { + return shift3(arg + 10); + } + if (arg == 4) { + return shift4(arg + 10); + } + if (arg == 5) { + return shift5(arg + 10); + } + return 0; + } + + public static int shift0(int x) { + return x >> 0; + } + + public static int shift1(int x) { + return x >>> 0; + } + + public static int shift2(int x) { + return x << 0; + } + + public static int shift3(int x) { + return x >> 64; + } + + public static int shift4(int x) { + return x >>> 64; + } + + public static int shift5(int x) { + return x << 64; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(13, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(14, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(15, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Reduce_IntShift02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization of integer operations. + */ +public class Reduce_IntShift02 { + + public static int test(int arg) { + if (arg == 0) { + return shift0(arg + 80); + } + if (arg == 1) { + return shift1(arg + 0x8000000a); + } + if (arg == 2) { + return shift2(arg + 192); + } + if (arg == 3) { + return shift3(arg + 208); + } + if (arg == 4) { + return shift4(arg); + } + if (arg == 5) { + return shift5(arg); + } + return 0; + } + + public static int shift0(int x) { + return x >>> 3 << 3; + } + + public static int shift1(int x) { + return x << 3 >>> 3; + } + + public static int shift2(int x) { + return x >> 3 >> 1; + } + + public static int shift3(int x) { + return x >>> 3 >>> 1; + } + + public static int shift4(int x) { + return x << 3 << 1; + } + + public static int shift5(int x) { + return x << 16 << 17; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(80, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(13, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(64, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(0, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Reduce_Long01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class Reduce_Long01 { + + public static long test(long arg) { + if (arg == 0) { + return add(10); + } + if (arg == 1) { + return sub(11); + } + if (arg == 2) { + return mul(12); + } + if (arg == 3) { + return div(13); + } + if (arg == 4) { + return mod(); + } + if (arg == 5) { + return and(15); + } + if (arg == 6) { + return or(16); + } + if (arg == 7) { + return xor(17); + } + return 0; + } + + public static long add(long x) { + return x + 0; + } + + public static long sub(long x) { + return x - 0; + } + + public static long mul(long x) { + return x * 1; + } + + public static long div(long x) { + return x / 1; + } + + public static long mod() { + return 14; + } + + public static long and(long x) { + return x & -1; + } + + public static long or(long x) { + return x | 0; + } + + public static long xor(long x) { + return x ^ 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11L, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12L, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(13L, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(14L, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(15L, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(16L, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(17L, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Reduce_Long02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class Reduce_Long02 { + + public static long test(long arg) { + if (arg == 0) { + return add(10); + } + if (arg == 1) { + return sub(); + } + if (arg == 2) { + return mul(12); + } + if (arg == 3) { + return div(); + } + if (arg == 4) { + return mod(); + } + if (arg == 5) { + return and(15); + } + if (arg == 6) { + return or(16); + } + if (arg == 7) { + return xor(17); + } + return 0; + } + + public static long add(long x) { + return 0 + x; + } + + public static long sub() { + return 11; + } + + public static long mul(long x) { + return 1 * x; + } + + public static long div() { + return 13; + } + + public static long mod() { + return 14; + } + + public static long and(long x) { + return -1 & x; + } + + public static long or(long x) { + return 0 | x; + } + + public static long xor(long x) { + return 0 ^ x; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11L, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12L, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(13L, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(14L, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(15L, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(16L, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(17L, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Reduce_Long03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class Reduce_Long03 { + + public static long test(long arg) { + if (arg == 0) { + return add(5); + } + if (arg == 1) { + return sub(10); + } + if (arg == 2) { + return mul(5); + } + if (arg == 3) { + return div(5); + } + if (arg == 4) { + return mod(5); + } + if (arg == 5) { + return and(15); + } + if (arg == 6) { + return or(16); + } + if (arg == 7) { + return xor(17); + } + return 0; + } + + public static long add(long x) { + return x + x; + } + + public static long sub(long x) { + return x - x; + } + + public static long mul(long x) { + return x * x; + } + + public static long div(long x) { + return x / x; + } + + public static long mod(long x) { + return x % x; + } + + public static long and(long x) { + return x & x; + } + + public static long or(long x) { + return x | x; + } + + public static long xor(long x) { + return x ^ x; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0L, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(25L, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1L, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0L, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(15L, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(16L, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(0L, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Reduce_Long04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class Reduce_Long04 { + + public static long test(long arg) { + if (arg == 0) { + return mul0(arg + 10); + } + if (arg == 1) { + return mul1(arg + 9); + } + return 0; + } + + public static long mul0(long x) { + return x * 4; + } + + public static long mul1(long x) { + return x * 8589934592L; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(40L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(85899345920L, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Reduce_LongShift01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization of integer operations. + */ +public class Reduce_LongShift01 { + + public static long test(long arg) { + if (arg == 0) { + return shift0(arg + 10); + } + if (arg == 1) { + return shift1(arg + 10); + } + if (arg == 2) { + return shift2(arg + 10); + } + if (arg == 3) { + return shift3(arg + 10); + } + if (arg == 4) { + return shift4(arg + 10); + } + if (arg == 5) { + return shift5(arg + 10); + } + return 0; + } + + public static long shift0(long x) { + return x >> 0; + } + + public static long shift1(long x) { + return x >>> 0; + } + + public static long shift2(long x) { + return x << 0; + } + + public static long shift3(long x) { + return x >> 64; + } + + public static long shift4(long x) { + return x >>> 64; + } + + public static long shift5(long x) { + return x << 64; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11L, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12L, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(13L, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(14L, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(15L, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Reduce_LongShift02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization of integer operations. + */ +public class Reduce_LongShift02 { + + public static long test(long arg) { + if (arg == 0) { + return shift0(arg + 80); + } + if (arg == 1) { + return shift1(arg + 0x800000000000000aL); + } + if (arg == 2) { + return shift2(arg + 192); + } + if (arg == 3) { + return shift3(arg + 208); + } + if (arg == 4) { + return shift4(arg); + } + return 0; + } + + public static long shift0(long x) { + return x >>> 3 << 3; + } + + public static long shift1(long x) { + return x << 3 >>> 3; + } + + public static long shift2(long x) { + return x >> 3 >> 1; + } + + public static long shift3(long x) { + return x >>> 3 >>> 1; + } + + public static long shift4(long x) { + return x << 3 << 1; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(80L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(11L, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(12L, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(13L, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(64L, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Switch01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization of switches. + */ +public class Switch01 { + + public static int test(int arg) { + switch (arg) { + default: + return 1; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1, test(0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/Switch02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization of switches. + */ +public class Switch02 { + + public static int test(int arg) { + switch (arg) { + case 1: + return 2; + default: + return 1; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(1, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(2, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/TypeCastElem.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + */ +public class TypeCastElem { + + interface Int1 { + + int do1(); + } + + interface Int2 { + + int do2(); + } + + interface Int3 extends Int1 { + + int do3(); + } + + public static class ClassA implements Int1 { + + private int a; + + public ClassA(int a) { + this.a = a; + } + + public int do1() { + return a; + } + } + + public static class ClassB extends ClassA implements Int2 { + + int b; + + public ClassB(int a, int b) { + super(a); + this.b = b; + } + + public int do2() { + return b; + } + } + + public static class ClassC implements Int3 { + + private int a; + private int b; + + public ClassC(int a, int b) { + this.a = a; + this.b = b; + } + + public int do3() { + return b; + } + + public int do1() { + return a; + } + + } + + public static int test1(Object o) { + if (o instanceof ClassB) { + ClassB b = (ClassB) o; + if (o instanceof Int1) { + return b.b - b.b + 1; + } + return 7; + } + return 3; + } + + public static int test2(Object o) { + Object b = o; + if (o instanceof ClassB) { + ClassA a = (ClassA) o; + if (b instanceof Int1) { + return ((Int1) a).do1(); + } + return 7; + } + return 3; + } + + public static int test3(Object o) { + Object b = o; + boolean t = o instanceof Int3; + if (t) { + Int1 a = (Int1) b; + return a.do1(); + } + return 3; + } + + public static int test(int a, int b, int c) { + ClassA ca = new ClassA(a); + ClassB cb = new ClassB(a, b); + ClassC cc = new ClassC(c, c); + int sum1 = test1(ca) + test1(cb) * 10 + test1(cc) * 100; + int sum2 = test2(ca) + test2(cb) * 10 + test2(cc) * 100; + int sum3 = test3(ca) + test3(cb) * 10 + test3(cc) * 100; + int result = sum1 * 5 + sum2 * 7 + sum3 * 9; + return result; + } + + public static void main(String[] args) { + System.out.println(test(10, 13, 25)); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(27183, test(10, 13, 25)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Cast01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class VN_Cast01 { + + static final Object object = new VN_Cast01(); + + int field = 9; + + public static int test(int arg) { + if (arg == 0) { + return test1(); + } + if (arg == 1) { + return test2(); + } + if (arg == 2) { + return test3(); + } + return 0; + } + + private static int test1() { + Object o = object; + VN_Cast01 a = (VN_Cast01) o; + VN_Cast01 b = (VN_Cast01) o; + return a.field + b.field; + } + + private static int test2() { + Object obj = new VN_Cast01(); + VN_Cast01 a = (VN_Cast01) obj; + VN_Cast01 b = (VN_Cast01) obj; + return a.field + b.field; + } + + @SuppressWarnings("all") + private static int test3() { + Object o = null; + VN_Cast01 a = (VN_Cast01) o; + VN_Cast01 b = (VN_Cast01) o; + return a.field + b.field; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(18, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(18, test(1)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run2() throws Throwable { + test(2); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Cast02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class VN_Cast02 { + + private static boolean cond = true; + static final Object object = new VN_Cast02(); + + int field = 9; + + public static int test(int arg) { + if (arg == 0) { + return test1(); + } + if (arg == 1) { + return test2(); + } + if (arg == 2) { + return test3(); + } + return 0; + } + + private static int test1() { + Object o = object; + VN_Cast02 a = (VN_Cast02) o; + if (cond) { + VN_Cast02 b = (VN_Cast02) o; + return a.field + b.field; + } + return 0; + } + + private static int test2() { + Object obj = new VN_Cast02(); + VN_Cast02 a = (VN_Cast02) obj; + if (cond) { + VN_Cast02 b = (VN_Cast02) obj; + return a.field + b.field; + } + return 0; + } + + @SuppressWarnings("all") + private static int test3() { + Object o = null; + VN_Cast02 a = (VN_Cast02) o; + if (cond) { + VN_Cast02 b = (VN_Cast02) o; + return a.field + b.field; + } + return 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(18, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(18, test(1)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run2() throws Throwable { + test(2); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Convert01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization integer conversions. + */ +public class VN_Convert01 { + + public static int test(int arg) { + if (arg == 0) { + return i2b(arg + 10); + } + if (arg == 1) { + return i2s(arg + 10); + } + if (arg == 2) { + return i2c(arg + 10); + } + return 0; + } + + public static int i2b(int arg) { + int x = (byte) arg; + int y = (byte) arg; + return x + y; + } + + public static int i2s(int arg) { + int x = (short) arg; + int y = (short) arg; + return x + y; + } + + public static int i2c(int arg) { + int x = (char) arg; + int y = (char) arg; + return x + y; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(20, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(22, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(24, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Convert02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization integer conversions. + */ +public class VN_Convert02 { + + private static boolean cond = true; + + public static int test(int arg) { + if (arg == 0) { + return i2b(arg + 10); + } + if (arg == 1) { + return i2s(arg + 10); + } + if (arg == 2) { + return i2c(arg + 10); + } + return 0; + } + + public static int i2b(int arg) { + int x = (byte) arg; + if (cond) { + int y = (byte) arg; + return x + y; + } + return 0; + } + + public static int i2s(int arg) { + int x = (short) arg; + if (cond) { + int y = (short) arg; + return x + y; + } + return 0; + } + + public static int i2c(int arg) { + int x = (char) arg; + if (cond) { + int y = (char) arg; + return x + y; + } + return 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(20, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(22, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(24, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Double01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization of float operations. + */ +public class VN_Double01 { + + public static double test(double arg) { + if (arg == 0) { + return add(arg + 10); + } + if (arg == 1) { + return sub(arg + 10); + } + if (arg == 2) { + return mul(arg + 10); + } + if (arg == 3) { + return div(arg + 10); + } + return 0; + } + + public static double add(double x) { + double c = 1; + double t = x + c; + double u = x + c; + return t + u; + } + + public static double sub(double x) { + double c = 1; + double t = x - c; + double u = x - c; + return t - u; + } + + public static double mul(double x) { + double c = 1; + double t = x * c; + double u = x * c; + return t * u; + } + + public static double div(double x) { + double c = 1; + double t = x / c; + double u = x / c; + return t / u; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(22d, test(0d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0d, test(1d), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(144d, test(2d), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1d, test(3d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Double02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization of float operations. + */ +public class VN_Double02 { + + private static boolean cond = true; + + public static double test(double arg) { + if (arg == 0) { + return add(arg + 10); + } + if (arg == 1) { + return sub(arg + 10); + } + if (arg == 2) { + return mul(arg + 10); + } + if (arg == 3) { + return div(arg + 10); + } + return 0; + } + + public static double add(double x) { + double c = 1.0d; + double t = x + c; + if (cond) { + double u = x + c; + return t + u; + } + return 1; + } + + public static double sub(double x) { + double c = 1.0d; + double t = x - c; + if (cond) { + double u = x - c; + return t - u; + } + return 1; + } + + public static double mul(double x) { + double c = 1.0d; + double t = x * c; + if (cond) { + double u = x * c; + return t * u; + } + return 1.0d; + } + + public static double div(double x) { + double c = 1.0d; + double t = x / c; + if (cond) { + double u = x / c; + return t / u; + } + return 1.0d; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(22d, test(0d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0d, test(1d), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(144d, test(2d), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1d, test(3d), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Field01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class VN_Field01 { + + static final VN_Field01 object = new VN_Field01(); + + int field = 9; + + public static int test(int arg) { + if (arg == 0) { + return test1(); + } + if (arg == 1) { + return test2(); + } + if (arg == 2) { + return test3(); + } + return 0; + } + + private static int test1() { + VN_Field01 a = object; + return a.field + a.field; + } + + private static int test2() { + VN_Field01 a = object; + VN_Field01 b = object; + return a.field + b.field; + } + + @SuppressWarnings("all") + private static int test3() { + VN_Field01 a = null; + VN_Field01 b = null; + return a.field + b.field; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(18, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(18, test(1)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run2() throws Throwable { + test(2); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Field02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests constant folding of integer operations. + */ +public class VN_Field02 { + + private static boolean cond = true; + static final VN_Field02 object = new VN_Field02(); + + int field = 9; + + public static int test(int arg) { + if (arg == 0) { + return test1(); + } + if (arg == 1) { + return test2(); + } + if (arg == 2) { + return test3(); + } + return 0; + } + + private static int test1() { + VN_Field02 a = object; + int c = a.field; + if (cond) { + return c + a.field; + } + return 0; + } + + private static int test2() { + VN_Field02 a = object; + if (cond) { + VN_Field02 b = object; + return a.field + b.field; + } + return 0; + } + + @SuppressWarnings("all") + private static int test3() { + VN_Field02 a = null; + if (cond) { + VN_Field02 b = null; + return a.field + b.field; + } + return 0; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(18, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(18, test(1)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run2() throws Throwable { + test(2); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Float01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization of float operations. + */ +public class VN_Float01 { + + public static float test(float arg) { + if (arg == 0) { + return add(arg + 10); + } + if (arg == 1) { + return sub(arg + 10); + } + if (arg == 2) { + return mul(arg + 10); + } + if (arg == 3) { + return div(arg + 10); + } + return 0; + } + + public static float add(float x) { + float c = 1; + float t = x + c; + float u = x + c; + return t + u; + } + + public static float sub(float x) { + float c = 1; + float t = x - c; + float u = x - c; + return t - u; + } + + public static float mul(float x) { + float c = 1; + float t = x * c; + float u = x * c; + return t * u; + } + + public static float div(float x) { + float c = 1; + float t = x / c; + float u = x / c; + return t / u; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(22f, test(0f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0f, test(1f), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(144f, test(2f), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1f, test(3f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Float02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization of float operations. + */ +public class VN_Float02 { + + private static boolean cond = true; + + public static float test(float arg) { + if (arg == 0) { + return add(arg + 10); + } + if (arg == 1) { + return sub(arg + 10); + } + if (arg == 2) { + return mul(arg + 10); + } + if (arg == 3) { + return div(arg + 10); + } + return 0; + } + + public static float add(float x) { + float c = 1.0f; + float t = x + c; + if (cond) { + float u = x + c; + return t + u; + } + return 1.0f; + } + + public static float sub(float x) { + float c = 1.0f; + float t = x - c; + if (cond) { + float u = x - c; + return t - u; + } + return 1.0f; + } + + public static float mul(float x) { + float c = 1.0f; + float t = x * c; + if (cond) { + float u = x * c; + return t * u; + } + return 1.0f; + } + + public static float div(float x) { + float c = 1.0f; + float t = x / c; + if (cond) { + float u = x / c; + return t / u; + } + return 1.0f; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(22f, test(0f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0f, test(1f), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(144f, test(2f), 0); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1f, test(3f), 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_InstanceOf01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests value numbering of instanceof operations. + */ +public class VN_InstanceOf01 { + + static final Object object = new VN_InstanceOf01(); + + public static boolean test(int arg) { + if (arg == 0) { + return foo1(); + } + if (arg == 1) { + return foo2(); + } + if (arg == 2) { + return foo3(); + } + // do nothing + return false; + } + + private static boolean foo1() { + boolean a = object instanceof VN_InstanceOf01; + boolean b = object instanceof VN_InstanceOf01; + return a | b; + } + + private static boolean foo2() { + Object obj = new VN_InstanceOf01(); + boolean a = obj instanceof VN_InstanceOf01; + boolean b = obj instanceof VN_InstanceOf01; + return a | b; + } + + private static boolean foo3() { + boolean a = null instanceof VN_InstanceOf01; + boolean b = null instanceof VN_InstanceOf01; + return a | b; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_InstanceOf02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests value numbering of instanceof operations. + */ +public class VN_InstanceOf02 { + + private static boolean cond = true; + + static final Object object = new VN_InstanceOf02(); + + public static boolean test(int arg) { + if (arg == 0) { + return foo1(); + } + if (arg == 1) { + return foo2(); + } + if (arg == 2) { + return foo3(); + } + // do nothing + return false; + } + + private static boolean foo1() { + boolean a = object instanceof VN_InstanceOf02; + if (cond) { + boolean b = object instanceof VN_InstanceOf02; + return a | b; + } + return false; + } + + private static boolean foo2() { + Object obj = new VN_InstanceOf02(); + boolean a = obj instanceof VN_InstanceOf02; + if (cond) { + boolean b = obj instanceof VN_InstanceOf02; + return a | b; + } + return false; + } + + private static boolean foo3() { + boolean a = null instanceof VN_InstanceOf02; + if (cond) { + boolean b = null instanceof VN_InstanceOf02; + return a | b; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(false, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_InstanceOf03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests value numbering of instanceof operations. + */ +public class VN_InstanceOf03 { + + private static boolean cond = true; + + static final Object object = new VN_InstanceOf03(); + + public static boolean test() { + return foo(); + } + + private static boolean foo() { + Object obj = new VN_InstanceOf03(); + boolean a = obj instanceof VN_InstanceOf03; + if (cond) { + boolean b = obj instanceof VN_InstanceOf03; + return a | b; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Int01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests value numbering of integer operations. + */ +public class VN_Int01 { + + public static int test(int arg) { + if (arg == 0) { + return add(arg); + } + if (arg == 1) { + return sub(arg); + } + if (arg == 2) { + return mul(arg); + } + if (arg == 3) { + return div(arg); + } + if (arg == 4) { + return mod(arg); + } + if (arg == 5) { + return and(arg); + } + if (arg == 6) { + return or(arg); + } + if (arg == 7) { + return xor(arg); + } + return 0; + } + + public static int add(int x) { + int c = 3; + int t = x + c; + int u = x + c; + return t + u; + } + + public static int sub(int x) { + int c = 3; + int t = x - c; + int u = x - c; + return t - u; + } + + public static int mul(int x) { + int i = 3; + int t = x * i; + int u = x * i; + return t * u; + } + + public static int div(int x) { + int i = 9; + int t = i / x; + int u = i / x; + return t / u; + } + + public static int mod(int x) { + int i = 7; + int t = i % x; + int u = i % x; + return t % u; + } + + public static int and(int x) { + int i = 7; + int t = i & x; + int u = i & x; + return t & u; + } + + public static int or(int x) { + int i = 7; + int t = i | x; + int u = i | x; + return t | u; + } + + public static int xor(int x) { + int i = 7; + int t = i ^ x; + int u = i ^ x; + return t ^ u; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(6, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(36, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(5, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(7, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(0, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Int02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization of integer operations. + */ +public class VN_Int02 { + + public static int test(int arg) { + if (arg == 0) { + return shift0(arg + 10); + } + if (arg == 1) { + return shift1(arg + 10); + } + if (arg == 2) { + return shift2(arg + 10); + } + return 0; + } + + public static int shift0(int x) { + int c = 1; + int t = x >> c; + int u = x >> c; + return t + u; + } + + public static int shift1(int x) { + int c = 1; + int t = x >>> c; + int u = x >>> c; + return t + u; + } + + public static int shift2(int x) { + int c = 1; + int t = x << c; + int u = x << c; + return t + u; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(10, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(48, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Int03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests value numbering of integer operations. + */ +public class VN_Int03 { + + private static boolean cond = true; + + public static int test(int arg) { + if (arg == 0) { + return add(arg); + } + if (arg == 1) { + return sub(arg); + } + if (arg == 2) { + return mul(arg); + } + if (arg == 3) { + return div(arg); + } + if (arg == 4) { + return mod(arg); + } + if (arg == 5) { + return and(arg); + } + if (arg == 6) { + return or(arg); + } + if (arg == 7) { + return xor(arg); + } + return 0; + } + + public static int add(int x) { + int c = 3; + int t = x + c; + if (cond) { + int u = x + c; + return t + u; + } + return 0; + } + + public static int sub(int x) { + int c = 3; + int t = x - c; + if (cond) { + int u = x - c; + return t - u; + } + return 3; + } + + public static int mul(int x) { + int i = 3; + int t = x * i; + if (cond) { + int u = x * i; + return t * u; + } + return 3; + } + + public static int div(int x) { + int i = 9; + int t = i / x; + if (cond) { + int u = i / x; + return t / u; + } + return 9; + } + + public static int mod(int x) { + int i = 7; + int t = i % x; + if (cond) { + int u = i % x; + return t % u; + } + return 7; + } + + public static int and(int x) { + int i = 7; + int t = i & x; + if (cond) { + int u = i & x; + return t & u; + } + return 7; + } + + public static int or(int x) { + int i = 7; + int t = i | x; + if (cond) { + int u = i | x; + return t | u; + } + return 7; + } + + public static int xor(int x) { + int i = 7; + int t = i ^ x; + if (cond) { + int u = i ^ x; + return t ^ u; + } + return 7; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(6, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(36, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(5, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(7, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(0, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Long01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests value numbering of long operations. + */ +public class VN_Long01 { + + public static long test(int arg) { + if (arg == 0) { + return add(arg); + } + if (arg == 1) { + return sub(arg); + } + if (arg == 2) { + return mul(arg); + } + if (arg == 3) { + return div(arg); + } + if (arg == 4) { + return mod(arg); + } + if (arg == 5) { + return and(arg); + } + if (arg == 6) { + return or(arg); + } + if (arg == 7) { + return xor(arg); + } + return 0; + } + + public static long add(long x) { + long t = x + 3; + long u = x + 3; + return t + u; + } + + public static long sub(long x) { + long t = x - 3; + long u = x - 3; + return t - u; + } + + public static long mul(long x) { + long t = x * 3; + long u = x * 3; + return t * u; + } + + public static long div(long x) { + long t = 9 / x; + long u = 9 / x; + return t / u; + } + + public static long mod(long x) { + long t = 7 % x; + long u = 7 % x; + return t % u; + } + + public static long and(long x) { + long t = 7 & x; + long u = 7 & x; + return t & u; + } + + public static long or(long x) { + long t = 7 | x; + long u = 7 | x; + return t | u; + } + + public static long xor(long x) { + long t = 7 ^ x; + long u = 7 ^ x; + return t ^ u; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(6L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0L, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(36L, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1L, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0L, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(5L, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(7L, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(0L, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Long02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests optimization of integer operations. + */ +public class VN_Long02 { + + public static long test(int arg) { + if (arg == 0) { + return shift0(arg + 10); + } + if (arg == 1) { + return shift1(arg + 10); + } + if (arg == 2) { + return shift2(arg + 10); + } + return 0; + } + + public static long shift0(long x) { + long c = 1; + long t = x >> c; + long u = x >> c; + return t + u; + } + + public static long shift1(long x) { + long c = 1; + long t = x >>> c; + long u = x >>> c; + return t + u; + } + + public static long shift2(long x) { + long c = 1; + long t = x << c; + long u = x << c; + return t + u; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(10L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(10L, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(48L, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Long03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests value numbering of long operations. + */ +public class VN_Long03 { + + private static boolean cond = true; + + public static long test(int arg) { + if (arg == 0) { + return add(arg); + } + if (arg == 1) { + return sub(arg); + } + if (arg == 2) { + return mul(arg); + } + if (arg == 3) { + return div(arg); + } + if (arg == 4) { + return mod(arg); + } + if (arg == 5) { + return and(arg); + } + if (arg == 6) { + return or(arg); + } + if (arg == 7) { + return xor(arg); + } + return 0; + } + + public static long add(long x) { + long t = x + 3; + if (cond) { + long u = x + 3; + return t + u; + } + return 3; + } + + public static long sub(long x) { + long t = x - 3; + if (cond) { + long u = x - 3; + return t - u; + } + return 3; + } + + public static long mul(long x) { + long t = x * 3; + if (cond) { + long u = x * 3; + return t * u; + } + return 3; + } + + public static long div(long x) { + long t = 9 / x; + if (cond) { + long u = 9 / x; + return t / u; + } + return 9; + } + + public static long mod(long x) { + long t = 7 % x; + if (cond) { + long u = 7 % x; + return t % u; + } + return 7; + } + + public static long and(long x) { + long t = 7 & x; + if (cond) { + long u = 7 & x; + return t & u; + } + return 7; + } + + public static long or(long x) { + long t = 7 | x; + if (cond) { + long u = 7 | x; + return t | u; + } + return 7; + } + + public static long xor(long x) { + long t = 7 ^ x; + if (cond) { + long u = 7 ^ x; + return t ^ u; + } + return 7; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(6L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(0L, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(36L, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(1L, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0L, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(5L, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(7L, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(0L, test(7)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/optimize/VN_Loop01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.optimize; + +import org.junit.*; + +/* + * Tests value numbering of integer operations. + */ +public class VN_Loop01 { + + private static boolean cond1 = true; + private static boolean cond2 = true; + + public static int test(int arg) { + if (arg == 0) { + return test1(arg); + } + if (arg == 1) { + return test2(arg); + } + if (arg == 2) { + return test3(arg); + } + if (arg == 3) { + return test4(arg); + } + return 0; + } + + public static int test1(int x) { + int c = 3; + int t = x + c; + while (cond1) { + if (cond2) { + int u = x + c; // GVN should recognize u == t + return t + u; + } + } + return 3; // GVN should recognize 3 == 3 + } + + public static int test2(int x) { + int c = 3; + while (cond1) { + int t = x + c; + if (cond2) { + int u = x + c; // GVN should recognize u == t + return t + u; + } + } + return 3; + } + + public static int test3(int x) { + int c = 3; + int t = x + c; + while (cond1) { + if (cond2) { + int u = x + c; // GVN should recognize u == t + return t + u; + } + int u = x + c; // GVN should recognize u == t + return t + u; + } + return 3; // GVN should recognize 3 == 3 + } + + public static int test4(int x) { + int c = 3; + int t = x + c; + while (cond1) { + if (!cond2) { + int u = x + c; + return t + u; + } + int u = x + c; + return t + u; + } + return 3; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(6, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(8, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(10, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(12, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(0, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_get01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_get01 { + + private static final String[] array = {"0", "1", "2"}; + + public static String test(int i) { + return (String) Array.get(array, i); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("0", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("1", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("2", test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_get02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_get02 { + + private static final int[] array = {11, 21, 42}; + + public static int test(int i) { + return (Integer) Array.get(array, i); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(21, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(42, test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_get03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_get03 { + + private static final byte[] array = {11, 21, 42}; + + public static byte test(int i) { + return (Byte) Array.get(array, i); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((byte) 11), test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((byte) 21), test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((byte) 42), test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_getBoolean01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_getBoolean01 { + + private static final boolean[] array = {true, false, true}; + + public static boolean test(int i) { + return Array.getBoolean(array, i); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_getByte01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_getByte01 { + + private static final byte[] array = {11, 21, 42}; + + public static byte test(int i) { + return Array.getByte(array, i); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((byte) 11), test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((byte) 21), test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((byte) 42), test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_getChar01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_getChar01 { + + private static final char[] array = {11, 21, 42}; + + public static char test(int i) { + return Array.getChar(array, i); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((char) 11), test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((char) 21), test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((char) 42), test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_getDouble01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_getDouble01 { + + private static final double[] array = {11.1d, 21.1d, 42.1d}; + + public static double test(int i) { + return Array.getDouble(array, i); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11.1d, test(0), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(21.1d, test(1), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(42.1d, test(2), 0); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_getFloat01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_getFloat01 { + + private static final float[] array = {11.1f, 21.1f, 42.1f}; + + public static float test(int i) { + return Array.getFloat(array, i); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11.1f, test(0), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(21.1f, test(1), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(42.1f, test(2), 0); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_getInt01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_getInt01 { + + private static final int[] array = {11, 21, 42}; + + public static int test(int i) { + return Array.getInt(array, i); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(21, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(42, test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_getLength01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_getLength01 { + + private static final int[] array0 = {11, 21, 42}; + private static final boolean[] array1 = {true, true, false, false}; + private static final String[] array2 = {"String"}; + + public static int test(int i) { + Object array = null; + if (i == 0) { + array = array0; + } else if (i == 1) { + array = array1; + } else if (i == 2) { + array = array2; + } + return Array.getLength(array); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(3, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(4, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(1, test(2)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run3() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_getLong01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_getLong01 { + + private static final long[] array = {11, 21, 42}; + + public static long test(int i) { + return Array.getLong(array, i); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11L, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(21L, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(42L, test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_getShort01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_getShort01 { + + private static final short[] array = {11, 21, 42}; + + public static short test(int i) { + return Array.getShort(array, i); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((short) 11), test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((short) 21), test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((short) 42), test(2)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_newInstance01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_newInstance01 { + + public static boolean test(int i) { + return Array.newInstance(Array_newInstance01.class, i) != null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test(expected = java.lang.NegativeArraySizeException.class) + public void run3() throws Throwable { + test(-1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_newInstance02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_newInstance02 { + + public static boolean test(int i) { + Class< ? > javaClass; + if (i == 2) { + javaClass = void.class; + } else if (i == 3) { + javaClass = null; + } else { + javaClass = int.class; + } + return Array.newInstance(javaClass, 0) != null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test(expected = java.lang.IllegalArgumentException.class) + public void run1() throws Throwable { + test(2); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run2() throws Throwable { + test(3); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_newInstance03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_newInstance03 { + + public static boolean test(int i) { + Class< ? > javaClass; + if (i == 2) { + javaClass = int.class; + } else if (i == 3) { + javaClass = Object.class; + } else { + javaClass = Array_newInstance03.class; + } + return Array.newInstance(javaClass, 0).getClass().getComponentType() == javaClass; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_newInstance04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_newInstance04 { + + public static boolean test(int i, int j) { + final int[] dims = {i, j}; + return Array.newInstance(Array_newInstance04.class, dims) != null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(1, 0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(2, 2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(3, 2)); + } + + @Test(expected = java.lang.NegativeArraySizeException.class) + public void run3() throws Throwable { + test(0, -1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_newInstance05.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_newInstance05 { + + public static boolean test(int i, int j) { + final int[] dims = {i, j}; + Class< ? > javaClass; + if (i == 2) { + javaClass = void.class; + } else if (i == 3) { + javaClass = null; + } else { + javaClass = int.class; + } + return Array.newInstance(javaClass, dims) != null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(1, 3)); + } + + @Test(expected = java.lang.IllegalArgumentException.class) + public void run1() throws Throwable { + test(2, 3); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run2() throws Throwable { + test(3, 4); + } + + @Test(expected = java.lang.NegativeArraySizeException.class) + public void run3() throws Throwable { + test(1, -1); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_newInstance06.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_newInstance06 { + + public static boolean test(int i) { + final int[] dims = {i, 3}; + Class< ? > javaClass; + if (i == 2) { + javaClass = int.class; + } else if (i == 3) { + javaClass = Object.class; + } else { + javaClass = Array_newInstance06.class; + } + return Array.newInstance(javaClass, dims).getClass().getComponentType().getComponentType() == javaClass; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_set01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_set01 { + + private static final String[] array = {"x", "x", "x"}; + + public static String test(int i, String value) { + Array.set(array, i, value); + return array[i]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("1", test(0, "1")); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("2", test(1, "2")); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("XXd", test(0, "XXd")); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3, "--"); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_set02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_set02 { + + private static final int[] array = {-1, -1, -1}; + + public static int test(int i, int value) { + Array.set(array, i, value); + return array[i]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11, test(0, 11)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(21, test(1, 21)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(42, test(0, 42)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3, 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_set03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_set03 { + + private static final byte[] array = {-1, -1, -1}; + + public static byte test(int i, byte value) { + Array.set(array, i, value); + return array[i]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((byte) 11), test(0, ((byte) 11))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((byte) 21), test(1, ((byte) 21))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((byte) 42), test(0, ((byte) 42))); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3, ((byte) 0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_setBoolean01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_setBoolean01 { + + private static final boolean[] array = {false, false, false}; + + public static boolean test(int i, boolean value) { + Array.setBoolean(array, i, value); + return array[i]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0, true)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1, false)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2, true)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3, false); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_setByte01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_setByte01 { + + private static final byte[] array = {-1, -1, -1}; + + public static byte test(int i, byte value) { + Array.setByte(array, i, value); + return array[i]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((byte) 11), test(0, ((byte) 11))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((byte) 21), test(1, ((byte) 21))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((byte) 42), test(0, ((byte) 42))); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3, ((byte) 0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_setChar01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_setChar01 { + + private static final char[] array = {0, 0, 0}; + + public static char test(int i, char value) { + Array.setChar(array, i, value); + return array[i]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((char) 11), test(0, ((char) 11))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((char) 21), test(1, ((char) 21))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((char) 42), test(0, ((char) 42))); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3, ((char) 0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_setDouble01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_setDouble01 { + + private static final double[] array = {-1, -1, -1}; + + public static double test(int i, double value) { + Array.setDouble(array, i, value); + return array[i]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11.1d, test(0, 11.1d), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(21.1d, test(1, 21.1d), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(42.1d, test(0, 42.1d), 0); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3, 0.1d); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_setFloat01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_setFloat01 { + + private static final float[] array = {-1, -1, -1}; + + public static float test(int i, float value) { + Array.setFloat(array, i, value); + return array[i]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11.1f, test(0, 11.1f), 0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(21.1f, test(1, 21.1f), 0); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(42.1f, test(0, 42.1f), 0); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3, 0.1f); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_setInt01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_setInt01 { + + private static final int[] array = {-1, -1, -1}; + + public static int test(int i, int value) { + Array.setInt(array, i, value); + return array[i]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11, test(0, 11)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(21, test(1, 21)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(42, test(0, 42)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3, 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_setLong01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_setLong01 { + + private static final long[] array = {-1, -1, -1}; + + public static long test(int i, long value) { + Array.setLong(array, i, value); + return array[i]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(11L, test(0, 11L)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(21L, test(1, 21L)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(42L, test(0, 42L)); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3, 0L); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Array_setShort01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +public class Array_setShort01 { + + private static final short[] array = {-1, -1, -1}; + + public static short test(int i, short value) { + Array.setShort(array, i, value); + return array[i]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(((short) 11), test(0, ((short) 11))); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(((short) 21), test(1, ((short) 21))); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(((short) 42), test(0, ((short) 42))); + } + + @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class) + public void run3() throws Throwable { + test(3, ((short) 0)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Class_getDeclaredField01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +/* + */ +public class Class_getDeclaredField01 { + + static String field; + static int f2; + + public static String test(String input) throws NoSuchFieldException { + return Class_getDeclaredField01.class.getDeclaredField(input).getName(); + } + + public static void main(String[] args) { + field = args[0]; + } + + @Test(expected = java.lang.NoSuchFieldException.class) + public void run0() throws Throwable { + test("test"); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("field", test("field")); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("f2", test("f2")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Class_getDeclaredMethod01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +/* + */ +public class Class_getDeclaredMethod01 { + + static String field; + + public static String test(String input) throws NoSuchMethodException { + return Class_getDeclaredMethod01.class.getDeclaredMethod(input, String[].class).getName(); + } + + public static void main(String[] args) { + field = args[0]; + } + + @Test(expected = java.lang.NoSuchMethodException.class) + public void run0() throws Throwable { + test("test"); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("main", test("main")); + } + + @Test(expected = java.lang.NoSuchMethodException.class) + public void run2() throws Throwable { + test("xx"); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Class_getField01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +/* + */ +public class Class_getField01 { + + public static String field; + public String field2; + String field3; + + public static String test(String input) throws NoSuchFieldException { + return Class_getField01.class.getField(input).getName(); + } + + @Test(expected = java.lang.NoSuchFieldException.class) + public void run0() throws Throwable { + test("test"); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("field", test("field")); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("field2", test("field2")); + } + + @Test(expected = java.lang.NoSuchFieldException.class) + public void run3() throws Throwable { + test("field3"); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Class_getField02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +/* + */ +public class Class_getField02 { + + public static String field; + public String field2; + String field3; + + public static String test(String input) throws NoSuchFieldException { + return Class_getField02b.class.getField(input).getName(); + } + + static class Class_getField02b extends Class_getField02 { + + public String field4; + } + + @Test(expected = java.lang.NoSuchFieldException.class) + public void run0() throws Throwable { + test("test"); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("field", test("field")); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("field2", test("field2")); + } + + @Test(expected = java.lang.NoSuchFieldException.class) + public void run3() throws Throwable { + test("field3"); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals("field4", test("field4")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Class_getMethod01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +/* + */ +public class Class_getMethod01 { + + static String field; + + public static String test(String input) throws NoSuchMethodException { + return Class_getMethod01.class.getMethod(input, String[].class).getName(); + } + + public static void main(String[] args) { + field = args[0]; + } + + @Test(expected = java.lang.NoSuchMethodException.class) + public void run0() throws Throwable { + test("test"); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("main", test("main")); + } + + @Test(expected = java.lang.NoSuchMethodException.class) + public void run2() throws Throwable { + test("xx"); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Class_getMethod02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +/* + */ +public class Class_getMethod02 { + + static String field; + + public static String test(int arg) throws NoSuchMethodException { + if (arg == 0) { + return Class_getMethod02.class.getMethod("test").getName(); + } else if (arg == 1) { + return Class_getMethod02.class.getMethod("test", int.class).getName(); + } else if (arg == 2) { + return Class_getMethod02.class.getMethod("main").getName(); + } else if (arg == 3) { + return Class_getMethod02.class.getMethod("main", String[].class).getName(); + } else if (arg == 4) { + return Class_getMethod02.class.getMethod("<init>").getName(); + } else if (arg == 5) { + return Class_getMethod02.class.getMethod("<clinit>").getName(); + } + return null; + } + + public static void main(String[] args) { + field = args[0]; + } + + @Test(expected = java.lang.NoSuchMethodException.class) + public void run0() throws Throwable { + test(0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("test", test(1)); + } + + @Test(expected = java.lang.NoSuchMethodException.class) + public void run2() throws Throwable { + test(2); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals("main", test(3)); + } + + @Test(expected = java.lang.NoSuchMethodException.class) + public void run4() throws Throwable { + test(4); + } + + @Test(expected = java.lang.NoSuchMethodException.class) + public void run5() throws Throwable { + test(5); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(null, test(6)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Class_newInstance01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_newInstance01 { + + public static boolean test(int i) throws IllegalAccessException, InstantiationException { + if (i == 0) { + return Class_newInstance01.class.newInstance() != null; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Class_newInstance02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_newInstance02 { + + public static boolean test(int i) throws IllegalAccessException, InstantiationException { + if (i == 0) { + // note: we rely on the other class here. + return Class_newInstance07.Class_newInstance.class.newInstance() != null; + } + return false; + } + + @Test(expected = java.lang.IllegalAccessException.class) + public void run0() throws Throwable { + test(0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Class_newInstance03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +public class Class_newInstance03 { + + public abstract static class AbstractClass { + } + + public static boolean test(int i) throws IllegalAccessException, InstantiationException { + if (i == 0) { + return AbstractClass.class.newInstance() != null; + } else if (i == 1) { + return Cloneable.class.newInstance() != null; + } else if (i == 2) { + return int[].class.newInstance() != null; + } else if (i == 3) { + return int.class.newInstance() != null; + } + return false; + } + + @Test(expected = java.lang.InstantiationException.class) + public void run0() throws Throwable { + test(0); + } + + @Test(expected = java.lang.InstantiationException.class) + public void run1() throws Throwable { + test(1); + } + + @Test(expected = java.lang.InstantiationException.class) + public void run2() throws Throwable { + test(2); + } + + @Test(expected = java.lang.InstantiationException.class) + public void run3() throws Throwable { + test(3); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Class_newInstance06.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_newInstance06 { + + public static final class Class_newInstance { + + @SuppressWarnings("unused") + private Class_newInstance(int i) { + // do nothing. xx + } + } + + public static boolean test(int i) throws IllegalAccessException, InstantiationException { + if (i == 0) { + return Class_newInstance.class.newInstance() != null; + } + return false; + } + + @Test(expected = java.lang.InstantiationException.class) + public void run0() throws Throwable { + test(0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Class_newInstance07.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Class_newInstance07 { + + public static final class Class_newInstance { + + private Class_newInstance() throws Exception { + throw new Exception(); + } + } + + public static boolean test(int i) throws IllegalAccessException, InstantiationException { + if (i == 0) { + return Class_newInstance.class.newInstance() != null; + } + return false; + } + + @Test(expected = java.lang.Exception.class) + public void run0() throws Throwable { + test(0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Field_get01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +/* + */ +public class Field_get01 { + + public static final byte byteField = 11; + public static final short shortField = 12; + public static final char charField = 13; + public static final int intField = 14; + public static final long longField = 15; + public static final float floatField = 16; + public static final double doubleField = 17; + public static final boolean booleanField = true; + + public static boolean test(int arg) throws NoSuchFieldException, IllegalAccessException { + if (arg == 0) { + return Field_get01.class.getField("byteField").get(null).equals(byteField); + } else if (arg == 1) { + return Field_get01.class.getField("shortField").get(null).equals(shortField); + } else if (arg == 2) { + return Field_get01.class.getField("charField").get(null).equals(charField); + } else if (arg == 3) { + return Field_get01.class.getField("intField").get(null).equals(intField); + } else if (arg == 4) { + return Field_get01.class.getField("longField").get(null).equals(longField); + } else if (arg == 5) { + return Field_get01.class.getField("floatField").get(null).equals(floatField); + } else if (arg == 6) { + return Field_get01.class.getField("doubleField").get(null).equals(doubleField); + } else if (arg == 7) { + return Field_get01.class.getField("booleanField").get(null).equals(booleanField); + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Field_get02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +/* + */ +public class Field_get02 { + + private static final Field_get02 object = new Field_get02(); + + public final byte byteField = 11; + public final short shortField = 12; + public final char charField = 13; + public final int intField = 14; + public final long longField = 15; + public final float floatField = 16; + public final double doubleField = 17; + public final boolean booleanField = true; + + public static boolean test(int arg) throws NoSuchFieldException, IllegalAccessException { + if (arg == 0) { + return Field_get02.class.getField("byteField").get(object).equals(object.byteField); + } else if (arg == 1) { + return Field_get02.class.getField("shortField").get(object).equals(object.shortField); + } else if (arg == 2) { + return Field_get02.class.getField("charField").get(object).equals(object.charField); + } else if (arg == 3) { + return Field_get02.class.getField("intField").get(object).equals(object.intField); + } else if (arg == 4) { + return Field_get02.class.getField("longField").get(object).equals(object.longField); + } else if (arg == 5) { + return Field_get02.class.getField("floatField").get(object).equals(object.floatField); + } else if (arg == 6) { + return Field_get02.class.getField("doubleField").get(object).equals(object.doubleField); + } else if (arg == 7) { + return Field_get02.class.getField("booleanField").get(object).equals(object.booleanField); + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Field_get03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +/* + */ +public class Field_get03 { + + private static Field ByteField; + private static Field ShortField; + private static Field CharField; + private static Field IntField; + private static Field LongField; + private static Field FloatField; + private static Field DoubleField; + private static Field BooleanField; + + static { + try { + ByteField = Field_get03.class.getField("byteField"); + ShortField = Field_get03.class.getField("shortField"); + CharField = Field_get03.class.getField("charField"); + IntField = Field_get03.class.getField("intField"); + LongField = Field_get03.class.getField("longField"); + FloatField = Field_get03.class.getField("floatField"); + DoubleField = Field_get03.class.getField("doubleField"); + BooleanField = Field_get03.class.getField("booleanField"); + } catch (SecurityException e) { + e.printStackTrace(); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + } + } + + private static final Field_get03 object = new Field_get03(); + + public final byte byteField = 11; + public final short shortField = 12; + public final char charField = 13; + public final int intField = 14; + public final long longField = 15; + public final float floatField = 16; + public final double doubleField = 17; + public final boolean booleanField = true; + + public static boolean test(int arg) throws IllegalAccessException { + if (arg == 0) { + return ByteField.get(object).equals(object.byteField); + } else if (arg == 1) { + return ShortField.get(object).equals(object.shortField); + } else if (arg == 2) { + return CharField.get(object).equals(object.charField); + } else if (arg == 3) { + return IntField.get(object).equals(object.intField); + } else if (arg == 4) { + return LongField.get(object).equals(object.longField); + } else if (arg == 5) { + return FloatField.get(object).equals(object.floatField); + } else if (arg == 6) { + return DoubleField.get(object).equals(object.doubleField); + } else if (arg == 7) { + return BooleanField.get(object).equals(object.booleanField); + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Field_get04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +/* + */ +public class Field_get04 { + + private static final Field_get04 object = new Field_get04(); + + public final byte byteField = 11; + public final short shortField = 12; + public final char charField = 13; + public final int intField = 14; + public final long longField = 15; + public final float floatField = 16; + public final double doubleField = 17; + public final boolean booleanField = true; + + public static boolean test(int arg) throws NoSuchFieldException, IllegalAccessException { + if (arg == 0) { + return Field_get04.class.getField("byteField").getByte(object) == object.byteField; + } else if (arg == 1) { + return Field_get04.class.getField("shortField").getShort(object) == object.shortField; + } else if (arg == 2) { + return Field_get04.class.getField("charField").getChar(object) == object.charField; + } else if (arg == 3) { + return Field_get04.class.getField("intField").getInt(object) == object.intField; + } else if (arg == 4) { + return Field_get04.class.getField("longField").getLong(object) == object.longField; + } else if (arg == 5) { + return Field_get04.class.getField("floatField").getFloat(object) == object.floatField; + } else if (arg == 6) { + return Field_get04.class.getField("doubleField").getDouble(object) == object.doubleField; + } else if (arg == 7) { + return Field_get04.class.getField("booleanField").getBoolean(object) == object.booleanField; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Field_getType01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +/* + */ +public class Field_getType01 { + + public static final byte byteField = 11; + public static final short shortField = 12; + public static final char charField = 13; + public static final int intField = 14; + public static final long longField = 15; + public static final float floatField = 16; + public static final double doubleField = 17; + public static final boolean booleanField = true; + + public static boolean test(int arg) throws NoSuchFieldException { + if (arg == 0) { + return Field_getType01.class.getField("byteField").getType() == byte.class; + } else if (arg == 1) { + return Field_getType01.class.getField("shortField").getType() == short.class; + } else if (arg == 2) { + return Field_getType01.class.getField("charField").getType() == char.class; + } else if (arg == 3) { + return Field_getType01.class.getField("intField").getType() == int.class; + } else if (arg == 4) { + return Field_getType01.class.getField("longField").getType() == long.class; + } else if (arg == 5) { + return Field_getType01.class.getField("floatField").getType() == float.class; + } else if (arg == 6) { + return Field_getType01.class.getField("doubleField").getType() == double.class; + } else if (arg == 7) { + return Field_getType01.class.getField("booleanField").getType() == boolean.class; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Field_set01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +/* + */ +public class Field_set01 { + + public static byte byteField; + public static short shortField; + public static char charField; + public static int intField; + public static long longField; + public static float floatField; + public static double doubleField; + public static boolean booleanField; + + public static boolean test(int arg) throws NoSuchFieldException, IllegalAccessException { + if (arg == 0) { + Field_set01.class.getField("byteField").set(null, Byte.valueOf((byte) 11)); + return byteField == 11; + } else if (arg == 1) { + Field_set01.class.getField("shortField").set(null, Short.valueOf((short) 12)); + return shortField == 12; + } else if (arg == 2) { + Field_set01.class.getField("charField").set(null, Character.valueOf((char) 13)); + return charField == 13; + } else if (arg == 3) { + Field_set01.class.getField("intField").set(null, Integer.valueOf(14)); + return intField == 14; + } else if (arg == 4) { + Field_set01.class.getField("longField").set(null, Long.valueOf(15L)); + return longField == 15; + } else if (arg == 5) { + Field_set01.class.getField("floatField").set(null, Float.valueOf(16)); + return floatField == 16; + } else if (arg == 6) { + Field_set01.class.getField("doubleField").set(null, Double.valueOf(17)); + return doubleField == 17; + } else if (arg == 7) { + Field_set01.class.getField("booleanField").set(null, true); + return booleanField == true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Field_set02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +/* + */ +public class Field_set02 { + + private static final Field_set02 object = new Field_set02(); + + public byte byteField; + public short shortField; + public char charField; + public int intField; + public long longField; + public float floatField; + public double doubleField; + public boolean booleanField; + + public static boolean test(int arg) throws NoSuchFieldException, IllegalAccessException { + if (arg == 0) { + Field_set02.class.getField("byteField").set(object, Byte.valueOf((byte) 11)); + return object.byteField == 11; + } else if (arg == 1) { + Field_set02.class.getField("shortField").set(object, Short.valueOf((short) 12)); + return object.shortField == 12; + } else if (arg == 2) { + Field_set02.class.getField("charField").set(object, Character.valueOf((char) 13)); + return object.charField == 13; + } else if (arg == 3) { + Field_set02.class.getField("intField").set(object, Integer.valueOf(14)); + return object.intField == 14; + } else if (arg == 4) { + Field_set02.class.getField("longField").set(object, Long.valueOf(15L)); + return object.longField == 15; + } else if (arg == 5) { + Field_set02.class.getField("floatField").set(object, Float.valueOf(16)); + return object.floatField == 16; + } else if (arg == 6) { + Field_set02.class.getField("doubleField").set(object, Double.valueOf(17)); + return object.doubleField == 17; + } else if (arg == 7) { + Field_set02.class.getField("booleanField").set(object, true); + return object.booleanField == true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Field_set03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +/* + */ +public class Field_set03 { + + private static final Field_set03 object = new Field_set03(); + + public byte byteField; + public short shortField; + public char charField; + public int intField; + public long longField; + public float floatField; + public double doubleField; + public boolean booleanField; + + public static boolean test(int arg) throws NoSuchFieldException, IllegalAccessException { + if (arg == 0) { + Field_set03.class.getField("byteField").setByte(object, (byte) 11); + return object.byteField == 11; + } else if (arg == 1) { + Field_set03.class.getField("shortField").setShort(object, (short) 12); + return object.shortField == 12; + } else if (arg == 2) { + Field_set03.class.getField("charField").setChar(object, (char) 13); + return object.charField == 13; + } else if (arg == 3) { + Field_set03.class.getField("intField").setInt(object, 14); + return object.intField == 14; + } else if (arg == 4) { + Field_set03.class.getField("longField").setLong(object, 15L); + return object.longField == 15; + } else if (arg == 5) { + Field_set03.class.getField("floatField").setFloat(object, 16); + return object.floatField == 16; + } else if (arg == 6) { + Field_set03.class.getField("doubleField").setDouble(object, 17); + return object.doubleField == 17; + } else if (arg == 7) { + Field_set03.class.getField("booleanField").setBoolean(object, true); + return object.booleanField == true; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run6() throws Throwable { + Assert.assertEquals(true, test(6)); + } + + @Test + public void run7() throws Throwable { + Assert.assertEquals(true, test(7)); + } + + @Test + public void run8() throws Throwable { + Assert.assertEquals(false, test(8)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Invoke_except01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +/* + */ +public class Invoke_except01 { + + public static int test(int arg) throws IllegalAccessException, InvocationTargetException { + Object[] args; + if (arg == 0) { + args = new Object[]{new int[0]}; + } else if (arg == 1) { + args = new Object[]{new int[3]}; + } else if (arg == 2) { + args = new Object[]{null}; + } else if (arg == 3) { + args = new Object[]{new char[3]}; + } else { + args = null; + } + for (Method m : Invoke_except01.class.getDeclaredMethods()) { + if ("method".equals(m.getName())) { + return (Integer) m.invoke(null, args); + } + } + return 42; + } + + public static int method(int[] arg) { + return arg.length; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(3, test(1)); + } + + @Test(expected = java.lang.reflect.InvocationTargetException.class) + public void run2() throws Throwable { + test(2); + } + + @Test(expected = java.lang.IllegalArgumentException.class) + public void run3() throws Throwable { + test(3); + } + + @Test(expected = java.lang.IllegalArgumentException.class) + public void run4() throws Throwable { + test(4); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Invoke_main01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +/* + */ +public class Invoke_main01 { + + static String field; + + public static String test(String input) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { + field = null; + final String[] args = {input}; + Invoke_main01.class.getMethod("main", String[].class).invoke(null, new Object[]{args}); + return field; + } + + public static void main(String[] args) { + field = args[0]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("test1", test("test1")); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("test2", test("test2")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Invoke_main02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +/* + */ +public class Invoke_main02 { + + static String field; + + public static String test(String input) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { + field = null; + final String[] args = {input}; + Invoke_main02.class.getDeclaredMethod("main", String[].class).invoke(null, new Object[]{args}); + return field; + } + + public static void main(String[] args) { + field = args[0]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("test1", test("test1")); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("test2", test("test2")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Invoke_main03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +/* + */ +public class Invoke_main03 { + + static String field; + + public static String test(String input) throws IllegalAccessException, InvocationTargetException { + field = null; + final String[] args = {input}; + for (Method m : Invoke_main03.class.getDeclaredMethods()) { + if ("main".equals(m.getName())) { + m.invoke(null, new Object[]{args}); + } + } + return field; + } + + public static void main(String[] args) { + field = args[0]; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("test1", test("test1")); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("test2", test("test2")); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Invoke_virtual01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import java.lang.reflect.*; + +import org.junit.*; + +/* + */ +public class Invoke_virtual01 { + + static final HelperTest helper = new HelperTest(55); + + public static int test(int input) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { + if (input == 1) { + final Method m = HelperTest.class.getDeclaredMethod("getInt"); + Object o = m.invoke(helper); + return ((Integer) o).intValue(); + } + return 0; + } + + public static class HelperTest { + + private int intField; + + public int getInt() { + return intField; + } + + public HelperTest(int i) { + intField = i; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(55, test(1)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Method_getParameterTypes01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +/* + */ +@SuppressWarnings("unused") +public class Method_getParameterTypes01 { + + public static int test(int arg) throws NoSuchMethodException { + if (arg == 0) { + return Method_getParameterTypes01.class.getMethod("method1").getParameterTypes().length; + } else if (arg == 1) { + return Method_getParameterTypes01.class.getMethod("method2", int.class).getParameterTypes().length; + } else if (arg == 2) { + return Method_getParameterTypes01.class.getMethod("method3", int.class, Object.class).getParameterTypes().length; + } + return -1; + } + + public int method1() { + return 0; + } + + public void method2(int arg1) { + } + + public void method3(int arg1, Object arg2) { + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(1, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(2, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(-1, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Method_getReturnType01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +/* + */ +public class Method_getReturnType01 { + + public static String test(int arg) throws NoSuchMethodException { + if (arg == 0) { + return Method_getReturnType01.class.getMethod("method1").getReturnType().getName(); + } else if (arg == 1) { + return Method_getReturnType01.class.getMethod("method2").getReturnType().getName(); + } else if (arg == 2) { + return Method_getReturnType01.class.getMethod("method3").getReturnType().getName(); + } + return null; + } + + public int method1() { + return 0; + } + + public String method2() { + return null; + } + + public void method3() { + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("int", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("java.lang.String", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("void", test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(null, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/reflect/Reflection_getCallerClass01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.reflect; + +import org.junit.*; + +import sun.reflect.*; + +/* + */ +@SuppressWarnings("static-method") +public final class Reflection_getCallerClass01 { + + public static final class Caller1 { + + private Caller1() { + } + + static String caller1(int depth) { + return Reflection.getCallerClass(depth).getName(); + } + } + + public static final class Caller2 { + + private Caller2() { + } + + static String caller2(int depth) { + return Caller1.caller1(depth); + } + } + + public static String test(int depth) { + return Caller2.caller2(depth); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals("sun.reflect.Reflection", test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals("com.oracle.max.graal.jtt.reflect.Reflection_getCallerClass01$Caller1", test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals("com.oracle.max.graal.jtt.reflect.Reflection_getCallerClass01$Caller2", test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Monitor_contended01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Monitor_contended01 implements Runnable { + + static final Object cond = new Object(); + static final Object obj = new Object(); + + boolean started = false; + boolean acquired = false; + + public static boolean test() throws InterruptedException { + // test contention for monitor + final Monitor_contended01 object = new Monitor_contended01(); + synchronized (obj) { + new Thread(object).start(); + // wait for other thread to startup and contend + synchronized (cond) { + cond.wait(1000); + if (!object.started) { + return false; + } + } + } + // wait for other thread to acquire monitor and then exit + synchronized (cond) { + cond.wait(1000); + } + return object.acquired; + } + + public void run() { + // signal that we have started up so first thread will release lock + synchronized (cond) { + started = true; + cond.notifyAll(); + } + synchronized (obj) { + + } + // signal that we have successfully acquired and released the monitor + synchronized (cond) { + acquired = true; + cond.notifyAll(); + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Monitor_notowner01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +public class Monitor_notowner01 { + + static Object monitor = new Object(); + static Object finished = new Object(); + + public static boolean test() throws InterruptedException { + final BadRunnable badRunnable = new BadRunnable(); + synchronized (monitor) { + new Thread(badRunnable).start(); + synchronized (finished) { + finished.wait(1000); + } + } + return badRunnable.caught; + } + + static class BadRunnable implements Runnable { + + protected boolean caught = false; + + public void run() { + try { + // we don't own this! + monitor.wait(); + } catch (InterruptedException ex) { + + } catch (IllegalMonitorStateException ex) { + caught = true; + synchronized (finished) { + finished.notifyAll(); + } + } + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Monitorenter01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Monitorenter01 { + + static final Object object = new Object(); + + public static boolean test() { + // test nested locking. + synchronized (object) { + synchronized (object) { + return true; + } + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Monitorenter02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Monitorenter02 { + + static final Object object = new Object(); + + public static boolean test() { + // test nested locking. + synchronized (object) { + return test2(); + } + } + + private static boolean test2() { + synchronized (object) { + return true; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Object_wait01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +public class Object_wait01 implements Runnable { + + static volatile int count = 0; + static volatile boolean done; + static final Object object = new Object(); + + public static boolean test(int i) throws InterruptedException { + count = 0; + done = false; + new Thread(new Object_wait01()).start(); + synchronized (object) { + while (count < i) { + object.wait(); + } + done = true; + return count >= i; + } + + } + + public void run() { + int i = 0; + while (i++ < 1000000 && !done) { + synchronized (object) { + count++; + object.notifyAll(); + } + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(15)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Object_wait02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +public class Object_wait02 implements Runnable { + + static volatile boolean done; + static final Object object = new Object(); + static int sleep; + + public static boolean test(int i) throws InterruptedException { + done = false; + sleep = i * 200; + new Thread(new Object_wait02()).start(); + synchronized (object) { + while (!done) { + object.wait(200); + } + } + return done; + } + + public void run() { + try { + Thread.sleep(sleep); + } catch (InterruptedException ex) { + + } + synchronized (object) { + done = true; + object.notifyAll(); + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Object_wait03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +public class Object_wait03 implements Runnable { + + static volatile boolean done; + static final Object object = new Object(); + static int sleep; + + public static boolean test(int i) throws InterruptedException { + done = false; + sleep = i * 200; + synchronized (object) { + new Thread(new Object_wait03()).start(); + dowait(); + } + return done; + } + + private static void dowait() throws InterruptedException { + synchronized (object) { + while (!done) { + object.wait(200); + } + } + } + + public void run() { + try { + Thread.sleep(sleep); + } catch (InterruptedException ex) { + + } + synchronized (object) { + done = true; + object.notifyAll(); + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Object_wait04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +public class Object_wait04 implements Runnable { + + static volatile boolean done; + static final Object object = new Object(); + static int sleep; + + public static boolean test(int i) throws InterruptedException { + done = false; + sleep = i * 50; + synchronized (object) { + new Thread(new Object_wait04()).start(); + dowait(i); + } + return done; + } + + private static void dowait(int i) throws InterruptedException { + if (i == 0) { + while (!done) { + object.wait(100); + } + } else { + synchronized (object) { + dowait(i - 1); + } + } + } + + public void run() { + try { + Thread.sleep(sleep); + } catch (InterruptedException ex) { + + } + synchronized (object) { + done = true; + object.notifyAll(); + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(true, test(4)); + } + + @Test + public void run5() throws Throwable { + Assert.assertEquals(true, test(5)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/ThreadLocal01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +/* + */ +public class ThreadLocal01 { + + private static final ThreadLocal<Integer> local = new ThreadLocal<>(); + + public static int test(int i) { + local.set(i + 5); + return local.get(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(5, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(6, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(7, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/ThreadLocal02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +/* + */ +public class ThreadLocal02 { + + public static int test(int i) { + ThreadLocal<Integer> local = new ThreadLocal<>(); + local.set(i + 5); + return local.get(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(5, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(6, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(7, test(2)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/ThreadLocal03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +/* + */ +public class ThreadLocal03 { + + static final ThreadLocal<Integer> local = new ThreadLocal<>(); + + public static int test(int i) { + int sum = 0; + for (int j = 0; j < i; j++) { + TThread t = new TThread(); + t.input = 10 + j; + t.run(); + try { + t.join(); + } catch (InterruptedException e) { + return -1; + } + sum += t.output; + } + return sum; + } + + private static class TThread extends Thread { + + int input; + int output; + + @Override + public void run() { + local.set(input + 5); + output = local.get(); + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(0, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(15, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(31, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(48, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_currentThread01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Thread_currentThread01 { + + public static boolean test() { + return Thread.currentThread() != null; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_getState01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Thread_getState01 { + + public static boolean test() { + return Thread.currentThread().getState() == Thread.State.RUNNABLE; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_getState02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Thread_getState02 { + + public static boolean test() { + return new Thread().getState() == Thread.State.NEW; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_holdsLock01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Thread_holdsLock01 { + + static final Object monitor = new Object(); + + public static boolean test(int i) { + if (i == 0) { + synchronized (monitor) { + return Thread.holdsLock(monitor); + } + } else if (i == 1) { + synchronized (monitor) { + // do nothing. + } + return Thread.holdsLock(monitor); + } else if (i == 2) { + return Thread.holdsLock(null); + } + return Thread.holdsLock(monitor); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(false, test(1)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void run2() throws Throwable { + test(2); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(false, test(3)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_isAlive01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Thread_isAlive01 { + + public static boolean test() { + return Thread.currentThread().isAlive(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_isInterrupted01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Thread_isInterrupted01 { + + public static boolean test() { + return Thread.currentThread().isInterrupted(); + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_isInterrupted02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + */ + +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +//Test all, mainly monitors +public class Thread_isInterrupted02 { + + private static final Object start = new Object(); + private static final Object end = new Object(); + private static int waitTime; + + @SuppressWarnings("unused") + public static boolean test(int i, int time) throws InterruptedException { + waitTime = time; + final Thread thread = new Thread(); + synchronized (thread) { + // start the thread and wait for it + thread.setDaemon(true); // in case the thread gets stuck + thread.start(); + thread.wait(); + } + synchronized (start) { + thread.interrupt(); + } + synchronized (end) { + end.wait(200); + } + return thread.interrupted; + } + + private static class Thread extends java.lang.Thread { + + private boolean interrupted; + + @Override + public void run() { + try { + synchronized (start) { + synchronized (this) { + // signal test thread that we are running + notify(); + } + // wait for the condition, which should be interrupted + if (waitTime == 0) { + start.wait(); + } else { + start.wait(waitTime); + } + } + } catch (InterruptedException e) { + // interrupted successfully. + interrupted = true; + synchronized (end) { + // notify the other thread we are done + end.notify(); + } + } + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0, 0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1, 500)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_isInterrupted03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +/* + */ + +// Interrupted while sleeping, throws an interrupted exception +public class Thread_isInterrupted03 { + + public static boolean test() throws InterruptedException { + final Thread1 thread = new Thread1(); + thread.start(); + Thread.sleep(1000); + thread.interrupt(); + Thread.sleep(1000); + // Did thread get interrupted? + final boolean result = thread.getInterrupted(); + // This stops the thread even if the interrupt didn't! + thread.setInterrupted(true); + return result; + } + + private static class Thread1 extends java.lang.Thread { + + private boolean interrupted = false; + + @Override + public void run() { + while (!interrupted) { + try { + sleep(10000); + } catch (InterruptedException e) { + interrupted = true; + } + } + } + + public void setInterrupted(boolean val) { + interrupted = val; + } + + public boolean getInterrupted() { + return interrupted; + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_isInterrupted04.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +/* + */ + +// Interrupted while running, do nothing, just set the flag and continue +// (tw) This test will exercise deoptimization on HotSpot, because a volatile unloaded field is accessed. +// (tw) The temporary result variable is needed, because in order to query the isInterrupted flag, the thread must be alive. +public class Thread_isInterrupted04 { + + public static boolean test() throws InterruptedException { + final Thread1 thread = new Thread1(); + thread.start(); + while (!thread.running) { + Thread.sleep(10); + } + Thread.sleep(100); + thread.interrupt(); + boolean result = thread.isInterrupted(); + thread.setStop(true); + return result; + } + + public static class Thread1 extends java.lang.Thread { + + private volatile boolean stop = false; + public volatile boolean running = false; + public long i = 0; + + @Override + public void run() { + running = true; + while (!stop) { + i++; + } + } + + public void setStop(boolean value) { + stop = value; + } + + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_isInterrupted05.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +/* + */ + +// Interrupted during wait, with interrupter joining +public class Thread_isInterrupted05 { + + public static boolean test() throws InterruptedException { + final WaitInterruptee waitInterruptee = new WaitInterruptee(); + waitInterruptee.start(); + waitInterruptee.interrupt(); + waitInterruptee.join(); + + if (waitInterruptee.throwable != null) { + throw new RuntimeException(waitInterruptee.throwable); + } + return true; + } + + static class WaitInterruptee extends Thread { + + Throwable throwable; + + public WaitInterruptee() { + super("WaitInterruptee"); + } + + @Override + public void run() { + try { + synchronized (this) { + try { + wait(); + } catch (InterruptedException ex) { + } + } + } catch (Throwable t) { + throwable = t; + } + } + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_join01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +public class Thread_join01 implements Runnable { + + static volatile boolean cont; + + public static boolean test() throws InterruptedException { + cont = true; + final Thread thread = new Thread(new Thread_join01()); + thread.start(); + thread.join(); + return cont; + } + + public void run() { + cont = false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_join02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * + * This test sleeps the thread that is joined to, which should ensure that the joining thread + * actually does wait for completeion. + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +public class Thread_join02 implements Runnable { + + static volatile boolean cont; + + public static boolean test() throws InterruptedException { + cont = true; + final Thread thread = new Thread(new Thread_join02()); + thread.start(); + thread.join(); + return cont; + } + + public void run() { + try { + Thread.sleep(200); + } catch (InterruptedException ex) { + } + cont = false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_join03.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * + * This test sleeps the joining thread, which should enure that the joinee is + * terminated by the time the join occurs. + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +public class Thread_join03 implements Runnable { + + static volatile boolean cont; + + public static boolean test() throws InterruptedException { + cont = true; + final Thread thread = new Thread(new Thread_join03()); + thread.start(); + Thread.sleep(200); + thread.join(); + return cont; + } + + public void run() { + cont = false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(false, test()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_new01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Thread_new01 { + + public static boolean test(int i) { + if (i == 0) { + return new Thread() != null; + } + if (i == 1) { + return new Thread("Thread_new01") != null; + } + if (i == 2) { + return new Thread(new Thread()) != null; + } + if (i == 3) { + return new Thread(new Thread(), "Thread_new01") != null; + } + return false; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_new02.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +public class Thread_new02 implements Runnable { + + static final Thread_new02 thisObject = new Thread_new02(); + + public static boolean test(int i) { + if (i == 0) { + return new Thread() != null; + } + if (i == 1) { + return new Thread("Thread_new01") != null; + } + if (i == 2) { + return new Thread(thisObject) != null; + } + if (i == 3) { + return new Thread(thisObject, "Thread_new01") != null; + } + return false; + } + + public void run() { + // do nothing. + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(0)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(2)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(3)); + } + + @Test + public void run4() throws Throwable { + Assert.assertEquals(false, test(4)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_setPriority01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Thread_setPriority01 { + + public static boolean test(int i) { + final Thread currentThread = Thread.currentThread(); + final int prev = currentThread.getPriority(); + currentThread.setPriority(i); + currentThread.setPriority(prev); + return true; + } + + @Test(expected = java.lang.IllegalArgumentException.class) + public void run0() throws Throwable { + test(0); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(1)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(5)); + } + + @Test + public void run3() throws Throwable { + Assert.assertEquals(true, test(10)); + } + + @Test(expected = java.lang.IllegalArgumentException.class) + public void run4() throws Throwable { + test(11); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_sleep01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Thread_sleep01 { + + public static boolean test(int i) throws InterruptedException { + final long before = System.currentTimeMillis(); + Thread.sleep(i); + return System.currentTimeMillis() - before >= i; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test(10)); + } + + @Test + public void run1() throws Throwable { + Assert.assertEquals(true, test(20)); + } + + @Test + public void run2() throws Throwable { + Assert.assertEquals(true, test(100)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.jtt/src/com/oracle/max/graal/jtt/threads/Thread_yield01.java Thu Feb 16 14:53:04 2012 +0100 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + */ +package com.oracle.max.graal.jtt.threads; + +import org.junit.*; + +@SuppressWarnings("static-method") +public final class Thread_yield01 { + + public static boolean test() { + Thread.yield(); + return true; + } + + @Test + public void run0() throws Throwable { + Assert.assertEquals(true, test()); + } + +}
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/FloatDivNode.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/FloatDivNode.java Thu Feb 16 14:53:04 2012 +0100 @@ -38,10 +38,14 @@ public ValueNode canonical(CanonicalizerTool tool) { if (x().isConstant() && y().isConstant()) { if (kind() == CiKind.Float) { - return ConstantNode.forFloat(x().asConstant().asFloat() / y().asConstant().asFloat(), graph()); + if (y().asConstant().asFloat() != 0) { + return ConstantNode.forFloat(x().asConstant().asFloat() / y().asConstant().asFloat(), graph()); + } } else { assert kind() == CiKind.Double; - return ConstantNode.forDouble(x().asConstant().asDouble() / y().asConstant().asDouble(), graph()); + if (y().asConstant().asDouble() != 0) { + return ConstantNode.forDouble(x().asConstant().asDouble() / y().asConstant().asDouble(), graph()); + } } } return this;
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/MethodCallTargetNode.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/MethodCallTargetNode.java Thu Feb 16 14:53:04 2012 +0100 @@ -133,13 +133,12 @@ if (!isStatic()) { ValueNode receiver = receiver(); if (receiver != null && receiver.exactType() != null) { - if (invokeKind == InvokeKind.Interface) { - invokeKind = InvokeKind.Virtual; - targetMethod = receiver.exactType().resolveMethodImpl(targetMethod); - } - if (receiver.isConstant() && invokeKind == InvokeKind.Virtual) { - invokeKind = InvokeKind.Special; - targetMethod = receiver.exactType().resolveMethodImpl(targetMethod); + if (invokeKind == InvokeKind.Interface || invokeKind == InvokeKind.Virtual) { + RiResolvedMethod method = receiver.exactType().resolveMethodImpl(targetMethod); + if (method != null) { + invokeKind = InvokeKind.Special; + targetMethod = method; + } } } }
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/type/StampFactory.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/type/StampFactory.java Thu Feb 16 14:53:04 2012 +0100 @@ -176,7 +176,9 @@ assert current.kind() == first.kind() : values + " first=" + first + " current=" + current + " first kind=" + first.kind() + " current kind=" + current.kind(); nonNull &= current.nonNull(); declaredType = orTypes(declaredType, current.declaredType()); - exactType = orTypes(exactType, current.exactType()); + if (exactType != current.exactType()) { + exactType = null; + } } if (nonNull != first.nonNull() || declaredType != first.declaredType() || exactType != first.exactType()) {
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/Snippets.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/Snippets.java Thu Feb 16 14:53:04 2012 +0100 @@ -27,6 +27,7 @@ import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ri.*; +import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.phases.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.cri.*; @@ -111,7 +112,9 @@ targetGraph = buildSnippetGraph(targetMethod, runtime, target, pool, plan); } InliningUtil.inline(invoke, targetGraph, true); - new CanonicalizerPhase(target, runtime, null).apply(graph); + if (GraalOptions.OptCanonicalizer) { + new CanonicalizerPhase(target, runtime, null).apply(graph); + } } } @@ -119,7 +122,9 @@ Debug.dump(graph, "%s: %s", snippetRiMethod.name(), GraphBuilderPhase.class.getSimpleName()); new DeadCodeEliminationPhase().apply(graph); - new CanonicalizerPhase(target, runtime, null).apply(graph); + if (GraalOptions.OptCanonicalizer) { + new CanonicalizerPhase(target, runtime, null).apply(graph); + } // TODO (gd) remove when we have safepoint polling elimination for (LoopEndNode end : graph.getNodes(LoopEndNode.class)) {
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/MonitorTest.java Thu Feb 16 14:43:05 2012 +0100 +++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/MonitorTest.java Thu Feb 16 14:53:04 2012 +0100 @@ -26,9 +26,10 @@ import java.util.*; -import junit.framework.AssertionFailedError; +import junit.framework.*; -import org.junit.*; +import org.junit.Assert; +import org.junit.Test; import com.oracle.max.graal.compiler.phases.*; import com.oracle.max.graal.graph.*;
--- a/mx/commands.py Thu Feb 16 14:43:05 2012 +0100 +++ b/mx/commands.py Thu Feb 16 14:53:04 2012 +0100 @@ -269,7 +269,7 @@ if len(failed) != 0: mx.abort('Scala DaCapo failures: ' + str(failed)) - + def _jdk(build='product', create=False): """ Get the JDK into which Graal is installed, creating it first if necessary. @@ -289,9 +289,35 @@ if not exists(src): mx.abort('Host JDK directory is missing: ' + src) shutil.copytree(src, dst) + + # Make a copy of the default VM so that this JDK can be + # reliably used as the bootstrap for a HotSpot build. + jvmCfg = join(jdk, 'jre', 'lib', 'amd64', 'jvm.cfg') + if not exists(jvmCfg): + mx.abort(jvmCfg + ' does not exist') + + lines = [] + defaultVM = None + with open(jvmCfg) as f: + for line in f: + if line.startswith('-') and defaultVM is None: + parts = line.split() + assert len(parts) == 2, parts + assert parts[1] == 'KNOWN', parts[1] + defaultVM = parts[0][1:] + lines.append('-' + defaultVM + '0 KNOWN\n') + lines.append(line) + + assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg + shutil.copytree(join(jdk, 'jre', 'lib', 'amd64', defaultVM), join(jdk, 'jre', 'lib', 'amd64', defaultVM + '0')) + + with open(jvmCfg, 'w') as f: + for line in lines: + f.write(line) + else: if not exists(jdk): - mx.abort('The ' + build + ' VM has not been created - run \'mx clean; mx make ' + build + '\'') + mx.abort('The ' + build + ' VM has not been created - run \'mx clean; mx build ' + build + '\'') return jdk # run a command in the windows SDK Debug Shell @@ -452,6 +478,9 @@ _unittests = { 'com.oracle.max.graal.tests': ['com.oracle.max.graal.compiler.tests'], } +_jtttests = { + 'com.oracle.max.graal.jtt': ['com.oracle.max.graal.jtt'], +} def _add_test_classes(testClassList, searchDir, pkgRoot): pkgDecl = re.compile(r"^package\s+([a-zA-Z_][\w\.]*)\s*;$") @@ -472,7 +501,8 @@ break if hasTest: assert pkg is not None - testClassList.append(pkg + '.' + name[:-len('.java')]) + if pkg.startswith(pkgRoot): + testClassList.append(pkg + '.' + name[:-len('.java')]) def unittest(args): """run the Graal Compiler Unit Tests in the GraalVM @@ -501,9 +531,62 @@ if len(neg) != 0: classes = [c for c in classes if not containsAny(c, neg)] - # (ds) The boot class path must be used for some reason I don't quite understand - vm(['-XX:-BootstrapGraal', '-esa', '-Xbootclasspath/a:' + mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes) + vm(['-XX:-BootstrapGraal', '-esa', '-cp', mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes) + +def jtt(args): + """run the Java Tester Tests in the GraalVM + + If filters are supplied, only tests whose fully qualified name + include a filter as a substring are run. Negative filters are + those with a '-' prefix.""" + + pos = [a for a in args if a[0] != '-'] + neg = [a[1:] for a in args if a[0] == '-'] + + def containsAny(c, substrings): + for s in substrings: + if s in c: + return True + return False + + for proj in _jtttests.iterkeys(): + p = mx.project(proj) + classes = [] + for pkg in _jtttests[proj]: + _add_test_classes(classes, join(p.dir, 'src'), pkg) + if len(pos) != 0: + classes = [c for c in classes if containsAny(c, pos)] + if len(neg) != 0: + classes = [c for c in classes if not containsAny(c, neg)] + + vm(['-XX:-BootstrapGraal', '-XX:CompileOnly=::test', '-Xcomp', '-esa', '-cp', mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes) + +def buildvms(args): + """build one or more VMs in various configurations""" + + parser = ArgumentParser(prog='mx buildvms'); + parser.add_argument('--vms', help='a comma separated list of VMs to build (default: server,client,graal)', default='server,client,graal') + parser.add_argument('--builds', help='a comma separated list of build types (default: product,fastdebug,debug)', default='product,fastdebug,debug') + + args = parser.parse_args(args) + vms = args.vms.split(',') + builds = args.builds.split(',') + + allStart = time.time() + for v in vms: + for vmbuild in builds: + logFile = join(v + '-' + vmbuild + '.log') + log = open(join(_graal_home, logFile), 'wb') + start = time.time() + mx.log('BEGIN: ' + v + '-' + vmbuild + '\t(see: ' + logFile + ')') + # Run as subprocess so that output can be directed to a file + subprocess.check_call([sys.executable, '-u', join('mxtool', 'mx.py'), '--vm', v, 'build', vmbuild], cwd=_graal_home, stdout=log, stderr=subprocess.STDOUT) + duration = datetime.timedelta(seconds=time.time() - start) + mx.log('END: ' + v + '-' + vmbuild + '\t[' + str(duration) + ']') + allDuration = datetime.timedelta(seconds=time.time() - allStart) + mx.log('TOTAL TIME: ' + '[' + str(allDuration) + ']') + def gate(args): """run the tests used to validate a push @@ -556,19 +639,17 @@ mx.run(['ant', '-f', join(_graal_home, 'visualizer', 'build.xml'), '-q', 'clean', 'build']) tasks.append(t.stop()) - # Prevent Graal modifications from breaking the standard client build - for v in ['client', 'server']: - for vmbuild in ['product', 'debug']: - t = Task('BuildHotSpot' + v.title() + ':' + vmbuild) - build(['--no-java', vmbuild], vm=v) - tasks.append(t.stop()) - + # Prevent Graal modifications from breaking the standard builds + t = Task('BuildHotSpotVarieties') + buildvms(['--vms', 'client,server', '--builds', 'fastdebug,product']) + tasks.append(t.stop()) + for vmbuild in ['fastdebug', 'product']: global _vmbuild _vmbuild = vmbuild t = Task('BuildHotSpotGraal:' + vmbuild) - build(['--no-java', vmbuild]) + buildvms(['--vms', 'graal', '--builds', vmbuild]) tasks.append(t.stop()) t = Task('BootstrapWithSystemAssertions:' + vmbuild) @@ -579,6 +660,10 @@ unittest([]) tasks.append(t.stop()) + # t = Task('JavaTesterTests:' + vmbuild) + # jtt([]) + # tasks.append(t.stop()) + for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): t = Task(str(test) + ':' + vmbuild) if not test.test('graal'): @@ -587,7 +672,7 @@ except KeyboardInterrupt: total.abort(1) - except Exception as e: + except BaseException as e: import traceback traceback.print_exc() total.abort(str(e)) @@ -710,6 +795,7 @@ _vmbuild = 'product' commands = { 'build': [build, '[-options]'], + 'buildvms': [buildvms, ''], 'clean': [clean, ''], 'copyrightcheck': [copyrightcheck, ''], 'hsdis': [hsdis, '[att]'], @@ -721,6 +807,7 @@ 'gv' : [gv, ''], 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], 'unittest' : [unittest, '[filters...]'], + 'jtt' : [jtt, '[filters...]'], 'vm': [vm, '[-options] class [args...]'] }
--- a/mx/eclipse-settings/org.eclipse.jdt.core.prefs Thu Feb 16 14:43:05 2012 +0100 +++ b/mx/eclipse-settings/org.eclipse.jdt.core.prefs Thu Feb 16 14:53:04 2012 +0100 @@ -247,7 +247,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert @@ -323,7 +323,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
--- a/mx/projects Thu Feb 16 14:43:05 2012 +0100 +++ b/mx/projects Thu Feb 16 14:53:04 2012 +0100 @@ -114,6 +114,12 @@ project@com.oracle.max.graal.tests@dependencies=com.oracle.max.graal.printer project@com.oracle.max.graal.tests@checkstyle=com.oracle.max.graal.graph +# graal.jtt +project@com.oracle.max.graal.jtt@subDir=graal +project@com.oracle.max.graal.jtt@sourceDirs=src +project@com.oracle.max.graal.jtt@dependencies=JUNIT +project@com.oracle.max.graal.jtt@checkstyle=com.oracle.max.graal.graph + # max.asm project@com.oracle.max.asm@subDir=graal project@com.oracle.max.asm@sourceDirs=src
--- a/src/share/tools/ProjectCreator/BuildConfig.java Thu Feb 16 14:43:05 2012 +0100 +++ b/src/share/tools/ProjectCreator/BuildConfig.java Thu Feb 16 14:53:04 2012 +0100 @@ -68,16 +68,13 @@ if (value != null) { outDir = value; } - if(outDir.endsWith("fastdebug")) { - outDir = outDir.substring(0, outDir.lastIndexOf("fastdebug") - 1); - } else if (outDir.endsWith("debug")) { - outDir = outDir.substring(0, outDir.lastIndexOf("debug") - 1); + + int lastDirectorySeparator = Math.max(outDir.lastIndexOf("/"), outDir.lastIndexOf("\\")); + if (lastDirectorySeparator >= 0) { + outDir = outDir.substring(0, lastDirectorySeparator); } - if (!build.equals("product")) { - outDir += Util.sep + build; - } - outDir += Util.sep + "jre" + Util.sep + "bin"; + outDir += Util.sep + build + Util.sep + "bin"; if (flavour.equals("graal")) { outDir += Util.sep + "graal"; } else if (flavour.equals("compiler1")) {
--- a/src/share/vm/runtime/arguments.cpp Thu Feb 16 14:43:05 2012 +0100 +++ b/src/share/vm/runtime/arguments.cpp Thu Feb 16 14:53:04 2012 +0100 @@ -2126,7 +2126,7 @@ errno = 0; DIR* graal_dir_handle = os::opendir(graal_dir); while ((dentry = os::readdir(graal_dir_handle, (struct dirent *)tdbuf)) != NULL) { - if (strcmp(dentry->d_name, ".") != 0 && strcmp(dentry->d_name, "..") != 0 && strcmp(dentry->d_name, "com.oracle.max.graal.tests") != 0) { + if (strcmp(dentry->d_name, ".") != 0 && strcmp(dentry->d_name, "..") != 0 && strcmp(dentry->d_name, "com.oracle.max.graal.tests") != 0 && strcmp(dentry->d_name, "com.oracle.max.graal.jtt") != 0) { prepend_to_graal_classpath(scp_compiler, graal_dir, dentry->d_name); if (PrintVMOptions) { tty->print_cr("Adding project directory %s to bootclasspath", dentry->d_name);