Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / mini / mini-wasm.c
1 #include "mini.h"
2
3
4 gpointer
5 mono_arch_get_this_arg_from_call (mgreg_t *regs, guint8 *code)
6 {
7         g_error ("mono_arch_get_this_arg_from_call");
8 }
9
10 gpointer
11 mono_arch_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod *method, int offset, gboolean load_imt_reg)
12 {
13         g_error ("mono_arch_get_delegate_virtual_invoke_impl");
14 }
15
16
17 void
18 mono_arch_cpu_init (void)
19 {
20         // printf ("mono_arch_cpu_init\n");
21 }
22
23 void
24 mono_arch_finish_init (void)
25 {
26         // printf ("mono_arch_finish_init\n");
27 }
28
29 void
30 mono_arch_init (void)
31 {
32         // printf ("mono_arch_init\n");
33 }
34
35 void
36 mono_arch_cleanup (void)
37 {
38 }
39
40 void
41 mono_arch_register_lowlevel_calls (void)
42 {
43 }
44
45 void
46 mono_arch_flush_register_windows (void)
47 {
48 }
49
50 void
51 mono_arch_free_jit_tls_data (MonoJitTlsData *tls)
52 {
53 }
54
55
56 MonoMethod*
57 mono_arch_find_imt_method (mgreg_t *regs, guint8 *code)
58 {
59         g_error ("mono_arch_find_static_call_vtable");
60         return (MonoMethod*) regs [MONO_ARCH_IMT_REG];
61 }
62
63 MonoVTable*
64 mono_arch_find_static_call_vtable (mgreg_t *regs, guint8 *code)
65 {
66         g_error ("mono_arch_find_static_call_vtable");
67         return (MonoVTable*) regs [MONO_ARCH_RGCTX_REG];
68 }
69
70 gpointer
71 mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp)
72 {
73         g_error ("mono_arch_build_imt_trampoline");
74 }
75
76 guint32
77 mono_arch_cpu_enumerate_simd_versions (void)
78 {
79         return 0;
80 }
81
82 guint32
83 mono_arch_cpu_optimizations (guint32 *exclude_mask)
84 {
85         return 0;
86 }
87
88 GSList*
89 mono_arch_get_delegate_invoke_impls (void)
90 {
91         g_error ("mono_arch_get_delegate_invoke_impls");
92         return NULL;
93 }
94
95 gpointer
96 mono_arch_get_delegate_invoke_impl (MonoMethodSignature *sig, gboolean has_target)
97 {
98         g_error ("mono_arch_get_delegate_invoke_impl");
99         return NULL;
100 }
101
102 mgreg_t
103 mono_arch_context_get_int_reg (MonoContext *ctx, int reg)
104 {
105         g_error ("mono_arch_context_get_int_reg");
106         return 0;
107 }
108
109 int
110 mono_arch_get_argument_info (MonoMethodSignature *csig, int param_count, MonoJitArgumentInfo *arg_info)
111 {
112         g_error ("mono_arch_get_argument_info");
113         return 0;
114
115 }
116
117 void
118 mono_arch_init_lmf_ext (MonoLMFExt *ext, gpointer prev_lmf)
119 {
120         ext->lmf.previous_lmf = (gsize)prev_lmf;
121         /* Mark that this is a MonoLMFExt */
122         ext->lmf.previous_lmf = (gsize)(gpointer)(((gssize)ext->lmf.previous_lmf) | 2);
123 }
124
125
126
127 void
128 mono_runtime_setup_stat_profiler (void)
129 {
130         g_error ("mono_runtime_setup_stat_profiler");
131 }
132
133
134 void
135 mono_runtime_shutdown_stat_profiler (void)
136 {
137         g_error ("mono_runtime_shutdown_stat_profiler");
138 }
139
140
141 gboolean
142 MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal)
143 {
144         g_error ("mono_chain_signal");
145         
146         return FALSE;
147 }
148
149 void
150 mono_runtime_install_handlers (void)
151 {
152 }
153
154 void
155 mono_runtime_cleanup_handlers (void)
156 {
157 }
158
159 gboolean
160 mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo *info)
161 {
162         g_error ("WASM systems don't support mono_thread_state_init_from_handle");
163         return FALSE;
164 }
165
166
167 /*
168 The following functions don't belong here, but are due to laziness.
169 */
170
171 //w32file-wasm.c
172 gboolean
173 mono_w32file_get_volume_information (const gunichar2 *path, gunichar2 *volumename, gint volumesize, gint *outserial, gint *maxcomp, gint *fsflags, gunichar2 *fsbuffer, gint fsbuffersize)
174 {
175         g_error ("mono_w32file_get_volume_information");
176 }
177
178
179 //llvm builtin's that we should not have used in the first place
180
181
182 //libc / libpthread missing bits from musl or shit we didn't detect :facepalm:
183 int pthread_getschedparam (pthread_t thread, int *policy, struct sched_param *param)
184 {
185         g_error ("pthread_getschedparam");
186         return 0;
187 }
188
189 int
190 pthread_attr_getstacksize (const pthread_attr_t *restrict attr, size_t *restrict stacksize)
191 {
192         return 65536; //wasm page size
193 }
194
195 int
196 pthread_sigmask (int how, const sigset_t * restrict set, sigset_t * restrict oset)
197 {
198         return 0;
199 }
200
201
202 int
203 sigsuspend(const sigset_t *sigmask)
204 {
205         g_error ("sigsuspend");
206         return 0;
207 }
208
209 int
210 getdtablesize (void)
211 {
212         return 256; //random constant that is the fd limit
213 }
214
215 void *
216 getgrnam (const char *name)
217 {
218         return NULL;
219 }
220
221 void *
222 getgrgid (gid_t gid)
223 {
224         return NULL;
225 }
226
227 int
228 inotify_init (void)
229 {
230         g_error ("inotify_init");
231 }
232
233 int
234 inotify_rm_watch (int fd, int wd)
235 {
236         g_error ("inotify_rm_watch");
237         return 0;
238 }
239
240 int
241 inotify_add_watch (int fd, const char *pathname, uint32_t mask)
242 {
243         g_error ("inotify_add_watch");
244         return 0;
245 }
246
247 int
248 sem_timedwait (sem_t *sem, const struct timespec *abs_timeout)
249 {
250         g_error ("sem_timedwait");
251         return 0;
252         
253 }