Closed juice500ml closed 7 years ago
난 그게 맞다고 생각함 밑에서 위로 쌓이니까?
int localCodeGen()의 ArrayK VariableK의 IntArrayT 와 dependent한 문제임.
이유는, arr[n]이라고 치면 VariableK의 IntArrayT에서 해당 array의 global 주소값을 넘기고, ArrayK에서는 해당 주소값 + sizeof(int) * n 을 접근해서 갖고옴. 문서에 언급이 되어있었던 것 같음. 확인 바람 @taeseunglee
Above the text segment is the data segment (starting at 0x10000000), which is divided into two parts. The static data portion contains objects whose size and address are known to the compiler and linker. Immediately above these objects is dynamic data. As a program allocates space dynamically (i.e., by malloc), the sbrk system call moves the top of the data segment up.
요래서 더해가면 될 듯!
static int globalMemAlloc(size) { // ... addr += size; return addr; } 이게 맞나?