What is "Primitives"?

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

What is "Primitives"?

Nicolai Hess
Looking at the code for DiskStore>>basicEntryAt:
I find this code:
"Primitives lookupDirectory: encodedPath filename: encodedBasename)"
What is this "Primitives" not a class? I am suprised there is some code
that I can not find the source for.

Ok, it has something to do with vm primitives, and I know that code like
<primitive: 'primitiveDirectoryEntry' module: 'FilePlugin'>
is in the vmmaker-package for FilePlugin.

BTW it is terrible hard to load vmmaker in a "normal" image. Now I use
the generator.image from pharo http://files.pharo.org/vm/src/.
But even in this image it is not possible to load the vmmaker tool.


Reply | Threaded
Open this post in threaded view
|

Re: What is "Primitives"?

Clément Béra
Well use the generator image you can find on the pharo repo, it is hard to build such an image by hand.

This code:
Primitives lookupDirectory: encodedPath filename: encodedBasename
Should be:
FilePluginPrims  lookupDirectory: encodedPath filename: encodedBasename

Now I don't why this was not correct (File management is pure magic to me).

I would recommend you to post question about VMMaker not in this mailing list, because few people can answer here, but instead in the pharo-dev mailing list OR Squeak-vm-dev.

Have fun with VMMaker




2013/11/29 Nicolai Hess <[hidden email]>
Looking at the code for DiskStore>>basicEntryAt:
I find this code:
"Primitives lookupDirectory: encodedPath filename: encodedBasename)"
What is this "Primitives" not a class? I am suprised there is some code
that I can not find the source for.

Ok, it has something to do with vm primitives, and I know that code like
<primitive: 'primitiveDirectoryEntry' module: 'FilePlugin'>
is in the vmmaker-package for FilePlugin.

BTW it is terrible hard to load vmmaker in a "normal" image. Now I use
the generator.image from pharo http://files.pharo.org/vm/src/.
But even in this image it is not possible to load the vmmaker tool.



Reply | Threaded
Open this post in threaded view
|

Re: What is "Primitives"?

philippeback
In reply to this post by Nicolai Hess
Hi Nicolai,

Question1

The Primitives you mention is a class variable.
Put your cursor on it and hit the blue "C" button on the right of the Nautilus code pane to see where it is used.

You'll notice that it is initialized in DiskStore class>>useFilePlugin

useFilePlugin
    Primitives := FilePluginPrims new

FilePluginPrims in turn provides an interface to the real file plugin.

e.g.
FilePluginPrims >> size: id
    "Answer the size of this file."

    <primitive: 'primitiveFileSize' module: 'FilePlugin'>
    self primitiveFailed

So, class variables are WrittenLikeThis and you may thing that it is a class. But it is either a class variable or a global (e.g. Display, Transcript)

In a workspace, try: Display class <printIt> Transcript class <printIt>

You'll see the real classes.

When using spotlight for example, you'll never find anything if you type Display for example. Even if the completion will propose something to you (hey, someone fixing this?)




Question2

If you want to load VMMaker, you have to do it from the GitHub directions.

There is a step where you do:
cd image && ./newImage.sh
and it loads all you need and you end up with the generator image.

I've been using it in my fork https://github.com/philippeback/pharo-vm
Follow the directions of the README.md and you'll be ready with ease.
If you use OSX, it is working very smoothly.
Windows will require some more fiddling but there is nothing stopping you.

The generator already has VMMaker in.

Now, please bear in mind that the PharoVM isn't the same VM as Squeak uses, so, the process is not with the Morphic based VMMaker tool (green thing) where you select plugins etc.

Here, you are going to use the PharoVMBuilder which does all of the automation.
./pharo generator.image eval 'PharoVMBuilder buildWin32'
will generate all CMake files, all Slang based files etc.

I plan to do a video of all the steps very soon. This will help.

Now, the VMSimulator isn't fully operational in the PharoVM, I am working on getting it right.
At this point, it executes bytecodes without problems, but we need to port some more code to the new transcript, filesystem etc.
Just a question of doing it. I am looking at that, hopefully  this will work in december.


Hope this clarifies the situation for you.

Enjoy,
Phil



---
Philippe Back
Dramatic Performance Improvements
Mob: +32(0) 478 650 140 | Fax: +32 (0) 70 408 027
Blog: http://philippeback.be | Twitter: @philippeback

High Octane SPRL
rue cour Boisacq 101 | 1301 Bierges | Belgium

Pharo Consortium Member - http://consortium.pharo.org/
Featured on the Software Process and Measurement Cast - http://spamcast.libsyn.com
Sparx Systems Enterprise Architect and Ability Engineering EADocX Value Added Reseller
 



On Fri, Nov 29, 2013 at 10:55 AM, Nicolai Hess <[hidden email]> wrote:
Looking at the code for DiskStore>>basicEntryAt:
I find this code:
"Primitives lookupDirectory: encodedPath filename: encodedBasename)"
What is this "Primitives" not a class? I am suprised there is some code
that I can not find the source for.

