-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for inlining functions #32
Labels
Comments
I think this should be an optimization step performed directly on TASM code -- that way we do not make the already very complicated code generation step even bigger. I suggest to implement function inlining like this. impl OuterFunctionTasmCode {
/// Return the names of the subroutines that should be inlined, those whose function body is shorter or equal to the input length
fn get_subroutines_for_inling(&self, subroutine_length_threshold: usize) -> Vec<String> {
todo!()
}
/// Perform the function inlining that mutates the `CompiledTasm` data structure
fn inline(&mut self, subroutine_names: Vec<String>) {
todo!()
} The subroutines that contain
So for this, we would also want a method impl SubRoutine {
pub(crate) fn can_be_inlined(&self) -> bool {
todo!()
}
} |
Sword-Smith
added a commit
that referenced
this issue
Aug 23, 2023
With this commit, the code is concatenated later in the compilation pipeline. This will allow us inline functions after the TASM code generation but before the final code concatenation. Cf. #32.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently we are calling a function each time read from public input, or print to it. We should just inline the function body instead of calling a function.
I suggest that e.g.CompiledFunction
gets a fieldinline
which defaults tofalse
.The inlining should happen after code generation, since the code generation step is already too big. We want to avoid making the most complicated step (intermediate AST -> TASM) more complicated than it already is. It's already too complicated.
The text was updated successfully, but these errors were encountered: