Conversation
compiler/stz-reg-alloc.stanza
Outdated
| ;===================== Driver =============================== | ||
| ;============================================================ | ||
|
|
||
| val SMALL-SMAP-SIZE = 16 ;; SIZE OF SMAP WHICH CAN BE CALLED WITHOUT CHECKING STACK-SIZE |
There was a problem hiding this comment.
Create a
;====================================
;========== PARAMETERS ===============
;====================================
section at the top of the file and put this definition there.
Please follow code comment conventions. Comments start with a single semi-colon are capitalized and then lower-case.
| val amb-branch = label-table[amb(e)] | ||
| E $ asm-MethodDispatch(multi(e), num-header-args(e), no-branch, amb-branch) | ||
| (e) : fatal("Not yet implemented: %_" % [e]) | ||
|
|
There was a problem hiding this comment.
This logic is too fragile. Let's introduce a new instruction called:
SectionMarker :
name: Symbol
And have the preamble be surrounded by a pair of SectionMarker instructions. Then strip away everything in that section.
| val return-lbl = unique-id(stubs) | ||
| E $ SetL(R0, LM(return-lbl)) | ||
| E $ SetL(R1, INT(size(stackmap) + 8)) | ||
| E $ SetL(R1, INT(size(stackmap) + (8 + SMALL-SMAP-SIZE))) |
There was a problem hiding this comment.
This might be the right logic, but before I can merge it I need to refresh my head about the details of the stack layout. It's tricky, and if we get it wrong, it manifests as random crashes every few weeks, so it's important we get it right on the first try.
To do that, I need to know what is the stack layout, what is enforced by this instruction, why that +8 is there, etc.
There was a problem hiding this comment.
the +8 is yours. i just added SMALL-SMAP-SIZE.
compiler/stz-compiler-main.stanza
Outdated
| switch(situation) : | ||
| `optimized-asm : | ||
| val packages = Vector<VMPackage|StdPkg>() | ||
| val opt-timer = MillisecondTimer("Opt") |
There was a problem hiding this comment.
Please cleanup before merge.
CuppoJava
left a comment
There was a problem hiding this comment.
This is a useful but tricky request to merge. Will need time to review.
remove stack check if function is small and doesn't have any non-tail-calls.