[squeak-dev] [NativeBoost] new win32 build available

Igor Stasenko siguctua at gmail.com
Thu Apr 29 08:41:31 UTC 2010


Hello,

i just uploaded a new VM, i built tonight and new NativeBoost code.
VM is built from latest SVN + VMMaker + NativeBoostPlugin sources, and
now NativeBoost can use all latest additions to interpreterProxy
function table,
such as addGCRoot, stackPointer etc.

And there's already a code which using that, named NBExternalTypeRegistry.
It serves as a dictionary of  name->object values, where you can
register any object under given name
and then use it in native code (during native code generation).

This is analoguous to what SpecialObjectArray serving for, where you
can put an object and then use that object in primitives
through well-known index.
But in contrast to SpecialObjectArray, a NBExternalTypeRegistry
doesn't requires from you to use indexes. You can use just names!
Also, it doesn't requires from you to statically assign or initialize
the same set of name/value pairs at each image startup.

All what you need is just register an object first:

NBExternalTypeRegistry current at: #MyName put: #(10 12 13)

and then, in your assembler, emit code to load it:

NBExternalTypeRegistry current emitOopAt: #MyName generator: gen


When your restarting a VM, it makes sure that this registry are
initially clean.
So, it is get refilled only when some new native methods is generated
which are using registry to fetch some named object(s).

The most often use of named objects is, of course, instantiating the
objects of specific class, like:

self typeRegistry emitFetchClass: objectClass generator: gen.
proxy instantiateClass: asm EAX indexableSize: 0.

Or, checking that argument is of correct type.
Here, the method which generates a code to verify that argument class
(held in oop) will be an objectClass:

validateClassOf: oop generator: gen

	| asm class |
	asm := gen asm.
	class := gen reserveTemp.
	
	gen proxy fetchClassOf: oop.
	asm mov:  asm EAX to: class.
	
	self typeRegistry emitFetchClass: objectClass generator: gen.
	
	asm cmp: asm EAX with: class;
		jne: gen failedLabel.
	
	gen releaseTemps: 1.


-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list