[runtime] Set pending, don't raise, in object.c icalls
[mono.git] / mono / metadata / sgen-os-win32.c
index 429d356adeef389da01451ee7d446ee366f442ca..3e78396ccd10f536f2bd73be7b41f01c69b76435 100644 (file)
@@ -1,11 +1,11 @@
 #include "config.h"
 
-#if defined(HAVE_SGEN_GC) && defined(HOST_WIN32)
+#if defined(HAVE_SGEN_GC) && !defined(USE_COOP_GC) && defined(HOST_WIN32)
 
 #include "io-layer/io-layer.h"
 
-#include "metadata/sgen-gc.h"
-#include "metadata/gc-internal.h"
+#include "sgen/sgen-gc.h"
+#include "metadata/gc-internals.h"
 
 gboolean
 sgen_resume_thread (SgenThreadInfo *info)
@@ -61,25 +61,25 @@ sgen_suspend_thread (SgenThreadInfo *info)
 #ifdef USE_MONO_CTX
        memset (&info->client_info.ctx, 0, sizeof (MonoContext));
 #ifdef TARGET_AMD64
-       info->client_info.ctx.rip = context.Rip;
-       info->client_info.ctx.rax = context.Rax;
-       info->client_info.ctx.rcx = context.Rcx;
-       info->client_info.ctx.rdx = context.Rdx;
-       info->client_info.ctx.rbx = context.Rbx;
-       info->client_info.ctx.rsp = context.Rsp;
-       info->client_info.ctx.rbp = context.Rbp;
-       info->client_info.ctx.rsi = context.Rsi;
-       info->client_info.ctx.rdi = context.Rdi;
-       info->client_info.ctx.r8 = context.R8;
-       info->client_info.ctx.r9 = context.R9;
-       info->client_info.ctx.r10 = context.R10;
-       info->client_info.ctx.r11 = context.R11;
-       info->client_info.ctx.r12 = context.R12;
-       info->client_info.ctx.r13 = context.R13;
-       info->client_info.ctx.r14 = context.R14;
-       info->client_info.ctx.r15 = context.R15;
-       info->client_info.stopped_ip = info->client_info.ctx.rip;
-       info->client_info.stack_start = (char*)info->client_info.ctx.rsp - REDZONE_SIZE;
+    info->client_info.ctx.gregs[AMD64_RIP] = context.Rip;
+    info->client_info.ctx.gregs[AMD64_RAX] = context.Rax;
+    info->client_info.ctx.gregs[AMD64_RCX] = context.Rcx;
+    info->client_info.ctx.gregs[AMD64_RDX] = context.Rdx;
+    info->client_info.ctx.gregs[AMD64_RBX] = context.Rbx;
+    info->client_info.ctx.gregs[AMD64_RSP] = context.Rsp;
+    info->client_info.ctx.gregs[AMD64_RBP] = context.Rbp;
+    info->client_info.ctx.gregs[AMD64_RSI] = context.Rsi;
+    info->client_info.ctx.gregs[AMD64_RDI] = context.Rdi;
+    info->client_info.ctx.gregs[AMD64_R8] = context.R8;
+    info->client_info.ctx.gregs[AMD64_R9] = context.R9;
+    info->client_info.ctx.gregs[AMD64_R10] = context.R10;
+    info->client_info.ctx.gregs[AMD64_R11] = context.R11;
+    info->client_info.ctx.gregs[AMD64_R12] = context.R12;
+    info->client_info.ctx.gregs[AMD64_R13] = context.R13;
+    info->client_info.ctx.gregs[AMD64_R14] = context.R14;
+    info->client_info.ctx.gregs[AMD64_R15] = context.R15;
+    info->client_info.stopped_ip = info->client_info.ctx.gregs[AMD64_RIP];
+    info->client_info.stack_start = (char*)info->client_info.ctx.gregs[AMD64_RSP] - REDZONE_SIZE;
 #else
        info->client_info.ctx.edi = context.Edi;
        info->client_info.ctx.esi = context.Esi;
@@ -123,12 +123,11 @@ sgen_wait_for_suspend_ack (int count)
 int
 sgen_thread_handshake (BOOL suspend)
 {
-       SgenThreadInfo *info;
        SgenThreadInfo *current = mono_thread_info_current ();
        int count = 0;
 
        current->client_info.suspend_done = TRUE;
-       FOREACH_THREAD_SAFE (info) {
+       FOREACH_THREAD (info) {
                if (info == current)
                        continue;
                info->client_info.suspend_done = FALSE;
@@ -142,7 +141,7 @@ sgen_thread_handshake (BOOL suspend)
                                continue;
                }
                ++count;
-       } END_FOREACH_THREAD_SAFE
+       } FOREACH_THREAD_END
        return count;
 }