Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[move][move-vm][rewrite][cleanup] Replace type info with a datatype descriptor pointers in VTables #21132

Open
wants to merge 2 commits into
base: cgsworsd/vm_rewrite_jit_opt
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ impl Arena {
Err(PartialVMError::new(StatusCode::PACKAGE_ARENA_LIMIT_REACHED))
}
}

pub fn alloc_item<T>(&self, item: T) -> PartialVMResult<*const T> {
if let Ok(value) = self.0.try_alloc(item) {
Ok(value)
} else {
Err(PartialVMError::new(StatusCode::PACKAGE_ARENA_LIMIT_REACHED))
}
Comment on lines +56 to +60
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
if let Ok(value) = self.0.try_alloc(item) {
Ok(value)
} else {
Err(PartialVMError::new(StatusCode::PACKAGE_ARENA_LIMIT_REACHED))
}
self.0.try_alloc(item).map_err(|_| PartialVMError::new(StatusCode::PACKAGE_ARENA_LIMIT_REACHED))

Copy link
Contributor Author

@cgswords cgswords Feb 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate this is more-concise, but the next PR needs the code like this anyway -- it has a more-complicated Ok case.

}
}

// -----------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl Package {
/// Used for testing that the correct number of types are loaded
#[allow(dead_code)]
pub(crate) fn loaded_types_len(&self) -> usize {
self.runtime.vtable.types.cached_types.len()
self.runtime.vtable.types.len()
}
}

Expand Down
Loading
Loading