Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2439.mcz ==================== Summary ==================== Name: VMMaker.oscog-eem.2439 Author: eem Time: 9 September 2018, 10:09:01.654985 am UUID: f6046fd7-5079-4f12-8e79-bd515107612f Ancestors: VMMaker.oscog-eem.2438 Slang: more Pharo/Squeak compatibiltiy refactoring. =============== Diff against VMMaker.oscog-eem.2438 =============== Item was changed: ----- Method: CCodeGenerator>>addMethodFor:selector: (in category 'utilities') ----- addMethodFor: aClass selector: selector "Add the given method to the code base and answer its translation or nil if it shouldn't be translated." | method tmethod | method := aClass compiledMethodAt: selector. (method pragmaAt: #doNotGenerate) ifNotNil: ["only remove a previous method if this one overrides it, i.e. this is a subclass method. If the existing method is in a different hierarchy this method must be merely a redeirect." (methods at: selector ifAbsent: []) ifNotNil: [:tm| (aClass includesBehavior: tm definingClass) ifTrue: [self removeMethodForSelector: selector]]. ^nil]. method isSubclassResponsibility ifTrue: [^nil]. (self shouldIncludeMethodFor: aClass selector: selector) ifFalse: [^nil]. tmethod := self compileToTMethodSelector: selector in: aClass. "Even though we exclude initialize methods, we must consider their global variable usage, otherwise globals may be incorrectly localized." selector == #initialize ifTrue: [self checkForGlobalUsage: (tmethod allReferencedVariablesUsing: self) in: tmethod. ^nil]. self addMethod: tmethod. "If the method has a macro then add the macro. But keep the method for analysis purposes (e.g. its variable accesses)." (method pragmaAt: #cmacro:) ifNotNil: [:pragma| self addMacro: (pragma argumentAt: 1) for: selector. (inlineList includes: selector) ifTrue: [inlineList := inlineList copyWithout: selector]]. (method pragmaAt: #cmacro) ifNotNil: [:pragma| | literal | "Method should be just foo ^const" self assert: (method numArgs = 0 and: [method numLiterals = 3 or: [method isQuick]]). literal := method isQuick + ifTrue: [method decompile quickMethodReturnLiteral] - ifTrue: [method decompile block statements last expr key] ifFalse: [method literalAt: 1]. self addMacro: '() ', (method isReturnField ifTrue: [literal] ifFalse: [self cLiteralFor: literal value name: method selector]) for: selector. (inlineList includes: selector) ifTrue: [inlineList := inlineList copyWithout: selector]]. ^tmethod! Item was changed: ----- Method: CCodeGenerator>>nonStructClassesForTranslationClasses: (in category 'utilities') ----- nonStructClassesForTranslationClasses: classes "Answer in superclass order (any superclass precedes any subclass) the ancilliaryClasses that are not struct classes for all the given classes." | nonStructClasses | nonStructClasses := OrderedCollection new. classes do: [:aTranslationClass| ([aTranslationClass ancilliaryClasses] on: MessageNotUnderstood do: [:ex| ex message selector == #ancilliaryClasses ifTrue: [#()] ifFalse: [ex pass]]) do: [:class| (vmClass isNil or: [vmClass isAcceptableAncilliaryClass: class]) ifTrue: [(class isStructClass or: [(nonStructClasses includes: class) or: [classes includes: class]]) ifFalse: [nonStructClasses addLast: class]]]]. + ^self superclassOrder: nonStructClasses! - ^ChangeSet superclassOrder: nonStructClasses! Item was changed: ----- Method: CCodeGenerator>>structClassesForTranslationClasses: (in category 'utilities') ----- structClassesForTranslationClasses: classes "Answer in superclass order (any superclass precedes any subclass) the ancilliaryClasses that are struct classes for all the given classes." | theStructClasses | theStructClasses := OrderedCollection new. classes do: [:aTranslationClass| ([aTranslationClass ancilliaryClasses] on: MessageNotUnderstood do: [:ex| ex message selector == #ancilliaryClasses ifTrue: [#()] ifFalse: [ex pass]]) do: [:class| (class isStructClass and: [(vmClass isNil or: [vmClass isAcceptableAncilliaryClass: class]) and: [(theStructClasses includes: class) not]]) ifTrue: [theStructClasses addLast: class]]]. + ^self superclassOrder: theStructClasses! - ^ChangeSet superclassOrder: theStructClasses! Item was added: + ----- Method: CCodeGenerator>>superclassOrder: (in category 'utilities') ----- + superclassOrder: classes + ^[ChangeSet superclassOrder: classes] "Squeak" + on: MessageNotUnderstood + do: [ :ex| + ex message selector == #superclassOrder: ifFalse: + [ex pass]. + Class superclassOrder: classes] "Pharo"! Item was added: + ----- Method: MethodNode>>quickMethodReturnLiteral (in category '*VMMaker-C translation') ----- + quickMethodReturnLiteral + ^self block statements last expr key! |
Free forum by Nabble | Edit this page |