[Vm-dev] VM Maker: VMMaker.oscog-eem.899.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Oct 13 23:21:12 UTC 2014


Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.899.mcz

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

Name: VMMaker.oscog-eem.899
Author: eem
Time: 13 October 2014, 4:17:43.268 pm
UUID: 494bc6dc-a8af-4d43-8858-7abf9968b9b4
Ancestors: VMMaker.oscog-eem.898

Fix signed/unsigned comparisons with freeStart in V3.

=============== Diff against VMMaker.oscog-eem.898 ===============

Item was changed:
  ----- Method: NewObjectMemory>>allObjectsDo: (in category 'object enumeration') -----
  allObjectsDo: aBlock
  	<inline: true>
  	| oop |
  	oop := self firstObject.
+ 	[oop asUnsignedInteger < freeStart] whileTrue:
- 	[oop < freeStart] whileTrue:
  		[(self isFreeObject: oop) ifFalse:
  			[aBlock value: oop].
  		 oop := self objectAfter: oop]!

Item was changed:
  ----- Method: NewObjectMemory>>allObjectsDoSafely: (in category 'object enumeration') -----
  allObjectsDoSafely: aBlock
  	<inline: true>
  	| oop |
  	oop := self firstObject.
+ 	[oop asUnsignedInteger < freeStart] whileTrue:
- 	[oop < freeStart] whileTrue:
  		[(self isFreeObject: oop) ifFalse:
  			[aBlock value: oop].
  		 oop := self objectAfterWhileForwarding: oop]!

Item was changed:
  ----- Method: NewObjectMemory>>safeObjectAfter: (in category 'object enumeration') -----
  safeObjectAfter: oop 
  	"Return the object or start of free space immediately following the 
  	 given object or free chunk in memory. Return freeStart when
  	 enumeration is complete.  This is for assertion checking only."
  	| sz |
  	<asmLabel: false>
  	(self isFreeObject: oop)
  		ifTrue: [sz := self sizeOfFree: oop]
  		ifFalse: [sz := self sizeBitsOf: oop].
+ 	^(oop + sz) asUnsignedInteger >= freeStart
- 	^oop + sz >= freeStart
  		ifTrue: [freeStart]
  		ifFalse: [self oopFromChunk: oop + sz]!

Item was changed:
  ----- Method: NewObjectMemory>>safePrintStringOf: (in category 'debug printing') -----
  safePrintStringOf: oop
  	"Version of printStringOf: that copes with forwarding during garbage collection."
  	| fmt header cnt i |
  	<inline: false>
  	(self isIntegerObject: oop) ifTrue:
  		[^nil].
+ 	(self oop: oop isGreaterThanOrEqualTo: self startOfMemory andLessThan: freeStart) ifFalse:
- 	(oop between: self startOfMemory and: freeStart) ifFalse:
  		[^nil].
  	(oop bitAnd: (BytesPerWord - 1)) ~= 0 ifTrue:
  		[^nil].
  	header := self headerWhileForwardingOf: oop.
  	fmt := self formatOfHeader: header.
  	fmt < 8 ifTrue: [ ^nil ].
  
  	cnt := 100 min: (self lengthOf: oop baseHeader: header format: fmt).
  	i := 0.
  
  	[i < cnt] whileTrue:
  		[self printChar: (self fetchByte: i ofObject: oop).
  		 i := i + 1].
  	coInterpreter flush.
  	^oop!

Item was changed:
  ----- Method: NewObjectMemory>>unmarkAllObjects (in category 'primitive support') -----
  unmarkAllObjects
  	| oop hdr |
  	oop := self firstObject.
+ 	[oop asUnsignedInteger < freeStart] whileTrue:
- 	[oop < freeStart] whileTrue:
  		[(self isFreeObject: oop) ifFalse:
  			[hdr := self baseHeader: oop.
  			 (hdr bitAnd: MarkBit) ~= 0 ifTrue:
  				[self baseHeader: oop put: (hdr bitAnd: AllButMarkBit)]].
  		 oop := self objectAfter: oop]!

