VM Maker: VMMaker.oscog-cb.2412.mcz

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

VM Maker: VMMaker.oscog-cb.2412.mcz

commits-2
 
ClementBera uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-cb.2412.mcz

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

Name: VMMaker.oscog-cb.2412
Author: cb
Time: 8 June 2018, 11:21:25.866032 am
UUID: f19cf5db-fa17-4984-8f08-aac504dd5d67
Ancestors: VMMaker.oscog-cb.2411

- Fixed compilation errors and some warnings.

=============== Diff against VMMaker.oscog-cb.2411 ===============

Item was changed:
  ----- Method: SpurMemoryManager>>storePointer:ofFreeChunk:withValue: (in category 'heap management') -----
  storePointer: fieldIndex ofFreeChunk: objOop withValue: valuePointer
 
  self assert: (self isFreeObject: objOop).
  self assert: (valuePointer = 0 or: [self isFreeObject: valuePointer]).
  self assert: (fieldIndex >= 0 and: [fieldIndex < (self numSlotsOfAny: objOop)
+ or: [fieldIndex = 0 "forwarders and free objs"
+ or: [fieldIndex = 1 and: [self wordSize = 4]]]]).
- or: [fieldIndex = 0 "forwarders and free objs"]
- or: [fieldIndex = 1 and: [self wordSize = 4]]]).
 
  ^self
  longAt: objOop + self baseHeaderSize + (fieldIndex << self shiftForWord)
  put: valuePointer!

Item was changed:
  ----- Method: SpurMemoryManager>>unlinkFreeChunk:atIndex:bytesBigEnoughForPrevPointer: (in category 'free space') -----
  unlinkFreeChunk: chunk atIndex: index bytesBigEnoughForPrevPointer: bytesBigEnoughForPrevPointer
  "Unlink and answer a small chunk from one of the fixed size freeLists"
  <inline: true> "inlining is important because bytesBigEnoughForPrevPointer is often true"
  |next|
  self assert: ((self bytesInObject: chunk) = (index * self allocationUnit)
  and: [index > 1 "a.k.a. (self bytesInObject: chunk) > self allocationUnit"
  and: [(self startOfObject: chunk) = chunk]]).
+
+ "For some reason the assertion is not compiled correctly"
+ self cCode: '' inSmalltalk: [self assert: (self bytesBigEnoughForPrevPointer:(self bytesInObject: chunk)) = bytesBigEnoughForPrevPointer].
+
- self assert: (self bytesBigEnoughForPrevPointer:(self bytesInObject: chunk)) = bytesBigEnoughForPrevPointer.
  freeLists
  at: index
  put: (next := self
  fetchPointer: self freeChunkNextIndex
  ofFreeChunk: chunk).
  (bytesBigEnoughForPrevPointer and: [next ~= 0]) ifTrue:
  [self storePointer: self freeChunkPrevIndex ofFreeChunk: next withValue: 0].
  ^chunk!

Item was changed:
  ----- Method: SpurMemoryManager>>unlinkFreeChunk:chunkBytes: (in category 'free space') -----
  unlinkFreeChunk: freeChunk chunkBytes: chunkBytes
  "Unlink a free object from the free lists. Do not alter totalFreeOldSpace. Used for coalescing."
  | index node next prev |
  index := chunkBytes / self allocationUnit.
 
  "Pathological 64 bits case - size 1 - single linked list"
  (self bytesBigEnoughForPrevPointer: chunkBytes) ifFalse:
  [node := freeLists at: index.
  prev := 0.
  [node ~= 0] whileTrue:
  [self assert: node = (self startOfObject: node).
  self assertValidFreeObject: node.
  next := self fetchPointer: self freeChunkNextIndex ofFreeChunk: node.
  node = freeChunk ifTrue:
  [prev = 0
  ifTrue: [self unlinkFreeChunk: freeChunk atIndex: index bytesBigEnoughForPrevPointer: false]
  ifFalse: [self setNextFreeChunkOf: prev withValue: next bytesBigEnoughForPrevPointer: false].
+ ^freeChunk].
- ^self].
  prev := node.
  node := next].
  self error: 'freeChunk not found in free list of size 1'].
 
  prev := self fetchPointer: self freeChunkPrevIndex ofFreeChunk: freeChunk.
  "Has prev element: update double linked list"
  prev ~= 0 ifTrue:
  [self
  setNextFreeChunkOf: prev
  withValue: (self fetchPointer: self freeChunkNextIndex ofFreeChunk: freeChunk)
  chunkBytes: chunkBytes.
+ ^freeChunk].
- ^self].
 
  "Is the beginning of a list"
  "Small chunk"
+ (index < self numFreeLists and: [1 << index <= freeListsMask]) ifTrue:
+ [self unlinkFreeChunk: freeChunk atIndex: index bytesBigEnoughForPrevPointer: true.
+ ^freeChunk].
- (index < self numFreeLists and: [1 << index <= freeListsMask]) ifTrue: [
- ^self unlinkFreeChunk: freeChunk atIndex: index bytesBigEnoughForPrevPointer: true ].
  "Large chunk"
  next := self fetchPointer: self freeChunkNextIndex ofFreeChunk: freeChunk.
  next = 0
  ifTrue: "no list; remove the interior node"
  [self unlinkSolitaryFreeTreeNode: freeChunk]
  ifFalse: "list; replace node with it"
+ [self inFreeTreeReplace: freeChunk with: next].
+ ^freeChunk
- [self inFreeTreeReplace: freeChunk with: next]
 
 
 
  !