intrinsics pr-01

This commit is contained in:
2026-03-24 13:40:45 +00:00
parent f126a64099
commit eb835bafee
7 changed files with 496 additions and 45 deletions
@@ -591,8 +591,8 @@ fn parse_syscalls(data: &[u8]) -> Result<Vec<SyscallDecl>, LoadError> {
if pos + module_len > data.len() {
return Err(LoadError::UnexpectedEof);
}
let module =
std::str::from_utf8(&data[pos..pos + module_len]).map_err(|_| LoadError::InvalidUtf8)?;
let module = std::str::from_utf8(&data[pos..pos + module_len])
.map_err(|_| LoadError::InvalidUtf8)?;
pos += module_len;
if pos + 2 > data.len() {
@@ -634,9 +634,11 @@ fn parse_syscalls(data: &[u8]) -> Result<Vec<SyscallDecl>, LoadError> {
fn validate_module(module: &BytecodeModule) -> Result<(), LoadError> {
let mut syscall_identities = HashSet::with_capacity(module.syscalls.len());
for syscall in &module.syscalls {
if !syscall_identities
.insert((syscall.module.clone(), syscall.name.clone(), syscall.version))
{
if !syscall_identities.insert((
syscall.module.clone(),
syscall.name.clone(),
syscall.version,
)) {
return Err(LoadError::DuplicateSyscallIdentity);
}
}