VM Maker: VMMaker.oscog-eem.2880.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.2880.mcz

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

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

Name: VMMaker.oscog-eem.2880
Author: eem
Time: 11 November 2020, 6:39:39.03013 pm
UUID: 6baaab83-7f09-434a-9db1-affff34cc15a
Ancestors: VMMaker.oscog-eem.2879

...and there's a lot more where that came from.

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

Item was changed:
  ----- Method: CoInterpreter>>isCFramePointerInUse:_: (in category 'cog jit support') -----
  isCFramePointerInUse: cFrmPtrPtr _: cStkPtrPtr
+ <var: 'cFrmPtrPtr' type: #'usqIntptr_t *'>
+ <var: 'cStkPtrPtr' type: #'usqIntptr_t *'>
- <var: 'cFrmPtrPtr' type: 'usqIntptr_t *'>
- <var: 'cStkPtrPtr' type: 'usqIntptr_t *'>
  <doNotGenerate>
  "This must be implemented externally, e.g. in sqPlatMain.c."
  ^self class initializationOptions at: #isCFramePointerInUse ifAbsent: [true]!

Item was changed:
  ----- Method: CogClass>>cCoerceSimple:to: (in category 'translation support') -----
  cCoerceSimple: value to: cTypeString
  <doNotGenerate>
  "Type coercion for translation and simulation.
  For simulation answer a suitable surrogate for the struct types"
  ^cTypeString caseOf:
    { [#'unsigned long'] -> [value].
  [#'unsigned int'] -> [value].
  [#'unsigned short'] -> [value].
  [#sqInt] -> [value].
  [#'sqIntptr_t'] -> [value].
  [#'usqIntptr_t'] -> [value].
  [#usqInt] -> [value].
  [#sqLong] -> [value].
  [#usqLong] -> [value].
  [#'AbstractInstruction *'] -> [value].
  [#'SpurSegmentInfo *'] -> [value].
  [#'BytecodeFixup *'] -> [value].
  [#'CogMethod *'] -> [value].
  [#'char *'] -> [value].
  [#'sqInt *'] -> [value].
  [#'void *'] -> [value].
  [#void] -> [value].
  [#'void (*)()'] -> [value].
  [#'void (*)(void)'] -> [value].
  [#'usqIntptr_t (*)(void)'] -> [value].
  [#'void (*)(usqIntptr_t,usqIntptr_t)'] -> [value].
+ [#'usqIntptr_t (*)(usqIntptr_t)'] -> [value].
+ [#'usqIntptr_t (*)(void)'] -> [value] }!
- [#'uintptr_t (*)(uintptr_t)'] -> [value].
- [#'uintptr_t (*)(void)'] -> [value] }!

Item was changed:
  ----- Method: CogIA32Compiler class>>declareCVarsIn: (in category 'translation') -----
  declareCVarsIn: aCCodeGenerator
  aCCodeGenerator
+ declareVar: 'cpuidWord0' type: #usqIntptr_t;
+ declareVar: 'cpuidWord1' type: #usqIntptr_t!
- declareVar: 'cpuidWord0' type: #uintptr_t;
- declareVar: 'cpuidWord1' type: #uintptr_t!

Item was changed:
  ----- Method: CogIA32Compiler>>detectFeatures (in category 'feature detection') -----
  detectFeatures
  "Do a throw-away compilation to get at the cpuid info and initialize cpuidWord0 and cpuidWord1.
  N.B. All of MSVC, gcc & clang have intrinsics for this, so if you have the energy by all means
  reimplement as an #if _MSC_VER...#elif __GNUC__ #else ... saga."
  | startAddress cpuid |
+ <var: 'cpuid' declareC: 'usqIntptr_t (*cpuid)(usqIntptr_t arg)'>
- <var: 'cpuid' declareC: 'uintptr_t (*cpuid)(uintptr_t arg)'>
  startAddress := cogit methodZoneBase.
  cogit allocateOpcodes: 10 bytecodes: 0.
+ cpuid := cogit cCoerceSimple: cogit methodZoneBase to: #'usqIntptr_t (*)(usqIntptr_t)'.
- cpuid := cogit cCoerceSimple: cogit methodZoneBase to: #'uintptr_t (*)(uintptr_t)'.
  cogit
  PushR: EDX;
  PushR: ECX;
  PushR: EBX;
  MoveMw: 16 "3 saved registers plus return pc" r: ESP R: EAX;
  gen: CPUID;
  MoveR: EDX R: EAX;
  PopR: EBX;
  PopR: ECX;
  PopR: EDX;
  RetN: 0.
  cogit outputInstructionsForGeneratedRuntimeAt: startAddress.
  cogit resetMethodZoneBase: startAddress.
  self setCpuidWord0: (self cCode: 'cpuid(1)' inSmalltalk: [self cpuid: 1]).
  cogit zeroOpcodeIndexForNewOpcodes.
  cogit
  PushR: EDX;
  PushR: ECX;
  PushR: EBX;
  MoveMw: 16 "3 saved registers plus return pc" r: ESP R: EAX;
  gen: CPUID;
  MoveR: ECX R: EAX;
  PopR: EBX;
  PopR: ECX;
  PopR: EDX;
  RetN: 0.
  cogit outputInstructionsForGeneratedRuntimeAt: startAddress.
  cogit resetMethodZoneBase: startAddress.
  self setCpuidWord1: (self cCode: 'cpuid(0x80000001)' inSmalltalk: [self cpuid: 16r80000001])!

Item was changed:
  ----- Method: CogX64Compiler class>>declareCVarsIn: (in category 'translation') -----
  declareCVarsIn: aCCodeGenerator
  aCCodeGenerator
+ declareVar: 'cpuidWord1' type: #usqIntptr_t!
- declareVar: 'cpuidWord1' type: #uintptr_t!

Item was changed:
  ----- Method: CogX64Compiler>>detectFeatures (in category 'feature detection') -----
  detectFeatures
  "Do a throw-away compilation to get at the cpuid info and initialize cpuidWord1
  N.B. All of MSVC, gcc & clang have intrinsics for this, so if you have the energy
  by all means reimplement as an #if _MSC_VER...#elif __GNUC__ #else ... saga."
  | startAddress cpuid |
+ <var: 'cpuid' declareC: 'usqIntptr_t (*cpuid)(void)'>
- <var: 'cpuid' declareC: 'uintptr_t (*cpuid)(void)'>
  startAddress := cogit methodZoneBase.
  cogit allocateOpcodes: 10 bytecodes: 0.
+ cpuid := cogit cCoerceSimple: startAddress to: #'usqIntptr_t (*)(void)'.
- cpuid := cogit cCoerceSimple: startAddress to: #'uintptr_t (*)(void)'.
  cogit
  PushR: RDX;
  PushR: RCX;
  PushR: RBX;
  MoveCq: 16r80000001 R: RAX;
  gen: CPUID;
  MoveR: RCX R: RAX;
  PopR: RBX;
  PopR: RCX;
  PopR: RDX;
  RetN: 0.
  cogit outputInstructionsForGeneratedRuntimeAt: startAddress.
  cogit resetMethodZoneBase: startAddress.
  self setCpuidWord1: (self cCode: 'cpuid()' inSmalltalk: [cogit simulateLeafCallOf: startAddress])!

Item was changed:
  ----- Method: Cogit>>generateVMOwnerLockFunctions (in category 'initialization') -----
  generateVMOwnerLockFunctions
  <inline: true>
  self cppIf: COGMTVM ifTrue:
  [| startAddress |
  self allocateOpcodes: backEnd numLowLevelLockOpcodes bytecodes: 0.
  self zeroOpcodeIndex.
  startAddress := methodZoneBase.
  backEnd generateLowLevelTryLock: coInterpreter vmOwnerAddress.
  self outputInstructionsForGeneratedRuntimeAt: startAddress.
  self recordGeneratedRunTime: 'ceTryLockVMOwner' address: startAddress.
+ ceTryLockVMOwner := self cCoerceSimple: startAddress to: #'usqIntptr_t (*)(usqIntptr_t)']!
- ceTryLockVMOwner := self cCoerceSimple: startAddress to: #'uintptr_t (*)(uintptr_t)']!

Item was changed:
  ----- Method: StackInterpreter>>lowcodePrimitiveInt32ToPointer (in category 'inline primitive generated code') -----
  lowcodePrimitiveInt32ToPointer
  <option: #LowcodeVM> "Lowcode instruction generator"
  | value result |
  <var: #value type: #'sqInt' >
  <var: #result type: #'char*' >
  value := self internalPopStackInt32.
 
+ result := self cCoerce: (self cCoerce: value to: 'usqIntptr_t') to: 'char*'.
- result := self cCoerce: (self cCoerce: value to: 'uintptr_t') to: 'char*'.
 
  self internalPushPointer: result.
 
  !

Item was changed:
  ----- Method: StackInterpreter>>lowcodePrimitivePointerToInt32 (in category 'inline primitive generated code') -----
  lowcodePrimitivePointerToInt32
  <option: #LowcodeVM> "Lowcode instruction generator"
  | pointer result |
  <var: #pointer type: #'char*' >
  <var: #result type: #'sqInt' >
  pointer := self internalPopStackPointer.
 
+ result := self cCoerce: pointer to: 'usqIntptr_t'.
- result := self cCoerce: pointer to: 'uintptr_t'.
 
  self internalPushInt32: result.
 
  !

Item was changed:
  ----- Method: StackInterpreter>>lowcodePrimitivePointerToInt64 (in category 'inline primitive generated code') -----
  lowcodePrimitivePointerToInt64
  <option: #LowcodeVM> "Lowcode instruction generator"
  | pointer result |
  <var: #pointer type: #'char*' >
  <var: #result type: #'sqLong' >
  pointer := self internalPopStackPointer.
 
+ result := self cCoerce: pointer to: 'usqIntptr_t'.
- result := self cCoerce: pointer to: 'uintptr_t'.
 
  self internalPushInt64: result.
 
  !