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

commits at source.squeak.org commits at source.squeak.org
Fri Aug 24 22:45:13 UTC 2018


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

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

Name: VMMaker.oscog-eem.2434
Author: eem
Time: 24 August 2018, 3:44:40.951049 pm
UUID: a39ae1c6-6a72-43d6-9deb-873785768a82
Ancestors: VMMaker.oscog-eem.2433

Add the missing implementation in InterpreterProxy, and correct the comment of primitiveFailForFFIException:at:.  Also activateFailingPrimitiveMethod is not an api method; primitiveFailForFFIException:at: is.

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

Item was changed:
  ----- Method: InterpreterPrimitives>>primitiveFailForFFIException:at: (in category 'primitive support') -----
  primitiveFailForFFIException: exceptionCode at: pc
  	<var: 'exceptionCode' type: #usqLong>
  	<var: 'pc' type: #usqInt>
+ 	"Set PrimErrFFIException primitive failure and associated exceptionCode (a.k.a. 
+ 	 osErrorCode) and exceptionPC. Under control of the ffiExceptionResponse flag,
+ 	 if in a primitive with an error code and the inFFIFlags indicate we're in an FFI call,
+ 	 then fail the primitive.
- 	"Set PrimErrOSError primitive failure and associated osErrorCode. Under
- 	 control of the ffiExceptionResponse flag, if in a primitive with an error code
- 	 and the inFFIFlags indicate we're in an FFI call, then fail the primitive.
  	 ffiExceptionResponse < 0 never fail
  	 ffiExceptionResponse = 0 fail if method has a primitive error code (default)
  	 ffiExceptionResponse > 0 always fail"
  	<api>
  	((inFFIFlags noMask: DisownVMForFFICall)	"i.e. not in an FFI call"
  	 or: [ffiExceptionResponse < 0]) ifTrue:		"i.e. never fail"
  		[^self].
  	osErrorCode := self cCoerceSimple: exceptionCode to: #sqLong.
  	exceptionPC := pc.
  	primFailCode := PrimErrFFIException.
  	(ffiExceptionResponse > 0					"always fail..."
  	 or: [(objectMemory isOopCompiledMethod: newMethod)
  		 and: [self methodUsesPrimitiveErrorCode: newMethod]]) ifTrue:
  		[self ownVM: DisownVMForFFICall. "To take ownership but importantly to reset inFFIFlags"
  		 self activateFailingPrimitiveMethod]!

Item was changed:
  Object subclass: #InterpreterProxy
+ 	instanceVariableNames: 'primFailCode remapBuffer stack method argumentCount bb thisSessionID osErrorCode exceptionPC'
- 	instanceVariableNames: 'primFailCode remapBuffer stack method argumentCount bb thisSessionID osErrorCode'
  	classVariableNames: ''
  	poolDictionaries: 'VMBasicConstants'
  	category: 'VMMaker-InterpreterSimulation'!
  
+ !InterpreterProxy commentStamp: 'eem 8/24/2018 15:43' prior: 0!
- !InterpreterProxy commentStamp: 'eem 12/7/2017 19:37' prior: 0!
  This class should provide the definition of what interpreter support plugins need and can have access to. Note that the proxy related files platforms - Cross - vm - sqVirtualMachine.[ch] are kept under the git tree at http://www.github.com/opensmalltalk/vm.
+ The main use of the class is to support the vm simulator and the RSqueak VM, which implements as many primitives as possible in Smalltalk.!
- The main use of the class is to support the vm simulator!

Item was added:
+ ----- Method: InterpreterProxy>>primitiveFailForFFIException:at: (in category 'other') -----
+ primitiveFailForFFIException: exceptionCode at: pc
+ 	<var: 'exceptionCode' type: #usqLong>
+ 	<var: 'pc' type: #usqInt>
+ 	"Set PrimErrFFIException primitive failure and associated exceptionCode (a.k.a. 
+ 	 osErrorCode) and exceptionPC."
+ 	<primitive: 255>
+ 	osErrorCode := exceptionCode.
+ 	exceptionPC := pc.
+ 	^primFailCode := PrimErrFFIException!

Item was changed:
  ----- Method: StackInterpreter>>activateFailingPrimitiveMethod (in category 'primitive support') -----
  activateFailingPrimitiveMethod
  	"Assuming the primFailCode (and any other relevant failure state) has been set,
  	 switch the VM to the interpreter if necessary (if in the CoInterpreter executing machine code),
  	 and activate the newMethod (which is expected to have a primitive)."
- 	<api>
  	self assert: primFailCode ~= 0.
  	self assert: (objectMemory addressCouldBeObj: newMethod).
  	self assert: (objectMemory isCompiledMethod: newMethod).
  	self assert: (self primitiveIndexOf: newMethod) ~= 0.
  	self justActivateNewMethod: true. "Frame must be interpreted"
  	self siglong: reenterInterpreter jmp: ReturnToInterpreter.
  	"NOTREACHED"
  	^nil!



More information about the Vm-dev mailing list