Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,7 @@ case CoreOp.VarAccessOp.VarLoadOp varLoadOp when isConstant(varLoadOp.varOp()) -
eval(l, varLoadOp.varOp().initOperand());
case JavaOp.ConvOp _ -> {
// we expect cast to primitive type
// cast from a primitive type to boolean or form boolean to a primitive type is not allowed in cast context
Value operand = op.operands().getFirst();
if ((op.resultType().equals(BOOLEAN) && !operand.type().equals(BOOLEAN)) ||
(operand.type().equals(BOOLEAN) && !op.resultType().equals(BOOLEAN))) {
throw new NonConstantExpression();
}
var v = eval(l, operand);
var v = eval(l, op.operands().getFirst());
yield ArithmeticAndConvOpImpls.evaluate(op, List.of(v));
}
case CastOp castOp -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,6 @@ public static char conv_char(double i) {
public static byte conv_byte(double i) {
return (byte) i;
}
public static boolean conv_boolean(double i) {
return ((int)i & 1) == 1;
}

// float conversion
public static double conv_double(float i) {
Expand All @@ -664,9 +661,6 @@ public static char conv_char(float i) {
public static byte conv_byte(float i) {
return (byte) i;
}
public static boolean conv_boolean(float i) {
return ((int)i & 1) == 1;
}

// long conversion
public static double conv_double(long i) {
Expand All @@ -690,9 +684,6 @@ public static char conv_char(long i) {
public static byte conv_byte(long i) {
return (byte) i;
}
public static boolean conv_boolean(long i) {
return (i & 1) == 1;
}

// int conversion
public static double conv_double(int i) {
Expand All @@ -716,9 +707,6 @@ public static char conv_char(int i) {
public static byte conv_byte(int i) {
return (byte) i;
}
public static boolean conv_boolean(int i) {
return (i & 1) == 1;
}

// short conversion
public static double conv_double(short i) {
Expand All @@ -742,9 +730,6 @@ public static char conv_char(short i) {
public static byte conv_byte(short i) {
return (byte) i;
}
public static boolean conv_boolean(short i) {
return (i & 1) == 1;
}

// char conversion
public static double conv_double(char i) {
Expand All @@ -768,9 +753,6 @@ public static char conv_char(char i) {
public static byte conv_byte(char i) {
return (byte) i;
}
public static boolean conv_boolean(char i) {
return (i & 1) == 1;
}

// byte conversion
public static double conv_double(byte i) {
Expand All @@ -794,32 +776,8 @@ public static char conv_char(byte i) {
public static byte conv_byte(byte i) {
return i;
}
public static boolean conv_boolean(byte i) {
return (i & 1) == 1;
}

// boolean conversion
public static double conv_double(boolean i) {
return i ? 1d : 0d;
}
public static float conv_float(boolean i) {
return i ? 1f : 0f;
}
public static long conv_long(boolean i) {
return i ? 1l : 0l;
}
public static int conv_int(boolean i) {
return i ? 1 : 0;
}
public static short conv_short(boolean i) {
return i ? (short)1 : 0;
}
public static char conv_char(boolean i) {
return i ? (char)1 : 0;
}
public static byte conv_byte(boolean i) {
return i ? (byte)1 : 0;
}
public static boolean conv_boolean(boolean i) {
return i;
}
Expand All @@ -833,6 +791,7 @@ private static MethodType resolveToMethodType(FunctionType ft) {
}
}

// @@@ we might revisit the mechanism to resolve a method and cache the result - JDK-8378294
private static MethodHandle opHandle(String methodName, FunctionType ft) {
MethodType mt = resolveToMethodType(ft);
if (mt == null) return null;
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion src/jdk.incubator.code/share/classes/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
exports jdk.incubator.code.dialect.core;
exports jdk.incubator.code.dialect.java;
exports jdk.incubator.code.bytecode;
exports jdk.incubator.code.interpreter;
exports jdk.incubator.code.runtime;

provides com.sun.tools.javac.comp.CodeReflectionTransformer with
Expand Down
2 changes: 1 addition & 1 deletion test/jdk/jdk/incubator/code/CoreBinaryOpsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/*
* @test
* @modules jdk.incubator.code
* @library lib
* @run junit CoreBinaryOpsTest
* @run junit/othervm -Dbabylon.ssa=cytron CoreBinaryOpsTest
*/
Expand All @@ -38,7 +39,6 @@
import jdk.incubator.code.dialect.core.CoreType;
import jdk.incubator.code.dialect.core.FunctionType;
import jdk.incubator.code.dialect.java.JavaType;
import jdk.incubator.code.interpreter.Interpreter;
import org.junit.jupiter.api.Named;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.function.ThrowingSupplier;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import jdk.incubator.code.Reflect;
import jdk.incubator.code.Op;
import jdk.incubator.code.interpreter.Interpreter;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand All @@ -14,6 +13,7 @@
* @test
* @summary test that invoking Op#ofLambda returns the same instance
* @modules jdk.incubator.code
* @library lib
* @run junit ReflectableLambdaSameInstanceTest
*/

Expand Down
2 changes: 1 addition & 1 deletion test/jdk/jdk/incubator/code/TestArrayCreation.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import jdk.incubator.code.Reflect;
import jdk.incubator.code.Op;
import jdk.incubator.code.dialect.core.CoreOp;
import jdk.incubator.code.interpreter.Interpreter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand All @@ -36,6 +35,7 @@
/*
* @test
* @modules jdk.incubator.code
* @library lib
* @run junit TestArrayCreation
* @run main Unreflect TestArrayCreation
* @run junit TestArrayCreation
Expand Down
2 changes: 1 addition & 1 deletion test/jdk/jdk/incubator/code/TestArrayTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import jdk.incubator.code.Op;
import jdk.incubator.code.dialect.core.CoreOp;
import jdk.incubator.code.dialect.java.JavaOp;
import jdk.incubator.code.interpreter.Interpreter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand All @@ -37,6 +36,7 @@
/*
* @test
* @modules jdk.incubator.code
* @library lib
* @run junit TestArrayTypes
* @run main Unreflect TestArrayTypes
* @run junit TestArrayTypes
Expand Down
2 changes: 1 addition & 1 deletion test/jdk/jdk/incubator/code/TestBinops.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/*
* @test
* @modules jdk.incubator.code
* @library lib
* @run junit TestBinops
* @run main Unreflect TestBinops
* @run junit TestBinops
Expand All @@ -32,7 +33,6 @@
import jdk.incubator.code.Reflect;
import jdk.incubator.code.Op;
import jdk.incubator.code.dialect.core.CoreOp;
import jdk.incubator.code.interpreter.Interpreter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand Down
2 changes: 1 addition & 1 deletion test/jdk/jdk/incubator/code/TestBlockOp.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import jdk.incubator.code.CodeTransformer;
import jdk.incubator.code.Op;
import jdk.incubator.code.dialect.core.CoreOp;
import jdk.incubator.code.interpreter.Interpreter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand All @@ -37,6 +36,7 @@
/*
* @test
* @modules jdk.incubator.code
* @library lib
* @run junit TestBlockOp
* @run main Unreflect TestBlockOp
* @run junit TestBlockOp
Expand Down
2 changes: 1 addition & 1 deletion test/jdk/jdk/incubator/code/TestBreakContinue.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/*
* @test
* @modules jdk.incubator.code
* @library lib
* @run junit TestBreakContinue
* @run main Unreflect TestBreakContinue
* @run junit TestBreakContinue
Expand All @@ -33,7 +34,6 @@
import jdk.incubator.code.CodeTransformer;
import jdk.incubator.code.Op;
import jdk.incubator.code.dialect.core.CoreOp;
import jdk.incubator.code.interpreter.Interpreter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand Down
2 changes: 1 addition & 1 deletion test/jdk/jdk/incubator/code/TestConcat.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import jdk.incubator.code.Reflect;
import jdk.incubator.code.Op;
import jdk.incubator.code.dialect.core.CoreOp;
import jdk.incubator.code.interpreter.Interpreter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
Expand All @@ -40,6 +39,7 @@
/*
* @test
* @modules jdk.incubator.code
* @library lib
* @run junit TestConcat
* @run main Unreflect TestConcat
* @run junit TestConcat
Expand Down
2 changes: 1 addition & 1 deletion test/jdk/jdk/incubator/code/TestConditionalExpression.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/*
* @test
* @modules jdk.incubator.code
* @library lib
* @run junit TestConditionalExpression
* @run main Unreflect TestConditionalExpression
* @run junit TestConditionalExpression
Expand All @@ -33,7 +34,6 @@
import jdk.incubator.code.CodeTransformer;
import jdk.incubator.code.Op;
import jdk.incubator.code.dialect.core.CoreOp;
import jdk.incubator.code.interpreter.Interpreter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand Down
2 changes: 1 addition & 1 deletion test/jdk/jdk/incubator/code/TestConditionalOp.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import jdk.incubator.code.Op;
import jdk.incubator.code.CodeTransformer;
import jdk.incubator.code.dialect.core.CoreOp;
import jdk.incubator.code.interpreter.Interpreter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand All @@ -39,6 +38,7 @@
/*
* @test
* @modules jdk.incubator.code
* @library lib
* @run junit TestConditionalOp
* @run main Unreflect TestConditionalOp
* @run junit TestConditionalOp
Expand Down
2 changes: 1 addition & 1 deletion test/jdk/jdk/incubator/code/TestConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/*
* @test
* @modules jdk.incubator.code
* @library lib
* @run junit TestConstants
* @run main Unreflect TestConstants
* @run junit TestConstants
Expand All @@ -33,7 +34,6 @@
import jdk.incubator.code.Op;
import jdk.incubator.code.CodeTransformer;
import jdk.incubator.code.dialect.core.CoreOp;
import jdk.incubator.code.interpreter.Interpreter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
Expand Down
2 changes: 1 addition & 1 deletion test/jdk/jdk/incubator/code/TestEnhancedForOp.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import jdk.incubator.code.CodeTransformer;
import jdk.incubator.code.Op;
import jdk.incubator.code.dialect.core.CoreOp;
import jdk.incubator.code.interpreter.Interpreter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand All @@ -38,6 +37,7 @@
/*
* @test
* @modules jdk.incubator.code
* @library lib
* @run junit TestEnhancedForOp
* @run main Unreflect TestEnhancedForOp
* @run junit TestEnhancedForOp
Expand Down
6 changes: 3 additions & 3 deletions test/jdk/jdk/incubator/code/TestEvaluation.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import jdk.incubator.code.dialect.core.CoreType;
import jdk.incubator.code.dialect.java.JavaOp;
import jdk.incubator.code.dialect.java.PrimitiveType;
import jdk.incubator.code.interpreter.Interpreter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
Expand All @@ -26,6 +25,7 @@
/*
* @test
* @modules jdk.incubator.code
* @library lib
* @run junit TestEvaluation
* @run main Unreflect TestEvaluation
* @run junit TestEvaluation
Expand Down Expand Up @@ -367,9 +367,9 @@ void testConversion() {
MethodHandles.Lookup l = MethodHandles.lookup();
Optional<Object> v = JavaOp.JavaExpression.evaluate(l, (JavaOp.ConvOp) op);
if ((to.equals(BOOLEAN) && !from.equals(BOOLEAN)) || (from.equals(BOOLEAN) && !to.equals(BOOLEAN))) {
Assertions.assertTrue(v.isEmpty());
Assertions.assertTrue(v.isEmpty(), from + " -> " + to);
} else {
Assertions.assertTrue(v.isPresent());
Assertions.assertTrue(v.isPresent(), from + " -> " + to);
Object expected = Interpreter.invoke(l, f);
Assertions.assertEquals(expected, v.get());
}
Expand Down
2 changes: 1 addition & 1 deletion test/jdk/jdk/incubator/code/TestExceptionRegionOps.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/*
* @test
* @modules jdk.incubator.code
* @library lib
* @run junit TestExceptionRegionOps
*/

Expand All @@ -32,7 +33,6 @@
import jdk.incubator.code.dialect.java.JavaOp;
import jdk.incubator.code.dialect.java.JavaType;
import jdk.incubator.code.dialect.java.MethodRef;
import jdk.incubator.code.interpreter.Interpreter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand Down
Loading