views:

373

answers:

6

Alan Kay points out that "Unlike Java, [Squeak] runs bit-identical on every machine -- we invented this 20 years ago". The wikipedia page mentions this also:

Squeak is available for many platforms, and programs produced on one platform run bit-identical on all other platforms.

Since machines with different instruction sets obviously can't run bit-identical programs natively, what does it mean when one says that Squeak runs bit-identical programs on different machines, in a way that Java doesn't?

I'm under the impression that compiled Java classes runs identically on any machine on any JVM, is that not so?

+1  A: 

It runs on a virtual machine, as stated in the next sentence on Wikipedia. :)

Not sure what the "bit-identical" part means, as compared to Java. My impression is that the same class files can run on different machines, since Java too runs on a virtual machine.

Here's hoping Alan will jump into the thread and clear this up for us!

unwind
A: 

The only thing I can think of is that he's referring to the fact the Java is often (and C# is always) "Just-in-time" compiled on the target machine to native code, before it's run.

James Curran
+2  A: 

Bit identical means that Squeak image itself can run in many platforms, not only Squeak source code.

Smalltalk image is namely a store for both code (in bytecode format) and live objects. Code is available in intermediate bytecode format, which VM then compile to platform specific machine code on the fly.

Janko Mivšek
+5  A: 

The obvious interpretation is that executing the same image on different machines with the same inputs will result in the image evolving through the same bit patterns. This post about Squeak's floating point math implies that the floating point has identical representation on different platforms. Java requires that semantics are the same between platforms, but permits denormalised representations. The library Squeak uses to ensure bit-identical floating point across platform is Sun's one, which the Sun JVM also uses, though they mention further restricting it with compiler settings.

Pete Kirkham
+3  A: 

The term bit-identical can not only refer to no native code, but also refer to how data operations are handled. From platform to platform there are subtile difference, for example in the least significant digits of floating point numbers due to diffrent hardware implementations of the floating point unit.

So bit-identical could also mean that such diffrences are removed and every single instruction returns bit by bit the same result on every hardware. Ad hoc this prohibts the usage of some hardware and would require emulation. I am not sure if thi is feasible at acceptable costs or if there is a good trick to achiev this.

Daniel Brückner
+1  A: 

From the documentation of java.lang.Math:

Unlike some of the numeric methods of class StrictMath, all implementations of the equivalent functions of class Math are not defined to return the bit-for-bit same results. This relaxation permits better-performing implementations where strict reproducibility is not required.

Dan Berindei