[mini] Add skeleton WebAssembly mini backend. It's not functional and some code needs...
[mono.git] / mono / mini / aot-runtime-wasm.c
1 /**
2  * \file
3  * WASM AOT runtime
4  */
5
6 #include "config.h"
7
8 #include <sys/types.h>
9
10 #include "mini.h"
11 #include "interp/interp.h"
12
13 #ifdef TARGET_WASM
14
15 static void
16 wasm_restore_context (void)
17 {
18         g_error ("wasm_restore_context");
19 }
20
21 static void
22 wasm_call_filter (void)
23 {
24         g_error ("wasm_call_filter");
25 }
26
27 static void
28 wasm_throw_exception (void)
29 {
30         g_error ("wasm_throw_exception");
31 }
32
33 static void
34 wasm_rethrow_exception (void)
35 {
36         g_error ("wasm_rethrow_exception");
37 }
38
39 static void
40 wasm_throw_corlib_exception (void)
41 {
42         g_error ("wasm_throw_corlib_exception");
43 }
44
45 static void
46 wasm_enter_icall_trampoline (void *target_func, InterpMethodArguments *margs)
47 {
48         g_error ("wasm_enter_icall_trampoline");
49         
50 }
51
52 gpointer
53 mono_aot_get_trampoline_full (const char *name, MonoTrampInfo **out_tinfo)
54 {
55         gpointer code = NULL;
56
57         if (!strcmp (name, "restore_context"))
58                 code = wasm_restore_context;
59         else if (!strcmp (name, "call_filter"))
60                 code = wasm_call_filter;
61         else if (!strcmp (name, "throw_exception"))
62                 code = wasm_throw_exception;
63         else if (!strcmp (name, "rethrow_exception"))
64                 code = wasm_rethrow_exception;
65         else if (!strcmp (name, "throw_corlib_exception"))
66                 code = wasm_throw_corlib_exception;
67         else if (!strcmp (name, "enter_icall_trampoline"))
68                 code = wasm_enter_icall_trampoline;
69
70         g_assert (code);
71
72         if (out_tinfo) {
73                 MonoTrampInfo *tinfo = g_new0 (MonoTrampInfo, 1);
74                 tinfo->code = code;
75                 tinfo->code_size = 1;
76                 tinfo->name = g_strdup (name);
77                 tinfo->ji = NULL;
78                 tinfo->unwind_ops = NULL;
79                 tinfo->uw_info = NULL;
80                 tinfo->uw_info_len = 0;
81                 tinfo->owns_uw_info = FALSE;
82
83                 *out_tinfo = tinfo;
84         }
85
86         return code;
87 }
88 #endif