[Vm-dev] primitive external call

Bert Freudenberg bert at freudenbergs.de
Sat May 31 15:03:09 UTC 2014


On 31.05.2014, at 15:48, Helmut Rohregger <helmut.rohregger at gmail.com> wrote:

> Hi,
> 
> could someone explain me primitive 117? I know the primitive is responsible for loading some kind of modules.

Yes. We got tired of assigning a new number for each new primitive. In addition to indexed primitives the Squeak VM supports "named primitives". And primitive 117 is used to execute those named primitives. The module name and primitive name are stored in the CompiledMethod:

	(Integer>>#bitAnd:) primitive
	==> 117

	(Integer>>#bitAnd:) literalAt: 1
	==> #(#LargeIntegers #primDigitBitAnd 0 25)

So when the VM executes primitive 117 it looks up that literal, loads the module, and executes the named primitive.

> But where do I find these modules.
> For example "Integer>>#bitAnd:" contains "<primitive: 'primDigitBitAnd' module:'LargeIntegers'>", which will load the 'primDigitBitAnd' method of module 'LargeIntegers'. Are these modules some kind of plug-ins outside the squeak image? Can I access these modules and check their implementation?

They are mostly part of the VM. Many are bundled in the regular VMMaker package, but you can also find them elsewhere (e.g. the DBus plugin is at http://squeaksource.com/dbus.html )

The 'LargeIntegers' module is implemented by the class LargeIntegersPlugin in the VMMaker package.

These modules can be linked into the VM executable itself ("built-in modules") or distributed as separate files ("external modules"). In the latter case they are dynamic libraries (DLLs on Windows, *.so files on Linux etc.)

To see which modules are built into your VM:

	Smalltalk listBuiltinModules

To see which external and built-in modules are currently in use:

	Smalltalk listLoadedModules

There is no general way to list unloaded external modules because they are loaded on demand and can be installed in various places.

- Bert -

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4142 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20140531/507f4f99/smime-0001.bin


More information about the Vm-dev mailing list