diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java index b6778421218..b554e7bd1ec 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java @@ -720,8 +720,8 @@ public abstract class StackValue { @Override public void putSelector(@NotNull Type type, @NotNull InstructionAdapter v) { - if (value instanceof Integer) { - v.iconst((Integer) value); + if (value instanceof Integer || value instanceof Byte || value instanceof Short) { + v.iconst(((Number) value).intValue()); } else if (value instanceof Long) { v.lconst((Long) value); diff --git a/compiler/testData/codegen/bytecodeText/constants/byte.kt b/compiler/testData/codegen/bytecodeText/constants/byte.kt index d9f3adca4ff..8809d08dbeb 100644 --- a/compiler/testData/codegen/bytecodeText/constants/byte.kt +++ b/compiler/testData/codegen/bytecodeText/constants/byte.kt @@ -1,3 +1,3 @@ -val a: Byte = 1 + 1 +val a: Byte = 1 + 10 -// 1 I2B \ No newline at end of file +// 1 BIPUSH 11 \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/constants/nullableByteAndShort.kt b/compiler/testData/codegen/bytecodeText/constants/nullableByteAndShort.kt index 17f32a26fd5..bbdfc92c94c 100644 --- a/compiler/testData/codegen/bytecodeText/constants/nullableByteAndShort.kt +++ b/compiler/testData/codegen/bytecodeText/constants/nullableByteAndShort.kt @@ -1,5 +1,5 @@ -val a: Byte? = -1 -val b: Short? = -1 +val a: Byte? = -10 +val b: Short? = -300 -// 1 I2B -// 1 I2S \ No newline at end of file +// 1 BIPUSH -10 +// 1 SIPUSH -300 \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/constants/short.kt b/compiler/testData/codegen/bytecodeText/constants/short.kt index 0d100a76c29..bf041dae18e 100644 --- a/compiler/testData/codegen/bytecodeText/constants/short.kt +++ b/compiler/testData/codegen/bytecodeText/constants/short.kt @@ -1,3 +1,3 @@ -val a: Short = 1 + 1 +val a: Short = 1 + 255 -// 1 I2S \ No newline at end of file +// 1 SIPUSH 256 \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeTextMultifile/inlineJavaStaticFields/JClass.java b/compiler/testData/codegen/bytecodeTextMultifile/inlineJavaStaticFields/JClass.java index 714e227319b..ab7378e4c41 100644 --- a/compiler/testData/codegen/bytecodeTextMultifile/inlineJavaStaticFields/JClass.java +++ b/compiler/testData/codegen/bytecodeTextMultifile/inlineJavaStaticFields/JClass.java @@ -4,7 +4,7 @@ public class JClass { public final static int PrimitiveInt = 9000; public final static int BigPrimitiveInt = 59000; public final static long PrimitiveLong = 100000; - public final static short PrimitiveShort = 900; + public final static short PrimitiveShort = 901; public final static boolean PrimitiveBool = false; public final static float PrimitiveFloat = 36.6; public final static double PrimitiveDouble = 42.4242; diff --git a/compiler/testData/codegen/bytecodeTextMultifile/inlineJavaStaticFields/test.kt b/compiler/testData/codegen/bytecodeTextMultifile/inlineJavaStaticFields/test.kt index f1fe2a262cf..a547050af34 100644 --- a/compiler/testData/codegen/bytecodeTextMultifile/inlineJavaStaticFields/test.kt +++ b/compiler/testData/codegen/bytecodeTextMultifile/inlineJavaStaticFields/test.kt @@ -31,10 +31,10 @@ fun test() { // 1 LDC 9223372036854775807 // 1 SIPUSH 9000 // 1 LDC 59000 -// 1 LDC -8 +// 1 BIPUSH -8 // 1 LDC K // 1 LDC 100000 -// 1 LDC 900 +// 1 SIPUSH 901 // 1 LDC false // 1 LDC 36.6 // 1 LDC 42.4242