ladybird/Libraries/LibJS/Bytecode/Validator.h
Andreas Kling a31c2c388b LibJS: Stop persisting basic_block_start_offsets on Executable
Keep basic block offsets as construction-only metadata rather than
storing them on every Executable. The validator now receives the offsets
through a transient Rust FFI span, and the bytecode dump rebuilds block
starts by scanning labels, terminators, and exception handler metadata.

Drop the table from the bytecode cache format and bump the format
version so old caches are rebuilt. This removes a field that was only
used by validation and bytecode dump paths.
2026-05-14 12:08:12 +02:00

28 lines
669 B
C++

/*
* Copyright (c) 2026-present, the Ladybird developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Error.h>
#include <AK/Span.h>
#include <LibJS/Forward.h>
namespace JS::Bytecode {
class Executable;
// Whether the bytecode being validated still has m_cache fields stored as
// indices (BeforeFixup) or has had Executable::fixup_cache_pointers() rewrite
// them into live pointers (AfterFixup). Cache fields are only range-checked
// in the BeforeFixup case.
enum class CacheState : u8 {
BeforeFixup,
AfterFixup,
};
ErrorOr<void> validate_bytecode(Executable const&, ReadonlySpan<u32> basic_block_offsets, CacheState);
}