Merge newInstance{,Reified} from runtime.h into ObjectData.
commit7b987b9467e8c6e0e072c8837982b4a659e18a41
authorAlexey Toptygin <alexeyt@fb.com>
Sat, 27 Apr 2019 19:16:24 +0000 (27 12:16 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Sat, 27 Apr 2019 19:20:36 +0000 (27 12:20 -0700)
treebd2773d0af7423c0cc405ab1568dcfcb84a711f7
parentf85d58fbfeb7dbd36975744f28b98989c7d99820
Merge newInstance{,Reified} from runtime.h into ObjectData.

Summary:
We had most of the functionality for ObjectData::newInstance in the object-data{.h,-inl.h,.cpp} code, BUT the logic for handling reified generics was living separately in vm/runtime.h. This is unintuitive and dangerous - calling ObjectData::newInstance directly bypassed the sanity checks that were in the runtime.h wrappers. Merge the runtime.h functionality into the object data code proper.
Most places were already calling the wrappers, but 2 were calling ObjectData::newInstance directly: in member-operations.h when we promote falsy to stdClass, and in type-object.h when constructing an Object from a Class*. The former was fine (stdClass will never have reified generics), but the latter was a bug: C++ code could construct instances of classes with reified generics without setting the reified generics on them. This bug was actually being (mis)used in APC, and is the only reason that the new hphp/test/slow/reified_generics/apc-*.php tests oulgen added were able to pass. I'm temporarily disabling these tests until we can fix APC to construct objects with reified generics safely.
While making these changes, I noticed that the trivial functions Class::hasReifiedGenerics and Class::hasReifiedParent were not inline (like their func and actrec counterparts are). Make them inline.

Reviewed By: oulgen

Differential Revision: D15079486

fbshipit-source-id: c7db49ac29f29b4976bf34f79f20b650bb4e8bbe
hphp/runtime/base/execution-context.cpp
hphp/runtime/base/object-data-inl.h
hphp/runtime/base/object-data.cpp
hphp/runtime/base/object-data.h
hphp/runtime/vm/bytecode.cpp
hphp/runtime/vm/class-inl.h
hphp/runtime/vm/class.cpp
hphp/runtime/vm/jit/native-calls.cpp
hphp/runtime/vm/runtime.h
hphp/test/slow/reified_generics/apc-1.php.disabled [moved from hphp/test/slow/reified_generics/apc-1.php with 100% similarity]
hphp/test/slow/reified_generics/apc-2.php.disabled [moved from hphp/test/slow/reified_generics/apc-2.php with 100% similarity]