mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
refactor(allocator/fixed-size): store alloc_ptr in the memory block backing the allocator (#12380)
`FixedSizeAllocator`s allocate a block of memory larger than what the `Allocator` controls, and often with a different start pointer. So when `FixedSizeAllocator` is dropped, it needs to deallocate that block of memory using the original pointer. That pointer way previously stored in `FixedSizeAllocator` itself. Instead store it in a `FixedSizeAllocatorMetadata` struct, which is written into the memory block itself, after the section controlled by the `Allocator`, and other metadata (`RawTransferMetadata`). This allows getting the original `alloc_ptr` when you only have access to the `Allocator`, but not the `FixedSizeAllocator`.
This commit is contained in:
1 parent
8fe1aeca1f
commit
319fc3b817
16 files changed
+464
-306
No files matched your search
@@ -3,7 +3,9 @@
|
||||
|
||||
src:
|
||||
- '.github/generated/ast_changes_watch_list.yml'
|
||||
- 'crates/oxc_allocator/src/generated/assert_layouts.rs'
|
||||
- 'crates/oxc_allocator/src/generated/fixed_size_constants.rs'
|
||||
- 'crates/oxc_allocator/src/pool_fixed_size.rs'
|
||||
- 'crates/oxc_ast/src/ast/comment.rs'
|
||||
- 'crates/oxc_ast/src/ast/js.rs'
|
||||
- 'crates/oxc_ast/src/ast/jsx.rs'
|
||||
|
||||
Generated
+1
@@ -1666,6 +1666,7 @@ dependencies = [
|
||||
"allocator-api2",
|
||||
"bumpalo",
|
||||
"hashbrown 0.15.4",
|
||||
"oxc_ast_macros",
|
||||
"oxc_data_structures",
|
||||
"oxc_estree",
|
||||
"rustc-hash",
|
||||
|
||||
@@ -19,6 +19,7 @@ workspace = true
|
||||
doctest = true
|
||||
|
||||
[dependencies]
|
||||
oxc_ast_macros = { workspace = true, optional = true }
|
||||
oxc_data_structures = { workspace = true, features = ["assert_unchecked", "pointer_ext"] }
|
||||
oxc_estree = { workspace = true, optional = true }
|
||||
|
||||
@@ -35,7 +36,7 @@ serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
[features]
|
||||
fixed_size = ["from_raw_parts"]
|
||||
fixed_size = ["from_raw_parts", "dep:oxc_ast_macros"]
|
||||
disable_fixed_size = []
|
||||
from_raw_parts = []
|
||||
serialize = ["dep:serde", "oxc_estree/serialize"]
|
||||
@@ -0,0 +1,27 @@
|
||||
// Auto-generated code, DO NOT EDIT DIRECTLY!
|
||||
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/assert_layouts.rs`.
|
||||
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::mem::{align_of, offset_of, size_of};
|
||||
|
||||
use crate::*;
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
const _: () = {
|
||||
// Padding: 0 bytes
|
||||
assert!(size_of::<FixedSizeAllocatorMetadata>() == 8);
|
||||
assert!(align_of::<FixedSizeAllocatorMetadata>() == 8);
|
||||
assert!(offset_of!(FixedSizeAllocatorMetadata, alloc_ptr) == 0);
|
||||
};
|
||||
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
const _: () = {
|
||||
// Padding: 0 bytes
|
||||
assert!(size_of::<FixedSizeAllocatorMetadata>() == 4);
|
||||
assert!(align_of::<FixedSizeAllocatorMetadata>() == 4);
|
||||
assert!(offset_of!(FixedSizeAllocatorMetadata, alloc_ptr) == 0);
|
||||
};
|
||||
|
||||
#[cfg(not(any(target_pointer_width = "64", target_pointer_width = "32")))]
|
||||
const _: () = panic!("Platforms with pointer width other than 64 or 32 bit are not supported");
|
||||
@@ -6,4 +6,5 @@
|
||||
|
||||
pub const BLOCK_SIZE: usize = 2147483632;
|
||||
pub const BLOCK_ALIGN: usize = 4294967296;
|
||||
pub const BUFFER_SIZE: usize = 2147483616;
|
||||
pub const RAW_METADATA_SIZE: usize = 16;
|
||||
@@ -80,16 +80,26 @@ mod pool_fixed_size;
|
||||
target_endian = "little"
|
||||
))]
|
||||
use pool_fixed_size as pool;
|
||||
// Import here so `generated/assert_layouts.rs` can access it
|
||||
#[cfg(all(
|
||||
feature = "fixed_size",
|
||||
not(feature = "disable_fixed_size"),
|
||||
target_pointer_width = "64",
|
||||
target_endian = "little"
|
||||
))]
|
||||
use pool_fixed_size::FixedSizeAllocatorMetadata;
|
||||
|
||||
pub use pool::{AllocatorGuard, AllocatorPool};
|
||||
|
||||
#[cfg(all(
|
||||
feature = "fixed_size",
|
||||
not(feature = "disable_fixed_size"),
|
||||
target_pointer_width = "64",
|
||||
target_endian = "little"
|
||||
))]
|
||||
mod generated {
|
||||
#[cfg(all(
|
||||
feature = "fixed_size",
|
||||
not(feature = "disable_fixed_size"),
|
||||
target_pointer_width = "64",
|
||||
target_endian = "little"
|
||||
))]
|
||||
#[cfg(debug_assertions)]
|
||||
pub mod assert_layouts;
|
||||
pub mod fixed_size_constants;
|
||||
}
|
||||
#[cfg(all(
|
||||
|
||||
@@ -6,6 +6,8 @@ use std::{
|
||||
sync::Mutex,
|
||||
};
|
||||
|
||||
use oxc_ast_macros::ast;
|
||||
|
||||
use crate::{
|
||||
Allocator,
|
||||
fixed_size_constants::{BLOCK_ALIGN, BLOCK_SIZE, RAW_METADATA_SIZE},
|
||||
@@ -86,6 +88,16 @@ impl Drop for AllocatorGuard<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Metadata about a [`FixedSizeAllocator`].
|
||||
///
|
||||
/// Is stored in the memory backing the [`FixedSizeAllocator`], after `RawTransferMetadata`,
|
||||
/// which is after the section of the allocation which [`Allocator`] uses for its chunk.
|
||||
#[ast]
|
||||
pub struct FixedSizeAllocatorMetadata {
|
||||
/// Pointer to start of original allocation backing the `FixedSizeAllocator`
|
||||
pub alloc_ptr: NonNull<u8>,
|
||||
}
|
||||
|
||||
// What we ideally want is an allocation 2 GiB in size, aligned on 4 GiB.
|
||||
// But system allocator on Mac OS refuses allocations with 4 GiB alignment.
|
||||
// https://github.com/rust-lang/rust/blob/556d20a834126d2d0ac20743b9792b8474d6d03c/library/std/src/sys/alloc/unix.rs#L16-L27
|
||||
@@ -109,10 +121,17 @@ const ALLOC_LAYOUT: Layout = match Layout::from_size_align(ALLOC_SIZE, ALLOC_ALI
|
||||
Err(_) => unreachable!(),
|
||||
};
|
||||
|
||||
/// Structure which wraps an [`Allocator`] with fixed size of 2 GiB, and aligned on 4 GiB.
|
||||
/// Structure which wraps an [`Allocator`] with fixed size of 2 GiB - 16, and aligned on 4 GiB.
|
||||
///
|
||||
/// # Allocation strategy
|
||||
///
|
||||
/// To achieve this, we manually allocate memory to back the `Allocator`'s single chunk,
|
||||
/// and to store other metadata.
|
||||
///
|
||||
/// We over-allocate 4 GiB, and then use only half of that allocation - either the 1st half,
|
||||
/// or the 2nd half, depending on the alignment of the allocation received from `alloc.alloc()`.
|
||||
/// One of those halves will be aligned on 4 GiB, and that's the one we use.
|
||||
///
|
||||
/// To achieve this, we manually allocate memory to back the `Allocator`'s single chunk.
|
||||
/// We over-allocate 4 GiB, and then use a part of that allocation to back the `Allocator`.
|
||||
/// Inner `Allocator` is wrapped in `ManuallyDrop` to prevent it freeing the memory itself,
|
||||
/// and `FixedSizeAllocator` has a custom `Drop` impl which frees the whole of the original allocation.
|
||||
///
|
||||
@@ -120,11 +139,41 @@ const ALLOC_LAYOUT: Layout = match Layout::from_size_align(ALLOC_SIZE, ALLOC_ALI
|
||||
/// (e.g. Mimalloc in linter). Mimalloc complains that it cannot serve allocations with high alignment,
|
||||
/// and presumably it's pointless to try to obtain such large allocations from a thread-local heap,
|
||||
/// so better to go direct to the system allocator anyway.
|
||||
///
|
||||
/// # Regions of the allocated memory
|
||||
///
|
||||
/// 2 GiB of the allocated memory is not used at all (see above).
|
||||
///
|
||||
/// The remaining 2 GiB - 16 bytes, which *is* used, is split up as follows:
|
||||
///
|
||||
/// ```txt
|
||||
/// WHOLE BLOCK - aligned on 4 GiB
|
||||
/// <-----------------------------------------------------> Allocated block (`BLOCK_SIZE` bytes)
|
||||
///
|
||||
/// ALLOCATOR
|
||||
/// <-----------------------------------------> `Allocator` chunk (`CHUNK_SIZE` bytes)
|
||||
/// <----> Bumpalo's `ChunkFooter` (aligned on 16)
|
||||
/// <-----------------------------------> `Allocator` chunk data storage (for AST)
|
||||
///
|
||||
/// METADATA
|
||||
/// <----> `RawTransferMetadata`
|
||||
/// <----> `FixedSizeAllocatorMetadata`
|
||||
///
|
||||
/// BUFFER SENT TO JS
|
||||
/// <-----------------------------------------------> Buffer sent to JS (`BUFFER_SIZE` bytes)
|
||||
/// ```
|
||||
///
|
||||
/// Note that the buffer sent to JS includes both the `Allocator` chunk, and `RawTransferMetadata`,
|
||||
/// but does NOT include `FixedSizeAllocatorMetadata`.
|
||||
///
|
||||
/// The end of the region used for `Allocator` chunk must be aligned on `Allocator::RAW_MIN_ALIGN` (16),
|
||||
/// due to the requirements of Bumpalo. We manage that by:
|
||||
/// * `BLOCK_SIZE` is a multiple of 16.
|
||||
/// * `RawTransferMetadata` is 16 bytes.
|
||||
/// * Size of `FixedSizeAllocatorMetadata` is rounded up to a multiple of 16.
|
||||
pub struct FixedSizeAllocator {
|
||||
/// `Allocator` which utilizes part of the original allocation
|
||||
allocator: ManuallyDrop<Allocator>,
|
||||
/// Pointer to start of original allocation
|
||||
alloc_ptr: NonNull<u8>,
|
||||
}
|
||||
|
||||
impl FixedSizeAllocator {
|
||||
@@ -154,7 +203,13 @@ impl FixedSizeAllocator {
|
||||
|
||||
debug_assert!(chunk_ptr.as_ptr() as usize % BLOCK_ALIGN == 0);
|
||||
|
||||
const CHUNK_SIZE: usize = BLOCK_SIZE - RAW_METADATA_SIZE;
|
||||
const FIXED_METADATA_SIZE_ROUNDED: usize =
|
||||
size_of::<FixedSizeAllocatorMetadata>().next_multiple_of(Allocator::RAW_MIN_ALIGN);
|
||||
const FIXED_METADATA_OFFSET: usize = BLOCK_SIZE - FIXED_METADATA_SIZE_ROUNDED;
|
||||
const _: () =
|
||||
assert!(FIXED_METADATA_OFFSET % align_of::<FixedSizeAllocatorMetadata>() == 0);
|
||||
|
||||
const CHUNK_SIZE: usize = FIXED_METADATA_OFFSET - RAW_METADATA_SIZE;
|
||||
const _: () = assert!(CHUNK_SIZE % Allocator::RAW_MIN_ALIGN == 0);
|
||||
|
||||
// SAFETY: Memory region starting at `chunk_ptr` with `CHUNK_SIZE` bytes is within
|
||||
@@ -162,8 +217,19 @@ impl FixedSizeAllocator {
|
||||
// `chunk_ptr` has high alignment (4 GiB). `CHUNK_SIZE` is large and a multiple of 16.
|
||||
let allocator = unsafe { Allocator::from_raw_parts(chunk_ptr, CHUNK_SIZE) };
|
||||
|
||||
// Store pointer to original allocation, so it can be used to deallocate in `drop`
|
||||
Self { allocator: ManuallyDrop::new(allocator), alloc_ptr }
|
||||
// Write `FixedSizeAllocatorMetadata` to after space reserved for `RawTransferMetadata`,
|
||||
// which is after the end of the allocator chunk
|
||||
let metadata = FixedSizeAllocatorMetadata { alloc_ptr };
|
||||
// SAFETY: `FIXED_METADATA_OFFSET` is `FIXED_METADATA_SIZE_ROUNDED` bytes before end of
|
||||
// the allocation, so there's space for `FixedSizeAllocatorMetadata`.
|
||||
// It's sufficiently aligned for `FixedSizeAllocatorMetadata`.
|
||||
unsafe {
|
||||
let metadata_ptr =
|
||||
chunk_ptr.add(FIXED_METADATA_OFFSET).cast::<FixedSizeAllocatorMetadata>();
|
||||
metadata_ptr.write(metadata);
|
||||
}
|
||||
|
||||
Self { allocator: ManuallyDrop::new(allocator) }
|
||||
}
|
||||
|
||||
/// Reset this [`FixedSizeAllocator`].
|
||||
@@ -186,11 +252,44 @@ impl FixedSizeAllocator {
|
||||
|
||||
impl Drop for FixedSizeAllocator {
|
||||
fn drop(&mut self) {
|
||||
// Get pointer to start of original allocation from `FixedSizeAllocatorMetadata`
|
||||
let alloc_ptr = {
|
||||
// SAFETY: This `Allocator` was created by this `FixedSizeAllocator`.
|
||||
// `&FixedSizeAllocatorMetadata` ref only lives until end of this block.
|
||||
let metadata = unsafe { self.allocator.fixed_size_metadata() };
|
||||
metadata.alloc_ptr
|
||||
};
|
||||
|
||||
// SAFETY: Originally allocated from `System` allocator at `alloc_ptr`, with layout `ALLOC_LAYOUT`
|
||||
unsafe { System.dealloc(self.alloc_ptr.as_ptr(), ALLOC_LAYOUT) }
|
||||
unsafe { System.dealloc(alloc_ptr.as_ptr(), ALLOC_LAYOUT) }
|
||||
}
|
||||
}
|
||||
|
||||
// SAFETY: `Allocator` is `Send`.
|
||||
// Moving `alloc_ptr: NonNull<u8>` across threads along with the `Allocator` is safe.
|
||||
unsafe impl Send for FixedSizeAllocator {}
|
||||
|
||||
impl Allocator {
|
||||
/// Get reference to the [`FixedSizeAllocatorMetadata`] for this [`Allocator`].
|
||||
///
|
||||
/// # SAFETY
|
||||
/// * This `Allocator` must have been created by a `FixedSizeAllocator`.
|
||||
/// * Reference returned by this method must not be allowed to live beyond the life of
|
||||
/// the `FixedSizeAllocator`.
|
||||
unsafe fn fixed_size_metadata(&self) -> &FixedSizeAllocatorMetadata {
|
||||
// SAFETY: Caller guarantees this `Allocator` was created by a `FixedSizeAllocator`.
|
||||
//
|
||||
// `FixedSizeAllocator::new` writes `FixedSizeAllocatorMetadata` after the end of
|
||||
// the chunk owned by the `Allocator`, and `RawTransferMetadata` (see above).
|
||||
// `end_ptr` is end of the allocator chunk (after the chunk header).
|
||||
// So `end_ptr + RAW_METADATA_SIZE` points to a valid, initialized `FixedSizeAllocatorMetadata`.
|
||||
//
|
||||
// We never create `&mut` references to `FixedSizeAllocatorMetadata`,
|
||||
// and it's not part of the buffer sent to JS, so no danger of aliasing violations.
|
||||
unsafe {
|
||||
let metadata_ptr =
|
||||
self.end_ptr().add(RAW_METADATA_SIZE).cast::<FixedSizeAllocatorMetadata>();
|
||||
metadata_ptr.as_ref()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,297 +9,299 @@ pub static STRUCTS: phf::Map<&'static str, StructDetails> = ::phf::Map {
|
||||
key: 16287231350648472473,
|
||||
disps: &[
|
||||
(0, 0),
|
||||
(0, 45),
|
||||
(0, 36),
|
||||
(0, 218),
|
||||
(0, 81),
|
||||
(0, 14),
|
||||
(0, 138),
|
||||
(1, 229),
|
||||
(0, 0),
|
||||
(0, 21),
|
||||
(0, 100),
|
||||
(0, 11),
|
||||
(0, 3),
|
||||
(0, 10),
|
||||
(0, 139),
|
||||
(0, 84),
|
||||
(0, 196),
|
||||
(0, 3),
|
||||
(4, 222),
|
||||
(0, 86),
|
||||
(0, 163),
|
||||
(1, 155),
|
||||
(0, 125),
|
||||
(103, 2),
|
||||
(5, 195),
|
||||
(0, 79),
|
||||
(0, 12),
|
||||
(0, 26),
|
||||
(0, 1),
|
||||
(0, 13),
|
||||
(1, 143),
|
||||
(0, 144),
|
||||
(8, 133),
|
||||
(0, 4),
|
||||
(2, 7),
|
||||
(0, 36),
|
||||
(4, 53),
|
||||
(0, 45),
|
||||
(0, 149),
|
||||
(0, 105),
|
||||
(0, 130),
|
||||
(2, 181),
|
||||
(1, 120),
|
||||
(2, 197),
|
||||
(0, 72),
|
||||
(0, 6),
|
||||
(0, 0),
|
||||
(3, 70),
|
||||
(26, 191),
|
||||
(3, 107),
|
||||
(4, 187),
|
||||
(1, 108),
|
||||
(0, 39),
|
||||
(0, 49),
|
||||
(11, 199),
|
||||
(0, 14),
|
||||
(0, 209),
|
||||
(0, 101),
|
||||
(0, 1),
|
||||
(0, 2),
|
||||
(0, 120),
|
||||
(11, 131),
|
||||
(0, 82),
|
||||
(16, 84),
|
||||
(0, 0),
|
||||
(0, 143),
|
||||
(0, 216),
|
||||
(0, 7),
|
||||
(3, 125),
|
||||
(1, 9),
|
||||
(0, 13),
|
||||
(2, 136),
|
||||
(0, 53),
|
||||
(1, 30),
|
||||
(0, 64),
|
||||
(2, 100),
|
||||
(0, 5),
|
||||
(1, 195),
|
||||
(4, 201),
|
||||
(0, 48),
|
||||
(3, 94),
|
||||
(0, 0),
|
||||
(3, 57),
|
||||
(2, 198),
|
||||
(0, 5),
|
||||
(25, 26),
|
||||
(0, 31),
|
||||
(0, 113),
|
||||
(44, 69),
|
||||
(1, 9),
|
||||
],
|
||||
entries: &[
|
||||
("JSXClosingElement", StructDetails { field_order: None }),
|
||||
("BindingIdentifier", StructDetails { field_order: None }),
|
||||
("TSConstructorType", StructDetails { field_order: Some(&[0, 4, 1, 2, 3]) }),
|
||||
("CharacterClass", StructDetails { field_order: Some(&[0, 2, 3, 4, 1]) }),
|
||||
("TSTypeReference", StructDetails { field_order: None }),
|
||||
("JSXNamespacedName", StructDetails { field_order: None }),
|
||||
("DoWhileStatement", StructDetails { field_order: None }),
|
||||
("TSStringKeyword", StructDetails { field_order: None }),
|
||||
("TSTupleType", StructDetails { field_order: None }),
|
||||
("ArrayExpression", StructDetails { field_order: None }),
|
||||
("ImportDefaultSpecifier", StructDetails { field_order: None }),
|
||||
("AssignmentPattern", StructDetails { field_order: None }),
|
||||
("TSBooleanKeyword", StructDetails { field_order: None }),
|
||||
("Span", StructDetails { field_order: None }),
|
||||
("TSConstructSignatureDeclaration", StructDetails { field_order: None }),
|
||||
("ForStatement", StructDetails { field_order: None }),
|
||||
("TSTypeParameterDeclaration", StructDetails { field_order: None }),
|
||||
("Alternative", StructDetails { field_order: None }),
|
||||
("PrivateFieldExpression", StructDetails { field_order: None }),
|
||||
("StringLiteral", StructDetails { field_order: None }),
|
||||
(
|
||||
"AccessorProperty",
|
||||
StructDetails { field_order: Some(&[0, 5, 1, 2, 3, 4, 6, 7, 8, 9, 10]) },
|
||||
),
|
||||
("NullLiteral", StructDetails { field_order: None }),
|
||||
("ConditionalExpression", StructDetails { field_order: None }),
|
||||
("ObjectProperty", StructDetails { field_order: Some(&[0, 3, 1, 2, 4, 5, 6]) }),
|
||||
("TaggedTemplateExpression", StructDetails { field_order: None }),
|
||||
("BlockStatement", StructDetails { field_order: None }),
|
||||
("BindingProperty", StructDetails { field_order: None }),
|
||||
("TSObjectKeyword", StructDetails { field_order: None }),
|
||||
("TSTypeAssertion", StructDetails { field_order: None }),
|
||||
("TSQualifiedName", StructDetails { field_order: None }),
|
||||
("Comment", StructDetails { field_order: None }),
|
||||
("UnaryExpression", StructDetails { field_order: Some(&[0, 2, 1]) }),
|
||||
(
|
||||
"MethodDefinition",
|
||||
StructDetails { field_order: Some(&[0, 4, 1, 2, 3, 5, 6, 7, 8, 9, 10]) },
|
||||
),
|
||||
("CommentNewlines", StructDetails { field_order: None }),
|
||||
("TSArrayType", StructDetails { field_order: None }),
|
||||
("Super", StructDetails { field_order: None }),
|
||||
("LogicalExpression", StructDetails { field_order: Some(&[0, 1, 3, 2]) }),
|
||||
("RegExpFlags", StructDetails { field_order: None }),
|
||||
("AssignmentExpression", StructDetails { field_order: Some(&[0, 3, 1, 2]) }),
|
||||
("TSNeverKeyword", StructDetails { field_order: None }),
|
||||
("TSRestType", StructDetails { field_order: None }),
|
||||
("TemplateElementValue", StructDetails { field_order: None }),
|
||||
("V8IntrinsicExpression", StructDetails { field_order: None }),
|
||||
("YieldExpression", StructDetails { field_order: Some(&[0, 2, 1]) }),
|
||||
("JSXEmptyExpression", StructDetails { field_order: None }),
|
||||
("Character", StructDetails { field_order: Some(&[0, 2, 1]) }),
|
||||
("TemplateElement", StructDetails { field_order: None }),
|
||||
("BooleanLiteral", StructDetails { field_order: None }),
|
||||
("StaticImport", StructDetails { field_order: None }),
|
||||
("ObjectAssignmentTarget", StructDetails { field_order: None }),
|
||||
("ScopeId", StructDetails { field_order: None }),
|
||||
("IfStatement", StructDetails { field_order: None }),
|
||||
("IdentifierName", StructDetails { field_order: None }),
|
||||
("NonMaxU32", StructDetails { field_order: None }),
|
||||
("StaticExport", StructDetails { field_order: None }),
|
||||
("FormalParameter", StructDetails { field_order: None }),
|
||||
("TSTypeOperator", StructDetails { field_order: Some(&[0, 2, 1]) }),
|
||||
("Directive", StructDetails { field_order: None }),
|
||||
("NewExpression", StructDetails { field_order: None }),
|
||||
("JSXMemberExpression", StructDetails { field_order: None }),
|
||||
("JSXExpressionContainer", StructDetails { field_order: None }),
|
||||
("CallExpression", StructDetails { field_order: None }),
|
||||
("NumericLiteral", StructDetails { field_order: None }),
|
||||
("ArrayPattern", StructDetails { field_order: None }),
|
||||
("PrivateInExpression", StructDetails { field_order: None }),
|
||||
("PrivateIdentifier", StructDetails { field_order: None }),
|
||||
("ExportDefaultDeclaration", StructDetails { field_order: None }),
|
||||
("ChainExpression", StructDetails { field_order: None }),
|
||||
("TSTypeAliasDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 3, 5, 4]) }),
|
||||
("ClassStringDisjunction", StructDetails { field_order: Some(&[0, 2, 1]) }),
|
||||
("ImportNamespaceSpecifier", StructDetails { field_order: None }),
|
||||
("LookAroundAssertion", StructDetails { field_order: Some(&[0, 2, 1]) }),
|
||||
("MetaProperty", StructDetails { field_order: None }),
|
||||
("LabeledStatement", StructDetails { field_order: None }),
|
||||
("SourceType", StructDetails { field_order: None }),
|
||||
("TSInterfaceDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 3, 4, 6, 5]) }),
|
||||
("SpreadElement", StructDetails { field_order: None }),
|
||||
("BreakStatement", StructDetails { field_order: None }),
|
||||
("CatchClause", StructDetails { field_order: None }),
|
||||
("Decorator", StructDetails { field_order: None }),
|
||||
("TSIntersectionType", StructDetails { field_order: None }),
|
||||
("ImportExpression", StructDetails { field_order: None }),
|
||||
("TSModuleDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 4, 5, 3]) }),
|
||||
("VariableDeclarator", StructDetails { field_order: Some(&[0, 3, 1, 2, 4]) }),
|
||||
("TSIndexedAccessType", StructDetails { field_order: None }),
|
||||
("TSClassImplements", StructDetails { field_order: None }),
|
||||
("TSTypeAssertion", StructDetails { field_order: None }),
|
||||
("SwitchCase", StructDetails { field_order: None }),
|
||||
("IfStatement", StructDetails { field_order: None }),
|
||||
("TSIntrinsicKeyword", StructDetails { field_order: None }),
|
||||
("TSArrayType", StructDetails { field_order: None }),
|
||||
("TSConstructorType", StructDetails { field_order: Some(&[0, 4, 1, 2, 3]) }),
|
||||
("LabelIdentifier", StructDetails { field_order: None }),
|
||||
("JSXClosingFragment", StructDetails { field_order: None }),
|
||||
("TSInstantiationExpression", StructDetails { field_order: None }),
|
||||
(
|
||||
"Function",
|
||||
StructDetails { field_order: Some(&[0, 8, 1, 9, 10, 11, 2, 3, 4, 5, 6, 7, 12]) },
|
||||
),
|
||||
("Error", StructDetails { field_order: Some(&[4, 0, 1, 2, 3]) }),
|
||||
("JSXFragment", StructDetails { field_order: None }),
|
||||
("RegExpPattern", StructDetails { field_order: None }),
|
||||
("JSXClosingFragment", StructDetails { field_order: None }),
|
||||
("ExportEntry", StructDetails { field_order: Some(&[1, 0, 2, 3, 4, 5, 6]) }),
|
||||
("WithClause", StructDetails { field_order: None }),
|
||||
("WithStatement", StructDetails { field_order: None }),
|
||||
("TSInterfaceHeritage", StructDetails { field_order: None }),
|
||||
("DynamicImport", StructDetails { field_order: None }),
|
||||
("UpdateExpression", StructDetails { field_order: Some(&[0, 2, 3, 1]) }),
|
||||
("IndexedReference", StructDetails { field_order: None }),
|
||||
("JSXIdentifier", StructDetails { field_order: None }),
|
||||
("TSParenthesizedType", StructDetails { field_order: None }),
|
||||
("TSIntrinsicKeyword", StructDetails { field_order: None }),
|
||||
("TSUnionType", StructDetails { field_order: None }),
|
||||
("ExportNamedDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 3, 5, 4]) }),
|
||||
("DebuggerStatement", StructDetails { field_order: None }),
|
||||
("TSInferType", StructDetails { field_order: None }),
|
||||
("SwitchCase", StructDetails { field_order: None }),
|
||||
("LookAroundAssertion", StructDetails { field_order: Some(&[0, 2, 1]) }),
|
||||
("Decorator", StructDetails { field_order: None }),
|
||||
("ClassString", StructDetails { field_order: Some(&[0, 2, 1]) }),
|
||||
("LabelIdentifier", StructDetails { field_order: None }),
|
||||
("TSIntersectionType", StructDetails { field_order: None }),
|
||||
("AssignmentTargetRest", StructDetails { field_order: None }),
|
||||
("JSXText", StructDetails { field_order: None }),
|
||||
("RawTransferData", StructDetails { field_order: None }),
|
||||
("TSNonNullExpression", StructDetails { field_order: None }),
|
||||
("TSAsExpression", StructDetails { field_order: None }),
|
||||
("BinaryExpression", StructDetails { field_order: Some(&[0, 1, 3, 2]) }),
|
||||
("ForOfStatement", StructDetails { field_order: Some(&[0, 5, 1, 2, 3, 4]) }),
|
||||
("TSUnknownKeyword", StructDetails { field_order: None }),
|
||||
("TSNullKeyword", StructDetails { field_order: None }),
|
||||
("Pattern", StructDetails { field_order: None }),
|
||||
("ImportAttribute", StructDetails { field_order: None }),
|
||||
("ParenthesizedExpression", StructDetails { field_order: None }),
|
||||
("SequenceExpression", StructDetails { field_order: None }),
|
||||
("AssignmentTargetPropertyProperty", StructDetails { field_order: None }),
|
||||
("ArrayAssignmentTarget", StructDetails { field_order: None }),
|
||||
("FormalParameters", StructDetails { field_order: Some(&[0, 3, 1, 2]) }),
|
||||
("CharacterClassEscape", StructDetails { field_order: None }),
|
||||
("TSSatisfiesExpression", StructDetails { field_order: None }),
|
||||
("JSDocNonNullableType", StructDetails { field_order: None }),
|
||||
("NameSpan", StructDetails { field_order: Some(&[1, 0]) }),
|
||||
("TSExportAssignment", StructDetails { field_order: None }),
|
||||
("TSExternalModuleReference", StructDetails { field_order: None }),
|
||||
("TSTypeLiteral", StructDetails { field_order: None }),
|
||||
("NewExpression", StructDetails { field_order: None }),
|
||||
("TSStringKeyword", StructDetails { field_order: None }),
|
||||
("Alternative", StructDetails { field_order: None }),
|
||||
("TSTypeAnnotation", StructDetails { field_order: None }),
|
||||
("JSDocUnknownType", StructDetails { field_order: None }),
|
||||
("TSThisType", StructDetails { field_order: None }),
|
||||
("TSThisParameter", StructDetails { field_order: None }),
|
||||
("TSTypeParameterInstantiation", StructDetails { field_order: None }),
|
||||
("Disjunction", StructDetails { field_order: None }),
|
||||
("ReferenceId", StructDetails { field_order: None }),
|
||||
("TSCallSignatureDeclaration", StructDetails { field_order: None }),
|
||||
("Quantifier", StructDetails { field_order: Some(&[0, 1, 2, 4, 3]) }),
|
||||
("TSAnyKeyword", StructDetails { field_order: None }),
|
||||
("TSOptionalType", StructDetails { field_order: None }),
|
||||
("TSIndexSignatureName", StructDetails { field_order: None }),
|
||||
("TSEnumDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 4, 5, 3]) }),
|
||||
("MetaProperty", StructDetails { field_order: None }),
|
||||
("UpdateExpression", StructDetails { field_order: Some(&[0, 2, 3, 1]) }),
|
||||
("BindingIdentifier", StructDetails { field_order: None }),
|
||||
("TSVoidKeyword", StructDetails { field_order: None }),
|
||||
("ScopeId", StructDetails { field_order: None }),
|
||||
("ExportEntry", StructDetails { field_order: Some(&[1, 0, 2, 3, 4, 5, 6]) }),
|
||||
("ImportSpecifier", StructDetails { field_order: None }),
|
||||
("TSBigIntKeyword", StructDetails { field_order: None }),
|
||||
("TSNumberKeyword", StructDetails { field_order: None }),
|
||||
("TSIndexSignature", StructDetails { field_order: None }),
|
||||
("CatchParameter", StructDetails { field_order: None }),
|
||||
("CatchClause", StructDetails { field_order: None }),
|
||||
("ReturnStatement", StructDetails { field_order: None }),
|
||||
("ImportEntry", StructDetails { field_order: None }),
|
||||
("SwitchStatement", StructDetails { field_order: None }),
|
||||
("FunctionBody", StructDetails { field_order: None }),
|
||||
("TSTypeParameter", StructDetails { field_order: None }),
|
||||
("ObjectPattern", StructDetails { field_order: None }),
|
||||
("ThrowStatement", StructDetails { field_order: None }),
|
||||
("ExportSpecifier", StructDetails { field_order: None }),
|
||||
("BoundaryAssertion", StructDetails { field_order: None }),
|
||||
("TSTypeAliasDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 3, 5, 4]) }),
|
||||
("BindingPattern", StructDetails { field_order: None }),
|
||||
("ThisExpression", StructDetails { field_order: None }),
|
||||
("RegExpLiteral", StructDetails { field_order: None }),
|
||||
("JSDocNullableType", StructDetails { field_order: None }),
|
||||
("SymbolId", StructDetails { field_order: None }),
|
||||
("AssignmentTargetPropertyIdentifier", StructDetails { field_order: None }),
|
||||
("ObjectExpression", StructDetails { field_order: None }),
|
||||
("NamedReference", StructDetails { field_order: None }),
|
||||
("ImportDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 4, 3, 5]) }),
|
||||
("ChainExpression", StructDetails { field_order: None }),
|
||||
("JSXSpreadChild", StructDetails { field_order: None }),
|
||||
("TSTypeQuery", StructDetails { field_order: None }),
|
||||
("WhileStatement", StructDetails { field_order: None }),
|
||||
("TemplateLiteral", StructDetails { field_order: None }),
|
||||
("TSFunctionType", StructDetails { field_order: None }),
|
||||
("BinaryExpression", StructDetails { field_order: Some(&[0, 1, 3, 2]) }),
|
||||
("WithStatement", StructDetails { field_order: None }),
|
||||
("BindingProperty", StructDetails { field_order: None }),
|
||||
("TSTypeLiteral", StructDetails { field_order: None }),
|
||||
("ExpressionStatement", StructDetails { field_order: None }),
|
||||
(
|
||||
"PropertyDefinition",
|
||||
StructDetails { field_order: Some(&[0, 5, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13]) },
|
||||
),
|
||||
("RegExp", StructDetails { field_order: None }),
|
||||
("JSXSpreadAttribute", StructDetails { field_order: None }),
|
||||
("TSClassImplements", StructDetails { field_order: None }),
|
||||
("StaticMemberExpression", StructDetails { field_order: None }),
|
||||
("Class", StructDetails { field_order: Some(&[0, 9, 1, 2, 3, 4, 5, 6, 7, 10, 11, 8]) }),
|
||||
("ClassStringDisjunction", StructDetails { field_order: Some(&[0, 2, 1]) }),
|
||||
("PrivateIdentifier", StructDetails { field_order: None }),
|
||||
("EmptyStatement", StructDetails { field_order: None }),
|
||||
("AssignmentTargetWithDefault", StructDetails { field_order: None }),
|
||||
("TSModuleBlock", StructDetails { field_order: None }),
|
||||
("ForInStatement", StructDetails { field_order: None }),
|
||||
("TSNamedTupleMember", StructDetails { field_order: None }),
|
||||
("BindingRestElement", StructDetails { field_order: None }),
|
||||
("Hashbang", StructDetails { field_order: None }),
|
||||
("TSLiteralType", StructDetails { field_order: None }),
|
||||
("TSBigIntKeyword", StructDetails { field_order: None }),
|
||||
("TSConditionalType", StructDetails { field_order: None }),
|
||||
("CapturingGroup", StructDetails { field_order: None }),
|
||||
("ExportDefaultDeclaration", StructDetails { field_order: None }),
|
||||
("Modifier", StructDetails { field_order: None }),
|
||||
("UnicodePropertyEscape", StructDetails { field_order: Some(&[0, 3, 4, 1, 2]) }),
|
||||
("TSMappedType", StructDetails { field_order: Some(&[0, 1, 2, 3, 5, 6, 4]) }),
|
||||
("TSSymbolKeyword", StructDetails { field_order: None }),
|
||||
("VariableDeclaration", StructDetails { field_order: Some(&[0, 2, 1, 3]) }),
|
||||
("Program", StructDetails { field_order: Some(&[0, 7, 1, 2, 3, 4, 5, 6]) }),
|
||||
("TSInterfaceBody", StructDetails { field_order: None }),
|
||||
("TryStatement", StructDetails { field_order: None }),
|
||||
("AwaitExpression", StructDetails { field_order: None }),
|
||||
("TSPropertySignature", StructDetails { field_order: Some(&[0, 3, 4, 5, 1, 2]) }),
|
||||
("TSImportEqualsDeclaration", StructDetails { field_order: None }),
|
||||
("ImportNamespaceSpecifier", StructDetails { field_order: None }),
|
||||
("TSEnumMember", StructDetails { field_order: None }),
|
||||
("JSXIdentifier", StructDetails { field_order: None }),
|
||||
("IdentifierReference", StructDetails { field_order: None }),
|
||||
("TSUndefinedKeyword", StructDetails { field_order: None }),
|
||||
("TSMethodSignature", StructDetails { field_order: Some(&[0, 1, 7, 8, 9, 2, 3, 4, 5, 6]) }),
|
||||
("ExpressionStatement", StructDetails { field_order: None }),
|
||||
("SpreadElement", StructDetails { field_order: None }),
|
||||
("TSVoidKeyword", StructDetails { field_order: None }),
|
||||
("NumericLiteral", StructDetails { field_order: None }),
|
||||
("CharacterClass", StructDetails { field_order: Some(&[0, 2, 3, 4, 1]) }),
|
||||
("AwaitExpression", StructDetails { field_order: None }),
|
||||
("CommentNodeId", StructDetails { field_order: None }),
|
||||
("StaticExport", StructDetails { field_order: None }),
|
||||
("NamedReference", StructDetails { field_order: None }),
|
||||
("JSXEmptyExpression", StructDetails { field_order: None }),
|
||||
("VariableDeclaration", StructDetails { field_order: Some(&[0, 2, 1, 3]) }),
|
||||
("JSDocNullableType", StructDetails { field_order: None }),
|
||||
("TSNonNullExpression", StructDetails { field_order: None }),
|
||||
("TSPropertySignature", StructDetails { field_order: Some(&[0, 3, 4, 5, 1, 2]) }),
|
||||
("DoWhileStatement", StructDetails { field_order: None }),
|
||||
("DebuggerStatement", StructDetails { field_order: None }),
|
||||
("StaticMemberExpression", StructDetails { field_order: None }),
|
||||
("TemplateElement", StructDetails { field_order: None }),
|
||||
("JSXAttribute", StructDetails { field_order: None }),
|
||||
("TSTemplateLiteralType", StructDetails { field_order: None }),
|
||||
("JSXExpressionContainer", StructDetails { field_order: None }),
|
||||
("TSModuleDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 4, 5, 3]) }),
|
||||
("Dot", StructDetails { field_order: None }),
|
||||
("Span", StructDetails { field_order: None }),
|
||||
("TaggedTemplateExpression", StructDetails { field_order: None }),
|
||||
("TSUndefinedKeyword", StructDetails { field_order: None }),
|
||||
("Comment", StructDetails { field_order: None }),
|
||||
("TSFunctionType", StructDetails { field_order: None }),
|
||||
(
|
||||
"MethodDefinition",
|
||||
StructDetails { field_order: Some(&[0, 4, 1, 2, 3, 5, 6, 7, 8, 9, 10]) },
|
||||
),
|
||||
("JSXOpeningElement", StructDetails { field_order: None }),
|
||||
("TemplateElementValue", StructDetails { field_order: None }),
|
||||
("RawTransferMetadata", StructDetails { field_order: Some(&[1, 2, 0]) }),
|
||||
("TSTypeParameterDeclaration", StructDetails { field_order: None }),
|
||||
("TSBooleanKeyword", StructDetails { field_order: None }),
|
||||
("ErrorLabel", StructDetails { field_order: Some(&[1, 0]) }),
|
||||
("Modifiers", StructDetails { field_order: None }),
|
||||
("BreakStatement", StructDetails { field_order: None }),
|
||||
("ObjectProperty", StructDetails { field_order: Some(&[0, 3, 1, 2, 4, 5, 6]) }),
|
||||
("Directive", StructDetails { field_order: None }),
|
||||
("YieldExpression", StructDetails { field_order: Some(&[0, 2, 1]) }),
|
||||
("ForOfStatement", StructDetails { field_order: Some(&[0, 5, 1, 2, 3, 4]) }),
|
||||
("TSObjectKeyword", StructDetails { field_order: None }),
|
||||
("TSInterfaceDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 3, 4, 6, 5]) }),
|
||||
("BindingRestElement", StructDetails { field_order: None }),
|
||||
("IdentifierName", StructDetails { field_order: None }),
|
||||
("ImportDefaultSpecifier", StructDetails { field_order: None }),
|
||||
("WhileStatement", StructDetails { field_order: None }),
|
||||
("UnicodePropertyEscape", StructDetails { field_order: Some(&[0, 3, 4, 1, 2]) }),
|
||||
("RegExpFlags", StructDetails { field_order: None }),
|
||||
("CallExpression", StructDetails { field_order: None }),
|
||||
("AssignmentTargetWithDefault", StructDetails { field_order: None }),
|
||||
("TSIndexSignature", StructDetails { field_order: None }),
|
||||
("TSUnionType", StructDetails { field_order: None }),
|
||||
("TSMethodSignature", StructDetails { field_order: Some(&[0, 1, 7, 8, 9, 2, 3, 4, 5, 6]) }),
|
||||
("TSTypeReference", StructDetails { field_order: None }),
|
||||
("StaticBlock", StructDetails { field_order: None }),
|
||||
("JSDocNonNullableType", StructDetails { field_order: None }),
|
||||
("TSCallSignatureDeclaration", StructDetails { field_order: None }),
|
||||
("BooleanLiteral", StructDetails { field_order: None }),
|
||||
("IndexedReference", StructDetails { field_order: None }),
|
||||
("StaticImport", StructDetails { field_order: None }),
|
||||
("Class", StructDetails { field_order: Some(&[0, 9, 1, 2, 3, 4, 5, 6, 7, 10, 11, 8]) }),
|
||||
("JSXText", StructDetails { field_order: None }),
|
||||
("AssignmentTargetPropertyProperty", StructDetails { field_order: None }),
|
||||
("TSThisType", StructDetails { field_order: None }),
|
||||
("TSModuleBlock", StructDetails { field_order: None }),
|
||||
("StringLiteral", StructDetails { field_order: None }),
|
||||
("Character", StructDetails { field_order: Some(&[0, 2, 1]) }),
|
||||
("TSTypeParameter", StructDetails { field_order: None }),
|
||||
("RawTransferData", StructDetails { field_order: None }),
|
||||
("TSQualifiedName", StructDetails { field_order: None }),
|
||||
("TemplateLiteral", StructDetails { field_order: None }),
|
||||
("ObjectPattern", StructDetails { field_order: None }),
|
||||
("TSTypeQuery", StructDetails { field_order: None }),
|
||||
("ArrayPattern", StructDetails { field_order: None }),
|
||||
("TSParenthesizedType", StructDetails { field_order: None }),
|
||||
("ReferenceId", StructDetails { field_order: None }),
|
||||
("TSAnyKeyword", StructDetails { field_order: None }),
|
||||
("TSInterfaceHeritage", StructDetails { field_order: None }),
|
||||
("ThisExpression", StructDetails { field_order: None }),
|
||||
("PrivateFieldExpression", StructDetails { field_order: None }),
|
||||
("TSTypeOperator", StructDetails { field_order: Some(&[0, 2, 1]) }),
|
||||
("TSUnknownKeyword", StructDetails { field_order: None }),
|
||||
("TSEnumDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 4, 5, 3]) }),
|
||||
("TSOptionalType", StructDetails { field_order: None }),
|
||||
("TSExternalModuleReference", StructDetails { field_order: None }),
|
||||
("TSNeverKeyword", StructDetails { field_order: None }),
|
||||
("ComputedMemberExpression", StructDetails { field_order: None }),
|
||||
("ImportEntry", StructDetails { field_order: None }),
|
||||
("AssignmentTargetRest", StructDetails { field_order: None }),
|
||||
("SequenceExpression", StructDetails { field_order: None }),
|
||||
("AssignmentPattern", StructDetails { field_order: None }),
|
||||
("TSImportType", StructDetails { field_order: None }),
|
||||
("TSTypePredicate", StructDetails { field_order: Some(&[0, 1, 3, 2]) }),
|
||||
("CommentNewlines", StructDetails { field_order: None }),
|
||||
("ArrayExpression", StructDetails { field_order: None }),
|
||||
("Elision", StructDetails { field_order: None }),
|
||||
("ConditionalExpression", StructDetails { field_order: None }),
|
||||
("TSEnumMember", StructDetails { field_order: None }),
|
||||
("TSLiteralType", StructDetails { field_order: None }),
|
||||
("EcmaScriptModule", StructDetails { field_order: Some(&[4, 0, 1, 2, 3]) }),
|
||||
("FunctionBody", StructDetails { field_order: None }),
|
||||
("TSNamedTupleMember", StructDetails { field_order: None }),
|
||||
("JSXNamespacedName", StructDetails { field_order: None }),
|
||||
("TSTypeParameterInstantiation", StructDetails { field_order: None }),
|
||||
("ClassString", StructDetails { field_order: Some(&[0, 2, 1]) }),
|
||||
("ImportDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 4, 3, 5]) }),
|
||||
("DynamicImport", StructDetails { field_order: None }),
|
||||
("TSTupleType", StructDetails { field_order: None }),
|
||||
("ObjectExpression", StructDetails { field_order: None }),
|
||||
("VariableDeclarator", StructDetails { field_order: Some(&[0, 3, 1, 2, 4]) }),
|
||||
("AssignmentTargetPropertyIdentifier", StructDetails { field_order: None }),
|
||||
("LogicalExpression", StructDetails { field_order: Some(&[0, 1, 3, 2]) }),
|
||||
("TSExportAssignment", StructDetails { field_order: None }),
|
||||
("RegExpPattern", StructDetails { field_order: None }),
|
||||
("CharacterClassRange", StructDetails { field_order: None }),
|
||||
("TSSymbolKeyword", StructDetails { field_order: None }),
|
||||
("TSThisParameter", StructDetails { field_order: None }),
|
||||
("JSXSpreadChild", StructDetails { field_order: None }),
|
||||
("TSRestType", StructDetails { field_order: None }),
|
||||
("FormalParameters", StructDetails { field_order: Some(&[0, 3, 1, 2]) }),
|
||||
("WithClause", StructDetails { field_order: None }),
|
||||
("TSAsExpression", StructDetails { field_order: None }),
|
||||
(
|
||||
"AccessorProperty",
|
||||
StructDetails { field_order: Some(&[0, 5, 1, 2, 3, 4, 6, 7, 8, 9, 10]) },
|
||||
),
|
||||
("CatchParameter", StructDetails { field_order: None }),
|
||||
("AssignmentExpression", StructDetails { field_order: Some(&[0, 3, 1, 2]) }),
|
||||
("NonMaxU32", StructDetails { field_order: None }),
|
||||
("JSXOpeningFragment", StructDetails { field_order: None }),
|
||||
("ClassBody", StructDetails { field_order: None }),
|
||||
("ContinueStatement", StructDetails { field_order: None }),
|
||||
("JSXOpeningElement", StructDetails { field_order: None }),
|
||||
("TSEnumBody", StructDetails { field_order: None }),
|
||||
("Dot", StructDetails { field_order: None }),
|
||||
("ImportSpecifier", StructDetails { field_order: None }),
|
||||
("BigIntLiteral", StructDetails { field_order: None }),
|
||||
("ExportAllDeclaration", StructDetails { field_order: None }),
|
||||
("EcmaScriptModule", StructDetails { field_order: Some(&[4, 0, 1, 2, 3]) }),
|
||||
("TSInstantiationExpression", StructDetails { field_order: None }),
|
||||
("JSXAttribute", StructDetails { field_order: None }),
|
||||
("TSTypePredicate", StructDetails { field_order: Some(&[0, 1, 3, 2]) }),
|
||||
("ErrorLabel", StructDetails { field_order: Some(&[1, 0]) }),
|
||||
("TSNamespaceExportDeclaration", StructDetails { field_order: None }),
|
||||
("TSImportType", StructDetails { field_order: None }),
|
||||
("JSXElement", StructDetails { field_order: None }),
|
||||
("IgnoreGroup", StructDetails { field_order: None }),
|
||||
("Elision", StructDetails { field_order: None }),
|
||||
("ComputedMemberExpression", StructDetails { field_order: None }),
|
||||
("TSTypeAnnotation", StructDetails { field_order: None }),
|
||||
("CharacterClassRange", StructDetails { field_order: None }),
|
||||
("RawTransferMetadata", StructDetails { field_order: Some(&[1, 2, 0]) }),
|
||||
("CommentNodeId", StructDetails { field_order: None }),
|
||||
("StaticBlock", StructDetails { field_order: None }),
|
||||
("ArrayAssignmentTarget", StructDetails { field_order: None }),
|
||||
("PrivateInExpression", StructDetails { field_order: None }),
|
||||
("SwitchStatement", StructDetails { field_order: None }),
|
||||
("ParenthesizedExpression", StructDetails { field_order: None }),
|
||||
("Quantifier", StructDetails { field_order: Some(&[0, 1, 2, 4, 3]) }),
|
||||
("BlockStatement", StructDetails { field_order: None }),
|
||||
("TSIndexedAccessType", StructDetails { field_order: None }),
|
||||
(
|
||||
"ArrowFunctionExpression",
|
||||
StructDetails { field_order: Some(&[0, 6, 7, 1, 2, 3, 4, 5, 8]) },
|
||||
),
|
||||
("Pattern", StructDetails { field_order: None }),
|
||||
("EmptyStatement", StructDetails { field_order: None }),
|
||||
("FixedSizeAllocatorMetadata", StructDetails { field_order: None }),
|
||||
("Hashbang", StructDetails { field_order: None }),
|
||||
("UnaryExpression", StructDetails { field_order: Some(&[0, 2, 1]) }),
|
||||
("ThrowStatement", StructDetails { field_order: None }),
|
||||
("TSIndexSignatureName", StructDetails { field_order: None }),
|
||||
("ForInStatement", StructDetails { field_order: None }),
|
||||
("Modifier", StructDetails { field_order: None }),
|
||||
("NameSpan", StructDetails { field_order: Some(&[1, 0]) }),
|
||||
("SymbolId", StructDetails { field_order: None }),
|
||||
("ImportAttribute", StructDetails { field_order: None }),
|
||||
("TSConditionalType", StructDetails { field_order: None }),
|
||||
("JSXElement", StructDetails { field_order: None }),
|
||||
("ObjectAssignmentTarget", StructDetails { field_order: None }),
|
||||
("TSInterfaceBody", StructDetails { field_order: None }),
|
||||
("RegExpLiteral", StructDetails { field_order: None }),
|
||||
("TryStatement", StructDetails { field_order: None }),
|
||||
("TSNamespaceExportDeclaration", StructDetails { field_order: None }),
|
||||
("V8IntrinsicExpression", StructDetails { field_order: None }),
|
||||
("TSConstructSignatureDeclaration", StructDetails { field_order: None }),
|
||||
("CharacterClassEscape", StructDetails { field_order: None }),
|
||||
("TSMappedType", StructDetails { field_order: Some(&[0, 1, 2, 3, 5, 6, 4]) }),
|
||||
("Super", StructDetails { field_order: None }),
|
||||
("TSInferType", StructDetails { field_order: None }),
|
||||
("ExportAllDeclaration", StructDetails { field_order: None }),
|
||||
("TSSatisfiesExpression", StructDetails { field_order: None }),
|
||||
("Error", StructDetails { field_order: Some(&[4, 0, 1, 2, 3]) }),
|
||||
("Program", StructDetails { field_order: Some(&[0, 7, 1, 2, 3, 4, 5, 6]) }),
|
||||
("ContinueStatement", StructDetails { field_order: None }),
|
||||
("IgnoreGroup", StructDetails { field_order: None }),
|
||||
("Disjunction", StructDetails { field_order: None }),
|
||||
("ForStatement", StructDetails { field_order: None }),
|
||||
("JSXSpreadAttribute", StructDetails { field_order: None }),
|
||||
("SourceType", StructDetails { field_order: None }),
|
||||
("NullLiteral", StructDetails { field_order: None }),
|
||||
("BoundaryAssertion", StructDetails { field_order: None }),
|
||||
("TSNullKeyword", StructDetails { field_order: None }),
|
||||
("RegExp", StructDetails { field_order: None }),
|
||||
("FormalParameter", StructDetails { field_order: None }),
|
||||
("CapturingGroup", StructDetails { field_order: None }),
|
||||
("ExportNamedDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 3, 5, 4]) }),
|
||||
("JSXClosingElement", StructDetails { field_order: None }),
|
||||
("TSEnumBody", StructDetails { field_order: None }),
|
||||
("JSXMemberExpression", StructDetails { field_order: None }),
|
||||
("TSImportEqualsDeclaration", StructDetails { field_order: None }),
|
||||
("ReturnStatement", StructDetails { field_order: None }),
|
||||
("BindingPattern", StructDetails { field_order: None }),
|
||||
("ExportSpecifier", StructDetails { field_order: None }),
|
||||
("JSXFragment", StructDetails { field_order: None }),
|
||||
("BigIntLiteral", StructDetails { field_order: None }),
|
||||
],
|
||||
};
|
||||
@@ -1,10 +1,10 @@
|
||||
// Auto-generated code, DO NOT EDIT DIRECTLY!
|
||||
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.
|
||||
|
||||
const BUFFER_SIZE = 2147483632,
|
||||
const BUFFER_SIZE = 2147483616,
|
||||
BUFFER_ALIGN = 4294967296,
|
||||
DATA_POINTER_POS_32 = 536870906,
|
||||
IS_TS_FLAG_POS = 2147483628,
|
||||
DATA_POINTER_POS_32 = 536870902,
|
||||
IS_TS_FLAG_POS = 2147483612,
|
||||
PROGRAM_OFFSET = 0;
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -20,7 +20,7 @@ function deserialize(buffer, sourceTextInput, sourceByteLenInput) {
|
||||
sourceByteLen = sourceByteLenInput;
|
||||
sourceIsAscii = sourceText.length === sourceByteLen;
|
||||
|
||||
const data = deserializeRawTransferData(uint32[536870906]);
|
||||
const data = deserializeRawTransferData(uint32[536870902]);
|
||||
|
||||
uint8 =
|
||||
uint32 =
|
||||
@@ -4020,6 +4020,10 @@ function deserializeErrorSeverity(pos) {
|
||||
}
|
||||
}
|
||||
|
||||
function deserializeU8(pos) {
|
||||
return uint8[pos];
|
||||
}
|
||||
|
||||
function deserializeStr(pos) {
|
||||
const pos32 = pos >> 2,
|
||||
len = uint32[pos32 + 2];
|
||||
@@ -4855,10 +4859,6 @@ function deserializeF64(pos) {
|
||||
return float64[pos >> 3];
|
||||
}
|
||||
|
||||
function deserializeU8(pos) {
|
||||
return uint8[pos];
|
||||
}
|
||||
|
||||
function deserializeBoxJSXOpeningElement(pos) {
|
||||
return deserializeJSXOpeningElement(uint32[pos >> 2]);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ function deserialize(buffer, sourceTextInput, sourceByteLenInput) {
|
||||
sourceByteLen = sourceByteLenInput;
|
||||
sourceIsAscii = sourceText.length === sourceByteLen;
|
||||
|
||||
const data = deserializeRawTransferData(uint32[536870906]);
|
||||
const data = deserializeRawTransferData(uint32[536870902]);
|
||||
|
||||
uint8 =
|
||||
uint32 =
|
||||
@@ -4151,6 +4151,10 @@ function deserializeErrorSeverity(pos) {
|
||||
}
|
||||
}
|
||||
|
||||
function deserializeU8(pos) {
|
||||
return uint8[pos];
|
||||
}
|
||||
|
||||
function deserializeStr(pos) {
|
||||
const pos32 = pos >> 2,
|
||||
len = uint32[pos32 + 2];
|
||||
@@ -4986,10 +4990,6 @@ function deserializeF64(pos) {
|
||||
return float64[pos >> 3];
|
||||
}
|
||||
|
||||
function deserializeU8(pos) {
|
||||
return uint8[pos];
|
||||
}
|
||||
|
||||
function deserializeBoxJSXOpeningElement(pos) {
|
||||
return deserializeJSXOpeningElement(uint32[pos >> 2]);
|
||||
}
|
||||
|
||||
@@ -12472,6 +12472,10 @@ class StaticExport {
|
||||
|
||||
const DebugStaticExport = class StaticExport {};
|
||||
|
||||
function constructU8(pos, ast) {
|
||||
return ast.buffer[pos];
|
||||
}
|
||||
|
||||
function constructStr(pos, ast) {
|
||||
const pos32 = pos >> 2,
|
||||
{ buffer } = ast,
|
||||
@@ -13353,10 +13357,6 @@ function constructF64(pos, ast) {
|
||||
return ast.buffer.float64[pos >> 3];
|
||||
}
|
||||
|
||||
function constructU8(pos, ast) {
|
||||
return ast.buffer[pos];
|
||||
}
|
||||
|
||||
function constructBoxJSXOpeningElement(pos, ast) {
|
||||
return new JSXOpeningElement(ast.buffer.uint32[pos >> 2], ast);
|
||||
}
|
||||
|
||||
@@ -6,4 +6,5 @@
|
||||
|
||||
pub const BLOCK_SIZE: usize = 2147483632;
|
||||
pub const BLOCK_ALIGN: usize = 4294967296;
|
||||
pub const BUFFER_SIZE: usize = 2147483616;
|
||||
pub const RAW_METADATA_SIZE: usize = 16;
|
||||
@@ -19,7 +19,7 @@ use oxc_napi::get_source_type;
|
||||
|
||||
use crate::{
|
||||
AstType, ParserOptions, get_ast_type, parse,
|
||||
raw_transfer_constants::{BLOCK_ALIGN as BUFFER_ALIGN, BLOCK_SIZE as BUFFER_SIZE},
|
||||
raw_transfer_constants::{BLOCK_ALIGN as BUFFER_ALIGN, BUFFER_SIZE},
|
||||
raw_transfer_types::{EcmaScriptModule, Error, RawTransferData, RawTransferMetadata},
|
||||
};
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ use super::define_generator;
|
||||
const MALLOC_RESERVED_SIZE: u32 = 16;
|
||||
|
||||
/// Minimum alignment requirement for end of `Allocator`'s chunk
|
||||
#[expect(dead_code)]
|
||||
const ALLOCATOR_CHUNK_END_ALIGN: u32 = 16;
|
||||
|
||||
/// Size of block of memory used for raw transfer.
|
||||
@@ -1002,6 +1001,8 @@ impl DeserializeFunctionName for PointerDef {
|
||||
/// Constants for position of fields in buffer which deserialization starts from.
|
||||
#[derive(Clone, Copy)]
|
||||
struct Constants {
|
||||
/// Size of buffer in bytes
|
||||
buffer_size: u32,
|
||||
/// Offset within buffer of `u32` containing position of `RawTransferData`
|
||||
data_pointer_pos: u32,
|
||||
/// Offset within buffer of `bool` indicating if AST is TS or JS
|
||||
@@ -1014,13 +1015,14 @@ struct Constants {
|
||||
|
||||
/// Generate constants file.
|
||||
fn generate_constants(consts: Constants) -> (String, TokenStream) {
|
||||
let Constants { data_pointer_pos, is_ts_pos, program_offset, raw_metadata_size } = consts;
|
||||
let Constants { buffer_size, data_pointer_pos, is_ts_pos, program_offset, raw_metadata_size } =
|
||||
consts;
|
||||
|
||||
let data_pointer_pos_32 = data_pointer_pos / 4;
|
||||
|
||||
#[rustfmt::skip]
|
||||
let js_output = format!("
|
||||
const BUFFER_SIZE = {BLOCK_SIZE},
|
||||
const BUFFER_SIZE = {buffer_size},
|
||||
BUFFER_ALIGN = {BLOCK_ALIGN},
|
||||
DATA_POINTER_POS_32 = {data_pointer_pos_32},
|
||||
IS_TS_FLAG_POS = {is_ts_pos},
|
||||
@@ -1037,6 +1039,7 @@ fn generate_constants(consts: Constants) -> (String, TokenStream) {
|
||||
|
||||
let block_size = number_lit(BLOCK_SIZE);
|
||||
let block_align = number_lit(BLOCK_ALIGN);
|
||||
let buffer_size = number_lit(buffer_size);
|
||||
let raw_metadata_size = number_lit(raw_metadata_size);
|
||||
let rust_output = quote! {
|
||||
#![expect(clippy::unreadable_literal)]
|
||||
@@ -1045,6 +1048,7 @@ fn generate_constants(consts: Constants) -> (String, TokenStream) {
|
||||
///@@line_break
|
||||
pub const BLOCK_SIZE: usize = #block_size;
|
||||
pub const BLOCK_ALIGN: usize = #block_align;
|
||||
pub const BUFFER_SIZE: usize = #buffer_size;
|
||||
pub const RAW_METADATA_SIZE: usize = #raw_metadata_size;
|
||||
};
|
||||
|
||||
@@ -1055,7 +1059,16 @@ fn generate_constants(consts: Constants) -> (String, TokenStream) {
|
||||
fn get_constants(schema: &Schema) -> Constants {
|
||||
let raw_metadata_struct = schema.type_by_name("RawTransferMetadata").as_struct().unwrap();
|
||||
let raw_metadata_size = raw_metadata_struct.layout_64().size;
|
||||
let raw_metadata_pos = BLOCK_SIZE - raw_metadata_size;
|
||||
|
||||
// Round up to multiple of `ALLOCATOR_CHUNK_END_ALIGN`
|
||||
let fixed_metadata_struct =
|
||||
schema.type_by_name("FixedSizeAllocatorMetadata").as_struct().unwrap();
|
||||
let fixed_metadata_size =
|
||||
fixed_metadata_struct.layout_64().size.next_multiple_of(ALLOCATOR_CHUNK_END_ALIGN);
|
||||
|
||||
let buffer_size = BLOCK_SIZE - fixed_metadata_size;
|
||||
|
||||
let raw_metadata_pos = buffer_size - raw_metadata_size;
|
||||
let data_pointer_pos =
|
||||
raw_metadata_pos + raw_metadata_struct.field_by_name("data_offset").offset_64();
|
||||
let is_ts_pos = raw_metadata_pos + raw_metadata_struct.field_by_name("is_ts").offset_64();
|
||||
@@ -1067,5 +1080,5 @@ fn get_constants(schema: &Schema) -> Constants {
|
||||
.field_by_name("program")
|
||||
.offset_64();
|
||||
|
||||
Constants { data_pointer_pos, is_ts_pos, program_offset, raw_metadata_size }
|
||||
Constants { buffer_size, data_pointer_pos, is_ts_pos, program_offset, raw_metadata_size }
|
||||
}
|
||||
@@ -207,6 +207,7 @@ use utils::create_ident;
|
||||
|
||||
/// Paths to source files containing AST types
|
||||
static SOURCE_PATHS: &[&str] = &[
|
||||
"crates/oxc_allocator/src/pool_fixed_size.rs",
|
||||
"crates/oxc_ast/src/ast/js.rs",
|
||||
"crates/oxc_ast/src/ast/literal.rs",
|
||||
"crates/oxc_ast/src/ast/jsx.rs",
|
||||
|
||||
Reference in new issue
Block a user