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

commits at source.squeak.org commits at source.squeak.org
Thu Oct 16 20:41:16 UTC 2014


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

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

Name: VMMaker.oscog-eem.904
Author: eem
Time: 16 October 2014, 1:38:11.453 pm
UUID: 6754ddfb-7fdd-46ea-9823-4e32b4454d70
Ancestors: VMMaker.oscog-eem.903

Include the AioPlugin in the Newspeak VMs; recent
reports indicate it's essential to good performance
in recent versions of OSProcessPlugin.

A little more progress on the Spur image segment
prms.

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

Item was added:
+ ----- Method: SpurMemoryManager>>markAllExceptTransitiveClosureOf: (in category 'image segment in/out') -----
+ markAllExceptTransitiveClosureOf: arrayOfRoots
+ 	"Mark all objects in the system except those in arrayOfRoots and objects only reachable from arrayOfRoots.
+ 	 This is how the image segment writing primitive computes the set of objects to include in a segment."
+ 
+  	self assert: self allObjectsUnmarked.
+ 	self markObjectsIn: arrayOfRoots.
+ 	self markObjects.
+ 	self unmarkObjectsIn: arrayOfRoots.!

Item was changed:
  ----- Method: SpurMemoryManager>>storeImageSegmentInto:outPointers:roots: (in category 'image segment in/out') -----
  storeImageSegmentInto: segmentWordArray outPointers: outPointerArray roots: arrayOfRoots
  	"This primitive is called from Squeak as...
  		<imageSegment> storeSegmentFor: arrayOfRoots into: aWordArray outPointers: anArray."
  
  "This primitive will store a binary image segment (in the same format as the Squeak image file) of the receiver and every object in its proper tree of subParts (ie, that is not refered to from anywhere else outside the tree).  All pointers from within the tree to objects outside the tree will be copied into the array of outpointers.  In their place in the image segment will be an oop equal to the offset in the outPointer array (the first would be 4). but with the high bit set."
  
  "The primitive expects the array and wordArray to be more than adequately long.  In this case it returns normally, and truncates the two arrays to exactly the right size.  To simplify truncation, both incoming arrays are required to have large headers (i.e. be 256 words long or larger).  If either array is too small, the primitive will fail, but in no other case.
  
  During operation of the primitive, it is necessary to convert from both internal and external oops to their mapped values.  To make this fast, the original objects in question are forwarded to the mapped values.  Tables are kept of both kinds of oops.  Note that markObjects eliminates forwarding pointers, so there will be no forwarding pointers in the object graph once objects have been marked.
  
  To be specific, there are two similar tables, the outPointer array, and one in the upper eight of the segmentWordArray.  Each grows oops from the bottom up.
  
  In case of either success or failure, the headers must be restored.  In the event of primitive failure, the table of outPointers must also be nilled out (since the garbage in the high half will not have been discarded)."
  
