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

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

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

Name: Compiler-eem.395
Author: eem
Time: 15 October 2018, 12:37:16.203042 pm
UUID: 2f7c8f3a-4e2d-413b-8651-b05b5683f89d
Ancestors: Compiler-eem.394

Implement markerOrNil: for the SistaV1 bytecode set and firm up both implementations so that e.g.
        aMethod
                self fooClass new
is not interpreted as a marker method (because #new is a special selector and hence does not cayse a literal to be allocated).

=============== Diff against Compiler-eem.394 ===============

Item was added:
+ ----- Method: EncoderForSistaV1 class>>markerOrNilFor: (in category 'compiled method support') -----
+ markerOrNilFor: aMethod
+ "If aMethod is a marker method, answer the symbol used to mark it.  Otherwise
+ answer nil.  What is a marker method?  It is method with body like
+ 'self subclassResponsibility' or '^ self subclassResponsibility'
+ used to indicate ('mark') a special property.
+
+ Marker methods compile to two bytecode forms, this:
+ self
+ send: <literal 1>
+ pop
+ returnSelf
+ or this:
+ self
+ send: <literal 1>
+ returnTop"
+ | expectedHeaderPlusLliteralSize e byte |
+ expectedHeaderPlusLliteralSize := Smalltalk wordSize * 4.
+ ^(((e := aMethod endPC - expectedHeaderPlusLliteralSize) = 3 or: [e = 4])
+  and: [aMethod numLiterals = 3
+  and: [(aMethod at: expectedHeaderPlusLliteralSize + 1) = 16r4C "push self"
+  and: [(aMethod at: expectedHeaderPlusLliteralSize + 2) = 16r80
+  and: [(byte := aMethod at: expectedHeaderPlusLliteralSize + 3) = 16rD8 or: [byte = 16r5C]]]]]) "pop or returnSelf"
+ ifTrue: [aMethod literalAt: 1]!

Item was changed:
  ----- Method: EncoderForV3 class>>markerOrNilFor: (in category 'compiled method support') -----
  markerOrNilFor: aMethod
  "If aMethod is a marker method, answer the symbol used to mark it.  Otherwise
  answer nil.  What is a marker method?  It is method with body like
  'self subclassResponsibility' or '^ self subclassResponsibility'
  used to indicate ('mark') a special property.
 
  Marker methods compile to two bytecode forms, this:
  self
  send: <literal 1>
  pop
  returnSelf
  or this:
  self
  send: <literal 1>
  returnTop"
+ | expectedHeaderPlusLliteralSize e byte |
- | expectedHeaderPlusLliteralSize e |
  expectedHeaderPlusLliteralSize := Smalltalk wordSize * 4.
  ^(((e := aMethod endPC - expectedHeaderPlusLliteralSize) = 3 or: [e = 4])
   and: [aMethod numLiterals = 3
+  and: [(aMethod at: expectedHeaderPlusLliteralSize + 1) = 16r70 "push self"
+  and: [(aMethod at: expectedHeaderPlusLliteralSize + 2) = 16rD0
+  and: [(byte := aMethod at: expectedHeaderPlusLliteralSize + 3) = 16r87 or: [byte = 16r78]]]]]) "pop or returnSelf"
-  and: [(aMethod at:  expectedHeaderPlusLliteralSize + 1) = 16r70 "push self"
-  and: [(aMethod at: expectedHeaderPlusLliteralSize + 2) = 16rD0]]]) "send <literal 1>"
  ifTrue: [aMethod literalAt: 1]!