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

commits at source.squeak.org commits at source.squeak.org
Thu Dec 11 00:11:23 UTC 2014


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

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

Name: VMMaker.oscog-eem.975
Author: eem
Time: 10 December 2014, 4:08:40.068 pm
UUID: de22d941-0268-4e60-a8be-89a3a88aa567
Ancestors: VMMaker.oscog-eem.974

Fix 64-bit issues i BitBlt Drop MIDI and RE plugins.

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

Item was changed:
  ----- Method: BitBltSimulation>>rgbComponentAlpha32 (in category 'combination rules') -----
  rgbComponentAlpha32
  	"This version assumes 
  		combinationRule = 41
  		sourcePixSize = destPixSize = 32
  		sourceForm ~= destForm.
  	Note: The inner loop has been optimized for dealing
  		with the special case of aR = aG = aB = 0 
  	"
  	| srcIndex dstIndex sourceWord srcAlpha destWord deltaX deltaY srcY dstY |
  
  	<inline: false> "This particular method should be optimized in itself"
  
  	"Give the compile a couple of hints"
+ 	<var: #sourceWord type: 'register long'>
+ 	<var: #deltaX type: 'register long'>
- 	<var: #sourceWord declareC:'register int sourceWord'>
- 	<var: #deltaX declareC:'register int deltaX'>
  
  	"The following should be declared as pointers so the compiler will
  	notice that they're used for accessing memory locations 
  	(good to know on an Intel architecture) but then the increments
  	would be different between ST code and C code so must hope the
  	compiler notices what happens (MS Visual C does)"
+ 	<var: #srcIndex type: 'register long'>
+ 	<var: #dstIndex type: 'register long'>
- 	<var: #srcIndex declareC:'register int srcIndex'>
- 	<var: #dstIndex declareC:'register int dstIndex'>
  	
  	deltaY := bbH + 1. "So we can pre-decrement"
  	srcY := sy.
  	dstY := dy.
  
  	"This is the outer loop"
  	[(deltaY := deltaY - 1) ~= 0] whileTrue:[
  		srcIndex := sourceBits + (srcY * sourcePitch) + (sx * 4).
  		dstIndex := destBits + (dstY * destPitch) + (dx * 4).
  		deltaX := bbW + 1. "So we can pre-decrement"
  
  		"This is the inner loop"
  		[(deltaX := deltaX - 1) ~= 0] whileTrue:[
  			sourceWord := self srcLongAt: srcIndex.
  			srcAlpha := sourceWord bitAnd:16rFFFFFF.
  				srcAlpha = 0 ifTrue:[
  					srcIndex := srcIndex + 4.
  					dstIndex := dstIndex + 4.
  					"Now skip as many words as possible,"
  					[(deltaX := deltaX - 1) ~= 0 and:[
  						((sourceWord := self srcLongAt: srcIndex) bitAnd:16rFFFFFF) = 0]]
  						whileTrue:[
  							srcIndex := srcIndex + 4.
  							dstIndex := dstIndex + 4.
  						].
  					"Adjust deltaX"
  					deltaX := deltaX + 1.
  				] ifFalse:[ "0 < srcAlpha"
  					"If we have to mix colors then just copy a single word"
  					destWord := self dstLongAt: dstIndex.
  					destWord := self rgbComponentAlpha32: sourceWord with: destWord.
  					self dstLongAt: dstIndex put: destWord.
  					srcIndex := srcIndex + 4.
  					dstIndex := dstIndex + 4.
  				].
  		].
  		srcY := srcY + 1.
  		dstY := dstY + 1.
  	].!

Item was changed:
  ----- Method: DropPlugin>>setFileAccessCallback: (in category 'primitives') -----
  setFileAccessCallback: address
  	<export: true>
+ 	^self sqSecFileAccessCallback: address asVoidPointer!
- 	<var: #address type: 'int'>
- 	^self cCode: 'sqSecFileAccessCallback((void *) address)'.!

Item was changed:
  ----- Method: MIDIPlugin>>primitiveMIDIGetPortName: (in category 'primitives') -----
  primitiveMIDIGetPortName: portNum
+ 	| portName sz nameObj |
- 
- 	| portName sz nameObj namePtr |
  	<var: #portName declareC: 'char portName[256]'>
