Organizing VM sources, CCodeGenerator: suggestions and questions

Stephan Rudlof sr at evolgo.de
Thu Dec 23 19:21:29 UTC 1999


Dear Andrew, dear Squeakers!

I want to make a few suggestions regarding organizing C sources and
compiling plugins.

I'v run into following problem:

Compiling the user defined plugin method

isBytes: oop 
	^ (interpreterProxy isIntegerObject: oop) not and: [interpreterProxy
isBytes: oop]

has led to

int isBytes(int oop) {
        return (!((oop & 1))) && (interpreterProxy->isBytes(oop));
}

.. Compiling works only without inlining, otherwise it runs into an
infinite recursion.
The plugin runs in simulation, but in calling this function in C crashes
the VM.

The problem here is that this function interferes with the same
signatured function from 'sqVirtualMachine.c'.

As test I have made it 'static' in the plugin source file, then it works
in C!

###########

This leads me to the following suggestions:

- A compiler warning would be nice, if someone overrides a predefined
function.

- Wouldn't it be good to make all user plugin functions which are not
exported 'static' as default?

- Wouldn't it be better to make 'int isBytes(int oop);' and similar
functions in 'sqVirtualMachine.c' static? For plugins they are called
indirectly by 'interpreterProxy->isBytes(oop)' anyway.

###########

A few questions:

Are there any compatibility reasons - perhaps previously these functions
have been called directly... - not to make this?

Couldn't there arise any compatibility problems between different
plugins in the current situation?


Greetings, Merry Christmas,

Stephan

-- 
Stephan Rudlof (sr at evolgo.de)
   "Genius doesn't work on an assembly line basis.
    You can't simply say, 'Today I will be brilliant.'"
    -- Kirk, "The Ultimate Computer", stardate 4731.3





More information about the Squeak-dev mailing list