[Vm-dev] VM Maker: VMMaker.oscog-eem.3256.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Oct 22 00:20:32 UTC 2022


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

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

Name: VMMaker.oscog-eem.3256
Author: eem
Time: 21 October 2022, 5:20:14.390293 pm
UUID: 85febed5-d156-4c33-8b7f-3b0d1835665d
Ancestors: VMMaker.oscog-eem.3255

The long-running primitive monitoring code in the JIT is broken; it will find false positives.  Fix it by zeroing longRunningPrimitiveStopUsecs whenever an external primitive is run (at the same time newmethod is assigned).

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

Item was added:
+ ----- Method: CoInterpreter>>checkingLongRunningPrimitives (in category 'cog jit support') -----
+ checkingLongRunningPrimitives
+ 	<api>
+ 	<option: #LRPCheck>
+ 	^longRunningPrimitiveCheckSemaphore notNil!

Item was added:
+ ----- Method: CoInterpreter>>longRunningPrimitiveStopUsecs: (in category 'cog jit support') -----
+ longRunningPrimitiveStopUsecs: n
+ 	<doNotGenerate>
+ 	longRunningPrimitiveStopUsecs := n!

Item was added:
+ ----- Method: CoInterpreter>>longRunningPrimitiveStopUsecsAddress (in category 'cog jit support') -----
+ longRunningPrimitiveStopUsecsAddress
+ 	<api>
+ 	<returnTypeC: #usqInt>
+ 	<option: #LRPCheck>
+ 	^self cCode: [(self addressOf: longRunningPrimitiveStopUsecs) asUnsignedInteger]
+ 		inSmalltalk:
+ 			[objectMemory wordSize = 8
+ 				ifTrue:
+ 					[cogit simulatedReadWriteVariableAddress: #longRunningPrimitiveStopUsecs in: self]
+ 				ifFalse:
+ 					["This looks weird, but the cogit doles out fake addresses counting down from
+ 					  16r80000000, so we have to ask for the halves backwards to get them in the
+ 					  right order, and ask for both now so that both get defined at the same time
+ 					  and are hence contiguous in memory."
+ 					 VMBIGENDIAN
+ 						ifTrue:
+ 							[cogit simulatedReadWriteVariableAddress: #longRunningPrimitiveStopUsecsHigh in: self.
+ 							 cogit simulatedReadWriteVariableAddress: #longRunningPrimitiveStopUsecsLow in: self.
+ 							 cogit simulatedReadWriteVariableAddress: #longRunningPrimitiveStopUsecsHigh in: self]
+ 						ifFalse:
+ 							[cogit simulatedReadWriteVariableAddress: #longRunningPrimitiveStopUsecsLow in: self.
+ 							 cogit simulatedReadWriteVariableAddress: #longRunningPrimitiveStopUsecsHigh in: self.
+ 							 cogit simulatedReadWriteVariableAddress: #longRunningPrimitiveStopUsecsLow in: self]]]!

Item was added:
+ ----- Method: CoInterpreter>>longRunningPrimitiveStopUsecsHigh: (in category 'cog jit support') -----
+ longRunningPrimitiveStopUsecsHigh: n
+ 	<doNotGenerate>
+ 	longRunningPrimitiveStopUsecs := (longRunningPrimitiveStopUsecs bitAnd: 16rFFFFFFFF) + (n bitShift: 32)!

Item was added:
+ ----- Method: CoInterpreter>>longRunningPrimitiveStopUsecsLow: (in category 'cog jit support') -----
+ longRunningPrimitiveStopUsecsLow: n
+ 	<doNotGenerate>
+ 	longRunningPrimitiveStopUsecs := ((longRunningPrimitiveStopUsecs bitShift: -32) bitShift: 32) + n!

Item was changed:
  ----- Method: CoInterpreter>>nextProfileTickAddress (in category 'trampoline support') -----
  nextProfileTickAddress
  	<api>
  	<returnTypeC: #usqInt>
  	"N.B. nextProfileTick is 64-bits"
  	^self cCode: [(self addressOf: nextProfileTick) asUnsignedInteger]
  		inSmalltalk:
  			[objectMemory wordSize = 8
  				ifTrue:
  					[cogit simulatedReadWriteVariableAddress: #nextProfileTick in: self]
  				ifFalse:
  					["This looks weird, but the cogit doles out fake addresses counting down from
  					  16r80000000, so we have to ask for the halves backwards to get them in the
+ 					  right order, and ask for both now so that both get defined at the same time
- 					  right order, and ask for both now so that botehr get defined at teh same time
  					  and are hence contiguous in memory."
  					 VMBIGENDIAN
  						ifTrue:
  							[cogit simulatedReadWriteVariableAddress: #nextProfileTickHigh in: self.
  							 cogit simulatedReadWriteVariableAddress: #nextProfileTickLow in: self.
  							 cogit simulatedReadWriteVariableAddress: #nextProfileTickHigh in: self]
  						ifFalse:
  							[cogit simulatedReadWriteVariableAddress: #nextProfileTickLow in: self.
  							 cogit simulatedReadWriteVariableAddress: #nextProfileTickHigh in: self.
  							 cogit simulatedReadWriteVariableAddress: #nextProfileTickLow in: self]]]!

Item was changed:
  ----- Method: SimpleStackBasedCogit>>genLoadNewMethod (in category 'primitive generators') -----
  genLoadNewMethod
  	<inline: false>
  	methodLabel addDependent:
  		(self annotateAbsolutePCRef:
  			(self MoveCw: methodLabel asInteger R: ClassReg)).
  	 self MoveMw: (self offset: CogMethod of: #methodObject) r: ClassReg R: TempReg.
+ 	 self MoveR: TempReg Aw: coInterpreter newMethodAddress.
+ 	self cppIf: #LRPCheck
+ 		ifTrue:
+ 			[coInterpreter checkingLongRunningPrimitives ifTrue:
+ 				[self MoveCq: 0 R: TempReg.
+ 				 objectMemory wordSize = 8
+ 					ifTrue:
+ 						[self MoveR: TempReg Aw: coInterpreter longRunningPrimitiveStopUsecsAddress]
+ 					ifFalse:
+ 						[self MoveR: TempReg Aw: coInterpreter longRunningPrimitiveStopUsecsAddress;
+ 							MoveR: TempReg Aw: coInterpreter longRunningPrimitiveStopUsecsAddress + 4]]]!
- 	 self MoveR: TempReg Aw: coInterpreter newMethodAddress!



More information about the Vm-dev mailing list