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

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

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

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

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

Name: VMMaker.oscog-eem.2498
Author: eem
Time: 24 December 2018, 2:03:10.161656 pm
UUID: f4233232-2c6b-452e-bdab-b814d48cc4a8
Ancestors: VMMaker.oscog-akg.2497

Integrate Ken Dickey's addition of the ThreadedARM64FFIPlugin.  Thanks Ken!

=============== Diff against VMMaker.oscog-akg.2497 ===============

Item was added:
+ ThreadedARMFFIPlugin subclass: #ThreadedARM64FFIPlugin
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'VMMaker-Plugins-FFI'!
+
+ !ThreadedARM64FFIPlugin commentStamp: 'KenD 12/17/2018 14:38' prior: 0!
+ A ThreadedARM64FFIPlugin is for the 64-bit ARM ABI.  It typically has 8 integer registers
+
+ Instance Variables
+ !

Item was added:
+ ----- Method: ThreadedARM64FFIPlugin class>>identifyingPredefinedMacros (in category 'translation') -----
+ identifyingPredefinedMacros
+ ^#('__ARM_ARCH_V8__' '__aarch64__' '__arm64__' 'ARM64')!

Item was added:
+ ----- Method: ThreadedARM64FFIPlugin class>>initialize (in category 'class initialization') -----
+ initialize
+ super initialize.
+ NumIntRegArgs     := 8.
+ NumFloatRegArgs := 16!

Item was added:
+ ----- Method: ThreadedARM64FFIPlugin class>>moduleName (in category 'translation') -----
+ moduleName
+ ^'ARM64FFIPlugin'!

Item was added:
+ ----- Method: ThreadedARM64FFIPlugin>>wordSize (in category 'simulation support') -----
+ wordSize
+
+ ^ 8  "arm64/aarch64"!

Item was changed:
  ----- Method: ThreadedARMFFIPlugin class>>identifyingPredefinedMacros (in category 'translation') -----
  identifyingPredefinedMacros
+ ^#('__ARM_ARCH__' " '__arm__' " '__arm32__' 'ARM32')!
- ^#('__ARM_ARCH__' '__arm__' '__arm32__' 'ARM32')!

Item was changed:
  ----- Method: ThreadedARMFFIPlugin class>>initialize (in category 'class initialization') -----
  initialize
+ super initialize.
  NumIntRegArgs := 4.
  NumFloatRegArgs := 16!

Item was changed:
  ----- Method: ThreadedARMFFIPlugin>>ffiPushPointer:in: (in category 'marshalling') -----
  ffiPushPointer: pointer in: calloutState
  <var: #pointer type: #'void *'>
  <var: #calloutState type: #'CalloutState *'>
  <inline: true>
  calloutState integerRegisterIndex < NumIntRegArgs
  ifTrue:
  [calloutState integerRegisters at: calloutState integerRegisterIndex put: pointer asInteger.
  calloutState integerRegisterIndex: calloutState integerRegisterIndex + 1]
  ifFalse:
+ [calloutState currentArg + self wordSize > calloutState limit ifTrue:
- [calloutState currentArg + 4 > calloutState limit ifTrue:
  [^FFIErrorCallFrameTooBig].
  interpreterProxy longAt: calloutState currentArg put: pointer.
+ calloutState currentArg: calloutState currentArg + self wordSize].
- calloutState currentArg: calloutState currentArg + 4].
  ^0!

