Skip to content

Commit

Permalink
Slight optimization in ModuleManager
Browse files Browse the repository at this point in the history
  • Loading branch information
remedcu committed Dec 22, 2023
1 parent e55d181 commit 9c80418
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions contracts/base/ModuleManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,14 @@ abstract contract ModuleManager is SelfAuthorized, Executor, GuardManager {
/// @solidity memory-safe-assembly
assembly {
// Load free memory location
let ptr := mload(0x40)
returnData := mload(0x40)
// We allocate memory for the return data by setting the free memory location to
// current free memory location + data size + 32 bytes for data size value
mstore(0x40, add(ptr, add(returndatasize(), 0x20)))
mstore(0x40, add(returnData, add(returndatasize(), 0x20)))
// Store the size
mstore(ptr, returndatasize())
mstore(returnData, returndatasize())
// Store the data
returndatacopy(add(ptr, 0x20), 0, returndatasize())
// Point the return data to the correct memory location
returnData := ptr
returndatacopy(add(returnData, 0x20), 0, returndatasize())
}
/* solhint-enable no-inline-assembly */
}
Expand Down

0 comments on commit 9c80418

Please sign in to comment.