--- a/Behavior.st Tue Apr 30 10:54:00 2013 +0100
+++ b/Behavior.st Tue May 21 21:58:09 2013 +0100
@@ -12,10 +12,10 @@
"{ Package: 'stx:libbasic' }"
Object subclass:#Behavior
- instanceVariableNames: 'superclass flags methodDictionary lookupObject instSize'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Kernel-Classes'
+ instanceVariableNames:'superclass flags methodDictionary lookupObject instSize'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Kernel-Classes'
!
!Behavior class methodsFor:'documentation'!
@@ -300,7 +300,6 @@
"
! !
-
!Behavior class methodsFor:'creating new classes'!
new
@@ -338,7 +337,6 @@
"Modified: 7.6.1996 / 15:38:58 / stefan"
! !
-
!Behavior class methodsFor:'flag bit constants'!
flagAlien
@@ -824,7 +822,6 @@
%}
! !
-
!Behavior class methodsFor:'helpers'!
classesSortedByLoadOrder2:aCollectionOfClasses
@@ -834,9 +831,9 @@
This is an alternate algorithm showing cycles"
- |classes orderedTuples|
-
- orderedTuples := OrderedCollection new:classes size.
+ |orderedTuples|
+
+ orderedTuples := OrderedCollection new:aCollectionOfClasses size.
aCollectionOfClasses do:[:eachClass|
|sharedPools|
orderedTuples add:(Array with:eachClass with:eachClass superclass).
@@ -1011,7 +1008,6 @@
"Modified: 5.9.1996 / 19:34:41 / cg"
! !
-
!Behavior class methodsFor:'misc'!
autoload
@@ -1021,7 +1017,6 @@
! !
-
!Behavior class methodsFor:'queries'!
definitionSelectorFirstParts
@@ -1101,7 +1096,6 @@
"Created: / 01-06-2012 / 20:37:46 / cg"
! !
-
!Behavior methodsFor:'Compatibility-Dolphin'!
allSubinstances
@@ -1143,7 +1137,6 @@
^ self compiledMethodAt:selector
! !
-
!Behavior methodsFor:'Compatibility-Squeak'!
classComment:comment stamp:commentStamp
@@ -1196,7 +1189,6 @@
"Modified (comment): / 20-08-2011 / 16:35:07 / cg"
! !
-
!Behavior methodsFor:'Compatibility-VW'!
>> aSelector
@@ -1258,7 +1250,6 @@
^ self nameWithoutPrefix
! !
-
!Behavior methodsFor:'accessing'!
addSelector:newSelector withMethod:newMethod
@@ -1499,7 +1490,6 @@
^ superclass
! !
-
!Behavior methodsFor:'autoload check'!
autoload
@@ -1527,7 +1517,6 @@
"Created: 16.4.1996 / 16:27:16 / cg"
! !
-
!Behavior methodsFor:'compiler interface'!
browserClass
@@ -1610,7 +1599,6 @@
^ self class syntaxHighlighterClass.
! !
-
!Behavior methodsFor:'compiling'!
compile:code
@@ -1640,7 +1628,6 @@
"Created: 1.4.1997 / 23:43:43 / stefan"
! !
-
!Behavior methodsFor:'copying'!
canCloneFrom:anObject
@@ -1736,7 +1723,6 @@
^ self
! !
-
!Behavior methodsFor:'dummy changes management'!
addChangeRecordForClassRemove:aClassName
@@ -1749,7 +1735,6 @@
"Modified: 16.4.1996 / 18:10:35 / cg"
! !
-
!Behavior methodsFor:'dummy fileOut'!
fileOutDefinitionOn:aStream
@@ -1762,7 +1747,6 @@
"Created: 16.4.1996 / 16:28:01 / cg"
! !
-
!Behavior methodsFor:'enumerating'!
allDerivedInstancesDo:aBlock
@@ -2033,7 +2017,6 @@
"
! !
-
!Behavior methodsFor:'error handling'!
abstractClassInstantiationError
@@ -2044,7 +2027,6 @@
"Created: / 02-11-2012 / 10:07:01 / cg"
! !
-
!Behavior methodsFor:'initialization'!
deinitialize
@@ -2105,7 +2087,6 @@
^ self
! !
-
!Behavior methodsFor:'instance creation'!
basicNew
@@ -2135,121 +2116,119 @@
nextPtr = ((char *)newobj) + instsize;
/*
- * dont argue about the goto and the arrangement below - it saves
+ * don't argue about the goto and the arrangement below - it saves
* an extra nil-compare and branch in the common case ...
* (i.e. if no GC is needed, we fall through without a branch)
*/
- if (nextPtr < __newEndPtr) {
- _objPtr(newobj)->o_size = instsize;
- /* o_allFlags(newobj) = 0; */
- /* _objPtr(newobj)->o_space = __newSpace; */
- o_setAllFlags(newobj, __newSpace);
+ if (nextPtr < (char *)__newEndPtr) {
+ _objPtr(newobj)->o_size = instsize;
+ /* o_allFlags(newobj) = 0; */
+ /* _objPtr(newobj)->o_space = __newSpace; */
+ o_setAllFlags(newobj, __newSpace);
#ifdef __HAS_ALIGN4__
- /*
- * if the alignment is 4, we are already sat,
- * since a non-indexed object always has a word-aligned size.
- */
- __newNextPtr = nextPtr;
+ /*
+ * if the alignment is 4, we are already sat,
+ * since a non-indexed object always has a word-aligned size.
+ */
+ __newNextPtr = nextPtr;
#else
- if (instsize & (__ALIGN__-1)) {
- __newNextPtr = (char *)newobj + (instsize & ~(__ALIGN__-1)) + __ALIGN__;
- } else {
- __newNextPtr = nextPtr;
- }
+ if (instsize & (__ALIGN__-1)) {
+ __newNextPtr = (char *)newobj + (instsize & ~(__ALIGN__-1)) + __ALIGN__;
+ } else {
+ __newNextPtr = nextPtr;
+ }
#endif
ok:
- __InstPtr(newobj)->o_class = self;
- __qSTORE(newobj, self);
-
- if (nInstVars) {
+ __InstPtr(newobj)->o_class = self;
+ __qSTORE(newobj, self);
+
+ if (nInstVars) {
#if defined(memset4) && defined(FAST_OBJECT_MEMSET4) || defined(FAST_MEMSET4)
- memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars);
+ memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars);
#else
- REGISTER OBJ *op;
-
- op = __InstPtr(newobj)->i_instvars;
-
- /*
- * knowing that nil is 0
- */
+ REGISTER OBJ *op = __InstPtr(newobj)->i_instvars;
+
+ /*
+ * knowing that nil is 0
+ */
# if defined(FAST_OBJECT_MEMSET_DOUBLES_UNROLLED)
- if (nInstVars > 8) {
- *op++ = nil; /* for alignment */
- nInstVars--;
- while (nInstVars >= 8) {
- *(double *)op = 0.0;
- ((double *)op)[1] = 0.0;
- ((double *)op)[2] = 0.0;
- ((double *)op)[3] = 0.0;
- op += 8;
- nInstVars -= 8;
- }
- }
- while (nInstVars != 0) {
- *op++ = 0;
- nInstVars--;
- }
+ if (nInstVars > 8) {
+ *op++ = nil; /* for alignment */
+ nInstVars--;
+ while (nInstVars >= 8) {
+ *(double *)op = 0.0;
+ ((double *)op)[1] = 0.0;
+ ((double *)op)[2] = 0.0;
+ ((double *)op)[3] = 0.0;
+ op += 8;
+ nInstVars -= 8;
+ }
+ }
+ while (nInstVars != 0) {
+ *op++ = 0;
+ nInstVars--;
+ }
# else
# if defined(FAST_OBJECT_MEMSET_LONGLONG_UNROLLED)
- if (nInstVars > 8) {
- *op++ = nil; /* for alignment */
- nInstVars--;
- while (nInstVars >= 8) {
- *(long long *)op = 0;
- ((long long *)op)[1] = 0;
- ((long long *)op)[2] = 0;
- ((long long *)op)[3] = 0;
- op += 8;
- nInstVars -= 8;
- }
- }
- while (nInstVars != 0) {
- *op++ = 0;
- nInstVars--;
- }
+ if (nInstVars > 8) {
+ *op++ = nil; /* for alignment */
+ nInstVars--;
+ while (nInstVars >= 8) {
+ *(long long *)op = 0;
+ ((long long *)op)[1] = 0;
+ ((long long *)op)[2] = 0;
+ ((long long *)op)[3] = 0;
+ op += 8;
+ nInstVars -= 8;
+ }
+ }
+ while (nInstVars != 0) {
+ *op++ = 0;
+ nInstVars--;
+ }
# else
# if defined(FAST_OBJECT_MEMSET_WORDS_UNROLLED)
- while (nInstVars >= 8) {
- *op = nil;
- *(op+1) = nil;
- *(op+2) = nil;
- *(op+3) = nil;
- *(op+4) = nil;
- *(op+5) = nil;
- *(op+6) = nil;
- *(op+7) = nil;
- op += 8;
- nInstVars -= 8;
- }
- while (nInstVars != 0) {
- *op++ = nil;
- nInstVars--;
- }
+ while (nInstVars >= 8) {
+ *op = nil;
+ *(op+1) = nil;
+ *(op+2) = nil;
+ *(op+3) = nil;
+ *(op+4) = nil;
+ *(op+5) = nil;
+ *(op+6) = nil;
+ *(op+7) = nil;
+ op += 8;
+ nInstVars -= 8;
+ }
+ while (nInstVars != 0) {
+ *op++ = nil;
+ nInstVars--;
+ }
# else
# if defined(FAST_MEMSET)
- memset(__InstPtr(newobj)->i_instvars, 0, instsize-OHDR_SIZE);
+ memset(__InstPtr(newobj)->i_instvars, 0, instsize-OHDR_SIZE);
# else
- while (nInstVars >= 8) {
- nInstVars -= 8;
- op[0] = nil; op[1] = nil;
- op[2] = nil; op[3] = nil;
- op[4] = nil; op[5] = nil;
- op[6] = nil; op[7] = nil;
- op += 8;
- }
- while (nInstVars != 0) {
- *op++ = nil;
- nInstVars--;
- }
+ while (nInstVars >= 8) {
+ nInstVars -= 8;
+ op[0] = nil; op[1] = nil;
+ op[2] = nil; op[3] = nil;
+ op[4] = nil; op[5] = nil;
+ op[6] = nil; op[7] = nil;
+ op += 8;
+ }
+ while (nInstVars != 0) {
+ *op++ = nil;
+ nInstVars--;
+ }
# endif
# endif
# endif
# endif
#endif
- }
- RETURN ( newobj );
+ }
+ RETURN ( newobj );
}
/*
@@ -2892,7 +2871,6 @@
^ self basicNew:anInteger
! !
-
!Behavior methodsFor:'misc'!
browse
@@ -2957,7 +2935,6 @@
"Created: / 19.6.1998 / 02:14:02 / cg"
! !
-
!Behavior methodsFor:'printing & storing'!
displayOn:aGCOrStream
@@ -2983,7 +2960,6 @@
aStream nextPutAll:(self name).
! !
-
!Behavior methodsFor:'private-accessing'!
flags:aNumber
@@ -3029,17 +3005,17 @@
|dict oldMethod|
newMethod isNil ifTrue:[
- self error:'invalid method'.
+ self error:'invalid method'.
].
- (Smalltalk
- changeRequest:#methodInClass
- with:(Array with:self with:aSelector with:oldMethod)) ifFalse:[
- ^ false
- ].
- "/ oldMethod := self compiledMethodAt:aSelector.
dict := self methodDictionary.
- "/ oldMethod := dict at:aSelector ifAbsent:nil.
+ oldMethod := dict at:aSelector ifAbsent:nil.
+
+ (Smalltalk
+ changeRequest:#methodInClass
+ with:(Array with:self with:aSelector with:oldMethod)) ifFalse:[
+ ^ false
+ ].
self setMethodDictionary:(dict at:aSelector putOrAppend:newMethod).
newMethod mclass:self.
@@ -3126,7 +3102,6 @@
"Modified: 22.1.1997 / 18:42:12 / cg"
! !
-
!Behavior methodsFor:'private-helpers'!
addAllClassVarNamesTo:aCollection
@@ -3200,7 +3175,6 @@
"Modified: / 22-07-2010 / 18:10:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-
!Behavior methodsFor:'queries'!
category
@@ -3548,7 +3522,6 @@
"Modified: 3.1.1997 / 19:18:49 / cg"
! !
-
!Behavior methodsFor:'queries-inheritance'!
allSubclasses
@@ -3792,7 +3765,6 @@
"
! !
-
!Behavior methodsFor:'queries-instances'!
allDerivedInstances
@@ -3995,7 +3967,6 @@
"
! !
-
!Behavior methodsFor:'queries-instlayout'!
elementByteSize
@@ -4317,7 +4288,6 @@
%}
! !
-
!Behavior methodsFor:'queries-protocol'!
allSelectors
@@ -4614,17 +4584,17 @@
cls := self.
[cls notNil] whileTrue:[
- m := cls compiledMethodAt:aSelector.
- m notNil ifTrue:[^ m].
- cls hasMultipleSuperclasses ifTrue:[
- cls superclasses do:[:aSuperClass |
- m := aSuperClass lookupMethodFor:aSelector.
- m notNil ifTrue:[^ m].
- ].
- ^ nil
- ] ifFalse:[
- cls := cls superclass
- ]
+ m := cls compiledMethodAt:aSelector.
+ m notNil ifTrue:[^ m].
+ cls hasMultipleSuperclasses ifTrue:[
+ cls superclasses do:[:aSuperClass |
+ m := aSuperClass lookupMethodFor:aSelector.
+ m notNil ifTrue:[^ m].
+ ].
+ ^ nil
+ ] ifFalse:[
+ cls := cls superclass
+ ]
].
^ nil
@@ -4737,7 +4707,6 @@
"
! !
-
!Behavior methodsFor:'queries-variables'!
allClassVarNames
@@ -4975,7 +4944,6 @@
"Modified: / 23-07-2012 / 11:21:17 / cg"
! !
-
!Behavior methodsFor:'snapshots'!
postSnapshot
@@ -4994,7 +4962,6 @@
"Modified: 16.4.1996 / 18:12:14 / cg"
! !
-
!Behavior methodsFor:'tracing'!
traceInto:aRequestor level:level from:referrer
@@ -5005,7 +4972,6 @@
! !
-
!Behavior methodsFor:'visiting'!
acceptVisitor:aVisitor with:aParameter
@@ -5013,14 +4979,13 @@
^ aVisitor visitBehavior:self with:aParameter
! !
-
!Behavior class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.340 2013-04-19 11:32:07 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.342 2013-05-08 07:54:34 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.340 2013-04-19 11:32:07 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.342 2013-05-08 07:54:34 stefan Exp $'
! !