Behavior.st
changeset 22311 5331770c9388
parent 22128 d7fc6efe8cc5
child 22362 271a6e5f7804
--- a/Behavior.st	Wed Oct 11 14:33:30 2017 +0200
+++ b/Behavior.st	Wed Oct 11 15:55:36 2017 +0200
@@ -400,9 +400,9 @@
 
 flagBlock
     "return the flag code which marks Block-like instances.
-     The VM checks for either this bit or the blockLike bit in the flag
-     value when checking for blocks to be evaluated from bytecodes.
-     However, compiled code only checks for the block bit."
+     The VM and compiled code check for this bit in the flag
+     value when checking for blocks to be evaluated from bytecode
+     or calling the block's code immediately."
 
 %{  /* NOCONTEXT */
     /* this is defined as a primitive to get defines from stc.h */
@@ -431,20 +431,17 @@
 %}
 !
 
-flagBlockLike
-    "return the flag code which marks Block-like instances
-     with respect to byteCode interpretation.
-     The VM checks for either this bit or the block bit in the flag
-     value when checking for blocks to be evaluated from bytecodes.
-     However, compiled code only checks for the block bit."
+flagVarArgBlock
+    "return the flag code which marks varArg Block-like instances
+     with respect to byteCode interpretation & code calling."
 
 %{  /* NOCONTEXT */
     /* this is defined as a primitive to get defines from stc.h */
 
 #ifdef __SCHTEAM__
-    return __c__._RETURN( STClass.FLAG_BLOCKLIKE_INSTS );
+    return __c__._RETURN( STClass.FLAG_VARARGBLOCK_INSTS );
 #else
-    RETURN ( __mkSmallInteger(BLOCKLIKE_INSTS) );
+    RETURN ( __mkSmallInteger(VARARGBLOCK_INSTS) );
 #endif
 %}
 !
@@ -1342,7 +1339,7 @@
 
 theMetaClass
     <resource: #obsolete>
-    
+
     "alias for theMetaclass (Squeak) - return the class.
      sigh; in ST/X, it is called theMetaclass; please use that."
 
@@ -1353,7 +1350,7 @@
 
 theNonMetaClass
     <resource: #obsolete>
-    
+
     "alias for theNonMetaclass (Squeak) - return the class.
      sigh; in ST/X, it is called theNonMetaclass; please use that."
 
@@ -1458,30 +1455,30 @@
     |oldMethod ns nsName selector newLookupObject|
 
     (newSelector isMemberOf:Symbol) ifFalse:[
-        self error:'invalid selector'.
+	self error:'invalid selector'.
     ].
 
     ns := newMethod nameSpace.
     (ns notNil and:[(nsName := ns name) ~= self programmingLanguage defaultSelectorNameSpacePrefix]) ifTrue:[
-        selector := (':' , nsName , '::' , newSelector) asSymbol.
-        newLookupObject := Smalltalk at: #NamespaceAwareLookup. "/ so it can be nilled to disable that feature
+	selector := (':' , nsName , '::' , newSelector) asSymbol.
+	newLookupObject := Smalltalk at: #NamespaceAwareLookup. "/ so it can be nilled to disable that feature
     ] ifFalse:[
-        selector := newSelector
+	selector := newSelector
     ].
 
     "/ Q (cg): isn't that something that the caller should decide?
     oldMethod := self compiledMethodAt:selector.
     oldMethod notNil ifTrue:[
-        newMethod restricted:(oldMethod isRestricted).
-        newMethod setPrivacy:(oldMethod privacy) flushCaches:false.
+	newMethod restricted:(oldMethod isRestricted).
+	newMethod setPrivacy:(oldMethod privacy) flushCaches:false.
     ].
 
     (self primAddSelector:selector withMethod:newMethod) ifFalse:[^ false].
 
     newLookupObject notNil ifTrue:[
-        lookupObject ~= newLookupObject ifTrue:[
-            self lookupObject: newLookupObject
-        ]
+	lookupObject ~= newLookupObject ifTrue:[
+	    self lookupObject: newLookupObject
+	]
     ].
 
     "
@@ -1491,12 +1488,12 @@
     "
 "
     problem: this is slower; since looking for all subclasses is (currently)
