Some more effort to make Slang and VMMaker work on Pharo [for review]

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Some more effort to make Slang and VMMaker work on Pharo [for review]

Guillermo Polito
 
Hi all,

In the last couple of days I've worked a bit on making VMMaker work in Pharo again, based on the original effort of Eliot. I've produced a couple of patches that I've left in the VMMaker inbox (below I past the commits' info).

With these changes I was able to generate, compile and run successfully so far the Stack VM on OSX (mojave). I've tried it with opensmalltalk-vm's platform code commit a838346b1, which is a commit previous to the migration to Metal.

To make this work I've written some tests too. I've packaged them so far in a separate package (VMMaker-Tests). I've seen that currently VMMaker tests are inside the VMMaker package itself, but some of them are red in Pharo. I can move those tests to the VMMaker package itself if people see a value on them.

In any case, I'm just submitting this for review :).

Cheers,
Guille

==== Patch 1 ====
Name: VMMaker.oscog-GAP.2533
Author: GAP
Time: 7 May 2019, 10:57:16.034354 am
UUID: 3209319f-60f3-4586-8d03-cfac3c9fddee
Ancestors: VMMaker.oscog-eem.2532

Convert numeric constants to strings for concatenation.
Required for Pharo compatibility, where the arguments of concatenation are not automatically coerced to strings.

==== Patch 2 - Pharo specific package ====
Name: VMMakerCompatibilityForPharo6-GuillermoPolito.10
Author: GuillermoPolito
Time: 7 May 2019, 11:03:08.229705 am
UUID: 4f49f938-aa44-0d00-8739-04000059f8ce
Ancestors: VMMakerCompatibilityForPharo6-eem.9

Fixes in AST translation to make it work as in Squeak
- to:do: => to:by:do: with extra arguments
- ifNil:ifNotNil: => ifTrue:ifFalse:
- fix arguments in TMethods
- fix comments in TMethods
- add name at the level of TParseNode (#name is not defined in Object anymore in Pharo)

Other
- Added FileDirectory compatibility layer using FileSystem behind the scenes (see FileDirectory and VMMakerFile classes).
- Added PackageOrganizer compatibility layer using RPackage behind the scenes.
- Extending Scanner and SystemNavigation with compatibility methods
- Extending Time with compatibility method

==== Patch 3 - Tests ====
Name: VMMakerTests-GuillermoPolito.1
Author: GuillermoPolito
Time: 7 May 2019, 11:27:14.195596 am
UUID: 77f9288f-aa44-0d00-873a-d0970059f8ce
Ancestors: 

Tests for AST translation and C code generation
Reply | Threaded
Open this post in threaded view
|

Re: Some more effort to make Slang and VMMaker work on Pharo [for review]

Eliot Miranda-2
 
Hi Guile,

On Tue, May 7, 2019 at 2:28 AM Guillermo Polito <[hidden email]> wrote:
 
Hi all,

In the last couple of days I've worked a bit on making VMMaker work in Pharo again, based on the original effort of Eliot. I've produced a couple of patches that I've left in the VMMaker inbox (below I past the commits' info).

With these changes I was able to generate, compile and run successfully so far the Stack VM on OSX (mojave). I've tried it with opensmalltalk-vm's platform code commit a838346b1, which is a commit previous to the migration to Metal.

To make this work I've written some tests too. I've packaged them so far in a separate package (VMMaker-Tests). I've seen that currently VMMaker tests are inside the VMMaker package itself, but some of them are red in Pharo. I can move those tests to the VMMaker package itself if people see a value on them.

In any case, I'm just submitting this for review :).

Cheers,
Guille


In VMMaker.oscog-GAP.2533 I would prefer to see printString instead of asString.  asString is a horrible hack.  printString says what we mean.

==== Patch 1 ====
Name: VMMaker.oscog-GAP.2533
Author: GAP
Time: 7 May 2019, 10:57:16.034354 am
UUID: 3209319f-60f3-4586-8d03-cfac3c9fddee
Ancestors: VMMaker.oscog-eem.2532

Convert numeric constants to strings for concatenation.
Required for Pharo compatibility, where the arguments of concatenation are not automatically coerced to strings.

I trust you on these.  I'm not really in a position to test this out right now.  I suggest you push the  VMMakerCompatibilityForPharo6 packages to VMMaker as soon as you'd like.  You can write VMMaker right?


==== Patch 2 - Pharo specific package ====
Name: VMMakerCompatibilityForPharo6-GuillermoPolito.10
Author: GuillermoPolito
Time: 7 May 2019, 11:03:08.229705 am
UUID: 4f49f938-aa44-0d00-8739-04000059f8ce
Ancestors: VMMakerCompatibilityForPharo6-eem.9

