[Vm-dev] [Cog] Problems with generating code (initialization of options)

Igor Stasenko siguctua at gmail.com
Wed Jun 29 13:42:11 UTC 2011

There are a bit mess with newly introduced generation options.

Here the problem:

	"Translate the Smalltalk description of the virtual machine into C.
If 'self doInlining' is true, small method bodies are inlined to
reduce procedure call overhead.  On the PPC, this results in a factor
of three speedup with only 30% increase in code size.  Subclasses can
use specialised versions of CCodeGenerator and interpreterClass."

	| cg cogitClass |
	self interpreterClass needsCogit ifFalse: [^nil].
	self needsToRegenerateCogitFile ifFalse: [^nil].
	cg := [self buildCodeGeneratorForCogit]

The options are initialized first in

but before that, in method #needsToRegenerateCogitFile it leads to call in:

	ProcessorClass ifNil: [thisContext methodClass theNonMetaClass initialize].
	^{	CogAbstractInstruction.
		ProcessorClass basicNew abstractInstructionCompilerClass.

here ProcessorClass class var is still nil, because its not yet initialized.
it is initialized only if you send #initializeWithOptions: to cogit class

Best regards,
Igor Stasenko AKA sig.

More information about the Vm-dev mailing list