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

commits at source.squeak.org commits at source.squeak.org
Thu Oct 1 03:11:52 UTC 2020


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

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

Name: VMMaker.oscog-eem.2832
Author: eem
Time: 30 September 2020, 8:11:43.302713 pm
UUID: bc601167-a7f8-41d3-8621-eb8313bbc4ad
Ancestors: VMMaker.oscog-eem.2831

Comment an interesting policy choice in externalInstVar:ofContext:.
Fix a slip in the new IA32ABI copy into primitive

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

Item was changed:
  ----- Method: CoInterpreter>>externalInstVar:ofContext: (in category 'frame access') -----
  externalInstVar: offset ofContext: aContext
  	"Fetch an instance variable from a maybe married context.
  	 If the context is still married compute the value of the
  	 relevant inst var from the spouse frame's state.
  
  	 If the context is single but has a negative instruction pointer
  	 recognise that the instruction pointer is actually into machine
  	 code and convert it to the corresponding bytecode pc."
  	<inline: false>
  	| value |
  
  	self assert: (objectMemory isContext: aContext).
  	self assert: offset <= (ReceiverIndex + (self checkStackPointerForMaybeMarriedContext: aContext)).
  	"method, closureOrNil & receiver need no special handling; only
  	 sender, pc & stackp have to be computed for married contexts."
  	(self isReadMediatedContextInstVarIndex: offset) ifFalse:
  		[^objectMemory fetchPointer: offset ofObject: aContext].
  
  	self externalWriteBackHeadFramePointers.
  	(self isStillMarriedContext: aContext) ifTrue:
  		[^self fetchPointer: offset ofMarriedContext: aContext].
  	
  	value := objectMemory fetchPointer: offset ofObject: aContext.
+ 	"Why not update the slot to refer to the mapped pc?  We're damned if we do, and damned if
+ 	 we don't.  If it is and the context is live and is returned to, then the pc will be mapped back
+ 	 to machine code.  If we don't then the mapping will be repeated on every access.  What we
+ 	 need are stats that show whether or not a read here predicts one or other outcome with any
+ 	 certainty.  For now, we keep it as it has been for a long time and do not update the slot."
  	(offset = InstructionPointerIndex
   	 and: [(objectMemory isIntegerObject: value)
   	 and: [value signedIntFromLong < 0]]) ifTrue:
  		[^self mustMapMachineCodePC: (objectMemory integerValueOf: value) context: aContext].
  	^value!

Item was changed:
  ----- Method: IA32ABIPlugin>>primAlienCopyInto (in category 'primitives-accessing') -----
  primAlienCopyInto
  	"Copy some number of bytes from the receiver starting at the first index into some destination
  	 object starting at the second index.  The  destination may be an Aliens or a bit-indexable object.
  	 The primitive will have the following signature:
  	<Alien>
  		primCopyFrom: start <Integer>
  		to: stop <Integer>
  		into: destination <Alien | indexableByteSubclass et al>
  		startingAt: destStart <Integer> ^<self>
  		<primitive: 'primitiveAlienReplace' error: errorCode module: 'IA32ABI'>
  	"
  	<export: true>
  	| alien start stop dest destStart src totalLength destAddr myLength |
  	alien := interpreterProxy stackValue: 4.  "Unchecked!!"
  	start := interpreterProxy stackIntegerValue: 3.
  	stop := interpreterProxy stackIntegerValue: 2.
  	dest := interpreterProxy stackValue: 1.
  	destStart := interpreterProxy stackIntegerValue: 0.
  
  	(interpreterProxy failed
  	 or: [(interpreterProxy isWordsOrBytes: dest) not]) ifTrue:
  		[^interpreterProxy primitiveFailFor: PrimErrBadArgument].
  
  	myLength := self sizeField: alien.
  	src := (self startOfData: alien withSize: myLength) + start - 1.
  
  	(self isAlien: dest)
  		ifTrue:
  			[totalLength := self sizeField: dest.
+ 			 destAddr := (self startOfData: dest withSize: totalLength) + destStart - 1.
- 			 destAddr := (self startOfData: dest withSize: totalLength) + start - 1.
  			 totalLength = 0 "no bounds checks for zero-sized (pointer) Aliens"
  				ifTrue: [totalLength := stop]
  				ifFalse: [totalLength := totalLength abs]]
  		ifFalse:
  			[totalLength := interpreterProxy byteSizeOf: dest.
+ 			 destAddr := (self startOfByteData: dest) + destStart - 1].
- 			 destAddr := (self startOfByteData: dest) + start - 1].
  
  	((start >= 1 and: [start - 1 <= stop and: [stop <= myLength abs]])
  	 and: [stop - start + 1 <= totalLength]) ifFalse:
  		[^interpreterProxy primitiveFailFor: PrimErrBadIndex].
  
  	(interpreterProxy isOopImmutable: dest) ifTrue:
  		[^interpreterProxy primitiveFailFor: PrimErrNoModification].
  
  	"Use memmove to allow source and desition to overlap"
  	self memmove: destAddr asVoidPointer _: src asVoidPointer _: stop - start + 1.
  
  	interpreterProxy methodReturnReceiver!



More information about the Vm-dev mailing list