The Trunk: Compiler-eem.411.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Compiler-eem.411.mcz

commits-2
Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.411.mcz

==================== Summary ====================

Name: Compiler-eem.411
Author: eem
Time: 8 October 2019, 1:01:29.356552 pm
UUID: fb8ba22e-7115-49b7-8a23-52ae58c168cf
Ancestors: Compiler-mt.410

Implement the postRecompileAction convention for rebuilding state affected by a Compiler recompileAll.
Eliminate such a dependency in StdLiterals itsdelf by using a Symbol for performing literalEqual:.  Remove Decompiler initialize from the comment; this method doesn;t do anything affected by VariableNode class>>#initialize anymore.

=============== Diff against Compiler-mt.410 ===============

Item was changed:
  ----- Method: Compiler class>>recompileAll (in category 'utilities') -----
  recompileAll "Compiler recompileAll"
+ "Recompile all classes and traits in the system.
+ After recompilation invoke the postRecompileAction on any "
- "Recompile all classes and traits in the system"
 
+ | classesWithRecompileActions |
+ classesWithRecompileActions := OrderedCollection new.
+ Smalltalk allClassesAndTraits "This is unordered; I find that unsatisfactory and fragile, because
+    if there is a bug it could be difficult to reproduce. eem 10/8/2019"
+ do: [:classOrTrait |
+ classOrTrait compileAll.
+ (classOrTrait class includesSelector: #postRecompileAction) ifTrue:
+ [classesWithRecompileActions addLast: classOrTrait]]
+ displayingProgress:[:classOrTrait| 'Recompiling ', classOrTrait].
- Smalltalk allClassesAndTraits
- do: [:classOrTrait | classOrTrait compileAll]
- displayingProgress:[:classOrTrait| 'Recompiling ', classOrTrait]
 
+ classesWithRecompileActions do: [:classOrTrait| classOrTrait postRecompileAction]!
-
- !

Item was changed:
  ----- Method: Compiler class>>recompileAllFrom: (in category 'utilities') -----
  recompileAllFrom: firstName
  "Recompile all classes, starting with given name."
+ | classesWithRecompileActions |
+ classesWithRecompileActions := OrderedCollection new.
 
  Smalltalk allClassesDo:
+ [:class |
+ class name >= firstName ifTrue:
+ [Transcript show: class name; cr.
+ class compileAll.
+ (class class includesSelector: #postRecompileAction) ifTrue:
+ [classesWithRecompileActions addLast: class]]].
- [:class | class name >= firstName
- ifTrue:
- [Transcript show: class name; cr.
- class compileAll]]
 
+ classesWithRecompileActions do:
+ [:classOrTrait| classOrTrait postRecompileAction]
+
+ "Compiler recompileAllFrom: 'AAABodyShop'"!
- "Compiler recompileAllFrom: 'AAABodyShop'."
- !

Item was changed:
  ----- Method: VariableNode class>>initialize (in category 'class initialization') -----
+ initialize    "VariableNode initialize"
- initialize    "VariableNode initialize.  Decompiler initialize"
  | encoder |
  encoder := Encoder new.
  StdVariables := Dictionary new: 16.
  encoder
  fillDict: StdVariables
  with: VariableNode
  mapping: #('self' 'thisContext' 'super' 'nil' 'false' 'true' )
  to: (Array with: LdSelf with: LdThisContext with: LdSuper)
  , (Array with: LdNil with: LdFalse with: LdTrue).
  StdSelectors := Dictionary new: 64.
  encoder
  fillDict: StdSelectors
  with: SpecialSelectorNode
  mapping: ((1 to: Smalltalk specialSelectorSize) collect:
  [:i | Smalltalk specialSelectorAt: i])
  to: (1 to: Smalltalk specialSelectorSize) asArray.
+ StdLiterals := PluggableDictionary new equalBlock: #literalEqual:. "This is at least as fast as a block and eliminates a recompileAll dependency. eem 10/8/2019"
- StdLiterals := PluggableDictionary new equalBlock: [ :x :y | x literalEqual: y ].
  encoder
  fillDict: StdLiterals
  with: LiteralNode
  mapping: #(-1 0 1 2 )
  to: (LdMinus1 to: LdMinus1 + 3).
  encoder initScopeAndLiteralTables.
 
  NodeNil := encoder encodeVariable: 'nil'.
  NodeTrue := encoder encodeVariable: 'true'.
  NodeFalse := encoder encodeVariable: 'false'.
  NodeSelf := encoder encodeVariable: 'self'.
  NodeThisContext := encoder encodeVariable: 'thisContext'.
  NodeSuper := encoder encodeVariable: 'super'!