Tuesday, August 21, 2007

NewCompiler repport

Last two weeks I worked on decompilation and optimization

For the decompilation I made some fixes for the closure decompiler.

Mainly fixes concern scope. Now I have a clear view of how variables are accessed.
This is not really what you can understand when you read the implementation. And I think we should concentrate to go in this direction.
So there is 3 different way to access a variable (I am talking only about temp and inst var).

- "Simple access": This is when we access a variable that is not captured.
The generated bytecodes are #pushTemp: offset, #storeTemp: offset , #pushInstVar: offset or #storeInstVar: offset.

Example:

| a |
a := 3.
[ | b | b:= 5 factorial.]

- "Captured access": This is when we have to access to a temp defined in the same scope that is captured by a block.

Example:

| a b |
a := 2. "A captured access"
b := 1. "An other captured access"
[a + [b] value ] value.

The compiler here needs to access to the ClosureEnvironment stored in the MethodContext:
pushConstant: 2
pushThisContext
pushConstant: 5
send: privGetInstVar:
pushConstant: 1
send: privStoreIn:instVar:

- "Far captured access": When we want to access to a variable which is in the parent scope

| a b |
a := 2.
b := 1.
[| c |
c := 3.
a + [b + c] value ] value. "Two different kind of Far captured access "

The right closure need to be pushed before we can access to the temp.

for the inst var a:

pushInstVar: 1 "since the receiver of the block is the closure environment"

for b:

pushInstVar: 0
pushConstant: 2
send: privGetInstVar: " Closure environment are chain by storing them in the first slot of the parent closure environment ".

Now to optimize the NewCompiler I have implemented 5 bytecodes.

- the first one is to push or store the closure environment:

pushThisContext
pushConstant:5
send: privGetInstVar:

will be replace by:

pushThisEnv

This bytecode is needed when you create the block. (Remember the receiver of the block is the closure environment)
I have also implemented the bytecode for the "captured access" and the far "captured access":

pushConstant: 2
pushThisContext
pushConstant: 5
send: privGetInstVar:
pushConstant: 1
send: privStoreIn:instVar:

is replaced by:

pushNestedClosure: 0 offset: 0

and:

pushInstVar: 0
pushConstant: 2
send: privGetInstVar:

by:

pushNestedClosure: 1 offset: 1

If you get confused with the value of the offset is normal.
In the image and more particularly for the message #privGetInstVar:, the instance variable are count starting from 1.
But in the VM the offset is count starting from 0.

The last bytecode concern the closure creation:

pushConstant: ClosureEnvironment
pushConstant: 1
send #mew:

replace by:

new closure: 1

I have made a small benchmark to see the performance:
[| a | a := 0. #(1 2 3 4 5 6 7 8 9 10) do: [:each | a := each + a].a halt] bench.

the result is:
For the new compiler:
'405 558 per second.'.

For the old closure and old compiler:
'567 088 per second.'.

Full closure performance is now quite close the the non full closure performance.
Some other benchmark is needed to confirm that result.
They is also some other optimization inside the bytecode and primitive to make closure faster.
At the end the new compiler could have similar performance to the old one.

Saturday, August 18, 2007

OWRTA #12

Hello. I've implemented headings and tables (without "=" as table haders for now.). I'm planning to finish tables and start implementing next tags. Remaining tags are: Links, Lists, Image, Placeholder and partly Escape character. Current status page with examples.

Wednesday, August 15, 2007

Having MC2 look like MC1

I'm currently working on making MC2 really look like MC1. This is what results from the discussion we had with my mentor when he visited me two weeks ago. My main goal is to have the same features as in MC1 to ease adoption, not more not less.

What have changed recently:

- I've implemented the 'Changes' feature. Changes are calculated but a tool must be built to display them.
- I've also implemented a browser for repositories. This is really like the Repository Browser in MC1.
- Some classes avoids the creation of equal instances (the slices, the slice stati...).
- Corrects a bug with the directory repository.

Here is a screenshot of the two MC2 browsers. When there are '?' around a button label, that means the feature is not yet implemented.



What I plan to do in future weeks:

- Finish the implementation of the 'Changes'
- Change the format of commits to contain textual information (a zip with the source code, the change comment, and the binary data that is already generated)

Monday, August 13, 2007

DomView

I worked on html tables last week. DomView is now able to display simple tables(with small bugs).
I have to display HEAD and FOOT nodes and manage colspans/rowspans - it will be my next week task.

If those milestones are reached, i will have to work on table borders and others table CSS attributes.

Tomorrow,I will add screenshots on my blog.

Monday, August 6, 2007

HTML Tables

Last week was devoted to Html tables renderer. I thought of an effective manner to display tables.
This one is not completed yet, but I have a start. I will have to adapt this method to be able to render complex tables (with rowspan or/and collspan attributes).

First, I wanted to use an existing package named SFC-Layout - Finally i am writing my own code.

I will continue this work during this next week - I hope that a pretty screenshot will be available next week :-) .

