ExecutableFunction.st
changeset 21623 0fd2de531f9a
parent 21340 df3769bd1417
child 22369 6510a4f3fbd9
--- a/ExecutableFunction.st	Fri Mar 03 09:22:00 2017 +0100
+++ b/ExecutableFunction.st	Fri Mar 03 16:21:23 2017 +0100
@@ -53,19 +53,19 @@
 
     [Instance variables:]
       code        <not_an_object>   the function pointer to the machine code.
-                                    Not accessible from smalltalk code.
-                                    (notice the '*' in the instVarNames definition)
+				    Not accessible from smalltalk code.
+				    (notice the '*' in the instVarNames definition)
 
 
     [Class variables:]
       ExecutionErrorSignal          parent of all execution errors
-                                    (not raised itself)
+				    (not raised itself)
 
       InvalidCodeSignal             codeObject is not executable
 
 
     [author:]
-        Claus Gittinger
+	Claus Gittinger
 "
 ! !
 
@@ -86,24 +86,31 @@
 
 !ExecutableFunction methodsFor:'accessing'!
 
+getCode
+    "return the code field. This is not an object but the address of the machine instructions.
+     Therefore an externalAddress representing the code-address is returned"
+
+    ^ self code
+!
+
 code
-    "return the code field. This is not an object but the address of the machine instructions. 
+    "return the code field. This is not an object but the address of the machine instructions.
      Therefore an externalAddress representing the code-address is returned"
 
 %{  /* NOCONTEXT */
     unsigned INT addr;
 
     if (__INST(code_) != nil) {
-        
+
 #ifdef OLD
-        // returned an integer in very old versions.
-        addr = (unsigned INT)__INST(code_);
-        if (addr <= _MAX_INT) {
-            RETURN ( __mkSmallInteger(addr) );
-        }
-        RETURN ( __MKUINT(addr));
+	// returned an integer in very old versions.
+	addr = (unsigned INT)__INST(code_);
+	if (addr <= _MAX_INT) {
+	    RETURN ( __mkSmallInteger(addr) );
+	}
+	RETURN ( __MKUINT(addr));
 #endif
-        RETURN (__MKEXTERNALADDRESS(__INST(code_)));
+	RETURN (__MKEXTERNALADDRESS(__INST(code_)));
     }
 %}.
     ^ nil
@@ -147,7 +154,7 @@
 
     |addr|
 
-    addr := self code.
+    addr := self getCode.
     addr isNil ifTrue:[^ super printOn:aStream].
 
     aStream nextPutAll:self class name; nextPutAll:'(address: 0x'.
@@ -168,7 +175,7 @@
 !ExecutableFunction methodsFor:'private-accessing'!
 
 code:anAddress
-    "set the code field - DANGER ALERT. 
+    "set the code field - DANGER ALERT.
      This is not an object but the address of the machine instructions.
      Therefore the argument must be an integer representing this address.
      You can crash Smalltalk very badly when playing around here ...
@@ -178,17 +185,17 @@
 %{  /* NOCONTEXT */
 
     if (__isExternalAddress(anAddress)) {
-        __INST(code_) = (OBJ)(__externalAddressVal(anAddress));
+	__INST(code_) = (OBJ)(__externalAddressVal(anAddress));
     } else {
-        if (__isSmallInteger(anAddress))
-            __INST(code_) = (OBJ)(__intVal(anAddress));
-        else {
-            if (anAddress == nil) {
-                __INST(code_) = nil;
-            } else {
-                __INST(code_) = (OBJ)(__longIntVal(anAddress));
-            }
-        }
+	if (__isSmallInteger(anAddress))
+	    __INST(code_) = (OBJ)(__intVal(anAddress));
+	else {
+	    if (anAddress == nil) {
+		__INST(code_) = nil;
+	    } else {
+		__INST(code_) = (OBJ)(__longIntVal(anAddress));
+	    }
+	}
     }
 %}
 !
@@ -223,7 +230,7 @@
 
 %{  /* NOCONTEXT */
     if (__INST(code_)) {
-        RETURN (true);
+	RETURN (true);
     }
     RETURN (false);
 %}.
@@ -259,7 +266,7 @@
 
     "
      Method allInstancesDo:[:m |
-        (m hasResource:#image) ifTrue:[self halt]
+	(m hasResource:#image) ifTrue:[self halt]
      ].
     "
 
@@ -443,13 +450,13 @@
 
 sends:aSelectorSymbol
     <resource: #obsolete>
-    
-    "return true, if this code object contains a message-send with aSelectorSymbol as selector. 
-     - due to the simple check in the literal array, also simple uses 
+
+    "return true, if this code object contains a message-send with aSelectorSymbol as selector.
+     - due to the simple check in the literal array, also simple uses
        of aSelectorSymbol as symbol will return true.
        Should ask compiler, if there is really a send."
 
-    self obsoleteFeatureWarning:'please use #sendsSelector:'.   
+    self obsoleteFeatureWarning:'please use #sendsSelector:'.
     ^ self sendsSelector:aSelectorSymbol
 
     "Created: / 16-04-1996 / 16:35:53 / cg"
@@ -462,7 +469,7 @@
     "return true, if this method contains a message-send
      to any of aCollectionOfSelectorSymbols."
 
-    self obsoleteFeatureWarning:'please use #sendsAnySelector:'.   
+    self obsoleteFeatureWarning:'please use #sendsAnySelector:'.
     ^ self sendsAnySelector:aCollectionOfSelectorSymbols
 
     "Created: / 08-08-2011 / 18:53:24 / cg"
@@ -474,7 +481,7 @@
      to any of aCollectionOfSelectorSymbols."
 
     (aCollectionOfSelectorSymbols contains:[:sym | self referencesLiteral:sym]) ifTrue:[
-        ^ true.
+	^ true.
     ].
     ^ false
 
@@ -482,8 +489,8 @@
 !
 
 sendsSelector:aSelectorSymbol
-    "return true, if this code object contains a message-send with aSelectorSymbol as selector. 
-     - due to the simple check in the literal array, also simple uses 
+    "return true, if this code object contains a message-send with aSelectorSymbol as selector.
+     - due to the simple check in the literal array, also simple uses
        of aSelectorSymbol as symbol will return true.
        Should ask compiler, if there is really a send."
 
@@ -508,4 +515,3 @@
 version_CVS
     ^ '$Header$'
 ! !
-