[ENH][FIX][BETA] VM improvement: speeding up failing calls of functions in missing modules

Stephan Rudlof sr at evolgo.de
Tue Feb 8 02:15:44 UTC 2000


Dear VM-Hackers,

this changeset speeds up *failing* of external primitives whose module
is *missing* dramatically.
This is necessary for seamlessly integration of plugins like ordinary
optional - numbered - VM primitives. 

With this changeset there is only a small speed penalty for calling a
missing plugin primitive, if a plugin module cannot be reached for
whatever reason, compared to calling an optional not existing numbered
VM primitive.

It is marked [BETA] because it has to be tested
- very intensively and
- on different platforms (I'm working on Linux).

It replaces and improves the previously posted changesets
	VM_speedUpCallsOfMissingModules.8.cs,
	SystemDictionary-clearMissingModuleCache.st and
	Test.st
. They are not compatible: don't update with this changeset, take a
fresh image!

I have changed some things:
- dynamically growing history of missing modules (no fixed sized ring
buffer anymore) -> big code changes!;
- 3 less methods in Interpreter (smaller VM), 1 more in
SystemDictionary;
- history cleared at startup in SystemDictionary>>snapshot:andQuit: now
(similar to externalObjects);
- improved postscript.


Greetings,

Stephan


"Change Set:		VM_speedUpCallsOfMissingModules
Date:			8 February 2000
Author:			Stephan Rudlof

This changeset speeds up *failing* of external primitives whose module
is *missing* dramatically.
This is necessary for seamlessly integration of plugin primitives like
ordinary optional - numbered - VM primitives. 

Now there is only a small speed penalty for calling a missing plugin
primitive, if a plugin module cannot be reached for whatever reason,
compared to calling an optional not existing numbered VM primitive.

More exactly: If loading a function from an external module fails, a
check is made if this module exists at all: If not, then there won't be
another trial of loading functions from this module during the current
session (unless the missing module cache will be cleared manually).

*** This changeset is not for beginners! ***
	You have to recompile the VM (using regenerated 'interp.c') to generate
a new squeak executable.

*** Please make a backup ***
	of your *.image and *.changes files, *before* you apply this changeset
and *before* you play with the new VM!

*** You have been warned! ***

Note: If you install a module *while* Squeak is running you should call
SystemDictionary>>clearMissingModuleCache by evaluating
	Smalltalk clearMissingModuleCache
to ensure that it will be loaded!


Idea:

Much time has been spent in
ioLoadExternalFunction:OfLength:FromModule:OfLength: which is called in
Interpreter>>primitiveExternalCall. This change set introduces a history
of missed modules (dynamically growing) to avoid calling this function,
if the corresponding module has been missed in a previous call.
Checking if a module exists works by trying to load the 'setInterpreter'
function pointer, which should be there in every external module:
otherwise there is a problem!


Implementation:

The history of missing modules is implemented as dynamically growing
array which will be searched backwards (look for last added first) while
checking for a possibly missing module. The index of the last missed
module found or stored in history is stored, too: this is to have a
shortcut if functions in the same missing module will be called
frequently after each other. At startup (resuming) of Squeak the history
will be cleared.
"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VM_speedUpCallsOfMissingModules.13.cs
Type: application/octet-stream
Size: 20966 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20000208/4ccfaeb2/VM_speedUpCallsOfMissingModules.13.obj


More information about the Squeak-dev mailing list