10IN_ALL
(10IN ALL)
January 12, 2024, 2:06am
1
I know semantics about methods
But want to know mechanics
How func structured
How method structured
Difference between both of them
How method and function calling works
mje
(Jeff Emanuel)
January 17, 2024, 4:32pm
2
Here are pointers to function representations at different levels of compilation, and part of the translation of a function call into machine code. You can see in the code the differences for methods.
"cmd/compile/internal/types"
"cmd/internal/src"
"fmt"
)
func postExpandCallsDecompose(f *Func) {
decomposeUser(f) // redo user decompose to cleanup after expand calls
decomposeBuiltIn(f) // handles both regular decomposition and cleanup.
}
func expandCalls(f *Func) {
// Convert each aggregate arg to a call into "dismantle aggregate, store/pass parts"
// Convert each aggregate result from a call into "assemble aggregate from parts"
// Convert each multivalue exit into "dismantle aggregate, store/return parts"
// Convert incoming aggregate arg into assembly of parts.
// Feed modified AST to decompose.
sp, _ := f.spSb()
x := &expandState{
f: f,
1 Like
system
(system)
Closed
April 16, 2024, 4:32pm
3
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.