From 15b77ee7527f0d48ae3292f46bda23657e0724a4 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Thu, 17 May 2018 23:58:14 +0300 Subject: [PATCH] Wasm backend: fix Array.get --- .../backend/wasm/generators/ArrayGenerator.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/core/src/main/java/org/teavm/backend/wasm/generators/ArrayGenerator.java b/core/src/main/java/org/teavm/backend/wasm/generators/ArrayGenerator.java index ccf09af28..3c255cf8b 100644 --- a/core/src/main/java/org/teavm/backend/wasm/generators/ArrayGenerator.java +++ b/core/src/main/java/org/teavm/backend/wasm/generators/ArrayGenerator.java @@ -45,19 +45,8 @@ import org.teavm.runtime.RuntimeArray; import org.teavm.runtime.RuntimeClass; public class ArrayGenerator implements WasmMethodGenerator { - private static FieldReference tagField = new FieldReference(RuntimeClass.class.getName(), "tag"); private static FieldReference componentField = new FieldReference(RuntimeClass.class.getName(), "itemType"); private static FieldReference flagsField = new FieldReference(RuntimeClass.class.getName(), "flags"); - private static final int[] primitives = { - RuntimeClass.BYTE_PRIMITIVE, - RuntimeClass.SHORT_PRIMITIVE, - RuntimeClass.CHAR_PRIMITIVE, - RuntimeClass.INT_PRIMITIVE, - RuntimeClass.LONG_PRIMITIVE, - RuntimeClass.FLOAT_PRIMITIVE, - RuntimeClass.DOUBLE_PRIMITIVE, - RuntimeClass.BOOLEAN_PRIMITIVE - }; private static final String[] primitiveWrappers = { "Byte", "Short", "Character", "Integer", "Long", "Float", "Double", "Boolean" }; private static final ValueType.Primitive[] primitiveTypes = { ValueType.BYTE, ValueType.SHORT, ValueType.CHARACTER, @@ -87,9 +76,7 @@ public class ArrayGenerator implements WasmMethodGenerator { function.add(indexVar); function.add(flagsVar); - int tagOffset = context.getClassGenerator().getFieldOffset(tagField); - WasmExpression arrayClass = new WasmLoadInt32(4, new WasmGetLocal(arrayVar), - WasmInt32Subtype.INT32, tagOffset); + WasmExpression arrayClass = new WasmLoadInt32(4, new WasmGetLocal(arrayVar), WasmInt32Subtype.INT32); arrayClass = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SHL, arrayClass, new WasmInt32Constant(3));