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

commits at source.squeak.org commits at source.squeak.org
Tue Jul 28 21:38:20 UTC 2020


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

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

Name: VMMaker.oscog-eem.2784
Author: eem
Time: 28 July 2020, 2:38:11.381837 pm
UUID: 5c810cae-a07a-469a-b68a-9a901ca3545c
Ancestors: VMMaker.oscog-eem.2783

StackInterpreter: introspection for the Qwaq Croquet high-priority ticker/tickee mechanism.

VMMaker: Generate ckformat.c to the src directory if ImageFormat is in the image.

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

Item was added:
+ ----- Method: StackInterpreterPrimitives>>getVMTickeeCallCount (in category 'system control primitives') -----
+ getVMTickeeCallCount
+ 	^self cppIf: #VM_TICKER
+ 		ifTrue: [self positiveMachineIntegerFor: self ioVMTickeeCallCount]
+ 		ifFalse: [ConstZero]!

Item was added:
+ ----- Method: StackInterpreterPrimitives>>getVMTickerCount (in category 'system control primitives') -----
+ getVMTickerCount
+ 	^self cppIf: #VM_TICKER
+ 		ifTrue: [self positiveMachineIntegerFor: self ioVMTickerCount]
+ 		ifFalse: [ConstZero]!

Item was added:
+ ----- Method: StackInterpreterPrimitives>>getVMTickerStartUSecs (in category 'system control primitives') -----
+ getVMTickerStartUSecs
+ 	^self cppIf: #VM_TICKER
+ 		ifTrue: [self positive64BitIntegerFor: self ioVMTickerStartUSecs]
+ 		ifFalse: [ConstZero]!

Item was changed:
  ----- Method: StackInterpreterPrimitives>>primitiveAllVMParameters: (in category 'system control primitives') -----
(excessive size, no diff calculated)

