The Trunk: Compiler-eem.383.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.383.mcz

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

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

Name: Compiler-eem.383
Author: eem
Time: 16 June 2018, 3:20:33.200059 pm
UUID: f72d6072-25d5-4064-8c6a-03cb9752c910
Ancestors: Compiler-eem.382

Fix decompilation in the full block regime.  Whem mapping from block starts to ranges, temp names, etc, the keys are Compiledblock instance4s, not simple integer pcs, and so IdentityDictioanries must be used so as not to confuse two blocks that have the same literals and bytecodes.

=============== Diff against Compiler-eem.382 ===============

Item was changed:
  ----- Method: CompiledMethod>>mapFromBlockKeys:toSchematicTemps: (in category '*Compiler-support') -----
  mapFromBlockKeys: keys toSchematicTemps: schematicTempNamesString
  "Decode a schematicTempNamesString that encodes the layout of temp names
  in a method and any closures/blocks within it, matching keys in keys to
  vectors of temp names."
  | map tempNames |
+ map := self newBlockStartMap.
- map := Dictionary new.
  tempNames := schematicTempNamesString readStream.
  keys do:
  [:key| | tempSequence tempIndex |
  tempSequence := OrderedCollection new.
  tempIndex := 0.
  [(tempNames skipSeparators; peek) ifNil: [true] ifNotNil: [:ch| '[]' includes: ch]] whileFalse:
  [tempNames peek = $(
  ifTrue: [tempSequence addAllLast: ((self tempsSubSequenceFrom: (tempNames next; yourself)) withIndexCollect:
  [:temp :index|
  { temp. { tempIndex + 1. index } }]).
  tempNames peek ~= $) ifTrue: [self error: 'parse error'].
  tempIndex := tempIndex + 1.
  tempNames next]
  ifFalse: [tempSequence addAllLast: ((self tempsSubSequenceFrom: tempNames) withIndexCollect:
  [:temp :index|
  { temp. tempIndex := tempIndex + 1 }])]].
  map at: key put: tempSequence asArray.
  [tempNames peek = $]] whileTrue: [tempNames next].
  tempNames peek = $[ ifTrue:
  [tempNames next]].
  ^map!

Item was changed:
  ----- Method: CompiledMethod>>startKeysToBlockExtents (in category '*Compiler-support') -----
  startKeysToBlockExtents
  "Answer a Dictionary of start key to Interval of blockExtent, using the
  identical numbering scheme described in and orchestrated by
  BlockNode>>analyseArguments:temporaries:rootNode:.  A start key
  identifies a block within a method and is either the startpc for an
  embedded block or the block method itself for a full block. This is
  used in part to find the temp names for any block in a method, as
  needed by the debugger.  The other half is to recompile the method,
  obtaining the temp names for each block extent.  By indirecting through
  the blockExtent instead of using the startpc directly we decouple the
  debugger's access to temp names from the exact bytecode; insulating
  debugging from minor changes in the compiler (e.g. changes in literal
  pooling, adding prefix bytecodes, adding inst vars to CompiledMethod
  in literals towards the end of the literal frame, etc).  If the recompilation
  doesn't produce exactly the same bytecode at exactly the same offset
  no matter; the blockExtents will be the same."
  | index |
  self flag: 'belongs in DebuggerMethodMap'.
  index := 0.
  ^self
+ blockExtentsInto: self newBlockStartMap
- blockExtentsInto: Dictionary new
  from: self initialPC
  to: self endPC
  method: self
  numberer: [| value | value := index. index := index + 2. value]!

Item was changed:
  ----- Method: Decompiler>>statementsTo: (in category 'control') -----
  statementsTo: end
  "Decompile the method from pc up to end and return an array of
  expressions. If at run time this block will leave a value on the stack,
  set hasValue to true. If the block ends with a jump or return, set exit
  to the destination of the jump, or the end of the method; otherwise, set
  exit = end. Leave pc = end."
 
+ | encoderClass blockPos stackPos localLastPC |
- | encoderClass blockPos stackPos |
  encoderClass := method encoderClass.
  blockPos := statements size.
  stackPos := stack size.
  [pc < end]
  whileTrue:
+ [lastPc := localLastPC := pc.  limit := end.  "for performs"
- [lastPc := pc.  limit := end.  "for performs"
  "If you want instrumentation replace the following statement with this one,
   and edit the implementation:
  self interpretNextInstructionFor: self"
  encoderClass interpretNextInstructionFor: self in: self].
  "If there is an additional item on the stack, it will be the value
  of this block."
  (hasValue := stack size > stackPos)
  ifTrue:
  [statements addLast: stack removeLast].
  lastJumpPc = lastPc ifFalse: [exit := pc].
  ^self popTo: blockPos!