<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
 --></style><title>Re: Complexity and starting over on the JVM
(ideas)</title></head><body>
<blockquote type="cite" cite>But, if you had the time, I'd sure be
happy to learn more about any unusual<br>
aspects of the general architecture if you can describe it simply. As
a<br>
simple answer to that, is it still organized as Michael outlined:
&quot;It's very<br>
nice code, and nicely modularised into just 8 classes and 1 interface:
the<br>
Squeak interface defines constants. The Main and Starter classes
are<br>
wrappers to get everything running. Then there are SqueakVM and<br>
SqueakPrimitiveHandler for execution, Screen and BitBlt for
displaying, and</blockquote>
<blockquote type="cite" cite>SqueakImage and SqueakObject for
representing living things.&quot;</blockquote>
<div><br></div>
<div>Yes, still so organized -- I haven't touched it since 2006.</div>
<div><br></div>
<blockquote type="cite" cite>And how many pages or lines of Java code
(roughly) did that turn out to be?</blockquote>
<div><br></div>
<div>Evaluating:</div>
<div>&nbsp;| dir s | dir _ FileDirectory on:
'/Users/danielingalls/Desktop/SqueakOnJava/src'.<br>
dir fileNames do: [:n | s _ (dir fileNamed: n) contents.<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>Transcript cr; nextPutAll: n;
space; print: (s asBag occurrencesOf: Character lf); endEntry]<br>
prints...</div>
<div>BitBlt.java 897<br>
Main.java 31<br>
Screen.java 380<br>
Squeak.java 125<br>
SqueakImage.java 360<br>
SqueakObject.java 300<br>
SqueakPrimitiveHandler.java 1680<br>
SqueakVM.java 1704<br>
Starter.java 55</div>
<div>... so it's about 5000 lines of code counting comments (and there
are some ;-).</div>
<div><br></div>
<blockquote type="cite" cite>And also, did you write a
Smalltalk-&gt;Java translator to make the VM or did</blockquote>
<blockquote type="cite" cite>you code it by hand?</blockquote>
<div><br></div>
<div>I wrote it by hand because (a) I was trying to learn Java, and
(b) I wanted to use</div>
<div>Java storage management.</div>
<div><br></div>
<blockquote type="cite" cite>I'd be curious about anything you could
say about the license of the Java<br>
part (or Smalltalk-&gt;Java translator). X/MIT? Squeak? Other (Sun's
Java or<br>
GPL+Exception)? (Even LGPL is fine with me, by the way, as I expect to
be<br>
using that if I draw from GNU/Smalltalk for the core.) Though I know
until<br>
its formally released maybe you can't make promises as to license, so
feel<br>
free to not answer that. Still, I would expect that those classes
would all</blockquote>
<blockquote type="cite" cite>be very useful in whatever implementation
anyone worked on for the JVM.</blockquote>
<div><br></div>
<div>It's an MIT license.</div>
<div><br></div>
<blockquote type="cite" cite>These questions would all take longer to
answer, or might have proprietary<br>
or personal answers, so feel free to skip them. In general, it would
be nice<br>
to learn what parts were hardest to do or where you had to write a lot
more<br>
Java code than expected (or even, what parts were surprisingly
easy).</blockquote>
<div><br></div>
<div>A lot of the code just looks like the C that comes out of our C
translation.</div>
<div>I would have just made a Java translator, except for the
adaptation to</div>
<div>Java objects.</div>
<div><br></div>
<blockquote type="cite" cite>Although perhaps that would be too
specific to you to know if it applies to<br>
any such effort? It would be nice to get a general impression of how
many<br>
Squeak classes it has (if different form a standard image), how it
performs<br>
relative to Squeak in C on the same hardware, or what parts of the
Squeak VM<br>
the JVM struggles with (if you profiled it), or if it exposed any
(publicly</blockquote>
<blockquote type="cite" cite>known) JVM problems or weaknesses any
such effort might encounter.</blockquote>
<div><br>
I had as a goal to run the Mini2.1 image, period. You can fire it
up</div>
<div>and get all the stats.&nbsp; It's about 600k (320k gzipped), it
has 202 classes,</div>
<div>and 4592 methods that decompile to 856k of source (more than the
image</div>
<div>size itself -- I always used to kid that it was like source code
compression</div>
<div>with an integrated development environment thrown in for free
;-).</div>
<div><br></div>
<blockquote type="cite" cite>I'd like</blockquote>
<blockquote type="cite" cite>to learn if it involved refactoring or
changing any of the Squeak core<br>
classes (or if you just used essentially a release image or
something<br>
similar). It would be nice to know what version(s) of Squeak you drew
from.</blockquote>
<div><br></div>
<div>Mini2.1 period.<br>
</div>
<div>By the way, if the stars are lined up right, you can just click
on...</div>
<div><br></div>
<div><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab><a
href="http://Weather-Dimensions.com/Dan/ForwardToThePast.jnlp"
>http://Weather-Dimensions.com/Dan/ForwardToThePast.jnlp</a></div>
<div><br></div>
<div>[It will run your cpu full throttle because I never bothered to
figure out</div>
<div>how to yield to the OS&nbsp; That would be a big help]</div>
<div><br></div>
<blockquote type="cite" cite>It would be nice to know if newer JVMs
(like six or seven) make it perform a</blockquote>
<blockquote type="cite" cite>lot better.</blockquote>
<div><br></div>
<div>I can't tell you.&nbsp; I just run what's on my Mac.&nbsp; I
get</div>
<div><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab>16088486 bytecodes/sec; 928210 sends/sec</div>
<div>where the Squeak VM gets</div>
<div><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab>539515279 bytecodes/sec; 12461126 sends/sec</div>
<div>or&nbsp; between 10 and 30 times slower than C.</div>
<div><br></div>
<div>But you can't take this as an indication of Java versus C because
the</div>
<div>whole object memory is simulated.&nbsp; If you look at bitBlt
performance</div>
<div>which is pretty comparable code, they're just about equal
(believe it or not).</div>
<div><br></div>
<blockquote type="cite" cite>Also, compared to the C, it would be nice
to know if you though</blockquote>
<blockquote type="cite" cite>the Java code seemed as beautiful or
elegant?</blockquote>
<div><br>
Well, look at the size.&nbsp; It was very nice not to have to write a
garbage collector,</div>
<div>and enumeration and become together are only a page of code.<br>
</div>
<blockquote type="cite" cite>Did you find the tools as</blockquote>
<blockquote type="cite" cite>reasonable as ones for C?</blockquote>
<div><br></div>
<div>Huh?&nbsp; I've never used C.&nbsp; Ha ha.&nbsp; Got ya
there.</div>
<div>The only C tool I've ever used is the C translator</div>
<div><br></div>
<blockquote type="cite" cite>I'd be curious what setup you used to
develop and<br>
test it too, just out of curiosity (Eclipse, Sun's tools?
Other?).</blockquote>
<div><br></div>
<div>I used Sun's NetBeans.&nbsp; It seemed PC, and a useful reality
check.</div>
<div><br></div>
<blockquote type="cite" cite>Does the<br>
system feel stable to you (that is, relatively to Squeak on a VM in
C)? Or</blockquote>
<blockquote type="cite" cite>anything else related to an overview to
get everyone even more tempted. :-)</blockquote>
<div><br></div>
<div>Yes, it's stable, but very untested.&nbsp; I'd say it needs a
month or two to complete it</div>
<div>and maybe another month to work up a decent synergy with
Java.</div>
<div><br></div>
<blockquote type="cite" cite>Essentially, anything non-proprietary you
might want to later put in a<br>
lengthy &quot;readme&quot; file or an informative pre-announcement is
what I would<br>
love to know right now. Or a pointer to such if it already exists on
the</blockquote>
<blockquote type="cite" cite>public web. :-)</blockquote>
<div><br></div>
<div>You wanted to know about the object format.&nbsp; Here it
is...</div>
<div><br></div>
<div>public class SqueakObject {//Later make variants for common
formats<br>
&nbsp;&nbsp;&nbsp; short hash;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//12-bit Squeak hash<br>
&nbsp;&nbsp;&nbsp; short format;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //
4-bit Squeak format<br>
&nbsp;&nbsp;&nbsp; Object sqClass;&nbsp; //squeak class<br>
&nbsp;&nbsp;&nbsp; Object[] pointers; //pointer fields; fixed as well
as indexable<br>
&nbsp;&nbsp;&nbsp; Object bits;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//indexable binary data (bytes or ints)<br>
</div>
<div>The only other tricks are that I use a weak object table to</div>
<div>support enumeration and become, and I use boxed integers</div>
<div>throughout, keeping the common ones in a table for quick
creation</div>
<div>and to avoid needing to reclaim them (they are shared).</div>
<div><br></div>
<blockquote type="cite" cite>This is unrelated, but as long as I'm
asking, :-) feel free to say no<br>
comment, I'd be curious if you were involved or in touch at all with
Sun's<br>
effort to make the JVM have better support for dynamic languages (like
JRuby<br>
or Jython, or, hopefully, a Squeak/JVM. :-) No Smalltalkers listed
here,<br>
sadly, but it was years ago:<br>
&nbsp; &quot;Sun warms to Dynamic Languages: Summit Held&quot; (Dec.
2004)<br>
&nbsp;
http://www.theserverside.com/news/thread.tss?thread_id=30462<br>
That's just to get a sense of how much the JVM might (in theory)
continue to<br>
improve in a Smalltalk-ish direction if there was an actively used
Smalltalk</blockquote>
<blockquote type="cite" cite>on the JVM and someone there who cared
about it.</blockquote>
<div><br></div>
<div>I've left this up to their own technical and marketing
decisions.</div>
<div>If they wanted to take this project farther I would certainly
help them</div>
<div>to get started.</div>
<div><br></div>
<div><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>-
Dan</div>
</body>
</html>