-             a bit slow :-(
-             We need the hasSubclasses-info bit in Behavior; now
+	     a bit slow :-(
+	     We need the hasSubclasses-info bit in Behavior; now
 
     self withAllSubclassesDo:[:aClass |
-        ObjectMemory flushInlineCachesFor:aClass withArgs:nargs.
-        ObjectMemory flushMethodCacheFor:aClass
+	ObjectMemory flushInlineCachesFor:aClass withArgs:nargs.
+	ObjectMemory flushMethodCacheFor:aClass
     ].
 "
 
@@ -2142,8 +2139,8 @@
      However, within one inheritance level, there is no specific order,
      in which the entries are enumerated.
      Warning:
-        This will only enumerate globally known classes - for anonymous
-        behaviors, you have to walk over all instances of Behavior."
+	This will only enumerate globally known classes - for anonymous
+	behaviors, you have to walk over all instances of Behavior."
 
     |meta toDo cls|
 
@@ -2151,13 +2148,13 @@
 
     toDo := self theNonMetaclass subclasses asNewOrderedCollection.
     [toDo notEmpty] whileTrue:[
-        cls := toDo removeFirst.
-        toDo addAll:cls subclasses.
-        meta ifTrue:[
-            aBlock value:cls class.
-        ] ifFalse:[
-            aBlock value:cls.
-        ]
+	cls := toDo removeFirst.
+	toDo addAll:cls subclasses.
+	meta ifTrue:[
+	    aBlock value:cls class.
+	] ifFalse:[
+	    aBlock value:cls.
+	]
     ].
 
 "/    self isMeta ifTrue:[
@@ -2981,13 +2978,13 @@
      This is the reverse operation to 'storeOn:'.
 
      WARNING: storeOn: does not handle circular references and multiple
-              references to the same object.
-              Use #storeBinary:/readBinaryFrom: for this."
+	      references to the same object.
+	      Use #storeBinary:/readBinaryFrom: for this."
 
     ^ self
-        readFrom:aStream
-        onError:[ self conversionErrorSignal
-                    raiseWith:aStream errorString:' for: ' , self name ]
+	readFrom:aStream
+	onError:[ self conversionErrorSignal
+		    raiseWith:aStream errorString:' for: ' , self name ]
 
     "
      |s|
@@ -3010,16 +3007,16 @@
      This is the reverse operation to 'storeOn:'.
 
      WARNING: storeOn: does not handle circular references and multiple
-              references to the same object.
-              Use #storeBinary:/readBinaryFrom: for this."
+	      references to the same object.
+	      Use #storeBinary:/readBinaryFrom: for this."
 
     ^ [
-        |newObject|
-
-        newObject := self evaluatorClass evaluateFrom:aStream ifFail:[^ exceptionBlock value].
-        ((newObject class == self) or:[newObject isKindOf:self])
-            ifTrue:[newObject]
-            ifFalse:[exceptionBlock value].
+	|newObject|
+
+	newObject := self evaluatorClass evaluateFrom:aStream ifFail:[^ exceptionBlock value].
+	((newObject class == self) or:[newObject isKindOf:self])
+	    ifTrue:[newObject]
+	    ifFalse:[exceptionBlock value].
     ] on:Error do:exceptionBlock.
 
     "
@@ -3027,7 +3024,7 @@
      s := WriteStream on:String new.
      #(1 2 3 4) storeOn:s.
      Transcript showCR:(
-        Array readFrom:(ReadStream on:s contents) onError:'not an Array'
+	Array readFrom:(ReadStream on:s contents) onError:'not an Array'
      )
     "
     "
@@ -3035,7 +3032,7 @@
      s := WriteStream on:String new.
      #[1 2 3 4] storeOn:s.
      Transcript showCR:(
-         Array readFrom:(ReadStream on:s contents) onError:'not an Array'
+	 Array readFrom:(ReadStream on:s contents) onError:'not an Array'
      )
     "
     "
@@ -3184,7 +3181,7 @@
     "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
     "/ old ST80 means: draw-yourself on a GC.
     (aGCOrStream isStream) ifFalse:[
-        ^ super displayOn:aGCOrStream
+	^ super displayOn:aGCOrStream
     ].
 
     aGCOrStream nextPutAll:self name
@@ -4122,7 +4119,7 @@
     coll := OrderedCollection new.
     self allInstancesForWhich:predicate do:[:someObject | coll add:someObject].
     ^ coll
-    
+
     "
      ScrollBar allInstancesSelect:[:s | s shown]
     "
@@ -4842,14 +4839,14 @@
      This is semantically equivalent to includesSelector: (which is ST/80/Squeak compatibility).
 
      Caveat:
-        This simply checks for the selector being present in the classes
-        selector table - therefore, it does not care for ignoredMethods.
-        (but: you should not use this method for protocol-testing, anyway).
+	This simply checks for the selector being present in the classes
+	selector table - therefore, it does not care for ignoredMethods.
+	(but: you should not use this method for protocol-testing, anyway).
 
      Hint:
-        Don't use this method to check if someone responds to a message -
-        use #canUnderstand: on the class or #respondsTo: on the instance
-        to do this."
+	Don't use this method to check if someone responds to a message -
+	use #canUnderstand: on the class or #respondsTo: on the instance
+	to do this."
 
     ^ self includesSelector:aSelector
 
@@ -5362,4 +5359,3 @@
 version_CVS
     ^ '$Header$'
 ! !
-