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

commits at source.squeak.org commits at source.squeak.org
Thu Jul 16 02:55:04 UTC 2015


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

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

Name: VMMaker.oscog-eem.1421
Author: eem
Time: 15 July 2015, 7:52:24.886 pm
UUID: 662f4359-0c53-410a-9be0-e8fa46ea0446
Ancestors: VMMaker.oscog-eem.1420

Implement a machine code perform:[with:]* primitive,  Fix open PICs in the simulator.  They were failing due to an off-by-one error and have been for ages.  Eliminate the duplication between SimpleStackBasedCogit>>compileOpenPIC:numArgs: and StackToRegisterMappingCogit>>compileOpenPIC:numArgs: now that we have dead code elimination enabled.

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

Item was changed:
  ----- Method: CoInterpreter>>methodCacheAddress (in category 'cog jit support') -----
  methodCacheAddress
  	<api>
  	<returnTypeC: #'void *'>
+ 	^self cCode: [methodCache] inSmalltalk: [methodCache offset - 1 * objectMemory wordSize]!
- 	^self cCode: 'GIV(methodCache)' inSmalltalk: [methodCache offset * objectMemory wordSize]!

Item was changed:
  ----- Method: SimpleStackBasedCogit class>>initializePrimitiveTableForNewsqueak (in category 'class initialization') -----
  initializePrimitiveTableForNewsqueak
  	"Initialize the table of primitive generators.  This does not include normal primitives implemented in the coInterpreter.
  	 N.B. primitives that don't have an explicit arg count (the integer following the generator) may be variadic."
  	"SimpleStackBasedCogit initializePrimitiveTableForSqueakV3"
  	MaxCompiledPrimitiveIndex := 222.
  	primitiveTable := CArrayAccessor on: (Array new: MaxCompiledPrimitiveIndex + 1).
  	self table: primitiveTable from: 
  	#(	"Integer Primitives (0-19)"
  		(1 genPrimitiveAdd				1	mclassIsSmallInteger:)
  		(2 genPrimitiveSubtract			1	mclassIsSmallInteger:)
  		(3 genPrimitiveLessThan		1	mclassIsSmallInteger:)
  		(4 genPrimitiveGreaterThan		1	mclassIsSmallInteger:)
  		(5 genPrimitiveLessOrEqual		1	mclassIsSmallInteger:)
  		(6 genPrimitiveGreaterOrEqual	1	mclassIsSmallInteger:)
  		(7 genPrimitiveEqual			1	mclassIsSmallInteger:)
  		(8 genPrimitiveNotEqual		1	mclassIsSmallInteger:)
  		(9 genPrimitiveMultiply			1	processorHasMultiplyAndMClassIsSmallInteger:)
  		(10 genPrimitiveDivide			1	processorHasDivQuoRemAndMClassIsSmallInteger:)
  		(11 genPrimitiveMod			1	processorHasDivQuoRemAndMClassIsSmallInteger:)
  		(12 genPrimitiveDiv				1	processorHasDivQuoRemAndMClassIsSmallInteger:)
  		(13 genPrimitiveQuo			1	processorHasDivQuoRemAndMClassIsSmallInteger:)
  		(14 genPrimitiveBitAnd			1	mclassIsSmallInteger:)
  		(15 genPrimitiveBitOr			1	mclassIsSmallInteger:)
  		(16 genPrimitiveBitXor			1	mclassIsSmallInteger:)
  		(17 genPrimitiveBitShift			1	mclassIsSmallInteger:)
  		"(18 primitiveMakePoint)"
  		"(19 primitiveFail)"					"Guard primitive for simulation -- *must* fail"
  
  		"LargeInteger Primitives (20-39)"
  		"(20 primitiveFail)"
  		"(21 primitiveAddLargeIntegers)"
  		"(22 primitiveSubtractLargeIntegers)"
  		"(23 primitiveLessThanLargeIntegers)"
  		"(24 primitiveGreaterThanLargeIntegers)"
  		"(25 primitiveLessOrEqualLargeIntegers)"
  		"(26 primitiveGreaterOrEqualLargeIntegers)"
  		"(27 primitiveEqualLargeIntegers)"
  		"(28 primitiveNotEqualLargeIntegers)"
  		"(29 primitiveMultiplyLargeIntegers)"
  		"(30 primitiveDivideLargeIntegers)"
  		"(31 primitiveModLargeIntegers)"
  		"(32 primitiveDivLargeIntegers)"
  		"(33 primitiveQuoLargeIntegers)"
  		"(34 primitiveBitAndLargeIntegers)"
  		"(35 primitiveBitOrLargeIntegers)"
  		"(36 primitiveBitXorLargeIntegers)"
  		"(37 primitiveBitShiftLargeIntegers)"
  
  		"Float Primitives (38-59)"
  		"(38 primitiveFloatAt)"
  		"(39 primitiveFloatAtPut)"
  		(40 genPrimitiveAsFloat					0	processorHasDoublePrecisionFloatingPointSupport:)
  		(41 genPrimitiveFloatAdd				1	processorHasDoublePrecisionFloatingPointSupport:)
  		(42 genPrimitiveFloatSubtract			1	processorHasDoublePrecisionFloatingPointSupport:)
  		(43 genPrimitiveFloatLessThan			1	processorHasDoublePrecisionFloatingPointSupport:)
  		(44 genPrimitiveFloatGreaterThan		1	processorHasDoublePrecisionFloatingPointSupport:)
  		(45 genPrimitiveFloatLessOrEqual		1	processorHasDoublePrecisionFloatingPointSupport:)
  		(46 genPrimitiveFloatGreaterOrEqual	1	processorHasDoublePrecisionFloatingPointSupport:)
  		(47 genPrimitiveFloatEqual				1	processorHasDoublePrecisionFloatingPointSupport:)
  		(48 genPrimitiveFloatNotEqual			1	processorHasDoublePrecisionFloatingPointSupport:)
  		(49 genPrimitiveFloatMultiply			1	processorHasDoublePrecisionFloatingPointSupport:)
  		(50 genPrimitiveFloatDivide				1	processorHasDoublePrecisionFloatingPointSupport:)
  		"(51 primitiveTruncated)"
  		"(52 primitiveFractionalPart)"
  		"(53 primitiveExponent)"
  		"(54 primitiveTimesTwoPower)"
  		(55 genPrimitiveFloatSquareRoot		0	processorHasDoublePrecisionFloatingPointSupport:)
  		"(56 primitiveSine)"
  		"(57 primitiveArctan)"
  		"(58 primitiveLogN)"
  		"(59 primitiveExp)"
  
  		"Subscript and Stream Primitives (60-67)"
  		(60 genPrimitiveAt				1)
  		(61 genPrimitiveAtPut			2)
  		(62 genPrimitiveSize			0)
  		(63 genPrimitiveStringAt		1)
  		(64 genPrimitiveStringAtPut		2)
  		"The stream primitives no longer pay their way; normal Smalltalk code is faster."
  		(65 genFastPrimFail)"was primitiveNext"
  		(66 genFastPrimFail) "was primitiveNextPut"
  		(67 genFastPrimFail) "was primitiveAtEnd"
  
  		"StorageManagement Primitives (68-79)"
  		"(68 primitiveObjectAt)"
  		"(69 primitiveObjectAtPut)"
  		(70 genPrimitiveNew)				"For VMMirror support 1 argument instantiateFixedClass: as well as baiscNew"
  		(71 genPrimitiveNewWithArg)		"For VMMirror support 2 argument instantiateVariableClass:withSize: as well as baiscNew:"
  		"(72 primitiveArrayBecomeOneWay)"		"Blue Book: primitiveBecome"
  		"(73 primitiveInstVarAt)"
  		"(74 primitiveInstVarAtPut)"
  		(75 genPrimitiveIdentityHash	0)
  		"(76 primitiveStoreStackp)"					"Blue Book: primitiveAsObject"
  		"(77 primitiveSomeInstance)"
  		"(78 primitiveNextInstance)"
  		(79 genPrimitiveNewMethod	2)
  
  		"Control Primitives (80-89)"
  		"(80 primitiveFail)"							"Blue Book: primitiveBlockCopy"
  		"(81 primitiveFail)"							"Blue Book: primitiveValue"
  		"(82 primitiveFail)"							"Blue Book: primitiveValueWithArgs"
