The Trunk: Kernel-eem.740.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-eem.740.mcz

commits-2
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.740.mcz

==================== Summary ====================

Name: Kernel-eem.740
Author: eem
Time: 23 February 2013, 5:42:23.379 pm
UUID: 9dce4ab5-fac8-4dc8-bbb7-9f9ca5b37fc6
Ancestors: Kernel-fbs.739

Move the code to set the owning method of an
AdditionalMethodState to the setter away from clients.
Add an anti-sharing check.

=============== Diff against Kernel-fbs.739 ===============

Item was added:
+ ----- Method: AdditionalMethodState>>method (in category 'accessing') -----
+ method
+ ^method!

Item was changed:
  ----- Method: CompiledMethod>>copyWithTrailerBytes: (in category 'copying') -----
  copyWithTrailerBytes: trailer
  "Testing:
  (CompiledMethod compiledMethodAt: #copyWithTrailerBytes:)
  tempNamesPut: 'copy end '
  "
+ | copy end start |
- | copy end start penultimateLiteral |
  start := self initialPC.
  end := self endPC.
  copy := trailer createMethod: end - start + 1 class: self class header: self header.
  1 to: self numLiterals do: [:i | copy literalAt: i put: (self literalAt: i)].
- (penultimateLiteral := self penultimateLiteral) isMethodProperties ifTrue:
- [copy penultimateLiteral: (penultimateLiteral copy
- setMethod: copy;
- yourself)].
  start to: end do: [:i | copy at: i put: (self at: i)].
+ copy postCopy.
  ^copy!

Item was changed:
  ----- Method: CompiledMethod>>penultimateLiteral: (in category 'private') -----
  penultimateLiteral: anObject
+ "Set the penultimate literal of the receiver, which holds either the
+ receiver's selector or its properties (which will hold the selector).
+ If it is an AdditionalMethodState set the state's ownership to this
+ method"
- "Answer the penultimate literal of the receiver, which holds either
- the receiver's selector or its properties (which will hold the selector)."
  | pIndex |
+ (pIndex := self numLiterals - 1) <= 0 ifTrue:
+ [self error: 'insufficient literals'].
+ self literalAt: pIndex put: anObject.
+ anObject isMethodProperties ifTrue:
+ [(anObject method ~~ nil
+  and: [anObject method ~~ self
+  and: [anObject method penultimateLiteral == anObject]]) ifTrue:
+ [self error: 'a method''s AdditionalMethodState should not be shared'].
+ anObject setMethod: self.
+ anObject pragmas do: [:p| p setMethod: self]]!
- (pIndex := self numLiterals - 1) > 0
- ifTrue: [self literalAt: pIndex put: anObject]
- ifFalse: [self error: 'insufficient literals']!

Item was changed:
  ----- Method: CompiledMethod>>postCopy (in category 'copying') -----
  postCopy
  | penultimateLiteral |
  (penultimateLiteral := self penultimateLiteral) isMethodProperties ifTrue:
+ [self penultimateLiteral: penultimateLiteral copy]!
- [self penultimateLiteral: (penultimateLiteral copy
- setMethod: self;
- yourself).
- self pragmas do:
- [:p| p setMethod: self]]!

Item was changed:
  ----- Method: CompiledMethod>>propertyValueAt:put: (in category 'accessing-pragmas & properties') -----
  propertyValueAt: propName put: propValue
  "Set or add the property with key propName and value propValue.
  If the receiver does not yet have a method properties create one and replace
  the selector with it.  Otherwise, either relace propValue in the method properties
  or replace method properties with one containing the new property."
  | propertiesOrSelector |
  (propertiesOrSelector := self penultimateLiteral) isMethodProperties ifFalse:
+ [self penultimateLiteral: (self class methodPropertiesClass
- [self penultimateLiteral: ((self class methodPropertiesClass
  selector: propertiesOrSelector
  with: (Association
  key: propName asSymbol
+ value: propValue)).
- value: propValue))
- setMethod: self;
- yourself).
  ^propValue].
  (propertiesOrSelector includesProperty: propName) ifTrue:
  [^propertiesOrSelector at: propName put: propValue].
  self penultimateLiteral: (propertiesOrSelector
  copyWith: (Association
+ key: propName asSymbol
+ value: propValue)).
- key: propName asSymbol
- value: propValue)).
  ^propValue!