mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
wasm gc: fix conversion of multidimensional arrays from JS
This commit is contained in:
parent
0bd7bc6ca9
commit
2aabddc32d
|
@ -34,6 +34,7 @@ import org.teavm.model.ReferenceCache;
|
||||||
import org.teavm.model.TextLocation;
|
import org.teavm.model.TextLocation;
|
||||||
import org.teavm.model.ValueType;
|
import org.teavm.model.ValueType;
|
||||||
import org.teavm.model.Variable;
|
import org.teavm.model.Variable;
|
||||||
|
import org.teavm.model.instructions.CastInstruction;
|
||||||
import org.teavm.model.instructions.ClassConstantInstruction;
|
import org.teavm.model.instructions.ClassConstantInstruction;
|
||||||
import org.teavm.model.instructions.InvocationType;
|
import org.teavm.model.instructions.InvocationType;
|
||||||
import org.teavm.model.instructions.InvokeInstruction;
|
import org.teavm.model.instructions.InvokeInstruction;
|
||||||
|
@ -472,11 +473,19 @@ class JSValueMarshaller {
|
||||||
insn = new InvokeInstruction();
|
insn = new InvokeInstruction();
|
||||||
insn.setMethod(JSMethods.UNMAP_ARRAY);
|
insn.setMethod(JSMethods.UNMAP_ARRAY);
|
||||||
insn.setArguments(cls, var, function);
|
insn.setArguments(cls, var, function);
|
||||||
insn.setReceiver(var);
|
insn.setReceiver(program.createVariable());
|
||||||
insn.setType(InvocationType.SPECIAL);
|
insn.setType(InvocationType.SPECIAL);
|
||||||
insn.setLocation(location.getSourceLocation());
|
insn.setLocation(location.getSourceLocation());
|
||||||
replacement.add(insn);
|
replacement.add(insn);
|
||||||
|
|
||||||
|
var cast = new CastInstruction();
|
||||||
|
cast.setTargetType(ValueType.arrayOf(ValueType.arrayOf(type)));
|
||||||
|
cast.setWeak(true);
|
||||||
|
cast.setValue(insn.getReceiver());
|
||||||
|
cast.setReceiver(var);
|
||||||
|
cast.setLocation(location.getSourceLocation());
|
||||||
|
replacement.add(cast);
|
||||||
|
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,6 @@ public class ConversionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SkipPlatform(TestPlatform.WEBASSEMBLY_GC)
|
|
||||||
public void convertsPrimitiveArraysToJava() {
|
public void convertsPrimitiveArraysToJava() {
|
||||||
PrimitiveArrays arrays = getPrimitiveArrays();
|
PrimitiveArrays arrays = getPrimitiveArrays();
|
||||||
|
|
||||||
|
@ -90,7 +89,6 @@ public class ConversionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SkipPlatform(TestPlatform.WEBASSEMBLY_GC)
|
|
||||||
public void convertsPrimitiveArrays2ToJava() {
|
public void convertsPrimitiveArrays2ToJava() {
|
||||||
PrimitiveArrays2 arrays = getPrimitiveArrays2();
|
PrimitiveArrays2 arrays = getPrimitiveArrays2();
|
||||||
|
|
||||||
|
@ -117,7 +115,6 @@ public class ConversionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SkipPlatform(TestPlatform.WEBASSEMBLY_GC)
|
|
||||||
public void convertsPrimitiveArrays4ToJava() {
|
public void convertsPrimitiveArrays4ToJava() {
|
||||||
PrimitiveArrays4 arrays = getPrimitiveArrays4();
|
PrimitiveArrays4 arrays = getPrimitiveArrays4();
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.teavm.jso.JSProperty;
|
||||||
import org.teavm.junit.EachTestCompiledSeparately;
|
import org.teavm.junit.EachTestCompiledSeparately;
|
||||||
import org.teavm.junit.OnlyPlatform;
|
import org.teavm.junit.OnlyPlatform;
|
||||||
import org.teavm.junit.SkipJVM;
|
import org.teavm.junit.SkipJVM;
|
||||||
import org.teavm.junit.SkipPlatform;
|
|
||||||
import org.teavm.junit.TeaVMTestRunner;
|
import org.teavm.junit.TeaVMTestRunner;
|
||||||
import org.teavm.junit.TestPlatform;
|
import org.teavm.junit.TestPlatform;
|
||||||
|
|
||||||
|
@ -90,7 +89,6 @@ public class FunctorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SkipPlatform(TestPlatform.WEBASSEMBLY_GC)
|
|
||||||
public void castToFunctor() {
|
public void castToFunctor() {
|
||||||
JSBiFunction f = getBiFunctionAsObject().cast();
|
JSBiFunction f = getBiFunctionAsObject().cast();
|
||||||
assertEquals(23042, f.foo(23, 42));
|
assertEquals(23042, f.foo(23, 42));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user