diff --git a/src/de/inetsoftware/jwebassembly/javascript/NonGC.java b/src/de/inetsoftware/jwebassembly/javascript/NonGC.java index c5056de..8630506 100644 --- a/src/de/inetsoftware/jwebassembly/javascript/NonGC.java +++ b/src/de/inetsoftware/jwebassembly/javascript/NonGC.java @@ -25,89 +25,6 @@ import de.inetsoftware.jwebassembly.api.annotation.Import; */ public abstract class NonGC { - @Import( js = "(l) => new Uint8Array(l)" ) - native static byte[] array_new_i8( int length ); - - @Import( js = "(l) => new Int16Array(l)" ) - native static short[] array_new_i16( int length ); - - @Import( js = "(l) => new Int32Array(l)" ) - native static int[] array_new_i32( int length ); - - @Import( js = "(l) => Object.seal(new Array(l).fill(0n))" ) - native static long[] array_new_i64( int length ); - - @Import( js = "(l) => new Float32Array(l)" ) - native static float[] array_new_f32( int length ); - - @Import( js = "(l) => new Float64Array(l)" ) - native static double[] array_new_f64( int length ); - - @Import( js = "(l) => Object.seal(new Array(l).fill(null))" ) - native static Object[] array_new_externref( int length ); - - @Import( js = "(a) => a.length" ) - native static int array_len_i8( Object array ); - - @Import( js = "(a) => a.length" ) - native static int array_len_i16( Object array ); - - @Import( js = "(a) => a.length" ) - native static int array_len_i32( Object array ); - - @Import( js = "(a) => a.length" ) - native static int array_len_i64( Object array ); - - @Import( js = "(a) => a.length" ) - native static int array_len_f32( Object array ); - - @Import( js = "(a) => a.length" ) - native static int array_len_f64( Object array ); - - @Import( js = "(a) => a.length" ) - native static int array_len_externref( Object array ); - - @Import( js = "(a,i,v) => a[i]=v" ) - native static void array_set_i8( byte[] array, int idx, byte value ); - - @Import( js = "(a,i,v) => a[i]=v" ) - native static void array_set_i16( short[] array, int idx, short value ); - - @Import( js = "(a,i,v) => a[i]=v" ) - native static void array_set_i32( int[] array, int idx, int value ); - - @Import( js = "(a,i,v) => a[i]=v" ) - native static void array_set_i64( long[] array, int idx, long value ); - - @Import( js = "(a,i,v) => a[i]=v" ) - native static void array_set_f32( float[] array, int idx, float value ); - - @Import( js = "(a,i,v) => a[i]=v" ) - native static void array_set_f64( double[] array, int idx, double value ); - - @Import( js = "(a,i,v) => a[i]=v" ) - native static void array_set_externref( Object[] array, int idx, Object value ); - - @Import( js = "(a,i) => a[i]" ) - native static byte array_get_i8( byte[] array, int idx ); - - @Import( js = "(a,i) => a[i]" ) - native static short array_get_i16( short[] array, int idx ); - - @Import( js = "(a,i) => a[i]" ) - native static int array_get_i32( int[] array, int idx ); - - @Import( js = "(a,i) => a[i]" ) - native static long array_get_i64( long[] array, int idx ); - - @Import( js = "(a,i) => a[i]" ) - native static float array_get_f32( float[] array, int idx ); - - @Import( js = "(a,i) => a[i]" ) - native static double array_get_f64( double[] array, int idx ); - - @Import( js = "(a,i) => a[i]" ) - native static Object array_get_externref( Object[] array, int idx ); @Import( js = "(a,b) => a === b" ) native static int ref_eq( Object a, Object b ); diff --git a/src/de/inetsoftware/jwebassembly/module/WasmArrayInstruction.java b/src/de/inetsoftware/jwebassembly/module/WasmArrayInstruction.java index 578d4a9..c0349f9 100644 --- a/src/de/inetsoftware/jwebassembly/module/WasmArrayInstruction.java +++ b/src/de/inetsoftware/jwebassembly/module/WasmArrayInstruction.java @@ -101,7 +101,7 @@ class WasmArrayInstruction extends WasmInstruction { } } ArrayType arrayType = types.arrayType( type ); - functionName = new JavaScriptSyntheticFunctionName( "NonGC_", "array_new_" + validJsName( type ), () -> { + functionName = new JavaScriptSyntheticFunctionName( "NonGC", "array_new_" + validJsName( type ), () -> { // create the default values of a new type return new StringBuilder( "(l)=>Object.seal({0:" ) // fix count of elements .append( arrayType.getVTable() ) // .vtable @@ -112,13 +112,13 @@ class WasmArrayInstruction extends WasmInstruction { }, ValueType.i32, null, ValueType.externref ); break; case GET: - functionName = new JavaScriptSyntheticFunctionName( "NonGC_", "array_get_" + validJsName( functionType ), () -> "(a,i)=>a[2][i]", ValueType.externref, ValueType.i32, null, functionType ); + functionName = new JavaScriptSyntheticFunctionName( "NonGC", "array_get_" + validJsName( functionType ), () -> "(a,i)=>a[2][i]", ValueType.externref, ValueType.i32, null, functionType ); break; case SET: - functionName = new JavaScriptSyntheticFunctionName( "NonGC_", "array_set_" + validJsName( functionType ), () -> "(a,i,v)=>a[2][i]=v", ValueType.externref, ValueType.i32, functionType, null, null ); + functionName = new JavaScriptSyntheticFunctionName( "NonGC", "array_set_" + validJsName( functionType ), () -> "(a,i,v)=>a[2][i]=v", ValueType.externref, ValueType.i32, functionType, null, null ); break; case LEN: - functionName = new JavaScriptSyntheticFunctionName( "NonGC_", "array_len", () -> "(a)=>a[2].length", ValueType.externref, null, ValueType.i32 ); + functionName = new JavaScriptSyntheticFunctionName( "NonGC", "array_len", () -> "(a)=>a[2].length", ValueType.externref, null, ValueType.i32 ); break; } return functionName;