+ 		(83 genPrimitivePerform)
- 		"(83 primitivePerform)"
  		"(84 primitivePerformWithArgs)"
  		"(85 primitiveSignal)"
  		"(86 primitiveWait)"
  		"(87 primitiveResume)"
  		"(88 primitiveSuspend)"
  		"(89 primitiveFlushCache)"
  
  		"System Primitives (110-119)"
  		(110 genPrimitiveIdentical 1)
  		(111 genPrimitiveClass)			"For objectClass: and VMMirror support 1 argument classOf: as well as class"
  		"(112 primitiveBytesLeft)"
  		"(113 primitiveQuit)"
  		"(114 primitiveExitToDebugger)"
  		"(115 primitiveChangeClass)"					"Blue Book: primitiveOopsLeft"
  		"(116 primitiveFlushCacheByMethod)"
  		"(117 primitiveExternalCall)"
  		"(118 primitiveDoPrimitiveWithArgs)"
  		"(119 primitiveFlushCacheSelective)"
  
  		(169 genPrimitiveNotIdentical 1)
  
  		(170 genPrimitiveAsCharacter)			"SmallInteger>>asCharacter, Character class>>value:"
  		(171 genPrimitiveCharacterValue 0)	"Character>>value"
  			
  		"(173 primitiveSlotAt 1)"
  		"(174 primitiveSlotAtPut 2)"
  		(175 genPrimitiveIdentityHash	0)		"Behavior>>identityHash"
  
  		"Old closure primitives"
  		"(186 primitiveFail)" "was primitiveClosureValue"
  		"(187 primitiveFail)" "was primitiveClosureValueWithArgs"
  
  		"Perform method directly"
  		"(188 primitiveExecuteMethodArgsArray)"
  		"(189 primitiveExecuteMethod)"
  
  		"Unwind primitives"
  		"(195 primitiveFindNextUnwindContext)"
  		"(196 primitiveTerminateTo)"
  		"(197 primitiveFindHandlerContext)"
  		(198 genFastPrimFail "primitiveMarkUnwindMethod")
  		(199 genFastPrimFail "primitiveMarkHandlerMethod")
  
  		"new closure primitives"
  		"(200 primitiveClosureCopyWithCopiedValues)"
  		(201 genPrimitiveClosureValue	0) "value"
  		(202 genPrimitiveClosureValue	1) "value:"
  		(203 genPrimitiveClosureValue	2) "value:value:"
  		(204 genPrimitiveClosureValue	3) "value:value:value:"
  		(205 genPrimitiveClosureValue	4) "value:value:value:value:"
  		"(206 genPrimitiveClosureValueWithArgs)" "valueWithArguments:"
  
  		"(210 primitiveContextAt)"
  		"(211 primitiveContextAtPut)"
  		"(212 primitiveContextSize)"
  
  		"(218 primitiveDoNamedPrimitiveWithArgs)"
  		"(219 primitiveFail)"	"reserved for Cog primitives"
  
  		"(220 primitiveFail)"		"reserved for Cog primitives"
  
  		(221 genPrimitiveClosureValue	0) "valueNoContextSwitch"
  		(222 genPrimitiveClosureValue	1) "valueNoContextSwitch:"
  
  		"(541 primitiveSmallFloatAdd				1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(542 primitiveSmallFloatSubtract			1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(543 primitiveSmallFloatLessThan			1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(544 primitiveSmallFloatGreaterThan		1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(545 primitiveSmallFloatLessOrEqual		1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(546 primitiveSmallFloatGreaterOrEqual	1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(547 primitiveSmallFloatEqual				1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(548 primitiveSmallFloatNotEqual			1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(549 primitiveSmallFloatMultiply			1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(550 primitiveSmallFloatDivide				1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(551 primitiveSmallFloatTruncated			0	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(552 primitiveSmallFloatFractionalPart		0	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(553 primitiveSmallFloatExponent			0	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(554 primitiveSmallFloatTimesTwoPower	1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(555 primitiveSmallFloatSquareRoot		0	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(556 primitiveSmallFloatSine				0	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(557 primitiveSmallFloatArctan				0	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(558 primitiveSmallFloatLogN				0	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(559 primitiveSmallFloatExp				0	processorHasDoublePrecisionFloatingPointSupport:)"
  	)!

