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

commits at source.squeak.org commits at source.squeak.org
Tue Jan 16 19:10:00 UTC 2018


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

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

Name: VMMaker.oscog-eem.2317
Author: eem
Time: 16 January 2018, 11:09:39.019913 am
UUID: 88da3e78-b771-4300-9064-884d028aa75c
Ancestors: VMMaker.oscog-eem.2316

Simulation:
Better SocketPlugin name lookup simulation.
Better display update.
Fix bug in breakpointing on function load (looking up primitives in the VM uses an empty string which matched due to the use of strncmp).

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

Item was removed:
- ----- Method: CogVMSimulator>>ioForceDisplayUpdate (in category 'other primitives') -----
- ioForceDisplayUpdate
- 	"no-op"!

Item was changed:
  ----- Method: CogVMSimulator>>ioLoadFunction:From: (in category 'plugin support') -----
  ioLoadFunction: functionString From: pluginString
  	"Load and return the requested function from a module"
  	| firstTime plugin fnSymbol |
  	firstTime := false.
  	fnSymbol := functionString asSymbol.
  	transcript
  		cr;
  		show: '(', byteCount printString, ') Looking for ', functionString, ' in ',
  				(pluginString isEmpty ifTrue:['vm'] ifFalse:[pluginString]).
  	(breakSelector notNil
+ 	 and: [pluginString size = breakSelector size
  	 and: [(self str: pluginString n: breakSelector cmp: pluginString size) = 0
+ 		or: [(self str: functionString n: breakSelector cmp: functionString size) = 0]]]) ifTrue:
- 		or: [(self str: functionString n: breakSelector cmp: functionString size) = 0]]) ifTrue:
  		[self halt: functionString].
  	plugin := pluginList 
  				detect:[:any| any key = pluginString asString]
  				ifNone:
  					[firstTime := true.
  					self loadNewPlugin: pluginString].
  	plugin ifNil:
  		[firstTime ifTrue: [transcript cr; show: 'Failed ... primitive not in plugin'].
  		 ^0].
  	plugin := plugin value.
  	mappedPluginEntries doWithIndex:
  		[:pluginAndName :index|
  		((pluginAndName at: 1) == plugin 
  		and:[(pluginAndName at: 2) == fnSymbol]) ifTrue:
  			[^index]].
  	(plugin respondsTo: fnSymbol) ifFalse:
  		[firstTime ifTrue: [transcript cr; show: 'Failed ... primitive not in plugin'].
  		 ^0].
  	mappedPluginEntries addLast: (Array
  									with: plugin
  									with: fnSymbol
  									with: [plugin perform: fnSymbol. self]).
  	"Transcript show: ' ... okay'."
  	transcript cr.
  	^ mappedPluginEntries size!

Item was changed:
  ----- Method: CogVMSimulator>>ioLoadFunction:From:AccessorDepthInto: (in category 'plugin support') -----
  ioLoadFunction: functionString From: pluginString AccessorDepthInto: accessorDepthPtr
  	"Load and return the requested function from a module.
  	 Assign the accessor depth through accessorDepthPtr.
  	 N.B. The actual code lives in platforms/Cross/vm/sqNamedPrims.h"
  	| firstTime plugin fnSymbol |
  	firstTime := false.
  	fnSymbol := functionString asSymbol.
  	transcript
  		cr;
  		show: '(', byteCount printString, ') Looking for ', functionString, ' in ',
  				(pluginString isEmpty ifTrue:['vm'] ifFalse:[pluginString]).
  	(breakSelector notNil
+ 	 and: [pluginString size = breakSelector size
  	 and: [(self str: pluginString n: breakSelector cmp: pluginString size) = 0
+ 		or: [(self str: functionString n: breakSelector cmp: functionString size) = 0]]]) ifTrue:
- 		or: [(self str: functionString n: breakSelector cmp: functionString size) = 0]]) ifTrue:
  		[self halt: functionString].
  	plugin := pluginList 
  				detect: [:any| any key = pluginString asString]
  				ifNone:
  					[firstTime := true.
  					 self loadNewPlugin: pluginString].
  	plugin ifNil:
  		[firstTime ifTrue: [transcript cr; show: 'Failed ... primitive not in plugin'].
  		 ^0].
  	plugin := plugin value.
  	mappedPluginEntries doWithIndex:
  		[:pluginAndName :index|
  		 ((pluginAndName at: 1) == plugin 
  		  and:[(pluginAndName at: 2) == fnSymbol]) ifTrue:
  			[firstTime ifTrue: [transcript show: ' ... okay'; cr].
  			 accessorDepthPtr at: 0 put: (pluginAndName at: 4).
  			 ^index]].
  	firstTime ifTrue: [transcript cr; show: 'Failed ... primitive not in plugin'].
  	transcript cr.
  	^0!

