Update dependencies (#503)

- Rust dependencies
- JS dependencies
- Retester submodule

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
xermicus authored and GitHub committed 2026-04-13 14:59:24 +02:00
1 parent b3cd402549
commit 255f5cc31b
18 files changed
+3035 -2444

No files matched your search

@@ -1,5 +1,7 @@
//! The LLVM intrinsic functions.
use std::num::NonZeroU32;
use inkwell::types::BasicType;
use crate::polkavm::context::function::declaration::Declaration as FunctionDeclaration;
@@ -37,8 +39,17 @@ impl<'ctx> Intrinsics<'ctx> {
module: &inkwell::module::Module<'ctx>,
) -> Self {
let void_type = llvm.void_type();
let word_type = llvm.custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32);
let address_type = llvm.custom_width_int_type(revive_common::BIT_LENGTH_ETH_ADDRESS as u32);
let word_type = llvm
.custom_width_int_type(
NonZeroU32::new(revive_common::BIT_LENGTH_WORD as u32).expect("const is non-zero"),
)
.expect("valid integer width");
let address_type = llvm
.custom_width_int_type(
NonZeroU32::new(revive_common::BIT_LENGTH_ETH_ADDRESS as u32)
.expect("const is non-zero"),
)
.expect("valid integer width");
let trap = Self::declare(
llvm,
@@ -94,13 +105,21 @@ impl<'ctx> Intrinsics<'ctx> {
llvm: &'ctx inkwell::context::Context,
name: &str,
) -> Vec<inkwell::types::BasicTypeEnum<'ctx>> {
let word_type = llvm.custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32);
let word_type = llvm
.custom_width_int_type(
NonZeroU32::new(revive_common::BIT_LENGTH_WORD as u32).expect("const is non-zero"),
)
.expect("valid integer width");
match name {
_ if name == Self::FUNCTION_BYTE_SWAP_WORD => vec![word_type.as_basic_type_enum()],
_ if name == Self::FUNCTION_BYTE_SWAP_ETH_ADDRESS => {
vec![llvm
.custom_width_int_type(revive_common::BIT_LENGTH_ETH_ADDRESS as u32)
.custom_width_int_type(
NonZeroU32::new(revive_common::BIT_LENGTH_ETH_ADDRESS as u32)
.expect("const is non-zero"),
)
.expect("valid integer width")
.as_basic_type_enum()]
}
_ if name == Self::FUNCTION_COUNT_LEADING_ZEROS => {
+27 -6
View File
@@ -3,6 +3,7 @@
use std::cell::RefCell;
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::num::NonZeroU32;
use std::rc::Rc;
use inkwell::debug_info::AsDIScope;
@@ -1208,23 +1209,37 @@ impl<'ctx> Context<'ctx> {
/// Returns the default byte type.
pub fn byte_type(&self) -> inkwell::types::IntType<'ctx> {
self.llvm
.custom_width_int_type(revive_common::BIT_LENGTH_BYTE as u32)
.custom_width_int_type(
NonZeroU32::new(revive_common::BIT_LENGTH_BYTE as u32).expect("const is non-zero"),
)
.expect("valid integer width")
}
/// Returns the integer type of the specified bit-length.
pub fn integer_type(&self, bit_length: usize) -> inkwell::types::IntType<'ctx> {
self.llvm.custom_width_int_type(bit_length as u32)
self.llvm
.custom_width_int_type(
NonZeroU32::new(bit_length as u32).expect("bit length is non-zero"),
)
.expect("valid integer width")
}
/// Returns the XLEN witdh sized type.
pub fn xlen_type(&self) -> inkwell::types::IntType<'ctx> {
self.llvm.custom_width_int_type(crate::polkavm::XLEN as u32)
self.llvm
.custom_width_int_type(
NonZeroU32::new(crate::polkavm::XLEN as u32).expect("const is non-zero"),
)
.expect("valid integer width")
}
/// Returns the PolkaVM native register width sized type.
pub fn register_type(&self) -> inkwell::types::IntType<'ctx> {
self.llvm
.custom_width_int_type(revive_common::BIT_LENGTH_X64 as u32)
.custom_width_int_type(
NonZeroU32::new(revive_common::BIT_LENGTH_X64 as u32).expect("const is non-zero"),
)
.expect("valid integer width")
}
/// Returns the sentinel pointer value.
@@ -1244,13 +1259,19 @@ impl<'ctx> Context<'ctx> {
/// Returns the runtime value width sized type.
pub fn value_type(&self) -> inkwell::types::IntType<'ctx> {
self.llvm
.custom_width_int_type(revive_common::BIT_LENGTH_VALUE as u32)
.custom_width_int_type(
NonZeroU32::new(revive_common::BIT_LENGTH_VALUE as u32).expect("const is non-zero"),
)
.expect("valid integer width")
}
/// Returns the default word type.
pub fn word_type(&self) -> inkwell::types::IntType<'ctx> {
self.llvm
.custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32)
.custom_width_int_type(
NonZeroU32::new(revive_common::BIT_LENGTH_WORD as u32).expect("const is non-zero"),
)
.expect("valid integer width")
}
/// Returns the array type with the specified length.
+16 -9
View File
@@ -1,6 +1,7 @@
//! The LLVM context library.
use std::collections::BTreeMap;
use std::num::NonZeroU32;
use crate::debug_config::DebugConfig;
use crate::optimizer::settings::Settings as OptimizerSettings;
@@ -80,7 +81,7 @@ pub fn link(
Ok(format @ ObjectFormat::PVM) => (bytecode.to_vec(), format),
Ok(ObjectFormat::ELF) => {
let symbols = build_symbols(linker_symbols, factory_dependencies)?;
let bytecode_linked = ElfLinker::setup()?.link(bytecode, symbols.as_slice())?;
let bytecode_linked = ElfLinker::setup()?.link(bytecode, &symbols)?;
polkavm_linker(&bytecode_linked, strip_binary)
.map(|pvm| (pvm, ObjectFormat::PVM))
.unwrap_or_else(|error| {
@@ -105,11 +106,17 @@ pub fn link(
pub fn build_symbols(
linker_symbols: &BTreeMap<String, [u8; BYTE_LENGTH_ETH_ADDRESS]>,
factory_dependencies: &BTreeMap<String, [u8; BYTE_LENGTH_WORD]>,
) -> anyhow::Result<inkwell::memory_buffer::MemoryBuffer> {
) -> anyhow::Result<Vec<u8>> {
let context = inkwell::context::Context::create();
let module = context.create_module("symbols");
let word_type = context.custom_width_int_type(BIT_LENGTH_WORD as u32);
let address_type = context.custom_width_int_type(BIT_LENGTH_ETH_ADDRESS as u32);
let word_type = context
.custom_width_int_type(NonZeroU32::new(BIT_LENGTH_WORD as u32).expect("const is non-zero"))
.expect("valid integer width");
let address_type = context
.custom_width_int_type(
NonZeroU32::new(BIT_LENGTH_ETH_ADDRESS as u32).expect("const is non-zero"),
)
.expect("valid integer width");
for (name, value) in linker_symbols {
let global_value = module.add_global(address_type, Default::default(), name);
@@ -137,11 +144,11 @@ pub fn build_symbols(
);
}
Ok(
PolkaVMTargetMachine::new(PolkaVMTarget::PVM, &OptimizerSettings::none())?
.write_to_memory_buffer(&module)
.expect("ICE: the symbols module should be valid"),
)
let target_machine = PolkaVMTargetMachine::new(PolkaVMTarget::PVM, &OptimizerSettings::none())?;
let buffer = target_machine
.write_to_memory_buffer(&module)
.expect("ICE: the symbols module should be valid");
Ok(buffer.as_slice().to_vec())
}
/// Implemented by items which are translated into LLVM IR.
pub trait WriteLLVM {
@@ -59,10 +59,10 @@ impl TargetMachine {
}
/// Writes the LLVM module to a memory buffer.
pub fn write_to_memory_buffer(
pub fn write_to_memory_buffer<'ctx>(
&self,
module: &inkwell::module::Module,
) -> Result<inkwell::memory_buffer::MemoryBuffer, inkwell::support::LLVMString> {
module: &inkwell::module::Module<'ctx>,
) -> Result<inkwell::memory_buffer::MemoryBuffer<'ctx>, inkwell::support::LLVMString> {
match self.target {
Target::PVM => self
.target_machine