Commit Graph

15 Commits

Author SHA1 Message Date
bacc40d844 GenASM: Make sure the stack is 16 byte aligned before calling malloc or free.
The GenASM visitor only uses quad mnemonics so each manipulation to the stack is done in 8 byte chunks. This means our stack is always 8 byte aligned which is fine when only calling KLang code. libc functions like 'malloc' or 'free' require the stack to be 16 byte aligned which isn't automatically guaranteed when being 8 byte aligned. This is why we need to be careful when manipulating the stack (e.g. pushq, popq, subq x, %rsp). By assuming that we are stack aligned at the beginning of execution and by tracking the number of pushq operations we can deduce whether we misaligned the stack and align it again by adding another 8 byte to the stack.

This re-alignment of the stack is done directly before entering a function body or calling malloc. Since there are no stack manipulations involved when generating the code to calling 'free' there is reason to check for alignment there.
2023-03-21 22:21:14 +01:00
35de3c7de4 implement test for tail call optimization 2020-03-09 17:10:50 +01:00
1f8de66751 update the struct test so that field c of the test struct is of type double 2020-03-09 13:49:09 +01:00
3b5dc43cfb implement test functions 2020-03-09 12:49:09 +01:00
333475f27b implement integer division tests 2020-03-05 17:21:08 +01:00
Marvin Kaiser
58cdaf04dd 25-Add more tests for floats 2020-03-05 07:58:16 +01:00
18cfbdcbb5 implement function call tests for floats and floats mixed with integers 2020-03-04 20:46:49 +01:00
384d98418d implement math tests for floats 2020-03-04 20:46:08 +01:00
Marvin Kaiser
6eb61f905f 25: Add logic for handling float in function calls 2020-03-04 19:29:24 +01:00
Marvin Kaiser
34253a70ba Implement operator precedence with and without parenthesis 2020-02-03 16:35:29 +01:00
fa8904e0f5 fix type annotation for comparison expressions 2020-01-27 16:57:09 +01:00
0aed4ee893 my initial short for typechecking, still very unifinished tho 2020-01-21 00:21:54 +01:00
e5baad62e6 implement tests 2020-01-20 19:33:07 +01:00
Marvin Kaiser
d27df13ec1 added boolean operators 2020-01-20 16:01:25 +01:00
Marvin Kaiser
d2d50f6d4f cleaned up test suit 2020-01-14 11:47:04 +01:00