Item was changed:
  ----- Method: ObjectMemory>>allObjectsDo: (in category 'object enumeration') -----
  allObjectsDo: aBlock
  	<inline: true>
  	| oop |
  	oop := self firstObject.
+ 	[oop asUnsignedInteger < freeBlock] whileTrue:
- 	[oop < freeBlock] whileTrue:
  		[(self isFreeObject: oop) ifFalse:
  			[aBlock value: oop].
  		 oop := self objectAfter: oop]!

Item was changed:
  ----- Method: ObjectMemory>>allObjectsDoSafely: (in category 'object enumeration') -----
  allObjectsDoSafely: aBlock
  	<inline: true>
  	| oop |
  	oop := self firstObject.
+ 	[oop asUnsignedInteger < freeBlock] whileTrue:
- 	[oop < freeBlock] whileTrue:
  		[(self isFreeObject: oop) ifFalse:
  			[aBlock value: oop].
  		 oop := self objectAfterWhileForwarding: oop]!

Item was changed:
  ----- Method: ObjectMemory>>okayOop: (in category 'debug support') -----
  okayOop: signedOop
  	"Verify that the given oop is legitimate. Check address, header, and size but not class."
  
  	| sz type fmt unusedBit oop |
  	<var: #oop type: #usqInt>
  	oop := self cCoerce: signedOop to: #usqInt.
  
  	"address and size checks"
  	(self isIntegerObject: oop) ifTrue: [ ^true ].
+ 	(self oop: oop isGreaterThanOrEqualTo: self startOfMemory andLessThan: endOfMemory)
- 	(oop >= self startOfMemory and: [oop < endOfMemory])
  		ifFalse: [ self error: 'oop is not a valid address'. ^false ].
  	((oop \\ BytesPerWord) = 0)
  		ifFalse: [ self error: 'oop is not a word-aligned address'. ^false ].
  	sz := self sizeBitsOf: oop.
  	(oop + sz) < endOfMemory
  		ifFalse: [ self error: 'oop size would make it extend beyond the end of memory'. ^false ].
  
  	"header type checks"
  	type := self headerType: oop.
  	type = HeaderTypeFree
  		ifTrue:  [ self error: 'oop is a free chunk, not an object'. ^false ].
  	type = HeaderTypeShort ifTrue: [
  		(self compactClassIndexOf: oop) = 0
  			ifTrue:  [ self error: 'cannot have zero compact class field in a short header'. ^false ].
  	].
  	type = HeaderTypeClass ifTrue: [
  		((oop >= BytesPerWord) and: [(self headerType: oop - BytesPerWord) = type])
  			ifFalse: [ self error: 'class header word has wrong type'. ^false ].
  	].
  	type = HeaderTypeSizeAndClass ifTrue: [
  		((oop >= (BytesPerWord*2)) and:
  		 [(self headerType: oop - (BytesPerWord*2)) = type and:
  		 [(self headerType: oop - BytesPerWord) = type]])
  			ifFalse: [ self error: 'class header word has wrong type'. ^false ].
  	].
  
  	"format check"
  	fmt := self formatOf: oop.
  	((fmt = 5) | (fmt = 7))
  		ifTrue:  [ self error: 'oop has an unknown format type'. ^false ].
  
  	"mark and root bit checks"
  	unusedBit := 16r20000000.
  	BytesPerWord = 8
  		ifTrue:
  			[unusedBit := unusedBit << 16.
  			 unusedBit := unusedBit << 16].
  	((self longAt: oop) bitAnd: unusedBit) = 0
  		ifFalse: [ self error: 'unused header bit 30 is set; should be zero'. ^false ].
  "xxx
  	((self longAt: oop) bitAnd: MarkBit) = 0
  		ifFalse: [ self error: 'mark bit should not be set except during GC' ].
  xxx"
  	((self isYoungRoot: oop) and: [oop >= youngStart])
  		ifTrue: [ self error: 'root bit is set in a young object'. ^false ].
  	^true
  !



More information about the Vm-dev mailing list