[squeak-dev] VMMaker: Problem with C-code generation

David T. Lewis lewis at mail.msen.com
Thu May 21 11:45:54 UTC 2009


On Thu, May 21, 2009 at 01:28:48PM +0200, Antoine Marot wrote:
> Hi all,
> 
> I am trying to change the method lookup process in the VM but I have  
> some troubles with the code generation.
> 
> I modified #lookupMethodInClass:  in the Interpreter class and I added  
> some methods and some class variables as well.  For now, I do not need  
> to build my extension as an internal or external plugin.
> 
> The generated C-code (in interp.c) includes my modified version of  
> #lookupMethodInClass: (it calls my own methods) but those methods do  
> not appear in the source at all (as well as my class variables).
> 
> However, I traced the code generation and my methods seems to treated.
> 
> Any idea of what I am doing wrong ?

There are a couple of possibilities.

If your new method is not referenced anywhere, the C code will not be
generated. You can force the code to be generated by adding it to
a list of required methods in Interpreter class>>requiredMethodNames.

If your method has been fully inlined, it will have been embedded in
the code for other methods and will not appear as a separate function
in the generated C code. If you want to disable this, add the line
"self inline: false" in your method.

You may find it easier to debug things like this if you add SlangBrowser
to your image (http://wiki.squeak.org/squeak/5916>. That will let you
see the code generation for each method in a class browser.

Dave




More information about the Squeak-dev mailing list