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

commits at source.squeak.org commits at source.squeak.org
Mon Nov 24 19:08:24 UTC 2014


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

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

Name: VMMaker.oscog-eem.954
Author: eem
Time: 24 November 2014, 11:05:55.778 am
UUID: b7f58c9d-3ec9-4d7f-b41e-45aac820f622
Ancestors: VMMaker.oscog-eem.953

Fix some warnings and some 64-bit issues with the
ThreadedFFIPlugin.  Comment the FFIPlugin as obsolete.

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

Item was changed:
  InterpreterPlugin subclass: #FFIPlugin
  	instanceVariableNames: 'ffiLastError ffiArgSpec ffiArgSpecSize ffiArgHeader ffiRetOop ffiRetClass ffiRetSpec ffiRetSpecSize ffiRetHeader ffiLogEnabled externalFunctionInstSize'
  	classVariableNames: ''
  	poolDictionaries: 'FFIConstants'
  	category: 'VMMaker-Plugins'!
  
+ !FFIPlugin commentStamp: 'eem 11/24/2014 11:00' prior: 0!
+ This plugin provides access to foreign function interfaces on those platforms that provide such. For example Windows DLLs and unix .so's.  It is obsolete, having been superceded by the ThreadedFFIPlugin.!
- !FFIPlugin commentStamp: 'tpr 5/5/2003 11:54' prior: 0!
- This plugin provides access to foreign function interfaces on those platforms that provide such. For example Windows DLLs and unix .so's.!

Item was changed:
  ----- Method: ThreadedFFIPlugin>>ffiContentsOfHandle:errCode: (in category 'callout support') -----
  ffiContentsOfHandle: oop errCode: errCode
  	"Make sure that the given oop is a valid external handle"
  	<inline: true>
  	((interpreterProxy isBytes: oop)
+ 	 and: [(interpreterProxy byteSizeOf: oop) = (self sizeof: #sqInt)]) ifFalse:
- 	 and: [(interpreterProxy byteSizeOf: oop) = 4]) ifFalse:
  		[^self ffiFail: errCode].
  	^interpreterProxy fetchPointer: 0 ofObject: oop!

Item was changed:
  ----- Method: ThreadedFFIPlugin>>ffiLoadCalloutModule: (in category 'symbol loading') -----
  ffiLoadCalloutModule: module
  	"Load the given module and return its handle"
  	| moduleHandlePtr moduleHandle ffiModuleName moduleLength rcvr ptr |
  	<var: #ptr type:'int *'>
  	(interpreterProxy isBytes: module) ifTrue:[
  		"plain module name"
  		ffiModuleName := module.
  		moduleLength := interpreterProxy byteSizeOf: ffiModuleName.
+ 		moduleHandle := (interpreterProxy
+ 							ioLoadModule: (interpreterProxy firstIndexableField: ffiModuleName) asInteger
+ 							OfLength: moduleLength) asInteger.
- 		moduleHandle := interpreterProxy ioLoadModule: (self cCoerce: (interpreterProxy firstIndexableField: ffiModuleName) to:'int') OfLength: moduleLength.
  		(interpreterProxy failed
  		 or: [moduleHandle = 0]) ifTrue:
  			[^self ffiFail: FFIErrorModuleNotFound]. "failed"
  		^moduleHandle].
  	"Check if the external method is defined in an external library"
  	rcvr := interpreterProxy stackValue: interpreterProxy methodArgumentCount.
  	(interpreterProxy is: rcvr KindOfClass: interpreterProxy classExternalLibrary) ifFalse:
  		[^self ffiFail: FFIErrorNoModule].
  	"external library"
  	moduleHandlePtr := interpreterProxy fetchPointer: 0 ofObject: rcvr.
  	moduleHandle := self ffiContentsOfHandle: moduleHandlePtr errCode: FFIErrorBadExternalLibrary.
  	interpreterProxy failed ifTrue:[^0].
  	moduleHandle = 0 ifTrue:["need to reload module"
  		ffiModuleName := interpreterProxy fetchPointer: 1 ofObject: rcvr.
  		(interpreterProxy isBytes: ffiModuleName) ifFalse:[^self ffiFail: FFIErrorBadExternalLibrary].
  		moduleLength := interpreterProxy byteSizeOf: ffiModuleName.
+ 		moduleHandle := (interpreterProxy
+ 								ioLoadModule: (interpreterProxy firstIndexableField: ffiModuleName) asInteger
+ 								OfLength: moduleLength) asInteger.
- 		moduleHandle := interpreterProxy ioLoadModule: (self cCoerce: (interpreterProxy firstIndexableField: ffiModuleName) to:'int') OfLength: moduleLength.
  		(interpreterProxy failed
  		 or: [moduleHandle = 0]) ifTrue:
  			[^self ffiFail: FFIErrorModuleNotFound]. "failed"
  		"and store back"
  		ptr := interpreterProxy firstIndexableField: moduleHandlePtr.
  		ptr at: 0 put: moduleHandle].
  	^moduleHandle!

Item was changed:
  ----- Method: ThreadedFFIPlugin>>primitiveForceLoad (in category 'primitives') -----
  primitiveForceLoad
  	"Primitive. Force loading the receiver (an instance of ExternalLibrary)."
  	| rcvr moduleHandlePtr moduleHandle ffiModuleName ptr |
  	<export: true>
  	<inline: false>
+ 	<var: #ptr type: #'sqInt *'>
- 	<var: #ptr type: #'int *'>
  	interpreterProxy methodArgumentCount = 0 ifFalse:
  		[^interpreterProxy primitiveFail].
  	rcvr := interpreterProxy stackValue: 0.
  	(interpreterProxy is: rcvr KindOfClass: interpreterProxy classExternalLibrary) ifFalse:
  		[^self ffiFail: FFIErrorBadExternalLibrary].
  	moduleHandlePtr := interpreterProxy fetchPointer: 0 ofObject: rcvr.
  	moduleHandle := self ffiContentsOfHandle: moduleHandlePtr errCode: FFIErrorBadExternalLibrary.
  	interpreterProxy failed ifTrue:
  		[^0].
  	ffiModuleName := interpreterProxy fetchPointer: 1 ofObject: rcvr.
  	(interpreterProxy isBytes: ffiModuleName) ifFalse:
  		[^self ffiFail: FFIErrorBadExternalLibrary].
+ 	moduleHandle := (interpreterProxy
+ 						ioLoadModule: (interpreterProxy firstIndexableField: ffiModuleName) asInteger
+ 						OfLength: (interpreterProxy byteSizeOf: ffiModuleName)) asInteger.
+ 	interpreterProxy failed ifTrue:
+ 		[^self ffiFail: FFIErrorModuleNotFound]. "failed"
- 	moduleHandle := interpreterProxy
- 						ioLoadModule: (self cCoerce: (interpreterProxy firstIndexableField: ffiModuleName) to: #int)
- 						OfLength: (interpreterProxy byteSizeOf: ffiModuleName).
- 	interpreterProxy failed ifTrue:[^self ffiFail: FFIErrorModuleNotFound]. "failed"
  	"and store back"
  	ptr := interpreterProxy firstIndexableField: moduleHandlePtr.
  	ptr at: 0 put: moduleHandle.
  	^0 "done"!



More information about the Vm-dev mailing list