Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.347.mcz ==================== Summary ==================== Name: Compiler-eem.347 Author: eem Time: 6 April 2017, 12:08:22.719112 pm UUID: d778b11b-16be-4455-8955-cac9921e64a0 Ancestors: Compiler-eem.346 Provide is(Non)SyntheticStoreAt:in:for: for SistaV1. Fix selectorToSendOrItselfFor:in:at: so that it is not follwed if invoked at a raw bytecode that is preceeded by an extension. =============== Diff against Compiler-eem.346 =============== Item was added: + ----- Method: EncoderForSistaV1 class>>isSyntheticStoreAt:in:for: (in category 'instruction stream support') ----- + isSyntheticStoreAt: pc in: method for: anInstructionStream + "Answer whether the bytecode at pc is a store or store-pop of an indirect temp vector, + which implement mutable closed-over variables in the the closure implementation. + Stores into temp vectors are not real stores. N.B. pcPreviousTo:in:for: is slow, so filter + out any preceding bytecodes other than what looks like a pushNewArrayCode. But the + pcPreviousTo:in:for: is still necessary, since the presence of a pcPreviousTo:in:for: in the + right place is potentially ambiguous, possibly part of a different bytecode sequence." + + ^(self isTempStoreAt: pc in: method) + and: [pc - 2 >= method initialPC + and: [(method at: pc - 2) = self pushNewArrayCode + and: [(method at: pc - 1) <= 127 + and: [pc - 2 = (self pcPreviousTo: pc in: method for: anInstructionStream)]]]]! Item was added: + ----- Method: EncoderForSistaV1 class>>isTempStoreAt:in: (in category 'instruction stream support') ----- + isTempStoreAt: pc in: method + "Answer if the bytecode at pc is a store or store-pop into a temporary variable. + 208-215 11010 iii Pop and Store Temporary Variable #iii + 242 11110010 iiiiiiii Pop and Store Temporary Variable #iiiiiiii + 245 11110110 iiiiiiii Store Temporary Variable #iiiiiiii" + + | byte | + byte := method at: pc. + ^byte >= 208 + and: [byte <= 215 + or: [byte = 242 and: [byte = 245]]]! Item was added: + ----- Method: EncoderForSistaV1 class>>pushNewArrayCode (in category 'bytecode decoding') ----- + pushNewArrayCode + "231 11100111 jkkkkkkk Push (Array new: kkkkkkk) (j = 0) + & Pop kkkkkkk elements into: (Array new: kkkkkkk) (j = 1)" + ^231! Item was changed: ----- Method: EncoderForSistaV1 class>>selectorToSendOrItselfFor:in:at: (in category 'instruction stream support') ----- selectorToSendOrItselfFor: anInstructionStream in: method at: pc "If anInstructionStream is at a send bytecode then answer the send's selector, otherwise answer anInstructionStream itself. The rationale for answering anInstructionStream instead of, say, nil, is that potentially any existing object can be used as a selector, but since anInstructionStream postdates the method, it can't be one of them. + 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. + 96-111 0110 iiii Send Arithmetic Message #iiii (+ - < > <= >= = ~= * / \\ @ bitShift: // bitAnd: bitOr:) + 112-119 01110 iii Send Special Message #iii + 0 (at: at:put: size next nextPut: atEnd == class) + 120-127 01111 iii Send Special Message #iii + 8 (~~ value value: do: new new: x y) + 128-143 1000 iiii Send Literal Selector #iiii With 0 Argument + 144-159 1001 iiii Send Literal Selector #iiii With 1 Arguments + 160-175 1010 iiii Send Literal Selector #iiii With 2 Arguments + * 224 11100000 aaaaaaaa Extend A (Ext A = Ext A prev * 256 + Ext A) + * 225 11100001 bbbbbbbb Extend B (Ext B = Ext B prev * 256 + Ext B) + ** 234 11101010 iiiiijjj Send Literal Selector #iiiii (+ Extend A * 32) with jjj (+ Extend B * 8) Arguments + ** 235 11101011 iiiiijjj ExtendB < 64 + ifTrue: [Send To Superclass Literal Selector #iiiii (+ Extend A * 32) with jjj (+ Extend B * 8) Arguments] + ifFalse: [Send To Superclass of Stacked Class Literal Selector #iiiii (+ Extend A * 32) with jjj (+ (Extend B " - The compilcation is that for convenience we assume the pc could be - pointing to the raw send bytecode after its extensions, or at the extension - preceeding the raw send bytecode. - 96-111 0110 iiii Send Arithmetic Message #iiii #(#+ #- #< #> #'<=' #'>=' #= #'~=' #* #/ #'\\' #@ #bitShift: #'//' #bitAnd: #bitOr:) - 112-119 01110 iii Send Special Message #iii #(#at: #at:put: #size #next #nextPut: #atEnd #'==' class) - 120 01111000 UNASSIGNED (was: blockCopy:) - 121 01111001 Send Special Message #value - 122-123 0111101 i Send Special Message #i #(#value: #do:) - 124-127 011111 ii Send Special Message #ii #(#new #new: #x #y)) - 128-143 1000 iiii Send Literal Selector #iiii With 0 Argument - 144-159 1001 iiii Send Literal Selector #iiii With 1 Arguments - 160-175 1010 iiii Send Literal Selector #iiii With 2 Arguments - * 224 11100000 aaaaaaaa Extend A (Ext A = Ext A prev * 256 + Ext A) - * 225 11100001 bbbbbbbb Extend B (Ext B = Ext B prev * 256 + Ext B) - ** 234 11101010 iiiiijjj Send Literal Selector #iiiii (+ Extend A * 32) with jjj (+ Extend B * 8) Arguments - ** 235 11101011 iiiiijjj Send To Superclass Literal Selector #iiiii (+ Extend A * 32) with jjj (+ Extend B * 8) Arguments" | byte | byte := method at: pc. byte < 96 ifTrue: [^anInstructionStream]. byte <= 175 ifTrue: ["special byte or short send" ^byte >= 128 ifTrue: [method literalAt: (byte bitAnd: 15) + 1] ifFalse: [Smalltalk specialSelectorAt: byte - 95]]. byte < 234 ifTrue: "need to check for either extension cuz order of extensions is not restricted. so extB could preceed extA" [(byte >= 224 and: [byte <= 225]) ifTrue: [^self extensionsAt: pc in: method into: [:extA :extB :nExtBytes| | byteAfter index | byteAfter := method at: pc + nExtBytes. (byteAfter >= 234 and: [byteAfter <= 235]) ifTrue: [index := ((method at: pc + nExtBytes + 1) bitShift: -3) + (extA bitShift: 5). method literalAt: index + 1] ifFalse: [anInstructionStream]]]. ^anInstructionStream]. byte > 235 ifTrue: [^anInstructionStream]. "they could be extended..." + ^self extensionsFor: pc in: method into: - ^self extensionsAt: pc in: method into: [:extA :extB :nExtBytes| | index | index := ((method at: pc + 1) bitShift: -3) + (extA bitShift: 5). method literalAt: index + 1]! |
Free forum by Nabble | Edit this page |