+ 	| endSeg firstIn firstOut lastIn lastOut limitSeg scanned newSegLimit unmarkedClasses |
- 	| endSeg firstIn firstOut lastIn lastOut limitSeg newSegLimit unmarkedClasses |
  	true ifTrue: [^PrimErrUnsupported] ifFalse: [
  
  	((self hasOverflowHeader: outPointerArray)						"Must have 128-bit header"
  	and: [self hasOverflowHeader: segmentWordArray]) ifFalse:		"Must have 128-bit header"
  		[^PrimErrGenericFailure].
  
  	firstOut := outPointerArray + self baseHeaderSize.
  	lastOut := firstOut - self bytesPerOop.
  
  	limitSeg := segmentWordArray + self baseHeaderSize.
  	endSeg := segmentWordArray + (self addressAfter: segmentWordArray).
  
  	"Allocate top 1/8 of segment for table of internal oops"
  	firstIn := endSeg - ((self numSlotsOf: segmentWordArray) // 8).  "Take 1/8 of seg"
  	lastIn := firstIn - self bytesPerOop.
  
+ 	"N.B.  A side effect of this marking is that all forwarders are followed,
+ 	 so while forwarders may exist in te heap they will *not* be reachable."
+ 	self markAllExceptTransitiveClosureOf: arrayOfRoots.
- 	self assert: self allObjectsUnmarked.
- 	self markObjectsIn: arrayOfRoots.
- 	self markObjects.
- 	self unmarkObjectsIn: arrayOfRoots.
  
  	"All external objects, and only they, are now marked."
  	unmarkedClasses := self arrayOfUnmarkedClasses.
  	(self isImmediate: unmarkedClasses) ifTrue:
  		[^PrimErrGenericFailure].
  
  	"Write a version number for byte order and version check, followed by the number of classes."
  	limitSeg >= endSeg ifTrue: [^PrimErrGenericFailure].
  	self long32At: limitSeg put: self imageSegmentVersion.
  	self long32At: limitSeg + 4 put: (self numSlotsOf: unmarkedClasses).
+ 	scanned := limitSeg := limitSeg + 8.
- 	limitSeg := limitSeg + 8.
  
  	"If there are any classes then copy them into the segment, and forward their oop."
  	(self numSlotsOf: unmarkedClasses) > 0 ifTrue:
  		[((lastIn := lastIn + self bytesPerOop) >= endSeg
  		 or: [0 = (newSegLimit := self copyObj: arrayOfRoots toSegment: segmentWordArray addr: limitSeg stopAt: firstIn saveOopAt: lastIn)]) ifTrue:
  			[lastIn := lastIn - self bytesPerWord.
  			self restoreObjectsFrom: firstIn to: lastIn from: segmentWordArray + self baseHeaderSize to: limitSeg.
  			self fillObj: outPointerArray numSlots: (self numSlotsOf: outPointerArray) with: nilObj.
  			^PrimErrGenericFailure].
  		limitSeg := newSegLimit].
  
  	"Copy the array of roots into the segment, and forward its oop."
  	((lastIn := lastIn + self bytesPerOop) >= endSeg
  	 or: [0 = (newSegLimit := self copyObj: arrayOfRoots toSegment: segmentWordArray addr: limitSeg stopAt: firstIn saveOopAt: lastIn)]) ifTrue:
  		[lastIn := lastIn - self bytesPerWord.
  		self restoreObjectsFrom: firstIn to: lastIn from: segmentWordArray + self baseHeaderSize to: limitSeg.
  		self fillObj: outPointerArray numSlots: (self numSlotsOf: outPointerArray) with: nilObj.
  		^PrimErrGenericFailure].
  	limitSeg := newSegLimit.
  
+ 	"Now traverse the objects copied to the segment so far, copying unmarked objects into the segment.
+ 	 This is essentially the same algorithm as the breadth-first copying algorithm in scavenging."
+ 	scanned := self objectStartingAt: scanned.
+ 	[scanned < limitSeg] whileTrue:	
+ 		[1 to: (self numPointerSlotsOf: scanned) do:
+ 			[:i| | oop |
+ 			 oop := self fetchPointer: i ofObject: scanned.
+ 			 ((self isImmediate: oop) or: [(self isForwarded: oop) or: [self isMarked: oop]]) ifFalse:
+ 				[((lastIn := lastIn + self bytesPerOop) >= endSeg
+ 				  or: [0 = (newSegLimit := self copyObj: oop toSegment: segmentWordArray addr: limitSeg stopAt: firstIn saveOopAt: lastIn)]) ifTrue:
+ 					[lastIn := lastIn - self bytesPerWord.
+ 					self restoreObjectsFrom: firstIn to: lastIn from: segmentWordArray + self baseHeaderSize to: limitSeg.
+ 					self fillObj: outPointerArray numSlots: (self numSlotsOf: outPointerArray) with: nilObj.
+ 					^PrimErrGenericFailure].
+ 				 limitSeg := newSegLimit]].
+ 		scanned := self objectAfter: scanned].
- 	"Now traverse arrayOfRoots, copying unmarked objects into the segment"
  
  	"Now the primitive can not fail; traverse the objects in the segment, unforwarding the originals and mapping external oops."
  	self flag: 'you are here']!

Item was changed:
  ----- Method: VMMaker class>>generateNewspeakCogVM (in category 'configurations') -----
  generateNewspeakCogVM
  	^VMMaker
  		generate: CoInterpreter
  		and: StackToRegisterMappingCogit
  		with: #(	NewspeakVM true
  				MULTIPLEBYTECODESETS true)
  		to: (FileDirectory default pathFromURI: self sourceTree, '/nscogsrc')
  		platformDir: (FileDirectory default pathFromURI: self sourceTree, '/platforms')
+ 		including:#(	AioPlugin AsynchFilePlugin BMPReadWriterPlugin BalloonEnginePlugin BitBltSimulation DeflatePlugin DSAPlugin DropPlugin
- 		including:#(	AsynchFilePlugin BMPReadWriterPlugin BalloonEnginePlugin BitBltSimulation DeflatePlugin DSAPlugin DropPlugin
  					FileCopyPlugin FilePlugin FloatArrayPlugin FloatMathPlugin ImmX11Plugin JPEGReadWriter2Plugin
  					JPEGReaderPlugin LargeIntegersPlugin Matrix2x3Plugin MiscPrimitivePlugin NewsqueakIA32ABIPlugin
  					RePlugin SecurityPlugin SocketPlugin SoundPlugin SqueakSSLPlugin SurfacePlugin
  					UUIDPlugin UnixOSProcessPlugin VMProfileLinuxSupportPlugin VMProfileMacSupportPlugin Win32OSProcessPlugin)!



More information about the Vm-dev mailing list