Item was added:
+ ----- Method: InterpreterProxy>>ioLoadFunction:From:AccessorDepthInto: (in category 'FFI support') -----
+ ioLoadFunction: functionName From: moduleName AccessorDepthInto: accessorDepthPtr
+ 	<returnTypeC: #'void *'>
+ 	<var: #functionName type: #'char *'>
+ 	<var: #moduleName type: #'char *'>
+ 	<var: #accessorDepthPtr type: #'sqInt *'>
+ 	"Dummy - provided by support code"
+ 	^0!

Item was changed:
  SocketPlugin subclass: #SocketPluginSimulator
+ 	instanceVariableNames: 'openSocketHandles externalSemaphores hostSocketToSimSocketMap simSocketToHostSocketMap fakeAddressCounter resolverSemaphoreIndex ipv6support resolverStatus addressForName'
- 	instanceVariableNames: 'openSocketHandles externalSemaphores hostSocketToSimSocketMap simSocketToHostSocketMap fakeAddressCounter resolverSemaphoreIndex ipv6support resolverStatus'
  	classVariableNames: 'ResolverBusy ResolverError ResolverReady ResolverUninitialized'
  	poolDictionaries: ''
  	category: 'VMMaker-InterpreterSimulation'!

Item was changed:
  ----- Method: SocketPluginSimulator>>sqResolverNameLookupResult (in category 'simulation') -----
  sqResolverNameLookupResult
  	"For now don't simulate the implicit semaphore."
+ 	addressForName ifNil: [^interpreterProxy primitiveFail].
+ 	self assert: addressForName size = 4.
- 	| bytes |
- 	bytes := NetNameResolver primNameLookupResult.
- 	self assert: bytes size = 4.
  	"Effectively netAddressToInt: bytes"
+ 	^	((addressForName at: 4)) +
+ 		((addressForName at: 3) <<8) +
+ 		((addressForName at: 2) <<16) +
+ 		((addressForName at: 1) <<24)!
- 	^	((bytes at: 4)) +
- 		((bytes at: 3) <<8) +
- 		((bytes at: 2) <<16) +
- 		((bytes at: 1) <<24)!

Item was changed:
  ----- Method: SocketPluginSimulator>>sqResolverStartName:Lookup: (in category 'simulation') -----
  sqResolverStartName: aCArray Lookup: size
  	"For now don't simulate the implicit semaphore."
  	| hostName |
  	hostName := self st: (String new: size) rn: aCArray cpy: size.
+ 	addressForName := NetNameResolver addressForName: hostName timeout: 30.
- 	NetNameResolver primStartLookupOfName: hostName.
  	resolverSemaphoreIndex ifNotNil:
+ 		[resolverStatus := ResolverReady.
+ 		 interpreterProxy signalSemaphoreWithIndex: resolverSemaphoreIndex]!
- 		[| status |
- 		 resolverStatus := ResolverBusy.
- 		 [[(status := NetNameResolver primNameResolverStatus) = resolverStatus] whileTrue:
- 			[(Delay forSeconds: 1) wait].
- 		 resolverStatus := status.
- 		 interpreterProxy signalSemaphoreWithIndex: resolverSemaphoreIndex] fork]!

Item was changed:
  ----- Method: SocketPluginSimulator>>sqResolverStatus (in category 'simulation') -----
  sqResolverStatus
+ 	self break.
+ 	self break.
+ 	^resolverStatus !
- 	^resolverStatus!

Item was added:
+ ----- Method: StackInterpreter>>ioForceDisplayUpdate (in category 'simulation') -----
+ ioForceDisplayUpdate
+ 	"Make sure the display is updated.  Simulation only"
+ 	<doNotGenerate>
+ 	World displayWorldSafely!

