Skip to content

Truly independent web browser

LibJS: Stop versioning the host class table ABI

Andreas Kling0d67dc88f1cf
diff --git a/Libraries/LibJS/HostClassBuilder.h b/Libraries/LibJS/HostClassBuilder.h
index ceaaf1873d4..5da35fcc2ae 100644
--- a/Libraries/LibJS/HostClassBuilder.h
+++ b/Libraries/LibJS/HostClassBuilder.h
@@ -550,9 +550,7 @@ consteval JSHostClass make_host_class(u8 kind, StringView name, JSHostClass cons
VERIFY(!(flags & JS_HOST_CLASS_SHARES_ALLOCATOR_WITH_PARENT) || parent);
return JSHostClass {
- .abi_version = JS_HOST_ABI_VERSION,
.kind = kind,
- .reserved = 0,
.flags = flags,
.name = name.characters_without_null_termination(),
.name_length = name.length(),
diff --git a/Libraries/LibJS/HostObjectABI.h b/Libraries/LibJS/HostObjectABI.h
index 7689bc8ff00..9978c73c1de 100644
--- a/Libraries/LibJS/HostObjectABI.h
+++ b/Libraries/LibJS/HostObjectABI.h
@@ -26,10 +26,6 @@
extern "C" {
#endif
-enum {
- JS_HOST_ABI_VERSION = 1,
-};
-
// Layout of every host object of kind JS_HOST_CLASS_OBJECT. Direct getter functions read the wrappable slot without
// checking what it holds, so it only ever holds the embedder's wrapped implementation object. Any other per-object state
// belongs in the host data slot. The host object's own fields follow the engine's object, which is 32 bytes.
@@ -239,9 +235,7 @@ typedef struct JSHostModuleHooks {
} JSHostModuleHooks;
typedef struct JSHostClass {
- uint16_t abi_version;
uint8_t kind;
- uint8_t reserved;
uint32_t flags;
char const* name;
size_t name_length;
diff --git a/Libraries/LibJS/Rust/generate/layout_header.rs b/Libraries/LibJS/Rust/generate/layout_header.rs
index d7a67befbb1..1b7df13e499 100644
--- a/Libraries/LibJS/Rust/generate/layout_header.rs
+++ b/Libraries/LibJS/Rust/generate/layout_header.rs
@@ -459,10 +459,9 @@ pub fn generate() -> LayoutHeader {
check_host_object_abi_struct!(w, JSHostArrayHooks { set, delete_property });
check_host_object_abi_struct!(w, JSResolvedBinding { module, binding_name, r#type });
check_host_object_abi_struct!(w, JSHostModuleHooks { get_exported_names, resolve_export, initialize_environment, execute_module });
- check_host_object_abi_struct!(w, JSHostClass { abi_version, kind, reserved, flags, name, name_length, parent, hooks, user_data });
+ check_host_object_abi_struct!(w, JSHostClass { kind, flags, name, name_length, parent, hooks, user_data });
check_host_object_abi_constants!(
w,
- JS_HOST_ABI_VERSION,
JS_COMPLETION_NORMAL,
JS_COMPLETION_THROW,
JS_PROPERTY_LOOKUP_PHASE_OWN_PROPERTY,
diff --git a/Libraries/LibJS/Rust/src/embedding/host/class_table.rs b/Libraries/LibJS/Rust/src/embedding/host/class_table.rs
index 8f157744243..955c09f781b 100644
--- a/Libraries/LibJS/Rust/src/embedding/host/class_table.rs
+++ b/Libraries/LibJS/Rust/src/embedding/host/class_table.rs
@@ -13,9 +13,9 @@ use crate::embedding::abi_types::{completion_from_abi, optional_cell_from_abi};
use crate::interpreter::vm::Vm;
use crate::layout::cell::Gc;
use crate::layout::host_class::{
- JS_HOST_ABI_VERSION, JS_HOST_CLASS_ARRAY, JS_HOST_CLASS_FUNCTION, JS_HOST_CLASS_HAS_CONSTRUCTOR,
- JS_HOST_CLASS_IMMUTABLE_PROTOTYPE, JS_HOST_CLASS_IS_GLOBAL_OBJECT, JS_HOST_CLASS_IS_HTMLDDA,
- JS_HOST_CLASS_IS_PLATFORM_OBJECT, JS_HOST_CLASS_MAY_INTERFERE_WITH_INDEXED_PROPERTY_ACCESS, JS_HOST_CLASS_MODULE,
+ JS_HOST_CLASS_ARRAY, JS_HOST_CLASS_FUNCTION, JS_HOST_CLASS_HAS_CONSTRUCTOR, JS_HOST_CLASS_IMMUTABLE_PROTOTYPE,
+ JS_HOST_CLASS_IS_GLOBAL_OBJECT, JS_HOST_CLASS_IS_HTMLDDA, JS_HOST_CLASS_IS_PLATFORM_OBJECT,
+ JS_HOST_CLASS_MAY_INTERFERE_WITH_INDEXED_PROPERTY_ACCESS, JS_HOST_CLASS_MODULE,
JS_HOST_CLASS_NOT_CACHEABLE_ACROSS_REALMS, JS_HOST_CLASS_NOT_CACHEABLE_FOR_INDEXED_PROPERTY_ABSENCE,
JS_HOST_CLASS_NOT_CACHEABLE_FOR_PROPERTY_ABSENCE,
JS_HOST_CLASS_NOT_ELIGIBLE_FOR_OWN_PROPERTY_ENUMERATION_FAST_PATH, JS_HOST_CLASS_OBJECT,
@@ -98,9 +98,7 @@ impl JSHostClass {
flags: u32,
) -> Self {
Self {
- abi_version: JS_HOST_ABI_VERSION,
kind,
- reserved: 0,
flags,
name: name.as_ptr().cast(),
name_length: name.len(),
@@ -183,16 +181,10 @@ impl JSHostClass {
unsafe { self.hooks.cast::<JSHostArrayHooks>().as_ref() }.unwrap_or(&HOST_ARRAY_HOOKS_THAT_ARE_ALL_ORDINARY)
}
- /// Checks what LibJS/HostObjectABI.h requires of a table of `kind`, which the engine then relies on: its version
- /// and kind, flags that apply to the kind, a parent of the same kind to share an allocator with, and the hooks the
- /// kind cannot do without.
+ /// Checks what LibJS/HostObjectABI.h requires of a table of `kind`, which the engine then relies on: its kind,
+ /// flags that apply to the kind, a parent of the same kind to share an allocator with, and the hooks the kind
+ /// cannot do without.
pub fn validate(&'static self, kind: u8) {
- assert!(
- self.abi_version == JS_HOST_ABI_VERSION,
- "the host class {} is of ABI version {}, not {JS_HOST_ABI_VERSION}",
- self.class_name(),
- self.abi_version
- );
assert!(
self.kind == kind,
"the host class {} is of kind {}, not {kind}",
diff --git a/Libraries/LibJS/Rust/src/layout/host_class.rs b/Libraries/LibJS/Rust/src/layout/host_class.rs
index 3f216c9559b..eecafdb7f99 100644
--- a/Libraries/LibJS/Rust/src/layout/host_class.rs
+++ b/Libraries/LibJS/Rust/src/layout/host_class.rs
@@ -12,8 +12,6 @@
use core::ffi::{c_char, c_void};
-pub const JS_HOST_ABI_VERSION: u16 = 1;
-
pub type JSValue = u64;
/// A borrowed property key, with the bits of the runtime's own property key.
@@ -210,9 +208,7 @@ pub struct JSHostModuleHooks {
#[repr(C)]
pub struct JSHostClass {
- pub abi_version: u16,
pub kind: u8,
- pub reserved: u8,
pub flags: u32,
pub name: *const c_char,
pub name_length: usize,