feature/char-support #3

Merged
nitrix merged 5 commits from feature/char-support into master 2023-03-24 17:03:24 +01:00
Showing only changes of commit a7e93f4f01 - Show all commits

View File

@@ -660,17 +660,17 @@ public class GenASM implements Visitor<Void> {
asm.sub("q", "$8", "%rsp");
}
e.block.welcome(this);
// I need to clear the stack here so that the top most element is the old rbp that
// ret uses to return to the caller but code that gets generated here will never be
// reached since the block node is guaranteed to contain a return node that results
// in a ret command being executed before this code would be reached.
// As a workaround (and a dirty, dirty hack) I indicate to the return node visitor
// how many bytes need to be cleared from the stack.
// ret uses to return to the caller but code that gets generated after visiting the
// function body will never be reached since the block node is guaranteed to
// contain a return node that results in a ret command being executed before this
// code would be reached. As a workaround (and a dirty, dirty hack) I indicate
// to the return node visitor how many bytes need to be cleared from the stack.
var wasStackPadded = (registerParameters.size() + e.localVariables.length) % 2 != 0;
bytesToClearFromTheStack = 8L * (registerParameters.size() + e.localVariables.length + (wasStackPadded ? 1 : 0));
e.block.welcome(this);
return null;
}