"Behavior new new bla" crashes the VM

Project:GNU Smalltalk
Component:VM
Category:bug
Priority:normal
Assigned:Unassigned
Status:invalid
Description

It is crashing the VM because the object does not even understand doesNotUnderstand. This means that one should check for either recursion or if one attempted to send the method.

diff --git a/libgst/interp-bc.inl b/libgst/interp-bc.inl
index 8819481..5085377 100644
--- a/libgst/interp-bc.inl

+++ b/libgst/interp-bc.inl

@@ -201,8 +201,9 @@ _gst_send_message_internal (OOP sendSelector,

      /* :-( cache miss )-: */
      if (!lookup_method (sendSelector, methodData, sendArgs, method_class))
       {

- _gst_send_message_internal (_gst_does_not_understand_symbol, 1,
- receiver, method_class);

+ if ( sendSelector != _gst_does_not_understand_symbol)

+ _gst_send_message_internal (_gst_does_not_understand_symbol, 1,

+ receiver, method_class);

         return;
       }

Updates

#1 submitted by Gwenael Casaccio on Wed, 09/05/2012 - 20:08

Instead of changing the vm lookup, why not adding a simple initialize pattern,
method dictionary (and dnu) is a kind of contract between the image and the vm.
It is up to you to provide a good behavior (otherwhise the superclass could
be an integer, or a loop in the between the superclasses, the instance specification an object,
...).

You could also create a simple BehaviorBuilder: https://github.com/MrGwen/gst-classbuilder/blob/master/Builder/BehaviorB... (for instance)

#2 submitted by Paolo Bonzini on Thu, 09/06/2012 - 07:37
Status:active» invalid

Gwen is right. This is not really a bug, though it is indeed a bit fragile.

User login