Hi, I would like to add special an object to the specialObject array. How could I do that? Thanks Mth |
Why would you need to do this? Cheers, - Andreas Mathieu Suen wrote: > > Hi, > > I would like to add special an object to the specialObject array. How > could I do that? > > Thanks > Mth > > > |
I would like to implement a bytecode to create the ClosureEnvironment and see if the performance of the NewCompiler is better Mth On Jul 26, 2007, at 4:45 AM, Andreas Raab wrote: > Why would you need to do this? > > Cheers, > - Andreas > > Mathieu Suen wrote: >> Hi, >> I would like to add special an object to the specialObject array. >> How could I do that? >> Thanks >> Mth |
Mathieu Suen writes: > > I would like to implement a bytecode to create the ClosureEnvironment > and see if the performance of the NewCompiler is better > Mth > What I did for Exupery's contexts is to make them compact classes with: ExuperyBlockContext>>initialize self becomeCompactAt: 15 Then the context object can be created by: newContext := self instantiateContext: (self fetchPointer: 14 ofObject: (self splObj: 28 "Current index, FIX") ) sizeInBytes: SmallContextSize. Bryce |
Hi, Where can I find the #becomeCompactAt:. Mth On Jul 26, 2007, at 11:10 AM, <[hidden email]> wrote: > ExuperyBlockContext>>initialize > self becomeCompactAt: 15 |
Mathieu Suen writes: > > Hi, > > Where can I find the #becomeCompactAt:. Sorry, that seems to be an Exupery extension. I don't think I wrote this method. It's here: Behavior>>becomeCompactAt: anInteger "Here are the restrictions on compact classes in order for export segments to work: A compact class index may not be reused. If a class was compact in a release of Squeak, no other class may use that index. The class might not be compact later, and there should be nil in its place in the array." | cct index | self isWeak ifTrue:[^ self halt: 'You must not make a weak class compact']. cct := self environment compactClassesArray. (self indexIfCompact > 0 or: [cct includes: self]) ifTrue: [^ self halt: self name , 'is already compact']. index := anInteger. (cct at: index) isNil ifFalse: [self halt: 'The compact class index is already used']. "Install this class in the compact class table" cct at: index put: self. "Update instspec so future instances will be compact" format := format + (index bitShift: 11). "Make up new instances and become old ones into them" self updateInstancesFrom: self. "Purge any old instances" Smalltalk garbageCollect. |
Thanks So what is the right way of using the compactClassesArray. If I use I shoudn't use the slot 15 but who else is using it? Mth On Jul 26, 2007, at 12:10 PM, <[hidden email]> wrote: > > Mathieu Suen writes: >> >> Hi, >> >> Where can I find the #becomeCompactAt:. > > Sorry, that seems to be an Exupery extension. I don't think I > wrote this method. > > It's here: > > Behavior>>becomeCompactAt: anInteger > "Here are the restrictions on compact classes in order for export > segments to work: A compact class index may not be reused. If a > class was compact in a release of Squeak, no other class may use > that index. The class might not be compact later, and there should > be nil in its place in the array." > | cct index | > > self isWeak ifTrue:[^ self halt: 'You must not make a weak class > compact']. > cct := self environment compactClassesArray. > (self indexIfCompact > 0 or: [cct includes: self]) > ifTrue: [^ self halt: self name , 'is already compact']. > index := anInteger. > (cct at: index) isNil ifFalse: [self halt: 'The compact class > index is already used']. > "Install this class in the compact class table" > cct at: index put: self. > "Update instspec so future instances will be compact" > format := format + (index bitShift: 11). > "Make up new instances and become old ones into them" > self updateInstancesFrom: self. > "Purge any old instances" > Smalltalk garbageCollect. |
In reply to this post by Bryce Kampjes
Could/should we push this method in 3.10? Mth On Jul 26, 2007, at 12:10 PM, <[hidden email]> wrote: > Behavior>>becomeCompactAt: anInteger > "Here are the restrictions on compact classes in order for export > segments to work: A compact class index may not be reused. If a > class was compact in a release of Squeak, no other class may use > that index. The class might not be compact later, and there should > be nil in its place in the array." > | cct index | > > self isWeak ifTrue:[^ self halt: 'You must not make a weak class > compact']. > cct := self environment compactClassesArray. > (self indexIfCompact > 0 or: [cct includes: self]) > ifTrue: [^ self halt: self name , 'is already compact']. > index := anInteger. > (cct at: index) isNil ifFalse: [self halt: 'The compact class > index is already used']. > "Install this class in the compact class table" > cct at: index put: self. > "Update instspec so future instances will be compact" > format := format + (index bitShift: 11). > "Make up new instances and become old ones into them" > self updateInstancesFrom: self. > "Purge any old instances" > Smalltalk garbageCollect. |
In reply to this post by Mathieu SUEN
Mathieu Suen writes: > > Thanks > > So what is the right way of using the compactClassesArray. > If I use I shoudn't use the slot 15 but who else is using it? Exupery uses 17 for ExuperyMethodContexts. Bryce |
In reply to this post by Bryce Kampjes
It should be in the class side, isn't it? Mth On Jul 26, 2007, at 11:10 AM, <[hidden email]> wrote: > ExuperyBlockContext>>initialize > self becomeCompactAt: 15 |
See Behavior>>becomeCompact You just call this once for a class in the image. I suggest to put it into the class side #initialize method. But do you really need a compact class? If you just need to access the class from the interpreter, you can also add it to the special objects array. See SystemDictionary>>recreateSpecialObjectsArray. I'd simply extend the array, I don't see any obvious reason why this should not work. Of course if you plan to make your changes go into the VM, you'll have to have a good point to satisfy the VM gurus ;) HTH, Adrian On Jul 26, 2007, at 14:18 , Mathieu Suen wrote: > It should be in the class side, isn't it? > Mth > > > > On Jul 26, 2007, at 11:10 AM, <[hidden email]> wrote: > >> ExuperyBlockContext>>initialize >> self becomeCompactAt: 15 > |
In reply to this post by Mathieu SUEN
Mathieu Suen writes: > > It should be in the class side, isn't it? > Mth Yes. |
Free forum by Nabble | Edit this page |