VM Maker: VMMaker.oscog-rsf.2127.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-rsf.2127.mcz

commits-2
 
Ronie Salgado Faila uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-rsf.2127.mcz

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

Name: VMMaker.oscog-rsf.2127
Author: rsf
Time: 9 February 2017, 11:44:14.589619 pm
UUID: 1a6d3cce-b752-4e79-905f-e1b6c155d910
Ancestors: VMMaker.oscog-eem.2126

Do not destroy registers that are used in the standard C calling convention when going through the Lowcode callout trampoline.
Fix some minor compilation problems.

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

Item was added:
+ ----- Method: CogIA32Compiler>>registerToSaveIP (in category 'abi') -----
+ registerToSaveIP
+ "Temporary register used for fetching the instruction pointer. This should
+ not be used for passing parameters in a standard ABI"
+ <option: #LowcodeVM>
+ ^ ClassReg!

Item was added:
+ ----- Method: CogMethod>>counters (in category 'accessing') -----
+ counters
+ ^ 0!

Item was added:
+ ----- Method: CogX64Compiler>>registerToSaveIP (in category 'abi') -----
+ registerToSaveIP
+ "Temporary register used for fetching the instruction pointer. This should
+ not be used for passing parameters in a standard ABI"
+ <option: #LowcodeVM>
+ ^ R15!

Item was changed:
  ----- Method: Cogit>>checkIfValidOopRefAndTarget:pc:cogMethod: (in category 'garbage collection') -----
  checkIfValidOopRefAndTarget: annotation pc: mcpc cogMethod: cogMethod
  "Check for a valid object reference, if any, at a map entry.  Answer a code unique to each error for debugging."
  <var: #mcpc type: #'char *'>
  <var: #nsSendCache type: #'NSSendCache *'>
  | literal entryPoint |
  annotation = IsObjectReference ifTrue:
  [literal := literalsManager fetchLiteralAtAnnotatedAddress: mcpc asUnsignedInteger using: backEnd.
  (self asserta: (objectRepresentation checkValidOopReference: literal)) ifFalse:
  [^1].
  ((objectRepresentation couldBeObject: literal)
  and: [objectMemory isReallyYoungObject: literal]) ifTrue:
  [(self asserta: (self cCoerceSimple: cogMethod to: #'CogMethod *') cmRefersToYoung) ifFalse:
  [^2]]].
 
  NewspeakVM ifTrue:
  [annotation = IsNSSendCall ifTrue:
  [| nsSendCache classTag enclosingObject nsTargetMethod |
  nsSendCache := self nsSendCacheFromReturnAddress: mcpc asInteger.
  (self asserta: (objectRepresentation checkValidOopReference: nsSendCache selector)) ifFalse:
  [^9].
  classTag := nsSendCache classTag.
  (self asserta: (classTag = 0 or: [objectRepresentation validInlineCacheTag: classTag])) ifFalse:
  [^10].
  enclosingObject := nsSendCache enclosingObject.
  (self asserta: (enclosingObject = 0 or: [objectRepresentation checkValidOopReference: enclosingObject])) ifFalse:
  [^11].
  entryPoint := nsSendCache target.
  entryPoint ~= 0 ifTrue: [
  nsTargetMethod := self cCoerceSimple: entryPoint - cmNoCheckEntryOffset to: #'CogMethod *'.
  (self asserta: (nsTargetMethod cmType = CMMethod)) ifFalse:
  [^12]]]].
 
  (self isPureSendAnnotation: annotation) ifTrue:
  [(self asserta: (self cCoerceSimple: cogMethod to: #'CogMethod *') cmType = CMMethod) ifFalse:
  [^3].
  self entryCacheTagAndCouldBeObjectAt: mcpc annotation: annotation into:
  [:entryPt :cacheTag :tagCouldBeObject|
  entryPoint := entryPt.
  tagCouldBeObject
  ifTrue:
  [(objectRepresentation couldBeObject: cacheTag)
  ifTrue:
  [(self asserta: (objectRepresentation checkValidOopReference: cacheTag)) ifFalse:
  [^4]]
  ifFalse:
  [(self asserta: (objectRepresentation validInlineCacheTag: cacheTag)) ifFalse:
  [^5]].
  ((objectRepresentation couldBeObject: cacheTag)
  and: [objectMemory isReallyYoungObject: cacheTag]) ifTrue:
  [(self asserta: (self cCoerceSimple: cogMethod to: #'CogMethod *') cmRefersToYoung) ifFalse:
  [^6]]]
  ifFalse:
  [(self inlineCacheTagsAreIndexes
+  and: [self entryPointTagIsSelector: entryPoint])
-  and: [self self entryPointTagIsSelector: entryPoint])
  ifTrue:
  [cacheTag signedIntFromLong < 0
  ifTrue:
  [cacheTag signedIntFromLong negated > NumSpecialSelectors ifTrue:
  [^7]]
  ifFalse:
  [cacheTag >= (objectMemory literalCountOf: enumeratingCogMethod methodObject) ifTrue:
  [^8]]]
  ifFalse:
  [(self asserta: (objectRepresentation validInlineCacheTag: cacheTag)) ifFalse:
  [^9]]]].
  entryPoint > methodZoneBase ifTrue:
  ["It's a linked send; find which kind."
  self targetMethodAndSendTableFor: entryPoint annotation: annotation into:
  [:targetMethod :sendTable|
  (self asserta: (targetMethod cmType = CMMethod
    or: [targetMethod cmType = CMClosedPIC
    or: [targetMethod cmType = CMOpenPIC]])) ifFalse:
  [^10]]]].
  ^0 "keep scanning"!

Item was changed:
  ----- Method: Cogit>>genFFICalloutTrampoline (in category 'initialization') -----
  genFFICalloutTrampoline
  <option: #LowcodeVM>
  | startAddress |
  opcodeIndex := 0.
  backEnd hasLinkRegister ifTrue: [
  self MoveR: LinkReg Aw: coInterpreter instructionPointerAddress
  ] ifFalse: [
+ self PopR: backEnd registerToSaveIP.
+ self MoveR: backEnd registerToSaveIP Aw: coInterpreter instructionPointerAddress
- self PopR: ClassReg.
- self MoveR: ClassReg Aw: coInterpreter instructionPointerAddress
  ].
 
  self CallR: TempReg.
 
  backEnd hasLinkRegister ifTrue: [
  self MoveAw: coInterpreter instructionPointerAddress R: LinkReg
  ] ifFalse: [
+ self MoveAw: coInterpreter instructionPointerAddress R: backEnd registerToSaveIP.
+ self PushR: backEnd registerToSaveIP.
- self MoveAw: coInterpreter instructionPointerAddress R: ClassReg.
- self PushR: ClassReg.
  ].
 
  self RetN: 0.
 
  startAddress := methodZoneBase.
  self outputInstructionsForGeneratedRuntimeAt: startAddress.
  self recordGeneratedRunTime: 'ceFFICalloutTrampoline' address: startAddress.
  self recordRunTimeObjectReferences.
  ^ startAddress
  !