Fix libmini targets and filters.
[mono.git] / mono / mini / aot-runtime-wasm.c
index 4fb8906941cb2debcb65916bc9beb051db1101a0..f50c59da1426efac09e863dd2c7655575b2b9c7b 100644 (file)
@@ -196,6 +196,15 @@ wasm_invoke_iiiiii (void *target_func, InterpMethodArguments *margs)
        *(int*)margs->retval = res;
 }
 
+static void
+wasm_invoke_iiiiiiiii (void *target_func, InterpMethodArguments *margs)
+{
+       int (*func)(gpointer a, gpointer b, gpointer c, gpointer d, gpointer e, gpointer f, gpointer g, gpointer h) = target_func;
+       int res = func (margs->iargs [0], margs->iargs [1], margs->iargs [2], margs->iargs [3], margs->iargs [4], margs->iargs [5], margs->iargs [6], margs->iargs [7]);
+       *(int*)margs->retval = res;
+}
+
+
 typedef union {
        gint64 l;
        struct {
@@ -204,6 +213,15 @@ typedef union {
        } pair;
 } interp_pair;
 
+static void
+wasm_invoke_l (void *target_func, InterpMethodArguments *margs)
+{
+       gint64 (*func)(void) = target_func;
+
+       gint64 res = func ();
+       *(gint64*)margs->retval = res;
+}
+
 static void
 wasm_invoke_ll (void *target_func, InterpMethodArguments *margs)
 {
@@ -303,6 +321,15 @@ wasm_invoke_vifffffi (void *target_func, InterpMethodArguments *margs)
                *(float*)&margs->iargs [1]);
 }
 
+static void
+wasm_invoke_ff (void *target_func, InterpMethodArguments *margs)
+{
+       float (*func)(float a) = target_func;
+
+       float res = func (*(float*)&margs->fargs [FIDX (0)]);
+       *(float*)margs->retval = res;
+}
+
 static void
 wasm_enter_icall_trampoline (void *target_func, InterpMethodArguments *margs)
 {
@@ -345,6 +372,10 @@ wasm_enter_icall_trampoline (void *target_func, InterpMethodArguments *margs)
                wasm_invoke_iiiii (target_func, margs);
        else if (!strcmp ("IIIIII", cookie))
                wasm_invoke_iiiiii (target_func, margs);
+       else if (!strcmp ("IIIIIIIII", cookie))
+               wasm_invoke_iiiiiiiii (target_func, margs);
+       else if (!strcmp ("L", cookie))
+               wasm_invoke_l (target_func, margs);
        else if (!strcmp ("LL", cookie))
                wasm_invoke_ll (target_func, margs);
        else if (!strcmp ("LI", cookie))
@@ -363,6 +394,8 @@ wasm_enter_icall_trampoline (void *target_func, InterpMethodArguments *margs)
                wasm_invoke_viffff (target_func, margs);
        else if (!strcmp ("VIFFFFFI", cookie))
                wasm_invoke_vifffffi (target_func, margs);
+       else if (!strcmp ("FF", cookie))
+               wasm_invoke_ff (target_func, margs);
        else {
                printf ("CANNOT HANDLE COOKIE %s\n", cookie);
                g_assert (0);
@@ -405,4 +438,8 @@ mono_aot_get_trampoline_full (const char *name, MonoTrampInfo **out_tinfo)
 
        return code;
 }
-#endif
+#else /* TARGET_WASM */
+
+MONO_EMPTY_SOURCE_FILE (aot_runtime_wasm);
+
+#endif /* TARGET_WASM */