Skip to content

Conversation

@jackbackrack
Copy link
Contributor

remove stack check if function is small and doesn't have any non-tail-calls.

;===================== Driver ===============================
;============================================================

val SMALL-SMAP-SIZE = 16 ;; SIZE OF SMAP WHICH CAN BE CALLED WITHOUT CHECKING STACK-SIZE
Copy link
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

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])

Copy link
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

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)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the +8 is yours. i just added SMALL-SMAP-SIZE.

switch(situation) :
`optimized-asm :
val packages = Vector<VMPackage|StdPkg>()
val opt-timer = MillisecondTimer("Opt")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please cleanup before merge.

Copy link
Collaborator

@CuppoJava CuppoJava left a comment

Choose a reason for hiding this comment

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

This is a useful but tricky request to merge. Will need time to review.

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.

2 participants