Item was changed:
  ----- Method: SimpleStackBasedCogit class>>initializePrimitiveTableForSqueak (in category 'class initialization') -----
  initializePrimitiveTableForSqueak
  	"Initialize the table of primitive generators.  This does not include normal primitives implemented in the coInterpreter.
  	 N.B. primitives that don't have an explicit arg count (the integer following the generator) may be variadic."
  	"SimpleStackBasedCogit initializePrimitiveTableForSqueak"
  	MaxCompiledPrimitiveIndex := 222.
  	primitiveTable := CArrayAccessor on: (Array new: MaxCompiledPrimitiveIndex + 1).
  	self table: primitiveTable from: 
  	#(	"Integer Primitives (0-19)"
  		(1 genPrimitiveAdd				1	mclassIsSmallInteger:)
  		(2 genPrimitiveSubtract			1	mclassIsSmallInteger:)
  		(3 genPrimitiveLessThan		1	mclassIsSmallInteger:)
  		(4 genPrimitiveGreaterThan		1	mclassIsSmallInteger:)
  		(5 genPrimitiveLessOrEqual		1	mclassIsSmallInteger:)
  		(6 genPrimitiveGreaterOrEqual	1	mclassIsSmallInteger:)
  		(7 genPrimitiveEqual			1	mclassIsSmallInteger:)
  		(8 genPrimitiveNotEqual		1	mclassIsSmallInteger:)
  		(9 genPrimitiveMultiply			1	processorHasMultiplyAndMClassIsSmallInteger:)
  		(10 genPrimitiveDivide			1	processorHasDivQuoRemAndMClassIsSmallInteger:)
  		(11 genPrimitiveMod			1	processorHasDivQuoRemAndMClassIsSmallInteger:)
  		(12 genPrimitiveDiv				1	processorHasDivQuoRemAndMClassIsSmallInteger:)
  		(13 genPrimitiveQuo			1	processorHasDivQuoRemAndMClassIsSmallInteger:)
  		(14 genPrimitiveBitAnd			1	mclassIsSmallInteger:)
  		(15 genPrimitiveBitOr			1	mclassIsSmallInteger:)
  		(16 genPrimitiveBitXor			1	mclassIsSmallInteger:)
  		(17 genPrimitiveBitShift			1	mclassIsSmallInteger:)
  		"(18 primitiveMakePoint)"
  		"(19 primitiveFail)"					"Guard primitive for simulation -- *must* fail"
  
  		"LargeInteger Primitives (20-39)"
  		"(20 primitiveFail)"
  		"(21 primitiveAddLargeIntegers)"
  		"(22 primitiveSubtractLargeIntegers)"
  		"(23 primitiveLessThanLargeIntegers)"
  		"(24 primitiveGreaterThanLargeIntegers)"
  		"(25 primitiveLessOrEqualLargeIntegers)"
  		"(26 primitiveGreaterOrEqualLargeIntegers)"
  		"(27 primitiveEqualLargeIntegers)"
  		"(28 primitiveNotEqualLargeIntegers)"
  		"(29 primitiveMultiplyLargeIntegers)"
  		"(30 primitiveDivideLargeIntegers)"
  		"(31 primitiveModLargeIntegers)"
  		"(32 primitiveDivLargeIntegers)"
  		"(33 primitiveQuoLargeIntegers)"
  		"(34 primitiveBitAndLargeIntegers)"
  		"(35 primitiveBitOrLargeIntegers)"
  		"(36 primitiveBitXorLargeIntegers)"
  		"(37 primitiveBitShiftLargeIntegers)"
  
  		"Float Primitives (38-59)"
  		"(38 primitiveFloatAt)"
  		"(39 primitiveFloatAtPut)"
  		(40 genPrimitiveAsFloat					0	processorHasDoublePrecisionFloatingPointSupport:)
  		(41 genPrimitiveFloatAdd				1	processorHasDoublePrecisionFloatingPointSupport:)
  		(42 genPrimitiveFloatSubtract			1	processorHasDoublePrecisionFloatingPointSupport:)
  		(43 genPrimitiveFloatLessThan			1	processorHasDoublePrecisionFloatingPointSupport:)
  		(44 genPrimitiveFloatGreaterThan		1	processorHasDoublePrecisionFloatingPointSupport:)
  		(45 genPrimitiveFloatLessOrEqual		1	processorHasDoublePrecisionFloatingPointSupport:)
  		(46 genPrimitiveFloatGreaterOrEqual	1	processorHasDoublePrecisionFloatingPointSupport:)
  		(47 genPrimitiveFloatEqual				1	processorHasDoublePrecisionFloatingPointSupport:)
  		(48 genPrimitiveFloatNotEqual			1	processorHasDoublePrecisionFloatingPointSupport:)
  		(49 genPrimitiveFloatMultiply			1	processorHasDoublePrecisionFloatingPointSupport:)
  		(50 genPrimitiveFloatDivide				1	processorHasDoublePrecisionFloatingPointSupport:)
  		"(51 primitiveTruncated)"
  		"(52 primitiveFractionalPart)"
  		"(53 primitiveExponent)"
  		"(54 primitiveTimesTwoPower)"
  		(55 genPrimitiveFloatSquareRoot		0	processorHasDoublePrecisionFloatingPointSupport:)
  		"(56 primitiveSine)"
  		"(57 primitiveArctan)"
  		"(58 primitiveLogN)"
  		"(59 primitiveExp)"
  
  		"Subscript and Stream Primitives (60-67)"
  		(60 genPrimitiveAt				1)
  		(61 genPrimitiveAtPut			2)
  		(62 genPrimitiveSize			0)
  		(63 genPrimitiveStringAt		1)
  		(64 genPrimitiveStringAtPut		2)
  		"The stream primitives no longer pay their way; normal Smalltalk code is faster."
  		(65 genFastPrimFail)"was primitiveNext"
  		(66 genFastPrimFail) "was primitiveNextPut"
  		(67 genFastPrimFail) "was primitiveAtEnd"
  
  		"StorageManagement Primitives (68-79)"
  		"(68 primitiveObjectAt)"
  		"(69 primitiveObjectAtPut)"
  		(70 genPrimitiveNew			0)
  		(71 genPrimitiveNewWithArg	1)
  		"(72 primitiveArrayBecomeOneWay)"		"Blue Book: primitiveBecome"
  		"(73 primitiveInstVarAt)"
  		"(74 primitiveInstVarAtPut)"
  		(75 genPrimitiveIdentityHash	0)
  		"(76 primitiveStoreStackp)"					"Blue Book: primitiveAsObject"
  		"(77 primitiveSomeInstance)"
  		"(78 primitiveNextInstance)"
  		(79 genPrimitiveNewMethod	2)
  
  		"Control Primitives (80-89)"
  		"(80 primitiveFail)"							"Blue Book: primitiveBlockCopy"
  		"(81 primitiveFail)"							"Blue Book: primitiveValue"
  		"(82 primitiveFail)"							"Blue Book: primitiveValueWithArgs"
