From dd2716f56c7cf55f2904fbbf4dfabaab1afbcd88 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Fri, 25 Jun 2010 20:46:11 -0700 Subject: [PATCH] Fix bad register use in GC sweep pass. --- src/boot/be/x86.ml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/boot/be/x86.ml b/src/boot/be/x86.ml index dfd659d96ad..64eaea22a56 100644 --- a/src/boot/be/x86.ml +++ b/src/boot/be/x86.ml @@ -839,12 +839,16 @@ let gc_glue (codefix exit_jmp_fix)); (* if nonzero *) mov (rc ecx) (* Load GC ctrl word *) (c (edx_n Abi.exterior_gc_slot_field_ctrl)); - - band (* Clear in-memory mark. *) - (edx_n Abi.exterior_gc_slot_field_ctrl) + mov (rc eax) (ro ecx); + band (rc eax) (immi 1L); (* Extract mark to eax. *) + band (* Clear mark in ecx. *) + (rc ecx) (immi 0xfffffffffffffffeL); - band (rc ecx) (immi 1L); (* Check in-reg mark. *) - emit (Il.cmp (ro edx) (immi 0L)); + mov + ((edx_n Abi.exterior_gc_slot_field_ctrl)) (* Write-back cleared. *) + (ro ecx); + + emit (Il.cmp (ro eax) (immi 0L)); emit (Il.jmp Il.JNE (codefix skip_jmp_fix)); (* if unmarked (garbage) *)