Merge pull request #832 from xplicit/webperf1
[mono.git] / mono / mini / mini-amd64.h
index fd84eab37980bca3d71852d67c18a20f1bdfbc50..b523d9981cd5df64e67e02d64ef9bac4b83c81a6 100644 (file)
@@ -47,7 +47,7 @@ struct sigcontext {
        guint64 eip;
 };
 
-typedef void (* MonoW32ExceptionHandler) (int _dummy, EXCEPTION_RECORD *info, void *context);
+typedef void (* MonoW32ExceptionHandler) (int _dummy, EXCEPTION_POINTERS *info, void *context);
 void win32_seh_init(void);
 void win32_seh_cleanup(void);
 void win32_seh_set_handler(int type, MonoW32ExceptionHandler handler);
@@ -159,16 +159,17 @@ struct sigcontext {
 
 struct MonoLMF {
        /* 
-        * If the lowest bit is set to 1, then this LMF has the rip field set. Otherwise,
+        * If the lowest bit is set, then this LMF has the rip field set. Otherwise,
         * the rip field is not set, and the rsp field points to the stack location where
         * the caller ip is saved.
-        * If the second lowest bit is set to 1, then this is a MonoLMFExt structure, and
+        * If the second lowest bit is set, then this is a MonoLMFExt structure, and
         * the other fields are not valid.
+        * If the third lowest bit is set, then this is a MonoLMFTramp structure.
         */
        gpointer    previous_lmf;
+#ifdef HOST_WIN32
        gpointer    lmf_addr;
-       /* This is only set in trampoline LMF frames */
-       MonoMethod *method;
+#endif
 #if defined(__default_codegen__) || defined(HOST_WIN32)
        guint64     rip;
 #elif defined(__native_client_codegen__)
@@ -189,6 +190,13 @@ struct MonoLMF {
 #endif
 };
 
+/* LMF structure used by the JIT trampolines */
+typedef struct {
+       struct MonoLMF lmf;
+       guint64 *regs;
+       gpointer lmf_addr;
+} MonoLMFTramp;
+
 typedef struct MonoCompileArch {
        gint32 localloc_offset;
        gint32 reg_save_area_offset;
@@ -334,9 +342,7 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_HAVE_IS_INT_OVERFLOW 1
 
 #define MONO_ARCH_ENABLE_REGALLOC_IN_EH_BLOCKS 1
-#if !defined(__APPLE__)
 #define MONO_ARCH_ENABLE_MONO_LMF_VAR 1
-#endif
 #define MONO_ARCH_HAVE_INVALIDATE_METHOD 1
 #define MONO_ARCH_HAVE_CREATE_DELEGATE_TRAMPOLINE 1
 #define MONO_ARCH_HAVE_ATOMIC_ADD 1
@@ -396,16 +402,13 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_HAVE_CONTEXT_SET_INT_REG 1
 #define MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK 1
 #define MONO_ARCH_HAVE_CREATE_LLVM_NATIVE_THUNK 1
+#define MONO_ARCH_HAVE_OP_TAIL_CALL 1
+#define MONO_ARCH_HAVE_TRANSLATE_TLS_OFFSET 1
 
-#ifdef TARGET_OSX
+#if defined(TARGET_OSX) || defined(__linux__)
 #define MONO_ARCH_HAVE_TLS_GET_REG 1
 #endif
 
-gboolean
-mono_amd64_tail_call_supported (MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig) MONO_INTERNAL;
-
-#define MONO_ARCH_USE_OP_TAIL_CALL(caller_sig, callee_sig) mono_amd64_tail_call_supported (caller_sig, callee_sig)
-
 /* Used for optimization, not complete */
 #define MONO_ARCH_IS_OP_MEMBASE(opcode) ((opcode) == OP_X86_PUSH_MEMBASE)
 
@@ -446,6 +449,9 @@ mono_amd64_have_tls_get (void) MONO_INTERNAL;
 GSList*
 mono_amd64_get_exception_trampolines (gboolean aot) MONO_INTERNAL;
 
+int
+mono_amd64_get_tls_gs_offset (void) MONO_INTERNAL;
+
 typedef struct {
        guint8 *address;
        guint8 saved_byte;