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

commits at source.squeak.org commits at source.squeak.org
Tue Oct 23 17:52:29 UTC 2018


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

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

Name: VMMaker.oscog-eem.2472
Author: eem
Time: 23 October 2018, 10:51:47.041242 am
UUID: ddfb4678-9bee-48fb-a486-c3f3eede8113
Ancestors: VMMaker.oscog-eem.2471

Simplify two uses of malloc: now that we use the right simulation form for VMClass>>malloc:.

Ronie, if I've broken Lowcode simulation I apologise, and want to work on fixing it (perhaps with you?) but I have no test cases.

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

Item was changed:
  ----- Method: InterpreterPrimitives>>cStringOrNullFor: (in category 'primitive support') -----
  cStringOrNullFor: oop
  	"Answer either a malloced string with the null-terminated contents of oop if oop is a string,
  	 or the null pointer if oop is nil, or fail.  It is the client's responsibility to free the string later."
  	<api>
  	<returnTypeC: #'char *'>
  	<inline: false>
  	| isString len cString |
  	<var: 'cString' type: #'char *'>
  	isString := self isInstanceOfClassByteString: oop.
  	isString ifFalse:
  		[oop ~= objectMemory nilObject ifTrue:
  			[self primitiveFailFor: PrimErrBadArgument].
  		 ^0].
  	len := objectMemory lengthOf: oop.
  	len = 0 ifTrue:
  		[^0].
  	cString := self malloc: len + 1.
  	cString ifNil:
  		[self primitiveFailFor: PrimErrNoCMemory.
  		 ^0].
  	self memcpy: cString _: (objectMemory firstIndexableField: oop) _: len.
+ 	cString at: len put: 0.
- 	cString at: (self cCode: [len] inSmalltalk: [len + 1]) put: 0.
  	^cString!

Item was changed:
  ----- Method: StackInterpreter>>setupNativeStack (in category 'initialization') -----
  setupNativeStack
  	<option: #LowcodeVM>
  	<var: #theNativeStackMemory type: #'char*'>
  	<var: #theShadowCallStackMemory type: #'char*'>
  	<inline: false>
  	"This initializes an alternate stack that is used by the Lowcode instructions"
  	| nativeStackMemorySize theNativeStackMemory shadowCallStackMemorySize theShadowCallStackMemory|
  	nativeStackMemorySize := self nativeStackSize.
+ 	theNativeStackMemory := self malloc: nativeStackMemorySize.
- 	theNativeStackMemory := self
- 							cCode: [self malloc: nativeStackMemorySize ]
- 							inSmalltalk: [CArrayAccessor on: (ByteArray new: self nativeStackSize)].
  	nativeStackPointer := theNativeStackMemory + nativeStackMemorySize.
  	
  	shadowCallStackMemorySize := self shadowCallStackSize.
+ 	theShadowCallStackMemory := self malloc: shadowCallStackMemorySize.
+ 	shadowCallStackPointer := theShadowCallStackMemory + shadowCallStackMemorySize!
- 	theShadowCallStackMemory := self
- 							cCode: [self malloc: shadowCallStackMemorySize ]
- 							inSmalltalk: [CArrayAccessor on: (ByteArray new: self shadowCallStackSize)].
- 	shadowCallStackPointer := theShadowCallStackMemory + shadowCallStackMemorySize.!



More information about the Vm-dev mailing list