Item was changed:
  ----- Method: StackInterpreterPrimitives>>primitiveGetVMParameter: (in category 'system control primitives') -----
  primitiveGetVMParameter: arg 
  	"See primitiveVMParameter method comment.
  	 N.B. written as a returning case to avoid branch limits in the V3 bytecode set."
  	arg caseOf: {
  			[1]  ->	[^self positiveMachineIntegerFor: objectMemory oldSpaceSize].
  			[2]  ->	[^objectMemory integerObjectOf: objectMemory newSpaceSize].
  			[3]  ->	[^self positiveMachineIntegerFor: objectMemory totalMemorySize].
  			[6]  ->	[^objectMemory integerObjectOf: objectMemory tenuringThreshold].
  			[7]  ->	[^objectMemory integerObjectOf: objectMemory statFullGCs].
  			[8]  ->	[^objectMemory integerObjectOf: objectMemory statFullGCUsecs + 500 // 1000].
  			[9]  ->	[^objectMemory integerObjectOf: (objectMemory hasSpurMemoryManagerAPI
  														ifTrue: [objectMemory statScavenges]
  														ifFalse: [objectMemory statIncrGCs])].
  			[10] ->	[^objectMemory integerObjectOf: (objectMemory hasSpurMemoryManagerAPI
  														ifTrue: [objectMemory statScavengeGCUsecs]
  														ifFalse: [objectMemory statIncrGCUsecs]) + 500 // 1000].
  			[11] ->	[^objectMemory integerObjectOf: objectMemory statTenures].
  			[12] ->	[^ConstZero]. "Was JITTER VM info"
+ 			[13] ->	[^self getVMTickerStartUSecs].
+ 			[14] ->	[^self getVMTickerCount].
+ 			[15] ->	[^self getVMTickeeCallCount].
- 			[13] ->	[^ConstZero]. "Was JITTER VM info"
- 			[14] ->	[^ConstZero]. "Was JITTER VM info"
- 			[15] ->	[^ConstZero]. "Was JITTER VM info"
  			[16] ->	[^self positive64BitIntegerFor: statIdleUsecs].
  			[17] ->	[^(SistaVM and: [self isCog])
  						ifTrue: [objectMemory floatObjectOf: self getCogCodeZoneThreshold]
  						ifFalse: [ConstZero]].
  			[18] ->	[^objectMemory hasSpurMemoryManagerAPI
  						ifTrue: [objectMemory integerObjectOf: objectMemory statCompactionUsecs + 500 // 1000]
  						ifFalse: [ConstZero]].
  			[19] ->	[^objectMemory hasSpurMemoryManagerAPI
  						ifTrue: [objectMemory integerObjectOf: objectMemory scavengeThresholdAsExtent]
  						ifFalse: [ConstZero]].
  			[20] ->	[^objectMemory positive64BitIntegerFor: self ioUTCStartMicroseconds].
  			[21] ->	[^objectMemory integerObjectOf: objectMemory rootTableCount].
  			[22] ->	[^objectMemory integerObjectOf: objectMemory statRootTableOverflows].
  			[23] ->	[^objectMemory integerObjectOf: extraVMMemory].
  			[24] ->	[^objectMemory integerObjectOf: objectMemory shrinkThreshold].
  			[25] ->	[^objectMemory integerObjectOf: objectMemory growHeadroom].
  			[26] ->	[^objectMemory integerObjectOf: self ioHeartbeatMilliseconds].
  			[27] ->	[^objectMemory integerObjectOf: objectMemory statMarkCount].
  			[28] ->	[^objectMemory integerObjectOf: objectMemory statSweepCount].
  			[29] ->	[^objectMemory integerObjectOf: objectMemory statMkFwdCount].
  			[30] ->	[^objectMemory integerObjectOf: objectMemory statCompMoveCount].
  			[31] ->	[^objectMemory integerObjectOf: objectMemory statGrowMemory].
  			[32] ->	[^objectMemory integerObjectOf: objectMemory statShrinkMemory].
  			[33] ->	[^objectMemory integerObjectOf: objectMemory statRootTableCount].
  			[34] ->	[^objectMemory hasSpurMemoryManagerAPI ifTrue:"was statAllocationCount"
  						[objectMemory positive64BitIntegerFor: objectMemory currentAllocatedBytes]].
  			[35] ->	[^objectMemory integerObjectOf: objectMemory statSurvivorCount].
  			[36] ->	[^objectMemory integerObjectOf: (self microsecondsToMilliseconds: objectMemory statGCEndUsecs)].
  			[37] ->	[^objectMemory integerObjectOf: objectMemory statSpecialMarkCount].
  			[38] ->	[^objectMemory integerObjectOf: objectMemory statIGCDeltaUsecs + 500 // 1000].
  			[39] ->	[^objectMemory integerObjectOf: statPendingFinalizationSignals].
  			[40] ->	[^objectMemory integerObjectOf: objectMemory wordSize].
  			[41] ->	[^objectMemory integerObjectOf: self imageFormatVersion].
  			[42] ->	[^objectMemory integerObjectOf: numStackPages].
  			[43] ->	[^objectMemory integerObjectOf: desiredNumStackPages].
  			[44] ->	[^objectMemory integerObjectOf: objectMemory edenBytes].
  			[45] ->	[^objectMemory integerObjectOf: desiredEdenBytes].
  			[46] ->	[^self getCogCodeSize].
  			[47] ->	[^self getDesiredCogCodeSize].
  			[48] ->	[^self getCogVMFlags].
  			[49] ->	[^objectMemory integerObjectOf: self ioGetMaxExtSemTableSize].
  			[52] ->	[^objectMemory integerObjectOf: objectMemory rootTableCapacity].
  			[53] ->	[^objectMemory hasSpurMemoryManagerAPI ifTrue:
  						[objectMemory integerObjectOf: objectMemory numSegments]].
  			[54] ->	[^objectMemory hasSpurMemoryManagerAPI ifTrue:
  						[objectMemory integerObjectOf: objectMemory freeSize]].
  			[55] ->	[^objectMemory hasSpurMemoryManagerAPI ifTrue:
  						[objectMemory floatObjectOf: objectMemory getHeapGrowthToSizeGCRatio]].
  			[56] ->	[^self positive64BitIntegerFor: statProcessSwitch].
  			[57] ->	[^self positive64BitIntegerFor: statIOProcessEvents].
  			[58] ->	[^self positive64BitIntegerFor: statForceInterruptCheck].
  			[59] ->	[^self positive64BitIntegerFor: statCheckForEvents].
  			[60] ->	[^self positive64BitIntegerFor: statStackOverflow].
  			[61] ->	[^self positive64BitIntegerFor: statStackPageDivorce].
  			[62] ->	[^self getCodeCompactionCount].
  			[63] ->	[^self getCodeCompactionMSecs].
  			[64] ->	[^self getCogMethodCount].
  			[65] ->	[^self getCogVMFeatureFlags].
  			[66] ->	[^objectMemory integerObjectOf: self stackPageByteSize].
  			[67] ->	[^objectMemory hasSpurMemoryManagerAPI ifTrue:
  						[self positiveMachineIntegerFor: objectMemory maxOldSpaceSize]].
  			[68] ->	[^objectMemory floatObjectOf: stackPages statAverageLivePagesWhenMapping].
  			[69] ->	[^objectMemory integerObjectOf: stackPages statMaxPageCountWhenMapping].
  			[70] ->	[^objectMemory integerObjectOf: self vmProxyMajorVersion].
  			[71] ->	[^objectMemory integerObjectOf: self vmProxyMinorVersion].
  			[72] ->	[^objectMemory integerObjectOf: objectMemory statMarkUsecs + 500 // 1000].
  			[73] ->	[^objectMemory integerObjectOf: objectMemory statSweepUsecs + 500 // 1000].
  			[74] ->	[^objectMemory hasSpurMemoryManagerAPI ifTrue:
  						[objectMemory integerObjectOf: objectMemory statMaxAllocSegmentTime + 500 // 1000]].
  			[75] ->	[^objectMemory booleanObjectOf: self primitiveDoMixedArithmetic] }
  		otherwise: [^nil]!

Item was changed:
  ----- Method: StackInterpreterPrimitives>>primitiveVMParameter (in category 'system control primitives') -----
  primitiveVMParameter
  	"Behaviour depends on argument count:
  		0 args:	return an Array of VM parameter values;
  		1 arg:	return the indicated VM parameter;
  		2 args:	set the VM indicated parameter.
  	VM parameters are numbered as follows:
  		1	end (v3)/size(Spur) of old-space (0-based, read-only)
  		2	end (v3)/size(Spur) of young/new-space (read-only)
  		3	end (v3)/size(Spur) of heap (read-only)
  		4	nil (was allocationCount (read-only))
  		5	nil (was allocations between GCs (read-write)
  		6	survivor count tenuring threshold (read-write)
  		7	full GCs since startup (read-only)
  		8	total milliseconds in full GCs since startup (read-only)
  		9	incremental GCs (SqueakV3) or scavenges (Spur) since startup (read-only)
  		10	total milliseconds in incremental GCs (SqueakV3) or scavenges (Spur) since startup (read-only)
  		11	tenures of surving objects since startup or reset (read-write)
+ 		12-20 were specific to ikp's JITTER VM, now 12 16 open for use
+ 		13	if started, the start time in utc microseconds of the high-priority ticker
+ 		14	if started, the number of checkHighPriorityTickees calls
+ 		15	if started, the number of tickee calls from checkHighPriorityTickees
- 		12-20 were specific to ikp's JITTER VM, now 12-15 are open for use
  		16	total microseconds at idle since start-up (if non-zero)
  		17	fraction of the code zone to use (Sista only; used to control code zone use to preserve sendAndBranchData on counter tripped callback)
  		18	total milliseconds in compaction phase of full GC since start-up (Spur only)
  		19	scavenge threshold, the effective size of eden.  When eden fills to the threshold a scavenge is scheduled. Newer Spur VMs only.
  		20	utc microseconds at VM start-up (actually at time initialization, which precedes image load).
  		21	root/remembered table size (occupancy) (read-only)
  		22	root table overflows since startup (read-only)
  		23	bytes of extra memory to reserve for VM buffers, plugins, etc (stored in image file header).
  		24	memory threshold above which shrinking object memory (rw)
  		25	memory headroom when growing object memory (rw)
  		26	interruptChecksEveryNms - force an ioProcessEvents every N milliseconds (rw)
  		27	number of times mark loop iterated for current IGC/FGC (read-only) includes ALL marking
  		28	number of times sweep loop iterated for current IGC/FGC (read-only)
  		29	number of times make forward loop iterated for current IGC/FGC (read-only)
  		30	number of times compact move loop iterated for current IGC/FGC (read-only)
  		31	number of grow memory requests (read-only)
  		32	number of shrink memory requests (read-only)
  		33	number of root table entries used for current IGC/FGC (read-only)
  		34	Spur: bytes allocated in total since start-up or reset (read-write) (Used to be number of allocations done before current IGC/FGC (read-only))
  		35	number of survivor objects after current IGC/FGC (read-only)
  		36	millisecond clock when current IGC/FGC completed (read-only)
  		37	number of marked objects for Roots of the world, not including Root Table entries for current IGC/FGC (read-only)
  		38	milliseconds taken by current IGC (read-only)
  		39	Number of finalization signals for Weak Objects pending when current IGC/FGC completed (read-only)
  		40	BytesPerOop for this image
  		41	imageFormatVersion for the VM
  		42	number of stack pages in use
  		43	desired number of stack pages (stored in image file header, max 65535)
  		44	size of eden, in bytes
  		45	desired size of eden, in bytes (stored in image file header)
  		46	machine code zone size, in bytes (Cog only; otherwise nil)
  		47	desired machine code zone size (stored in image file header; Cog only; otherwise nil)
  		48	various header flags.  See getCogVMFlags.
  		49	max size the image promises to grow the external semaphore table to (0 sets to default, which is 256 as of writing)
  		50-51 nil; reserved for VM parameters that persist in the image (such as eden above)
  		52	root/remembered table capacity
  		53	number of segments (Spur only; otherwise nil)
  		54	total size of free old space (Spur only, otherwise nil)
  		55	ratio of growth and image size at or above which a GC will be performed post scavenge
  		56	number of process switches since startup (read-only)
  		57	number of ioProcessEvents calls since startup (read-only)
  		58	number of ForceInterruptCheck calls since startup (read-only)
  		59	number of check event calls since startup (read-only)
  		60	number of stack page overflows since startup (read-only)
  		61	number of stack page divorces since startup (read-only)
  		62	compiled code compactions since startup (read-only; Cog only; otherwise nil)
  		63	total milliseconds in compiled code compactions since startup (read-only; Cog only; otherwise nil)
  		64	the number of methods that currently have jitted machine-code
  		65	whether the VM supports a certain feature, MULTIPLE_BYTECODE_SETS is bit 0, IMMUTABILITY is bit 1
  		66	the byte size of a stack page
  		67	the max allowed size of old space (Spur only; nil otherwise; 0 implies no limit except that of the underlying platform)
  		68	the average number of live stack pages when scanned by GC (at scavenge/gc/become et al) (read-write)
  		69	the maximum number of live stack pages when scanned by GC (at scavenge/gc/become et al) (read-write)
  		70	the vmProxyMajorVersion (the interpreterProxy VM_MAJOR_VERSION)
  		71	the vmProxyMinorVersion (the interpreterProxy VM_MINOR_VERSION)
  		72 total milliseconds in full GCs Mark phase since startup (read-only)
  		73 total milliseconds in full GCs Sweep phase since startup (read-only, can be 0 depending on compactors)
  		74 maximum pause time due to segment allocation
  		75 whether the arithmetic primitives perform conversion in case of mixed SmallInteger/Float (true) or fail (false)
  		
  	Note: Thanks to Ian Piumarta for this primitive."
  
  	| paramsArraySize index |
  	paramsArraySize := 75.
  	argumentCount = 0 ifTrue: [^self primitiveAllVMParameters: paramsArraySize].
  	argumentCount > 2 ifTrue: [^self primitiveFailFor: PrimErrBadNumArgs].
  	
  	"index read & checks"
  	index := self stackValue: (argumentCount = 1 ifTrue: [0] ifFalse: [1]).
  	(objectMemory isIntegerObject: index) ifFalse: [^self primitiveFailFor: PrimErrBadArgument].
  	index := objectMemory integerValueOf: index.
  	(index < 1 or: [index > paramsArraySize]) ifTrue: [^self primitiveFailFor: PrimErrBadIndex].
  	
  	argumentCount = 1 ifTrue:	 "read VM parameter; written this way to avoid branch limits in V3 bytecode set"
  		[| result |
  		 result := self primitiveGetVMParameter: index.
  		 ^self methodReturnValue: (result ifNil: [objectMemory nilObject])].
  
  	"write a VM parameter"
  	self primitiveSetVMParameter: index arg: self stackTop!

Item was changed:
  ----- Method: VMBasicConstants class>>namesDefinedAtCompileTime (in category 'C translation') -----
  namesDefinedAtCompileTime
  	"Answer the set of names for variables that should be defined at compile time.
  	 Some of these get default values during simulation, and hence get defaulted in
  	 the various initializeMiscConstants methods.  But that they have values should
  	 /not/ cause the code generator to do dead code elimination based on their
  	 default values.  In particular, methods marked with <option: ANameDefinedAtCompileTime>
  	 will be emitted within #if defined(ANameDefinedAtCompileTime)...#endif.
  
  	And of course this is backwards.  We'd like to define names that are defined at translation time."
  	^#(VMBIGENDIAN
  		IMMUTABILITY
  		STACKVM COGVM COGMTVM SPURVM
  		PharoVM								"Pharo vs Squeak"
+ 		TerfVM VM_TICKER						"Terf vs Squeak & Qwaq/Teleplace/Terf high-priority thread support"
- 		TerfVM									"Terf vs Squeak"
  		EnforceAccessControl					"Newspeak"
  		CheckRememberedInTrampoline		"IMMUTABILITY"
+ 		BIT_IDENTICAL_FLOATING_POINT PLATFORM_SPECIFIC_FLOATING_POINT	"Alternatives for using fdlibm for floating-point"
- 		BIT_IDENTICAL_FLOATING_POINT
  		LLDB									"As of lldb-370.0.42 Swift-3.1, passing function parameters to printOopsSuchThat fails with Internal error [IRForTarget]: Couldn't rewrite one of the arguments of a function call.  Turning off link time optimization with -fno-lto has no effect.  hence we define some debugging functions as being <option: LLDB>"
  
  		"processor related"
  		__ARM_ARCH__ __arm__ __arm32__ ARM32 __arm64__ ARM64
  		_M_I386 _X86_ i386 i486 i586 i686 __i386__ __386__ X86 I386
  		x86_64 __amd64 __x86_64 __amd64__ __x86_64__ _M_AMD64 _M_X64
  		__mips__ __mips
  		__powerpc __powerpc__ __powerpc64__ __POWERPC__
  		__ppc__ __ppc64__ __PPC__ __PPC64__
  		__sparc__ __sparc __sparc_v8__ __sparc_v9__ __sparcv8 __sparcv9
  
  		"Compiler brand related"
  		__ACK__
  		__CC_ARM
  		__clang__
  		__GNUC__
  		_MSC_VER
  		__ICC
  		__SUNPRO_C
  		
  		"os related"
  		ACORN
  		_AIX
  		__ANDROID__
  		__BEOS__
  		__linux__
  		__MINGW32__
  		__FreeBSD__ __NetBSD__ __OpenBSD__
  		__osf__
  		EPLAN9
  		__unix__ __unix UNIX
  		WIN32 _WIN32 _WIN32_WCE
  		WIN64 _WIN64 _WIN64_WCE)!

Item was changed:
  ----- Method: VMMaker class>>generateAllConfigurationsUnderVersionControl (in category 'configurations') -----
  generateAllConfigurationsUnderVersionControl
  	self
  		executeDisplayingProgress:
  			(OrderedDictionary
  				with: 'Generate all newspeak configurations under VCS' -> [ self generateAllNewspeakConfigurationsUnderVersionControl ]
  				with: 'Generate all squeak configurations under VCS' -> [ self generateAllSqueakConfigurationsUnderVersionControl ]
  				with: 'Generate all spur lowcode configurations' -> [ self generateAllSpurLowcodeConfigurations ]
  				with: 'Generate VM plugins' -> [ self generateVMPlugins ]
+ 				with: 'Generate utilities' -> [ self generateSpur32LeakChecker; generateSpur64LeakChecker; generateUtilityPrograms ])!
- 				with: 'Generate spur leak checkers' -> [ self generateSpur32LeakChecker; generateSpur64LeakChecker ])!

Item was added:
+ ----- Method: VMMaker class>>generateUtilityPrograms (in category 'configurations') -----
+ generateUtilityPrograms
+ 	^(self
+ 		makerFor: nil
+ 		and: nil
+ 		with: #()
+ 		to: self sourceTree, '/src'
+ 		platformDir: self sourceTree, '/platforms')
+ 			generateUtilityPrograms!

Item was added:
+ ----- Method: VMMaker>>generateUtilityPrograms (in category 'generate sources') -----
+ generateUtilityPrograms
+ 	"Any additional sources not directly part of the VM may be generated here"
+ 
+ 	Smalltalk
+ 		at: #ImageFormat
+ 		ifPresent:
+ 			[:cls |  "generate ckformat utility program"
+ 			(self needsToRegenerateCheckFormatFile: cls named: 'ckformat.c') ifTrue:
+ 				[cls storeCkFormatOnFile: (self sourceDirectory fullNameFor: 'ckformat.c')]]!

Item was added:
+ ----- Method: VMMaker>>needsToRegenerateCheckFormatFile:named: (in category 'generate sources') -----
+ needsToRegenerateCheckFormatFile: cls named: fileName
+ 	"Check the timestamp for ImageFormat and then the timestamp for ckformat.c if it already exists.  Answer if the file needs regenerating."
+ 
+ 	| tStamp |
+ 	tStamp := cls timeStamp.
+ 
+ 	"don't translate if the file is newer than my timeStamp"
+ 	(self sourceDirectory entryAt: fileName ifAbsent: [nil]) ifNotNil:
+ 		[:fstat| | mTime |
+ 		mTime := fstat modificationTime.
+ 		mTime isInteger ifFalse: [mTime := mTime asSeconds].
+ 		tStamp < mTime ifTrue:
+ 			[^self confirm: (cls name, ' has not been modified since\', fileName, ' was last generated.\Do you still want to regenerate it?') withCRs]].
+ 	^true!



More information about the Vm-dev mailing list