Fixes in AST translation to make it work as in Squeak
- to:do: => to:by:do: with extra arguments
- ifNil:ifNotNil: => ifTrue:ifFalse:
- fix arguments in TMethods
- fix comments in TMethods
- add name at the level of TParseNode (#name is not defined in Object anymore in Pharo)

Other
- Added FileDirectory compatibility layer using FileSystem behind the scenes (see FileDirectory and VMMakerFile classes).
- Added PackageOrganizer compatibility layer using RPackage behind the scenes.
- Extending Scanner and SystemNavigation with compatibility methods
- Extending Time with compatibility method

==== Patch 3 - Tests ====
Name: VMMakerTests-GuillermoPolito.1
Author: GuillermoPolito
Time: 7 May 2019, 11:27:14.195596 am
UUID: 77f9288f-aa44-0d00-873a-d0970059f8ce
Ancestors: 

Tests for AST translation and C code generation


--
_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: Some more effort to make Slang and VMMaker work on Pharo [for review]

Steve Thomas
In reply to this post by Guillermo Polito
 


On Tue, May 7, 2019 at 5:28 AM Guillermo Polito <[hidden email]> wrote:
 
Hi all,

In the last couple of days I've worked a bit on making VMMaker work in Pharo again, based on the original effort of Eliot. I've produced a couple of patches that I've left in the VMMaker inbox (below I past the commits' info).

With these changes I was able to generate, compile and run successfully so far the Stack VM on OSX (mojave). I've tried it with opensmalltalk-vm's platform code commit a838346b1, which is a commit previous to the migration to Metal.

To make this work I've written some tests too. I've packaged them so far in a separate package (VMMaker-Tests). I've seen that currently VMMaker tests are inside the VMMaker package itself, but some of them are red in Pharo. I can move those tests to the VMMaker package itself if people see a value on them.

In any case, I'm just submitting this for review :).

Cheers,
Guille

==== Patch 1 ====
Name: VMMaker.oscog-GAP.2533
Author: GAP
Time: 7 May 2019, 10:57:16.034354 am
UUID: 3209319f-60f3-4586-8d03-cfac3c9fddee
Ancestors: VMMaker.oscog-eem.2532

Convert numeric constants to strings for concatenation.
Required for Pharo compatibility, where the arguments of concatenation are not automatically coerced to strings.

==== Patch 2 - Pharo specific package ====
Name: VMMakerCompatibilityForPharo6-GuillermoPolito.10
Author: GuillermoPolito
Time: 7 May 2019, 11:03:08.229705 am
UUID: 4f49f938-aa44-0d00-8739-04000059f8ce
Ancestors: VMMakerCompatibilityForPharo6-eem.9

Fixes in AST translation to make it work as in Squeak
- to:do: => to:by:do: with extra arguments
- ifNil:ifNotNil: => ifTrue:ifFalse:
- fix arguments in TMethods
- fix comments in TMethods
- add name at the level of TParseNode (#name is not defined in Object anymore in Pharo)

Other
- Added FileDirectory compatibility layer using FileSystem behind the scenes (see FileDirectory and VMMakerFile classes).
- Added PackageOrganizer compatibility layer using RPackage behind the scenes.
- Extending Scanner and SystemNavigation with compatibility methods
- Extending Time with compatibility method

==== Patch 3 - Tests ====
Name: VMMakerTests-GuillermoPolito.1
Author: GuillermoPolito
Time: 7 May 2019, 11:27:14.195596 am
UUID: 77f9288f-aa44-0d00-873a-d0970059f8ce
Ancestors: 

Tests for AST translation and C code generation
--

To some of us, writing computer programs is a fascinating game. A program is a building of thought. It is costless to build, weightless, growing easily under our typing hands. If we get carried away, its size and complexity will grow out of control, confusing even the one who created it. This is the main problem of programming. It is why so much of today's software tends to crash, fail, screw up.

When a program works, it is beautiful. The art of programming is the skill of controlling complexity. The great program is subdued, made simple in its complexity.

- Martin Harverbeke (from Eloquent JavaScript)

Reply | Threaded
Open this post in threaded view
|

Re: Some more effort to make Slang and VMMaker work on Pharo [for review]

David T. Lewis
In reply to this post by Eliot Miranda-2
 
Hi Guille,

On Tue, May 07, 2019 at 03:36:32PM -0700, Eliot Miranda wrote:

>  
> Hi Guile,
>
> On Tue, May 7, 2019 at 2:28 AM Guillermo Polito <[hidden email]>
> wrote:
>
> >
> > Hi all,
> >
> > In the last couple of days I've worked a bit on making VMMaker work in
> > Pharo again, based on the original effort of Eliot. I've produced a couple
> > of patches that I've left in the VMMaker inbox (below I past the commits'
> > info).
> >
> > With these changes I was able to generate, compile and run successfully so
> > far the Stack VM on OSX (mojave). I've tried it with opensmalltalk-vm's
> > platform code commit a838346b1, which is a commit previous to the migration
> > to Metal.
> >
> > To make this work I've written some tests too. I've packaged them so far
> > in a separate package (VMMaker-Tests). I've seen that currently VMMaker
> > tests are inside the VMMaker package itself, but some of them are red in
> > Pharo. I can move those tests to the VMMaker package itself if people see a
> > value on them.
> >
> > In any case, I'm just submitting this for review :).

