VM Maker: VMMaker.oscog-eem.2059.mcz

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

VM Maker: VMMaker.oscog-eem.2059.mcz

commits-2
 
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2059.mcz

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

Name: VMMaker.oscog-eem.2059
Author: eem
Time: 30 December 2016, 4:32:26.95142 pm
UUID: fc6d415a-2e9d-4a42-abae-71dce27c857a
Ancestors: VMMaker.oscog-eem.2058

SmartSyntaxPluginSimulator
Simplify getting at the interpreterProxy and hence streamline asSmallIntegerObj et al.

Add support for logging (print frame, primitive selecvtor and result).

=============== Diff against VMMaker.oscog-eem.2058 ===============

Item was added:
+ ----- Method: Boolean>>asBooleanObj (in category '*VMMaker-interpreter simulator') -----
+ asBooleanObj
+ ^(Notification new tag: #getInterpreter; signal)
+ ifNotNil: [:interpreter| interpreter booleanObjectOf: self]
+ ifNil: [self]!

Item was changed:
  ----- Method: Integer>>asCharPtr (in category '*VMMaker-interpreter simulator') -----
  asCharPtr
+ ^(Notification new tag: #getInterpreter; signal)
+ ifNotNil: [:interpreter|
- ^(Notification new tag: #getSimulator; signal)
- ifNotNil: [:simulator| | interpreter |
- interpreter := simulator getInterpreter.
  (interpreter firstIndexableField: self) asInteger
  coerceTo: #'char *'
  sim: interpreter]
  ifNil: [self]!

Item was changed:
  ----- Method: Integer>>asSmallIntegerObj (in category '*VMMaker-interpreter simulator') -----
  asSmallIntegerObj
+ ^(Notification new tag: #getInterpreter; signal)
+ ifNotNil: [:interpreter| interpreter integerObjectOf: self]
- ^(Notification new tag: #getSimulator; signal)
- ifNotNil: [:simulator| simulator getInterpreter integerObjectOf: self]
  ifNil: [self]!

Item was changed:
  ----- Method: Object>>stAt: (in category '*VMMaker-translation support') -----
  stAt: index
  "Simulation of generateStAt:on:indent:"
 
+ ^(Notification new tag: #getInterpreter; signal)
+ ifNotNil: [:interpreter| interpreter stObject: self at: index]
- ^(Notification new tag: #getSimulator; signal)
- ifNotNil: [:simulator| simulator stObject: self at: index]
  ifNil: [self at: index]!

Item was changed:
  ----- Method: Object>>stAt:put: (in category '*VMMaker-translation support') -----
  stAt: index put: value
  "Simulation of generateStAtPut:on:indent:"
 
+ ^(Notification new tag: #getInterpreter; signal)
+ ifNotNil: [:interpreter| interpreter stObject: self at: index put: value]
- ^(Notification new tag: #getSimulator; signal)
- ifNotNil: [:simulator| simulator getInterpreter stObject: self at: index put: value]
  ifNil: [self at: index put: value]!

Item was changed:
  InterpreterPlugin subclass: #SmartSyntaxPluginSimulator
+ instanceVariableNames: 'actualPlugin signatureMap forMap pluginClass logging'
- instanceVariableNames: 'actualPlugin signatureMap forMap pluginClass'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'VMMaker-SmartSyntaxPlugins'!

Item was changed:
  ----- Method: SmartSyntaxPluginSimulator>>doesNotUnderstand: (in category 'message forwarding') -----
  doesNotUnderstand: aMessage
  | signature selector parameters result |
  signature := signatureMap
  at: aMessage selector
  ifAbsent: [^super doesNotUnderstand: aMessage].
+ self log: [interpreterProxy coInterpreter printExternalHeadFrame; print: aMessage selector; cr].
  selector := signature first.
  parameters := signature second.
  signature third "receiver block" value: (interpreterProxy stackValue: parameters size).
  interpreterProxy failed ifTrue:
+ [self log: 'failed in marshalling'.
+ ^nil].
- [^nil].
  result := [actualPlugin
  perform: selector
  withArguments: (parameters withIndexCollect:
  [:block :index|
  block value: (interpreterProxy stackValue: parameters size - index)])]
  on: Notification
  do: [:ex|
+ ex tag == #getInterpreter ifTrue: [ex resume: interpreterProxy] ifFalse:
+ [ex tag == #getSimulator ifTrue: [ex resume: self]
+ ifFalse: [ex pass]]].
- ex tag == #getSimulator
- ifTrue: [ex resume: self]
- ifFalse: [ex pass]].
  interpreterProxy failed ifTrue:
+ [self log: 'failed in execution'.
+ ^nil].
- [^nil].
  result == actualPlugin ifTrue:
+ [self log: '^self'.
+ interpreterProxy pop: interpreterProxy methodArgumentCount.
- [interpreterProxy pop: interpreterProxy methodArgumentCount.
  ^nil].
+ self log: [interpreterProxy coInterpreter print: '^'; shortPrintOop: result; flush].
  interpreterProxy
  pop: interpreterProxy methodArgumentCount + 1
  thenPush: result.
  ^nil "SmartSyntaxPluginPrimitives return null"!

Item was added:
+ ----- Method: SmartSyntaxPluginSimulator>>log: (in category 'simulation support') -----
+ log: aBlockOrString
+ logging ifTrue:
+ [aBlockOrString isBlock
+ ifTrue: [aBlockOrString value]
+ ifFalse: [interpreterProxy coInterpreter print: aBlockOrString; cr; flush]]!

Item was added:
+ ----- Method: SmartSyntaxPluginSimulator>>logging (in category 'accessing') -----
+ logging
+ ^logging!

Item was added:
+ ----- Method: SmartSyntaxPluginSimulator>>logging: (in category 'accessing') -----
+ logging: anObject
+ logging := anObject!

Item was changed:
  ----- Method: SmartSyntaxPluginSimulator>>setInterpreter: (in category 'initialize') -----
  setInterpreter: anInterpreterProxy
  interpreterProxy := anInterpreterProxy.
  actualPlugin setInterpreter: anInterpreterProxy.
+ logging ifNil: [logging := false].
  self computeSignatureMap!

Loading...