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

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

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

Name: Compiler-eem.378
Author: eem
Time: 14 March 2018, 7:13:03.579626 pm
UUID: 9e96b6bb-8a69-4250-9b67-e61ce104cadc
Ancestors: Compiler-eem.377

Provide a full block extractor, e.g. to support InstructionStream>>blockMethodOrNil a la selectorToSendOrSelf.

Fix a typo.

=============== Diff against Compiler-eem.377 ===============

Item was added:
+ ----- Method: BytecodeEncoder class>>blockMethodOrNilFor:in:at: (in category 'instruction stream support') -----
+ blockMethodOrNilFor: anInstructionStream in: method at: pc
+ "If anInstructionStream is at a block creation bytecode then answer the block's
+ CompiledBlock, otherwise answer nil.
+ Subclasses override as appropriate."
+
+ ^nil!

Item was changed:
  ----- Method: BytecodeEncoder class>>createClosureCode (in category 'bytecode decoding') -----
  createClosureCode
+ "Answer the create closure bytecode, if it exists in the encoder's bytecode set, or nil if not."
- "Answer the create closure bytecode, if it exists in the encoder's byetcode set, or nil if not."
  ^nil!

Item was added:
+ ----- Method: EncoderForSistaV1 class>>blockMethodOrNilFor:in:at: (in category 'instruction stream support') -----
+ blockMethodOrNilFor: anInstructionStream in: method at: pc
+ "If anInstructionStream is at a block creation bytecode then answer the block's
+ CompiledBlock, otherwise answer nil.
+
+ The complication is that for convenience we allow the pc to point to the
+ raw send bytecode after its extension(s), or at the extension(s) preceeding it.
+ 249 11111001 xxxxxxxx siyyyyyy push Closure Compiled block literal index xxxxxxxx (+ Extend A * 256) numCopied yyyyyy receiverOnStack: s = 1 ignoreOuterContext: i = 1"
+
+ | byte |
+ byte := method at: pc.
+ byte = 249 ifTrue:
+ ["it could be extended..."
+ ^self extensionsFor: pc in: method into:
+ [:extA :extB :nExtBytes|
+ method literalAt: (method at: pc + nExtBytes + 1) + (extA bitShift: 8) + 1]].
+ ^byte = 16rE0 ifTrue:
+ [self extensionsAt: pc in: method into:
+ [:extA :extB :nExtBytes|
+ (method at: pc + nExtBytes) = 249 ifTrue:
+ [method literalAt: (method at: pc + nExtBytes + 1) + (extA bitShift: 8) + 1]]]!