mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-27 16:17:59 +00:00
@@ -29,12 +29,12 @@ impl IRType {
|
||||
///
|
||||
pub fn file_extension(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Yul => era_compiler_common::EXTENSION_YUL,
|
||||
Self::EthIR => era_compiler_common::EXTENSION_ETHIR,
|
||||
Self::EVMLA => era_compiler_common::EXTENSION_EVMLA,
|
||||
Self::LLL => era_compiler_common::EXTENSION_LLL,
|
||||
Self::LLVM => era_compiler_common::EXTENSION_LLVM_SOURCE,
|
||||
Self::Assembly => era_compiler_common::EXTENSION_ERAVM_ASSEMBLY,
|
||||
Self::Yul => revive_common::EXTENSION_YUL,
|
||||
Self::EthIR => revive_common::EXTENSION_ETHIR,
|
||||
Self::EVMLA => revive_common::EXTENSION_EVMLA,
|
||||
Self::LLL => revive_common::EXTENSION_LLL,
|
||||
Self::LLVM => revive_common::EXTENSION_LLVM_SOURCE,
|
||||
Self::Assembly => revive_common::EXTENSION_ERAVM_ASSEMBLY,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ pub const HEAP_AUX_OFFSET_EXTERNAL_CALL: u64 = 0;
|
||||
|
||||
/// The constructor return data offset in the auxiliary heap.
|
||||
pub const HEAP_AUX_OFFSET_CONSTRUCTOR_RETURN_DATA: u64 =
|
||||
8 * (era_compiler_common::BYTE_LENGTH_FIELD as u64);
|
||||
8 * (revive_common::BYTE_LENGTH_FIELD as u64);
|
||||
|
||||
/// The number of the extra ABI data arguments.
|
||||
pub const EXTRA_ABI_DATA_SIZE: usize = 0;
|
||||
@@ -69,4 +69,4 @@ pub const SYSTEM_CALL_BIT: bool = true;
|
||||
/// - constructor arguments length (32 bytes)
|
||||
///
|
||||
pub const DEPLOYER_CALL_HEADER_SIZE: usize =
|
||||
era_compiler_common::BYTE_LENGTH_X32 + (era_compiler_common::BYTE_LENGTH_FIELD * 4);
|
||||
revive_common::BYTE_LENGTH_X32 + (revive_common::BYTE_LENGTH_FIELD * 4);
|
||||
|
||||
@@ -15,7 +15,7 @@ pub struct Build {
|
||||
/// The EraVM text assembly.
|
||||
pub assembly_text: String,
|
||||
/// The metadata hash.
|
||||
pub metadata_hash: Option<[u8; era_compiler_common::BYTE_LENGTH_FIELD]>,
|
||||
pub metadata_hash: Option<[u8; revive_common::BYTE_LENGTH_FIELD]>,
|
||||
/// The EraVM binary bytecode.
|
||||
pub bytecode: Vec<u8>,
|
||||
/// The EraVM bytecode hash.
|
||||
@@ -30,7 +30,7 @@ impl Build {
|
||||
///
|
||||
pub fn new(
|
||||
assembly_text: String,
|
||||
metadata_hash: Option<[u8; era_compiler_common::BYTE_LENGTH_FIELD]>,
|
||||
metadata_hash: Option<[u8; revive_common::BYTE_LENGTH_FIELD]>,
|
||||
bytecode: Vec<u8>,
|
||||
bytecode_hash: String,
|
||||
) -> Self {
|
||||
|
||||
@@ -46,8 +46,8 @@ impl<'ctx> Intrinsics<'ctx> {
|
||||
) -> Self {
|
||||
let void_type = llvm.void_type();
|
||||
let bool_type = llvm.bool_type();
|
||||
let byte_type = llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_BYTE as u32);
|
||||
let field_type = llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32);
|
||||
let byte_type = llvm.custom_width_int_type(revive_common::BIT_LENGTH_BYTE as u32);
|
||||
let field_type = llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32);
|
||||
let _stack_field_pointer_type = field_type.ptr_type(AddressSpace::Stack.into());
|
||||
let heap_field_pointer_type = byte_type.ptr_type(AddressSpace::Heap.into());
|
||||
let generic_byte_pointer_type = byte_type.ptr_type(AddressSpace::Generic.into());
|
||||
@@ -126,7 +126,7 @@ impl<'ctx> Intrinsics<'ctx> {
|
||||
llvm: &'ctx inkwell::context::Context,
|
||||
name: &str,
|
||||
) -> Vec<inkwell::types::BasicTypeEnum<'ctx>> {
|
||||
let field_type = llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32);
|
||||
let field_type = llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32);
|
||||
|
||||
match name {
|
||||
name if name == Self::FUNCTION_MEMORY_COPY => vec![
|
||||
|
||||
@@ -202,10 +202,10 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
let div = Self::declare(
|
||||
module,
|
||||
Self::FUNCTION_DIV,
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
2
|
||||
@@ -221,10 +221,10 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
let r#mod = Self::declare(
|
||||
module,
|
||||
Self::FUNCTION_MOD,
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
2
|
||||
@@ -240,10 +240,10 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
let sdiv = Self::declare(
|
||||
module,
|
||||
Self::FUNCTION_SDIV,
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
2
|
||||
@@ -259,10 +259,10 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
let smod = Self::declare(
|
||||
module,
|
||||
Self::FUNCTION_SMOD,
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
2
|
||||
@@ -278,10 +278,10 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
let shl = Self::declare(
|
||||
module,
|
||||
Self::FUNCTION_SHL,
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
2
|
||||
@@ -297,10 +297,10 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
let shr = Self::declare(
|
||||
module,
|
||||
Self::FUNCTION_SHR,
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
2
|
||||
@@ -316,10 +316,10 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
let sar = Self::declare(
|
||||
module,
|
||||
Self::FUNCTION_SAR,
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
2
|
||||
@@ -335,10 +335,10 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
let byte = Self::declare(
|
||||
module,
|
||||
Self::FUNCTION_BYTE,
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
2
|
||||
@@ -354,10 +354,10 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
let add_mod = Self::declare(
|
||||
module,
|
||||
Self::FUNCTION_ADDMOD,
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
3
|
||||
@@ -373,10 +373,10 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
let mul_mod = Self::declare(
|
||||
module,
|
||||
Self::FUNCTION_MULMOD,
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
3
|
||||
@@ -392,10 +392,10 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
let exp = Self::declare(
|
||||
module,
|
||||
Self::FUNCTION_EXP,
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
2
|
||||
@@ -409,10 +409,10 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
Function::set_pure_function_attributes(llvm, exp);
|
||||
|
||||
let sign_extend = FunctionDeclaration::new(
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
2
|
||||
@@ -432,11 +432,11 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
Self::FUNCTION_MSTORE8,
|
||||
llvm.void_type().fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_BYTE as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_BYTE as u32)
|
||||
.ptr_type(AddressSpace::Heap.into())
|
||||
.as_basic_type_enum()
|
||||
.into(),
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into(),
|
||||
]
|
||||
@@ -460,17 +460,17 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
let sha3 = Self::declare(
|
||||
module,
|
||||
Self::FUNCTION_SHA3,
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_BYTE as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_BYTE as u32)
|
||||
.ptr_type(AddressSpace::Heap.into())
|
||||
.as_basic_type_enum()
|
||||
.into(),
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into(),
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_BOOLEAN as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_BOOLEAN as u32)
|
||||
.as_basic_type_enum()
|
||||
.into(),
|
||||
]
|
||||
@@ -491,19 +491,19 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
let system_request = Self::declare(
|
||||
module,
|
||||
Self::FUNCTION_SYSTEM_REQUEST,
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into(),
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into(),
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into(),
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.ptr_type(AddressSpace::Stack.into())
|
||||
.as_basic_type_enum()
|
||||
.into(),
|
||||
@@ -523,7 +523,7 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
);
|
||||
|
||||
let external_call_arguments: Vec<inkwell::types::BasicMetadataTypeEnum> = vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
crate::eravm::context::function::runtime::entry::Entry::MANDATORY_ARGUMENTS_COUNT
|
||||
@@ -531,23 +531,23 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
];
|
||||
let mut mimic_call_arguments = external_call_arguments.clone();
|
||||
mimic_call_arguments.push(
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into(),
|
||||
);
|
||||
|
||||
let mut external_call_arguments_by_ref: Vec<inkwell::types::BasicMetadataTypeEnum> = vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_BYTE as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_BYTE as u32)
|
||||
.ptr_type(AddressSpace::Generic.into())
|
||||
.as_basic_type_enum()
|
||||
.into(),
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into(),
|
||||
];
|
||||
external_call_arguments_by_ref.extend::<Vec<inkwell::types::BasicMetadataTypeEnum>>(vec![
|
||||
llvm.custom_width_int_type(
|
||||
era_compiler_common::BIT_LENGTH_FIELD as u32
|
||||
revive_common::BIT_LENGTH_FIELD as u32
|
||||
)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
@@ -555,7 +555,7 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
]);
|
||||
let mut mimic_call_arguments_by_ref = external_call_arguments_by_ref.clone();
|
||||
mimic_call_arguments_by_ref.push(
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into(),
|
||||
);
|
||||
@@ -563,7 +563,7 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
let external_call_result_type = llvm
|
||||
.struct_type(
|
||||
&[
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_BYTE as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_BYTE as u32)
|
||||
.ptr_type(AddressSpace::Generic.into())
|
||||
.as_basic_type_enum(),
|
||||
llvm.bool_type().as_basic_type_enum(),
|
||||
@@ -635,7 +635,7 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
Self::FUNCTION_RETURN,
|
||||
llvm.void_type().fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
3
|
||||
@@ -651,7 +651,7 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
||||
Self::FUNCTION_REVERT,
|
||||
llvm.void_type().fn_type(
|
||||
vec![
|
||||
llvm.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
.as_basic_type_enum()
|
||||
.into();
|
||||
3
|
||||
|
||||
@@ -63,7 +63,7 @@ impl<'ctx> Return<'ctx> {
|
||||
/// Returns the return data size in bytes, based on the default stack alignment.
|
||||
///
|
||||
pub fn return_data_size(&self) -> usize {
|
||||
era_compiler_common::BYTE_LENGTH_FIELD
|
||||
revive_common::BYTE_LENGTH_FIELD
|
||||
* match self {
|
||||
Self::None => 0,
|
||||
Self::Primitive { .. } => 1,
|
||||
|
||||
@@ -69,11 +69,11 @@ where
|
||||
context.set_basic_block(context.current_function().borrow().entry_block());
|
||||
context.set_code_type(CodeType::Deploy);
|
||||
if let Some(vyper) = context.vyper_data.as_ref() {
|
||||
for index in 0..vyper.immutables_size() / era_compiler_common::BYTE_LENGTH_FIELD {
|
||||
for index in 0..vyper.immutables_size() / revive_common::BYTE_LENGTH_FIELD {
|
||||
let offset = (crate::eravm::r#const::HEAP_AUX_OFFSET_CONSTRUCTOR_RETURN_DATA
|
||||
as usize)
|
||||
+ (1 + index) * 2 * era_compiler_common::BYTE_LENGTH_FIELD;
|
||||
let value = index * era_compiler_common::BYTE_LENGTH_FIELD;
|
||||
+ (1 + index) * 2 * revive_common::BYTE_LENGTH_FIELD;
|
||||
let value = index * revive_common::BYTE_LENGTH_FIELD;
|
||||
let pointer = Pointer::new_with_offset(
|
||||
context,
|
||||
AddressSpace::HeapAuxiliary,
|
||||
|
||||
@@ -140,7 +140,7 @@ where
|
||||
|
||||
let salt_offset = context.builder().build_int_add(
|
||||
input_offset,
|
||||
context.field_const(era_compiler_common::BYTE_LENGTH_X32 as u64),
|
||||
context.field_const(revive_common::BYTE_LENGTH_X32 as u64),
|
||||
"deployer_call_salt_offset",
|
||||
)?;
|
||||
let salt_pointer = Pointer::new_with_offset(
|
||||
@@ -154,7 +154,7 @@ where
|
||||
|
||||
let arguments_offset_offset = context.builder().build_int_add(
|
||||
salt_offset,
|
||||
context.field_const((era_compiler_common::BYTE_LENGTH_FIELD * 2) as u64),
|
||||
context.field_const((revive_common::BYTE_LENGTH_FIELD * 2) as u64),
|
||||
"deployer_call_arguments_offset_offset",
|
||||
)?;
|
||||
let arguments_offset_pointer = Pointer::new_with_offset(
|
||||
@@ -168,14 +168,14 @@ where
|
||||
arguments_offset_pointer,
|
||||
context.field_const(
|
||||
(crate::eravm::DEPLOYER_CALL_HEADER_SIZE
|
||||
- (era_compiler_common::BYTE_LENGTH_X32
|
||||
+ era_compiler_common::BYTE_LENGTH_FIELD)) as u64,
|
||||
- (revive_common::BYTE_LENGTH_X32 + revive_common::BYTE_LENGTH_FIELD))
|
||||
as u64,
|
||||
),
|
||||
)?;
|
||||
|
||||
let arguments_length_offset = context.builder().build_int_add(
|
||||
arguments_offset_offset,
|
||||
context.field_const(era_compiler_common::BYTE_LENGTH_FIELD as u64),
|
||||
context.field_const(revive_common::BYTE_LENGTH_FIELD as u64),
|
||||
"deployer_call_arguments_length_offset",
|
||||
)?;
|
||||
let arguments_length_pointer = Pointer::new_with_offset(
|
||||
@@ -262,7 +262,7 @@ where
|
||||
&[
|
||||
context.field_const(0),
|
||||
context
|
||||
.integer_type(era_compiler_common::BIT_LENGTH_X32)
|
||||
.integer_type(revive_common::BIT_LENGTH_X32)
|
||||
.const_zero(),
|
||||
],
|
||||
context
|
||||
@@ -279,7 +279,7 @@ where
|
||||
&[
|
||||
context.field_const(0),
|
||||
context
|
||||
.integer_type(era_compiler_common::BIT_LENGTH_X32)
|
||||
.integer_type(revive_common::BIT_LENGTH_X32)
|
||||
.const_int(1, false),
|
||||
],
|
||||
context.bool_type().as_basic_type_enum(),
|
||||
|
||||
@@ -222,7 +222,7 @@ where
|
||||
pub fn build(
|
||||
mut self,
|
||||
contract_path: &str,
|
||||
metadata_hash: Option<[u8; era_compiler_common::BYTE_LENGTH_FIELD]>,
|
||||
metadata_hash: Option<[u8; revive_common::BYTE_LENGTH_FIELD]>,
|
||||
) -> anyhow::Result<Build> {
|
||||
let module_clone = self.module.clone();
|
||||
|
||||
@@ -645,7 +645,7 @@ where
|
||||
self.basic_block()
|
||||
.get_last_instruction()
|
||||
.expect("Always exists")
|
||||
.set_alignment(era_compiler_common::BYTE_LENGTH_FIELD as u32)
|
||||
.set_alignment(revive_common::BYTE_LENGTH_FIELD as u32)
|
||||
.expect("Alignment is valid");
|
||||
Pointer::new(r#type, AddressSpace::Stack, pointer)
|
||||
}
|
||||
@@ -681,7 +681,7 @@ where
|
||||
self.basic_block()
|
||||
.get_last_instruction()
|
||||
.expect("Always exists")
|
||||
.set_alignment(era_compiler_common::BYTE_LENGTH_BYTE as u32)
|
||||
.set_alignment(revive_common::BYTE_LENGTH_BYTE as u32)
|
||||
.expect("Alignment is valid");
|
||||
|
||||
Ok(self.build_byte_swap(value))
|
||||
@@ -720,7 +720,7 @@ where
|
||||
.build_store(storage_key_pointer.value, storage_key_value)?;
|
||||
self.builder().build_store(
|
||||
storage_value_length_pointer.value,
|
||||
self.integer_const(32, era_compiler_common::BIT_LENGTH_FIELD as u64),
|
||||
self.integer_const(32, revive_common::BIT_LENGTH_FIELD as u64),
|
||||
)?;
|
||||
|
||||
let runtime_api = self
|
||||
@@ -757,7 +757,7 @@ where
|
||||
self.basic_block()
|
||||
.get_last_instruction()
|
||||
.expect("Always exists")
|
||||
.set_alignment(era_compiler_common::BYTE_LENGTH_FIELD as u32)
|
||||
.set_alignment(revive_common::BYTE_LENGTH_FIELD as u32)
|
||||
.expect("Alignment is valid");
|
||||
|
||||
Ok(value)
|
||||
@@ -793,7 +793,7 @@ where
|
||||
|
||||
self.builder
|
||||
.build_store(heap_pointer.value, value)?
|
||||
.set_alignment(era_compiler_common::BYTE_LENGTH_BYTE as u32)
|
||||
.set_alignment(revive_common::BYTE_LENGTH_BYTE as u32)
|
||||
.expect("Alignment is valid");
|
||||
}
|
||||
AddressSpace::TransientStorage => todo!(),
|
||||
@@ -851,7 +851,7 @@ where
|
||||
AddressSpace::Stack => {
|
||||
let instruction = self.builder.build_store(pointer.value, value).unwrap();
|
||||
instruction
|
||||
.set_alignment(era_compiler_common::BYTE_LENGTH_FIELD as u32)
|
||||
.set_alignment(revive_common::BYTE_LENGTH_FIELD as u32)
|
||||
.expect("Alignment is valid");
|
||||
}
|
||||
};
|
||||
@@ -993,7 +993,7 @@ where
|
||||
self.byte_type()
|
||||
.ptr_type(AddressSpace::Stack.into())
|
||||
.as_basic_type_enum(),
|
||||
self.integer_type(era_compiler_common::BIT_LENGTH_X32)
|
||||
self.integer_type(revive_common::BIT_LENGTH_X32)
|
||||
.as_basic_type_enum(),
|
||||
]);
|
||||
self.builder
|
||||
@@ -1104,7 +1104,7 @@ where
|
||||
)?;
|
||||
let return_data_size_shifted = self.builder.build_right_shift(
|
||||
pointer_casted,
|
||||
self.field_const((era_compiler_common::BIT_LENGTH_X32 * 3) as u64),
|
||||
self.field_const((revive_common::BIT_LENGTH_X32 * 3) as u64),
|
||||
false,
|
||||
format!("{name}_return_data_size_shifted").as_str(),
|
||||
)?;
|
||||
@@ -1360,7 +1360,7 @@ where
|
||||
.builder()
|
||||
.build_right_shift(
|
||||
abi_pointer_value,
|
||||
self.field_const((era_compiler_common::BIT_LENGTH_X32 * 3) as u64),
|
||||
self.field_const((revive_common::BIT_LENGTH_X32 * 3) as u64),
|
||||
false,
|
||||
"abi_pointer_value_shifted",
|
||||
)
|
||||
@@ -1450,7 +1450,7 @@ where
|
||||
///
|
||||
pub fn byte_type(&self) -> inkwell::types::IntType<'ctx> {
|
||||
self.llvm
|
||||
.custom_width_int_type(era_compiler_common::BIT_LENGTH_BYTE as u32)
|
||||
.custom_width_int_type(revive_common::BIT_LENGTH_BYTE as u32)
|
||||
}
|
||||
|
||||
///
|
||||
@@ -1460,12 +1460,18 @@ where
|
||||
self.llvm.custom_width_int_type(bit_length as u32)
|
||||
}
|
||||
|
||||
/// Returns the register witdh sized type.
|
||||
pub fn xlen_type(&self) -> inkwell::types::IntType<'ctx> {
|
||||
self.llvm
|
||||
.custom_width_int_type(revive_common::BIT_LENGTH_X32 as u32)
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns the default field type.
|
||||
///
|
||||
pub fn field_type(&self) -> inkwell::types::IntType<'ctx> {
|
||||
self.llvm
|
||||
.custom_width_int_type(era_compiler_common::BIT_LENGTH_FIELD as u32)
|
||||
.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
||||
}
|
||||
|
||||
///
|
||||
@@ -1543,7 +1549,7 @@ where
|
||||
if argument.is_pointer_value() {
|
||||
call_site_value.set_alignment_attribute(
|
||||
inkwell::attributes::AttributeLoc::Param(index as u32),
|
||||
era_compiler_common::BYTE_LENGTH_FIELD as u32,
|
||||
revive_common::BYTE_LENGTH_FIELD as u32,
|
||||
);
|
||||
call_site_value.add_attribute(
|
||||
inkwell::attributes::AttributeLoc::Param(index as u32),
|
||||
@@ -1593,14 +1599,14 @@ where
|
||||
inkwell::attributes::AttributeLoc::Param(index as u32),
|
||||
self.llvm.create_enum_attribute(
|
||||
Attribute::Dereferenceable as u32,
|
||||
(era_compiler_common::BIT_LENGTH_FIELD * 2) as u64,
|
||||
(revive_common::BIT_LENGTH_FIELD * 2) as u64,
|
||||
),
|
||||
);
|
||||
call_site_value.add_attribute(
|
||||
inkwell::attributes::AttributeLoc::Return,
|
||||
self.llvm.create_enum_attribute(
|
||||
Attribute::Dereferenceable as u32,
|
||||
(era_compiler_common::BIT_LENGTH_FIELD * 2) as u64,
|
||||
(revive_common::BIT_LENGTH_FIELD * 2) as u64,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1625,7 +1631,7 @@ where
|
||||
{
|
||||
call_site_value.set_alignment_attribute(
|
||||
inkwell::attributes::AttributeLoc::Return,
|
||||
era_compiler_common::BYTE_LENGTH_FIELD as u32,
|
||||
revive_common::BYTE_LENGTH_FIELD as u32,
|
||||
);
|
||||
call_site_value.add_attribute(
|
||||
inkwell::attributes::AttributeLoc::Return,
|
||||
|
||||
@@ -28,7 +28,7 @@ impl SolidityData {
|
||||
/// Returns the current number of immutables values in the contract.
|
||||
///
|
||||
pub fn immutables_size(&self) -> usize {
|
||||
self.immutables.len() * era_compiler_common::BYTE_LENGTH_FIELD
|
||||
self.immutables.len() * revive_common::BYTE_LENGTH_FIELD
|
||||
}
|
||||
|
||||
///
|
||||
@@ -38,7 +38,7 @@ impl SolidityData {
|
||||
///
|
||||
pub fn allocate_immutable(&mut self, identifier: &str) -> usize {
|
||||
let number_of_elements = self.immutables.len();
|
||||
let new_offset = number_of_elements * era_compiler_common::BYTE_LENGTH_FIELD;
|
||||
let new_offset = number_of_elements * revive_common::BYTE_LENGTH_FIELD;
|
||||
*self
|
||||
.immutables
|
||||
.entry(identifier.to_owned())
|
||||
|
||||
@@ -77,7 +77,7 @@ where
|
||||
let condition_is_overflow = context.builder().build_int_compare(
|
||||
inkwell::IntPredicate::UGT,
|
||||
shift,
|
||||
context.field_const((era_compiler_common::BIT_LENGTH_FIELD - 1) as u64),
|
||||
context.field_const((revive_common::BIT_LENGTH_FIELD - 1) as u64),
|
||||
"shift_left_is_overflow",
|
||||
)?;
|
||||
context.build_conditional_branch(condition_is_overflow, overflow_block, non_overflow_block)?;
|
||||
@@ -117,7 +117,7 @@ where
|
||||
let condition_is_overflow = context.builder().build_int_compare(
|
||||
inkwell::IntPredicate::UGT,
|
||||
shift,
|
||||
context.field_const((era_compiler_common::BIT_LENGTH_FIELD - 1) as u64),
|
||||
context.field_const((revive_common::BIT_LENGTH_FIELD - 1) as u64),
|
||||
"shift_right_is_overflow",
|
||||
)?;
|
||||
context.build_conditional_branch(condition_is_overflow, overflow_block, non_overflow_block)?;
|
||||
@@ -166,7 +166,7 @@ where
|
||||
let condition_is_overflow = context.builder().build_int_compare(
|
||||
inkwell::IntPredicate::UGT,
|
||||
shift,
|
||||
context.field_const((era_compiler_common::BIT_LENGTH_FIELD - 1) as u64),
|
||||
context.field_const((revive_common::BIT_LENGTH_FIELD - 1) as u64),
|
||||
"shift_right_arithmetic_is_overflow",
|
||||
)?;
|
||||
context.build_conditional_branch(condition_is_overflow, overflow_block, non_overflow_block)?;
|
||||
@@ -174,7 +174,7 @@ where
|
||||
context.set_basic_block(overflow_block);
|
||||
let sign_bit = context.builder().build_right_shift(
|
||||
value,
|
||||
context.field_const((era_compiler_common::BIT_LENGTH_FIELD - 1) as u64),
|
||||
context.field_const((revive_common::BIT_LENGTH_FIELD - 1) as u64),
|
||||
false,
|
||||
"shift_right_arithmetic_sign_bit",
|
||||
)?;
|
||||
|
||||
@@ -44,7 +44,7 @@ where
|
||||
.and_then(|value| value.to_u16());
|
||||
|
||||
match simulation_address {
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_TO_L1) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_TO_L1) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().far_call,
|
||||
function,
|
||||
@@ -57,7 +57,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::general::to_l1(context, is_first, in_0, in_1);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_CODE_ADDRESS) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_CODE_ADDRESS) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -66,7 +66,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::general::code_source(context);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_PRECOMPILE) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_PRECOMPILE) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -78,7 +78,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::general::precompile(context, in_0, gas_left);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_META) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_META) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -87,7 +87,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::general::meta(context);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_MIMIC_CALL) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_MIMIC_CALL) => {
|
||||
let address = gas;
|
||||
let abi_data = input_offset;
|
||||
let mimic = input_length;
|
||||
@@ -101,7 +101,7 @@ where
|
||||
vec![],
|
||||
);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_SYSTEM_MIMIC_CALL) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_SYSTEM_MIMIC_CALL) => {
|
||||
let address = gas;
|
||||
let abi_data = input_offset;
|
||||
let mimic = input_length;
|
||||
@@ -117,7 +117,7 @@ where
|
||||
vec![extra_value_1, extra_value_2],
|
||||
);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_MIMIC_CALL_BYREF) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_MIMIC_CALL_BYREF) => {
|
||||
let address = gas;
|
||||
let mimic = input_length;
|
||||
let abi_data = context.get_global_value(crate::eravm::GLOBAL_ACTIVE_POINTER)?;
|
||||
@@ -131,7 +131,7 @@ where
|
||||
vec![],
|
||||
);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_SYSTEM_MIMIC_CALL_BYREF) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_SYSTEM_MIMIC_CALL_BYREF) => {
|
||||
let address = gas;
|
||||
let mimic = input_length;
|
||||
let abi_data = context.get_global_value(crate::eravm::GLOBAL_ACTIVE_POINTER)?;
|
||||
@@ -147,7 +147,7 @@ where
|
||||
vec![extra_value_1, extra_value_2],
|
||||
);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_RAW_FAR_CALL) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_RAW_FAR_CALL) => {
|
||||
let address = gas;
|
||||
let abi_data = input_length;
|
||||
|
||||
@@ -160,7 +160,7 @@ where
|
||||
output_length,
|
||||
);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_RAW_FAR_CALL_BYREF) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_RAW_FAR_CALL_BYREF) => {
|
||||
let address = gas;
|
||||
let abi_data = context.get_global_value(crate::eravm::GLOBAL_ACTIVE_POINTER)?;
|
||||
|
||||
@@ -173,7 +173,7 @@ where
|
||||
output_length,
|
||||
);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_SYSTEM_CALL) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_SYSTEM_CALL) => {
|
||||
let address = gas;
|
||||
let abi_data = input_length;
|
||||
let extra_value_1 = value.expect("Always exists");
|
||||
@@ -191,7 +191,7 @@ where
|
||||
vec![extra_value_1, extra_value_2, extra_value_3, extra_value_4],
|
||||
);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_SYSTEM_CALL_BYREF) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_SYSTEM_CALL_BYREF) => {
|
||||
let address = gas;
|
||||
let abi_data = context.get_global_value(crate::eravm::GLOBAL_ACTIVE_POINTER)?;
|
||||
let extra_value_1 = value.expect("Always exists");
|
||||
@@ -209,7 +209,7 @@ where
|
||||
vec![extra_value_1, extra_value_2, extra_value_3, extra_value_4],
|
||||
);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_SET_CONTEXT_VALUE_CALL) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_SET_CONTEXT_VALUE_CALL) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().far_call,
|
||||
function,
|
||||
@@ -220,7 +220,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::general::set_context_value(context, value);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_SET_PUBDATA_PRICE) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_SET_PUBDATA_PRICE) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().far_call,
|
||||
function,
|
||||
@@ -231,7 +231,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::general::set_pubdata_price(context, price);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_INCREMENT_TX_COUNTER) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_INCREMENT_TX_COUNTER) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().far_call,
|
||||
function,
|
||||
@@ -240,7 +240,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::general::increment_tx_counter(context);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_GET_GLOBAL_PTR_CALLDATA) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_GET_GLOBAL_PTR_CALLDATA) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -255,7 +255,7 @@ where
|
||||
)?;
|
||||
return Ok(value.as_basic_value_enum());
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_GET_GLOBAL_CALL_FLAGS) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_GET_GLOBAL_CALL_FLAGS) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -264,7 +264,7 @@ where
|
||||
|
||||
return context.get_global_value(crate::eravm::GLOBAL_CALL_FLAGS);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_GET_GLOBAL_PTR_RETURN_DATA) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_GET_GLOBAL_PTR_RETURN_DATA) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -279,7 +279,7 @@ where
|
||||
)?;
|
||||
return Ok(value.as_basic_value_enum());
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_EVENT_INITIALIZE) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_EVENT_INITIALIZE) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().far_call,
|
||||
function,
|
||||
@@ -293,7 +293,7 @@ where
|
||||
context, operand_1, operand_2, true,
|
||||
);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_EVENT_WRITE) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_EVENT_WRITE) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().far_call,
|
||||
function,
|
||||
@@ -307,7 +307,7 @@ where
|
||||
context, operand_1, operand_2, false,
|
||||
);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_ACTIVE_PTR_LOAD_CALLDATA) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_ACTIVE_PTR_LOAD_CALLDATA) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -316,7 +316,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::abi::calldata_ptr_to_active(context);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_ACTIVE_PTR_LOAD_RETURN_DATA) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_ACTIVE_PTR_LOAD_RETURN_DATA) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -325,7 +325,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::abi::return_data_ptr_to_active(context);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_ACTIVE_PTR_ADD) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_ACTIVE_PTR_ADD) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -336,7 +336,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::abi::active_ptr_add_assign(context, offset);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_ACTIVE_PTR_SHRINK) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_ACTIVE_PTR_SHRINK) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -347,7 +347,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::abi::active_ptr_shrink_assign(context, offset);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_ACTIVE_PTR_PACK) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_ACTIVE_PTR_PACK) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -358,7 +358,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::abi::active_ptr_pack_assign(context, data);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_MULTIPLICATION_HIGH_REGISTER) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_MULTIPLICATION_HIGH_REGISTER) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -372,7 +372,7 @@ where
|
||||
context, operand_1, operand_2,
|
||||
);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_GET_GLOBAL_EXTRA_ABI_DATA) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_GET_GLOBAL_EXTRA_ABI_DATA) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -383,7 +383,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::abi::get_extra_abi_data(context, index);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_ACTIVE_PTR_DATA_LOAD) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_ACTIVE_PTR_DATA_LOAD) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -394,7 +394,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::abi::active_ptr_data_load(context, offset);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_ACTIVE_PTR_DATA_SIZE) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_ACTIVE_PTR_DATA_SIZE) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -403,7 +403,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::abi::active_ptr_data_size(context);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_ACTIVE_PTR_DATA_COPY) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_ACTIVE_PTR_DATA_COPY) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -421,7 +421,7 @@ where
|
||||
size,
|
||||
);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_CONST_ARRAY_DECLARE) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_CONST_ARRAY_DECLARE) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -443,7 +443,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::const_array::declare(context, index, size);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_CONST_ARRAY_SET) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_CONST_ARRAY_SET) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -469,7 +469,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::const_array::set(context, index, offset, value);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_CONST_ARRAY_FINALIZE) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_CONST_ARRAY_FINALIZE) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -485,7 +485,7 @@ where
|
||||
|
||||
return crate::eravm::extensions::const_array::finalize(context, index);
|
||||
}
|
||||
Some(era_compiler_common::ERAVM_ADDRESS_CONST_ARRAY_GET) => {
|
||||
Some(revive_common::ERAVM_ADDRESS_CONST_ARRAY_GET) => {
|
||||
crate::eravm::extensions::call::validate_call_type(
|
||||
context.llvm_runtime().static_call,
|
||||
function,
|
||||
@@ -604,8 +604,8 @@ where
|
||||
let signature_value = context.field_const_str_hex(signature_hash.as_str());
|
||||
|
||||
let calldata_size = context.field_const(
|
||||
(era_compiler_common::BYTE_LENGTH_X32
|
||||
+ (era_compiler_common::BYTE_LENGTH_FIELD * arguments.len())) as u64,
|
||||
(revive_common::BYTE_LENGTH_X32 + (revive_common::BYTE_LENGTH_FIELD * arguments.len()))
|
||||
as u64,
|
||||
);
|
||||
|
||||
let calldata_array_pointer = context.build_alloca(
|
||||
|
||||
@@ -35,7 +35,7 @@ where
|
||||
index_double,
|
||||
context.field_const(
|
||||
crate::eravm::HEAP_AUX_OFFSET_CONSTRUCTOR_RETURN_DATA
|
||||
+ (3 * era_compiler_common::BYTE_LENGTH_FIELD) as u64,
|
||||
+ (3 * revive_common::BYTE_LENGTH_FIELD) as u64,
|
||||
),
|
||||
"immutable_offset_absolute",
|
||||
)?;
|
||||
@@ -84,7 +84,7 @@ where
|
||||
index_double,
|
||||
context.field_const(
|
||||
crate::eravm::HEAP_AUX_OFFSET_CONSTRUCTOR_RETURN_DATA
|
||||
+ (2 * era_compiler_common::BYTE_LENGTH_FIELD) as u64,
|
||||
+ (2 * revive_common::BYTE_LENGTH_FIELD) as u64,
|
||||
),
|
||||
"index_offset_absolute",
|
||||
)?;
|
||||
@@ -99,7 +99,7 @@ where
|
||||
|
||||
let value_offset_absolute = context.builder().build_int_add(
|
||||
index_offset_absolute,
|
||||
context.field_const(era_compiler_common::BYTE_LENGTH_FIELD as u64),
|
||||
context.field_const(revive_common::BYTE_LENGTH_FIELD as u64),
|
||||
"value_offset_absolute",
|
||||
)?;
|
||||
let value_offset_pointer = Pointer::new_with_offset(
|
||||
|
||||
@@ -35,7 +35,7 @@ where
|
||||
);
|
||||
context.build_store(
|
||||
immutables_offset_pointer,
|
||||
context.field_const(era_compiler_common::BYTE_LENGTH_FIELD as u64),
|
||||
context.field_const(revive_common::BYTE_LENGTH_FIELD as u64),
|
||||
)?;
|
||||
|
||||
let immutables_number_pointer = Pointer::new_with_offset(
|
||||
@@ -44,16 +44,15 @@ where
|
||||
context.field_type(),
|
||||
context.field_const(
|
||||
crate::eravm::HEAP_AUX_OFFSET_CONSTRUCTOR_RETURN_DATA
|
||||
+ (era_compiler_common::BYTE_LENGTH_FIELD as u64),
|
||||
+ (revive_common::BYTE_LENGTH_FIELD as u64),
|
||||
),
|
||||
"immutables_number_pointer",
|
||||
);
|
||||
let immutable_values_size = context.immutables_size()?;
|
||||
context.build_store(
|
||||
immutables_number_pointer,
|
||||
context.field_const(
|
||||
(immutable_values_size / era_compiler_common::BYTE_LENGTH_FIELD) as u64,
|
||||
),
|
||||
context
|
||||
.field_const((immutable_values_size / revive_common::BYTE_LENGTH_FIELD) as u64),
|
||||
)?;
|
||||
let immutables_size = context.builder().build_int_mul(
|
||||
context.field_const(immutable_values_size as u64),
|
||||
@@ -62,7 +61,7 @@ where
|
||||
)?;
|
||||
let return_data_length = context.builder().build_int_add(
|
||||
immutables_size,
|
||||
context.field_const((era_compiler_common::BYTE_LENGTH_FIELD * 2) as u64),
|
||||
context.field_const((revive_common::BYTE_LENGTH_FIELD * 2) as u64),
|
||||
"return_data_length",
|
||||
)?;
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ where
|
||||
)?;
|
||||
let active_pointer_value_shifted = context.builder().build_right_shift(
|
||||
active_pointer_value,
|
||||
context.field_const((era_compiler_common::BIT_LENGTH_X32 * 3) as u64),
|
||||
context.field_const((revive_common::BIT_LENGTH_X32 * 3) as u64),
|
||||
false,
|
||||
"active_pointer_value_shifted",
|
||||
)?;
|
||||
|
||||
@@ -20,12 +20,12 @@ where
|
||||
{
|
||||
let operand_1_extended = context.builder().build_int_z_extend_or_bit_cast(
|
||||
operand_1,
|
||||
context.integer_type(era_compiler_common::BIT_LENGTH_FIELD * 2),
|
||||
context.integer_type(revive_common::BIT_LENGTH_FIELD * 2),
|
||||
"multiplication_512_operand_1_extended",
|
||||
)?;
|
||||
let operand_2_extended = context.builder().build_int_z_extend_or_bit_cast(
|
||||
operand_2,
|
||||
context.integer_type(era_compiler_common::BIT_LENGTH_FIELD * 2),
|
||||
context.integer_type(revive_common::BIT_LENGTH_FIELD * 2),
|
||||
"multiplication_512_operand_2_extended",
|
||||
)?;
|
||||
let result_extended = context.builder().build_int_mul(
|
||||
@@ -36,8 +36,8 @@ where
|
||||
let result_shifted = context.builder().build_right_shift(
|
||||
result_extended,
|
||||
context.integer_const(
|
||||
era_compiler_common::BIT_LENGTH_FIELD * 2,
|
||||
era_compiler_common::BIT_LENGTH_FIELD as u64,
|
||||
revive_common::BIT_LENGTH_FIELD * 2,
|
||||
revive_common::BIT_LENGTH_FIELD as u64,
|
||||
),
|
||||
false,
|
||||
"multiplication_512_result_shifted",
|
||||
|
||||
@@ -30,7 +30,7 @@ pub fn initialize_target() {
|
||||
pub fn build_assembly_text(
|
||||
contract_path: &str,
|
||||
assembly_text: &str,
|
||||
_metadata_hash: Option<[u8; era_compiler_common::BYTE_LENGTH_FIELD]>,
|
||||
_metadata_hash: Option<[u8; revive_common::BYTE_LENGTH_FIELD]>,
|
||||
debug_config: Option<&DebugConfig>,
|
||||
) -> anyhow::Result<Build> {
|
||||
if let Some(debug_config) = debug_config {
|
||||
|
||||
@@ -138,17 +138,17 @@ where
|
||||
|
||||
let input_offset_shifted = context.builder().build_left_shift(
|
||||
input_offset,
|
||||
context.field_const((era_compiler_common::BIT_LENGTH_X32 * 2) as u64),
|
||||
context.field_const((revive_common::BIT_LENGTH_X32 * 2) as u64),
|
||||
"abi_data_input_offset_shifted",
|
||||
)?;
|
||||
let input_length_shifted = context.builder().build_left_shift(
|
||||
input_length,
|
||||
context.field_const((era_compiler_common::BIT_LENGTH_X32 * 3) as u64),
|
||||
context.field_const((revive_common::BIT_LENGTH_X32 * 3) as u64),
|
||||
"abi_data_input_length_shifted",
|
||||
)?;
|
||||
let gas_shifted = context.builder().build_left_shift(
|
||||
gas,
|
||||
context.field_const((era_compiler_common::BIT_LENGTH_X32 * 6) as u64),
|
||||
context.field_const((revive_common::BIT_LENGTH_X32 * 6) as u64),
|
||||
"abi_data_gas_shifted",
|
||||
)?;
|
||||
|
||||
@@ -163,7 +163,7 @@ where
|
||||
if let AddressSpace::HeapAuxiliary = address_space {
|
||||
let auxiliary_heap_marker_shifted = context.builder().build_left_shift(
|
||||
context.field_const(zkevm_opcode_defs::FarCallForwardPageType::UseAuxHeap as u64),
|
||||
context.field_const((era_compiler_common::BIT_LENGTH_X32 * 7) as u64),
|
||||
context.field_const((revive_common::BIT_LENGTH_X32 * 7) as u64),
|
||||
"abi_data_auxiliary_heap_marker_shifted",
|
||||
)?;
|
||||
abi_data = context.builder().build_int_add(
|
||||
@@ -176,8 +176,7 @@ where
|
||||
let auxiliary_heap_marker_shifted = context.builder().build_left_shift(
|
||||
context.field_const(zkevm_opcode_defs::FarCallForwardPageType::UseAuxHeap as u64),
|
||||
context.field_const(
|
||||
((era_compiler_common::BIT_LENGTH_X32 * 7)
|
||||
+ (era_compiler_common::BIT_LENGTH_BYTE * 3)) as u64,
|
||||
((revive_common::BIT_LENGTH_X32 * 7) + (revive_common::BIT_LENGTH_BYTE * 3)) as u64,
|
||||
),
|
||||
"abi_data_system_call_marker_shifted",
|
||||
)?;
|
||||
|
||||
Reference in New Issue
Block a user