OWRTA #11

Ok. Finally I've got Preformatted tags working. That also helped me to find some bugs which I've fixed too. I'm going to implement next tags in this week. Also I'm planning to get a new image from Keithy so I could start next task in parallel. The only problem with Preformatted is that string: //yoyo{{{preformatted}}}yoyoyo// will be in italics at any position (preformatted too). I thought that this is a bug, but Creole sandbox shows the same result. Please visit my site at Services -> CreoleTest and feel free to edit that page. (**bold**, //italics//,{{{preformatted}}},---- and \\).

Tuesday, July 31, 2007

Release of Monticello 2

Last week, I made refinements to Monticello 2 to build a release. Amongst them:

  • intelligent naming of generated files
  • 2 loading problems corrected
  • more automatic refresh of the browser
  • the browser is registered in the open... menu
  • new actions in the browser
Then, I announced the release on squeak-dev. However, I didn't get any feedback, nor comments...

I'm still waiting for 5 answers from Colin and Avi. This lack of help from both of them prevents me from going much further. I would also like comments from the community.

This week my mentor Stéphane Ducasse is visiting me. We will discuss about how I should continue.

Monday, July 30, 2007

DomView Weekly Report

I have just finished the Acid1 test page renderer.
I am really happy to complete this step. Last little details are now correctly displayed: Radio buttons and irregular borders (I am not sure that the border draw method is the finale one).

Here the screenshot ( Click on it for the real size ).





The css loading algorithm proved to be useless. You could go on my blog for more explanations.
This week I will work on html tables. First I will have to think of an effective manner for their render.

NewCompiler repport #8

Last week I have looked at VMMaker.
VMMaker is a tool that let you write the interpreter of Squeak.
VMMaker is written in Squeak. So you can read slang(a subset of smalltalk) to understand how the VM work.
Slang are translated to C that is part of the VM code source.

I have implemented some primitive to make BlockClosure faster.
In Squeak primitives are special methods that are built inside the VM.
To specify a primitive you have to use the pragma #primitive:

Take a look at SmallInteger>>+
If you have VMMaker loaded inside the image you can see what the VM dose.
The corresponding method of SmallInteger>>+ is Interpreter>>primitiveAdd.
So when the message #+ is sent to an integer the VM call the subroutine primitiveAdd.

Most of the time Slang only call ObjectMemmory and Interprete methods.
The both classes represent the internal state of the VM. They also manipulate reify contexts.

For optimizing the BlockClosure I have implemented 2 primitive one for #value and one for either #value: or #value:value:…
Now the performance of the closure are closed to the old block.

I have also discussed with Marcus Denker to know which bytecodes should be implemented. We finally agreed on 3 bytecodes:

- creating the ClosureEnvironment(CE)
- store in the CE
- push in the CE

A part from VMMaker I also contnue fixing the decompiler for closure.
Especially for scope and captured variable.

Still, the decompiler for old block is finish and ready to use

Saturday, July 28, 2007

OWRTA #10

DUH! Finally I've finished this horizontal rule which helped me to find some errors in code. So... new tags are available: line break (\\) and Horizontal Rule (----). Check this out. Feel free to edit it now! Paragraph bug is was fixed too ;)

Friday, July 27, 2007

OWRTA #9

Tonight I've modified Piers wikiWriter's class copy so now everybody can edit-save-edit in Creole syntax (not so many tags for now). There was ability to edit-save in Creole before. After next edit - all markup was shown in Pier. Check how it works here

Thursday, July 26, 2007

Seaside and Sails first report

Hi there!
I just finished Proof-of-Concept blog example. It accessible at http://www.squeaksource.com/SeasideAndSails/ now.

Two words about Sails: it's an add-on to Seaside for fast generation of web application from Domain Model or Relational Model - ready-to use prototype with automatic storing in RDB or/and in OODB. You can read more at Giovanni Corriga's intro, at Sails wiki page or you can look at Sails Tutorial .

This Proof-of-Concept is reincarnation of famous Blog at 15 min video , mutated in "Blog in 5 minute" now. All you need is your Domain Model, described by magritte's describers. Then you just tell #generate to Sails - and your ready and even registered blog appear.

OWRTA #8



Ok. It seems that simple bold-italic nesting works fine for now.

Monday, July 23, 2007

OWRTA #7

Sorry that I'm late. I've just finished paragraph-by-paragraph Creole parsing implementation and implemented multi-line syntax support.