+ 		(83 genPrimitivePerform)
- 		"(83 primitivePerform)"
  		"(84 primitivePerformWithArgs)"
  		"(85 primitiveSignal)"
  		"(86 primitiveWait)"
  		"(87 primitiveResume)"
  		"(88 primitiveSuspend)"
  		"(89 primitiveFlushCache)"
  
  		"System Primitives (110-119)"
  		(110 genPrimitiveIdentical 1)
  		(111 genPrimitiveClass)				"Support both class and Context>>objectClass:"
  		"(112 primitiveBytesLeft)"
  		"(113 primitiveQuit)"
  		"(114 primitiveExitToDebugger)"
  		"(115 primitiveChangeClass)"					"Blue Book: primitiveOopsLeft"
  		"(116 primitiveFlushCacheByMethod)"
  		"(117 primitiveExternalCall)"
  		"(118 primitiveDoPrimitiveWithArgs)"
  		"(119 primitiveFlushCacheSelective)"
  
  		(169 genPrimitiveNotIdentical 1)
  
  		(170 genPrimitiveAsCharacter)			"SmallInteger>>asCharacter, Character class>>value:"
  		(171 genPrimitiveCharacterValue 0)	"Character>>value"
  			
  		"(173 primitiveSlotAt 1)"
  		"(174 primitiveSlotAtPut 2)"
  		(175 genPrimitiveIdentityHash	0)		"Behavior>>identityHash"
  
  		"Old closure primitives"
  		"(186 primitiveFail)" "was primitiveClosureValue"
  		"(187 primitiveFail)" "was primitiveClosureValueWithArgs"
  
  		"Perform method directly"
  		"(188 primitiveExecuteMethodArgsArray)"
  		"(189 primitiveExecuteMethod)"
  
  		"Unwind primitives"
  		"(195 primitiveFindNextUnwindContext)"
  		"(196 primitiveTerminateTo)"
  		"(197 primitiveFindHandlerContext)"
  		(198 genFastPrimFail "primitiveMarkUnwindMethod")
  		(199 genFastPrimFail "primitiveMarkHandlerMethod")
  
  		"new closure primitives"
  		"(200 primitiveClosureCopyWithCopiedValues)"
  		(201 genPrimitiveClosureValue	0) "value"
  		(202 genPrimitiveClosureValue	1) "value:"
  		(203 genPrimitiveClosureValue	2) "value:value:"
  		(204 genPrimitiveClosureValue	3) "value:value:value:"
  		(205 genPrimitiveClosureValue	4) "value:value:value:value:"
  		"(206 genPrimitiveClosureValueWithArgs)" "valueWithArguments:"
  
  		"(210 primitiveContextAt)"
  		"(211 primitiveContextAtPut)"
  		"(212 primitiveContextSize)"
  
  		"(218 primitiveDoNamedPrimitiveWithArgs)"
  		"(219 primitiveFail)"	"reserved for Cog primitives"
  
  		"(220 primitiveFail)"		"reserved for Cog primitives"
  
  		(221 genPrimitiveClosureValue	0) "valueNoContextSwitch"
  		(222 genPrimitiveClosureValue	1) "valueNoContextSwitch:"
  
  		"(541 primitiveSmallFloatAdd				1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(542 primitiveSmallFloatSubtract			1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(543 primitiveSmallFloatLessThan			1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(544 primitiveSmallFloatGreaterThan		1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(545 primitiveSmallFloatLessOrEqual		1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(546 primitiveSmallFloatGreaterOrEqual	1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(547 primitiveSmallFloatEqual				1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(548 primitiveSmallFloatNotEqual			1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(549 primitiveSmallFloatMultiply			1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(550 primitiveSmallFloatDivide				1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(551 primitiveSmallFloatTruncated			0	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(552 primitiveSmallFloatFractionalPart		0	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(553 primitiveSmallFloatExponent			0	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(554 primitiveSmallFloatTimesTwoPower	1	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(555 primitiveSmallFloatSquareRoot		0	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(556 primitiveSmallFloatSine				0	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(557 primitiveSmallFloatArctan				0	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(558 primitiveSmallFloatLogN				0	processorHasDoublePrecisionFloatingPointSupport:)"
  		"(559 primitiveSmallFloatExp				0	processorHasDoublePrecisionFloatingPointSupport:)"
  	)!

