diff --git a/jre/java/java/util/ArrayDeque.java b/jre/java/java/util/ArrayDeque.java
index 29b4a5e7cb..5416511a1c 100644
--- a/jre/java/java/util/ArrayDeque.java
+++ b/jre/java/java/util/ArrayDeque.java
@@ -443,7 +443,7 @@ private void ensureCapacity() {
array = newArray;
head = 0;
} else {
- ArrayHelper.setLength(array, newLength);
+ array = ArrayHelper.setLength(array, newLength);
}
tail = numElements;
}
diff --git a/jre/java/super-wasm/java/util/ArrayList.java b/jre/java/super-wasm/java/util/ArrayList.java
new file mode 100644
index 0000000000..4a447cf047
--- /dev/null
+++ b/jre/java/super-wasm/java/util/ArrayList.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright 2007 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package java.util;
+
+import static javaemul.internal.InternalPreconditions.checkArgument;
+import static javaemul.internal.InternalPreconditions.checkPositionIndex;
+import static javaemul.internal.InternalPreconditions.checkPositionIndexes;
+
+import javaemul.internal.ArrayHelper;
+
+/**
+ * Resizeable array implementation of the List interface. See the official Java API
+ * doc for details.
+ *
+ * @param the element type.
+ */
+public class ArrayList extends ArrayListBase {
+
+ private int size;
+
+ public ArrayList() {
+ array = (E[]) new Object[10];
+ }
+
+ public ArrayList(Collection extends E> c) {
+ array = (E[]) c.toArray();
+ size = array.length;
+ }
+
+ public ArrayList(int initialCapacity) {
+ // Avoid calling overridable methods from constructors
+ checkArgument(initialCapacity >= 0, "Initial capacity must not be negative");
+ array = (E[]) new Object[initialCapacity];
+ }
+
+ @Override
+ public boolean add(E o) {
+ int nextIndex = size;
+ ensureCapacity(nextIndex + 1);
+ array[nextIndex] = o;
+ size = nextIndex + 1;
+ return true;
+ }
+
+ @Override
+ public void add(int index, E o) {
+ checkPositionIndex(index, size);
+ E[] array = insertGap(index, 1);
+ array[index] = o;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection extends E> c) {
+ checkPositionIndex(index, size);
+ Object[] cArray = c.toArray();
+ int len = cArray.length;
+ if (len == 0) {
+ return false;
+ }
+ E[] array = insertGap(index, len);
+ ArrayHelper.copy(cArray, 0, array, index, len);
+ return true;
+ }
+
+ private E[] insertGap(int index, int count) {
+ E[] original = array;
+ int originalCapacity = original.length;
+
+ int originalSize = this.size;
+ int newSize = originalSize + count;
+
+ E[] target;
+ if (newSize > originalCapacity) {
+ // Ensure enough capacity.
+ target = (E[]) new Object[ArrayHelper.getNewCapacity(originalCapacity, newSize)];
+ // Only copy up to index since others will need to move anyway.
+ ArrayHelper.copy(original, 0, target, 0, index);
+ this.array = target;
+ } else {
+ target = original;
+ }
+
+ // Move the items. Note that we are not trying to clear existing values; callers will do that.
+ ArrayHelper.copy(original, index, target, index + count, originalSize - index);
+
+ this.size = newSize;
+
+ return target;
+ }
+
+ public Object clone() {
+ return new ArrayList(this);
+ }
+
+ public void ensureCapacity(int minCapacity) {
+ if (minCapacity > array.length) {
+ array = ArrayHelper.grow(array, minCapacity);
+ }
+ }
+
+ @Override
+ void removeImpl(int index) {
+ int newSize = size - 1;
+ ArrayHelper.copy(array, index + 1, array, index, newSize - index);
+ array[newSize] = null;
+ this.size = newSize;
+ }
+
+ @Override
+ int sizeImpl() {
+ return size;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return ArrayHelper.clone(array, 0, size);
+ }
+
+ /*
+ * Faster than the iterator-based implementation in AbstractCollection.
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public T[] toArray(T[] out) {
+ int size = this.size;
+ if (out.length < size) {
+ out = ArrayHelper.createFrom(out, size);
+ }
+ for (int i = 0; i < size; ++i) {
+ out[i] = (T) array[i];
+ }
+ if (out.length > size) {
+ out[size] = null;
+ }
+ return out;
+ }
+
+ public void trimToSize() {
+ if (size == array.length) {
+ return;
+ }
+ array = ArrayHelper.clone(array, 0, size);
+ }
+
+ @Override
+ protected void removeRange(int fromIndex, int endIndex) {
+ checkPositionIndexes(fromIndex, endIndex, size);
+ int count = endIndex - fromIndex;
+ if (count == 0) {
+ return;
+ }
+
+ int oldSize = size;
+ // Copy the items after removal end, overwriting removed items.
+ ArrayHelper.copy(array, endIndex, array, fromIndex, oldSize - endIndex);
+ // Clear the end of the array.
+ Arrays.fill(array, oldSize - count, oldSize, null);
+
+ this.size = oldSize - count;
+ }
+
+ void setSize(int newSize) {
+ int oldSize = size;
+ if (newSize == oldSize) {
+ return;
+ }
+ if (newSize > oldSize) {
+ ArrayHelper.grow(array, newSize);
+ } else {
+ Arrays.fill(array, newSize, oldSize, null);
+ }
+ this.size = newSize;
+ }
+}
diff --git a/jre/java/super-wasm/javaemul/internal/ArrayHelper.java b/jre/java/super-wasm/javaemul/internal/ArrayHelper.java
index 78d9a05a06..3320320f60 100644
--- a/jre/java/super-wasm/javaemul/internal/ArrayHelper.java
+++ b/jre/java/super-wasm/javaemul/internal/ArrayHelper.java
@@ -23,10 +23,6 @@
/** Provides utilities to perform operations on Arrays. */
public final class ArrayHelper {
- public static T clone(T array) {
- return (T) cloneImpl(array, 0, getLength(array));
- }
-
public static T clone(T array, int fromIndex, int toIndex) {
return (T) cloneImpl(array, fromIndex, toIndex);
}
@@ -37,8 +33,9 @@ public static T unsafeClone(Object array, int fromIndex, int toIndex) {
private static Object cloneImpl(Object array, int fromIndex, int toIndex) {
int newLength = toIndex - fromIndex;
- Object targetArray = asWasmArray(array).newArray(newLength);
- int endIndex = Math.min(getLength(array), toIndex);
+ WasmArray wasmArray = asWasmArray(array);
+ Object targetArray = wasmArray.newArray(newLength);
+ int endIndex = Math.min(wasmArray.getLength(), toIndex);
copy(array, fromIndex, targetArray, 0, endIndex - fromIndex);
return targetArray;
}
@@ -55,33 +52,22 @@ public static int getLength(Object array) {
return asWasmArray(array).getLength();
}
- public static T setLength(T array, int length) {
- asWasmArray(array).setLength(length);
- return array;
+ public static T setLength(T array, int newLength) {
+ return getLength(array) == newLength ? array : clone(array, 0, newLength);
}
+ /**
+ * Resize the array to accommodate requested length. For Wasm, the size is increased in larger
+ * chunks to amortize cost of growing similar to JavaScript.
+ */
public static T grow(T array, int length) {
- return setLength(array, length);
- }
-
- public static void push(Object[] array, Object o) {
- ((WasmArray.OfObject) asWasmArray(array)).push(o);
- }
-
- public static void push(byte[] array, byte o) {
- ((WasmArray.OfByte) asWasmArray(array)).push(o);
+ return clone(array, 0, getNewCapacity(getLength(array), length));
}
- public static void push(int[] array, int o) {
- ((WasmArray.OfInt) asWasmArray(array)).push(o);
- }
-
- public static void push(long[] array, long o) {
- ((WasmArray.OfLong) asWasmArray(array)).push(o);
- }
-
- public static void push(double[] array, double o) {
- ((WasmArray.OfDouble) asWasmArray(array)).push(o);
+ public static int getNewCapacity(int originalCapacity, int requestedCapacity) {
+ // Grow roughly with 1.5x rate at minimum.
+ int minCapacity = originalCapacity + (originalCapacity >> 1) + 1;
+ return Math.max(minCapacity, requestedCapacity);
}
public static void fill(int[] array, int value) {
@@ -183,19 +169,6 @@ public static void fill(T[] array, T value, int fromIndex, int toIndex) {
@Wasm("array.fill $java.lang.Object.array")
private static native void nativeFill(Object[] array, int offset, Object value, int size);
- public static void removeFrom(Object[] array, int index, int deleteCount) {
- // Copy the items after deletion end, overwriting deleted items.
- int copyFrom = index + deleteCount;
- copy(array, copyFrom, array, index, array.length - copyFrom);
- // Trim the end array.
- setLength(array, array.length - deleteCount);
- }
-
- public static void insertTo(Object[] array, int index, Object value) {
- ((WasmArray.OfObject) asWasmArray(array))
- .insertFrom(index, (WasmArray.OfObject) asWasmArray(new Object[] {value}));
- }
-
public static void copy(Object array, int srcOfs, Object dest, int destOfs, int len) {
asWasmArray(dest).copyFrom(destOfs, asWasmArray(array), srcOfs, len);
}
diff --git a/jre/java/super-wasm/javaemul/internal/wasmarray/OfType.java.template b/jre/java/super-wasm/javaemul/internal/wasmarray/OfType.java.template
index 36b7e8b25f..44b12e2af7 100644
--- a/jre/java/super-wasm/javaemul/internal/wasmarray/OfType.java.template
+++ b/jre/java/super-wasm/javaemul/internal/wasmarray/OfType.java.template
@@ -1,50 +1,20 @@
static class %ARRAY_TYPE_NAME% extends WasmArray {
- %TYPE_NAME%[] elements;
-
- %ARRAY_TYPE_NAME%(int length) {
- super(length);
+ static %ARRAY_TYPE_NAME% newWithLength(int length) {
// Do explicit construction of 0 length arrays because those are optimized to preallocated
// singletons.
- this.elements = (length == 0) ? new %TYPE_NAME%[0] : new %TYPE_NAME%[length];
+ return new %ARRAY_TYPE_NAME%((length == 0) ? new %TYPE_NAME%[0] : new %TYPE_NAME%[length]);
}
+ final %TYPE_NAME%[] elements;
+
%ARRAY_TYPE_NAME%(%TYPE_NAME%[] initialValues) {
- super(initialValues.length);
this.elements = initialValues;
}
@Override
Object newArray(int length) {
- return new WasmArray.%ARRAY_TYPE_NAME%(length);
- }
-
- @Override
- void setLength(int newLength) {
- ensureCapacity(newLength);
- if (newLength < length) {
- // Clear to outside contents
- for (int i = newLength; i < length; i++) {
- elements[i] = %DEFAULT_VALUE%;
- }
- }
- length = newLength;
- }
-
- public void push(%TYPE_NAME% o) {
- int newLength = length + 1;
- ensureCapacity(newLength);
- elements[length] = o;
- length = newLength;
- }
-
- private void ensureCapacity(int newLength) {
- %TYPE_NAME%[] original = elements;
- if (newLength > original.length) {
- // Not enough capacity, increase it.
- elements = new %TYPE_NAME%[getNewCapacity(length, newLength)];
- copy(elements, 0, original, 0, length);
- }
+ return newWithLength(length);
}
#IF OfByte OfShort OfInt OfLong OfChar OfFloat OfDouble
@@ -180,29 +150,4 @@
@JsMethod // Keep JsInteropRestrictionsChecker happy.
@Wasm("array.copy $%TYPE_NAME%.array $%TYPE_NAME%.array ")
private static native void copy(Object dest, int destOfs, Object src, int srcOfs, int len);
-
-#IF OfObject
- public void insertFrom(int insertIndex, WasmArray.%ARRAY_TYPE_NAME% values) {
- %TYPE_NAME%[] original = elements;
- int newLength = length + values.length;
-
- // Ensure enough capacity.
- if (newLength > elements.length) {
- elements = new %TYPE_NAME%[getNewCapacity(elements.length, newLength)];
- // Copy only up to index since the other will be moved anyway.
- copy(this.elements, 0, original, 0, insertIndex);
- }
-
- // Make room for the values that will be inserted by moving the existing elements to the
- // end so that they are not overwritten.
- int insertEndIndex = insertIndex + values.length;
- copy(this.elements, insertEndIndex, original, insertIndex, newLength - insertEndIndex);
-
- // Copy new values into the insert location.
- copy(this.elements, insertIndex, values.elements, 0, values.length);
-
- // Adjust the final size to cover all copied items
- length = newLength;
- }
-#ENDIF
}
diff --git a/jre/java/super-wasm/javaemul/internal/wasmarray/WasmArray.java.template b/jre/java/super-wasm/javaemul/internal/wasmarray/WasmArray.java.template
index 8f4ebd7b45..4b346eb423 100644
--- a/jre/java/super-wasm/javaemul/internal/wasmarray/WasmArray.java.template
+++ b/jre/java/super-wasm/javaemul/internal/wasmarray/WasmArray.java.template
@@ -13,22 +13,22 @@ import jsinterop.annotations.JsMethod;
*/
abstract class WasmArray implements Serializable, Cloneable {
- int length;
+ @Wasm("array")
+ private static interface ArrayRef { }
- protected WasmArray(int length) {
- this.length = length;
- }
+ // Special treated by compiler and merged with subtype's element field.
+ final ArrayRef elements = null;
public final int getLength() {
- return length;
+ return arrayLen(elements);
}
+ @Wasm("array.len")
+ private static final native int arrayLen(ArrayRef elements);
+
/** Create a new array of same type with given length. */
abstract Object newArray(int length);
- /** Change the length of the array. May resize storage if necessary. */
- abstract void setLength(int length);
-
abstract void copyFrom(int offset, WasmArray values, int valueOffset, int len);
/**
@@ -86,10 +86,4 @@ abstract class WasmArray implements Serializable, Cloneable {
}
%SUBTYPES%
-
- private static int getNewCapacity(int originalCapacity, int requestedCapacity) {
- // Grow roughly with 1.5x rate at minimum.
- int minCapacity = originalCapacity + (originalCapacity >> 1) + 1;
- return Math.max(minCapacity, requestedCapacity);
- }
}
diff --git a/transpiler/java/com/google/j2cl/transpiler/backend/wasm/WasmTypeLayout.java b/transpiler/java/com/google/j2cl/transpiler/backend/wasm/WasmTypeLayout.java
index 5fc941c5f3..22f659ae8b 100644
--- a/transpiler/java/com/google/j2cl/transpiler/backend/wasm/WasmTypeLayout.java
+++ b/transpiler/java/com/google/j2cl/transpiler/backend/wasm/WasmTypeLayout.java
@@ -13,45 +13,58 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-
package com.google.j2cl.transpiler.backend.wasm;
+import static com.google.common.base.Preconditions.checkState;
+
import com.google.auto.value.AutoValue;
import com.google.auto.value.extension.memoized.Memoized;
+import com.google.common.collect.ImmutableList;
import com.google.j2cl.transpiler.ast.DeclaredTypeDescriptor;
import com.google.j2cl.transpiler.ast.Field;
import com.google.j2cl.transpiler.ast.MethodDescriptor;
import com.google.j2cl.transpiler.ast.Type;
import com.google.j2cl.transpiler.ast.TypeDescriptors;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
+import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.annotation.Nullable;
/** Runtime representation of a Java class in Wasm. */
@AutoValue
abstract class WasmTypeLayout {
-
static WasmTypeLayout create(Type javaType, WasmTypeLayout wasmSupertypeLayout) {
return new AutoValue_WasmTypeLayout(javaType, wasmSupertypeLayout);
}
/** The Java class represented by this Wasm type. */
abstract Type getJavaType();
+
/** The wasm representation of the superclass for this Java class. */
@Nullable
abstract WasmTypeLayout getWasmSupertypeLayout();
/** Returns all the fields that will be in the layout for struct for the Java class. */
@Memoized
- Collection getAllInstanceFields() {
- Set instanceFields = new LinkedHashSet<>();
+ List getAllInstanceFields() {
+ List instanceFields = new ArrayList<>();
if (getWasmSupertypeLayout() != null) {
instanceFields.addAll(getWasmSupertypeLayout().getAllInstanceFields());
}
- instanceFields.addAll(getJavaType().getInstanceFields());
+ ImmutableList declaredInstanceFields = getJavaType().getInstanceFields();
+ if (TypeDescriptors.isWasmArraySubtype(getJavaType().getTypeDescriptor())) {
+ // TODO(b/296475021): Remove the hack to treat the field as overriden by subclass' field.
+ // Override the type of the elements field in Wasm arrays by replacing the WasmArray elements
+ // field with that of their subtype.
+ // Relies on the elements field being the last declared filed in WasmArray and also being
+ // the first in the WasmArray subclass.
+ checkState(declaredInstanceFields.get(0).getDescriptor().getName().equals("elements"));
+ Field removedField = instanceFields.remove(instanceFields.size() - 1);
+ checkState(removedField.getDescriptor().getName().equals("elements"));
+ }
+ instanceFields.addAll(declaredInstanceFields);
return instanceFields;
}
diff --git a/transpiler/java/com/google/j2cl/transpiler/passes/ImplementArraysAsClasses.java b/transpiler/java/com/google/j2cl/transpiler/passes/ImplementArraysAsClasses.java
index 9d0a8ae6f0..cf2d64ee18 100644
--- a/transpiler/java/com/google/j2cl/transpiler/passes/ImplementArraysAsClasses.java
+++ b/transpiler/java/com/google/j2cl/transpiler/passes/ImplementArraysAsClasses.java
@@ -184,9 +184,8 @@ public Node rewriteArrayLength(ArrayLength arrayLength) {
return arrayLength;
}
- return FieldAccess.Builder.from(
- TypeDescriptors.get().javaemulInternalWasmArray.getFieldDescriptor("length"))
- .setQualifier(arrayLength.getArrayExpression())
+ return ArrayLength.Builder.from(arrayLength)
+ .setArrayExpression(getInnerNativeArrayExpression(arrayLength.getArrayExpression()))
.build();
}
@@ -258,10 +257,9 @@ public Expression rewriteNewArray(NewArray newArray) {
checkState(newArray.getDimensionExpressions().size() == 1);
- return NewInstance.Builder.from(
+ return MethodCall.Builder.from(
TypeDescriptors.getWasmArrayType(newArray.getTypeDescriptor())
- .getMethodDescriptor(
- MethodDescriptor.CONSTRUCTOR_METHOD_NAME, PrimitiveTypes.INT))
+ .getMethodDescriptor("newWithLength", PrimitiveTypes.INT))
.setArguments(newArray.getDimensionExpressions().get(0))
.build();
}
diff --git a/transpiler/java/com/google/j2cl/transpiler/passes/NormalizeInstantiationThroughFactoryMethods.java b/transpiler/java/com/google/j2cl/transpiler/passes/NormalizeInstantiationThroughFactoryMethods.java
index 536d7ad627..d632e80439 100644
--- a/transpiler/java/com/google/j2cl/transpiler/passes/NormalizeInstantiationThroughFactoryMethods.java
+++ b/transpiler/java/com/google/j2cl/transpiler/passes/NormalizeInstantiationThroughFactoryMethods.java
@@ -1005,6 +1005,12 @@ private List getAllInstanceFields(TypeDeclaration typeDeclaration) {
superTypeDeclaration == null
? ImmutableList.of()
: getAllInstanceFields(superTypeDeclaration);
+ if (TypeDescriptors.isWasmArraySubtype(typeDeclaration.toUnparameterizedTypeDescriptor())) {
+ // Drop WasmArray.elements so that it does not get initialized since it will be merged later.
+ Field lastField = Iterables.getLast(superTypeFields);
+ checkState(lastField.getDescriptor().getName().equals("elements"));
+ superTypeFields = superTypeFields.subList(0, superTypeFields.size() - 1);
+ }
ImmutableList instanceFields =
ImmutableList.builder()
.addAll(superTypeFields)
diff --git a/transpiler/javatests/com/google/j2cl/integration/java/wasm/Main.java b/transpiler/javatests/com/google/j2cl/integration/java/wasm/Main.java
index 0e4f912938..a52ce020b6 100644
--- a/transpiler/javatests/com/google/j2cl/integration/java/wasm/Main.java
+++ b/transpiler/javatests/com/google/j2cl/integration/java/wasm/Main.java
@@ -19,7 +19,6 @@
import static com.google.j2cl.integration.testing.Asserts.assertFalse;
import static com.google.j2cl.integration.testing.Asserts.assertTrue;
-import javaemul.internal.ArrayHelper;
import javaemul.internal.annotations.Wasm;
import jsinterop.annotations.JsMethod;
@@ -36,7 +35,6 @@ public static void main(String... args) throws Exception {
testClassLiterals();
testArrayInstanceOf();
testArrayGetClass();
- testWasmArrayApis();
}
private static void testWasmAnnotation() {
@@ -143,28 +141,4 @@ private static void testArrayGetClass() {
assertEquals(Object[].class, objectArray.getClass());
assertEquals(Object.class, objectArray.getClass().getComponentType());
}
-
- private static void testWasmArrayApis() {
- Object[] array = new Object[0];
- ArrayHelper.push(array, "c");
- ArrayHelper.push(array, "d");
- assertEquals(array, new Object[] {"c", "d"});
-
- ArrayHelper.insertTo(array, 0, "a");
- assertEquals(array, new Object[] {"a", "c", "d"});
- ArrayHelper.insertTo(array, 1, "b");
- assertEquals(array, new Object[] {"a", "b", "c", "d"});
-
- ArrayHelper.removeFrom(array, 3, 1);
- ArrayHelper.removeFrom(array, 0, 1);
- assertEquals(array, new Object[] {"b", "c"});
-
- ArrayHelper.setLength(array, 5);
- assertEquals(array, new Object[] {"b", "c", null, null, null});
- ArrayHelper.setLength(array, 1);
- assertEquals(array, new Object[] {"b"});
-
- Object[] clone = ArrayHelper.clone(new Object[] {"a", "b"}, 0, 4);
- assertEquals(clone, new Object[] {"a", "b", null, null});
- }
}
diff --git a/transpiler/javatests/com/google/j2cl/readable/java/array/output_wasm/module.wat.txt b/transpiler/javatests/com/google/j2cl/readable/java/array/output_wasm/module.wat.txt
index 1968c4eb44..a256d9d2f0 100644
--- a/transpiler/javatests/com/google/j2cl/readable/java/array/output_wasm/module.wat.txt
+++ b/transpiler/javatests/com/google/j2cl/readable/java/array/output_wasm/module.wat.txt
@@ -244,9 +244,9 @@
(local.set $this (ref.cast (ref $array.Arrays) (local.get $this.untyped)))
(block
;;@ array/Arrays.java:27:4
- (local.set $objects (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 100)))
+ (local.set $objects (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 100)))
;;@ array/Arrays.java:28:4
- (local.set $objects (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 0)))
+ (local.set $objects (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 0)))
;;@ array/Arrays.java:29:4
(local.set $objects (call $$create__arrayOf_java_lang_Object@javaemul.internal.WasmArray.OfObject (array.init_static $java.lang.Object.array (ref.null $java.lang.Object)(ref.null $java.lang.Object))))
;;@ array/Arrays.java:30:4
@@ -281,9 +281,9 @@
(local.set $this (ref.cast (ref $array.Arrays) (local.get $this.untyped)))
(block
;;@ array/Arrays.java:48:4
- (local.set $objects (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 100)))
+ (local.set $objects (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 100)))
;;@ array/Arrays.java:49:4
- (local.set $objects (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 0)))
+ (local.set $objects (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 0)))
;;@ array/Arrays.java:50:4
(local.set $objects (call $$create__arrayOf_java_lang_Object@javaemul.internal.WasmArray.OfObject (array.init_static $java.lang.Object.array (ref.null $java.lang.Object)(ref.null $java.lang.Object))))
;;@ array/Arrays.java:51:4
@@ -318,9 +318,9 @@
(local.set $this (ref.cast (ref $array.Arrays) (local.get $this.untyped)))
(block
;;@ array/Arrays.java:66:4
- (local.set $ints (call $$create__int@javaemul.internal.WasmArray.OfInt (i32.const 100)))
+ (local.set $ints (call $m_newWithLength__int__javaemul_internal_WasmArray_OfInt@javaemul.internal.WasmArray.OfInt (i32.const 100)))
;;@ array/Arrays.java:67:4
- (local.set $ints (call $$create__int@javaemul.internal.WasmArray.OfInt (i32.const 0)))
+ (local.set $ints (call $m_newWithLength__int__javaemul_internal_WasmArray_OfInt@javaemul.internal.WasmArray.OfInt (i32.const 0)))
;;@ array/Arrays.java:68:4
(local.set $ints (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@array.Arrays-5 (i32.const 0) (i32.const 2))))
;;@ array/Arrays.java:69:4
@@ -342,11 +342,11 @@
;;@ array/Arrays.java:83:4
(local.set $c (i32.const 97))
;;@ array/Arrays.java:84:4
- (local.set $ints (call $$create__int@javaemul.internal.WasmArray.OfInt (local.get $b)))
+ (local.set $ints (call $m_newWithLength__int__javaemul_internal_WasmArray_OfInt@javaemul.internal.WasmArray.OfInt (local.get $b)))
;;@ array/Arrays.java:85:4
(array.set $int.array (struct.get $javaemul.internal.WasmArray.OfInt $f_elements__javaemul_internal_WasmArray_OfInt (local.get $ints)) (local.get $b) (local.get $b))
;;@ array/Arrays.java:86:4
- (local.set $ints (call $$create__int@javaemul.internal.WasmArray.OfInt (local.get $c)))
+ (local.set $ints (call $m_newWithLength__int__javaemul_internal_WasmArray_OfInt@javaemul.internal.WasmArray.OfInt (local.get $c)))
;;@ array/Arrays.java:87:4
(array.set $int.array (struct.get $javaemul.internal.WasmArray.OfInt $f_elements__javaemul_internal_WasmArray_OfInt (local.get $ints)) (local.get $c) (local.get $c))
;;@ array/Arrays.java:88:4
@@ -369,9 +369,9 @@
(local.set $this (ref.cast (ref $array.Arrays) (local.get $this.untyped)))
(block
;;@ array/Arrays.java:93:4
- (local.set $longs (call $$create__int@javaemul.internal.WasmArray.OfLong (i32.const 100)))
+ (local.set $longs (call $m_newWithLength__int__javaemul_internal_WasmArray_OfLong@javaemul.internal.WasmArray.OfLong (i32.const 100)))
;;@ array/Arrays.java:94:4
- (local.set $longs (call $$create__int@javaemul.internal.WasmArray.OfLong (i32.const 0)))
+ (local.set $longs (call $m_newWithLength__int__javaemul_internal_WasmArray_OfLong@javaemul.internal.WasmArray.OfLong (i32.const 0)))
;;@ array/Arrays.java:95:4
(local.set $longs (call $$create__arrayOf_long@javaemul.internal.WasmArray.OfLong (array.new_data $long.array $arrayliteral@array.Arrays-9 (i32.const 0) (i32.const 2))))
;;@ array/Arrays.java:96:4
@@ -393,11 +393,11 @@
;;@ array/Arrays.java:110:4
(local.set $c (i32.const 97))
;;@ array/Arrays.java:111:4
- (local.set $longs (call $$create__int@javaemul.internal.WasmArray.OfLong (local.get $b)))
+ (local.set $longs (call $m_newWithLength__int__javaemul_internal_WasmArray_OfLong@javaemul.internal.WasmArray.OfLong (local.get $b)))
;;@ array/Arrays.java:112:4
(array.set $long.array (struct.get $javaemul.internal.WasmArray.OfLong $f_elements__javaemul_internal_WasmArray_OfLong (local.get $longs)) (local.get $b) (i64.extend_i32_s (local.get $b)))
;;@ array/Arrays.java:113:4
- (local.set $longs (call $$create__int@javaemul.internal.WasmArray.OfLong (local.get $c)))
+ (local.set $longs (call $m_newWithLength__int__javaemul_internal_WasmArray_OfLong@javaemul.internal.WasmArray.OfLong (local.get $c)))
;;@ array/Arrays.java:114:4
(array.set $long.array (struct.get $javaemul.internal.WasmArray.OfLong $f_elements__javaemul_internal_WasmArray_OfLong (local.get $longs)) (local.get $c) (i64.extend_i32_u (local.get $c)))
;;@ array/Arrays.java:115:4
@@ -420,9 +420,9 @@
(local.set $this (ref.cast (ref $array.Arrays) (local.get $this.untyped)))
(block
;;@ array/Arrays.java:120:4
- (local.set $booleans (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 100)))
+ (local.set $booleans (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 100)))
;;@ array/Arrays.java:121:4
- (local.set $booleans (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 0)))
+ (local.set $booleans (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 0)))
;;@ array/Arrays.java:122:4
(local.set $booleans (call $$create__arrayOf_java_lang_Object@javaemul.internal.WasmArray.OfObject (array.init_static $java.lang.Object.array (call $m_valueOf__boolean__java_lang_Boolean@java.lang.Boolean (i32.const 1))(call $m_valueOf__boolean__java_lang_Boolean@java.lang.Boolean (i32.const 0)))))
;;@ array/Arrays.java:123:4
@@ -461,9 +461,9 @@
(local.set $this (ref.cast (ref $array.Arrays) (local.get $this.untyped)))
(block
;;@ array/Arrays.java:138:4
- (local.set $strings (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 100)))
+ (local.set $strings (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 100)))
;;@ array/Arrays.java:139:4
- (local.set $strings (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 0)))
+ (local.set $strings (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 0)))
;;@ array/Arrays.java:140:4
(local.set $strings (call $$create__arrayOf_java_lang_Object@javaemul.internal.WasmArray.OfObject (array.init_static $java.lang.Object.array (ref.null $java.lang.Object)(ref.null $java.lang.Object))))
;;@ array/Arrays.java:141:4
@@ -531,9 +531,9 @@
(local.set $this (ref.cast (ref $array.Arrays) (local.get $this.untyped)))
(block
;;@ array/Arrays.java:194:4
- (call_ref $function.m_consumesCloneable__java_lang_Cloneable__void (ref.as_non_null (local.get $this))(call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 10))(struct.get $array.Arrays.vtable $m_consumesCloneable__java_lang_Cloneable__void (struct.get $array.Arrays $vtable(local.get $this))))
+ (call_ref $function.m_consumesCloneable__java_lang_Cloneable__void (ref.as_non_null (local.get $this))(call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 10))(struct.get $array.Arrays.vtable $m_consumesCloneable__java_lang_Cloneable__void (struct.get $array.Arrays $vtable(local.get $this))))
;;@ array/Arrays.java:195:4
- (call_ref $function.m_consumesSerializable__java_io_Serializable__void (ref.as_non_null (local.get $this))(call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 10))(struct.get $array.Arrays.vtable $m_consumesSerializable__java_io_Serializable__void (struct.get $array.Arrays $vtable(local.get $this))))
+ (call_ref $function.m_consumesSerializable__java_io_Serializable__void (ref.as_non_null (local.get $this))(call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 10))(struct.get $array.Arrays.vtable $m_consumesSerializable__java_io_Serializable__void (struct.get $array.Arrays $vtable(local.get $this))))
)
)
(elem declare func $m_testArraysSupertypeClosureTypes__void@array.Arrays)
diff --git a/transpiler/javatests/com/google/j2cl/readable/java/autoboxing/output_wasm/module.wat.txt b/transpiler/javatests/com/google/j2cl/readable/java/autoboxing/output_wasm/module.wat.txt
index c58ac76657..af7b56c30f 100644
--- a/transpiler/javatests/com/google/j2cl/readable/java/autoboxing/output_wasm/module.wat.txt
+++ b/transpiler/javatests/com/google/j2cl/readable/java/autoboxing/output_wasm/module.wat.txt
@@ -563,7 +563,7 @@
(local.set $$index (i32.const 0))
(block $LOOP.BREAK
(loop
- (br_if 1 (i32.eqz (i32.lt_s (local.get $$index) (struct.get $javaemul.internal.WasmArray $f_length__javaemul_internal_WasmArray (local.get $$array)))))
+ (br_if 1 (i32.eqz (i32.lt_s (local.get $$index) (array.len (struct.get $javaemul.internal.WasmArray.OfObject $f_elements__javaemul_internal_WasmArray_OfObject (local.get $$array))))))
(block $LOOP.CONTINUE
(block
;;@ autoboxing/AutoBoxing.java:108:4
@@ -609,7 +609,7 @@
(local.set $$index (i32.const 0))
(block $LOOP.BREAK
(loop
- (br_if 1 (i32.eqz (i32.lt_s (local.get $$index) (struct.get $javaemul.internal.WasmArray $f_length__javaemul_internal_WasmArray (local.get $$array)))))
+ (br_if 1 (i32.eqz (i32.lt_s (local.get $$index) (array.len (struct.get $javaemul.internal.WasmArray.OfObject $f_elements__javaemul_internal_WasmArray_OfObject (local.get $$array))))))
(block $LOOP.CONTINUE
(block
;;@ autoboxing/AutoBoxing.java:117:4
diff --git a/transpiler/javatests/com/google/j2cl/readable/java/devirtualizedcalls/output_wasm/module.wat.txt b/transpiler/javatests/com/google/j2cl/readable/java/devirtualizedcalls/output_wasm/module.wat.txt
index e45ee7fb85..5d91b707cf 100644
--- a/transpiler/javatests/com/google/j2cl/readable/java/devirtualizedcalls/output_wasm/module.wat.txt
+++ b/transpiler/javatests/com/google/j2cl/readable/java/devirtualizedcalls/output_wasm/module.wat.txt
@@ -219,9 +219,9 @@
;;@ devirtualizedcalls/ArrayCalls.java:20:4
(local.set $array2d (call $m_createMultiDimensional__arrayOf_int__int__arrayOf_java_lang_Object@javaemul.internal.WasmArray (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@devirtualizedcalls.ArrayCalls-1 (i32.const 0) (i32.const 2)))(i32.const -1)))
;;@ devirtualizedcalls/ArrayCalls.java:22:4
- (local.set $length1 (struct.get $javaemul.internal.WasmArray $f_length__javaemul_internal_WasmArray (ref.cast (ref null $javaemul.internal.WasmArray.OfObject) (array.get $java.lang.Object.array (struct.get $javaemul.internal.WasmArray.OfObject $f_elements__javaemul_internal_WasmArray_OfObject (local.get $array2d)) (i32.const 0)))))
+ (local.set $length1 (array.len (struct.get $javaemul.internal.WasmArray.OfObject $f_elements__javaemul_internal_WasmArray_OfObject (ref.cast (ref null $javaemul.internal.WasmArray.OfObject) (array.get $java.lang.Object.array (struct.get $javaemul.internal.WasmArray.OfObject $f_elements__javaemul_internal_WasmArray_OfObject (local.get $array2d)) (i32.const 0))))))
;;@ devirtualizedcalls/ArrayCalls.java:23:4
- (local.set $length2 (struct.get $javaemul.internal.WasmArray $f_length__javaemul_internal_WasmArray (local.get $array2d)))
+ (local.set $length2 (array.len (struct.get $javaemul.internal.WasmArray.OfObject $f_elements__javaemul_internal_WasmArray_OfObject (local.get $array2d))))
)
)
(elem declare func $m_main__void@devirtualizedcalls.ArrayCalls)
@@ -752,7 +752,7 @@
;;@ devirtualizedcalls/ObjectCalls.java:26:4
(drop (call_ref $function.m_getClass__java_lang_Class (ref.as_non_null (local.get $object))(struct.get $java.lang.Object.vtable $m_getClass__java_lang_Class (struct.get $java.lang.Object $vtable(local.get $object)))))
;;@ devirtualizedcalls/ObjectCalls.java:28:4
- (local.set $objectCalls (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 1)))
+ (local.set $objectCalls (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 1)))
;;@ devirtualizedcalls/ObjectCalls.java:29:4
(drop (call_ref $function.m_equals__java_lang_Object__boolean (ref.as_non_null (local.get $objectCalls))(local.get $objectCalls)(struct.get $java.lang.Object.vtable $m_equals__java_lang_Object__boolean (struct.get $java.lang.Object $vtable(local.get $objectCalls)))))
;;@ devirtualizedcalls/ObjectCalls.java:30:4
diff --git a/transpiler/javatests/com/google/j2cl/readable/java/enums/output_wasm/module.wat.txt b/transpiler/javatests/com/google/j2cl/readable/java/enums/output_wasm/module.wat.txt
index 4318c7c5d3..bc7cb54f50 100644
--- a/transpiler/javatests/com/google/j2cl/readable/java/enums/output_wasm/module.wat.txt
+++ b/transpiler/javatests/com/google/j2cl/readable/java/enums/output_wasm/module.wat.txt
@@ -755,7 +755,7 @@
;;@ enums/Enum1.java:41:2
(struct.set $java.lang.Enum $f_ordinal__java_lang_Enum_ (local.get $this) (local.get $$ordinal))
;;@ enums/Enum1.java:42:4
- (call $$ctor__java_lang_String__int__int__void_$p_enums_Enum2@enums.Enum2 (ref.as_non_null (local.get $this))(local.get $$name)(local.get $$ordinal)(struct.get $javaemul.internal.WasmArray $f_length__javaemul_internal_WasmArray (local.get $somePars)))
+ (call $$ctor__java_lang_String__int__int__void_$p_enums_Enum2@enums.Enum2 (ref.as_non_null (local.get $this))(local.get $$name)(local.get $$ordinal)(array.len (struct.get $javaemul.internal.WasmArray.OfObject $f_elements__javaemul_internal_WasmArray_OfObject (local.get $somePars))))
)
)
@@ -796,7 +796,7 @@
(call_ref $function.m_ordinal__int (ref.as_non_null (local.get $$qualifier_1))(struct.get $java.lang.Enum.vtable $m_ordinal__int (struct.get $java.lang.Enum $vtable(local.get $$qualifier_1))))
))
;;@ enums/Enum1.java:54:4
- (local.set $l (struct.get $javaemul.internal.WasmArray $f_length__javaemul_internal_WasmArray (call $m_values__arrayOf_enums_Enum2@enums.Enum2 )))
+ (local.set $l (array.len (struct.get $javaemul.internal.WasmArray.OfObject $f_elements__javaemul_internal_WasmArray_OfObject (call $m_values__arrayOf_enums_Enum2@enums.Enum2 ))))
)
)
(elem declare func $m_specialMethods__void_$pp_enums@enums.Enum2)
diff --git a/transpiler/javatests/com/google/j2cl/readable/java/equality/output_wasm/module.wat.txt b/transpiler/javatests/com/google/j2cl/readable/java/equality/output_wasm/module.wat.txt
index c709376388..0f54d2358d 100644
--- a/transpiler/javatests/com/google/j2cl/readable/java/equality/output_wasm/module.wat.txt
+++ b/transpiler/javatests/com/google/j2cl/readable/java/equality/output_wasm/module.wat.txt
@@ -101,7 +101,7 @@
;;@ equality/Equality.java:44:6
(local.set $g (i32.eqz (ref.is_null (call $$create__@java.lang.Object ))))
;;@ equality/Equality.java:45:6
- (local.set $h (i32.eqz (ref.is_null (call $$create__int@javaemul.internal.WasmArray.OfInt (i32.const 0)))))
+ (local.set $h (i32.eqz (ref.is_null (call $m_newWithLength__int__javaemul_internal_WasmArray_OfInt@javaemul.internal.WasmArray.OfInt (i32.const 0)))))
)
)
)
diff --git a/transpiler/javatests/com/google/j2cl/readable/java/foreachstatement/output_wasm/module.wat.txt b/transpiler/javatests/com/google/j2cl/readable/java/foreachstatement/output_wasm/module.wat.txt
index dfefff1c8f..1a5dfe4039 100644
--- a/transpiler/javatests/com/google/j2cl/readable/java/foreachstatement/output_wasm/module.wat.txt
+++ b/transpiler/javatests/com/google/j2cl/readable/java/foreachstatement/output_wasm/module.wat.txt
@@ -348,11 +348,11 @@
)
)
;;@ foreachstatement/ForEachStatement.java:27:4
- (local.set $$array (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 10)))
+ (local.set $$array (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 10)))
(local.set $$index (i32.const 0))
(block $LOOP_1.BREAK
(loop
- (br_if 1 (i32.eqz (i32.lt_s (local.get $$index) (struct.get $javaemul.internal.WasmArray $f_length__javaemul_internal_WasmArray (local.get $$array)))))
+ (br_if 1 (i32.eqz (i32.lt_s (local.get $$index) (array.len (struct.get $javaemul.internal.WasmArray.OfObject $f_elements__javaemul_internal_WasmArray_OfObject (local.get $$array))))))
(block $LOOP_1.CONTINUE
(block
;;@ foreachstatement/ForEachStatement.java:27:4
diff --git a/transpiler/javatests/com/google/j2cl/readable/java/inferreturn/output_wasm/module.wat.txt b/transpiler/javatests/com/google/j2cl/readable/java/inferreturn/output_wasm/module.wat.txt
index 57ed6ca96b..3c26d67403 100644
--- a/transpiler/javatests/com/google/j2cl/readable/java/inferreturn/output_wasm/module.wat.txt
+++ b/transpiler/javatests/com/google/j2cl/readable/java/inferreturn/output_wasm/module.wat.txt
@@ -136,7 +136,7 @@
;;@ inferreturn/InferReturn.java:50:40
(call $$clinit__void@inferreturn.InferReturn )
;;@ inferreturn/InferReturn.java:51:4
- (return (ref.cast (ref null $javaemul.internal.WasmArray.OfObject) (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 0))))
+ (return (ref.cast (ref null $javaemul.internal.WasmArray.OfObject) (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 0))))
)
)
diff --git a/transpiler/javatests/com/google/j2cl/readable/java/innerclassinitorder/output_wasm/module.wat.txt b/transpiler/javatests/com/google/j2cl/readable/java/innerclassinitorder/output_wasm/module.wat.txt
index e9e0d314e0..1f2f0e3bad 100644
--- a/transpiler/javatests/com/google/j2cl/readable/java/innerclassinitorder/output_wasm/module.wat.txt
+++ b/transpiler/javatests/com/google/j2cl/readable/java/innerclassinitorder/output_wasm/module.wat.txt
@@ -1130,7 +1130,7 @@
(local.set $this (ref.cast (ref $innerclassinitorder.InnerClassInitOrder) (local.get $this.untyped)))
(block
;;@ innerclassinitorder/InnerClassInitOrder.java:230:4
- (local.set $results (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 10)))
+ (local.set $results (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 10)))
;;@ innerclassinitorder/InnerClassInitOrder.java:231:4
(local.set $i (i32.const 0))
(block $LOOP.BREAK
@@ -1153,7 +1153,7 @@
(local.set $$index (i32.const 0))
(block $LOOP_1.BREAK
(loop
- (br_if 1 (i32.eqz (i32.lt_s (local.get $$index) (struct.get $javaemul.internal.WasmArray $f_length__javaemul_internal_WasmArray (local.get $$array)))))
+ (br_if 1 (i32.eqz (i32.lt_s (local.get $$index) (array.len (struct.get $javaemul.internal.WasmArray.OfObject $f_elements__javaemul_internal_WasmArray_OfObject (local.get $$array))))))
(block $LOOP_1.CONTINUE
(block
;;@ innerclassinitorder/InnerClassInitOrder.java:240:4
diff --git a/transpiler/javatests/com/google/j2cl/readable/java/instanceofexpression/output_wasm/module.wat.txt b/transpiler/javatests/com/google/j2cl/readable/java/instanceofexpression/output_wasm/module.wat.txt
index ba6eb29242..53618ba9c6 100644
--- a/transpiler/javatests/com/google/j2cl/readable/java/instanceofexpression/output_wasm/module.wat.txt
+++ b/transpiler/javatests/com/google/j2cl/readable/java/instanceofexpression/output_wasm/module.wat.txt
@@ -244,11 +244,11 @@
;;@ instanceofexpression/InstanceofExpressions.java:57:4
(local.set $object (call $$create__@java.lang.Object ))
;;@ instanceofexpression/InstanceofExpressions.java:58:4
- (local.set $objectArray (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 0)))
+ (local.set $objectArray (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 0)))
;;@ instanceofexpression/InstanceofExpressions.java:59:4
(local.set $objectDoubleArray (call $m_createMultiDimensional__arrayOf_int__int__arrayOf_java_lang_Object@javaemul.internal.WasmArray (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@instanceofexpression.InstanceofExpressions-1 (i32.const 0) (i32.const 2)))(i32.const -1)))
;;@ instanceofexpression/InstanceofExpressions.java:60:4
- (local.set $stringArray (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 0)))
+ (local.set $stringArray (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 0)))
;;@ instanceofexpression/InstanceofExpressions.java:62:4
;;@ instanceofexpression/InstanceofExpressions.java:63:4
diff --git a/transpiler/javatests/com/google/j2cl/readable/java/methodreferences/output_wasm/module.wat.txt b/transpiler/javatests/com/google/j2cl/readable/java/methodreferences/output_wasm/module.wat.txt
index b01169bd38..623e35e3bc 100644
--- a/transpiler/javatests/com/google/j2cl/readable/java/methodreferences/output_wasm/module.wat.txt
+++ b/transpiler/javatests/com/google/j2cl/readable/java/methodreferences/output_wasm/module.wat.txt
@@ -2804,7 +2804,7 @@
(local.set $this (ref.cast (ref $methodreferences.MethodReferences.$LambdaImplementor$9) (local.get $this.untyped)))
(block
;;@ methodreferences/MethodReferences.java:99:42
- (return (call $$create__int@javaemul.internal.WasmArray.OfObject (local.get $arg0)))
+ (return (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (local.get $arg0)))
)
)
(elem declare func $m_produce__int__arrayOf_java_lang_Object@methodreferences.MethodReferences.$LambdaImplementor$9)
@@ -3117,7 +3117,7 @@
;;@ methodreferences/MethodReferences.java:105:47
(local.set $arg0_1 (ref.cast (ref null $java.lang.Integer) (local.get $arg0)))
;;@ methodreferences/MethodReferences.java:105:47
- (return (call $$create__int@javaemul.internal.WasmArray.OfObject (call_ref $function.m_intValue__int (ref.as_non_null (local.get $arg0_1))(struct.get $java.lang.Integer.vtable $m_intValue__int (struct.get $java.lang.Integer $vtable(local.get $arg0_1))))))
+ (return (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (call_ref $function.m_intValue__int (ref.as_non_null (local.get $arg0_1))(struct.get $java.lang.Integer.vtable $m_intValue__int (struct.get $java.lang.Integer $vtable(local.get $arg0_1))))))
)
)
(elem declare func $m_apply__java_lang_Object__java_lang_Object@methodreferences.MethodReferences.$LambdaImplementor$12)
@@ -3735,7 +3735,7 @@
;;@ methodreferences/MethodReferences.java:116:60
(local.set $arg0_1 (ref.cast (ref null $java.lang.Integer) (local.get $arg0)))
;;@ methodreferences/MethodReferences.java:116:60
- (return (call $$create__int@javaemul.internal.WasmArray.OfObject (call_ref $function.m_intValue__int (ref.as_non_null (local.get $arg0_1))(struct.get $java.lang.Integer.vtable $m_intValue__int (struct.get $java.lang.Integer $vtable(local.get $arg0_1))))))
+ (return (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (call_ref $function.m_intValue__int (ref.as_non_null (local.get $arg0_1))(struct.get $java.lang.Integer.vtable $m_intValue__int (struct.get $java.lang.Integer $vtable(local.get $arg0_1))))))
)
)
(elem declare func $m_apply__java_lang_Object__java_lang_Object@methodreferences.MethodReferences.$LambdaImplementor$18)
diff --git a/transpiler/javatests/com/google/j2cl/readable/java/nullability/output_wasm/module.wat.txt b/transpiler/javatests/com/google/j2cl/readable/java/nullability/output_wasm/module.wat.txt
index bcb74bd8b3..a7d8ece4e8 100644
--- a/transpiler/javatests/com/google/j2cl/readable/java/nullability/output_wasm/module.wat.txt
+++ b/transpiler/javatests/com/google/j2cl/readable/java/nullability/output_wasm/module.wat.txt
@@ -8807,7 +8807,7 @@
(local.set $this (ref.cast (ref $nullability.defaultnullable.DefaultNullable.$LambdaImplementor$3) (local.get $this.untyped)))
(block
;;@ nullability/defaultnullable/DefaultNullable.java:361:56
- (return (call $$create__int@javaemul.internal.WasmArray.OfObject (local.get $arg0)))
+ (return (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (local.get $arg0)))
)
)
(elem declare func $m_accept__int__java_lang_Object@nullability.defaultnullable.DefaultNullable.$LambdaImplementor$3)
@@ -10305,13 +10305,13 @@
;;@ nullability/explicitnotnullable/ExplicitNotNullable.java:57:2
(struct.set $nullability.explicitnotnullable.ExplicitNotNullable $f_f26__nullability_explicitnotnullable_ExplicitNotNullable_ (local.get $this) (call $$create__arrayOf_java_lang_Object@javaemul.internal.WasmArray.OfObject (array.init_static $java.lang.Object.array )))
;;@ nullability/explicitnotnullable/ExplicitNotNullable.java:59:2
- (struct.set $nullability.explicitnotnullable.ExplicitNotNullable $f_f27__nullability_explicitnotnullable_ExplicitNotNullable_ (local.get $this) (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 1)))
+ (struct.set $nullability.explicitnotnullable.ExplicitNotNullable $f_f27__nullability_explicitnotnullable_ExplicitNotNullable_ (local.get $this) (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 1)))
;;@ nullability/explicitnotnullable/ExplicitNotNullable.java:60:2
- (struct.set $nullability.explicitnotnullable.ExplicitNotNullable $f_f28__nullability_explicitnotnullable_ExplicitNotNullable_ (local.get $this) (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 1)))
+ (struct.set $nullability.explicitnotnullable.ExplicitNotNullable $f_f28__nullability_explicitnotnullable_ExplicitNotNullable_ (local.get $this) (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 1)))
;;@ nullability/explicitnotnullable/ExplicitNotNullable.java:61:2
- (struct.set $nullability.explicitnotnullable.ExplicitNotNullable $f_f29__nullability_explicitnotnullable_ExplicitNotNullable_ (local.get $this) (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 1)))
+ (struct.set $nullability.explicitnotnullable.ExplicitNotNullable $f_f29__nullability_explicitnotnullable_ExplicitNotNullable_ (local.get $this) (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 1)))
;;@ nullability/explicitnotnullable/ExplicitNotNullable.java:62:2
- (struct.set $nullability.explicitnotnullable.ExplicitNotNullable $f_f30__nullability_explicitnotnullable_ExplicitNotNullable_ (local.get $this) (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 1)))
+ (struct.set $nullability.explicitnotnullable.ExplicitNotNullable $f_f30__nullability_explicitnotnullable_ExplicitNotNullable_ (local.get $this) (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 1)))
;;@ nullability/explicitnotnullable/ExplicitNotNullable.java:392:2
(struct.set $nullability.explicitnotnullable.ExplicitNotNullable $f_i__nullability_explicitnotnullable_ExplicitNotNullable (local.get $this) (call $$create__nullability_explicitnotnullable_ExplicitNotNullable@nullability.explicitnotnullable.ExplicitNotNullable.1 (local.get $this)))
)
@@ -11021,7 +11021,7 @@
(local.set $this (ref.cast (ref $nullability.explicitnotnullable.ExplicitNotNullable.$LambdaImplementor$5) (local.get $this.untyped)))
(block
;;@ nullability/explicitnotnullable/ExplicitNotNullable.java:368:37
- (return (call $$create__int@javaemul.internal.WasmArray.OfObject (local.get $arg0)))
+ (return (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (local.get $arg0)))
)
)
(elem declare func $m_accept__int__java_lang_Object@nullability.explicitnotnullable.ExplicitNotNullable.$LambdaImplementor$5)
diff --git a/transpiler/javatests/com/google/j2cl/readable/java/wasmimmutablefields/output_wasm/module.wat.txt b/transpiler/javatests/com/google/j2cl/readable/java/wasmimmutablefields/output_wasm/module.wat.txt
index 21a509a13f..a1e65d1449 100644
--- a/transpiler/javatests/com/google/j2cl/readable/java/wasmimmutablefields/output_wasm/module.wat.txt
+++ b/transpiler/javatests/com/google/j2cl/readable/java/wasmimmutablefields/output_wasm/module.wat.txt
@@ -21,12 +21,12 @@
(field $f_$systemIdentityHashCode__java_lang_Object (mut i32))
(field $f_compileTimeConstant__wasmimmutablefields_AssignmentsInDeclaration i32)
(field $f_stringLiteral__wasmimmutablefields_AssignmentsInDeclaration (ref null $java.lang.String))
- (field $f_newArray__wasmimmutablefields_AssignmentsInDeclaration (ref null $javaemul.internal.WasmArray.OfObject))
+ (field $f_newArray__wasmimmutablefields_AssignmentsInDeclaration (mut (ref null $javaemul.internal.WasmArray.OfObject)))
(field $f_newArrayMultidimensional__wasmimmutablefields_AssignmentsInDeclaration (ref null $javaemul.internal.WasmArray.OfObject))
(field $f_arrayLiteral__wasmimmutablefields_AssignmentsInDeclaration (ref null $javaemul.internal.WasmArray.OfInt))
(field $f_arrayLiteralMultidimensional__wasmimmutablefields_AssignmentsInDeclaration (ref null $javaemul.internal.WasmArray.OfObject))
(field $f_classLiteral__wasmimmutablefields_AssignmentsInDeclaration (ref null $java.lang.Class))
- (field $f_withCast__wasmimmutablefields_AssignmentsInDeclaration (ref null $javaemul.internal.WasmArray.OfObject))
+ (field $f_withCast__wasmimmutablefields_AssignmentsInDeclaration (mut (ref null $javaemul.internal.WasmArray.OfObject)))
))
)
(type $wasmimmutablefields.AssignmentsInDeclaration.vtable (sub $java.lang.Object.vtable (struct
@@ -45,12 +45,12 @@
(field $f_$systemIdentityHashCode__java_lang_Object (mut i32))
(field $f_compileTimeConstant__wasmimmutablefields_AssignmentsInInitializer i32)
(field $f_stringLiteral__wasmimmutablefields_AssignmentsInInitializer (ref null $java.lang.String))
- (field $f_newArray__wasmimmutablefields_AssignmentsInInitializer (ref null $javaemul.internal.WasmArray.OfObject))
+ (field $f_newArray__wasmimmutablefields_AssignmentsInInitializer (mut (ref null $javaemul.internal.WasmArray.OfObject)))
(field $f_newArrayMultidimensional__wasmimmutablefields_AssignmentsInInitializer (ref null $javaemul.internal.WasmArray.OfObject))
(field $f_arrayLiteral__wasmimmutablefields_AssignmentsInInitializer (ref null $javaemul.internal.WasmArray.OfInt))
(field $f_arrayLiteralMultidimensional__wasmimmutablefields_AssignmentsInInitializer (ref null $javaemul.internal.WasmArray.OfObject))
(field $f_classLiteral__wasmimmutablefields_AssignmentsInInitializer (ref null $java.lang.Class))
- (field $f_withCast__wasmimmutablefields_AssignmentsInInitializer (ref null $javaemul.internal.WasmArray.OfObject))
+ (field $f_withCast__wasmimmutablefields_AssignmentsInInitializer (mut (ref null $javaemul.internal.WasmArray.OfObject)))
))
)
(type $wasmimmutablefields.AssignmentsInInitializer.vtable (sub $java.lang.Object.vtable (struct
@@ -69,12 +69,12 @@
(field $f_$systemIdentityHashCode__java_lang_Object (mut i32))
(field $f_compileTimeConstant__wasmimmutablefields_AssignmentsInConstructor i32)
(field $f_stringLiteral__wasmimmutablefields_AssignmentsInConstructor (ref null $java.lang.String))
- (field $f_newArray__wasmimmutablefields_AssignmentsInConstructor (ref null $javaemul.internal.WasmArray.OfObject))
+ (field $f_newArray__wasmimmutablefields_AssignmentsInConstructor (mut (ref null $javaemul.internal.WasmArray.OfObject)))
(field $f_newArrayMultidimensional__wasmimmutablefields_AssignmentsInConstructor (ref null $javaemul.internal.WasmArray.OfObject))
(field $f_arrayLiteral__wasmimmutablefields_AssignmentsInConstructor (ref null $javaemul.internal.WasmArray.OfInt))
(field $f_arrayLiteralMultidimensional__wasmimmutablefields_AssignmentsInConstructor (ref null $javaemul.internal.WasmArray.OfObject))
(field $f_classLiteral__wasmimmutablefields_AssignmentsInConstructor (ref null $java.lang.Class))
- (field $f_withCast__wasmimmutablefields_AssignmentsInConstructor (ref null $javaemul.internal.WasmArray.OfObject))
+ (field $f_withCast__wasmimmutablefields_AssignmentsInConstructor (mut (ref null $javaemul.internal.WasmArray.OfObject)))
(field $f_fromParameter__wasmimmutablefields_AssignmentsInConstructor (ref null $java.lang.Object))
(field $f_finalFieldReference__wasmimmutablefields_AssignmentsInConstructor (ref null $java.lang.String))
))
@@ -359,7 +359,7 @@
(local $$instance (ref null $wasmimmutablefields.AssignmentsInDeclaration))
(block
;;@ wasmimmutablefields/WasmImmutableFields.java:20:6
- (local.set $$instance (struct.new $wasmimmutablefields.AssignmentsInDeclaration (ref.as_non_null (global.get $wasmimmutablefields.AssignmentsInDeclaration.vtable)) (ref.as_non_null (global.get $itable.empty)) (i32.const 0) (i32.const 12) (call $function.no.side.effects.$getString_|Hello_World|__java_lang_String (ref.func $$getString_|Hello_World|__java_lang_String@wasmimmutablefields.AssignmentsInDeclaration) ) (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 4)) (call $m_createMultiDimensional__arrayOf_int__int__arrayOf_java_lang_Object@javaemul.internal.WasmArray (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInDeclaration-1 (i32.const 0) (i32.const 3)))(i32.const -1)) (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInDeclaration-2 (i32.const 0) (i32.const 4))) (call $$create__arrayOf_java_lang_Object@javaemul.internal.WasmArray.OfObject (array.init_static $java.lang.Object.array (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInDeclaration-3 (i32.const 0) (i32.const 2)))(call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInDeclaration-4 (i32.const 0) (i32.const 2))))) (call $function.no.side.effects.$getClassMetadata__java_lang_Class (ref.func $$getClassMetadata__java_lang_Class@wasmimmutablefields.WasmImmutableFields) ) (ref.cast (ref null $javaemul.internal.WasmArray.OfObject) (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 0)))))
+ (local.set $$instance (struct.new $wasmimmutablefields.AssignmentsInDeclaration (ref.as_non_null (global.get $wasmimmutablefields.AssignmentsInDeclaration.vtable)) (ref.as_non_null (global.get $itable.empty)) (i32.const 0) (i32.const 12) (call $function.no.side.effects.$getString_|Hello_World|__java_lang_String (ref.func $$getString_|Hello_World|__java_lang_String@wasmimmutablefields.AssignmentsInDeclaration) ) (ref.null $javaemul.internal.WasmArray.OfObject) (call $m_createMultiDimensional__arrayOf_int__int__arrayOf_java_lang_Object@javaemul.internal.WasmArray (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInDeclaration-1 (i32.const 0) (i32.const 3)))(i32.const -1)) (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInDeclaration-2 (i32.const 0) (i32.const 4))) (call $$create__arrayOf_java_lang_Object@javaemul.internal.WasmArray.OfObject (array.init_static $java.lang.Object.array (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInDeclaration-3 (i32.const 0) (i32.const 2)))(call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInDeclaration-4 (i32.const 0) (i32.const 2))))) (call $function.no.side.effects.$getClassMetadata__java_lang_Class (ref.func $$getClassMetadata__java_lang_Class@wasmimmutablefields.WasmImmutableFields) ) (ref.null $javaemul.internal.WasmArray.OfObject)))
;;@ wasmimmutablefields/WasmImmutableFields.java:20:6
(call $$ctor__void_$p_wasmimmutablefields_AssignmentsInDeclaration@wasmimmutablefields.AssignmentsInDeclaration (ref.as_non_null (local.get $$instance)))
;;@ wasmimmutablefields/WasmImmutableFields.java:20:6
@@ -386,6 +386,10 @@
(param $this (ref null $wasmimmutablefields.AssignmentsInDeclaration))
;;@ wasmimmutablefields/WasmImmutableFields.java:20:6
(block
+ ;;@ wasmimmutablefields/WasmImmutableFields.java:23:2
+ (struct.set $wasmimmutablefields.AssignmentsInDeclaration $f_newArray__wasmimmutablefields_AssignmentsInDeclaration (local.get $this) (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 4)))
+ ;;@ wasmimmutablefields/WasmImmutableFields.java:28:2
+ (struct.set $wasmimmutablefields.AssignmentsInDeclaration $f_withCast__wasmimmutablefields_AssignmentsInDeclaration (local.get $this) (ref.cast (ref null $javaemul.internal.WasmArray.OfObject) (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 0))))
)
)
@@ -468,7 +472,7 @@
(local $$instance (ref null $wasmimmutablefields.AssignmentsInInitializer))
(block
;;@ wasmimmutablefields/WasmImmutableFields.java:31:6
- (local.set $$instance (struct.new $wasmimmutablefields.AssignmentsInInitializer (ref.as_non_null (global.get $wasmimmutablefields.AssignmentsInInitializer.vtable)) (ref.as_non_null (global.get $itable.empty)) (i32.const 0) (i32.const 12) (call $function.no.side.effects.$getString_|Hello_World|__java_lang_String (ref.func $$getString_|Hello_World|__java_lang_String@wasmimmutablefields.AssignmentsInDeclaration) ) (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 4)) (call $m_createMultiDimensional__arrayOf_int__int__arrayOf_java_lang_Object@javaemul.internal.WasmArray (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInInitializer-1 (i32.const 0) (i32.const 3)))(i32.const -1)) (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInInitializer-2 (i32.const 0) (i32.const 4))) (call $$create__arrayOf_java_lang_Object@javaemul.internal.WasmArray.OfObject (array.init_static $java.lang.Object.array (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInInitializer-3 (i32.const 0) (i32.const 2)))(call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInInitializer-4 (i32.const 0) (i32.const 2))))) (call $function.no.side.effects.$getClassMetadata__java_lang_Class (ref.func $$getClassMetadata__java_lang_Class@wasmimmutablefields.WasmImmutableFields) ) (ref.cast (ref null $javaemul.internal.WasmArray.OfObject) (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 0)))))
+ (local.set $$instance (struct.new $wasmimmutablefields.AssignmentsInInitializer (ref.as_non_null (global.get $wasmimmutablefields.AssignmentsInInitializer.vtable)) (ref.as_non_null (global.get $itable.empty)) (i32.const 0) (i32.const 12) (call $function.no.side.effects.$getString_|Hello_World|__java_lang_String (ref.func $$getString_|Hello_World|__java_lang_String@wasmimmutablefields.AssignmentsInDeclaration) ) (ref.null $javaemul.internal.WasmArray.OfObject) (call $m_createMultiDimensional__arrayOf_int__int__arrayOf_java_lang_Object@javaemul.internal.WasmArray (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInInitializer-1 (i32.const 0) (i32.const 3)))(i32.const -1)) (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInInitializer-2 (i32.const 0) (i32.const 4))) (call $$create__arrayOf_java_lang_Object@javaemul.internal.WasmArray.OfObject (array.init_static $java.lang.Object.array (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInInitializer-3 (i32.const 0) (i32.const 2)))(call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInInitializer-4 (i32.const 0) (i32.const 2))))) (call $function.no.side.effects.$getClassMetadata__java_lang_Class (ref.func $$getClassMetadata__java_lang_Class@wasmimmutablefields.WasmImmutableFields) ) (ref.null $javaemul.internal.WasmArray.OfObject)))
;;@ wasmimmutablefields/WasmImmutableFields.java:31:6
(call $$ctor__void_$p_wasmimmutablefields_AssignmentsInInitializer@wasmimmutablefields.AssignmentsInInitializer (ref.as_non_null (local.get $$instance)))
;;@ wasmimmutablefields/WasmImmutableFields.java:31:6
@@ -495,6 +499,10 @@
(param $this (ref null $wasmimmutablefields.AssignmentsInInitializer))
;;@ wasmimmutablefields/WasmImmutableFields.java:31:6
(block
+ ;;@ wasmimmutablefields/WasmImmutableFields.java:44:4
+ (struct.set $wasmimmutablefields.AssignmentsInInitializer $f_newArray__wasmimmutablefields_AssignmentsInInitializer (local.get $this) (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 4)))
+ ;;@ wasmimmutablefields/WasmImmutableFields.java:49:4
+ (struct.set $wasmimmutablefields.AssignmentsInInitializer $f_withCast__wasmimmutablefields_AssignmentsInInitializer (local.get $this) (ref.cast (ref null $javaemul.internal.WasmArray.OfObject) (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 0))))
)
)
@@ -567,7 +575,7 @@
(local $$instance (ref null $wasmimmutablefields.AssignmentsInConstructor))
(block
;;@ wasmimmutablefields/WasmImmutableFields.java:65:2
- (local.set $$instance (struct.new $wasmimmutablefields.AssignmentsInConstructor (ref.as_non_null (global.get $wasmimmutablefields.AssignmentsInConstructor.vtable)) (ref.as_non_null (global.get $itable.empty)) (i32.const 0) (i32.const 12) (call $function.no.side.effects.$getString_|Hello_World|__java_lang_String (ref.func $$getString_|Hello_World|__java_lang_String@wasmimmutablefields.AssignmentsInDeclaration) ) (call $$create__int@javaemul.internal.WasmArray.OfObject (local.get $intParameter)) (call $m_createMultiDimensional__arrayOf_int__int__arrayOf_java_lang_Object@javaemul.internal.WasmArray (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.init_static $int.array (local.get $intParameter)(i32.const 4)(i32.const -1)))(i32.const -1)) (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.init_static $int.array (i32.const 1)(i32.const 2)(local.get $intParameter)(i32.const 4))) (call $$create__arrayOf_java_lang_Object@javaemul.internal.WasmArray.OfObject (array.init_static $java.lang.Object.array (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.init_static $int.array (i32.const 1)(local.get $intParameter)))(call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInConstructor-1 (i32.const 0) (i32.const 2))))) (call $function.no.side.effects.$getClassMetadata__java_lang_Class (ref.func $$getClassMetadata__java_lang_Class@wasmimmutablefields.WasmImmutableFields) ) (ref.cast (ref null $javaemul.internal.WasmArray.OfObject) (call $$create__int@javaemul.internal.WasmArray.OfObject (i32.const 0))) (local.get $parameter) (struct.get $wasmimmutablefields.AssignmentsInConstructor $f_stringLiteral__wasmimmutablefields_AssignmentsInConstructor (local.get $par))))
+ (local.set $$instance (struct.new $wasmimmutablefields.AssignmentsInConstructor (ref.as_non_null (global.get $wasmimmutablefields.AssignmentsInConstructor.vtable)) (ref.as_non_null (global.get $itable.empty)) (i32.const 0) (i32.const 12) (call $function.no.side.effects.$getString_|Hello_World|__java_lang_String (ref.func $$getString_|Hello_World|__java_lang_String@wasmimmutablefields.AssignmentsInDeclaration) ) (ref.null $javaemul.internal.WasmArray.OfObject) (call $m_createMultiDimensional__arrayOf_int__int__arrayOf_java_lang_Object@javaemul.internal.WasmArray (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.init_static $int.array (local.get $intParameter)(i32.const 4)(i32.const -1)))(i32.const -1)) (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.init_static $int.array (i32.const 1)(i32.const 2)(local.get $intParameter)(i32.const 4))) (call $$create__arrayOf_java_lang_Object@javaemul.internal.WasmArray.OfObject (array.init_static $java.lang.Object.array (call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.init_static $int.array (i32.const 1)(local.get $intParameter)))(call $$create__arrayOf_int@javaemul.internal.WasmArray.OfInt (array.new_data $int.array $arrayliteral@wasmimmutablefields.AssignmentsInConstructor-1 (i32.const 0) (i32.const 2))))) (call $function.no.side.effects.$getClassMetadata__java_lang_Class (ref.func $$getClassMetadata__java_lang_Class@wasmimmutablefields.WasmImmutableFields) ) (ref.null $javaemul.internal.WasmArray.OfObject) (local.get $parameter) (struct.get $wasmimmutablefields.AssignmentsInConstructor $f_stringLiteral__wasmimmutablefields_AssignmentsInConstructor (local.get $par))))
;;@ wasmimmutablefields/WasmImmutableFields.java:65:2
(call $$ctor__java_lang_Object__int__wasmimmutablefields_AssignmentsInConstructor__void_$p_wasmimmutablefields_AssignmentsInConstructor@wasmimmutablefields.AssignmentsInConstructor (ref.as_non_null (local.get $$instance))(local.get $parameter)(local.get $intParameter)(local.get $par))
;;@ wasmimmutablefields/WasmImmutableFields.java:65:2
@@ -587,6 +595,10 @@
(call $$clinit__void@wasmimmutablefields.AssignmentsInConstructor )
;;@ wasmimmutablefields/WasmImmutableFields.java:65:93
(call $$ctor__void_$p_java_lang_Object@java.lang.Object (ref.as_non_null (local.get $this)))
+ ;;@ wasmimmutablefields/WasmImmutableFields.java:68:4
+ (struct.set $wasmimmutablefields.AssignmentsInConstructor $f_newArray__wasmimmutablefields_AssignmentsInConstructor (local.get $this) (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (local.get $intParameter)))
+ ;;@ wasmimmutablefields/WasmImmutableFields.java:73:4
+ (struct.set $wasmimmutablefields.AssignmentsInConstructor $f_withCast__wasmimmutablefields_AssignmentsInConstructor (local.get $this) (ref.cast (ref null $javaemul.internal.WasmArray.OfObject) (call $m_newWithLength__int__javaemul_internal_WasmArray_OfObject@javaemul.internal.WasmArray.OfObject (i32.const 0))))
)
)