Use cached classname in the class type constant to optimize type_structure(cls,cns...
commitdcee8d85e7fafa4d2715a236f2d4b5081e83c4ac
authorOguz Ulgen <oulgen@fb.com>
Wed, 15 May 2019 15:56:40 +0000 (15 08:56 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Wed, 15 May 2019 16:03:37 +0000 (15 09:03 -0700)
tree55a0bac3457b387fc681e6a87d89011480cd8ea4
parentbc376a7e7ac5b7e90d79ece7160624f65f403922
Use cached classname in the class type constant to optimize type_structure(cls,cns)['classname']

Summary: In most cases, when people use the function `type_structure()`, they immediately retrieve back `classname` field out. Lets optimize this by caching the name of the class. We convert `type_structure(cls,cns)['classname']` to `type_structure_classname(cls,cns)` to detect this pattern in the JIT. This diff adds IR instructions to check if a classname is cached on a constant and if so, retrieves it. Otherwise, uses a slightly slower path.

Reviewed By: markw65

Differential Revision: D15305287

fbshipit-source-id: a6952da57160b6633d74d700111cf85b88bb2497
12 files changed:
hphp/doc/ir.specification
hphp/hhbbc/interp-builtin.cpp
hphp/hhbbc/interp-minstr.cpp
hphp/runtime/ext/reflection/ext_reflection-classes.php
hphp/runtime/ext/reflection/ext_reflection.cpp
hphp/runtime/vm/class.cpp
hphp/runtime/vm/jit/dce.cpp
hphp/runtime/vm/jit/extra-data.h
hphp/runtime/vm/jit/ir-opcode.cpp
hphp/runtime/vm/jit/irgen-builtin.cpp
hphp/runtime/vm/jit/irlower-cns.cpp
hphp/runtime/vm/jit/memory-effects.cpp