refactor: use constants from kernel::memory module directly#2766
Open
giwaov wants to merge 1 commit into0xMiden:mainfrom
Open
refactor: use constants from kernel::memory module directly#2766giwaov wants to merge 1 commit into0xMiden:mainfrom
giwaov wants to merge 1 commit into0xMiden:mainfrom
Conversation
Replace 16 simple push-constant procedures in memory.masm with direct constant imports using use \::memory::CONSTANT_NAME and push.CONSTANT_NAME at call sites. This removes unnecessary procedure call overhead for procedures that simply push a constant value onto the stack. Replaced procedures: - get_input_vault_root_ptr -> INPUT_VAULT_ROOT_PTR - get_output_vault_root_ptr -> OUTPUT_VAULT_ROOT_PTR - get_tx_script_root_ptr -> TX_SCRIPT_ROOT_PTR - get_block_data_ptr -> BLOCK_DATA_SECTION_OFFSET - get_partial_blockchain_ptr -> PARTIAL_BLOCKCHAIN_PTR - get_partial_blockchain_peaks_ptr -> PARTIAL_BLOCKCHAIN_PEAKS_PTR - get_native_account_data_ptr -> NATIVE_ACCOUNT_DATA_PTR - get_account_data_length -> ACCOUNT_DATA_LENGTH - get_max_foreign_account_ptr -> MAX_FOREIGN_ACCOUNT_PTR - get_account_delta_fungible_asset_ptr -> ACCOUNT_DELTA_FUNGIBLE_ASSET_PTR - get_account_delta_non_fungible_asset_ptr -> ACCOUNT_DELTA_NON_FUNGIBLE_ASSET_PTR - get_output_note_data_offset -> OUTPUT_NOTE_SECTION_OFFSET - get_kernel_procedures_ptr -> KERNEL_PROCEDURES_PTR - get_link_map_region_start_ptr -> LINK_MAP_REGION_START_PTR - get_link_map_region_end_ptr -> LINK_MAP_REGION_END_PTR - get_link_map_entry_size -> LINK_MAP_ENTRY_SIZE Closes 0xMiden#2415
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Replaces 16 simple push-constant procedures in
memory.masmwith direct constant imports, following the pattern established in #2221.Each replaced procedure simply pushes a constant onto the stack:
These are now replaced at call sites with:
This removes unnecessary procedure call overhead while keeping the code clear and direct.
Replaced procedures (16 total)
get_input_vault_root_ptrINPUT_VAULT_ROOT_PTRget_output_vault_root_ptrOUTPUT_VAULT_ROOT_PTRget_tx_script_root_ptrTX_SCRIPT_ROOT_PTRget_block_data_ptrBLOCK_DATA_SECTION_OFFSETget_partial_blockchain_ptrPARTIAL_BLOCKCHAIN_PTRget_partial_blockchain_peaks_ptrPARTIAL_BLOCKCHAIN_PEAKS_PTRget_native_account_data_ptrNATIVE_ACCOUNT_DATA_PTRget_account_data_lengthACCOUNT_DATA_LENGTHget_max_foreign_account_ptrMAX_FOREIGN_ACCOUNT_PTRget_account_delta_fungible_asset_ptrACCOUNT_DELTA_FUNGIBLE_ASSET_PTRget_account_delta_non_fungible_asset_ptrACCOUNT_DELTA_NON_FUNGIBLE_ASSET_PTRget_output_note_data_offsetOUTPUT_NOTE_SECTION_OFFSETget_kernel_procedures_ptrKERNEL_PROCEDURES_PTRget_link_map_region_start_ptrLINK_MAP_REGION_START_PTRget_link_map_region_end_ptrLINK_MAP_REGION_END_PTRget_link_map_entry_sizeLINK_MAP_ENTRY_SIZEFiles changed (10)
get_native_account_active_storage_slots_ptr,get_native_account_initial_storage_slots_ptr) to usepush.NATIVE_ACCOUNT_DATA_PTRdirectly.Closes #2415