2 ms·
Not necessarily; in that era compiling with GCJ was a viable option too. And in the case of something like OCaml there's no VM. The point is that running the pr
by lmm 4y ago
Not necessarily; in that era compiling with GCJ was a viable option too. And in the case of something like OCaml there's no VM. The point is that running the program on a different machine does not result in random changes to when arithmetic does or doesn't overflow.
- kazinator 4y agoCompiling doesn't mean you don't have a virtual machine. Don't forget that emulators (good ones) use dyanamic translation techniques. Executor, Valgrind ... (This one: https://en.wikipedia.org/wiki/Executor_(software) https://en.wikipedia.org/wiki/Executor_(software) ) MC68K MacOS software running on x86 via executor has not been "ported", even though it is transpiled to x86 code. That's approximately the same as Java portability. There is a Java virtual machine (whether interpreted or compiled). Programs are written to that, and the virtual machine semantics is what is ported. The programs are running on the Java machine, just like the programs running under Executor are running on a 68K Mac (as far as they know).
- lmm 4y agoC programs also run on the C abstract machine, if you want to use that kind of logic. GCJ was a true native compiler, not an emulator. And Java is far from the only language that offers specific-sized integers. (Even in C, people writing portable code know to avoid the machine-sized integer types and use POSIX intN_t types instead).
- kazinator 4y agoThere is no one C abstract machine; the implementation has to choose parameters and instantiate an abstract machine. The portable C program is a kind polyglot among more than one of these (possibly all).