Skip to content

Commit

Permalink
Add allowLargeAlloc to GCCell VTable
Browse files Browse the repository at this point in the history
  • Loading branch information
lavenzg authored and facebook-github-bot committed Nov 7, 2024
1 parent 175c5cf commit d5a8536
Show file tree
Hide file tree
Showing 21 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/hermes/VM/SingleObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct IsGCObject<SingleObject<kind>> {

template <CellKind kind>
const ObjectVTable SingleObject<kind>::vt = {
VTable(kind, cellSize<SingleObject<kind>>(), nullptr, nullptr),
VTable(kind, cellSize<SingleObject<kind>>()),
SingleObject::_getOwnIndexedRangeImpl,
SingleObject::_haveOwnIndexedImpl,
SingleObject::_getOwnIndexedPropertyFlagsImpl,
Expand Down
3 changes: 3 additions & 0 deletions include/hermes/VM/StringPrimitive.h
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,7 @@ template <typename T, bool Uniqued>
const VTable DynamicStringPrimitive<T, Uniqued>::vt = VTable(
DynamicStringPrimitive<T, Uniqued>::getCellKind(),
0,
false,
nullptr,
nullptr,
nullptr
Expand Down Expand Up @@ -865,6 +866,7 @@ template <typename T>
const VTable ExternalStringPrimitive<T>::vt = VTable(
ExternalStringPrimitive<T>::getCellKind(),
0,
false,
ExternalStringPrimitive<T>::_finalizeImpl,
ExternalStringPrimitive<T>::_mallocSizeImpl,
nullptr
Expand All @@ -886,6 +888,7 @@ template <typename T>
const VTable BufferedStringPrimitive<T>::vt = VTable(
BufferedStringPrimitive<T>::getCellKind(),
0,
false,
nullptr, // finalize.
nullptr, // mallocSize
nullptr
Expand Down
4 changes: 4 additions & 0 deletions include/hermes/VM/VTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ struct VTable {
/// If it is variable sized, it should inherit from \see
/// VariableSizeRuntimeCell.
const uint32_t size;
/// Whether the cell supports large allocation.
bool allowLargeAlloc;
/// Called during GC when an object becomes unreachable. Must not perform any
/// allocations or access any garbage-collectable objects. Unless an
/// operation is documented to be safe to call from a finalizer, it probably
Expand Down Expand Up @@ -137,6 +139,7 @@ struct VTable {
constexpr explicit VTable(
CellKind kind,
uint32_t size,
bool allowLargeAlloc = false,
FinalizeCallback *finalize = nullptr,
MallocSizeCallback *mallocSize = nullptr,
TrimSizeCallback *trimSize = nullptr
Expand All @@ -153,6 +156,7 @@ struct VTable {
)
: kind(kind),
size(heapAlignSize(size)),
allowLargeAlloc(allowLargeAlloc),
finalize_(finalize),
mallocSize_(mallocSize),
trimSize_(trimSize)
Expand Down
1 change: 1 addition & 0 deletions lib/VM/ArrayStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ template <typename HVType>
const VTable ArrayStorageBase<HVType>::vt(
ArrayStorageBase<HVType>::getCellKind(),
0,
false,
nullptr,
nullptr,
_trimSizeCallback
Expand Down
5 changes: 5 additions & 0 deletions lib/VM/Callable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ const CallableVTable BoundFunction::vt{
VTable(
CellKind::BoundFunctionKind,
cellSize<BoundFunction>(),
false,
nullptr,
nullptr,
nullptr
Expand Down Expand Up @@ -905,6 +906,7 @@ const CallableVTable NativeJSFunction::vt{
VTable(
CellKind::NativeJSFunctionKind,
cellSize<NativeJSFunction>(),
false,
nullptr,
nullptr,
nullptr
Expand Down Expand Up @@ -1054,6 +1056,7 @@ const CallableVTable NativeFunction::vt{
VTable(
CellKind::NativeFunctionKind,
cellSize<NativeFunction>(),
false,
nullptr,
nullptr,
nullptr
Expand Down Expand Up @@ -1233,6 +1236,7 @@ const CallableVTable NativeConstructor::vt{
VTable(
CellKind::NativeConstructorKind,
cellSize<NativeConstructor>(),
false,
nullptr,
nullptr,
nullptr
Expand Down Expand Up @@ -1284,6 +1288,7 @@ const CallableVTable JSFunction::vt{
VTable(
CellKind::JSFunctionKind,
cellSize<JSFunction>(),
false,
nullptr,
nullptr,
nullptr
Expand Down
1 change: 1 addition & 0 deletions lib/VM/DecoratedObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const ObjectVTable DecoratedObject::vt{
VTable(
CellKind::DecoratedObjectKind,
cellSize<DecoratedObject>(),
false,
DecoratedObject::_finalizeImpl,
DecoratedObject::_mallocSizeImpl),
DecoratedObject::_getOwnIndexedRangeImpl,
Expand Down
1 change: 1 addition & 0 deletions lib/VM/Domain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace vm {
const VTable Domain::vt{
CellKind::DomainKind,
cellSize<Domain>(),
false,
_finalizeImpl,
_mallocSizeImpl,
nullptr
Expand Down
1 change: 1 addition & 0 deletions lib/VM/DummyObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace testhelpers {
const VTable DummyObject::vt{
CellKind::DummyObjectKind,
cellSize<DummyObject>(),
false,
_finalizeImpl,
_mallocSizeImpl,
nullptr
Expand Down
1 change: 1 addition & 0 deletions lib/VM/FastArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const ObjectVTable FastArray::vt{
VTable(
CellKind::FastArrayKind,
cellSize<FastArray>(),
false,
nullptr,
nullptr,
nullptr
Expand Down
1 change: 1 addition & 0 deletions lib/VM/HiddenClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ void TransitionMap::uncleanMakeLarge(Runtime &runtime) {
const VTable HiddenClass::vt{
CellKind::HiddenClassKind,
cellSize<HiddenClass>(),
false,
_finalizeImpl,
_mallocSizeImpl,
nullptr
Expand Down
2 changes: 2 additions & 0 deletions lib/VM/HostModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const CallableVTable FinalizableNativeFunction::vt{
VTable(
CellKind::FinalizableNativeFunctionKind,
cellSize<FinalizableNativeFunction>(),
false,
FinalizableNativeFunction::_finalizeImpl),
FinalizableNativeFunction::_getOwnIndexedRangeImpl,
FinalizableNativeFunction::_haveOwnIndexedImpl,
Expand Down Expand Up @@ -81,6 +82,7 @@ const ObjectVTable HostObject::vt{
VTable(
CellKind::HostObjectKind,
cellSize<HostObject>(),
false,
HostObject::_finalizeImpl),
HostObject::_getOwnIndexedRangeImpl,
HostObject::_haveOwnIndexedImpl,
Expand Down
2 changes: 2 additions & 0 deletions lib/VM/JSArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ const ObjectVTable Arguments::vt{
VTable(
CellKind::ArgumentsKind,
cellSize<Arguments>(),
false,
nullptr,
nullptr,
nullptr
Expand Down Expand Up @@ -493,6 +494,7 @@ const ObjectVTable JSArray::vt{
VTable(
CellKind::JSArrayKind,
cellSize<JSArray>(),
false,
nullptr,
nullptr,
nullptr
Expand Down
1 change: 1 addition & 0 deletions lib/VM/JSArrayBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const ObjectVTable JSArrayBuffer::vt{
VTable(
CellKind::JSArrayBufferKind,
cellSize<JSArrayBuffer>(),
false,
_finalizeImpl,
_mallocSizeImpl,
nullptr
Expand Down
2 changes: 1 addition & 1 deletion lib/VM/JSCallSite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace hermes {
namespace vm {
const ObjectVTable JSCallSite::vt{
VTable(CellKind::JSCallSiteKind, cellSize<JSCallSite>(), nullptr, nullptr),
VTable(CellKind::JSCallSiteKind, cellSize<JSCallSite>()),
JSCallSite::_getOwnIndexedRangeImpl,
JSCallSite::_haveOwnIndexedImpl,
JSCallSite::_getOwnIndexedPropertyFlagsImpl,
Expand Down
1 change: 1 addition & 0 deletions lib/VM/JSError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const ObjectVTable JSError::vt{
VTable(
CellKind::JSErrorKind,
cellSize<JSError>(),
false,
JSError::_finalizeImpl,
JSError::_mallocSizeImpl),
JSError::_getOwnIndexedRangeImpl,
Expand Down
1 change: 1 addition & 0 deletions lib/VM/JSObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const ObjectVTable JSObject::vt{
VTable(
CellKind::JSObjectKind,
cellSize<JSObject>(),
false,
nullptr,
nullptr,
nullptr
Expand Down
1 change: 1 addition & 0 deletions lib/VM/JSRegExp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const ObjectVTable JSRegExp::vt{
VTable(
CellKind::JSRegExpKind,
cellSize<JSRegExp>(),
false,
JSRegExp::_finalizeImpl,
JSRegExp::_mallocSizeImpl,
nullptr
Expand Down
1 change: 1 addition & 0 deletions lib/VM/JSWeakMapImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ const ObjectVTable JSWeakMapImpl<C>::vt{
VTable(
C,
cellSize<JSWeakMapImpl>(),
false,
JSWeakMapImpl::_finalizeImpl,
JSWeakMapImpl::_mallocSizeImpl,
nullptr
Expand Down
1 change: 1 addition & 0 deletions lib/VM/JSWeakRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const ObjectVTable JSWeakRef::vt{
VTable(
CellKind::JSWeakRefKind,
cellSize<JSWeakRef>(),
false,
JSWeakRef::_finalizeImpl,
nullptr,
nullptr
Expand Down
1 change: 1 addition & 0 deletions lib/VM/NativeState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace vm {
const VTable NativeState::vt{
CellKind::NativeStateKind,
cellSize<NativeState>(),
false,
_finalizeImpl,
};

Expand Down
2 changes: 2 additions & 0 deletions lib/VM/SegmentedArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ template <typename HVType>
const VTable SegmentedArrayBase<HVType>::Segment::vt(
getCellKind(),
cellSize<SegmentedArrayBase::Segment>(),
false,
nullptr,
nullptr,
nullptr
Expand Down Expand Up @@ -76,6 +77,7 @@ template <typename HVType>
const VTable SegmentedArrayBase<HVType>::vt(
getCellKind(),
/*variableSize*/ 0,
false,
nullptr,
nullptr,
_trimSizeCallback
Expand Down

0 comments on commit d5a8536

Please sign in to comment.