[Vm-dev] VM Maker: VMMaker.oscog-eem.879.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Sep 13 00:19:22 UTC 2014
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
==================== Summary ====================
Time: 12 September 2014, 5:11:28.11 pm
Back out of saneMethodClassAssociation assert in
initialPCForHeader:method:. Newspeak falls foul of this.
=============== Diff against VMMaker.oscog-eem.878 ===============
Item was added:
+ ----- Method: SpurMemoryManager>>imageSegmentVersion (in category 'image segment in/out') -----
+ | wholeWord |
+ "a more complex version that tells both the word reversal and the endianness of the machine
+ it came from. Low half of word is e.g. 6521. Top byte is top byte of #doesNotUnderstand: on
+ this machine. ($d on the Mac or $s on the PC)"
+ wholeWord := self long32At: (self splObj: SelectorDoesNotUnderstand) + self baseHeaderSize. "first data word, 'does'"
+ ^coInterpreter imageFormatVersion bitOr: (wholeWord bitAnd: 16rFF000000)!
Item was changed:
----- Method: SpurMemoryManager>>storeImageSegmentInto:outPointers:roots: (in category 'primitive support') -----
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.
- "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 be 256 bytes or more long (ie with 3-word headers). 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 headers of the original objects in question are replaced by the mapped values (and this is noted by adding the forbidden XX header type). Tables are kept of both kinds of oops, as well as of the original headers for restoration.
To be specific, there are two similar two-part tables, the outpointer array, and one in the upper fifth of the segmentWordArray. Each grows oops from the bottom up, and preserved headers from halfway 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 hdrBaseIn hdrBaseOut lastIn lastOut lastSeg versionOffset |
+ true ifTrue: [^PrimErrUnsupported] ifFalse: [
+ ((self hasOverflowHeader: outPointerArray) "Must have 128-bit header"
+ and: [self hasOverflowHeader: segmentWordArray]) ifFalse: "Must have 128-bit header"
+ "Use the top half of outPointers for saved headers."
+ firstOut := outPointerArray + self baseHeaderSize.
+ lastOut := firstOut - self bytesPerOop.
+ hdrBaseOut := firstOut + ((self numSlotsOf: outPointerArray) // 2 * self bytesPerOop). "top half"
+ lastSeg := segmentWordArray.
+ endSeg := segmentWordArray + (self addressAfter: segmentWordArray) - self bytesPerOop.
+ "Write a version number for byte order and version check"
+ versionOffset := self bytesPerOop.
+ lastSeg := lastSeg + versionOffset.
+ lastSeg > endSeg ifTrue: [^PrimErrGenericFailure].
+ self longAt: lastSeg put: self imageSegmentVersion.
+ "Allocate top 1/8 of segment for table of internal oops and saved headers"
+ firstIn := endSeg - ((self numSlotsOf: segmentWordArray) // 8). "Take 1/8 of seg"
+ lastIn := firstIn - self bytesPerOop.
+ hdrBaseIn := firstIn + ((self numSlotsOf: segmentWordArray) // 16). "top half of that"
+ self assert: self allObjectsUnmarked.
+ self markObjectsIn: arrayOfRoots.
+ self markObjects.
+ self unmarkObjectsIn: arrayOfRoots.
+ self flag: 'you are here']!
Item was changed:
----- Method: StackInterpreter>>initialPCForHeader:method: (in category 'compiled methods') -----
initialPCForHeader: methodHeader method: theMethod
+ "Answer the initial PC for a method; used only in methods that build a frame."
- "Answer the initial PC for a method; used only in methods that build a frame.
- Hence add an assert to check that there's a sane methodClassAssociation."
- self assert: (self saneMethodClassAssociationIn: theMethod
- numLiterals: (objectMemory literalCountOfMethodHeader: methodHeader)).
+ + ((LiteralStart + (objectMemory literalCountOfMethodHeader: methodHeader)) * objectMemory bytesPerOop)
- + ((LiteralStart + (objectMemory literalCountOfMethodHeader: methodHeader)) * BytesPerOop)
+ objectMemory baseHeaderSize!
More information about the Vm-dev