Mark registers dirty before entering catch-traces

Otherwise we end up with bizarre stack corruption.
Esse commit está contido em:
mwilliams
2013-06-27 11:53:44 -07:00
commit de Sara Golemon
commit 8f421ab193
4 arquivos alterados com 38 adições e 1 exclusões
+6 -1
Ver Arquivo
@@ -840,12 +840,17 @@ void CodeGenerator::cgBeginCatch(IRInstruction* inst) {
PhysRegSaverParity::emitPops(m_as, info.savedRegs);
}
static void unwindResumeHelper(_Unwind_Exception* data) {
tl_regState = VMRegState::CLEAN;
_Unwind_Resume(data);
}
void CodeGenerator::cgEndCatch(IRInstruction* inst) {
m_as.cmpb (0, rVmTl[TargetCache::kUnwinderSideExitOff]);
unlikelyIfBlock(CC_E,
[&](Asm& as) { // doSideExit == false, so call _Unwind_Resume
as.loadq(rVmTl[TargetCache::kUnwinderScratchOff], rdi);
as.call ((TCA)_Unwind_Resume); // pass control back to the unwinder
as.call ((TCA)unwindResumeHelper); // pass control back to the unwinder
as.ud2();
});
+1
Ver Arquivo
@@ -99,6 +99,7 @@ bool install_catch_trace(_Unwind_Context* ctx, _Unwind_Exception* exn,
TargetCache::header()->unwinderTv = ism->tv();
}
_Unwind_SetIP(ctx, (uint64_t)catchTrace);
tl_regState = VMRegState::DIRTY;
return true;
}
+19
Ver Arquivo
@@ -0,0 +1,19 @@
<?php
function test($a, $b, $c, $d, $e) {
$k = array();
foreach ($a as $id) {
$k[$id] = foo($id, $b, $c, $d, $e);
$k[$id] = foo($k[$id], $b);
}
}
function foo($a, $b) {
return $a ?: $b;
}
function main() {
test(array(array('foo'), array('bar'), array('baz')), null, 1, 2, 3);
}
main();
+12
Ver Arquivo
@@ -0,0 +1,12 @@
HipHop Warning: Illegal offset type in %s/test/quick/bad_setm.php on line 6
HipHop Warning: Invalid operand type was used: Invalid type used as key in %s/test/quick/bad_setm.php on line 7
HipHop Notice: Undefined index: Array in %s/test/quick/bad_setm.php on line 7
HipHop Warning: Illegal offset type in %s/test/quick/bad_setm.php on line 7
HipHop Warning: Illegal offset type in %s/test/quick/bad_setm.php on line 6
HipHop Warning: Invalid operand type was used: Invalid type used as key in %s/test/quick/bad_setm.php on line 7
HipHop Notice: Undefined index: Array in %s/test/quick/bad_setm.php on line 7
HipHop Warning: Illegal offset type in %s/test/quick/bad_setm.php on line 7
HipHop Warning: Illegal offset type in %s/test/quick/bad_setm.php on line 6
HipHop Warning: Invalid operand type was used: Invalid type used as key in %s/test/quick/bad_setm.php on line 7
HipHop Notice: Undefined index: Array in %s/test/quick/bad_setm.php on line 7
HipHop Warning: Illegal offset type in %s/test/quick/bad_setm.php on line 7