|
RPNXCortado
C++23 JVM class-file, bytecode, validation, and JAR toolkit
|
Interns constant-pool entries while retaining deterministic first-insertion order. More...
#include <builders.hpp>
Public Member Functions | |
| constant_pool_builder ()=default | |
| Constructs an empty constant pool. | |
| constant_pool_builder (std::vector< constant_pool_entry > entries) | |
| Initializes an interner from an exact existing pool. | |
| constant_pool_index | intern (constant_pool_entry entry) |
| Interns an exact constant-pool entry. | |
| constant_pool_index | add_utf8 (std::string_view bytes) |
| Interns a modified-UTF-8 byte sequence. | |
| constant_pool_index | add_class (std::string_view internal_name) |
| Interns a CONSTANT_Class and its name. | |
| constant_pool_index | add_string (std::string_view bytes) |
| Interns a CONSTANT_String and its modified-UTF-8 payload. | |
| constant_pool_index | add_name_and_type (std::string_view name, std::string_view descriptor) |
| Interns a CONSTANT_NameAndType. | |
| constant_pool_index | add_fieldref (std::string_view owner, std::string_view name, std::string_view descriptor) |
| Interns a CONSTANT_Fieldref. | |
| constant_pool_index | add_methodref (std::string_view owner, std::string_view name, std::string_view descriptor) |
| Interns a CONSTANT_Methodref. | |
| constant_pool_index | add_interface_methodref (std::string_view owner, std::string_view name, std::string_view descriptor) |
| Interns a CONSTANT_InterfaceMethodref. | |
| constant_pool_entry const & | entry_at (constant_pool_index index) const |
| Returns an exact entry by logical constant-pool index. | |
| std::string_view | utf8_at (constant_pool_index index) const |
| Returns modified-UTF-8 bytes by logical constant-pool index. | |
| std::vector< constant_pool_entry > const & | entries () const noexcept |
| Returns the exact current entry sequence. | |
| std::vector< constant_pool_entry > | build () const |
| Copies the exact current entry sequence. | |
Interns constant-pool entries while retaining deterministic first-insertion order.
Logical indexes include the reserved slot after every long or double. Re-interning an equal entry returns its original index without changing the sequence. Returned entry references remain valid only until the next operation that may grow the pool.
Definition at line 182 of file builders.hpp.
|
explicit |
Initializes an interner from an exact existing pool.
| entries | Existing entry sequence in logical order without explicit reserved-slot values. |
| validation_error | if the sequence cannot fit in the JVM constant-pool index space. |
References entries().
|
nodiscard |
Interns a CONSTANT_Class and its name.
| internal_name | Slash-separated class name or array descriptor. |
class_constant.
|
nodiscard |
Interns a CONSTANT_Fieldref.
| owner | Declaring class internal name. |
| name | Field name. |
| descriptor | Field descriptor. |
fieldref_constant.
|
nodiscard |
Interns a CONSTANT_InterfaceMethodref.
| owner | Declaring interface internal name. |
| name | Method name. |
| descriptor | Method descriptor. |
interface_methodref_constant.
|
nodiscard |
Interns a CONSTANT_Methodref.
| owner | Declaring class internal name. |
| name | Method name. |
| descriptor | Method descriptor. |
methodref_constant.
|
nodiscard |
Interns a CONSTANT_NameAndType.
| name | Member name bytes. |
| descriptor | Field or method descriptor bytes. |
name_and_type_constant.
|
nodiscard |
Interns a CONSTANT_String and its modified-UTF-8 payload.
| bytes | Exact string contents, copied during the call. |
string_constant.
|
nodiscard |
Interns a modified-UTF-8 byte sequence.
| bytes | Exact modified-UTF-8 payload, copied during the call. |
utf8_constant.
|
nodiscard |
Copies the exact current entry sequence.
class_file::constant_pool. References build().
Referenced by build().
|
nodiscardnoexcept |
Returns the exact current entry sequence.
Referenced by constant_pool_builder().
|
nodiscard |
Returns an exact entry by logical constant-pool index.
| index | Nonzero occupied logical pool slot. |
| validation_error | if the index is zero, out of range, or a reserved second slot. |
|
nodiscard |
Interns an exact constant-pool entry.
| entry | Owning entry value to find or append. |
| assembly_error | if appending would overflow the constant-pool index space. |
|
nodiscard |
Returns modified-UTF-8 bytes by logical constant-pool index.
| index | Index expected to identify a utf8_constant. |
| validation_error | if the index is invalid or has another constant kind. |