Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2719.mcz ==================== Summary ==================== Name: VMMaker.oscog-eem.2719 Author: eem Time: 23 February 2020, 3:39:58.674739 pm UUID: e40f3e94-3a54-411b-9613-5d19114ea131 Ancestors: VMMaker.oscog-eem.2718 Cogit: Get the ordering of the ClosedPIC case labels to agree with Tim R's lovely reordering that simplified extending closed PICs. =============== Diff against VMMaker.oscog-eem.2718 =============== Item was changed: ----- Method: Cogit>>disassembleMethod:on: (in category 'disassembly') ----- disassembleMethod: surrogateOrAddress on: aStream <doNotGenerate> | cogMethod mapEntries codeRanges | cogMethod := surrogateOrAddress isInteger ifTrue: [self cogMethodSurrogateAt: surrogateOrAddress] ifFalse: [surrogateOrAddress]. cogMethod cmType = CMBlock ifTrue: [^self disassembleMethod: cogMethod cmHomeMethod on: aStream]. (disassemblingMethod isNil and: [self class initializationOptions at: #relativeAddressDisassembly ifAbsent: [false]]) ifTrue: [^[disassemblingMethod := cogMethod. self disassembleMethod: surrogateOrAddress on: aStream] ensure: [disassemblingMethod := nil]]. self printMethodHeader: cogMethod on: aStream. mapEntries := Dictionary new. (cogMethod cmType = CMMethod and: [cogMethod cmIsFullBlock]) ifFalse: [mapEntries at: cogMethod asInteger + cmEntryOffset put: 'entry']. cogMethod cmType = CMMethod ifTrue: [cogMethod cmIsFullBlock ifTrue: [mapEntries at: cogMethod asInteger + cbNoSwitchEntryOffset put: 'noSwitchEntry'] ifFalse: [mapEntries at: cogMethod asInteger + cmNoCheckEntryOffset put: 'noCheckEntry']]. cogMethod cmType = CMClosedPIC + ifTrue: "Since Tim R's lovely work on Closed PICs, PIC cases go backwards..." + [mapEntries at: cogMethod asInteger + firstCPICCaseOffset put: 'ClosedPICCase', MaxCPICCases printString. - ifTrue: - [mapEntries at: cogMethod asInteger + firstCPICCaseOffset put: 'ClosedPICCase0'. 1 to: MaxCPICCases - 1 do: [:i| mapEntries at: cogMethod asInteger + firstCPICCaseOffset + (i * cPICCaseSize) + put: 'ClosedPICCase', (MaxCPICCases - i) printString]] - put: 'ClosedPICCase', i printString]] ifFalse: [self mapFor: cogMethod performUntil: #collectMapEntry:address:into: arg: mapEntries]. NewspeakVM ifTrue: [objectRepresentation canPinObjects ifFalse: [mapEntries keys do: [:a| (mapEntries at: a) = #IsNSSendCall ifTrue: [mapEntries at: a + backEnd jumpShortByteSize put: {'Class'. #disassembleCachedOop:. (objectMemory wordSize)}; at: a + backEnd jumpShortByteSize + objectMemory bytesPerOop put: {'ImplicitReceiver'. #disassembleCachedOop:. (objectMemory wordSize)}]]]]. "This would all be far more elegant and simple if we used blocks. But there are no blocks in C and the basic enumerators here need to be used in the real VM. Apologies." (codeRanges := self codeRangesFor: cogMethod) do: [:range| (cogMethod cmType = CMMethod) ifTrue: [mapEntries keysAndValuesDo: [:mcpc :label| | bcpc selectorOrNone | (((range includes: mcpc) or: [range last + 1 = mcpc]) and: [(AnnotationsWithBytecodePCs includes: label) and: [range cogMethod stackCheckOffset > 0]]) ifTrue: [bcpc := self bytecodePCFor: mcpc startBcpc: range startpc in: range cogMethod. bcpc ~= 0 ifTrue: [label = #IsSendCall ifTrue: [selectorOrNone := (self selectorForSendAt: mcpc annotation: IsSendCall in: cogMethod methodObject). (selectorOrNone isInteger and: [objectMemory addressCouldBeOop: selectorOrNone]) ifTrue: [selectorOrNone := objectMemory stringOf: selectorOrNone]. selectorOrNone := ' ', selectorOrNone] ifFalse: [selectorOrNone := '']. mapEntries at: mcpc put: label, selectorOrNone, ' bc ', bcpc printString, '/', (bcpc + 1) printString]]]]. (cogMethod blockEntryOffset ~= 0 and: [range first = (cogMethod blockEntryOffset + cogMethod asInteger)]) ifTrue: [aStream nextPutAll: 'blockEntry:'; cr. self blockDispatchFor: cogMethod perform: #disassemble:from:to:arg: arg: aStream] ifFalse: [range first > (cogMethod address + cmNoCheckEntryOffset) ifTrue: [self printMethodHeader: range cogMethod on: aStream]. self maybeNoteStartpcFor: range. self disassembleFrom: range first to: range last labels: mapEntries on: aStream]]. aStream nextPutAll: 'startpc: '; print: codeRanges first startpc; cr. (cogMethod cmType = CMMethod or: [cogMethod cmType = CMOpenPIC]) ifTrue: [[self mapFor: cogMethod performUntil: #printMapEntry:mcpc:args: arg: { aStream. codeRanges. cogMethod }] on: AssertionFailure do: [:ex| ex primitiveChangeClassTo: ResumableVMError basicNew. ":) :) :)" ex resume: nil]]. ^cogMethod! |
Ho hum, don't' forget to do it backwards Virignia :-) > On 2020-02-23, at 3:40 PM, [hidden email] wrote: > > + ifTrue: "Since Tim R's lovely work on Closed PICs, PIC cases go backwards..." tim -- tim Rowledge; [hidden email]; http://www.rowledge.org/tim Useful Latin Phrases:- Vescere bracis meis. = Eat my shorts. |
Free forum by Nabble | Edit this page |