The Trunk: Kernel-ar.437.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-ar.437.mcz

commits-2
Andreas Raab uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ar.437.mcz

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

Name: Kernel-ar.437
Author: ar
Time: 31 March 2010, 11:12:42.404 pm
UUID: fca21cc5-5dcb-e24d-af15-a1bf0241151d
Ancestors: Kernel-ar.436

Fixes needed for new condensing method:
* Allow class comments to be moved to the sources file
* Make CompiledMethod>>setSourcePointer: less expensive by avoiding #become: if at all possible

=============== Diff against Kernel-ar.436 ===============

Item was changed:
  ----- Method: ClassDescription>>putClassCommentToCondensedChangesFile: (in category 'fileIn/Out') -----
  putClassCommentToCondensedChangesFile: aFileStream
  "Called when condensing changes.  If the receiver has a class comment, and if that class comment does not reside in the .sources file, then write it to the given filestream, with the resulting RemoteString being reachable from the source file #2.  Note that any existing backpointer into the .sources file is lost by this process -- a situation that maybe should be fixed someday."
+ ^self moveClassCommentTo: aFileStream fileIndex: 2!
-
- | header aStamp aCommentRemoteStr |
- self isMeta ifTrue: [^ self].  "bulletproofing only"
- ((aCommentRemoteStr := self organization commentRemoteStr) isNil or:
- [aCommentRemoteStr sourceFileNumber == 1]) ifTrue: [^ self].
-
- aFileStream cr; nextPut: $!!.
- header := String streamContents: [:strm | strm nextPutAll: self name;
- nextPutAll: ' commentStamp: '.
- (aStamp := self organization commentStamp ifNil: ['<historical>']) storeOn: strm.
- strm nextPutAll: ' prior: 0'].
- aFileStream nextChunkPut: header.
- aFileStream cr.
- self organization classComment: (RemoteString newString: self organization classComment onFileNumber: 2 toFile: aFileStream) stamp: aStamp!

Item was added:
+ ----- Method: ClassDescription>>moveClassCommentTo:fileIndex: (in category 'fileIn/Out') -----
+ moveClassCommentTo: aFileStream fileIndex: newFileIndex
+ "Called when condensing changes.  If the receiver has a class comment, and if that class comment does not reside in the .sources file, then write it to the given filestream, with the resulting RemoteString being reachable from the source file fileIndex.  Note that any existing backpointer into the .sources file is lost by this process -- a situation that maybe should be fixed someday."
+
+ | header aStamp aCommentRemoteStr |
+ self isMeta ifTrue: [^ self].  "bulletproofing only"
+ ((aCommentRemoteStr := self organization commentRemoteStr) isNil or:
+ [aCommentRemoteStr sourceFileNumber == 1]) ifTrue: [^ self].
+
+ aFileStream cr; nextPut: $!!.
+ header := String streamContents: [:strm | strm nextPutAll: self name;
+ nextPutAll: ' commentStamp: '.
+ (aStamp := self organization commentStamp ifNil: ['<historical>']) storeOn: strm.
+ strm nextPutAll: ' prior: 0'].
+ aFileStream nextChunkPut: header.
+ aFileStream cr.
+ self organization classComment: (RemoteString newString: self organization classComment onFileNumber: newFileIndex toFile: aFileStream) stamp: aStamp!

Item was changed:
  ----- Method: CompiledMethod>>setSourcePointer: (in category 'source code management') -----
  setSourcePointer: srcPointer
  "We can't change the trailer of existing method, since
  it could have completely different format. Therefore we need to
  generate a copy with new trailer, containing an scrPointer, and then
  #become it"
+ | trailer copy start |
- | trailer copy |
  trailer := CompiledMethodTrailer new sourcePointer: srcPointer.
  copy := self copyWithTrailerBytes: trailer.
+
+ "ar 3/31/2010: Be a bit more clever since #become: is slow.
+ If the old and the new trailer have the same size, just replace it."
+ (self trailer class == trailer class and:[self size = copy size]) ifTrue:[
+ start := self endPC + 1.
+ self replaceFrom: start to: self size with: copy startingAt: start.
+ ] ifFalse:[self becomeForward: copy].
+
+ ^self "will be copy if #become was needed"
+ !
- self becomeForward: copy.
- ^ copy!