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

commits at source.squeak.org commits at source.squeak.org
Fri Jul 21 18:33:53 UTC 2017


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

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

Name: VMMaker.oscog-eem.2257
Author: eem
Time: 21 July 2017, 11:32:44.600471 am
UUID: 7a3c75a8-72e7-4362-88b7-9a97109592a1
Ancestors: VMMaker.oscog-eem.2256

InterpreterPlugins:
Add the Terf primitives to the HostWindowPlugin as <option: #TerfVM>.  Hence add #TerfVM to namesDefinedAtCompileTime.
Make positive/signedMachineIntegerFor: <inline: #always> since they're merely indirections to 64-bit and 32-bit functions, and with #always we don't bother to generate the method itself.

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

Item was added:
+ ----- Method: HostWindowPlugin>>pointFromCompactPointEncoding: (in category 'support') -----
+ pointFromCompactPointEncoding: encodedPoint
+ 	"Answer a point from one of the funky encoded x,y position/size values the VM uses.
+ 	 The issue here is that the values can be negative, each value being in the range -32768 to 32767"
+ 	<inline: #always>
+ 	^interpreterProxy
+ 		makePointwithxValue: (self cCoerceSimple: encodedPoint >> 16 to: #short)
+ 		yValue: (self cCoerceSimple: (encodedPoint bitAnd: 16rFFFF) to: #short)!

Item was changed:
  ----- Method: HostWindowPlugin>>primitiveHostWindowPosition: (in category 'system primitives') -----
  primitiveHostWindowPosition: windowIndex 
  	"Return the origin position of the user area of the window in pixels from the topleft corner of the screen. Fail if the windowIndex is invalid or the platform routine returns -1 to indicate failure"
  	| pos |
  	self primitive: 'primitiveHostWindowPosition'
  		parameters: #(SmallInteger ).
  	pos := self ioPositionOfWindow: windowIndex.
+ 	pos = -1 ifTrue:
+ 		[^interpreterProxy primitiveFail].
+ 	^self pointFromCompactPointEncoding: pos!
- 	pos = -1
- 		ifTrue: [^ interpreterProxy primitiveFail]
- 		ifFalse: [^ interpreterProxy makePointwithxValue: pos >> 16  yValue: (pos bitAnd: 16rFFFF)]!

Item was changed:
  ----- Method: HostWindowPlugin>>primitiveHostWindowPositionSet:x:y: (in category 'system primitives') -----
+ primitiveHostWindowPositionSet: windowIndex x: x y: y
+ 	"Set the origin position of the user area of the window in pixels from the topleft corner of the screen- return the position actually set by the OS/GUI/window manager. Fail if the windowIndex is invalid or the platform routine returns -1 to indicate failure"
- primitiveHostWindowPositionSet: windowIndex x:  x y: y
- 	"Set the origin position of the user area of the window  in pixels from the topleft corner of the screen- return the position actually set by the OS/GUI/window manager. Fail if the windowIndex is invalid or the platform routine returns -1 to indicate failure"
  	| pos |
  	self primitive: 'primitiveHostWindowPositionSet'
  		parameters: #(SmallInteger SmallInteger SmallInteger).
  	pos := self ioPositionOfWindowSet: windowIndex x: x y: y.
+ 	pos = -1 ifTrue:
+ 		[^interpreterProxy primitiveFail].
+ 	^self pointFromCompactPointEncoding: pos!
- 	pos = -1
- 		ifTrue: [^ interpreterProxy primitiveFail]
- 		ifFalse: [^ interpreterProxy makePointwithxValue: pos >> 16  yValue: (pos bitAnd: 16rFFFF)]!

Item was added:
+ ----- Method: HostWindowPlugin>>primitiveHostWindowScreenWorkAreaPosition: (in category 'system primitives') -----
+ primitiveHostWindowScreenWorkAreaPosition: windex
+ 	<option: #TerfVM>
+ 	"Answer the platform's notion of the available work area on the screen containing the given window."
+ 	| size |
+ 	self primitive: 'primitiveHostWindowScreenWorkAreaPosition'
+ 		parameters: #(SmallInteger).
+ 	size := self ioPositionOfScreenWorkArea: windex.
+ 	size = -1 ifTrue:
+ 		[^interpreterProxy primitiveFail].
+ 	^self pointFromCompactPointEncoding: size!

Item was added:
+ ----- Method: HostWindowPlugin>>primitiveHostWindowScreenWorkAreaSize: (in category 'system primitives') -----
+ primitiveHostWindowScreenWorkAreaSize: windex
+ 	<option: #TerfVM>
+ 	"Answer the platform's notion of the available work area on the screen containing the given window."
+ 	| size |
+ 	self primitive: 'primitiveHostWindowScreenWorkAreaSize'
+ 		parameters: #(SmallInteger).
+ 	size := self ioSizeOfScreenWorkArea: windex.
+ 	size = -1 ifTrue:
+ 		[^interpreterProxy primitiveFail].
+ 	^self pointFromCompactPointEncoding: size!

Item was changed:
  ----- Method: HostWindowPlugin>>primitiveHostWindowSize: (in category 'system primitives') -----
  primitiveHostWindowSize: windowIndex 
  	"Return the size of the user area of the window in pixels. Fail if the windowIndex is invalid or the platform routine returns -1 to indicate failure"
  	| size |
  	self primitive: 'primitiveHostWindowSize'
  		parameters: #(SmallInteger ).
  	size := self ioSizeOfWindow: windowIndex.
+ 	size = -1 ifTrue:
+ 		[^interpreterProxy primitiveFail].
+ 	^self pointFromCompactPointEncoding: size!
- 	size = -1
- 		ifTrue: [^ interpreterProxy primitiveFail]
- 		ifFalse: [^ interpreterProxy makePointwithxValue: size >> 16  yValue: (size bitAnd: 16rFFFF)]!

Item was changed:
  ----- Method: HostWindowPlugin>>primitiveHostWindowSizeSet:x:y: (in category 'system primitives') -----
  primitiveHostWindowSizeSet: windowIndex x: x y: y
  	"Set the size of the user area of the window in pixels - return what is actually set by the OS/GUI/window manager. Fail if the windowIndex is invalid or the platform routine returns -1 to indicate failure"
  	| size |
  	self primitive: 'primitiveHostWindowSizeSet'
  		parameters: #(SmallInteger SmallInteger SmallInteger).
  	size := self ioSizeOfWindowSet: windowIndex x: x y: y.
+ 	size = -1 ifTrue:
+ 		[^interpreterProxy primitiveFail].
+ 	^self pointFromCompactPointEncoding: size!
- 	size = -1
- 		ifTrue: [^ interpreterProxy primitiveFail]
- 		ifFalse: [^ interpreterProxy makePointwithxValue: size >> 16  yValue: (size bitAnd: 16rFFFF)]!

Item was added:
+ ----- Method: HostWindowPlugin>>primitiveNativeDisplayPosition: (in category 'system primitives') -----
+ primitiveNativeDisplayPosition: windowHandle
+ 	<option: #TerfVM>
+ 	"Answer the origin position of the user area of the given native window in pixels from the topleft corner of the screen.
+ 	 Fail if the windowHandle is invalid or the platform routine returns -1 to indicate failure"
+ 	| pos |
+ 	self primitive: 'primitiveNativeDisplayPosition'
+ 		parameters: #(Unsigned).
+ 	pos := self ioPositionOfNativeDisplay: windowHandle.
+ 	pos = -1 ifTrue:
+ 		[^interpreterProxy primitiveFail].
+ 	^self pointFromCompactPointEncoding: pos!

Item was added:
+ ----- Method: HostWindowPlugin>>primitiveNativeDisplaySize: (in category 'system primitives') -----
+ primitiveNativeDisplaySize: windowHandle
+ 	<option: #TerfVM>
+ 	"Answer the size of the user area of the given native window in pixels.
+ 	 Fail if the windowHandle is invalid or the platform routine returns -1 to indicate failure"
+ 	| size |
+ 	self primitive: 'primitiveNativeDisplaySize'
+ 		parameters: #(Unsigned).
+ 	size := self ioSizeOfNativeDisplay: windowHandle.
+ 	size = -1 ifTrue:
+ 		[^interpreterProxy primitiveFail].
+ 	^self pointFromCompactPointEncoding: size!

Item was added:
+ ----- Method: HostWindowPlugin>>primitiveNativeWindowPosition: (in category 'system primitives') -----
+ primitiveNativeWindowPosition: windowHandle
+ 	<option: #TerfVM>
+ 	"Answer the origin position of the given native window in pixels from the topleft corner of the screen.
+ 	 Fail if the windowHandle is invalid or the platform routine returns -1 to indicate failure"
+ 	| pos |
+ 	self primitive: 'primitiveNativeWindowPosition'
+ 		parameters: #(Unsigned).
+ 	pos := self ioPositionOfNativeWindow: windowHandle.
+ 	pos = -1 ifTrue:
+ 		[^interpreterProxy primitiveFail].
+ 	^self pointFromCompactPointEncoding: pos!

Item was added:
+ ----- Method: HostWindowPlugin>>primitiveNativeWindowSize: (in category 'system primitives') -----
+ primitiveNativeWindowSize: windowHandle
+ 	<option: #TerfVM>
+ 	"Answer the size of the given native window in pixels.
+ 	 Fail if the windowHandle is invalid or the platform routine returns -1 to indicate failure"
+ 	| size |
+ 	self primitive: 'primitiveNativeWindowSize'
+ 		parameters: #(Unsigned).
+ 	size := self ioSizeOfNativeWindow: windowHandle.
+ 	size = -1 ifTrue:
+ 		[^interpreterProxy primitiveFail].
+ 	^self pointFromCompactPointEncoding: size!

Item was added:
+ ----- Method: HostWindowPlugin>>primitiveSetCursorPositionX:Y: (in category 'system primitives') -----
+ primitiveSetCursorPositionX: x Y: y
+ 	<option: #TerfVM>
+ 	"Set the position of the cursor to the specified position on the desktop.
+ 	 Fail if the platform routine returns -1 to indicate failure."
+ 	| result |
+ 	self primitive: 'primitiveSetCursorPosition'
+ 		parameters: #(SmallInteger SmallInteger).
+ 	result := self ioSetCursorPositionX: x Y: y.
+ 	result = -1 ifTrue:
+ 		[^interpreterProxy primitiveFail]!

Item was added:
+ ----- Method: HostWindowPlugin>>primitiveSqueakWindowHandle (in category 'system primitives') -----
+ primitiveSqueakWindowHandle
+ 	<option: #TerfVM>
+ 	"Answer the native Squeak window handle, presumably a pointer, as an unsigned integer.
+ 	 This value should be usable in native calls to the window manager as well as
+ 	 the argument to primitiveNativeWindowPosition:"
+ 	| handle |
+ 	<var: #handle type: 'void *'>
+ 	self primitive: 'primitiveSqueakWindowHandle'.
+ 	handle := self ioGetWindowHandle.
+ 	handle = 0 ifTrue:
+ 		[^interpreterProxy primitiveFail].
+ 	^interpreterProxy positiveMachineIntegerFor: (self cCoerceSimple: handle to: #sqInt)!

Item was changed:
  ----- Method: InterpreterPlugin>>positiveMachineIntegerFor: (in category 'API access') -----
  positiveMachineIntegerFor: value
  	<var: #value type: #'usqIntptr_t'>
+ 	<inline: #always>
- 	<inline: true>
  	^interpreterProxy wordSize = 8
  		ifTrue: [interpreterProxy positive64BitIntegerFor: value]
  		ifFalse: [interpreterProxy positive32BitIntegerFor: value]!

Item was changed:
  ----- Method: InterpreterPlugin>>signedMachineIntegerFor: (in category 'API access') -----
  signedMachineIntegerFor: value
  	<var: #value type: #'sqIntptr_t'>
+ 	<inline: #always>
- 	<inline: true>
  	^interpreterProxy wordSize = 8
  		ifTrue: [interpreterProxy signed64BitIntegerFor: value]
  		ifFalse: [interpreterProxy signed32BitIntegerFor: value]!

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."
  	^#(	VMBIGENDIAN
  		IMMUTABILITY
  		STACKVM COGVM COGMTVM SPURVM
  		PharoVM								"Pharo vs Squeak"
+ 		TerfVM									"Terf vs Squeak"
  		EnforceAccessControl					"Newspeak"
  		CheckRememberedInTrampoline		"IMMUTABILITY"
+ 		LLDB)									"As of lldb-370.0.42 Swift-3.1, passing funciton 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>"!
- 		LLDB)									"As of lldb-370.0.42 Swift-3.1, passing funciton 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 -fno0lto has no effect.  hence we define some debugging functions as being <option: LLDB>"!



More information about the Vm-dev mailing list