VM Maker: Cog-eem.424.mcz

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

VM Maker: Cog-eem.424.mcz

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

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

Name: Cog-eem.424
Author: eem
Time: 30 October 2020, 6:33:53.848366 pm
UUID: bb913004-6fb8-4e7e-9c53-55153bb970db
Ancestors: Cog-eem.423

MultiProcessor needs to save the register state after each execution in the doesNotUnderstand: so that the right state can be restored on entry to the doesNotUnderstand: wrapper.

=============== Diff against Cog-eem.423 ===============

Item was added:
+ ----- Method: BochsIA32Alien>>setIntegerRegisterState: (in category 'accessing-abstract') -----
+ setIntegerRegisterState: newState
+ "Set the state reasonably efficiently, for the benefit of the MultiProcessor."
+ self eax: (newState at: 1).
+ self ebx: (newState at: 2).
+ self ecx: (newState at: 3).
+ self edx: (newState at: 4).
+ self esp: (newState at: 5).
+ self ebp: (newState at: 6).
+ self esi: (newState at: 7).
+ self edi: (newState at: 8).
+ self eip: (newState at: 9).
+ self eflags: (newState at: 10)!

Item was added:
+ ----- Method: BochsX64Alien>>setIntegerRegisterState: (in category 'accessing-abstract') -----
+ setIntegerRegisterState: newState
+ "Set the state reasonably efficiently, for the benefit of the MultiProcessor."
+ self rax: (newState at: 1).
+ self rbx: (newState at: 2).
+ self rcx: (newState at: 3).
+ self rdx: (newState at: 4).
+ self rsp: (newState at: 5).
+ self rbp: (newState at: 6).
+ self rsi: (newState at: 7).
+ self rdi: (newState at: 8).
+ self r8: (newState at: 9).
+ self r9: (newState at: 10).
+ self r10: (newState at: 11).
+ self r11: (newState at: 12).
+ self r12: (newState at: 13).
+ self r13: (newState at: 14).
+ self r14: (newState at: 15).
+ self r15: (newState at: 16).
+ self rip: (newState at: 17).
+ self rflags: (newState at: 18)!

Item was changed:
  ----- Method: MultiProcessor>>doesNotUnderstand: (in category 'message forwarding') -----
  doesNotUnderstand: aMessage
  "Forward a message to the actual processor, managing a thread-switch if necessary.
  Catch ProcessorSimulationTraps and raise them outside of the critical section to
  avoid deadlock when reentering the VM from a trap and switching threads in the run-time."
  | selector result trap contextInCritical |
  selector := aMessage selector.
  (guardedProcessorProtocol includes: selector) ifFalse:
  [^(unguardedProcessorProtocol includes: selector)
  ifTrue: [processor perform: selector withArguments: aMessage arguments]
  ifFalse: [super doesNotUnderstand: aMessage]].
+ [mutex critical:
+ [contextInCritical := thisContext.
+ owner ~~ mutex owningProcess ifTrue:
+ [(registerState at: (owner := mutex owningProcess) ifAbsent: nil)
+ ifNil: [coInterpreter initializeProcessorForThreadIndex: (threadIndex := threadIndex + 1)]
+ ifNotNil: [:newState| processor setIntegerRegisterState: newState]].
+ result := processor perform: selector withArguments: aMessage arguments.
+ registerState at: owner put: processor integerRegisterState]]
+ on: ProcessorSimulationTrap, Error, AssertionFailure
+ do: [:ex|
+ ex isProcessorSimulationTrap ifFalse:
+ [ex pass].
+ "Alas things are not so simple with ARMv8 ldp/stp...
+ The comments in these two methods explain..."
+ (self isAboutToReturn: ex signalerContext) ifFalse:
+ [self saveStackFor: ex signalerContext
+ above: contextInCritical
+ homeContext: thisContext home].
+ trap := ex].
- result := [mutex critical:
- [contextInCritical := thisContext.
- owner ~~ mutex owningProcess ifTrue:
- [owner ifNotNil:
- [registerState at: owner put: processor registerState].
- (registerState at: (owner := mutex owningProcess) ifAbsent: nil)
- ifNil: [coInterpreter initializeProcessorForThreadIndex: (threadIndex := threadIndex + 1)]
- ifNotNil: [:newState| processor setRegisterState: newState]].
- processor perform: selector withArguments: aMessage arguments]]
- on: ProcessorSimulationTrap, Error, AssertionFailure
- do: [:ex|
- ex isProcessorSimulationTrap ifFalse:
- [ex pass].
- "Alas things are not so simple with ARMv8 ldp/stp...
- The comments in these two methods explain..."
- (self isAboutToReturn: ex signalerContext) ifFalse:
- [self saveStackFor: ex signalerContext
- above: contextInCritical
- homeContext: thisContext home].
- trap := ex].
  ^trap
  ifNil: [result]
  ifNotNil: [trap signal ifNotNil:
  [:resultOfSignal|
  resultOfSignal == self
  ifTrue: [processor]
  ifFalse: [resultOfSignal]]]!

Item was changed:
  ----- Method: MultiProcessor>>processor: (in category 'initialize-release') -----
  processor: aProcessor
  processor := aProcessor.
  "Try and compute messages such as those in the execution category, for which
  we should thread-switch, and those, in accessing, for which we don't need to.
  Better would be to use pragmas to label those messages we should thread-switch on."
  guardedProcessorProtocol := Set new.
  unguardedProcessorProtocol := Set new.
  (aProcessor class withAllSuperclasses copyUpThrough: CogProcessorAlien) do:
  [:class|
  unguardedProcessorProtocol addAll: class selectors.
+ #(execution #'accessing-abstract') do:
- #(execution) do:
  [ :category|
  guardedProcessorProtocol addAll: (class organization listAtCategoryNamed: category)]].
  unguardedProcessorProtocol removeAll: guardedProcessorProtocol!