View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Sum00 Final Exam Review: Virtual Machines

a.
better security
possible faster startup
memory management taken care of (garbage collection)
cross-platform compatibility
better for O-O

b.

Squeak and Java VM Similarities:

nearly same generational garbage collection
both use stacks, not registers
Java bytecodes can be compiled into Squeak bytecodes


Squeak and Java VM Differences:

Java has better security built in than Squeak
Squeak bytecodes can't be compiled into Java bytecodes
Squeak can recover and continue from exceptions; Java can't
Java bytecodes are typed and Squeak bytecodes are not


c.

The tricky and timeconsuming part of dealing with a primitive would be the boxing and unboxing of the object, or moving it between native types to objects.

Adam Blaiss



Hang on: Compiling Java to Squeak bytecodes isn't the same as compiling Java bytecodes to Squeak bytecodes. Also, don't forget about Contexts/Frames. Mark Guzdial

To add to B:

Mike Maniscalco
Contexts in Java have nothing to do with compiling bytecodes. You got the exceptions backwards: Java pops the stack, Squeak doesn't. Mark Guzdial


From looking at the lectures slides and the answers given in the Spring 2000 review I am not really sure what the advantages/disadvanteges between Java's and Squeak's use of contexts. Can someone help me out?
Mike
Java pushes its method contexts ("frames" in Java) onto a global stack. (Well, global to a thread.) Squeak keeps the stack for each method INSIDE the method contexts, and contexts are chained together in a kind of separate stack. Having a global stack is faster – even Smalltalks that implement a global stack are faster than ones that don't. However, a global stack loses the flexibility of being able to carry around a "closure" – a context that refers to variables that were defined long ago and whose methods are long since departed. This is a typical Java/Squeak tradeoff – Java wins on speed, Squeak wins on flexibility. Mark Guzdial


And another reason VMs are more secure is because a VM filters and limits access to the raw machine. Mark Guzdial




Link to this Page