Arquivos
hhvm/hphp/test/vm/array_helper_reenter.php
T
Jordan Delong 363d1bb20f Code move src/ -> hphp/
This change is mostly for FB internal organizational reasons.
Building is not effected beyond the fact that the target now
lands in hphp/hhvm/hhvm rather than src/hhvm/hhvm.
2013-02-11 02:10:41 -08:00

29 linhas
1.0 KiB
PHP

<?php
// This is a micro-test for a specific, tricky bug in the jit. See comments
// inline for explanation. It hinges on invoking the user error handler (i.e.
// reentering the VM) from one of the jit's array helpers, which are directly
// called into from jitted code.
function error_handler($errno, $msg, $file, $line) {
echo "error handler\n";
}
set_error_handler('error_handler');
function f($form) {
// The call to a builtin is needed to invoke the code that saves the VM's
// hardware registers to ExecutionContext, and gives them values that will
// be bogus below.
if (!is_array(123)) {
// The array-index operation calls into array_getm_s_fast, which will
// raise a notice because the index is undefined. The runtime will attempt
// to get a backtrace, which will crash because m_fp is out of sync and
// points at something that isn't an ActRec.
$sink = $form['default_value'];
}
}
// It dies on the second invocation; not exactly sure why the first one is OK
f(array());
f(array());