From 76aed9f1505271f928fb6a61eb2f5570c435c338 Mon Sep 17 00:00:00 2001 From: mwilliams Date: Wed, 17 Jul 2013 15:11:27 -0700 Subject: [PATCH] Empty loops need to check surprise flags We didnt count a brach to itself as a backward branch. Also, there seemed to be a signed vs unsigned issue with IterBreak. --- hphp/runtime/vm/bytecode.cpp | 2 +- hphp/runtime/vm/jit/hhbc-translator.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hphp/runtime/vm/bytecode.cpp b/hphp/runtime/vm/bytecode.cpp index c41d897a0..0ef3bfcf8 100644 --- a/hphp/runtime/vm/bytecode.cpp +++ b/hphp/runtime/vm/bytecode.cpp @@ -3948,7 +3948,7 @@ inline void OPTBLD_INLINE VMExecutionContext::iopFatal(PC& pc) { } inline void OPTBLD_INLINE VMExecutionContext::jmpSurpriseCheck(Offset offset) { - if (offset < 0 && UNLIKELY(Transl::TargetCache::loadConditionFlags())) { + if (offset <= 0 && UNLIKELY(Transl::TargetCache::loadConditionFlags())) { EventHook::CheckSurprise(); } } diff --git a/hphp/runtime/vm/jit/hhbc-translator.cpp b/hphp/runtime/vm/jit/hhbc-translator.cpp index d854ab6a6..6d1104574 100755 --- a/hphp/runtime/vm/jit/hhbc-translator.cpp +++ b/hphp/runtime/vm/jit/hhbc-translator.cpp @@ -1107,7 +1107,7 @@ void HhbcTranslator::emitIterBreak(const ImmVector& iv, uint32_t offset, bool breakTracelet, bool noSurprise) { - bool backward = (offset - (int32_t)bcOff()) < 0; + bool backward = offset <= bcOff(); if (backward && !noSurprise) { gen(ExitWhenSurprised, getExitSlowTrace()); } @@ -1615,7 +1615,7 @@ void HhbcTranslator::emitJmp(int32_t offset, bool breakTracelet, bool noSurprise) { // If surprise flags are set, exit trace and handle surprise - bool backward = (offset - (int32_t)bcOff()) < 0; + bool backward = (uint32_t)offset <= bcOff(); if (backward && !noSurprise) { gen(ExitWhenSurprised, getExitSlowTrace()); }