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

commits at source.squeak.org commits at source.squeak.org
Mon Mar 23 17:13:56 UTC 2015


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

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

Name: VMMaker.oscog-eem.1112
Author: eem
Time: 23 March 2015, 10:11:57.392 am
UUID: ad55a64a-81f7-4a37-9fb4-3787919a6923
Ancestors: VMMaker.oscog-eem.1111

Provide a common sizeof: for SQSocket.
Exclude dumpImage: from Spur (no seg support yet)

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

Item was changed:
  ----- Method: FilePlugin>>primitiveFileTruncate (in category 'file primitives') -----
  primitiveFileTruncate
  "ftruncate is not an ansi function so we have a macro to point to a suitable platform implementation" 
+ 	| truncatePosition file |
+ 	<var: 'file' type: #'SQFile *'>
+ 	<var: 'truncatePosition' type: #squeakFileOffsetType>
- 	| truncatePosition file sz |
- 	<var: 'file' type: 'SQFile *'>
- 	<var: 'truncatePosition' type: 'squeakFileOffsetType'>
  	<export: true>
+ 	(interpreterProxy isIntegerObject: (interpreterProxy stackValue: 0)) ifFalse:
+ 		[(interpreterProxy byteSizeOf: (interpreterProxy stackValue: 0)) > (self sizeof: #squeakFileOffsetType) ifTrue:
+ 			[^interpreterProxy primitiveFail]].
+ 	truncatePosition := interpreterProxy positive64BitValueOf: (interpreterProxy stackValue: 0).
- 	(interpreterProxy isIntegerObject: (interpreterProxy stackValue: 0))
- 		ifFalse: [sz := self cCode: 'sizeof(squeakFileOffsetType)'.
- 			(interpreterProxy byteSizeOf: (interpreterProxy stackValue: 0)) > sz
- 				ifTrue: [^ interpreterProxy primitiveFail]].
- 	truncatePosition := interpreterProxy
- 				positive64BitValueOf: (interpreterProxy stackValue: 0).
  	file := self fileValueOf: (interpreterProxy stackValue: 1).
+ 	interpreterProxy failed ifFalse:
+ 		[self sqFile: file Truncate: truncatePosition].
+ 		 interpreterProxy failed ifFalse:
+ 			[interpreterProxy pop: 2 "pop position, file; leave rcvr on stack"]!
- 	interpreterProxy failed
- 		ifFalse: [self sqFile: file Truncate: truncatePosition].
- 	interpreterProxy failed
- 		ifFalse: [interpreterProxy pop: 2 "pop position, file; leave rcvr on stack"]!

Item was changed:
  ----- Method: InterpreterPlugin>>sizeof: (in category 'simulation support') -----
  sizeof: objectSymbolOrClass
  	<doNotGenerate>
  	objectSymbolOrClass isInteger ifTrue:
  		[^interpreterProxy wordSize].
  	"In the simulator file handles are just integer indices into openFiles and so need
  	 only be BytesPerWord big. But in the actual VM they are at least 5 words long."
  	objectSymbolOrClass == #SQFile ifTrue:
  		[^interpreterProxy wordSize * 5].
+ 	"SQSocket is typedef struct { int sessionID; int socketType; void *privateSocketPtr; } SQSocket"
+ 	objectSymbolOrClass == #SQSocket ifTrue:
+ 		[^8 + interpreterProxy wordSize].
  	"We assume the file offset type is always 64-bits."
  	objectSymbolOrClass == #squeakFileOffsetType ifTrue:
  		[^8].
  	^super sizeof: objectSymbolOrClass!

Item was changed:
  ----- Method: SocketPlugin>>socketRecordSize (in category 'primitives') -----
  socketRecordSize
  	"Return the size of a Smalltalk socket record in bytes."
+ 	<inline: true>
+ 	^ self sizeof: #SQSocket!
- 
- 	^ self cCode: 'sizeof(SQSocket)' inSmalltalk: [12]!

Item was changed:
  ----- Method: StackInterpreter>>dumpImage: (in category 'image save/restore') -----
  dumpImage: fileName
+ 	"Dump the entire image out to the given file. Intended for debugging only.  Doesn't work for Spur."
- 	"Dump the entire image out to the given file. Intended for debugging only."
  	| f dataSize result |
+ 	<notOption: #SpurObjectMemory>
  	<export: true>
+ 	<var: #f type: #sqImageFile>
- 	<var: #f type: 'sqImageFile'>
  
+ 	f := self sqImageFile: (self pointerForOop: fileName) Open: 'wb'.
- 	f := self cCode: 'sqImageFileOpen(pointerForOop(fileName), "wb")'.
  	f = nil ifTrue: [^-1].
  	dataSize := objectMemory endOfMemory - objectMemory startOfMemory.
+ 	result := self sq: (self pointerForOop: self memory) Image: (self sizeof: #'unsigned char') File: dataSize Write: f.
+ 	self sqImageFileClose: f.
+ 	^result!
- 	result := self cCode: 'sqImageFileWrite(pointerForOop(memory()), sizeof(unsigned char), dataSize, f)'.
- 	self cCode: 'sqImageFileClose(f)'.
- 	^result
- !



More information about the Vm-dev mailing list