Item was added:
+ ----- Method: SimpleStackBasedCogit>>adjustArgumentsForPerform: (in category 'primitive generators') -----
+ adjustArgumentsForPerform: numArgs
+ 	"e.g.	Receiver				Receiver
+ 			Selector/Arg0	=>		Arg1
+ 			Arg1					Arg2
+ 	 		Arg2			sp->	retpc
+ 	 sp->	retpc"
+ 
+ 	self break.
+ 	(backEnd hasLinkRegister ifTrue: [numArgs - 2] ifFalse: [numArgs - 1]) to: 0 by: -1 do:
+ 		[:index|
+ 		self MoveMw: index * objectMemory wordSize r: SPReg R: TempReg.
+ 		self MoveR: TempReg Mw: index + 1 * objectMemory wordSize r: SPReg].
+ 	self PopR: TempReg.
+ 	self MoveR: TempReg Mw: 0 r: SPReg!

Item was changed:
  ----- Method: SimpleStackBasedCogit>>compileOpenPIC:numArgs: (in category 'in-line cacheing') -----
  compileOpenPIC: selector numArgs: numArgs
  	"Compile the code for an open PIC.  Perform a probe of the first-level method
  	 lookup cache followed by a call of ceSendFromInLineCacheMiss: if the probe fails."
  	| jumpSelectorMiss jumpClassMiss itsAHit jumpBCMethod |
  	<var: #jumpSelectorMiss type: #'AbstractInstruction *'>
  	<var: #jumpClassMiss type: #'AbstractInstruction *'>
  	<var: #itsAHit type: #'AbstractInstruction *'>
  	<var: #jumpBCMethod type: #'AbstractInstruction *'>
  	self compilePICAbort: numArgs.
  	entry := objectRepresentation genGetClassTagOf: ReceiverResultReg into: ClassReg scratchReg: TempReg.
  
  	"Do first of three probes.  See CoInterpreter>>lookupInMethodCacheSel:classTag:"
  	self flag: #lookupInMethodCacheSel:classTag:. "so this method shows up as a sender of lookupInMethodCacheSel:class:"
  	self MoveR: ClassReg R: SendNumArgsReg.
  	self annotate: (self XorCw: selector R: ClassReg) objRef: selector.
  	self LogicalShiftLeftCq: objectMemory shiftForWord R: ClassReg.
  	self AndCq: MethodCacheMask << objectMemory shiftForWord R: ClassReg.
  	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << objectMemory shiftForWord)
  		r: ClassReg
  		R: TempReg.
  	self annotate: (self CmpCw: selector R: TempReg) objRef: selector.
  	jumpSelectorMiss := self JumpNonZero: 0.
  	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << objectMemory shiftForWord)
  		r: ClassReg
  		R: TempReg.
  	self CmpR: SendNumArgsReg R: TempReg.
  	jumpClassMiss := self JumpNonZero: 0.
  
  	itsAHit := self Label.
  	"Fetch the method.  The interpret trampoline requires the bytecoded method in SendNumArgsReg"
  	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheMethod << objectMemory shiftForWord)
  		r: ClassReg
  		R: SendNumArgsReg.
  	"If the method is compiled jump to its unchecked entry-point, otherwise interpret it."
  	objectRepresentation genLoadSlot: HeaderIndex sourceReg: SendNumArgsReg destReg: ClassReg.
  	jumpBCMethod := objectRepresentation genJumpImmediate: ClassReg.
  	jumpBCMethod jmpTarget: picInterpretAbort.
  	self AddCq: cmNoCheckEntryOffset R: ClassReg.
  	self JumpR: ClassReg.
  
  	"First probe missed.  Do second of three probes.  Shift hash right one and retry."
  	jumpSelectorMiss jmpTarget: (jumpClassMiss jmpTarget: self Label).
  	self MoveR: SendNumArgsReg R: ClassReg.
  	self annotate: (self XorCw: selector R: ClassReg) objRef: selector.
  	self LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg.
  	self AndCq: MethodCacheMask << objectMemory shiftForWord R: ClassReg.
  	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << objectMemory shiftForWord)
  		r: ClassReg
  		R: TempReg.
  	self annotate: (self CmpCw: selector R: TempReg) objRef: selector.
  	jumpSelectorMiss := self JumpNonZero: 0.
  	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << objectMemory shiftForWord)
  		r: ClassReg
  		R: TempReg.
  	self CmpR: SendNumArgsReg R: TempReg.
  	self JumpZero: itsAHit.
  
  	"Second probe missed.  Do last probe.  Shift hash right two and retry."
  	jumpSelectorMiss jmpTarget: self Label.
  	self MoveR: SendNumArgsReg R: ClassReg.
  	self annotate: (self XorCw: selector R: ClassReg) objRef: selector.
  	objectMemory shiftForWord > 2 ifTrue:
  		[self LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg].
  	self AndCq: MethodCacheMask << objectMemory shiftForWord R: ClassReg.
  	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << objectMemory shiftForWord)
  		r: ClassReg
  		R: TempReg.
  	self annotate: (self CmpCw: selector R: TempReg) objRef: selector.
  	jumpSelectorMiss := self JumpNonZero: 0.
  	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << objectMemory shiftForWord)
  		r: ClassReg
  		R: TempReg.
  	self CmpR: SendNumArgsReg R: TempReg.
  	self JumpZero: itsAHit.
  
  	"Last probe missed.  Call ceSendFromInLineCacheMiss: to do the full lookup."
  	jumpSelectorMiss jmpTarget: self Label.
