The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Bootstrapping Smalltalk

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Bootstrapping Smalltalk Posted: Sep 10, 2004 8:00 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Bootstrapping Smalltalk
Feed Title: David Buck - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/buck-rss.xml
Feed Description: Smalltalk can do that
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From David Buck - Blog

Advertisement

On James Robertson's blog, Kartik Agaram asks:

1) Is all the source for Moose in the parcel file on their download page (i.e. browseable from within visual works)?

2) Is all the source for Visual Works browseable from within Visual Works?

If 1 is true but 2 is false, it seems one doesn't have quite the extent of freedom one associates with source code. Also, if 2 is true, how does Visual Works bootstrap to the point where it can interpret smalltalk? I assume there is some small bootstrap portion that is distributed in binary form?

This leads to a third question: What is the first Smalltalk code to execute when it launches? For the purposes of this article, we'll talk about VisualWorks.

First, there are two pieces that make up a Smalltalk system - the virtual machine and the virtual image. You can think of the virtual machine as the interpreter, although these days, Smalltalk is dynamically compiled (JIT compiled) like Java and C#. The virtual image contains an exact snapshot of the objects in the system when the image was saved.

When Smalltalk starts running, the virtual machine begins by reading the image into memory and doing a bit of housecleaning to prepare to execute it. Remember that this image contains objects for:

  • All classes in the image
  • All methods in the image
  • All the bytecodes for the methods
  • All global variables
  • All Smalltalk processes
  • The context stacks of all Smalltalk processes

At this instant, the memory copy of the image looks just like it did when the snapshot was taken. It even knows which process was the active one and has a copy of the stack. There's only one thing left to do - pick up where you left off.

Where did you leave off? The image remembers - it had just taken a snapshot. The image starts by returning from the snapshot primitive. It's already nested several levels deep in a Smalltalk return stack, but that's ok. It just picks up exactly where it left off.

The snapshot primitive itself returns two different values. One indicates that it had just snapshotted an image and was just continuing. The other value indicates that the virtual machine is starting up a new image. In that latter case, the system performs various initializations that need to be done on startup. This process is called a "returnFromSnapshot".

I don't know if it exactly answers the question, but it's an interesting topic.

Read: Bootstrapping Smalltalk

Topic: Exploring Smalltalk Previous Topic   Next Topic Topic: RUnit - Web-based test runner

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use