So this construction:


will become:


and parsed tree is:


This week I will continue to implement other syntax parts and then I will implement wikiWriter to write back correct syntax in TextArea. Also I think I will not go to the ESUG, because there is only 5 weeks to complete my tasks, so I prefer to stick with my current tasks (ESUG organisators! Please, don't kill me). I will notify them today.

Message histogram

A byproduct of today's work is a simple histogram that shows Croquet messages received by a computer. To try it out,

  1. Load SocRecording-bvs.7 from the "SocRecording" Monticello repository at http://www.squeaksource.com/SocRecording.
  2. Open the Croquet(Master) demo somewhere on your network.
  3. Do "CroquetMessageHistogramMorph new openInHand" in a Workspace.

OmniBrowser based UI for Monticello2

This week, I've decided to stop working with ToolBuilder to mock up the graphical interface. As I have some knowledge about OmniBrowser, I chose OB to test ideas.

This revealed to be a really good idea. I don't loose time with low abstractions anymore. OmniBrowser provides me all the necessary abstractions and I can concentrate on the model and the features.

To present my work, I have built a screencast:
http://damien.cassou.free.fr/monticello2/monticello2.ogg

This is encoded in Ogg/Theora which is a free open-source encoding. If you are on Linux, you should be able to play this video without problem. On MacOS, Damien Pollet told me to advertise Perian. I don't know for MS Windows users, but it should be easy.

During the current week, I will continue working on the UI. As soon as I have something ready to use by everyone, I will post an announce on the squeak-dev mailing list.

I have some problems with the MC2 model. I've sent mails to the mailing list but, currently, they prevent me from going much further without answers from Colin and/or Avi.

DomView Weekly Report

My last week was focused on the ACID1 test page.

I still have some problems with the CSS loading algorithm that is why the render is not perfect.
Here a screenshot:






Next week, I will complete this task - I have to:

  • Resolve the css loading problem

  • Make links clickable

  • Display forms elements (here radio buttons)

  • Resolve the in line element placement

Weekly update

I have of course done many weekly updates in private, but this is my first post (!) to this blog, so I will give some background as well.

My name is Benjamin Schroeder; I am working on recording Squeak programming sessions for later playback, using Croquet as a foundation. The plan is to start with 2D, rather than trying to figure out appropriate browser/workspace/inspector UIs for use in a 3D Croquet world.

So far, I have had some success recording and playing back simple Croquet interaction sequences, using the standard 3D Croquet simple demo island. There is another recording project at Minnesota; it takes a slightly different approach, but I may switch to using their code at some point if it is publicly available.

The standard Croquet interaction paradigm is 3D. There are 2D "embedded apps", but it is not clear whether these are properly replicated (and hence recordable) or not. Recently, I have been working on replicating simple 2D worlds using Croquet. To that end, I have been stripping down the Croquet "harness" object to reduce its reliance on OpenGL. The act of stripping parts out, while keeping very basic functionality working, has helped me understand more about what happens during a Croquet session.

I now understand how to replicate a single Morph, headless, across a network. I think my next step is to display the Morph inside an owner that converts mouse events to "future" sends, and then to try more complicated morphs. I am told that Tweak works better than Morphic with the synchronization mechanisms used during Croquet replication, and so I will likely switch to Tweak at some point. I have been learning a little about Tweak, but still have much to understand.

Sunday, July 22, 2007

New guests from ESUG's SummerTalk projects

SummerTalk is a project sponsored by ESUG similar to Google Summer of Code. While the latter focuses on Open Source projects and is programming-languages agnostic, the former focuses on Smalltalk projects (while keeping the requirements for the work to be under an open-source license).

We've decided to invite the SummerTalk partecipants who are working on Squeak-related projects to join this blog as guest authors. These new guests are Juraj Kubelka, who's working on improving the OmniBrowser framework, and Yuriy Mironenko, who's working on an add-on to Seaside called Sails.

Welcome, guys!

Monday, July 16, 2007

NewCompiler week #5 repport

Until the last week, I was fixing some tests for the decompiler. This week, I am starting to decompile the complete image.
To do that, I take a method compiled with the NewCompiler. I decompile it to an AST and recompile it to a CompiledMethod, then I reinstall the method inside the class.

It is necessary to take a method compiled with the NewCompiler because the NewCompiler does some optimization that the decompiler know.

I do this for all the methods in the image.
This helps to find a lot of bug.
At the beginning I had 37 tests now I have 71 tests.
The decompiler still don't work but only for a few methods.

This week I will finish to fix the decompiler(for the old block).
I also need to decompile with the block closure.
The next things to do will be to implement a primitive for BlockClosure>>value and more generally work on performance.