The Trunk: System-nice.682.mcz

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

The Trunk: System-nice.682.mcz

commits-2
Nicolas Cellier uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-nice.682.mcz

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

Name: System-nice.682
Author: nice
Time: 28 July 2014, 11:38:58.476 pm
UUID: f38c414b-25fc-4c7c-ab24-c2d05b1699cf
Ancestors: System-nice.681

Use peekLast in ReferenceStream rather than skip: -1; next.
This is now going to work on a simple WriteStream (no ReadWriteStream requirement).

Note: I don't understand what was a uggly workaround, the fact to peekLast, or (byteStream skip: 0)?
If it's (byteStream skip: 0), I don't know what it works around, and I just cross fingers...
The sole reference google got me was too far and too light  http://st-www.cs.illinois.edu/squeak/Squeak2.0/updates/152hide&show-LG-tk.cs

=============== Diff against System-nice.681 ===============

Item was changed:
  ----- Method: ReferenceStream>>beginInstance:size: (in category 'writing') -----
  beginInstance: aClass size: anInteger
  "This is for use by storeDataOn: methods.  Cf. Object>>storeDataOn:."
  "Addition of 1 seems to make extra work, since readInstance has to compensate.  Here for historical reasons dating back to Kent Beck's original implementation in late 1988.
  In ReferenceStream, class is just 5 bytes for shared symbol.
  SmartRefStream puts out the names and number of class's instances variables for checking.
  6/10/97 16:09 tk: See if we can put on a short header. Type = 16. "
 
  | short ref |
  short := true. "All tests for object header that can be written in 4 bytes"
  anInteger <= 254 ifFalse: [short := false]. "one byte size"
  ref := references at: aClass name ifAbsent: [short := false. nil].
  ref isInteger ifFalse: [short := false].
  short ifTrue: [short := (ref < 65536) & (ref > 0) "& (ref ~= self vacantRef)"].  "vacantRef is big"
+ short ifTrue: [short := byteStream peekLast = 9]. "ugly workaround"
- short ifTrue: [
- byteStream skip: -1.
- short := byteStream next = 9.
- byteStream skip: 0]. "ugly workaround"
  short
  ifTrue: ["passed all the tests!!"
  byteStream skip: -1; nextPut: 16; "type = short header"
  nextPut: anInteger + 1; "size is short"
  nextNumber: 2 put: ref]
  ifFalse: [
  "default to normal longer object header"
  byteStream nextNumber: 4 put: anInteger + 1.
  self nextPut: aClass name].
  insideASegment ifTrue: [
  aClass isSystemDefined ifFalse: [self nextPut: aClass]].
  "just record it to put it into roots"!