191 |
191 |
192 LastFileLock isNil ifTrue:[ |
192 LastFileLock isNil ifTrue:[ |
193 LastFileLock := RecursionLock new name:'Method-LastFile'. |
193 LastFileLock := RecursionLock new name:'Method-LastFile'. |
194 LastMethodSourcesLock := RecursionLock new name:'Method-LastMethodSources'. |
194 LastMethodSourcesLock := RecursionLock new name:'Method-LastMethodSources'. |
195 |
195 |
196 "LastFileReference used to be a WeakArray. The problem was, that |
196 LastFileReference := WeakArray new:1. |
197 during some operations (generating project definition methods), lots of |
|
198 methods and classes are accessed. GC (scavenge) is done heavily, |
|
199 while finalization is a low prio process, so that the file limit |
|
200 is reached before finalization did close the old streams." |
|
201 LastFileReference := Array new:1. |
|
202 LastFileReference at:1 put:nil. |
197 LastFileReference at:1 put:nil. |
203 ]. |
198 ]. |
204 |
199 |
205 CompilationLock := RecursionLock new name:'MethodCompilation'. |
200 CompilationLock := RecursionLock new name:'MethodCompilation'. |
206 |
201 |
207 "Modified: 22.4.1996 / 16:34:38 / cg" |
202 "Modified: / 03-01-1997 / 16:58:16 / stefan" |
208 "Modified: 3.1.1997 / 16:58:16 / stefan" |
203 "Modified (comment): / 20-07-2012 / 18:41:11 / cg" |
209 ! |
204 ! |
210 |
205 |
211 lastMethodSourcesLock |
206 lastMethodSourcesLock |
212 LastMethodSourcesLock isNil ifTrue:[ |
207 LastMethodSourcesLock isNil ifTrue:[ |
213 self initialize |
208 self initialize |
227 !Method class methodsFor:'cleanup'! |
222 !Method class methodsFor:'cleanup'! |
228 |
223 |
229 lowSpaceCleanup |
224 lowSpaceCleanup |
230 LastParseTreeCache := nil. |
225 LastParseTreeCache := nil. |
231 LastSourceFileName := LastWhoClass := nil. |
226 LastSourceFileName := LastWhoClass := nil. |
|
227 self flushSourceStreamCache. |
232 |
228 |
233 "Created: / 08-08-2011 / 19:11:23 / cg" |
229 "Created: / 08-08-2011 / 19:11:23 / cg" |
234 ! ! |
230 ! ! |
235 |
231 |
236 !Method class methodsFor:'queries'! |
232 !Method class methodsFor:'queries'! |
2353 ]. |
2349 ]. |
2354 ]. |
2350 ]. |
2355 ^ #() "/ actually: unknown |
2351 ^ #() "/ actually: unknown |
2356 |
2352 |
2357 "Modified: 19.6.1997 / 17:54:09 / cg" |
2353 "Modified: 19.6.1997 / 17:54:09 / cg" |
|
2354 ! |
|
2355 |
|
2356 accessesField:instVarIndex |
|
2357 "return true, if the instvar at instVarIndex is accessed by the receiver. |
|
2358 Uses parser (for now); could look at bytecode as well here..." |
|
2359 |
|
2360 |instVarName| |
|
2361 |
|
2362 instVarName := (self mclass allInstVarNames) at:instVarIndex. |
|
2363 ^ self accessesInstVar:instVarName |
|
2364 |
|
2365 "Created: / 23-07-2012 / 11:13:54 / cg" |
|
2366 ! |
|
2367 |
|
2368 accessesInstVar:instVarName |
|
2369 "return true, if the named instvar is accessed by the receiver. |
|
2370 Uses parser (for now); could look at bytecode as well here..." |
|
2371 |
|
2372 |usedInstVars| |
|
2373 |
|
2374 (self source includesString:instVarName) ifFalse:[^ false]. "/ that's much faster than parsing... |
|
2375 usedInstVars := self parse:#'parseMethodSilent:in:' with:self mclass return:#usedInstVars or:#(). |
|
2376 ^ usedInstVars includes:instVarName. |
|
2377 |
|
2378 "Created: / 23-07-2012 / 11:15:02 / cg" |
2358 ! |
2379 ! |
2359 |
2380 |
2360 containingClass |
2381 containingClass |
2361 "return the class I am defined in. |
2382 "return the class I am defined in. |
2362 See comment in who." |
2383 See comment in who." |
3116 |
3137 |
3117 readsField:instVarIndex |
3138 readsField:instVarIndex |
3118 "return true, if the instvar at instVarIndex is read by the receiver. |
3139 "return true, if the instvar at instVarIndex is read by the receiver. |
3119 Uses parser (for now); could look at bytecode as well here..." |
3140 Uses parser (for now); could look at bytecode as well here..." |
3120 |
3141 |
3121 |varName readInstVars| |
3142 |instVarName| |
3122 |
3143 |
3123 varName := (self mclass allInstVarNames) at:instVarIndex. |
3144 instVarName := (self mclass allInstVarNames) at:instVarIndex. |
|
3145 ^ self readsInstVar:instVarName |
|
3146 |
|
3147 "Modified: / 23-07-2012 / 11:16:08 / cg" |
|
3148 ! |
|
3149 |
|
3150 readsInstVar:instVarName |
|
3151 "return true, if the named instvar is read by the receiver. |
|
3152 Uses parser (for now); could look at bytecode as well here..." |
|
3153 |
|
3154 |readInstVars| |
|
3155 |
|
3156 (self source includesString:instVarName) ifFalse:[^ false]. "/ that's much faster than parsing... |
3124 readInstVars := self parse:#'parseMethodSilent:in:' with:self mclass return:#readInstVars or:#(). |
3157 readInstVars := self parse:#'parseMethodSilent:in:' with:self mclass return:#readInstVars or:#(). |
3125 ^ readInstVars includes:varName. |
3158 ^ readInstVars includes:instVarName. |
|
3159 |
|
3160 "Created: / 23-07-2012 / 11:15:56 / cg" |
3126 ! |
3161 ! |
3127 |
3162 |
3128 resourceType |
3163 resourceType |
3129 "ST-80 compatibility: |
3164 "ST-80 compatibility: |
3130 return the methods first resource specs key. |
3165 return the methods first resource specs key. |
3423 |
3458 |
3424 writesField:instVarIndex |
3459 writesField:instVarIndex |
3425 "return true, if the instvar at instVarIndex is written (modified) by the receiver. |
3460 "return true, if the instvar at instVarIndex is written (modified) by the receiver. |
3426 Uses parser (for now); could look at bytecode as well here..." |
3461 Uses parser (for now); could look at bytecode as well here..." |
3427 |
3462 |
3428 |varName modifiedInstVars| |
3463 |instVarName| |
3429 |
3464 |
3430 varName := (self mclass allInstVarNames) at:instVarIndex. |
3465 instVarName := (self mclass allInstVarNames) at:instVarIndex. |
|
3466 ^ self writesInstVar:instVarName |
|
3467 |
|
3468 "Modified: / 23-07-2012 / 11:16:51 / cg" |
|
3469 ! |
|
3470 |
|
3471 writesInstVar:instVarName |
|
3472 "return true, if the named instvar is written (modified) by the receiver. |
|
3473 Uses parser (for now); could look at bytecode as well here..." |
|
3474 |
|
3475 |modifiedInstVars| |
|
3476 |
|
3477 (self source includesString:instVarName) ifFalse:[^ false]. "/ that's much faster than parsing... |
3431 modifiedInstVars := self parse:#'parseMethodSilent:in:' with:self mclass return:#modifiedInstVars or:#(). |
3478 modifiedInstVars := self parse:#'parseMethodSilent:in:' with:self mclass return:#modifiedInstVars or:#(). |
3432 ^ modifiedInstVars includes:varName. |
3479 ^ modifiedInstVars includes:instVarName. |
|
3480 |
|
3481 "Created: / 23-07-2012 / 11:16:36 / cg" |
3433 ! ! |
3482 ! ! |
3434 |
3483 |
3435 !Method methodsFor:'trap methods'! |
3484 !Method methodsFor:'trap methods'! |
3436 |
3485 |
3437 makeInvalid |
3486 makeInvalid |
3666 ! ! |
3715 ! ! |
3667 |
3716 |
3668 !Method class methodsFor:'documentation'! |
3717 !Method class methodsFor:'documentation'! |
3669 |
3718 |
3670 version |
3719 version |
3671 ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.385 2012/06/13 13:11:30 cg Exp $' |
3720 ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.388 2012/07/23 09:17:47 cg Exp $' |
3672 ! |
3721 ! |
3673 |
3722 |
3674 version_CVS |
3723 version_CVS |
3675 ^ '§Header: /cvs/stx/stx/libbasic/Method.st,v 1.385 2012/06/13 13:11:30 cg Exp §' |
3724 ^ '§Header: /cvs/stx/stx/libbasic/Method.st,v 1.388 2012/07/23 09:17:47 cg Exp §' |
3676 ! |
3725 ! |
3677 |
3726 |
3678 version_SVN |
3727 version_SVN |
3679 ^ '$ Id: Method.st 10648 2011-06-23 15:55:10Z vranyj1 $' |
3728 ^ '$ Id: Method.st 10648 2011-06-23 15:55:10Z vranyj1 $' |
3680 ! ! |
3729 ! ! |