> On 13 Jan 2016, at 10:57, Dimitris Chloupis <kilon.al...@gmail.com> wrote:
> 
> I was adding a short description to the UPBE about sources file , I always 
> thought that the sources file is the file that contains the source code of 
> the image because the image file itself stores only the bytecode. 
> 
> However its just came to my attention that the sources file does not contain 
> code that is recently installed in the image.
> 
> So how exactly the sources file works and what it is ? 

The main perspective is from the object point of view: methods are just objects 
like everything else. In order to be executable they know their byte codes 
(which might be JIT compiled on execution, but that is an implementation 
detail) and they know their source code.

Today we would probably just store the source code strings in the image (maybe 
compressed) as memory is pretty cheap. But way back when Smalltalk started, 
that was not the case. So they decided to map the source code out to files.

So method source code is a magic string (RemoteString) that points to some 
position in a file. There are 2 files in use: the sources file and the changes 
file.

The sources file is a kind of snapshot of the source code of all methods at the 
point of release of a major new version. That is why there is a Vxy in their 
name. The source file never changes once created or renewed (a process called 
generating the sources, see PharoSourcesCondenser).

While developing and creating new versions of methods, the new source code is 
appended to another file called the changes file, much like a transaction log. 
This is also a safety mechanism to recover 'lost' changes.

The changes file can contain multiple versions of a method. This can be reduced 
in size using a process called condensing the changes, see 
PharoChangesCondenser.

On a new release, the changes file will be (almost) empty.

HTH,

Sven



Reply via email to