From f72684f07a7ad9d96862e23aec5737dd3d5d9484 Mon Sep 17 00:00:00 2001 From: mwilliams Date: Mon, 1 Jul 2013 16:47:21 -0700 Subject: [PATCH] Fix spilling bug in linearscan If we reload a value in an exit trace that was spilled in the main trace, a comment tells us that we reload it at the start of the exit trace. In fact the reload was inserted at the start of the main trace. Fixed the code to match the comment. --- hphp/runtime/vm/jit/linearscan.cpp | 2 +- hphp/test/slow/compilation/exitspill.php | 28 +++++++++++++++++++ .../slow/compilation/exitspill.php.expect | 15 ++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 hphp/test/slow/compilation/exitspill.php create mode 100644 hphp/test/slow/compilation/exitspill.php.expect diff --git a/hphp/runtime/vm/jit/linearscan.cpp b/hphp/runtime/vm/jit/linearscan.cpp index 0763eb24d..dc20fc240 100644 --- a/hphp/runtime/vm/jit/linearscan.cpp +++ b/hphp/runtime/vm/jit/linearscan.cpp @@ -1191,7 +1191,7 @@ void LinearScan::allocRegsOneTrace(BlockList::iterator& blockIt, assert(!spill->block()->trace()->isMain()); spill = spill->clone(m_irFactory); } - block->trace()->front()->prepend(spill); + trace->front()->prepend(spill); } else if (inst->isBlockEnd()) { block->next()->prepend(spill); } else { diff --git a/hphp/test/slow/compilation/exitspill.php b/hphp/test/slow/compilation/exitspill.php new file mode 100644 index 000000000..19e3b567c --- /dev/null +++ b/hphp/test/slow/compilation/exitspill.php @@ -0,0 +1,28 @@ + + int(1) + [1]=> + int(32) + [2]=> + int(32) + [3]=> + int(32) + [4]=> + int(32) + [5]=> + int(32) +}