+ 	self numRegArgs > 0 ifTrue:
+ 		[backEnd genPushRegisterArgsForNumArgs: numArgs scratchReg: SendNumArgsReg].
  	self genSmalltalkToCStackSwitch: true.
  	methodLabel addDependent: (self annotateAbsolutePCRef: (self MoveCw: methodLabel asInteger R: SendNumArgsReg)).
  	self 
  		compileCallFor: #ceSendFromInLineCacheMiss:
  		numArgs: 1
  		arg: SendNumArgsReg
  		arg: nil
  		arg: nil
  		arg: nil
  		resultReg: nil
  		saveRegs: false
  	"Note that this call does not return."!

Item was added:
+ ----- Method: SimpleStackBasedCogit>>genLookupForPerformNumArgs: (in category 'primitive generators') -----
+ genLookupForPerformNumArgs: numArgs
+ 	"Compile the code for a probe of the first-level method cache for a perform primtiive.
+ 	 The selector is assumed to be in Arg0Reg.  Defer to adjustArgumentsForPerform: to
+ 	 adjust the arguments before the jump to the method."
+ 	| jumpSelectorMiss jumpClassMiss jumpInterpret itsAHit |
+ 	<var: #jumpSelectorMiss type: #'AbstractInstruction *'>
+ 	<var: #jumpClassMiss type: #'AbstractInstruction *'>
+ 	<var: #jumpInterpret type: #'AbstractInstruction *'>
+ 	<var: #itsAHit type: #'AbstractInstruction *'>
+ 
+ 	"N.B.  Can't assume TempReg already contains the tag because a method can
+ 	 of course be invoked via the unchecked entry-point, e.g. as does perform:."
+ 	objectRepresentation genGetInlineCacheClassTagFrom: ReceiverResultReg into: ClassReg forEntry: false.
+ 
+ 	"Do first of three probes.  See StackInterpreter>>lookupInMethodCacheSel:classTag:"
+ 	self flag: #lookupInMethodCacheSel:classTag:. "so this method shows up as a sender of lookupInMethodCacheSel:class:"
+ 	self MoveR: ClassReg R: SendNumArgsReg.
+ 	self XorR: Arg0Reg R: ClassReg.
+ 	self LogicalShiftLeftCq: objectMemory shiftForWord R: ClassReg.
+ 	self AndCq: MethodCacheMask << objectMemory shiftForWord R: ClassReg.
+ 	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << objectMemory shiftForWord)
+ 		r: ClassReg
+ 		R: TempReg.
+ 	self CmpR: Arg0Reg R: TempReg.
+ 	jumpSelectorMiss := self JumpNonZero: 0.
+ 	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << objectMemory shiftForWord)
+ 		r: ClassReg
+ 		R: TempReg.
+ 	self CmpR: SendNumArgsReg R: TempReg.
+ 	jumpClassMiss := self JumpNonZero: 0.
+ 
+ 	itsAHit := self Label.
+ 	"Fetch the method, and check it is cogged."
+ 	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheMethod << objectMemory shiftForWord)
+ 		r: ClassReg
+ 		R: SendNumArgsReg.
+ 	"If the method is not compiled fall back on the interpreter primitive."
+ 	objectRepresentation genLoadSlot: HeaderIndex sourceReg: SendNumArgsReg destReg: ClassReg.
+ 	jumpInterpret := objectRepresentation genJumpImmediate: ClassReg.
+ 	"Adjust arguments and jump to the method's unchecked entry-point."
+ 	self AddCq: cmNoCheckEntryOffset R: ClassReg.
+ 	self adjustArgumentsForPerform: numArgs.
+ 	self JumpR: ClassReg.
+ 
+ 	"First probe missed.  Do second of three probes.  Shift hash right one and retry."
+ 	jumpSelectorMiss jmpTarget: (jumpClassMiss jmpTarget: self Label).
+ 	self MoveR: SendNumArgsReg R: ClassReg.
+ 	self XorR: Arg0Reg R: ClassReg.
+ 	self LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg.
+ 	self AndCq: MethodCacheMask << objectMemory shiftForWord R: ClassReg.
+ 	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << objectMemory shiftForWord)
+ 		r: ClassReg
+ 		R: TempReg.
+ 	self CmpR: Arg0Reg R: TempReg.
+ 	jumpSelectorMiss := self JumpNonZero: 0.
+ 	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << objectMemory shiftForWord)
+ 		r: ClassReg
+ 		R: TempReg.
+ 	self CmpR: SendNumArgsReg R: TempReg.
+ 	self JumpZero: itsAHit.
+ 
+ 	"Second probe missed.  Do last probe.  Shift hash right two and retry."
+ 	jumpSelectorMiss jmpTarget: self Label.
+ 	self MoveR: SendNumArgsReg R: ClassReg.
+ 	self XorR: Arg0Reg R: ClassReg.
+ 	objectMemory shiftForWord > 2 ifTrue:
+ 		[self LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg].
+ 	self AndCq: MethodCacheMask << objectMemory shiftForWord R: ClassReg.
+ 	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << objectMemory shiftForWord)
+ 		r: ClassReg
+ 		R: TempReg.
+ 	self CmpR: Arg0Reg R: TempReg.
+ 	jumpSelectorMiss := self JumpNonZero: 0.
+ 	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << objectMemory shiftForWord)
+ 		r: ClassReg
+ 		R: TempReg.
+ 	self CmpR: SendNumArgsReg R: TempReg.
+ 	self JumpZero: itsAHit.
+ 
+ 	"Last probe missed.  Caller will generate the call to fall back on the interpreter primitive."
+ 	jumpSelectorMiss jmpTarget:
+ 	(jumpInterpret jmpTarget: self Label).
+ 	^0!

