VM Maker: Cog-eem.388.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.388.mcz

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

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

Name: Cog-eem.388
Author: eem
Time: 10 January 2020, 1:04:43.254641 pm
UUID: dc0a7060-b74e-404e-a6f3-db260a2c8288
Ancestors: Cog-eem.387

Add a whooreish speedup for single-stepping in capturing the intgerRegisterState via a primitive instead of several Alien accesses.

=============== Diff against Cog-eem.387 ===============

Item was added:
+ ----- Method: BochsIA32Alien>>primitiveIntegerRegisterState: (in category 'primitives') -----
+ primitiveIntegerRegisterState: integerArrayClass "<WordArray class>"
+ "Answer a WordArray of the integer registers, the pc and the flags.
+ This primitive is unnecessary; it exists only to speed up single-stepping."
+ <primitive: 'primitiveIntegerRegisterState' module: 'BochsIA32Plugin'>
+ ^self primitiveFailed!

Item was added:
+ ----- Method: BochsX64Alien>>primitiveIntegerRegisterState: (in category 'primitives') -----
+ primitiveIntegerRegisterState: integerArrayClass "<DoubleWordArray class>"
+ "Answer a DoubleWordArray of the integer registers, the pc and the flags.
+ This primitive is unnecessary; it exists only to speed up single-stepping."
+ <primitive: 'primitiveIntegerRegisterState' module: 'BochsX64Plugin'>
+ ^self primitiveFailed!

Item was added:
+ ----- Method: GdbARMAlien>>primitiveIntegerRegisterState: (in category 'primitives') -----
+ primitiveIntegerRegisterState: integerArrayClass "<WordArray class>"
+ "Answer a WordArray of the integer registers, the pc and the flags.
+ This primitive is unnecessary; it exists only to speed up single-stepping."
+ <primitive: 'primitiveIntegerRegisterState' module: 'GdbARMPlugin'>
+ ^self primitiveFailed!

Item was changed:
  SmartSyntaxInterpreterPlugin subclass: #ProcessorSimulatorPlugin
  instanceVariableNames: 'prevInterruptCheckChain'
+ classVariableNames: 'NumIntegerRegisterStateFields'
- classVariableNames: ''
  poolDictionaries: 'VMBasicConstants'
  category: 'Cog-ProcessorPlugins'!
 
  !ProcessorSimulatorPlugin commentStamp: 'eem 11/19/2019 09:32' prior: 0!
  ProcessorSimulatorPlugin is the abstract superclass for plugins that interface to a processor simulator that executes the machine code for some processor the Cog JIT generates code for.  These include the Bochs C++ IA32/x64 processor emulator, and the GDB simulator for the ARMv6 and ARMv8 architectures.
 
  Instance Variables
  prevInterruptCheckChain: <Symbol/function pointer>
 
  prevInterruptCheckChain
  - the previous value of the interruptCheckChain function pointer
  !

Item was changed:
  ----- Method: ProcessorSimulatorPlugin class>>declareCVarsIn: (in category 'translation') -----
  declareCVarsIn: aCCodeGenerator
- "prevInterruptCheckChain lives in the platform support code."
  self ~~ ProcessorSimulatorPlugin ifTrue:
  [super declareCVarsIn: aCCodeGenerator.
+ aCCodeGenerator
+ removeVariable: 'prevInterruptCheckChain'; "lives in the platform support code."
+ removeConstant: #NumIntegerRegisterStateFields] "defined by the header file"!
- aCCodeGenerator removeVariable: 'prevInterruptCheckChain']!

Item was added:
+ ----- Method: ProcessorSimulatorPlugin>>primitiveIntegerRegisterState: (in category 'primitives') -----
+ primitiveIntegerRegisterState: integerArrayClass
+ "Answer an IntegerArray of the processor's integer register state, ending with, if these are not otherwise
+ included in the register state, the pc and the flags (if the processor has flags). The integer array will be an
+ instance of the class argument, which must be large enough for the natural word size of the processor.
+ This primitive is unnecessary; it exists only to speed up single stepping."
+ | cpuAlien cpu registerStateVector |
+ <var: #cpu type: #'void *'>
+ cpuAlien := self primitive: #primitiveIntegerRegisterState parameters: #(Oop) receiver: #Oop.
+
+ (cpu := self cCoerceSimple: (self startOfData: cpuAlien) to: #'void *') = 0 ifTrue:
+ [^interpreterProxy primitiveFailFor: PrimErrBadReceiver].
+
+ "The plugin specific include file must define NumIntegerRegisterStateFields"
+ registerStateVector := interpreterProxy instantiateClass: integerArrayClass indexableSize: NumIntegerRegisterStateFields.
+ registerStateVector = 0 ifTrue:
+ [^interpreterProxy primitiveFailFor: PrimErrNoMemory].
+ (interpreterProxy byteSizeOf: registerStateVector) ~= (NumIntegerRegisterStateFields * (self sizeof: #long)) ifTrue:
+ [^interpreterProxy primitiveFailFor: PrimErrBadArgument].
+ self storeIntegerRegisterStateOf: cpu into: (interpreterProxy firstIndexableField: registerStateVector).
+
+ ^registerStateVector!