Encapsulate return types of NvGet*() and GetValueRef()
commite513c6d6d4a847fd7d09e27f23e4554b6955c0f0
authorMax Wang <mwang@fb.com>
Tue, 27 Jun 2017 04:41:14 +0000 (26 21:41 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Tue, 27 Jun 2017 04:43:19 +0000 (26 21:43 -0700)
treee41291b33f93a7c0a9c06707dcf586056870ac54
parent095a4b27efec8c84fb84d0b2b1cc0234bce20609
Encapsulate return types of NvGet*() and GetValueRef()

Summary:
This divorces the array vtable API from the actual data layout used
by the various array implementations.  In particular, it no longer
requires them to lay out TypedValues in memory (or rather... we're
pushing that dependency further out, with plans to eliminate it
completely).

We define a member_rval type analogous to the member_lval type used by
the LvalAt*() functions, which has const/read-only semantics.
member_rval::ptr_u replaces the return types for the array vtable
NvGet*() and GetValueRef() functions, while ArrayData wraps it trivially
as a member_rval.  We also add Rval*() functions to mirror the Lval*()
functions on each array type, and we rename ArrayData::nvGet() and
ArrayData::getValueRef() to ArrayData::rval*() (with ArrayData::at() as
a helper for getting a TypedValue by value).

Reviewed By: jano

Differential Revision: D4890419

fbshipit-source-id: 57c0fda93ea28eac6e02cadbb178f83fa33bd4b2
51 files changed:
hphp/hhbbc/type-system.cpp
hphp/runtime/base/apc-local-array.cpp
hphp/runtime/base/apc-local-array.h
hphp/runtime/base/array-data-defs.h
hphp/runtime/base/array-data.cpp
hphp/runtime/base/array-data.h
hphp/runtime/base/array-iterator.cpp
hphp/runtime/base/array-iterator.h
hphp/runtime/base/array-util.cpp
hphp/runtime/base/empty-array.cpp
hphp/runtime/base/empty-array.h
hphp/runtime/base/exceptions.cpp
hphp/runtime/base/hash-table-inl.h
hphp/runtime/base/hash-table.h
hphp/runtime/base/member-val-inl.h [moved from hphp/runtime/base/member-lval-inl.h with 66% similarity]
hphp/runtime/base/member-val.h [moved from hphp/runtime/base/member-lval.h with 53% similarity]
hphp/runtime/base/mixed-array-defs.h
hphp/runtime/base/mixed-array.cpp
hphp/runtime/base/mixed-array.h
hphp/runtime/base/object-data.cpp
hphp/runtime/base/packed-array.cpp
hphp/runtime/base/packed-array.h
hphp/runtime/base/php-globals.h
hphp/runtime/base/proxy-array.cpp
hphp/runtime/base/proxy-array.h
hphp/runtime/base/repo-auth-type.cpp
hphp/runtime/base/set-array.cpp
hphp/runtime/base/set-array.h
hphp/runtime/base/tv-mutate.h
hphp/runtime/base/tv-type.h
hphp/runtime/base/type-array.cpp
hphp/runtime/base/type-variant.h
hphp/runtime/base/variable-serializer.cpp
hphp/runtime/ext/array/ext_array.cpp
hphp/runtime/ext/collections/ext_collections-map.cpp
hphp/runtime/ext/collections/ext_collections-set.h
hphp/runtime/ext/collections/ext_collections-vector.cpp
hphp/runtime/ext/factparse/ext_factparse.cpp
hphp/runtime/ext/std/ext_std_classobj.cpp
hphp/runtime/vm/class.cpp
hphp/runtime/vm/globals-array.cpp
hphp/runtime/vm/globals-array.h
hphp/runtime/vm/jit/irgen-minstr.cpp
hphp/runtime/vm/jit/irlower-cns.cpp
hphp/runtime/vm/jit/irlower-lookup-cls-func.cpp
hphp/runtime/vm/jit/minstr-helpers.h
hphp/runtime/vm/jit/simplify.cpp
hphp/runtime/vm/jit/translator-runtime.cpp
hphp/runtime/vm/jit/type-array-elem.cpp
hphp/runtime/vm/member-operations.h
hphp/runtime/vm/unit.cpp