Item was removed:
- ----- Method: StackInterpreterSimulator>>ioForceDisplayUpdate (in category 'other primitives') -----
- ioForceDisplayUpdate
- 	"This assumes morphic"
- 	World doOneCycle!

Item was changed:
  ----- Method: StackInterpreterSimulator>>ioLoadFunction:From: (in category 'plugin support') -----
  ioLoadFunction: functionString From: pluginString
  	"Load and return the requested function from a module"
  	| plugin fnSymbol |
  	fnSymbol := functionString asSymbol.
  	transcript
  		cr;
  		show: '(', byteCount printString, ') Looking for ', functionString, ' in ',
  				(pluginString isEmpty ifTrue:['vm'] ifFalse:[pluginString]).
+ 	(breakSelector notNil
+ 	 and: [pluginString size = breakSelector size
+ 	 and: [(self str: pluginString n: breakSelector cmp: pluginString size) = 0
+ 		or: [(self str: functionString n: breakSelector cmp: functionString size) = 0]]]) ifTrue:
+ 		[self halt: functionString].
  	plugin := pluginList 
  				detect:[:any| any key = pluginString asString]
  				ifNone:[self loadNewPlugin: pluginString].
  	plugin ifNil:[
  		"Transcript cr; show:'Failed ... no plugin found'." ^ 0].
  	plugin := plugin value.
  	mappedPluginEntries doWithIndex:[:pluginAndName :index|
  		((pluginAndName at: 1) == plugin 
  			and:[(pluginAndName at: 2) == fnSymbol]) ifTrue:[
  				"Transcript show:' ... okay'." ^ index]].
  	(plugin respondsTo: fnSymbol) ifFalse:[
  		"Transcript cr; show:'Failed ... primitive not in plugin'." ^ 0].
  	mappedPluginEntries := mappedPluginEntries copyWith: (Array with: plugin with: fnSymbol).
  	"Transcript show:' ... okay'."
  	^ mappedPluginEntries size!

Item was changed:
  ----- Method: StackInterpreterSimulator>>ioLoadFunction:From:AccessorDepthInto: (in category 'plugin support') -----
  ioLoadFunction: functionString From: pluginString AccessorDepthInto: accessorDepthPtr
  	"Load and return the requested function from a module.
  	 Assign the accessor depth through accessorDepthPtr.
  	 N.B. The actual code lives in platforms/Cross/vm/sqNamedPrims.h"
  	| firstTime plugin fnSymbol |
  	firstTime := false.
  	fnSymbol := functionString asSymbol.
  	transcript
  		cr;
  		show: '(', byteCount printString, ') Looking for ', functionString, ' in ',
  				(pluginString isEmpty ifTrue:['vm'] ifFalse:[pluginString]).
  	(breakSelector notNil
+ 	 and: [pluginString size = breakSelector size
+ 	 and: [(self str: pluginString n: breakSelector cmp: pluginString size) = 0
+ 		or: [(self str: functionString n: breakSelector cmp: functionString size) = 0]]]) ifTrue:
- 	 and: [(self str: functionString n: breakSelector cmp: functionString size) = 0]) ifTrue:
  		[self halt: functionString].
  	plugin := pluginList 
  				detect: [:any| any key = pluginString asString]
  				ifNone:
  					[firstTime := true.
  					 self loadNewPlugin: pluginString].
  	plugin ifNil:
  		[firstTime ifTrue: [transcript cr; show: 'Failed ... primitive not in plugin'].
  		 ^0].
  	plugin := plugin value.
  	mappedPluginEntries doWithIndex:
  		[:pluginAndName :index|
  		 ((pluginAndName at: 1) == plugin 
  		  and:[(pluginAndName at: 2) == fnSymbol]) ifTrue:
  			[firstTime ifTrue: [transcript show: ' ... okay'; cr].
  			 accessorDepthPtr at: 0 put: (pluginAndName at: 4).
  			 ^index]].
  	firstTime ifTrue: [transcript cr; show: 'Failed ... primitive not in plugin'].
  	transcript cr.
  	^0!



More information about the Vm-dev mailing list