Thank you for doing this :-)


> >
> > Cheers,
> > Guille
> >
> >
> In VMMaker.oscog-GAP.2533 I would prefer to see printString instead of
> asString.  asString is a horrible hack.  printString says what we mean.
>
> ==== Patch 1 ====
> > Name: VMMaker.oscog-GAP.2533
> > Author: GAP
> > Time: 7 May 2019, 10:57:16.034354 am
> > UUID: 3209319f-60f3-4586-8d03-cfac3c9fddee
> > Ancestors: VMMaker.oscog-eem.2532
> >
> > Convert numeric constants to strings for concatenation.
> > Required for Pharo compatibility, where the arguments of concatenation are
> > not automatically coerced to strings.
> >
>
> I trust you on these.  I'm not really in a position to test this out right
> now.  I suggest you push the  VMMakerCompatibilityForPharo6 packages to
> VMMaker as soon as you'd like.  You can write VMMaker right?
>

+1

Guille, if you want commit access to the repo, you can make an account
on source.squeak.org and I'll add you the the VMMaker project. Or if
it's easier, just say which packages you are ready to move and either
I or Eliot (or any of the others with commit access) will move it to
VMMaker for you.

I note that VMMaker.oscog-GAP.2533 package is part of the main
VMMaker.oscog package. If you need to have that tested on Squeak I
can probably do that for you within the next couple of days if no
one else gets to it first.

Thank you!

Dave

Reply | Threaded
Open this post in threaded view
|

Re: Some more effort to make Slang and VMMaker work on Pharo [for review]

Guillermo Polito
 
Hi all,

On Wed, May 8, 2019 at 2:17 AM David T. Lewis <[hidden email]> wrote:
 

On Tue, May 07, 2019 at 03:36:32PM -0700, Eliot Miranda wrote:

> In VMMaker.oscog-GAP.2533 I would prefer to see printString instead of
> asString.  asString is a horrible hack.  printString says what we mean.

Sure. I've submitted another version to the inbox:

Name: VMMaker.oscog-GAP.2534
Author: GAP
Time: 9 May 2019, 5:12:22.055089 pm
UUID: cd6aae16-6f20-4ddb-9328-64b19b413cb1
Ancestors: VMMaker.oscog-eem.2532

Convert numeric constants to strings for concatenation using #printString.
Required for Pharo compatibility, where the arguments of concatenation are not automatically coerced to strings.
 
> ==== Patch 1 ====
> > Name: VMMaker.oscog-GAP.2533
> > Author: GAP
> > Time: 7 May 2019, 10:57:16.034354 am
> > UUID: 3209319f-60f3-4586-8d03-cfac3c9fddee
> > Ancestors: VMMaker.oscog-eem.2532
> >
> > Convert numeric constants to strings for concatenation.
> > Required for Pharo compatibility, where the arguments of concatenation are
> > not automatically coerced to strings.
> >
>
> I trust you on these.  I'm not really in a position to test this out right
> now.  I suggest you push the  VMMakerCompatibilityForPharo6 packages to
> VMMaker as soon as you'd like.  You can write VMMaker right?
>

+1

Guille, if you want commit access to the repo, you can make an account
on source.squeak.org and I'll add you the the VMMaker project. Or if
it's easier, just say which packages you are ready to move and either
I or Eliot (or any of the others with commit access) will move it to
VMMaker for you.

I note that VMMaker.oscog-GAP.2533 package is part of the main
VMMaker.oscog package. If you need to have that tested on Squeak I
can probably do that for you within the next couple of days if no
one else gets to it first.

