Skip to content

Conversation

@hedgar2017
Copy link
Contributor

Fixes #165

@hedgar2017 hedgar2017 requested a review from Copilot November 7, 2025 15:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the EVMLA compilation pipeline to inline the main function into the __entry function. The key changes include:

  • Renaming "recursive functions" to "defined functions" throughout the codebase to reflect that these are ordinary functions called from the entry function or other defined functions
  • Removing the separate entry link mechanism and integrating its functionality directly into the entry function
  • Consolidating function handling so the entry function is treated as the primary container for inlined code

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
solx-evm-assembly/src/lib.rs Updated public export to reflect rename from RecursiveFunction to DefinedFunction
solx-evm-assembly/src/extra_metadata/mod.rs Renamed recursive_functions to defined_functions with serde compatibility
solx-evm-assembly/src/extra_metadata/defined_function.rs Renamed RecursiveFunction struct to DefinedFunction with updated documentation
solx-evm-assembly/src/ethereal_ir/mod.rs Renamed recursive_functions to defined_functions and removed DEFAULT_ENTRY_FUNCTION_NAME constant
solx-evm-assembly/src/ethereal_ir/function/type.rs Renamed function types from Initial/Recursive to Entry/Defined
solx-evm-assembly/src/ethereal_ir/function/mod.rs Updated function handling logic to use Entry/Defined terminology and integrated entry return handling
solx-evm-assembly/src/ethereal_ir/function/block/element/stack/element.rs Updated comment from "recursive function" to "defined function"
solx-evm-assembly/src/ethereal_ir/entry_link.rs Removed entire entry_link module as functionality is now integrated
solx-evm-assembly/src/assembly/mod.rs Simplified assembly compilation by integrating EtherealIR directly into EntryFunction
solx-evm-assembly/src/assembly/instruction/name.rs Updated comments for RecursiveCall/RecursiveReturn to reference "defined function"
solx-evm-assembly/src/assembly/instruction/mod.rs Renamed recursive_call/recursive_return methods to call/r#return
solx-core/src/yul/parser/statement/function_definition.rs Simplified branch termination check using is_basic_block_terminated helper
solx-codegen-evm/src/target_machine.rs Renamed constant from SOLC_GENERAL_MEMORY_OFFSET to SOLC_USER_MEMORY_OFFSET
solx-codegen-evm/src/context/mod.rs Added is_basic_block_terminated helper method to IContext trait
solx-codegen-evm/src/const.rs Renamed constant from SOLC_GENERAL_MEMORY_OFFSET to SOLC_USER_MEMORY_OFFSET
solx-codegen-evm/src/codegen/context/mod.rs Implemented is_basic_block_terminated helper and moved module_size_fallback initialization
solx-codegen-evm/src/codegen/context/function/runtime/entry.rs Simplified termination checks using is_basic_block_terminated helper

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

})?;
run_init_verify.borrow_mut().finish();

let module_size_fallback = self.module.clone();
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module_size_fallback variable is now initialized after optimization instead of before. While this may be intentional, ensure this doesn't affect the fallback behavior if optimization fails, as the clone now happens after the initial verification step.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not after optimization, but after verification!
Invalid module cannot be cloned with inkwell, so I moved it between the verification of unoptimized module and running the optimizer.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove generation of main function and inline it in __entry

2 participants