Mark registers dirty before entering catch-traces
Otherwise we end up with bizarre stack corruption.
Esse commit está contido em:
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
@@ -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
|
||||
Referência em uma Nova Issue
Bloquear um usuário