Item was changed:
  ----- Method: ThreadedARMFFIPlugin>>ffiPushSignedByte:in: (in category 'marshalling') -----
  ffiPushSignedByte: value in: calloutState
  <var: #calloutState type: #'CalloutState *'>
  <inline: true>
  calloutState integerRegisterIndex < NumIntRegArgs
  ifTrue:
  [calloutState integerRegisters at: calloutState integerRegisterIndex put: (self cCoerceSimple: value to: #'signed char').
  calloutState integerRegisterIndex: calloutState integerRegisterIndex + 1]
  ifFalse:
+ [calloutState currentArg + self wordSize > calloutState limit ifTrue:
- [calloutState currentArg + 4 > calloutState limit ifTrue:
  [^FFIErrorCallFrameTooBig].
  interpreterProxy longAt: calloutState currentArg put: (self cCoerceSimple: value to: #'signed char').
+ calloutState currentArg: calloutState currentArg + self wordSize].
- calloutState currentArg: calloutState currentArg + 4].
  ^0!

Item was changed:
  ----- Method: ThreadedARMFFIPlugin>>ffiPushSignedChar:in: (in category 'marshalling') -----
  ffiPushSignedChar: value in: calloutState
  <var: #calloutState type: #'CalloutState *'>
  <inline: true>
  calloutState integerRegisterIndex < NumIntRegArgs
  ifTrue:
  [calloutState integerRegisters at: calloutState integerRegisterIndex put: (self cCoerceSimple: value to: #'signed char').
  calloutState integerRegisterIndex: calloutState integerRegisterIndex + 1]
  ifFalse:
+ [calloutState currentArg + self wordSize > calloutState limit ifTrue:
- [calloutState currentArg + 4 > calloutState limit ifTrue:
  [^FFIErrorCallFrameTooBig].
  interpreterProxy longAt: calloutState currentArg put: (self cCoerceSimple: value to: #'signed char').
+ calloutState currentArg: calloutState currentArg + self wordSize].
- calloutState currentArg: calloutState currentArg + 4].
  ^0!

Item was changed:
  ----- Method: ThreadedARMFFIPlugin>>ffiPushSignedInt:in: (in category 'marshalling') -----
  ffiPushSignedInt: value in: calloutState
  <var: #calloutState type: #'CalloutState *'>
  <inline: true>
  calloutState integerRegisterIndex < NumIntRegArgs
  ifTrue:
  [calloutState integerRegisters at: calloutState integerRegisterIndex put: value.
  calloutState integerRegisterIndex: calloutState integerRegisterIndex + 1]
  ifFalse:
+ [calloutState currentArg + self wordSize > calloutState limit ifTrue:
- [calloutState currentArg + 4 > calloutState limit ifTrue:
  [^FFIErrorCallFrameTooBig].
  interpreterProxy longAt: calloutState currentArg put: value.
+ calloutState currentArg: calloutState currentArg + self wordSize].
- calloutState currentArg: calloutState currentArg + 4].
  ^0
  !

Item was changed:
  ----- Method: ThreadedARMFFIPlugin>>ffiPushSignedLongLong:in: (in category 'marshalling') -----
  ffiPushSignedLongLong: value in: calloutState
  <var: #value type: #sqLong>
  <var: #calloutState type: #'CalloutState *'>
  <inline: true>
  calloutState integerRegisterIndex < (NumIntRegArgs - 1)
  ifTrue:
  [calloutState integerRegisterIndex: (calloutState integerRegisterIndex + 1 bitClear: 1).
  calloutState integerRegisters at: calloutState integerRegisterIndex put: (self cCoerceSimple: value to: #usqInt).
  calloutState integerRegisters at: calloutState integerRegisterIndex + 1 put: (self cCoerceSimple: value >> 32 to: #usqInt).
  calloutState integerRegisterIndex: calloutState integerRegisterIndex + 2]
  ifFalse:
  [calloutState currentArg + 8 > calloutState limit ifTrue: [^FFIErrorCallFrameTooBig].
  calloutState integerRegisterIndex: NumIntRegArgs.
  interpreterProxy
  longAt: calloutState currentArg put: (self cCoerceSimple: value to: #usqInt);
+ longAt: calloutState currentArg + self wordSize put: (self cCoerceSimple: value >> 32 to: #usqInt).
- longAt: calloutState currentArg + 4 put: (self cCoerceSimple: value >> 32 to: #usqInt).
  calloutState currentArg: calloutState currentArg + 8].
  ^0!

Item was changed:
  ----- Method: ThreadedARMFFIPlugin>>ffiPushSignedShort:in: (in category 'marshalling') -----
  ffiPushSignedShort: value in: calloutState
  <var: #calloutState type: #'CalloutState *'>
  <inline: true>
  calloutState integerRegisterIndex < NumIntRegArgs
  ifTrue:
  [calloutState integerRegisters at: calloutState integerRegisterIndex put: (self cCoerceSimple: value to: #'signed short').
  calloutState integerRegisterIndex: calloutState integerRegisterIndex + 1]
  ifFalse:
+ [calloutState currentArg + self wordSize > calloutState limit ifTrue:
- [calloutState currentArg + 4 > calloutState limit ifTrue:
  [^FFIErrorCallFrameTooBig].
  interpreterProxy longAt: calloutState currentArg put: (self cCoerceSimple: value to: #'signed short').
+ calloutState currentArg: calloutState currentArg + self wordSize].
- calloutState currentArg: calloutState currentArg + 4].
  ^0!

Item was changed:
  ----- Method: ThreadedARMFFIPlugin>>ffiPushSingleFloat:in: (in category 'marshalling') -----
  ffiPushSingleFloat: value in: calloutState
  <var: #value type: #float>
  <var: #calloutState type: #'CalloutState *'>
  <inline: #always>
  calloutState floatRegisterIndex < NumFloatRegArgs
  ifTrue:
  [calloutState backfillFloatRegisterIndex > 0
  ifTrue:
  [calloutState floatRegisters at: calloutState backfillFloatRegisterIndex  put: value.
  calloutState backfillFloatRegisterIndex: 0]
  ifFalse:
  [calloutState floatRegisters at: calloutState floatRegisterIndex  put: value.
  calloutState floatRegisterIndex: calloutState floatRegisterIndex + 1]]
  ifFalse:
+ [calloutState currentArg + self wordSize > calloutState limit ifTrue:
- [calloutState currentArg + 4 > calloutState limit ifTrue:
  [^FFIErrorCallFrameTooBig].
  interpreterProxy storeSingleFloatAtPointer: calloutState currentArg from: value.
+ calloutState currentArg: calloutState currentArg + self wordSize].
- calloutState currentArg: calloutState currentArg + 4].
  ^0!

Item was changed:
  ----- Method: ThreadedARMFFIPlugin>>ffiPushUnsignedByte:in: (in category 'marshalling') -----
  ffiPushUnsignedByte: value in: calloutState
  <var: #calloutState type: #'CalloutState *'>
  <inline: true>
  calloutState integerRegisterIndex < NumIntRegArgs
  ifTrue:
  [calloutState integerRegisters at: calloutState integerRegisterIndex put: (self cCoerceSimple: value to: #'unsigned char').
  calloutState integerRegisterIndex: calloutState integerRegisterIndex + 1]
  ifFalse:
+ [calloutState currentArg + self wordSize > calloutState limit ifTrue:
- [calloutState currentArg + 4 > calloutState limit ifTrue:
  [^FFIErrorCallFrameTooBig].
  interpreterProxy longAt: calloutState currentArg put: (self cCoerceSimple: value to: #'unsigned char').
+ calloutState currentArg: calloutState currentArg + self wordSize].
- calloutState currentArg: calloutState currentArg + 4].
  ^0
  !

Item was changed:
  ----- Method: ThreadedARMFFIPlugin>>ffiPushUnsignedChar:in: (in category 'marshalling') -----
  ffiPushUnsignedChar: value in: calloutState
  <var: #calloutState type: #'CalloutState *'>
  <inline: true>
  calloutState integerRegisterIndex < NumIntRegArgs
  ifTrue:
  [calloutState integerRegisters at: calloutState integerRegisterIndex put: (self cCoerceSimple: value to: #'unsigned char').
  calloutState integerRegisterIndex: calloutState integerRegisterIndex + 1]
  ifFalse:
+ [calloutState currentArg + self wordSize > calloutState limit ifTrue:
- [calloutState currentArg + 4 > calloutState limit ifTrue:
  [^FFIErrorCallFrameTooBig].
  interpreterProxy longAt: calloutState currentArg put: (self cCoerceSimple: value to: #'unsigned char').
+ calloutState currentArg: calloutState currentArg + self wordSize].
- calloutState currentArg: calloutState currentArg + 4].
  ^0!

Item was changed:
  ----- Method: ThreadedARMFFIPlugin>>ffiPushUnsignedInt:in: (in category 'marshalling') -----
  ffiPushUnsignedInt: value in: calloutState
  <var: #calloutState type: #'CalloutState *'>
  <inline: true>
  calloutState integerRegisterIndex < NumIntRegArgs
  ifTrue:
  [calloutState integerRegisters at: calloutState integerRegisterIndex put: value.
  calloutState integerRegisterIndex: calloutState integerRegisterIndex + 1]
  ifFalse:
+ [calloutState currentArg + self wordSize > calloutState limit ifTrue:
- [calloutState currentArg + 4 > calloutState limit ifTrue:
  [^FFIErrorCallFrameTooBig].
  interpreterProxy longAt: calloutState currentArg put: value.
+ calloutState currentArg: calloutState currentArg + self wordSize].
- calloutState currentArg: calloutState currentArg + 4].
  ^0
 
  !

Item was changed:
  ----- Method: ThreadedARMFFIPlugin>>ffiPushUnsignedLongLong:in: (in category 'marshalling') -----
  ffiPushUnsignedLongLong: value in: calloutState
  <var: #value type: #usqLong>
  <var: #calloutState type: #'CalloutState *'>
  <inline: true>
  calloutState integerRegisterIndex < (NumIntRegArgs - 1)
  ifTrue:
  [calloutState integerRegisterIndex: (calloutState integerRegisterIndex + 1 bitClear: 1).
  calloutState integerRegisters at: calloutState integerRegisterIndex put: (self cCoerceSimple: value to: #usqInt).
  calloutState integerRegisters at: calloutState integerRegisterIndex + 1 put: (self cCoerceSimple: value >> 32 to: #usqInt).
  calloutState integerRegisterIndex: calloutState integerRegisterIndex + 2]
  ifFalse:
  [calloutState currentArg + 8 > calloutState limit ifTrue: [^FFIErrorCallFrameTooBig].
  calloutState integerRegisterIndex: NumIntRegArgs.
  interpreterProxy
  longAt: calloutState currentArg put: (self cCoerceSimple: value to: #usqInt);
+ longAt: calloutState currentArg + self wordSize put: (self cCoerceSimple: value >> 32 to: #usqInt).
- longAt: calloutState currentArg + 4 put: (self cCoerceSimple: value >> 32 to: #usqInt).
  calloutState currentArg: calloutState currentArg + 8].
  ^0
  !

Item was changed:
  ----- Method: ThreadedARMFFIPlugin>>ffiPushUnsignedShort:in: (in category 'marshalling') -----
  ffiPushUnsignedShort: value in: calloutState
  <var: #calloutState type: #'CalloutState *'>
  <inline: true>
  calloutState integerRegisterIndex < NumIntRegArgs
  ifTrue:
  [calloutState integerRegisters at: calloutState integerRegisterIndex put: (self cCoerceSimple: value to: #'unsigned short').
  calloutState integerRegisterIndex: calloutState integerRegisterIndex + 1]
  ifFalse:
+ [calloutState currentArg + self wordSize > calloutState limit ifTrue:
- [calloutState currentArg + 4 > calloutState limit ifTrue:
  [^FFIErrorCallFrameTooBig].
  interpreterProxy longAt: calloutState currentArg put: (self cCoerceSimple: value to: #'unsigned short').
+ calloutState currentArg: calloutState currentArg + self wordSize].
- calloutState currentArg: calloutState currentArg + 4].
  ^0!

Item was changed:
  ----- Method: ThreadedARMFFIPlugin>>returnStructInRegisters: (in category 'marshalling') -----
  returnStructInRegisters: returnStructSize
  "Answer if a struct result of a given size is returned in memory or not."
+ ^returnStructSize <= self wordSize!
- ^returnStructSize <= 4!

Item was added:
+ ----- Method: ThreadedARMFFIPlugin>>wordSize (in category 'simulation support') -----
+ wordSize
+
+ ^ 4  "arm32"!