pub trait RuntimeProvider {
Show 25 methods
// Required methods
fn collect_definitions(&self) -> Vec<FunctionDefinition>;
fn alloc(&mut self, db: &dyn CodegenDb, size: Expression) -> Expression;
fn avail(&mut self, db: &dyn CodegenDb) -> Expression;
fn create(
&mut self,
db: &dyn CodegenDb,
contract: ContractId,
value: Expression,
) -> Expression;
fn create2(
&mut self,
db: &dyn CodegenDb,
contract: ContractId,
value: Expression,
salt: Expression,
) -> Expression;
fn emit(
&mut self,
db: &dyn CodegenDb,
event: Expression,
event_ty: TypeId,
) -> Expression;
fn revert(
&mut self,
db: &dyn CodegenDb,
arg: Option<Expression>,
arg_name: &str,
arg_ty: TypeId,
) -> Expression;
fn external_call(
&mut self,
db: &dyn CodegenDb,
function: FunctionId,
args: Vec<Expression>,
) -> Expression;
fn map_value_ptr(
&mut self,
db: &dyn CodegenDb,
map_ptr: Expression,
key: Expression,
key_ty: TypeId,
) -> Expression;
fn aggregate_init(
&mut self,
db: &dyn CodegenDb,
ptr: Expression,
args: Vec<Expression>,
ptr_ty: TypeId,
arg_tys: Vec<TypeId>,
) -> Expression;
fn string_copy(
&mut self,
db: &dyn CodegenDb,
dst: Expression,
data: &str,
is_dst_storage: bool,
) -> Expression;
fn string_construct(
&mut self,
db: &dyn CodegenDb,
data: &str,
string_len: usize,
) -> Expression;
fn ptr_copy(
&mut self,
db: &dyn CodegenDb,
src: Expression,
dst: Expression,
size: Expression,
is_src_storage: bool,
is_dst_storage: bool,
) -> Expression;
fn ptr_store(
&mut self,
db: &dyn CodegenDb,
ptr: Expression,
imm: Expression,
ptr_ty: TypeId,
) -> Expression;
fn ptr_load(
&mut self,
db: &dyn CodegenDb,
ptr: Expression,
ptr_ty: TypeId,
) -> Expression;
fn abi_encode(
&mut self,
db: &dyn CodegenDb,
src: Expression,
dst: Expression,
src_ty: TypeId,
is_dst_storage: bool,
) -> Expression;
fn abi_encode_seq(
&mut self,
db: &dyn CodegenDb,
src: &[Expression],
dst: Expression,
src_tys: &[TypeId],
is_dst_storage: bool,
) -> Expression;
fn abi_decode(
&mut self,
db: &dyn CodegenDb,
src: Expression,
size: Expression,
types: &[TypeId],
abi_loc: AbiSrcLocation,
) -> Expression;
fn safe_add(
&mut self,
db: &dyn CodegenDb,
lhs: Expression,
rhs: Expression,
ty: TypeId,
) -> Expression;
fn safe_sub(
&mut self,
db: &dyn CodegenDb,
lhs: Expression,
rhs: Expression,
ty: TypeId,
) -> Expression;
fn safe_mul(
&mut self,
db: &dyn CodegenDb,
lhs: Expression,
rhs: Expression,
ty: TypeId,
) -> Expression;
fn safe_div(
&mut self,
db: &dyn CodegenDb,
lhs: Expression,
rhs: Expression,
ty: TypeId,
) -> Expression;
fn safe_mod(
&mut self,
db: &dyn CodegenDb,
lhs: Expression,
rhs: Expression,
ty: TypeId,
) -> Expression;
fn safe_pow(
&mut self,
db: &dyn CodegenDb,
lhs: Expression,
rhs: Expression,
ty: TypeId,
) -> Expression;
// Provided method
fn primitive_cast(
&mut self,
db: &dyn CodegenDb,
value: Expression,
from_ty: TypeId,
) -> Expression { ... }
}
Required Methods§
fn collect_definitions(&self) -> Vec<FunctionDefinition>
fn alloc(&mut self, db: &dyn CodegenDb, size: Expression) -> Expression
fn avail(&mut self, db: &dyn CodegenDb) -> Expression
fn create( &mut self, db: &dyn CodegenDb, contract: ContractId, value: Expression, ) -> Expression
fn create2( &mut self, db: &dyn CodegenDb, contract: ContractId, value: Expression, salt: Expression, ) -> Expression
fn emit( &mut self, db: &dyn CodegenDb, event: Expression, event_ty: TypeId, ) -> Expression
fn revert( &mut self, db: &dyn CodegenDb, arg: Option<Expression>, arg_name: &str, arg_ty: TypeId, ) -> Expression
fn external_call( &mut self, db: &dyn CodegenDb, function: FunctionId, args: Vec<Expression>, ) -> Expression
fn map_value_ptr( &mut self, db: &dyn CodegenDb, map_ptr: Expression, key: Expression, key_ty: TypeId, ) -> Expression
fn aggregate_init( &mut self, db: &dyn CodegenDb, ptr: Expression, args: Vec<Expression>, ptr_ty: TypeId, arg_tys: Vec<TypeId>, ) -> Expression
fn string_copy( &mut self, db: &dyn CodegenDb, dst: Expression, data: &str, is_dst_storage: bool, ) -> Expression
fn string_construct( &mut self, db: &dyn CodegenDb, data: &str, string_len: usize, ) -> Expression
Sourcefn ptr_copy(
&mut self,
db: &dyn CodegenDb,
src: Expression,
dst: Expression,
size: Expression,
is_src_storage: bool,
is_dst_storage: bool,
) -> Expression
fn ptr_copy( &mut self, db: &dyn CodegenDb, src: Expression, dst: Expression, size: Expression, is_src_storage: bool, is_dst_storage: bool, ) -> Expression
Copy data from src
to dst
.
NOTE: src and dst must be aligned by 32 when a ptr is storage ptr.