Ok, it has something to do with vm primitives, and I know that code like
<primitive: 'primitiveDirectoryEntry' module: 'FilePlugin'>
is in the vmmaker-package for FilePlugin.

BTW it is terrible hard to load vmmaker in a "normal" image. Now I use
the generator.image from pharo http://files.pharo.org/vm/src/.
But even in this image it is not possible to load the vmmaker tool.



Reply | Threaded
Open this post in threaded view
|

Re: What is "Primitives"?

nacho
In reply to this post by Nicolai Hess
Hi Nicolai,
A very good source is Mariano Martinez Peck's excellent blog. He posted extensively on building a VM, managing plugins, pretty cover all aspects.
If you want to take a look, his journey begins here: http://marianopeck.wordpress.com/2011/03/31/journey-through-the-vm/

I found it really good and enlightener.
best
Nacho


Lic. Ignacio Sniechowski, MBA







On Fri, Nov 29, 2013 at 6:55 AM, Nicolai Hess <[hidden email]> wrote:
Looking at the code for DiskStore>>basicEntryAt:
I find this code:
"Primitives lookupDirectory: encodedPath filename: encodedBasename)"
What is this "Primitives" not a class? I am suprised there is some code
that I can not find the source for.

Ok, it has something to do with vm primitives, and I know that code like
<primitive: 'primitiveDirectoryEntry' module: 'FilePlugin'>
is in the vmmaker-package for FilePlugin.

BTW it is terrible hard to load vmmaker in a "normal" image. Now I use
the generator.image from pharo http://files.pharo.org/vm/src/.
But even in this image it is not possible to load the vmmaker tool.



Nacho Smalltalker apprentice. Buenos Aires, Argentina.
Reply | Threaded
Open this post in threaded view
|

Re: What is "Primitives"?

Nicolai Hess
In reply to this post by philippeback
Thank you. I thought the pharo vmbuilder way is only for cog-vms, and the traditional way
for the interpreter vm would still work.
There is a vmmaker chapter at
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool






2013/11/29 [hidden email] <[hidden email]>
Hi Nicolai,

Question1

The Primitives you mention is a class variable.
Put your cursor on it and hit the blue "C" button on the right of the Nautilus code pane to see where it is used.

You'll notice that it is initialized in DiskStore class>>useFilePlugin

useFilePlugin
    Primitives := FilePluginPrims new

FilePluginPrims in turn provides an interface to the real file plugin.

e.g.
FilePluginPrims >> size: id
    "Answer the size of this file."

    <primitive: 'primitiveFileSize' module: 'FilePlugin'>
    self primitiveFailed

So, class variables are WrittenLikeThis and you may thing that it is a class. But it is either a class variable or a global (e.g. Display, Transcript)

In a workspace, try: Display class <printIt> Transcript class <printIt>

You'll see the real classes.

When using spotlight for example, you'll never find anything if you type Display for example. Even if the completion will propose something to you (hey, someone fixing this?)




Question2

If you want to load VMMaker, you have to do it from the GitHub directions.

There is a step where you do:
cd image && ./newImage.sh
and it loads all you need and you end up with the generator image.

I've been using it in my fork https://github.com/philippeback/pharo-vm
Follow the directions of the README.md and you'll be ready with ease.
If you use OSX, it is working very smoothly.
Windows will require some more fiddling but there is nothing stopping you.

The generator already has VMMaker in.

Now, please bear in mind that the PharoVM isn't the same VM as Squeak uses, so, the process is not with the Morphic based VMMaker tool (green thing) where you select plugins etc.

Here, you are going to use the PharoVMBuilder which does all of the automation.
./pharo generator.image eval 'PharoVMBuilder buildWin32'
will generate all CMake files, all Slang based files etc.

I plan to do a video of all the steps very soon. This will help.

Now, the VMSimulator isn't fully operational in the PharoVM, I am working on getting it right.
At this point, it executes bytecodes without problems, but we need to port some more code to the new transcript, filesystem etc.
Just a question of doing it. I am looking at that, hopefully  this will work in december.


Hope this clarifies the situation for you.

Enjoy,
Phil



---
Philippe Back
Dramatic Performance Improvements
Mob: <a href="tel:%2B32%280%29%20478%20650%20140" value="+32478650140" target="_blank">+32(0) 478 650 140 | Fax: <a href="tel:%2B32%20%280%29%2070%20408%20027" value="+3270408027" target="_blank">+32 (0) 70 408 027
Blog: http://philippeback.be | Twitter: @philippeback

High Octane SPRL
rue cour Boisacq 101 | 1301 Bierges | Belgium

Pharo Consortium Member - http://consortium.pharo.org/
Featured on the Software Process and Measurement Cast - http://spamcast.libsyn.com
Sparx Systems Enterprise Architect and Ability Engineering EADocX Value Added Reseller
 



On Fri, Nov 29, 2013 at 10:55 AM, Nicolai Hess <[hidden email]> wrote:
Looking at the code for DiskStore>>basicEntryAt:
I find this code:
"Primitives lookupDirectory: encodedPath filename: encodedBasename)"
What is this "Primitives" not a class? I am suprised there is some code
that I can not find the source for.

