Method.st
changeset 77 6c38ca59927f
parent 68 59faa75185ba
child 85 1343af456e28
--- a/Method.st	Thu May 12 04:07:15 1994 +0200
+++ b/Method.st	Tue May 17 12:09:46 1994 +0200
@@ -23,7 +23,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
              All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Method.st,v 1.12 1994-03-30 09:32:56 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Method.st,v 1.13 1994-05-17 10:08:11 claus Exp $
 written spring 89 by claus
 '!
 
@@ -418,6 +418,18 @@
         (aClass containsMethod:self) ifTrue:[^ aClass].
         (aClass class containsMethod:self) ifTrue:[^ aClass class]
     ].
+    "
+     mhmh - must be a method of some anonymous class (i.e. one not
+     in the Smalltalk dictionary; search all instances of Behavior
+    "
+    Behavior allDerivedInstancesDo:[:someClass |
+        (someClass containsMethod:self) ifTrue:[
+            ^ someClass
+        ].
+    ].
+    "
+     none found - sorry
+    "
     ^ nil
 !
 
@@ -529,6 +541,10 @@
        Should ask compiler, if there is really a send."
 
     ^ self referencesGlobal:aSelectorSymbol
+!
+
+isWrapped
+    ^ false
 ! !
 
 !Method methodsFor:'error handling'!
@@ -633,9 +649,9 @@
      expectations -
      - otherwise strange things (and also strange crashes) can occur.
      The system is NOT always detecting a wrong method/receiver combination.
-     BE WARNED."
+     YOU HAVE BEEN WARNED."
 
-    ^ self valueWithReceiver:anObject arguments:argArray selector:nil
+    ^ self valueWithReceiver:anObject arguments:argArray selector:nil search:nil
 !
 
 valueWithReceiver:anObject arguments:argArray selector:aSymbol
@@ -652,7 +668,26 @@
      expectations -
      - otherwise strange things (and also strange crashes) can occur.
      The system is NOT always detecting a wrong method/receiver combination.
-     BE WARNED."
+     YOU HAVE BEEN WARNED."
+
+    ^ self valueWithReceiver:anObject arguments:argArray selector:aSymbol search:nil
+!
+
+valueWithReceiver:anObject arguments:argArray selector:aSymbol search:aClass
+    "low level call of a methods code - BIG DANGER ALERT.
+     Perform the receiver-method on anObject as receiver and argArray as
+     arguments. This does NO message lookup at all and mimics a
+     traditional function call.
+     This method is provided for debugging- and breakpoint-support 
+     (replacing a method by a stub and recalling the original), or to implement
+     experimental MI implementations - it is not for general use. 
+
+     The receiver must be a method compiled in anObjects class or one of its 
+     superclasses and also, the number of arguments given must match the methods
+     expectations -
+     - otherwise strange things (and also strange crashes) can occur.
+     The system is NOT always detecting a wrong method/receiver combination.
+     YOU HAVE BEEN WARNED."
 
 %{
     OBJFUNC code;
@@ -673,7 +708,12 @@
     }
 
     code = _MethodInstPtr(self)->m_code;
-    searchClass = dummy.ilc_class = _Class(anObject);
+    if (aClass == nil) {
+        searchClass = dummy.ilc_class = _Class(anObject);
+    } else {
+        searchClass = dummy.ilc_class = aClass;
+    }
+
     if (code) {
         /* compiled code */
         switch (nargs) {
@@ -727,6 +767,21 @@
                 RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
                                  ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
                                  ap[9], ap[10], ap[11]) );
+
+            case 13:
+                RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
+                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
+                                 ap[9], ap[10], ap[11], ap[12]) );
+
+            case 14:
+                RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
+                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
+                                 ap[9], ap[10], ap[11], ap[12], ap[13]) );
+
+            case 15:
+                RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
+                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
+                                 ap[9], ap[10], ap[11], ap[12], ap[13], ap[14]) );
         }
     } else {
         /* interpreted code */
@@ -786,6 +841,21 @@
                 RETURN ( interpret(self, 12, anObject, aSymbol, SND_COMMA searchClass,
                                    ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
                                    ap[7], ap[8], ap[9], ap[11]) );
+
+            case 13:
+                RETURN ( interpret(self, 13, anObject, aSymbol, SND_COMMA searchClass,
+                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
+                                   ap[7], ap[8], ap[9], ap[11], ap[12]) );
+
+            case 14:
+                RETURN ( interpret(self, 14, anObject, aSymbol, SND_COMMA searchClass,
+                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
+                                   ap[7], ap[8], ap[9], ap[11], ap[12], ap[13]) );
+
+            case 15:
+                RETURN ( interpret(self, 15, anObject, aSymbol, SND_COMMA searchClass,
+                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
+                                   ap[7], ap[8], ap[9], ap[11], ap[12], ap[13], ap[14]) );
         }
     }
 %}