[Vm-dev] Jitted methods cache primitive failures?

David T. Lewis lewis at mail.msen.com
Sun May 1 23:21:52 UTC 2016


On Mon, May 02, 2016 at 12:44:58AM +0200, Levente Uzonyi wrote:
> 
> Hi All,
> 
> If you try to use a method with a primitive, and that primitive fails for 
> the first time for some reason (e.g. the plugin can't be loaded), then 
> subsequent sends of the same method will always fail, even if they would 
> work normally. The workaround I found was recompiling the method.
> To reproduce:
> 1. Open a Squeak Trunk image with a working SqueakSSL plugin.
> 2. Rename the plugin to SqueakSSL_.
> 3. Evaluate [SqueakSSL new]. Its primitive should fail.
> 4. Close the debugger and rename the plugin to SqueakSSL.
> 5. Try [SqueakSSL new] again. It's primitive should fail again, despite 
> the fact that the plugin is at its place.

This is a good thing. If the VM cannot load the plugin the first time it tries,
then it should not try again. Loading the plugin on first reference is fairly
expensive, so you would not want to try it again every time you call the
primitive. It works this way on the interpreter VM too.

However, if a primitive fails for some other reason, such as failing a parameter
check, that failure should not affect the next call to the primitive. If that
is what is happening, then maybe we have a bug.

> 6. Evaluate [SqueakSSL compileAll] and then [SqueakSSL new]. This time it 
> should work.
>

I did not check, but this may be part of the existing mechanism.

Dave



More information about the Vm-dev mailing list