From 5095ef1ea4409171bf65a38aadd4816455e6cc91 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Tue, 7 Feb 2017 17:13:48 +0100 Subject: [PATCH] Revert 'Temporary disable new intrinsics usage in ieee754 arithmetic' --- .../org/jetbrains/kotlin/codegen/ExpressionCodegen.java | 6 +----- .../codegen/bytecodeText/ieee754/nullableDoubleEquals.kt | 9 ++++----- .../bytecodeText/ieee754/nullableDoubleNotEquals.kt | 9 ++++----- .../codegen/bytecodeText/ieee754/nullableFloatEquals.kt | 9 ++++----- .../bytecodeText/ieee754/nullableFloatNotEquals.kt | 9 ++++----- .../codegen/bytecodeText/ieee754/smartCastsForDouble.kt | 9 ++++----- .../codegen/bytecodeText/ieee754/smartCastsForFloat.kt | 9 ++++----- compiler/testData/codegen/bytecodeText/ieee754/when.kt | 5 ++--- .../bytecodeText/ieee754/whenNullableSmartCast.kt | 7 +++---- 9 files changed, 30 insertions(+), 42 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index b2f26ad60fa..423977238ca 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -3675,11 +3675,7 @@ public class ExpressionCodegen extends KtVisitor impleme if (left754Type != null && right754Type != null && left754Type.type.equals(right754Type.type)) { //check nullability cause there is some optimizations in codegen for non-nullable case if (left754Type.isNullable || right754Type.isNullable) { - // Using Intrinsics.areEqual is preferable here, but will result in NoSuchMethodError at runtime if the runtime - // of version 1.0 is used and the user forgot to explicitly specify language version / API version. - // This should be enabled when/if we decide to drop support for "-language-version 1.0" / "-api-version 1.0" - //noinspection ConstantConditions, PointlessBooleanExpression - if (false && state.getLanguageVersionSettings().getApiVersion().compareTo(ApiVersion.KOTLIN_1_1) >= 0) { + if (state.getLanguageVersionSettings().getApiVersion().compareTo(ApiVersion.KOTLIN_1_1) >= 0) { return StackValue.operation(Type.BOOLEAN_TYPE, new Function1() { @Override public Unit invoke(InstructionAdapter v) { diff --git a/compiler/testData/codegen/bytecodeText/ieee754/nullableDoubleEquals.kt b/compiler/testData/codegen/bytecodeText/ieee754/nullableDoubleEquals.kt index 8b487c9abc1..1778e9bddde 100644 --- a/compiler/testData/codegen/bytecodeText/ieee754/nullableDoubleEquals.kt +++ b/compiler/testData/codegen/bytecodeText/ieee754/nullableDoubleEquals.kt @@ -24,8 +24,7 @@ fun box(): String { return "OK" } -/* - 1 areEqual \(Ljava/lang/Double;Ljava/lang/Double;\)Z - 1 areEqual \(DLjava/lang/Double;\)Z - 1 areEqual \(Ljava/lang/Double;D\)Z - 3 areEqual*/ +// 1 areEqual \(Ljava/lang/Double;Ljava/lang/Double;\)Z +// 1 areEqual \(DLjava/lang/Double;\)Z +// 1 areEqual \(Ljava/lang/Double;D\)Z +// 3 areEqual diff --git a/compiler/testData/codegen/bytecodeText/ieee754/nullableDoubleNotEquals.kt b/compiler/testData/codegen/bytecodeText/ieee754/nullableDoubleNotEquals.kt index 1606d206cf0..75ae482ab4d 100644 --- a/compiler/testData/codegen/bytecodeText/ieee754/nullableDoubleNotEquals.kt +++ b/compiler/testData/codegen/bytecodeText/ieee754/nullableDoubleNotEquals.kt @@ -24,8 +24,7 @@ fun box(): String { return "OK" } -/* - 1 areEqual \(Ljava/lang/Double;Ljava/lang/Double;\)Z - 1 areEqual \(DLjava/lang/Double;\)Z - 1 areEqual \(Ljava/lang/Double;D\)Z - 3 areEqual*/ +// 1 areEqual \(Ljava/lang/Double;Ljava/lang/Double;\)Z +// 1 areEqual \(DLjava/lang/Double;\)Z +// 1 areEqual \(Ljava/lang/Double;D\)Z +// 3 areEqual diff --git a/compiler/testData/codegen/bytecodeText/ieee754/nullableFloatEquals.kt b/compiler/testData/codegen/bytecodeText/ieee754/nullableFloatEquals.kt index 5670dd98e7d..236bb2bc74b 100644 --- a/compiler/testData/codegen/bytecodeText/ieee754/nullableFloatEquals.kt +++ b/compiler/testData/codegen/bytecodeText/ieee754/nullableFloatEquals.kt @@ -24,8 +24,7 @@ fun box(): String { return "OK" } -/* - 1 areEqual \(Ljava/lang/Float;Ljava/lang/Float;\)Z - 1 areEqual \(FLjava/lang/Float;\)Z - 1 areEqual \(Ljava/lang/Float;F\)Z - 3 areEqual*/ +// 1 areEqual \(Ljava/lang/Float;Ljava/lang/Float;\)Z +// 1 areEqual \(FLjava/lang/Float;\)Z +// 1 areEqual \(Ljava/lang/Float;F\)Z +// 3 areEqual diff --git a/compiler/testData/codegen/bytecodeText/ieee754/nullableFloatNotEquals.kt b/compiler/testData/codegen/bytecodeText/ieee754/nullableFloatNotEquals.kt index 643291dfe4b..004b27554a4 100644 --- a/compiler/testData/codegen/bytecodeText/ieee754/nullableFloatNotEquals.kt +++ b/compiler/testData/codegen/bytecodeText/ieee754/nullableFloatNotEquals.kt @@ -24,8 +24,7 @@ fun box(): String { return "OK" } -/* - 1 areEqual \(Ljava/lang/Float;Ljava/lang/Float;\)Z - 1 areEqual \(FLjava/lang/Float;\)Z - 1 areEqual \(Ljava/lang/Float;F\)Z - 3 areEqual*/ +// 1 areEqual \(Ljava/lang/Float;Ljava/lang/Float;\)Z +// 1 areEqual \(FLjava/lang/Float;\)Z +// 1 areEqual \(Ljava/lang/Float;F\)Z +// 3 areEqual diff --git a/compiler/testData/codegen/bytecodeText/ieee754/smartCastsForDouble.kt b/compiler/testData/codegen/bytecodeText/ieee754/smartCastsForDouble.kt index 5d2b58869aa..91a02c0b536 100644 --- a/compiler/testData/codegen/bytecodeText/ieee754/smartCastsForDouble.kt +++ b/compiler/testData/codegen/bytecodeText/ieee754/smartCastsForDouble.kt @@ -17,8 +17,7 @@ fun box(): String { return "OK" } -/* - 1 areEqual \(Ljava/lang/Double;Ljava/lang/Double;\)Z - 1 areEqual \(DLjava/lang/Double;\)Z - 1 areEqual \(Ljava/lang/Double;D\)Z - 3 areEqual*/ +// 1 areEqual \(Ljava/lang/Double;Ljava/lang/Double;\)Z +// 1 areEqual \(DLjava/lang/Double;\)Z +// 1 areEqual \(Ljava/lang/Double;D\)Z +// 3 areEqual diff --git a/compiler/testData/codegen/bytecodeText/ieee754/smartCastsForFloat.kt b/compiler/testData/codegen/bytecodeText/ieee754/smartCastsForFloat.kt index 8163f46af63..89832229136 100644 --- a/compiler/testData/codegen/bytecodeText/ieee754/smartCastsForFloat.kt +++ b/compiler/testData/codegen/bytecodeText/ieee754/smartCastsForFloat.kt @@ -17,8 +17,7 @@ fun box(): String { return "OK" } -/* - 1 areEqual \(Ljava/lang/Float;Ljava/lang/Float;\)Z - 1 areEqual \(FLjava/lang/Float;\)Z - 1 areEqual \(Ljava/lang/Float;F\)Z - 3 areEqual*/ +// 1 areEqual \(Ljava/lang/Float;Ljava/lang/Float;\)Z +// 1 areEqual \(FLjava/lang/Float;\)Z +// 1 areEqual \(Ljava/lang/Float;F\)Z +// 3 areEqual diff --git a/compiler/testData/codegen/bytecodeText/ieee754/when.kt b/compiler/testData/codegen/bytecodeText/ieee754/when.kt index a25cd5c1dcc..1c1491e4cc6 100644 --- a/compiler/testData/codegen/bytecodeText/ieee754/when.kt +++ b/compiler/testData/codegen/bytecodeText/ieee754/when.kt @@ -27,6 +27,5 @@ fun box(): String { return "OK" } -/* - 2 areEqual \(DLjava/lang/Double;\)Z - 2 areEqual*/ +// 2 areEqual \(DLjava/lang/Double;\)Z +// 2 areEqual diff --git a/compiler/testData/codegen/bytecodeText/ieee754/whenNullableSmartCast.kt b/compiler/testData/codegen/bytecodeText/ieee754/whenNullableSmartCast.kt index a458e34d897..7f02248e417 100644 --- a/compiler/testData/codegen/bytecodeText/ieee754/whenNullableSmartCast.kt +++ b/compiler/testData/codegen/bytecodeText/ieee754/whenNullableSmartCast.kt @@ -26,7 +26,6 @@ fun box(): String { return "OK" } -/* - 2 areEqual \(Ljava/lang/Double;Ljava/lang/Double;\)Z - 2 areEqual \(Ljava/lang/Double;D\)Z - 4 areEqual*/ +// 2 areEqual \(Ljava/lang/Double;Ljava/lang/Double;\)Z +// 2 areEqual \(Ljava/lang/Double;D\)Z +// 4 areEqual