mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-15 04:31:08 +00:00
llvm-context: lazy handling of function arguments and immutable data (#282)
- Lazily load function arguments so that they can be passed as pointers. - Lazily call the immutable store function to avoid storing zero sized immutable data. --------- Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -101,6 +101,9 @@ where
|
||||
solidity_data: Option<SolidityData>,
|
||||
/// The Yul data.
|
||||
yul_data: Option<YulData>,
|
||||
|
||||
/// Hints whether the contracts deploy function stores immutables.
|
||||
immutables: bool,
|
||||
}
|
||||
|
||||
impl<'ctx, D> Context<'ctx, D>
|
||||
@@ -263,6 +266,8 @@ where
|
||||
|
||||
solidity_data: None,
|
||||
yul_data: None,
|
||||
|
||||
immutables: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1426,4 +1431,14 @@ where
|
||||
pub fn optimizer_settings(&self) -> &OptimizerSettings {
|
||||
self.optimizer.settings()
|
||||
}
|
||||
|
||||
/// Hint the deploy code exit routine to emit storing the immutables.
|
||||
pub fn enable_immutables(&mut self) {
|
||||
self.immutables = true;
|
||||
}
|
||||
|
||||
/// Returns if the contract stores or loads immutables.
|
||||
pub fn has_immutables(&self) -> bool {
|
||||
self.immutables
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user