+ 	self primitive: 'primitiveMIDIGetPortName' parameters: #(SmallInteger).
- 	<var: #namePtr type: 'char * '>
- 	self primitive: 'primitiveMIDIGetPortName'
- 		parameters: #(SmallInteger).
  
+ 	sz := self sqMIDIGet: portNum Port: portName Name: 255.
- 	sz := self cCode: 'sqMIDIGetPortName(portNum, (int) &portName, 255)'.
  	nameObj := interpreterProxy instantiateClass: interpreterProxy classString indexableSize: sz.
+ 	interpreterProxy failed ifTrue: [^nil].
+ 	self mem: (nameObj asValue: String) cp: portName y: sz.
- 	interpreterProxy failed ifTrue:[^nil].
- 	namePtr := nameObj asValue: String .
- 	self cCode: 'memcpy(namePtr, portName, sz)'.
  	^nameObj!

Item was changed:
  ----- Method: RePlugin>>primPCRECompile (in category 're primitives') -----
  primPCRECompile
  
  "<rcvr primPCRECompile>, where rcvr is an object with instance variables:
  
  	'patternStr compileFlags pcrePtr extraPtr errorStr errorOffset matchFlags'	
  
  Compile the regular expression in patternStr, and if the compilation is successful, attempt to optimize the compiled expression.  Store the results in <pcrePtr> and <extratr>, or fill errorStr with a meaningful errorString and errorOffset with an indicator where the error was found, applying compileFlags throughout.  Answer nil with a clean compile (regardless of whether an optimization is possible, and answer with the string otherwise."
  
  
  	<export: true>
  	self loadRcvrFromStackAt: 0.
  	patternStrPtr := self rcvrPatternStrPtr.
  	compileFlags := self rcvrCompileFlags.
  	interpreterProxy failed ifTrue:[^ nil].
  
+ 	pcrePtr := self cCode: '(sqInt) pcre_compile(patternStrPtr, compileFlags, &errorStrBuffer, &errorOffset, NULL)'.
- 	pcrePtr := self cCode: '(int) pcre_compile(patternStrPtr, compileFlags, 
- 					&errorStrBuffer, &errorOffset, NULL)'.
  	pcrePtr
  		ifTrue: [
  			self allocateByteArrayAndSetRcvrPCREPtrFromPCRE: pcrePtr.
+ 			extraPtr := self cCode: '(sqInt) pcre_study((pcre *)pcrePtr, compileFlags, &errorStrBuffer)'.
- 			extraPtr := self cCode: '(int) pcre_study((pcre *)pcrePtr, compileFlags, &errorStrBuffer)'.
  			self allocateByteArrayAndSetRcvrExtraPtrFrom: extraPtr.
+ 			self rePluginFree: pcrePtr asVoidPointer.
+ 			extraPtr ifTrue: [self rePluginFree: extraPtr asVoidPointer].
- 			self rePluginFree: (self cCoerce: pcrePtr to: 'void *').
- 			extraPtr ifTrue: [self rePluginFree: (self cCoerce: extraPtr to: 'void *')].
  			interpreterProxy failed ifTrue:[^ nil].
  			interpreterProxy pop: 1 thenPush: interpreterProxy nilObject]
  		ifFalse: [
  			errorStr := self allocateStringAndSetRcvrErrorStrFromCStr: errorStrBuffer.
  			self rcvrErrorOffsetFrom: errorOffset.
  			interpreterProxy failed ifTrue:[^ nil].
  			interpreterProxy pop: 1 thenPush: errorStr].!

Item was changed:
  ----- Method: RePlugin>>rcvrExtraPtr (in category 'rcvr linkage') -----
  rcvrExtraPtr
  
  	|extraObj|
  	<inline: true>
  	extraObj := interpreterProxy fetchPointer: 3 ofObject: rcvr.
  	^self 
  		cCoerce: (extraObj = interpreterProxy nilObject
  					ifTrue: [nil]
  					ifFalse: [interpreterProxy arrayValueOf: extraObj])
+ 		to: #sqInt!
- 		to: 'int'!

Item was changed:
  ----- Method: RePlugin>>rcvrPCREBufferPtr (in category 'rcvr linkage') -----
  rcvrPCREBufferPtr
- 
  	<inline: true>
  	^self
  		cCoerce: (interpreterProxy fetchArray: 2 ofObject: rcvr)
+ 		to: #sqInt!
- 		to: 'int'.!



More information about the Vm-dev mailing list