mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-28 18:57:58 +00:00
@@ -16,7 +16,7 @@ where
|
||||
let offset = context.builder().build_int_add(
|
||||
offset,
|
||||
context.field_const(
|
||||
(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,
|
||||
),
|
||||
"datacopy_contract_hash_offset",
|
||||
)?;
|
||||
@@ -61,12 +61,12 @@ where
|
||||
for (index, chunk) in source
|
||||
.chars()
|
||||
.collect::<Vec<char>>()
|
||||
.chunks(era_compiler_common::BYTE_LENGTH_FIELD * 2)
|
||||
.chunks(revive_common::BYTE_LENGTH_FIELD * 2)
|
||||
.enumerate()
|
||||
{
|
||||
let mut value_string = chunk.iter().collect::<String>();
|
||||
value_string.push_str(
|
||||
"0".repeat((era_compiler_common::BYTE_LENGTH_FIELD * 2) - chunk.len())
|
||||
"0".repeat((revive_common::BYTE_LENGTH_FIELD * 2) - chunk.len())
|
||||
.as_str(),
|
||||
);
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@ impl Instruction {
|
||||
..
|
||||
} => {
|
||||
let mut key_extended =
|
||||
"0".repeat(era_compiler_common::BYTE_LENGTH_FIELD * 2 - value.len());
|
||||
"0".repeat(revive_common::BYTE_LENGTH_FIELD * 2 - value.len());
|
||||
key_extended.push_str(value.as_str());
|
||||
|
||||
*value = mapping.get(key_extended.as_str()).cloned().ok_or_else(|| {
|
||||
|
||||
@@ -103,7 +103,7 @@ impl Assembly {
|
||||
hash_data_mapping: &BTreeMap<String, String>,
|
||||
) -> anyhow::Result<BTreeMap<String, String>> {
|
||||
let mut index_path_mapping = BTreeMap::new();
|
||||
let index = "0".repeat(era_compiler_common::BYTE_LENGTH_FIELD * 2);
|
||||
let index = "0".repeat(revive_common::BYTE_LENGTH_FIELD * 2);
|
||||
index_path_mapping.insert(index, full_path.to_owned());
|
||||
|
||||
let dependencies = match self.data.as_mut() {
|
||||
@@ -115,8 +115,7 @@ impl Assembly {
|
||||
continue;
|
||||
}
|
||||
|
||||
let mut index_extended =
|
||||
"0".repeat(era_compiler_common::BYTE_LENGTH_FIELD * 2 - index.len());
|
||||
let mut index_extended = "0".repeat(revive_common::BYTE_LENGTH_FIELD * 2 - index.len());
|
||||
index_extended.push_str(index.as_str());
|
||||
|
||||
*data = match data {
|
||||
@@ -154,7 +153,7 @@ impl Assembly {
|
||||
hash_data_mapping: &BTreeMap<String, String>,
|
||||
) -> anyhow::Result<BTreeMap<String, String>> {
|
||||
let mut index_path_mapping = BTreeMap::new();
|
||||
let index = "0".repeat(era_compiler_common::BYTE_LENGTH_FIELD * 2);
|
||||
let index = "0".repeat(revive_common::BYTE_LENGTH_FIELD * 2);
|
||||
index_path_mapping.insert(index, full_path.to_owned());
|
||||
|
||||
let dependencies = match self
|
||||
@@ -168,8 +167,7 @@ impl Assembly {
|
||||
None => return Ok(index_path_mapping),
|
||||
};
|
||||
for (index, data) in dependencies.iter_mut() {
|
||||
let mut index_extended =
|
||||
"0".repeat(era_compiler_common::BYTE_LENGTH_FIELD * 2 - index.len());
|
||||
let mut index_extended = "0".repeat(revive_common::BYTE_LENGTH_FIELD * 2 - index.len());
|
||||
index_extended.push_str(index.as_str());
|
||||
|
||||
*data = match data {
|
||||
|
||||
@@ -41,10 +41,10 @@ where
|
||||
.declaration();
|
||||
let is_deploy_code = match self.code_type {
|
||||
era_compiler_llvm_context::EraVMCodeType::Deploy => context
|
||||
.integer_type(era_compiler_common::BIT_LENGTH_BOOLEAN)
|
||||
.integer_type(revive_common::BIT_LENGTH_BOOLEAN)
|
||||
.const_int(1, false),
|
||||
era_compiler_llvm_context::EraVMCodeType::Runtime => context
|
||||
.integer_type(era_compiler_common::BIT_LENGTH_BOOLEAN)
|
||||
.integer_type(revive_common::BIT_LENGTH_BOOLEAN)
|
||||
.const_int(0, false),
|
||||
};
|
||||
context.build_invoke(
|
||||
|
||||
@@ -170,7 +170,7 @@ where
|
||||
.value
|
||||
.ok_or_else(|| anyhow::anyhow!("Instruction value missing"))?;
|
||||
|
||||
if value.len() > era_compiler_common::BYTE_LENGTH_FIELD * 2 {
|
||||
if value.len() > revive_common::BYTE_LENGTH_FIELD * 2 {
|
||||
Ok(Some(context.field_const(0).as_basic_value_enum()))
|
||||
} else {
|
||||
crate::evmla::assembly::instruction::stack::push(context, value).map(Some)
|
||||
@@ -1319,10 +1319,8 @@ where
|
||||
pointer,
|
||||
&[
|
||||
context.field_const(0),
|
||||
context.integer_const(
|
||||
era_compiler_common::BIT_LENGTH_X32,
|
||||
index as u64,
|
||||
),
|
||||
context
|
||||
.integer_const(revive_common::BIT_LENGTH_X32, index as u64),
|
||||
],
|
||||
context.field_type(),
|
||||
format!("return_value_pointer_element_{}", index).as_str(),
|
||||
|
||||
@@ -593,7 +593,7 @@ impl Function {
|
||||
} => (
|
||||
vec![num::BigUint::from_str_radix(
|
||||
constant.as_str(),
|
||||
era_compiler_common::BASE_HEXADECIMAL,
|
||||
revive_common::BASE_HEXADECIMAL,
|
||||
)
|
||||
.map(StackElement::Constant)?],
|
||||
None,
|
||||
@@ -784,7 +784,7 @@ impl Function {
|
||||
|
||||
let result = match (&operands[0], &operands[1]) {
|
||||
(Element::Tag(tag), Element::Constant(offset)) => {
|
||||
let offset = offset % era_compiler_common::BIT_LENGTH_FIELD;
|
||||
let offset = offset % revive_common::BIT_LENGTH_FIELD;
|
||||
let offset = offset.to_u64().expect("Always valid");
|
||||
let result = tag << offset;
|
||||
if Self::is_tag_value_valid(blocks, &result) {
|
||||
@@ -794,7 +794,7 @@ impl Function {
|
||||
}
|
||||
}
|
||||
(Element::Constant(constant), Element::Constant(offset)) => {
|
||||
let offset = offset % era_compiler_common::BIT_LENGTH_FIELD;
|
||||
let offset = offset % revive_common::BIT_LENGTH_FIELD;
|
||||
let offset = offset.to_u64().expect("Always valid");
|
||||
Element::Constant(constant << offset)
|
||||
}
|
||||
@@ -811,7 +811,7 @@ impl Function {
|
||||
|
||||
let result = match (&operands[0], &operands[1]) {
|
||||
(Element::Tag(tag), Element::Constant(offset)) => {
|
||||
let offset = offset % era_compiler_common::BIT_LENGTH_FIELD;
|
||||
let offset = offset % revive_common::BIT_LENGTH_FIELD;
|
||||
let offset = offset.to_u64().expect("Always valid");
|
||||
let result = tag >> offset;
|
||||
if Self::is_tag_value_valid(blocks, &result) {
|
||||
@@ -821,7 +821,7 @@ impl Function {
|
||||
}
|
||||
}
|
||||
(Element::Constant(constant), Element::Constant(offset)) => {
|
||||
let offset = offset % era_compiler_common::BIT_LENGTH_FIELD;
|
||||
let offset = offset % revive_common::BIT_LENGTH_FIELD;
|
||||
let offset = offset.to_u64().expect("Always valid");
|
||||
Element::Constant(constant >> offset)
|
||||
}
|
||||
@@ -1170,7 +1170,7 @@ where
|
||||
let output_size = 0;
|
||||
let r#type = context.function_type(
|
||||
vec![context
|
||||
.integer_type(era_compiler_common::BIT_LENGTH_BOOLEAN)
|
||||
.integer_type(revive_common::BIT_LENGTH_BOOLEAN)
|
||||
.as_basic_type_enum()],
|
||||
output_size,
|
||||
false,
|
||||
@@ -1185,7 +1185,7 @@ where
|
||||
let r#type = context.function_type(
|
||||
vec![
|
||||
context
|
||||
.integer_type(era_compiler_common::BIT_LENGTH_FIELD)
|
||||
.integer_type(revive_common::BIT_LENGTH_FIELD)
|
||||
.as_basic_type_enum();
|
||||
input_size
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user