Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.433.mcz ==================== Summary ==================== Name: VMMaker.oscog-eem.433 Author: eem Time: 3 October 2013, 5:28:26.615 pm UUID: a3ae4b63-36dd-4fef-918a-5f92b009851a Ancestors: VMMaker.oscog-eem.432 Implement CogObjectRepresentationFor32BitSpur>>genInnerPrimitiveNew:. Recategorize the format definitions so there's a convenient list of them. =============== Diff against VMMaker.oscog-eem.432 =============== Item was added: + ----- Method: CogObjectRepresentationFor32BitSpur>>genGetHashFieldNonImmOf:into: (in category 'compile abstract instructions') ----- + genGetHashFieldNonImmOf: instReg into: destReg + "Fetch the instance's identity hash into destReg, unencoded." + cogit MoveMw: 4 r: instReg R: destReg. + cogit AndCq: objectMemory identityHashHalfWordMask R: destReg. + ^0! Item was added: + ----- Method: CogObjectRepresentationFor32BitSpur>>genInnerPrimitiveNew: (in category 'primitive generators') ----- + genInnerPrimitiveNew: retNoffset + "Implement primitiveNew for convenient cases: + - the receiver has a hash + - the receiver is fixed size (excluding ephemerons to save instructions & miniscule time) + - single word header/num slots < numSlotsMask + - the result fits in eden" + + | halfHeaderReg instSpecReg + jumpUnhashed jumpVariableOrEphemeron jumpNoSpace jumpTooBig jumpHasSlots fillLoop skip | + <var: 'skip' type: #'AbstractInstruction *'> + <var: 'fillLoop' type: #'AbstractInstruction *'> + <var: 'jumpTooBig' type: #'AbstractInstruction *'> + <var: 'jumpHasSlots' type: #'AbstractInstruction *'> + <var: 'jumpNoSpace' type: #'AbstractInstruction *'> + <var: 'jumpUnhashed' type: #'AbstractInstruction *'> + <var: 'jumpVariableOrEphemeron' type: #'AbstractInstruction *'> + + "half header will contain classIndex (class's hash) and format, then fixed size and eventually nilObject" + halfHeaderReg := SendNumArgsReg. + "inst spec will hold class's instance specification and then byte size and finally numSlots half of header" + instSpecReg := ClassReg. + + "get freeStart as early as possible so as not to wait later..." + cogit MoveAw: objectMemory freeStartAddress R: Arg1Reg. + "get class's hash & fail if 0" + self genGetHashFieldNonImmOf: ReceiverResultReg into: halfHeaderReg. + jumpUnhashed := cogit JumpZero: 0. + "get class's format inst var for both inst spec (format field) and num fixed fields" + self genLoadSlot: InstanceSpecificationIndex sourceReg: ReceiverResultReg destReg: TempReg. + self genConvertSmallIntegerToIntegerInScratchReg: TempReg. + cogit MoveR: TempReg R: instSpecReg. + cogit LogicalShiftRightCq: objectMemory fixedFieldsFieldWidth R: TempReg. + cogit AndCq: objectMemory formatMask R: TempReg. + cogit AndCq: objectMemory fixedFieldsOfClassFormatMask R: instSpecReg. + "fail if not fixed or if ephemeron (rare beasts so save the cycles)" + cogit CmpCq: objectMemory nonIndexablePointerFormat R: TempReg. + jumpVariableOrEphemeron := cogit JumpAbove: 0. + cogit CmpCq: objectMemory numSlotsMask R: instSpecReg. + jumpTooBig := cogit JumpAboveOrEqual: 0. + "Add format to classIndex/format half header; other word contains numSlots" + cogit LogicalShiftLeftCq: objectMemory formatShift R: TempReg. + cogit AddR: TempReg R: halfHeaderReg. + "write half header now; it frees halfHeaderReg" + cogit MoveR: halfHeaderReg Mw: 0 r: Arg1Reg. + "save unrounded numSlots for header" + cogit MoveR: instSpecReg R: halfHeaderReg. + "compute byte size; remember 0-sized objects still need 1 slot & allocation is + rounded up to 8 bytes." + cogit CmpCq: 0 R: instSpecReg. + jumpHasSlots := cogit JumpNonZero: 0. + cogit MoveCq: objectMemory baseHeaderSize * 2 R: instSpecReg. + skip := cogit Jump: 0. + "round up to allocationUnit" + jumpHasSlots jmpTarget: + (cogit MoveR: instSpecReg R: TempReg). + cogit AndCq: 1 R: TempReg. + cogit AddR: TempReg R: instSpecReg. + cogit AddCq: objectMemory baseHeaderSize / objectMemory wordSize R: instSpecReg. + cogit LogicalShiftLeftCq: objectMemory shiftForWord R: instSpecReg. + skip jmpTarget: "get scavengeThreshold (have freeStart already)" + (cogit MoveAw: objectMemory scavengeThresholdAddress R: TempReg). + "shift halfHeaderReg to put numSlots in correct place" + cogit LogicalShiftLeftCq: objectMemory numSlotsHalfShift R: halfHeaderReg. + "check if allocation fits" + cogit SubR: Arg1Reg R: TempReg. + cogit CmpR: TempReg R: instSpecReg. + jumpNoSpace := cogit JumpAbove: 0. + "get result, increment freeStart and write it back. Arg1Reg holds new freeStart, the limit of the object" + cogit MoveR: Arg1Reg R: ReceiverResultReg. + cogit AddR: instSpecReg R: Arg1Reg. + cogit MoveR: Arg1Reg Aw: objectMemory freeStartAddress. + "write other half of header (numSlots/identityHash)" + cogit MoveR: halfHeaderReg Mw: 4 r: ReceiverResultReg. + "now fill" + cogit LoadEffectiveAddressMw: objectMemory baseHeaderSize r: ReceiverResultReg R: instSpecReg. + cogit MoveCq: objectMemory nilObject R: halfHeaderReg. + "at least two words; so can make this a [fill 2 words. reached limit?] whileFalse" + fillLoop := + cogit MoveR: halfHeaderReg Mw: 0 r: instSpecReg. + cogit MoveR: halfHeaderReg Mw: 4 r: instSpecReg. + cogit AddCq: 8 R: instSpecReg. + cogit CmpR: Arg1Reg R: instSpecReg. + cogit JumpBelow: fillLoop. + cogit RetN: retNoffset. + + jumpUnhashed jmpTarget: + (jumpVariableOrEphemeron jmpTarget: + (jumpTooBig jmpTarget: + (jumpNoSpace jmpTarget: cogit Label))). + + ^0! Item was added: + ----- Method: CogObjectRepresentationForSpur>>genInnerPrimitiveNew: (in category 'primitive generators') ----- + genInnerPrimitiveNew: retNoffset + "Implement primitiveNew for convenient cases: + - the receiver has a hash + - the receiver is fixed size + - the result fits in eden" + + self subclassResponsibility! Item was changed: + ----- Method: SpurMemoryManager>>arrayFormat (in category 'header formats') ----- - ----- Method: SpurMemoryManager>>arrayFormat (in category 'header format') ----- arrayFormat ^2! Item was changed: + ----- Method: SpurMemoryManager>>ephemeronFormat (in category 'header formats') ----- - ----- Method: SpurMemoryManager>>ephemeronFormat (in category 'header format') ----- ephemeronFormat ^5! Item was changed: + ----- Method: SpurMemoryManager>>firstByteFormat (in category 'header formats') ----- - ----- Method: SpurMemoryManager>>firstByteFormat (in category 'header format') ----- firstByteFormat ^16! Item was changed: + ----- Method: SpurMemoryManager>>firstCompiledMethodFormat (in category 'header formats') ----- - ----- Method: SpurMemoryManager>>firstCompiledMethodFormat (in category 'header format') ----- firstCompiledMethodFormat ^24! Item was changed: + ----- Method: SpurMemoryManager>>firstLongFormat (in category 'header formats') ----- - ----- Method: SpurMemoryManager>>firstLongFormat (in category 'header format') ----- firstLongFormat ^10! Item was changed: + ----- Method: SpurMemoryManager>>firstShortFormat (in category 'header formats') ----- - ----- Method: SpurMemoryManager>>firstShortFormat (in category 'header format') ----- firstShortFormat ^12! Item was changed: + ----- Method: SpurMemoryManager>>firstStringyFakeFormat (in category 'header formats') ----- - ----- Method: SpurMemoryManager>>firstStringyFakeFormat (in category 'header format') ----- firstStringyFakeFormat "A fake format for the interpreter used to mark indexable strings in the interpreter's at cache. This is larger than any format." ^32! Item was changed: + ----- Method: SpurMemoryManager>>forwardedFormat (in category 'header formats') ----- - ----- Method: SpurMemoryManager>>forwardedFormat (in category 'header format') ----- forwardedFormat "A special format used by the GC to follow only the first pointer." ^7! Item was changed: + ----- Method: SpurMemoryManager>>indexablePointersFormat (in category 'header formats') ----- - ----- Method: SpurMemoryManager>>indexablePointersFormat (in category 'header format') ----- indexablePointersFormat ^3! Item was changed: + ----- Method: SpurMemoryManager>>lastPointerFormat (in category 'header formats') ----- - ----- Method: SpurMemoryManager>>lastPointerFormat (in category 'header format') ----- lastPointerFormat ^5! Item was changed: + ----- Method: SpurMemoryManager>>nonIndexablePointerFormat (in category 'header formats') ----- - ----- Method: SpurMemoryManager>>nonIndexablePointerFormat (in category 'header format') ----- nonIndexablePointerFormat ^1! Item was changed: + ----- Method: SpurMemoryManager>>sixtyFourBitIndexableFormat (in category 'header formats') ----- - ----- Method: SpurMemoryManager>>sixtyFourBitIndexableFormat (in category 'header format') ----- sixtyFourBitIndexableFormat ^9! Item was changed: + ----- Method: SpurMemoryManager>>weakArrayFormat (in category 'header formats') ----- - ----- Method: SpurMemoryManager>>weakArrayFormat (in category 'header format') ----- weakArrayFormat ^4! |
Free forum by Nabble | Edit this page |