more notes
This commit is contained in:
parent
58c053782e
commit
ed8fa31104
8
NOTES
8
NOTES
@ -1,3 +1,11 @@
|
|||||||
|
Been thinking about the stack and heap a lot. It would be possible, though
|
||||||
|
possibly painful, to enforce a language with no global heap. The question really
|
||||||
|
is: what are the principles which give reason to do so? What are the principles
|
||||||
|
of this language, period? The principles are different than the use-cases. They
|
||||||
|
don't need to be logically rigorous (at first anyway).
|
||||||
|
|
||||||
|
##########
|
||||||
|
|
||||||
I need to prioritize the future of this project a bit more. I've been thinking
|
I need to prioritize the future of this project a bit more. I've been thinking
|
||||||
I'm going to figure this thing out at this level, but I shouldn't even be
|
I'm going to figure this thing out at this level, but I shouldn't even be
|
||||||
working here without a higher level view.
|
working here without a higher level view.
|
||||||
|
@ -258,3 +258,34 @@ void _start() {
|
|||||||
|
|
||||||
- The subsequent `mov %rax,-0x8(%rsp)` is moving the pointer (stored in
|
- The subsequent `mov %rax,-0x8(%rsp)` is moving the pointer (stored in
|
||||||
`%rax`) and putting it onto the stack.
|
`%rax`) and putting it onto the stack.
|
||||||
|
|
||||||
|
## VLA
|
||||||
|
|
||||||
|
With the following file:
|
||||||
|
|
||||||
|
```c
|
||||||
|
// main.c
|
||||||
|
void do_the_thing(int n) {
|
||||||
|
int arr[n];
|
||||||
|
for (int i=0; i<n; i++) {
|
||||||
|
arr[i] = i;
|
||||||
|
}
|
||||||
|
asm("nop; nop; nop;");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void _start() {
|
||||||
|
do_the_thing(10);
|
||||||
|
asm("movl $1, %eax;"
|
||||||
|
"movl $0, %ebx;"
|
||||||
|
"int $0x80;");
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
And compiled into LLVM IR with the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
clang -nostdlib -fno-stack-protector -fomit-frame-pointer -S -emit-llvm main.c
|
||||||
|
```
|
||||||
|
|
||||||
|
We can see how llvm handles VLA. It ain't pretty, that's for sure.
|
||||||
|
Loading…
Reference in New Issue
Block a user