More WASM fixes, with this I can get half of the mini test suite to run without crashing.
MonoObjectHandle current_appdomain_delegate = MONO_HANDLE_NEW (MonoObject, NULL);
MonoClass *klass = mono_handle_class (exc);
- if (mono_class_has_parent (klass, mono_defaults.threadabortexception_class))
+ /*
+ * AppDomainUnloadedException don't behave like unhandled exceptions unless thrown from
+ * a thread started in unmanaged world.
+ * https://msdn.microsoft.com/en-us/library/system.appdomainunloadedexception(v=vs.110).aspx#Anchor_6
+ */
+ if (klass == mono_defaults.threadabortexception_class ||
+ (klass == mono_class_get_appdomain_unloaded_exception_class () &&
+ mono_thread_info_current ()->runtime_thread))
return;
field = mono_class_get_field_from_name (mono_defaults.appdomain_class, "UnhandledException");
static MonoObject*
mono_runtime_capture_context (MonoDomain *domain, MonoError *error)
{
+ #ifdef HOST_WASM
+ return mono_runtime_invoke_checked (mono_get_context_capture_method (), NULL, NULL, error);
+ #else
MONO_REQ_GC_UNSAFE_MODE;
RuntimeInvokeFunction runtime_invoke;
runtime_invoke = (RuntimeInvokeFunction)domain->capture_context_runtime_invoke;
return runtime_invoke (NULL, NULL, NULL, domain->capture_context_method);
+ #endif
}
/**
* mono_async_result_new:
klass.rank = 1;
klass.instance_size = MONO_SIZEOF_MONO_ARRAY;
klass.sizes.element_size = 1;
+ klass.size_inited = 1;
klass.name = "array_filler_type";
vtable->klass = &klass;
tid = mono_thread_info_get_tid (p);
- if (p->client_info.info.runtime_thread)
- mono_threads_add_joinable_thread ((gpointer)tid);
+ mono_threads_add_joinable_runtime_thread (&p->client_info.info);
if (mono_gc_get_gc_callbacks ()->thread_detach_func) {
mono_gc_get_gc_callbacks ()->thread_detach_func (p->client_info.runtime_data);
{
scan_area_arg_start = start_nursery;
scan_area_arg_end = end_nursery;
+ #ifdef HOST_WASM
+ //Under WASM we don't scan thread stacks and we can't trust the values we find there either.
+ return;
+ #endif
FOREACH_THREAD (info) {
int skip_reason = 0;
int i;
gboolean val = FALSE;
+ if (m->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD) {
+ MonoDynamicMethod *dm = (MonoDynamicMethod *)m;
+ if (dm->assembly)
+ ass = dm->assembly;
+ }
g_assert (ass);
if (ass->wrap_non_exception_throws_inited)
return ass->wrap_non_exception_throws;
if (mono_ex->trace_ips) {
GList *trace_ips = NULL;
- gpointer ip = RETURN_ADDRESS ();
+ gpointer ip = MONO_RETURN_ADDRESS ();
size_t upper = mono_array_length (mono_ex->trace_ips);
g_free (jit_tls);*/
if ((mono_runtime_unhandled_exception_policy_get () == MONO_UNHANDLED_POLICY_LEGACY) ||
- (obj->vtable->klass == mono_defaults.threadabortexception_class)) {
+ (obj->vtable->klass == mono_defaults.threadabortexception_class) ||
+ ((obj->vtable->klass) == mono_class_get_appdomain_unloaded_exception_class () &&
+ mono_thread_info_current ()->runtime_thread)) {
mono_thread_exit ();
} else {
mono_invoke_unhandled_exception_hook (obj);
if (mono_class_is_contextbound (method->klass) || !info->compiled_method)
supported = FALSE;
- if (supported)
+ if (supported) {
info->dyn_call_info = mono_arch_dyn_call_prepare (sig);
+ if (debug_options.dyn_runtime_invoke)
+ g_assert (info->dyn_call_info);
+ }
}
#endif
MonoMethodSignature *sig = mono_method_signature (method);
gpointer *args;
static RuntimeInvokeDynamicFunction dyn_runtime_invoke;
- int i, pindex;
- guint8 buf [512];
+ int i, pindex, buf_size;
+ guint8 *buf;
guint8 retval [256];
if (!dyn_runtime_invoke) {
//printf ("M: %s\n", mono_method_full_name (method, TRUE));
- mono_arch_start_dyn_call (info->dyn_call_info, (gpointer**)args, retval, buf, sizeof (buf));
+ buf_size = mono_arch_dyn_call_get_buf_size (info->dyn_call_info);
+ buf = g_alloca (buf_size);
+ g_assert (buf);
+
+ mono_arch_start_dyn_call (info->dyn_call_info, (gpointer**)args, retval, buf);
dyn_runtime_invoke (buf, exc, info->compiled_method);
mono_arch_finish_dyn_call (info->dyn_call_info, buf);
void
mini_init_delegate (MonoDelegate *del)
{
- if (mono_llvm_only)
- del->extra_arg = mini_get_delegate_arg (del->method, del->method_ptr);
#ifdef ENABLE_INTERPRETER
if (mono_use_interpreter)
mono_interp_init_delegate (del);
+ else
#endif
+ if (mono_llvm_only)
+ del->extra_arg = mini_get_delegate_arg (del->method, del->method_ptr);
}
char*
extern int mono_break_at_bb_bb_num;
extern gboolean mono_verify_all;
extern gboolean mono_do_x86_stack_align;
-extern const char *mono_build_date;
+extern MONO_API const char *mono_build_date;
extern gboolean mono_do_signal_chaining;
extern gboolean mono_do_crash_chaining;
extern MONO_API gboolean mono_use_llvm;
void mono_arch_emit_setret (MonoCompile *cfg, MonoMethod *method, MonoInst *val);
MonoDynCallInfo *mono_arch_dyn_call_prepare (MonoMethodSignature *sig);
void mono_arch_dyn_call_free (MonoDynCallInfo *info);
-void mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, guint8 *buf, int buf_len);
+int mono_arch_dyn_call_get_buf_size (MonoDynCallInfo *info);
+void mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, guint8 *buf);
void mono_arch_finish_dyn_call (MonoDynCallInfo *info, guint8 *buf);
MonoInst *mono_arch_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args);
void mono_arch_decompose_opts (MonoCompile *cfg, MonoInst *ins);
#if defined (HOST_WASM)
- #define RETURN_ADDRESS_N(N) NULL
- #define RETURN_ADDRESS() RETURN_ADDRESS_N(0)
+ #define MONO_RETURN_ADDRESS_N(N) NULL
+ #define MONO_RETURN_ADDRESS() MONO_RETURN_ADDRESS_N(0)
#elif defined (__GNUC__)
- #define RETURN_ADDRESS_N(N) (__builtin_extract_return_addr (__builtin_return_address (N)))
- #define RETURN_ADDRESS() RETURN_ADDRESS_N(0)
+ #define MONO_RETURN_ADDRESS_N(N) (__builtin_extract_return_addr (__builtin_return_address (N)))
+ #define MONO_RETURN_ADDRESS() MONO_RETURN_ADDRESS_N(0)
#elif defined(_MSC_VER)
#include <intrin.h>
#pragma intrinsic(_ReturnAddress)
- #define RETURN_ADDRESS() _ReturnAddress()
- #define RETURN_ADDRESS_N(N) NULL
+ #define MONO_RETURN_ADDRESS() _ReturnAddress()
+ #define MONO_RETURN_ADDRESS_N(N) NULL
#else