Re:CS 6120: Advanced Compilers: The Self-Guided Online Course
by koonsolo on Monday March 13, 2023 @03:56AM
(#35132488)
What do you mean exactly by "compilers"? Because the book features a chapter on how to compile source code to virtual machine byte code.
[ Parent
| on HN ]
Re:CS 6120: Advanced Compilers: The Self-Guided Online Course
by sondr3 on Monday March 13, 2023 @04:27AM
(#35132710)
Most of the time when people talk about compiled languages/compilers, they mean languages that compile to native machine code, not languages that compile to a bytecode/run on a virtual machine.
Re:CS 6120: Advanced Compilers: The Self-Guided Online Course
by vsnf on Monday March 13, 2023 @04:40AM
(#35132820)
Is that true? I think of C# and Java as compiled languages and they run on the CLR/JVM which are both virtual machines.
Re:CS 6120: Advanced Compilers: The Self-Guided Online Course
by sondr3 on Monday March 13, 2023 @05:48AM
(#35133388)
It's just the nomenclature that I'm used to, compiled languages are so called because there is no VM, it's just machine code that is run while C# and Java still requires the JVM to do JIT compilation at runtime. But it's mostly splitting hairs, there is no agreed upon definition of what makes a languages compiled/interpreted.
Re:CS 6120: Advanced Compilers: The Self-Guided Online Course
by orthoxerox on Monday March 13, 2023 @10:10AM
(#35135918)
Both have JITs. So someone wrote a compiler from CIL/JVM bytecode into native code.
Re:CS 6120: Advanced Compilers: The Self-Guided Online Course
by barrkel on Monday March 13, 2023 @05:58AM
(#35133467)
Compiling to machine code rather than VM bytecode is a difference in degree rather than kind, and doing it well rather than naively is a deep topic.
Simple machine code generation with basic register allocation and evaluation which eagerly spills to the stack is not super hard. Producing fast code instead is a bottomless well.
Re:CS 6120: Advanced Compilers: The Self-Guided Online Course
by t-3 on Monday March 13, 2023 @11:38AM
(#35137240)
There's literally no difference in the theory or technique of compiling for a virtual machine or a real one. Real machines are just messier and have a bunch of edge cases and weirdness that require you to read those multi-kilopage manuals to figure out. Having one or more intermediate steps is useful for portability and optimization though, so it's probably a good idea to target a virtual machine unless you only intend to ever target one specific architecture that you know inside and out.