VM improvement: speeding up failing calls of functions in missing modules
Marcus Denker
marcus at ira.uka.de
Fri Feb 4 23:02:03 UTC 2000
On Fri, Jan 28, 2000 at 06:58:04PM -0800, Jake Hamby wrote:
> On Fri, 28 Jan 2000, Michael Rueger wrote:
>
> > Most of what you are describing is already realized in SmalltalkX.
> > Have a look at
> > http://www.exept.de/
>
> I keep seeing mentions to Smalltalk/X on this list, especially their
> integrated Smalltalk/Java approach. Thanks for the link: I'll definitely
> have to download it and see what it's capable of.
ST/X is *really* worth a look. It's a very interesting system.
Besides Java it has a very good C integration. You can simply write C-code
in a normal Smalltalk method, e.g. (from the documentation):
myMethodReturningOne
%{
/* return a SmallInteger */
RETURN ( __MKSMALLINT(1) );
%}
or:
mySpecialTrigMethod:arg
%{
if (__isFloat(arg)) {
/* compute a Float */
double fVal = __floatVal(arg);
RETURN ( __MKFLOAT(sin(exp(fVal) * 1.2345)) );
}
%}
it is even possible to mix Smalltalk and C:
anotherMethodReturningOne
|retVal|
%{
/* return a SmallInteger */
retVal = __MKSMALLINT(1);
%}.
^ retVal
When such a method is accepted, the Browser automagically calls the
Smalltalk-to-C translator, the C-compiler and the linker. Then the DLL is
loaded into the VM. This whole procedure does not take much longer than
accepting a Smalltalk method. Wow!
ST/X doesn't have primitives. In Squeak, ProtoObject>>== looks like this:
== anObject
<primitive: 110>
self primitiveFailed
ST/X:
== anObject
%{ /* NOCONTEXT */
RETURN ( (self == anObject) ? true : false );
%}
Changing a primitive in Squeak requires a recompilation of the whole
VM, in ST/X you change it, accept, and that's it. (#== is a bad example,
it's compiled inline in both systems).
Marcus
--
Marcus Denker marcus at ira.uka.de phone at home:(0721)614235 @work:(0721)608-2749
More information about the Squeak-dev
mailing list
|