#include <math.h>
#include <sys/time.h>
-#ifdef sun // Solaris x86
-#include <sys/types.h>
-#include <sys/ucontext.h>
-#endif
-
#ifdef HAVE_VALGRIND_MEMCHECK_H
#include <valgrind/memcheck.h>
#endif
if (!(cfg->opt & MONO_OPT_SHARED)) {
vtable = mono_class_vtable (cfg->domain, method->klass);
if (method->klass->flags & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT) {
- if (cfg->run_cctors)
+ if (cfg->run_cctors) {
+ /* This makes so that inline cannot trigger */
+ /* .cctors: too many apps depend on them */
+ /* running with a specific order... */
+ if (! vtable->initialized)
+ return FALSE;
mono_runtime_class_init (vtable);
+ }
}
else if (!vtable->initialized && mono_class_needs_cctor_run (method->klass, NULL))
return FALSE;
dont_verify |= method->wrapper_type == MONO_WRAPPER_XDOMAIN_INVOKE;
dont_verify |= method->wrapper_type == MONO_WRAPPER_XDOMAIN_DISPATCH;
dont_verify |= method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE; /* bug #77896 */
+ dont_verify |= method->wrapper_type == MONO_WRAPPER_COMINTEROP;
- /* still some type unsefety issues in marshal wrappers... (unknown is PtrToStructure) */
+ /* still some type unsafety issues in marshal wrappers... (unknown is PtrToStructure) */
dont_verify_stloc = method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE;
dont_verify_stloc |= method->wrapper_type == MONO_WRAPPER_UNKNOWN;
dont_verify_stloc |= method->wrapper_type == MONO_WRAPPER_NATIVE_TO_MANAGED;
}
ip += 5;
+ ins_flag = 0;
break;
}
if ((ins_flag & MONO_INST_TAILCALL) && cmethod && (*ip == CEE_CALL) &&
(mono_metadata_signature_equal (mono_method_signature (method), mono_method_signature (cmethod)))) {
int i;
+
/* Prevent inlining of methods with tail calls (the call stack would be altered) */
INLINE_FAILURE;
/* FIXME: This assumes the two methods has the same number and type of arguments */
}
ip += 5;
+ ins_flag = 0;
break;
}
bblock = ebblock;
inline_costs += costs;
+ ins_flag = 0;
break;
}
}
ip += 6;
else
ip += 5;
-
+ ins_flag = 0;
break;
}
}
}
ip += 5;
+ ins_flag = 0;
break;
}
case CEE_RET:
g_print ("class %s.%s needs init call for %s\n", klass->name_space, klass->name, field->name);
class_inits = g_slist_prepend (class_inits, vtable);
} else {
- if (cfg->run_cctors)
+ if (cfg->run_cctors) {
+ /* This makes so that inline cannot trigger */
+ /* .cctors: too many apps depend on them */
+ /* running with a specific order... */
+ if (! vtable->initialized)
+ INLINE_FAILURE;
mono_runtime_class_init (vtable);
+ }
}
addr = (char*)vtable->data + field->offset;
}
}
+/**
+ * mono_patch_info_dup_mp:
+ *
+ * Make a copy of PATCH_INFO, allocating memory from the mempool MP.
+ */
+MonoJumpInfo*
+mono_patch_info_dup_mp (MonoMemPool *mp, MonoJumpInfo *patch_info)
+{
+ MonoJumpInfo *res = mono_mempool_alloc (mp, sizeof (MonoJumpInfo));
+ memcpy (res, patch_info, sizeof (MonoJumpInfo));
+
+ switch (patch_info->type) {
+ case MONO_PATCH_INFO_LDSTR:
+ case MONO_PATCH_INFO_TYPE_FROM_HANDLE:
+ case MONO_PATCH_INFO_LDTOKEN:
+ case MONO_PATCH_INFO_DECLSEC:
+ res->data.token = mono_mempool_alloc (mp, sizeof (MonoJumpInfoToken));
+ memcpy (res->data.token, patch_info->data.token, sizeof (MonoJumpInfoToken));
+ break;
+ case MONO_PATCH_INFO_SWITCH:
+ res->data.table = mono_mempool_alloc (mp, sizeof (MonoJumpInfoBBTable));
+ memcpy (res->data.table, patch_info->data.table, sizeof (MonoJumpInfoBBTable));
+ break;
+ default:
+ break;
+ }
+
+ return res;
+}
+
gpointer
mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors)
{
MonoMethod *nm;
MonoMethodPInvoke* piinfo = (MonoMethodPInvoke *) method;
- if (method->iflags & METHOD_IMPL_ATTRIBUTE_NATIVE)
+ if (method->iflags & METHOD_IMPL_ATTRIBUTE_NATIVE && !MONO_CLASS_IS_IMPORT(method->klass))
g_error ("Method '%s' in assembly '%s' contains native code and mono can't run it. The assembly was probably created by Managed C++.\n", mono_method_full_name (method, TRUE), method->klass->image->name);
if (!piinfo->addr) {
#ifdef __sparc
#define GET_CONTEXT \
void *ctx = context;
-#elif defined(sun) // Solaris x86
-#define GET_CONTEXT \
- ucontext_t *uctx = context; \
- struct sigcontext *ctx = (struct sigcontext *)&(uctx->uc_mcontext);
#elif defined (MONO_ARCH_USE_SIGACTION)
#define GET_CONTEXT \
void *ctx = context;
mono_trace_cleanup ();
mono_counters_dump (-1, stdout);
+
+ TlsFree(mono_jit_tls_id);
+
+ DeleteCriticalSection (&jit_mutex);
+
+ DeleteCriticalSection (&mono_delegate_section);
}
void