IR -> IR Optimization -> Code Generation(Register allocation/Instruction selection) Assembly
1.top-of-stack caching (1-TOSCA)
2.init garbage collector
1.similar to C++ inheritance
2.gc in COOL runtime
3.Class Tag, Object Size, Dispatch table pointer (similar to C++ vptr), Dispatch table (similar to C++ vtable)
4.register allocation is Graph coloring
(Linear-Scan Register Allocation
is another way to allocate registers)
1.Three-address code (it doesn't be implemented in this course)
1.it contains a concurrent garbage collector
2.the management of application memory
3.how the program accesses variables, mechanisms for passing parameters between procedures
4.interfacing with the operating system
5.The compiler makes assumptions depending on the specific runtime system to generate correct code.
gc is also part of the program
1.gc in runtime
2.how gc works
3.stack-based virtual machine -> register-based virtual machine (?
4.code generation
4-1. stack based machine
4-2. register based machine
-> register allocation and assignment
-> instruction selection/instruction scheduling
5. how to verify and test compiler?
boot in qemu-system-aarch64
qemu-system-aarch64 -m 4096 -cpu cortex-a72 -smp 4 -M virt -nographic -bios QEMU_EFI.fd -drive if=none,file=ubuntu-20.04-arm64.img,id=hd0 -device virtio-blk-device,drive=hd0 -drive file=user-data.img,format=raw -device virtio-net-device,netdev=net0 -netdev user,hostfwd=tcp:127.0.0.1:2222-:22,id=net0
username: ubuntu
password: asdfqwer
REF:
ARM64 Linux on Win10
QEMU + Ubuntu ARM aarch64
ubuntu-18.04-server-cloudimg-arm64.sh
qemu-arm64.sh
ssh connect to qemu
ssh ubuntu@localhost -p 2222
Question:
E514: write error (file system full?)
How to fix :
Step1: resize the ubuntu image
qemu-img resize [your_image_name] +8G // add more 8G
e.g.
qemu-img resize ubuntu-20.04-arm64_10G.img +8G
Step2: To avoid a No space left on the block device error
sudo mount -o size=10M,rw,nodev,nosuid -t tmpfs tmpfs /tmp
Step3: Run the growpart command to grow the size of the root partition or partition 1
sudo growpart /dev/vda 1
Step4: Expand the file system (e.g. EXT2/EXT3/EXT4 file system)
sudo resize2fs /dev/vda1
Step5: Unmount the tmpfs file system (
/tmp
which is done in Step2)sudo umount /tmp
REF:
How do I increase the size of my EBS volume if I receive an error that there's no space left on my file system?
Error message "sudo: unable to resolve host (none)" (
echo $(hostname -I | cut -d\ -f1) $(hostname) | sudo tee -a /etc/hosts
)scanf
does not consume the '\n' that follows the number. The nextfgets
reads that 1 character '\n'.transfer a file from host to guest in qemu
rsync -e 'ssh -p [ssh port]' [file_in_host] [user_name]@localhost:[guest dir]
(from host to guest)e.g.
rsync -e 'ssh -p 2222' ./main ubuntu@localhost:/home/ubuntu
ref: How to Transfer Files with Rsync over SSH
debug with gdb
gdb ./main2
Write a linux module to show the current exception level of aarch64 in qemu
Ref: 如何寫一個 Linux Kernel Module
hello.c
Makefile