Item was added:
+ ----- Method: SimpleStackBasedCogit>>genPrimitivePerform (in category 'primitive generators') -----
+ genPrimitivePerform
+ 	"Generate an in-line perform primitive.  The lookup code requires the selector to be in Arg0Reg.
+ 	 adjustArgumentsForPerform: adjusts the arguments once genLookupForPerformNumArgs:
+ 	 has generated the code for the lookup."
+ 	self MoveMw: methodOrBlockNumArgs - 1 * objectMemory wordSize r: SPReg R: Arg0Reg.
+ 	self genLookupForPerformNumArgs: methodOrBlockNumArgs.
+ 	^self compileInterpreterPrimitive: (coInterpreter
+ 										functionPointerForCompiledMethod: methodObj
+ 										primitiveIndex: primitiveIndex)!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>adjustArgumentsForPerform: (in category 'primitive generators') -----
+ adjustArgumentsForPerform: numArgs
+ 	"Generate code to adjust the possibly stacked arguments immediately
+ 	 before jumping to a method looked up by a perform primitive."
+ 	self assert: self numRegArgs <= 2.
+ 	self assert: numArgs >= 1.
+ 	numArgs <= self numRegArgs ifTrue:
+ 		[numArgs = 2 ifTrue:
+ 			[self MoveR: Arg1Reg R: Arg0Reg].
+ 		 ^self].
+ 
+ 	self numRegArgs + 1 = numArgs ifTrue:
+ 		[backEnd hasLinkRegister
+ 			ifTrue:
+ 				[self numRegArgs = 2 ifTrue:
+ 					[self PopR: Arg1Reg].
+ 				 self PopR: Arg0Reg]
+ 			ifFalse:
+ 				[self PopR: TempReg. "save retpc"
+ 				 self numRegArgs = 2 ifTrue:
+ 					[self PopR: Arg1Reg].
+ 				 self MoveMw: 0 r: SPReg R: Arg0Reg.
+ 				 self MoveR: TempReg Mw: 0 r: SPReg].
+ 		 ^self].
+ 
+ 	"e.g.	Receiver				Receiver
+ 			Selector/Arg0	=>		Arg1
+ 			Arg1					Arg2
+ 	 		Arg2			sp->	Arg3
+ 	 sp->	Arg3"
+ 	super adjustArgumentsForPerform: numArgs!

