From cfd9dc6656c61e9e0b955308c6a9ef96b770ab61 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 26 Jun 2012 08:39:23 -0600 Subject: [PATCH] fix bug which failed to preserve source site during multi-word move The compiler was failing to freeze the source site containing the value of the second word in a multi-word move, leading to mis-compiled code in some cases. --- src/compiler.cpp | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/compiler.cpp b/src/compiler.cpp index 213c6e81ae..8e118008bb 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -3773,26 +3773,32 @@ class MoveEvent: public Event { and srcSelectSize >= dstSize) { if (dst->target) { - if (dstSize > TargetBytesPerWord - and src->source->registerSize(c) > TargetBytesPerWord) - { - apply(c, Move, srcSelectSize, src->source, src->source, - dstSize, dst->target, dst->target); - - if (live(c, dst) == 0) { - removeSite(c, dst, dst->target); - if (dstSize > TargetBytesPerWord) { - removeSite(c, dst->nextWord, dst->nextWord->target); + if (dstSize > TargetBytesPerWord) { + if (src->source->registerSize(c) > TargetBytesPerWord) { + apply(c, Move, srcSelectSize, src->source, src->source, + dstSize, dst->target, dst->target); + + if (live(c, dst) == 0) { + removeSite(c, dst, dst->target); + if (dstSize > TargetBytesPerWord) { + removeSite(c, dst->nextWord, dst->nextWord->target); + } } - } - } else { - maybeMove(c, Move, TargetBytesPerWord, TargetBytesPerWord, src, - TargetBytesPerWord, dst, dstLowMask); - if (dstSize > TargetBytesPerWord) { + } else { + src->nextWord->source->freeze(c, src->nextWord); + + maybeMove(c, Move, TargetBytesPerWord, TargetBytesPerWord, src, + TargetBytesPerWord, dst, dstLowMask); + + src->nextWord->source->thaw(c, src->nextWord); + maybeMove (c, Move, TargetBytesPerWord, TargetBytesPerWord, src->nextWord, TargetBytesPerWord, dst->nextWord, dstHighMask); } + } else { + maybeMove(c, Move, TargetBytesPerWord, TargetBytesPerWord, src, + TargetBytesPerWord, dst, dstLowMask); } } else { Site* low = pickSiteOrMove(c, src, dst, 0, 0);