Well, the change I did in that package was fairly small, and I'm using squeak to generate also some parts of the VM to compare to what I generate from Pharo.
So, I'd say I've tried it myself already.

For the Pharo specific package, I've already uploaded it to the VMMaker repository.
I had already rights to do it :).

Name: VMMakerCompatibilityForPharo6-GuillermoPolito.11
Author: GuillermoPolito
Time: 9 May 2019, 5:15:50.00473 pm
UUID: e1a685a9-d744-0d00-b3c1-ad600f1a7e9a
Ancestors: VMMakerCompatibilityForPharo6-GuillermoPolito.10

With these changes I can already compile and run Cog and almost all tests pass :)

image.png

I have also a couple dozen tests about AST translation and C generation, mainly about those parts that are covered differently between Pharo's and Squeak's ASTs.
Would you like that I push them inside the VMMaker package or make a separate package?

Thanks!
Guille
Reply | Threaded
Open this post in threaded view
|

Re: Some more effort to make Slang and VMMaker work on Pharo [for review]

Guillermo Polito
 
I've decided for the moment to put the tests in the PharoCompatibility package, since they are too close of Pharo's AST.
I've tried to make them work in squeak but I've found too many incompatibilities in the AST and some in the collections that would make the tests too verbose to make them reusable...
Maybe we can do an iteration afterwards.

Cheers,
Guille

On Thu, May 9, 2019 at 5:21 PM Guillermo Polito <[hidden email]> wrote:
Hi all,

On Wed, May 8, 2019 at 2:17 AM David T. Lewis <[hidden email]> wrote:
 

On Tue, May 07, 2019 at 03:36:32PM -0700, Eliot Miranda wrote:

> In VMMaker.oscog-GAP.2533 I would prefer to see printString instead of
> asString.  asString is a horrible hack.  printString says what we mean.

Sure. I've submitted another version to the inbox:

Name: VMMaker.oscog-GAP.2534
Author: GAP
Time: 9 May 2019, 5:12:22.055089 pm
UUID: cd6aae16-6f20-4ddb-9328-64b19b413cb1
Ancestors: VMMaker.oscog-eem.2532

Convert numeric constants to strings for concatenation using #printString.
Required for Pharo compatibility, where the arguments of concatenation are not automatically coerced to strings.
 
> ==== Patch 1 ====
> > Name: VMMaker.oscog-GAP.2533
> > Author: GAP
> > Time: 7 May 2019, 10:57:16.034354 am
> > UUID: 3209319f-60f3-4586-8d03-cfac3c9fddee
> > Ancestors: VMMaker.oscog-eem.2532
> >
> > Convert numeric constants to strings for concatenation.
> > Required for Pharo compatibility, where the arguments of concatenation are
> > not automatically coerced to strings.
> >
>
> I trust you on these.  I'm not really in a position to test this out right
> now.  I suggest you push the  VMMakerCompatibilityForPharo6 packages to
> VMMaker as soon as you'd like.  You can write VMMaker right?
>

+1

Guille, if you want commit access to the repo, you can make an account
on source.squeak.org and I'll add you the the VMMaker project. Or if
it's easier, just say which packages you are ready to move and either
I or Eliot (or any of the others with commit access) will move it to
VMMaker for you.

I note that VMMaker.oscog-GAP.2533 package is part of the main
VMMaker.oscog package. If you need to have that tested on Squeak I
can probably do that for you within the next couple of days if no
one else gets to it first.

Well, the change I did in that package was fairly small, and I'm using squeak to generate also some parts of the VM to compare to what I generate from Pharo.
So, I'd say I've tried it myself already.

For the Pharo specific package, I've already uploaded it to the VMMaker repository.
I had already rights to do it :).

Name: VMMakerCompatibilityForPharo6-GuillermoPolito.11
Author: GuillermoPolito
Time: 9 May 2019, 5:15:50.00473 pm
UUID: e1a685a9-d744-0d00-b3c1-ad600f1a7e9a
Ancestors: VMMakerCompatibilityForPharo6-GuillermoPolito.10

With these changes I can already compile and run Cog and almost all tests pass :)

image.png

I have also a couple dozen tests about AST translation and C generation, mainly about those parts that are covered differently between Pharo's and Squeak's ASTs.
Would you like that I push them inside the VMMaker package or make a separate package?

Thanks!
Guille


--

   

Guille Polito

Research Engineer

Centre de Recherche en Informatique, Signal et Automatique de Lille

CRIStAL - UMR 9189

French National Center for Scientific Research - http://www.cnrs.fr


Web: http://guillep.github.io

Phone: +33 06 52 70 66 13