The Trunk: Compiler-eem.357.mcz

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

The Trunk: Compiler-eem.357.mcz

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

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

Name: Compiler-eem.357
Author: eem
Time: 12 July 2017, 5:14:16.035903 pm
UUID: 3965b31d-87f6-47e3-b23e-57dd1dd273b9
Ancestors: Compiler-eem.356

Fix the Compiler's evaluate:in: methods for non-cil contexts (e.g. the ContextVariablesInspector bottom right pane in the debugger).  The old code used aContext methodClass which would exclude the variables of a receiver whose class inherited the method, rather than implemented it directly (e.g. debug (1@2) printString and in the context inspector on the Point(Object)>>printString activation try and evaluate x@y.  Using methodClass excludes Point's inst vars.

=============== Diff against Compiler-eem.356 ===============

Item was added:
+ ----- Method: Compiler>>classForReceiver:context: (in category 'private') -----
+ classForReceiver: receiver context: contextOrNil
+ "Answer the class to compile in for a receiver and aContext.
+ If aContext is non-nil use its receiver's class (if we use the context's
+ methodClass we may exclude instance variables of the receiver).
+ Access the class of the receiver via the mirror primitive to avoid issues with proxies."
+
+ ^thisContext objectClass: (contextOrNil ifNil: [receiver] ifNotNil: [contextOrNil receiver])!

Item was changed:
  ----- Method: Compiler>>compiledMethodFor:in:to:notifying:ifFail: (in category 'public access') -----
  compiledMethodFor: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: failBlock
  "Compiles the sourceStream into a parse tree, then generates code
  into a method, and answers it.  If receiver is not nil, then the text can
  refer to instance variables of that receiver (the Inspector uses this).
  If aContext is not nil, the text can refer to temporaries in that context
  (the Debugger uses this). If aRequestor is not nil, then it will receive a
  notify:at: message before the attempt to evaluate is aborted."
 
+ | methodNode method |
- | methodNode method theClass |
- theClass := (aContext == nil ifTrue: [receiver] ifFalse: [aContext receiver]) class.
  methodNode := self
  compileNoPattern: textOrStream
+ in: (self classForReceiver: receiver context: aContext)
- in: theClass
  context: aContext
  notifying: aRequestor
  ifFail: [^failBlock value].
  method := self interactive
  ifTrue: [ methodNode generateWithTempNames ]
  ifFalse: [ methodNode generate ].
  ^method!

Item was changed:
  ----- Method: Compiler>>evaluate:in:to:environment:notifying:ifFail:logged: (in category 'public access logging') -----
  evaluate: textOrStream in: aContext to: receiver environment: anEnvironment notifying: aRequestor ifFail: failBlock logged: logFlag
  "Same as #evaluate:in:to:notifying:ifFail:logged: but with an explicit environment"
- | theClass |
- theClass := (aContext == nil ifTrue: [receiver class] ifFalse: [aContext methodClass]).
  ^self
  evaluateCue: (CompilationCue
  source: textOrStream
  context: aContext
  receiver: receiver
+ class: (self classForReceiver: receiver context: aContext)
- class: theClass
  environment: anEnvironment
  requestor: aRequestor)
  ifFail: failBlock
  logged: logFlag!

Item was changed:
  ----- Method: Compiler>>evaluate:in:to:notifying:ifFail: (in category 'public access') -----
  evaluate: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: failBlock
  "Compiles the sourceStream into a parse tree, then generates code into
  a method. If aContext is not nil, the text can refer to temporaries in that
  context (the Debugger uses this). If aRequestor is not nil, then it will receive
  a notify:at: message before the attempt to evaluate is aborted. Finally, the
  compiled method is invoked from here via withArgs:executeMethod:, hence
  the system no longer creates Doit method litter on errors."
 
  | theClass |
+ theClass := self classForReceiver: receiver context: aContext.
- theClass := aContext ifNil: [receiver class] ifNotNil: [:ctx | ctx methodClass].
  ^self
  evaluateCue: (CompilationCue
  source: textOrStream
  context: aContext
  receiver: receiver
  class: theClass
  environment: theClass environment
  requestor: aRequestor)
  ifFail: failBlock!

Item was changed:
  ----- Method: Compiler>>evaluate:in:to:notifying:ifFail:logged: (in category 'public access logging') -----
  evaluate: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: failBlock logged: logFlag
  "Compiles the sourceStream into a parse tree, then generates code into
  a method. If aContext is not nil, the text can refer to temporaries in that
  context (the Debugger uses this). If aRequestor is not nil, then it will receive
  a notify:at: message before the attempt to evaluate is aborted. Finally, the
  compiled method is invoked from here via withArgs:executeMethod:, hence
  the system no longer creates Doit method litter on errors."
  | theClass |
+ theClass := self classForReceiver: receiver context: aContext.
- theClass := (aContext == nil ifTrue: [receiver class] ifFalse: [aContext methodClass]).
  ^self
  evaluateCue: (CompilationCue
  source: textOrStream
  context: aContext
  receiver: receiver
  class: theClass
  environment: theClass environment
  requestor: aRequestor)
  ifFail: failBlock
  logged: logFlag!


Loading...