Ok, it has something to do with vm primitives, and I know that code like
<primitive: 'primitiveDirectoryEntry' module: 'FilePlugin'>
is in the vmmaker-package for FilePlugin.

BTW it is terrible hard to load vmmaker in a "normal" image. Now I use
the generator.image from pharo http://files.pharo.org/vm/src/.
But even in this image it is not possible to load the vmmaker tool.




Reply | Threaded
Open this post in threaded view
|

Re: What is "Primitives"?

Nicolai Hess
In reply to this post by nacho
Thank you.
It is not about how to build a vm.
I do have some experience on this (mostly squeak vm).
But I find it rather difficult to follow the current active way on doing so.
In Mariano blogs he is using vmmaker tool as well.
It just didn't work for pharo anymore.
For example, you can load vmmaker packages. (really difficult on with
a normal image (you need all kind of dependent packages), or you
can use the generator.image from pharo.src.
But
VMMakerTool openInWorld
fails.
I don't know
- why,
- if it is supposed to do so,
- or how other people working with vm source.

regards
nicolai



2013/11/29 Ignacio Matías Sniechowski <[hidden email]>
Hi Nicolai,
A very good source is Mariano Martinez Peck's excellent blog. He posted extensively on building a VM, managing plugins, pretty cover all aspects.
If you want to take a look, his journey begins here: http://marianopeck.wordpress.com/2011/03/31/journey-through-the-vm/

I found it really good and enlightener.
best
Nacho


Lic. Ignacio Sniechowski, MBA







On Fri, Nov 29, 2013 at 6:55 AM, Nicolai Hess <[hidden email]> wrote:
Looking at the code for DiskStore>>basicEntryAt:
I find this code:
"Primitives lookupDirectory: encodedPath filename: encodedBasename)"
What is this "Primitives" not a class? I am suprised there is some code
that I can not find the source for.

Ok, it has something to do with vm primitives, and I know that code like
<primitive: 'primitiveDirectoryEntry' module: 'FilePlugin'>
is in the vmmaker-package for FilePlugin.

BTW it is terrible hard to load vmmaker in a "normal" image. Now I use
the generator.image from pharo http://files.pharo.org/vm/src/.
But even in this image it is not possible to load the vmmaker tool.




Reply | Threaded
Open this post in threaded view
|

Re: What is "Primitives"?

philippeback
There is no VMMaker UI tool anymore for the PharoVM.

For continuous integration, it sucks anyway.

So, you have the VMBuilders and CMake related classes.

I like that better.

There are options in each build method for specifying which plugins are to be used. e.g. do not use the ObjectiveC bridge in Windows...

Phil 

---
Philippe Back
Dramatic Performance Improvements
Mob: +32(0) 478 650 140 | Fax: +32 (0) 70 408 027
Blog: http://philippeback.be | Twitter: @philippeback

High Octane SPRL
rue cour Boisacq 101 | 1301 Bierges | Belgium

Pharo Consortium Member - http://consortium.pharo.org/
Featured on the Software Process and Measurement Cast - http://spamcast.libsyn.com
Sparx Systems Enterprise Architect and Ability Engineering EADocX Value Added Reseller
 



On Fri, Nov 29, 2013 at 2:32 PM, Nicolai Hess <[hidden email]> wrote:
Thank you.
It is not about how to build a vm.
I do have some experience on this (mostly squeak vm).
But I find it rather difficult to follow the current active way on doing so.
In Mariano blogs he is using vmmaker tool as well.
It just didn't work for pharo anymore.
For example, you can load vmmaker packages. (really difficult on with
a normal image (you need all kind of dependent packages), or you
can use the generator.image from pharo.src.
But
VMMakerTool openInWorld
fails.
I don't know
- why,
- if it is supposed to do so,
- or how other people working with vm source.

regards
nicolai



2013/11/29 Ignacio Matías Sniechowski <[hidden email]>
Hi Nicolai,
A very good source is Mariano Martinez Peck's excellent blog. He posted extensively on building a VM, managing plugins, pretty cover all aspects.
If you want to take a look, his journey begins here: http://marianopeck.wordpress.com/2011/03/31/journey-through-the-vm/

I found it really good and enlightener.
best
Nacho


Lic. Ignacio Sniechowski, MBA







On Fri, Nov 29, 2013 at 6:55 AM, Nicolai Hess <[hidden email]> wrote:
Looking at the code for DiskStore>>basicEntryAt:
I find this code:
"Primitives lookupDirectory: encodedPath filename: encodedBasename)"
What is this "Primitives" not a class? I am suprised there is some code
that I can not find the source for.

Ok, it has something to do with vm primitives, and I know that code like
<primitive: 'primitiveDirectoryEntry' module: 'FilePlugin'>
is in the vmmaker-package for FilePlugin.

BTW it is terrible hard to load vmmaker in a "normal" image. Now I use
the generator.image from pharo http://files.pharo.org/vm/src/.
But even in this image it is not possible to load the vmmaker tool.