From ff6c434c246d7306726bb924adb616f8b972413b Mon Sep 17 00:00:00 2001 From: Max Wang Date: Tue, 21 May 2019 11:07:37 -0700 Subject: [PATCH] Break tracelets after CGetS Summary: Suffers from the same pathology as ClsCns. Reviewed By: markw65, leikahing Differential Revision: D15424814 fbshipit-source-id: 953ba160e9d0414b3f6b3046082339b98fe5e43f --- hphp/runtime/vm/jit/translator-inl.h | 2 +- hphp/test/slow/class_constant/jit-idx-bug.php | 15 +++++++++++---- hphp/test/slow/class_constant/jit-idx-bug.php.expect | 1 + 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/hphp/runtime/vm/jit/translator-inl.h b/hphp/runtime/vm/jit/translator-inl.h index 1d8f1ddf323..d9bc3bb1160 100644 --- a/hphp/runtime/vm/jit/translator-inl.h +++ b/hphp/runtime/vm/jit/translator-inl.h @@ -106,7 +106,7 @@ inline bool opcodeChangesPC(const Op op) { } inline bool opcodeBreaksBB(const Op op, bool inlining) { - if (op == Op::ClsCns) { + if (op == Op::ClsCns || op == Op::CGetS) { // side exits if it misses in the RDS, and may produce an overly // specific type without guarding if the class comes from an // object (during form_region, the class will appear to be a diff --git a/hphp/test/slow/class_constant/jit-idx-bug.php b/hphp/test/slow/class_constant/jit-idx-bug.php index 0a0a4db7081..e949c84e924 100644 --- a/hphp/test/slow/class_constant/jit-idx-bug.php +++ b/hphp/test/slow/class_constant/jit-idx-bug.php @@ -6,18 +6,25 @@ abstract class B { class C1 extends B { const string NAME = 'S1'; + public static $prop = 'S2'; } -function test(dict $x, $c) { +function test_clscns(dict $x, $c) { return idx($x, $c::NAME, ""); } +function test_cgets(dict $x, $c) { + return idx($x, $c::$prop, ""); +} + <<__EntryPoint>> function main() { - $d = dict['a' => 1, 'S1' => 2]; + $d = dict['a' => 1, 'S1' => 2, 'S2' => 3]; $c1 = new C1(); for ($i = 0; $i < 10; $i++) { - test($d, $c1); + test_clscns($d, $c1); + test_cgets($d, $c1); } - var_dump(test($d, $c1)); + var_dump(test_clscns($d, $c1)); + var_dump(test_cgets($d, $c1)); } diff --git a/hphp/test/slow/class_constant/jit-idx-bug.php.expect b/hphp/test/slow/class_constant/jit-idx-bug.php.expect index 9ba94a3fd9f..365381e8c29 100644 --- a/hphp/test/slow/class_constant/jit-idx-bug.php.expect +++ b/hphp/test/slow/class_constant/jit-idx-bug.php.expect @@ -1 +1,2 @@ int(2) +int(3) -- 2.11.4.GIT