Item was removed:
- ----- Method: StackToRegisterMappingCogit>>compileOpenPIC:numArgs: (in category 'in-line cacheing') -----
- compileOpenPIC: selector numArgs: numArgs
- 	"Compile the code for an open PIC.  Perform a probe of the first-level method
- 	 lookup cache followed by a call of ceSendFromInLineCacheMiss: if the probe fails.
- 	 Override to push the register args when calling ceSendFromInLineCacheMiss:"
- 	| jumpSelectorMiss jumpClassMiss itsAHit jumpBCMethod |
- 	<var: #jumpSelectorMiss type: #'AbstractInstruction *'>
- 	<var: #jumpClassMiss type: #'AbstractInstruction *'>
- 	<var: #itsAHit type: #'AbstractInstruction *'>
- 	<var: #jumpBCMethod type: #'AbstractInstruction *'>
- 	self compilePICAbort: numArgs.
- 	entry := objectRepresentation genGetClassTagOf: ReceiverResultReg into: ClassReg scratchReg: TempReg.
- 
- 	"Do first of three probes.  See CoInterpreter>>lookupInMethodCacheSel:classTag:"
- 	self flag: #lookupInMethodCacheSel:classTag:. "so this method shows up as a sender of lookupInMethodCacheSel:class:"
- 	self MoveR: ClassReg R: SendNumArgsReg.
- 	self annotate: (self XorCw: selector R: ClassReg) objRef: selector.
- 	self LogicalShiftLeftCq: objectMemory shiftForWord R: ClassReg.
- 	self AndCq: MethodCacheMask << objectMemory shiftForWord R: ClassReg.
- 	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << objectMemory shiftForWord)
- 		r: ClassReg
- 		R: TempReg.
- 	self annotate: (self CmpCw: selector R: TempReg) objRef: selector.
- 	jumpSelectorMiss := self JumpNonZero: 0.
- 	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << objectMemory shiftForWord)
- 		r: ClassReg
- 		R: TempReg.
- 	self CmpR: SendNumArgsReg R: TempReg.
- 	jumpClassMiss := self JumpNonZero: 0.
- 
- 	itsAHit := self Label.
- 	"Fetch the method.  The interpret trampoline requires the bytecoded method in SendNumArgsReg"
- 	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheMethod << objectMemory shiftForWord)
- 		r: ClassReg
- 		R: SendNumArgsReg.
- 	"If the method is compiled jump to its unchecked entry-point, otherwise interpret it."
- 	objectRepresentation genLoadSlot: HeaderIndex sourceReg: SendNumArgsReg destReg: ClassReg.
- 	jumpBCMethod := objectRepresentation genJumpImmediate: ClassReg.
- 	jumpBCMethod jmpTarget: picInterpretAbort.
- 	self AddCq: cmNoCheckEntryOffset R: ClassReg.
- 	self JumpR: ClassReg.
- 
- 	"First probe missed.  Do second of three probes.  Shift hash right one and retry."
- 	jumpSelectorMiss jmpTarget: (jumpClassMiss jmpTarget: self Label).
- 	self MoveR: SendNumArgsReg R: ClassReg.
- 	self annotate: (self XorCw: selector R: ClassReg) objRef: selector.
- 	self LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg.
- 	self AndCq: MethodCacheMask << objectMemory shiftForWord R: ClassReg.
- 	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << objectMemory shiftForWord)
- 		r: ClassReg
- 		R: TempReg.
- 	self annotate: (self CmpCw: selector R: TempReg) objRef: selector.
- 	jumpSelectorMiss := self JumpNonZero: 0.
- 	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << objectMemory shiftForWord)
- 		r: ClassReg
- 		R: TempReg.
- 	self CmpR: SendNumArgsReg R: TempReg.
- 	self JumpZero: itsAHit.
- 
- 	"Second probe missed.  Do last probe.  Shift hash right two and retry."
- 	jumpSelectorMiss jmpTarget: self Label.
- 	self MoveR: SendNumArgsReg R: ClassReg.
- 	self annotate: (self XorCw: selector R: ClassReg) objRef: selector.
- 	objectMemory shiftForWord > 2 ifTrue:
- 		[self LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg].
- 	self AndCq: MethodCacheMask << objectMemory shiftForWord R: ClassReg.
- 	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << objectMemory shiftForWord)
- 		r: ClassReg
- 		R: TempReg.
- 	self annotate: (self CmpCw: selector R: TempReg) objRef: selector.
- 	jumpSelectorMiss := self JumpNonZero: 0.
- 	self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << objectMemory shiftForWord)
- 		r: ClassReg
- 		R: TempReg.
- 	self CmpR: SendNumArgsReg R: TempReg.
- 	self JumpZero: itsAHit.
- 
- 	"Last probe missed.  Call ceSendFromInLineCacheMiss: to do the full lookup."
- 	jumpSelectorMiss jmpTarget: self Label.
- 	backEnd genPushRegisterArgsForNumArgs: numArgs scratchReg: SendNumArgsReg.
- 	self genSmalltalkToCStackSwitch: true.
- 	methodLabel addDependent: (self annotateAbsolutePCRef: (self MoveCw: methodLabel asInteger R: SendNumArgsReg)).
- 	self 
- 		compileCallFor: #ceSendFromInLineCacheMiss:
- 		numArgs: 1
- 		arg: SendNumArgsReg
- 		arg: nil
- 		arg: nil
- 		arg: nil
- 		resultReg: nil
- 		saveRegs: false
- 	"Note that this call does not return."!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genPrimitivePerform (in category 'primitive generators') -----
+ genPrimitivePerform
+ 	"Generate an in-line perform primitive.  The lookup code requires the selector to be in Arg0Reg.
+ 	 adjustArgumentsForPerform: adjusts the arguments once genLookupForPerformNumArgs:
+ 	 has generated the code for the lookup."
+ 	methodOrBlockNumArgs > self numRegArgs ifTrue:
+ 		[self MoveMw: (backEnd hasLinkRegister ifTrue: [methodOrBlockNumArgs - 1] ifFalse: [methodOrBlockNumArgs]) * objectMemory wordSize r: SPReg R: Arg0Reg].
+ 	self genLookupForPerformNumArgs: methodOrBlockNumArgs.
+ 	^self compileInterpreterPrimitive: (coInterpreter
+ 										functionPointerForCompiledMethod: methodObj
+ 										primitiveIndex: primitiveIndex)!



More information about the Vm-dev mailing list