mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 07:34:57 +00:00

This works very similarly to MarkedVector<T>, but instead of expecting T to be Value or a GC-allocated pointer type, T can be anything. Every pointer-sized value in the vector's storage will be checked during conservative root scanning. In other words, this allows you to put something like this in a ConservativeVector<Foo> and it will be protected from GC: struct Foo { i64 number; Value some_value; GCPtr<Object> some_object; };
29 lines
488 B
C++
29 lines
488 B
C++
/*
|
|
* Copyright (c) 2023, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/SourceLocation.h>
|
|
|
|
namespace JS {
|
|
|
|
struct HeapRoot {
|
|
enum class Type {
|
|
HeapFunctionCapturedPointer,
|
|
Handle,
|
|
MarkedVector,
|
|
ConservativeVector,
|
|
RegisterPointer,
|
|
SafeFunction,
|
|
StackPointer,
|
|
VM,
|
|
};
|
|
|
|
Type type;
|
|
SourceLocation const* location { nullptr };
|
|
};
|
|
|
|
}
|