Eliot Miranda uploaded a new version of Cog to project VM Maker: http://source.squeak.org/VMMaker/Cog-eem.131.mcz ==================== Summary ==================== Name: Cog-eem.131 Author: eem Time: 5 February 2014, 3:19:18.198 pm UUID: d441f4c0-9e39-4495-802d-c5d46af4283c Ancestors: Cog-eem.130 Update SpurBootstrapMonticelloPackagePatcher to rewrite Character methods that refer to value inst var. Update references to BrowserEnvironment to RBBrowserEnvironment. Tag transformed packages with Cog package version. Add or improve comments in several Character methods. Add a method that documents which packages refactoring browser packages need to be loaded for the code editing operations in the Cog package. =============== Diff against Cog-eem.130 =============== Item was changed: - SystemOrganization addCategory: #Cog! SystemOrganization addCategory: #'Cog-Benchmarks-DeltaBlue'! SystemOrganization addCategory: #'Cog-Benchmarks-Richards'! SystemOrganization addCategory: #'Cog-Benchmarks-SMark'! SystemOrganization addCategory: #'Cog-Benchmarks-Shootout'! SystemOrganization addCategory: #'Cog-Bootstrapping'! SystemOrganization addCategory: #'Cog-Morphing Bytecode Set'! SystemOrganization addCategory: #'Cog-ProcessorPlugins'! SystemOrganization addCategory: #'Cog-Processors'! SystemOrganization addCategory: #'Cog-Processors-Tests'! SystemOrganization addCategory: #'Cog-Scripting'! SystemOrganization addCategory: #'Cog-Scripts'! SystemOrganization addCategory: #'Cog-Tests'! SystemOrganization addCategory: #'Cog-Benchmarks'! Item was changed: ----- Method: CogScripts class>>changedMethodsForObjectMemorySends (in category 'separate vm scripts') ----- changedMethodsForObjectMemorySends "Answer the methods in StackInterpreter and subclasses that change if sends to self for methods implemented in ObjectMemory, NewObjectMemory (& NewObjectMemorySE ?) become sends to objectMemory." "CogScripts changedMethodsForObjectMemorySends" | selectors rules model environment sortedChanges | selectors := { ObjectMemory. NewObjectMemory. "NewObjectMemorySE" } inject: Set new into: [:sels :class| sels addAll: class selectors; yourself]. rules := RBParseTreeRewriter new. rules replace: 'self `@method: ``@args' with: 'objectMemory `@method: ``@args' when: [:node| selectors includes: node selector]. #( 'nilObj' 'trueObj' 'falseObj') do: [:instVar| rules replace: instVar, ' := ``@args' with: 'objectMemory ', instVar, 'ect: ``@args'; replace: instVar with: 'objectMemory ', instVar, 'ect']. self readWriteVars do: [:instVar| rules replace: instVar, ' := ``@args' with: 'objectMemory ', instVar, ': ``@args'; replace: instVar with: 'objectMemory ', instVar]. self readOnlyVars do: [:instVar| rules replace: instVar with: 'objectMemory ', instVar]. model := RBNamespace new. + environment := RBBrowserEnvironment new forClasses: - environment := BrowserEnvironment new forClasses: { StackInterpreter. CoInterpreter. CoInterpreterMT. StackInterpreterSimulator. CogVMSimulator }. environment classesAndSelectorsDo: [ :class :selector | | tree | "(class == StackInterpreter and: [selector == #isContextHeader:]) ifTrue: [self halt]." "(class == StackInterpreter and: [selector == #isIndexable:]) ifTrue: [self halt]." "(class == StackInterpreter and: [selector == #printContextCallStackOf:]) ifTrue: [self halt]." tree := class parseTreeFor: selector. (rules executeTree: tree) ifTrue: [model compile: rules tree newSource in: class classified: (class whichCategoryIncludesSelector: selector)]]. false ifTrue: [model changes inspect]. false ifTrue: "shortest change:" [(model changes changes inject: model changes changes first into: [:c1 :c2| c1 printString size < c2 printString size ifTrue: [c1] ifFalse: [c2]]) inspect]. sortedChanges := model changes changes asSortedCollection: [:c1 :c2| c1 changeClass == c2 changeClass ifTrue: [c1 selector <= c2 selector] ifFalse: [c2 changeClass inheritsFrom: c1 changeClass]]. true ifTrue: [MessageSetTextDifferencer openMessageList: (sortedChanges collect: [:mr| { MethodReference class: mr changeClass selector: mr selector. TextReference new text: mr source class: mr class selector: mr selector }]) name: 'self foo <-> objectMemory foo et al' autoSelect: nil]. ^sortedChanges! Item was changed: ----- Method: CogScripts class>>doClassSide (in category 'separate vm scripts') ----- doClassSide "self doClassSide" | classes rules model env sortedChanges | classes := (PackageInfo named: 'VMMaker') classes. classes := classes select: [:c| classes anySatisfy: [:d| d name last = $S and: [d name allButLast = c name]]]. rules := RBParseTreeRewriter new. model := RBNamespace new. + env := RBBrowserEnvironment new forClasses: classes. - env := BrowserEnvironment new forClasses: classes. classes do: [:c| rules replace: c name with: c name, 'S']. env classesAndSelectorsDo: [:class :selector| | tree | class isMeta ifTrue: [tree := class parseTreeFor: selector. rules executeTree: tree. model compile: rules tree newSource in: class classified: (class whichCategoryIncludesSelector: selector)]]. false ifTrue: [model changes inspect]. false ifTrue: "shortest change:" [(model changes changes inject: model changes changes first into: [:c1 :c2| c1 printString size < c2 printString size ifTrue: [c1] ifFalse: [c2]]) inspect]. sortedChanges := model changes changes asSortedCollection: [:c1 :c2| c1 changeClass == c2 changeClass ifTrue: [c1 selector <= c2 selector] ifFalse: [c2 changeClass inheritsFrom: c1 changeClass]]. true ifTrue: [MessageSetTextDifferencer openMessageList: (sortedChanges collect: [:mr| { MethodReference class: mr changeClass selector: mr selector. TextReference new text: mr source class: mr class selector: mr selector }]) name: 'class side' autoSelect: nil]. sortedChanges do: [:mr| (Smalltalk classNamed: (mr changeClass theNonMetaClass name, 'S') asSymbol) class compile: mr source classified: (mr changeClass whichCategoryIncludesSelector: mr selector) withStamp: (mr source asString = (mr changeClass sourceCodeAt: mr selector) asString ifTrue: [(mr changeClass >> mr selector) timeStamp] ifFalse: [Utilities changeStamp copyReplaceAll: Utilities authorInitials with: Utilities authorInitials, ' (objmem refactor)']) notifying: nil]! Item was added: + ----- Method: CogScripts class>>refactoringPackages (in category 'documentation') ----- + refactoringPackages + "to use the source editing facilities in the refactoring browser that this class uses load + AST-Core + AST-Semantic + Refactoring-Core + Refactoring-Environment + Refactoring-Changes + in that order from http://www.squeaksource.com/rb. Relevant tests are + AST-Tests-Core + AST-Tests-Semantic + Refactoring-Tests-Core + Refactoring-Tests-Environment + Refactoring-Tests-Changes"! Item was changed: ----- Method: SpurBootstrap class>>CharacterPROTOTYPEasInteger (in category 'method prototypes') ----- CharacterPROTOTYPEasInteger + "Answer the receiver's character code." <primitive: 171> ^self primitiveFailed! Item was changed: ----- Method: SpurBootstrap class>>CharacterPROTOTYPEasciiValue (in category 'method prototypes') ----- CharacterPROTOTYPEasciiValue + "Answer the receiver's character code. + This will be ascii for characters with value <= 127, + and Unicode for those with higher values." <primitive: 171> ^self primitiveFailed! Item was changed: ----- Method: SpurBootstrap class>>CharacterPROTOTYPEclone (in category 'method prototypes') ----- CharacterPROTOTYPEclone + "Answer the receiver, because Characters are unique." ^self! Item was changed: ----- Method: SpurBootstrap class>>CharacterPROTOTYPEcopy (in category 'method prototypes') ----- CharacterPROTOTYPEcopy + "Answer the receiver, because Characters are unique." ^self! Item was changed: ----- Method: SpurBootstrap class>>CharacterPROTOTYPEdeepCopy (in category 'method prototypes') ----- CharacterPROTOTYPEdeepCopy + "Answer the receiver, because Characters are unique." ^self! Item was changed: ----- Method: SpurBootstrap class>>CharacterPROTOTYPEhash (in category 'method prototypes') ----- CharacterPROTOTYPEhash + "Hash is reimplemented because = is implemented. + Answer the receiver's character code." <primitive: 171> ^self primitiveFailed! Item was changed: ----- Method: SpurBootstrap class>>CharacterPROTOTYPEidentityHash (in category 'method prototypes') ----- CharacterPROTOTYPEidentityHash + "Answer the receiver's character code." <primitive: 171> ^self primitiveFailed! Item was changed: ----- Method: SpurBootstrap class>>CharacterPROTOTYPEshallowCopy (in category 'method prototypes') ----- CharacterPROTOTYPEshallowCopy + "Answer the receiver, because Characters are unique." ^self! Item was changed: ----- Method: SpurBootstrap class>>CharacterPROTOTYPEveryDeepCopyWith: (in category 'method prototypes') ----- CharacterPROTOTYPEveryDeepCopyWith: deepCopier + "Answer the receiver, because Characters are unique." ^self! Item was changed: ----- Method: SpurBootstrap class>>CharacterclassPROTOTYPEvalue: (in category 'method prototypes') ----- CharacterclassPROTOTYPEvalue: anInteger + "Answer the Character whose value is anInteger." <primitive: 170> ^self primitiveFailed! Item was added: + ----- Method: SpurBootstrapMonticelloPackagePatcher>>modifiedCharacterDefinitionsIn: (in category 'patching') ----- + modifiedCharacterDefinitionsIn: definitions + | rewriter | + rewriter := RBParseTreeRewriter new. + rewriter replace: 'value' with: 'self asInteger'. + ^((definitions select: [:d| d isMethodDefinition and: [d fullClassName = #Character]]) + collect: [:d| { d. self patchDefinition: d withRewriter: rewriter} ] + thenSelect: [:pair| pair first source ~= pair second source]) + collect: [:pair| pair second]! Item was changed: ----- Method: SpurBootstrapMonticelloPackagePatcher>>patch (in category 'patching') ----- patch "(SpurBootstrapMonticelloPackagePatcher new from: '/Users/eliot/Glue/repositories/nsboot/smalltalk' to: '/Users/eliot/Glue/repositories/spurnsboot/smalltalk') patch" + "(SpurBootstrapMonticelloPackagePatcher new + from: '/Users/eliot/Glue/repositories/nsboot/Squeak4.3/squeak-package-cache' + to: '/Users/eliot/Glue/repositories/nsboot/Squeak4.3/package-cache') + patch" self packagesAndPatches keysAndValuesDo: [:package :patches| (self filesForPackage: package in: sourceDir) do: [:packageFile| self patchPackage: packageFile with: patches for: package]]! Item was added: + ----- Method: SpurBootstrapMonticelloPackagePatcher>>patchDefinition:withRewriter: (in category 'patching') ----- + patchDefinition: aMCMethodDefinition withRewriter: aRBParseTreeRewriter + | parseTree | + parseTree := RBParser + parseMethod: aMCMethodDefinition source + onError: [:str :pos | self halt]. + aRBParseTreeRewriter executeTree: parseTree. + ^MCMethodDefinition + className: aMCMethodDefinition className + classIsMeta:aMCMethodDefinition classIsMeta + selector: aMCMethodDefinition selector + category: aMCMethodDefinition category + timeStamp: aMCMethodDefinition timeStamp + source: aRBParseTreeRewriter tree newSource! Item was changed: ----- Method: SpurBootstrapMonticelloPackagePatcher>>patchForPackage:withPatches:snapshot: (in category 'patching') ----- patchForPackage: package withPatches: patches snapshot: snapshot (package includesClass: Character) ifTrue: + [patches addAll: ((self modifiedCharacterDefinitionsIn: snapshot definitions) + select: + [:def| + patches noneSatisfy: + [:addition| + addition definition selector = def selector + and: [addition definition className = def className + and: [addition definition classIsMeta = def classIsMeta]]]] + thenCollect: + [:def| MCAddition of: def])]. - [snapshot halt]. ^MCPatch operations: patches! Item was changed: ----- Method: SpurBootstrapMonticelloPackagePatcher>>version:withPatches:for: (in category 'patching') ----- version: version withPatches: patches for: package | snapshot ancestry | snapshot := MCPatcher apply: (self patchForPackage: package withPatches: patches snapshot: version snapshot) to: version snapshot. ancestry := MCWorkingAncestry new addAncestor: version info. ^MCVersion package: version package info: (ancestry infoWithName: version info name + message: version info name, + ' patched for Spur by ', + (CCodeGenerator new shortMonticelloDescriptionForClass: self class)) - message: version info name, ' patched for Spur') snapshot: snapshot dependencies: {} "punt on computing dependencies; there are't any so far" ! |
Free forum by Nabble | Edit this page |