4 ms·
And now for a reference to a field in a struct living on the heap? Of course you can get C to run on the JVM (any CPU emulator written in Java proves that) but
by Thiez 3y ago
And now for a reference to a field in a struct living on the heap?
Of course you can get C to run on the JVM (any CPU emulator written in Java proves that) but due to JVM limitations you cannot do so efficiently. Which is why it the JVM is not an attractive target for the 'traditional' languages.
- kaba0 3y agoThat struct on the heap is just consecutive bytes in an array, so you just return an integer.
- Thiez 3y agowarrenm was asking whether Java's (and implicitly: the JVMs) concept of references could be used. I'm glad that you agree with me that they cannot. Representing the memory of a compiled C program with a giant byte array would of course work, but also defeat the purpose of running on the JVM in the first place. You lose all the advantages that running on the JVM might have given you, and are slower than a natively compiled program.