The Trunk: Kernel-eem.1136.mcz

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

The Trunk: Kernel-eem.1136.mcz

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

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

Name: Kernel-eem.1136
Author: eem
Time: 7 January 2018, 5:12:13.286468 pm
UUID: d26ae358-e7c7-4838-8053-f3e868c774be
Ancestors: Kernel-eem.1135

Make CompiledCode>>= work for CompiledBlocks and add the #== short-cut (e.g. to speed-up Dictionary lookup).
Add pushFullClosure:numCopied: implementations to Context, BlockStartLocator and InstructionClient.  Tweak pushClosureCopyNumCopiedValues:numArgs:blockSize: to avoid determining numCopied from the copiedValues.

=============== Diff against Kernel-eem.1135 ===============

Item was added:
+ ----- Method: BlockStartLocator>>pushFullClosure:numCopied: (in category 'instruction decoding') -----
+ pushFullClosure: aCompiledBlock numCopied: numCopied
+ "Answer the block method"
+ ^aCompiledBlock!

Item was changed:
  ----- Method: CompiledCode>>= (in category 'comparing') -----
  = method
  "Answer whether the receiver implements the same code as the argument, method.
  Here ``same code'' means that if the receiver's source is compiled with the same
  compiler it should produce the same sequence of bytecodes and literals, same
  trailer and same properties.  Hence this definition of #= (only one of many plausible
  definitions) can be used to quickly identify changes in the compiler's output."
  | numLits |
+ self == method ifTrue:
+ [^true].
+ method isCompiledCode ifFalse: [^false].
- method isCompiledMethod ifFalse: [^false].
  self size = method size ifFalse: [^false].
  self header = method header ifFalse: [^false]. "N.B. includes numLiterals comparison."
  self initialPC to: self endPC do:
  [:i | (self at: i) = (method at: i) ifFalse: [^false]].
  numLits := self numLiterals.
  1 to: numLits do:
  [:i| | lit1 lit2 |
  lit1 := self literalAt: i.
  lit2 := method literalAt: i.
  (lit1 == lit2 or: [lit1 literalEqual: lit2]) ifFalse:
  [(i = 1 and: [#(117 120) includes: self primitive])
  ifTrue:
  [lit1 isArray
  ifTrue:
  [(lit2 isArray and: [(lit1 first: 2) = (lit2 first: 2)]) ifFalse:
  [^false]]
  ifFalse: "ExternalLibraryFunction"
  [(lit1 analogousCodeTo: lit2) ifFalse:
  [^false]]]
  ifFalse:
  [i = (numLits - 1)
  ifTrue: "properties"
  [(self properties analogousCodeTo: method properties)
  ifFalse: [^false]]
  ifFalse: "last literal (methodClassAssociation) of class-side methods is not unique"
  [(i = numLits
  and: [lit1 isVariableBinding
  and: [lit2 isVariableBinding
  and: [lit1 key == lit2 key
  and: [lit1 value == lit2 value]]]]) ifFalse:
  [^false]]]]].
  ^true!

Item was changed:
  ----- Method: Context>>pushClosureCopyNumCopiedValues:numArgs:blockSize: (in category 'instruction decoding') -----
  pushClosureCopyNumCopiedValues: numCopied numArgs: numArgs blockSize: blockSize
  "Simulate the action of a 'closure copy' bytecode whose result is the
  new BlockClosure for the following code"
  | copiedValues |
  numCopied > 0
  ifTrue:
  [copiedValues := Array new: numCopied.
  numCopied to: 1 by: -1 do:
  [:i|
  copiedValues at: i put: self pop]]
  ifFalse:
  [copiedValues := nil].
+ self push: ((BlockClosure new: numCopied)
- self push: (BlockClosure
  outerContext: self
  startpc: pc
  numArgs: numArgs
  copiedValues: copiedValues).
  self jump: blockSize!

Item was added:
+ ----- Method: Context>>pushFullClosure:numCopied: (in category 'instruction decoding') -----
+ pushFullClosure: aCompiledBlock numCopied: numCopied
+ "Simulate the action of a 'closure copy' bytecode whose result is the
+ new FullBlockClosure for the supplied compiled block."
+ | copiedValues |
+ numCopied > 0
+ ifTrue:
+ [copiedValues := Array new: numCopied.
+ numCopied to: 1 by: -1 do:
+ [:i|
+ copiedValues at: i put: self pop]]
+ ifFalse:
+ [copiedValues := nil].
+ self push: ((FullBlockClosure new: numCopied)
+ receiver: receiver
+ outerContext: self
+ method: aCompiledBlock
+ copiedValues: copiedValues)!

Item was added:
+ ----- Method: InstructionClient>>pushFullClosure:numCopied: (in category 'instruction decoding') -----
+ pushFullClosure: aCompiledBlock numCopied: numCopied
+ "Push Full Closure bytecode."!