mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-13 10:41:05 +00:00
change getters to register version (#138)
This commit is contained in:
Generated
+367
-367
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -68,7 +68,7 @@ git2 = "0.19.0"
|
|||||||
# polkadot-sdk and friends
|
# polkadot-sdk and friends
|
||||||
codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" }
|
codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" }
|
||||||
scale-info = { version = "2.11.1", default-features = false }
|
scale-info = { version = "2.11.1", default-features = false }
|
||||||
polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", rev = "6ad748857e0e63c38cb7bb9435831ae73ab708cf" }
|
polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", rev = "53f6473c9c8c9d18b5ef0ed02a587757495d1dbf" }
|
||||||
|
|
||||||
# llvm
|
# llvm
|
||||||
[workspace.dependencies.inkwell]
|
[workspace.dependencies.inkwell]
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"Baseline": 1115,
|
"Baseline": 1099,
|
||||||
"Computation": 2394,
|
"Computation": 2378,
|
||||||
"DivisionArithmetics": 14470,
|
"DivisionArithmetics": 14454,
|
||||||
"ERC20": 22747,
|
"ERC20": 22731,
|
||||||
"Events": 1609,
|
"Events": 1593,
|
||||||
"FibonacciIterative": 1659,
|
"FibonacciIterative": 1643,
|
||||||
"Flipper": 1994,
|
"Flipper": 1978,
|
||||||
"SHA1": 16817
|
"SHA1": 16801
|
||||||
}
|
}
|
||||||
@@ -66,21 +66,14 @@ impl Entry {
|
|||||||
.get_global(crate::polkavm::GLOBAL_CALLDATA_SIZE)?
|
.get_global(crate::polkavm::GLOBAL_CALLDATA_SIZE)?
|
||||||
.value
|
.value
|
||||||
.as_pointer_value();
|
.as_pointer_value();
|
||||||
let call_data_size_pointer_arg =
|
let call_data_size_value = context
|
||||||
context.build_alloca_at_entry(context.word_type(), "call_data_size_pointer_arg");
|
.build_runtime_call(revive_runtime_api::polkavm_imports::CALL_DATA_SIZE, &[])
|
||||||
context.build_runtime_call(
|
.expect("the call_data_size syscall method should return a value")
|
||||||
revive_runtime_api::polkavm_imports::CALL_DATA_SIZE,
|
.into_int_value();
|
||||||
&[call_data_size_pointer_arg.to_int(context).into()],
|
|
||||||
);
|
|
||||||
let value = context.build_load(call_data_size_pointer_arg, "call_data_size_load")?;
|
|
||||||
let value_truncated = context.builder().build_int_truncate(
|
|
||||||
value.into_int_value(),
|
|
||||||
context.xlen_type(),
|
|
||||||
"call_data_size_truncated",
|
|
||||||
)?;
|
|
||||||
context
|
context
|
||||||
.builder()
|
.builder()
|
||||||
.build_store(call_data_size_pointer, value_truncated)?;
|
.build_store(call_data_size_pointer, call_data_size_value)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,19 +16,20 @@ where
|
|||||||
Some(address) => address,
|
Some(address) => address,
|
||||||
None => super::context::address(context)?.into_int_value(),
|
None => super::context::address(context)?.into_int_value(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let address_pointer = context.build_address_argument_store(address)?;
|
let address_pointer = context.build_address_argument_store(address)?;
|
||||||
let output_pointer = context.build_alloca_at_entry(context.word_type(), "output_pointer");
|
|
||||||
|
|
||||||
context.build_runtime_call(
|
let code_size_value = context
|
||||||
revive_runtime_api::polkavm_imports::CODE_SIZE,
|
.build_runtime_call(
|
||||||
&[
|
revive_runtime_api::polkavm_imports::CODE_SIZE,
|
||||||
address_pointer.to_int(context).into(),
|
&[address_pointer.to_int(context).into()],
|
||||||
output_pointer.to_int(context).into(),
|
)
|
||||||
],
|
.expect("the code_size syscall method should return a value")
|
||||||
);
|
.into_int_value();
|
||||||
|
|
||||||
context.build_load(output_pointer, "code_size")
|
Ok(context
|
||||||
|
.builder()
|
||||||
|
.build_int_z_extend(code_size_value, context.word_type(), "code_size")?
|
||||||
|
.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Translates the `extcodehash` instruction.
|
/// Translates the `extcodehash` instruction.
|
||||||
|
|||||||
@@ -10,17 +10,19 @@ pub fn size<'ctx, D>(
|
|||||||
where
|
where
|
||||||
D: Dependency + Clone,
|
D: Dependency + Clone,
|
||||||
{
|
{
|
||||||
let output_pointer = context.build_alloca_at_entry(context.word_type(), "return_data_size");
|
let return_data_size_value = context
|
||||||
let output_pointer_parameter = context.builder().build_ptr_to_int(
|
.build_runtime_call(revive_runtime_api::polkavm_imports::RETURNDATASIZE, &[])
|
||||||
output_pointer.value,
|
.expect("the return_data_size syscall method should return a value")
|
||||||
context.xlen_type(),
|
.into_int_value();
|
||||||
"return_data_copy_output_pointer",
|
|
||||||
)?;
|
Ok(context
|
||||||
context.build_runtime_call(
|
.builder()
|
||||||
revive_runtime_api::polkavm_imports::RETURNDATASIZE,
|
.build_int_z_extend(
|
||||||
&[output_pointer_parameter.into()],
|
return_data_size_value,
|
||||||
);
|
context.word_type(),
|
||||||
context.build_load(output_pointer, "return_data_size_load")
|
"return_data_size",
|
||||||
|
)?
|
||||||
|
.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Translates the return data copy, trapping if
|
/// Translates the return data copy, trapping if
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ POLKAVM_IMPORT(uint64_t, call_data_copy, uint32_t, uint32_t, uint32_t)
|
|||||||
|
|
||||||
POLKAVM_IMPORT(uint64_t, call_data_load, uint32_t, uint32_t)
|
POLKAVM_IMPORT(uint64_t, call_data_load, uint32_t, uint32_t)
|
||||||
|
|
||||||
POLKAVM_IMPORT(uint64_t, call_data_size, uint32_t)
|
POLKAVM_IMPORT(uint64_t, call_data_size)
|
||||||
|
|
||||||
POLKAVM_IMPORT(uint64_t, delegate_call, uint32_t)
|
POLKAVM_IMPORT(uint64_t, delegate_call, uint32_t)
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ POLKAVM_IMPORT(void, caller, uint32_t)
|
|||||||
|
|
||||||
POLKAVM_IMPORT(void, chain_id, uint32_t)
|
POLKAVM_IMPORT(void, chain_id, uint32_t)
|
||||||
|
|
||||||
POLKAVM_IMPORT(void, code_size, uint32_t, uint32_t)
|
POLKAVM_IMPORT(uint64_t, code_size, uint32_t)
|
||||||
|
|
||||||
POLKAVM_IMPORT(void, code_hash, uint32_t, uint32_t)
|
POLKAVM_IMPORT(void, code_hash, uint32_t, uint32_t)
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ POLKAVM_IMPORT(uint64_t, ref_time_left)
|
|||||||
|
|
||||||
POLKAVM_IMPORT(void, return_data_copy, uint32_t, uint32_t, uint32_t)
|
POLKAVM_IMPORT(void, return_data_copy, uint32_t, uint32_t, uint32_t)
|
||||||
|
|
||||||
POLKAVM_IMPORT(void, return_data_size, uint32_t)
|
POLKAVM_IMPORT(uint64_t, return_data_size)
|
||||||
|
|
||||||
POLKAVM_IMPORT(void, set_immutable_data, uint32_t, uint32_t);
|
POLKAVM_IMPORT(void, set_immutable_data, uint32_t, uint32_t);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user