[Vm-dev] VM Maker: MemoryAccess-dtl.6.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Mar 30 23:28:27 UTC 2016


David T. Lewis uploaded a new version of MemoryAccess to project VM Maker:
http://source.squeak.org/VMMaker/MemoryAccess-dtl.6.mcz

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

Name: MemoryAccess-dtl.6
Author: dtl
Time: 30 March 2016, 7:28:23.155 pm
UUID: 6fabecce-e2aa-4bec-8b2e-f421802beda7
Ancestors: MemoryAccess-dtl.5

Convert to pragma declarations using Pragmatizer

=============== Diff against MemoryAccess-dtl.5 ===============

Item was changed:
  ----- Method: MemoryAccess>>byteAt: (in category 'object memory access') -----
  byteAt: oop
  	"Answer the byte at an object memory location. The result is a signed sqInt
  	value in the range 0 through 255."
  
  	"sqInt byteAt(sqInt oop) { return byteAtPointer(pointerForOop(oop)); }"
  
+ 	<inline: true>
- 	self inline: true.
  	^ self byteAtPointer: (self pointerForOop: oop)!

Item was changed:
  ----- Method: MemoryAccess>>byteAt:put: (in category 'object memory access') -----
  byteAt: oop put: val
  	"Cast a sqInt value to signed integer and store its low order byte at the given
  	object memory location."
  
  	"sqInt byteAtput(sqInt oop, int val) { return byteAtPointerput(pointerForOop(oop), val); }"
  
+ 	<inline: true>
+ 	<var: #val type: 'int'>
- 	self inline: true.
- 	self var: #val type: 'int'.
  	^ self byteAtPointer: (self pointerForOop: oop) put: val!

Item was changed:
  ----- Method: MemoryAccess>>byteAtPointer: (in category 'map address to value') -----
  byteAtPointer: ptr
  	"Answer the unsigned byte value at a machine address. The result is a signed
  	sqInt value in the range 0 through 255."
  
  	"sqInt byteAtPointer(char *ptr) { return (sqInt)(*((unsigned char *)ptr)) }"
  
+ 	<inline: true>
+ 	<var: #ptr type: 'char *'>
- 	self inline: true.
- 	self var: #ptr type: 'char *'.
  	^ self cCoerce:
  			((self cCoerce: ptr to: 'unsigned char *') at: 0)
  		to: 'sqInt'!

Item was changed:
  ----- Method: MemoryAccess>>byteAtPointer:put: (in category 'map address to value') -----
  byteAtPointer: ptr put: val
  	"Cast a sqInt value to signed integer and store its low order byte at the given
  	machine address."
  
  	"sqInt byteAtPointerput(char *ptr, int val) { return (sqInt)(*((unsigned char *)ptr)= (unsigned char)val) }"
  
+ 	<inline: true>
+ 	<var: #ptr type: 'char *'>
+ 	<var: #val type: 'int'>
- 	self inline: true.
- 	self var: #ptr type: 'char *'.
- 	self var: #val type: 'int'.
  	^ self cCoerce: ((self cCoerce: ptr to: 'unsigned char *')
  				at: 0
  				put: val)
  		to: 'sqInt'!

Item was changed:
  ----- Method: MemoryAccess>>intAt: (in category 'object memory access') -----
  intAt: oop
  	"Answer the unsigned integer value at an object memory location. The result
  	is a signed sqInt value with binary value in the range 0 through 16rFFFFFFFF.
  	If the size of sqInt is 8 bytes (64-bit object memory) and size of integer is 4, 
  	then the high order 4 bytes of the result are zero."
  
  	"sqInt intAt(sqInt oop) { return intAtPointer(pointerForOop(oop)); }"
  
+ 	<inline: true>
- 	self inline: true.
  	^ self intAtPointer: (self pointerForOop: oop)!

Item was changed:
  ----- Method: MemoryAccess>>intAt:put: (in category 'object memory access') -----
  intAt: oop put: val
  	"Cast a sqInt value to unsigned integer and store its low order bytes at the given
  	object memory location. Assuming that size of integer is 4, then four bytes are stored
  	regardless of the size of sqInt (32-bit or 64-bit object memory)."
  
  	"sqInt intAtput(sqInt oop, int val) { return intAtPointerput(pointerForOop(oop), val); }"
  
+ 	<inline: true>
+ 	<var: #val type: 'int'>
- 	self inline: true.
- 	self var: #val type: 'int'.
  	^ self intAtPointer: (self pointerForOop: oop) put: val!

Item was changed:
  ----- Method: MemoryAccess>>intAtPointer: (in category 'map address to value') -----
  intAtPointer: ptr
  	"Answer the unsigned integer value at a machine address. The result is a signed
  	sqInt value with binary value in the range 0 through 16rFFFFFFFF. If the
  	size of sqInt is 8 bytes (64-bit object memory) and size of integer is 4, then the
  	high order 4 bytes of the result are zero."
  
  	"sqInt intAtPointer(char *ptr) { return (sqInt)(*((unsigned int *)ptr)) }"
  
+ 	<inline: true>
+ 	<var: #ptr type: 'char *'>
- 	self inline: true.
- 	self var: #ptr type: 'char *'.
  	^ self cCoerce:
  			((self cCoerce: ptr to: 'unsigned int *') at: 0)
  		to: 'sqInt'!

Item was changed:
  ----- Method: MemoryAccess>>intAtPointer:put: (in category 'map address to value') -----
  intAtPointer: ptr put: val
  	"Cast a sqInt value to unsigned integer and store its low order bytes at the given
  	machine address. Assuming that size of integer is 4, then four bytes are stored
  	regardless of the size of sqInt (32-bit or 64-bit object memory)."
  
  	"sqInt intAtPointerput(char *ptr, int val) { return (sqInt)(*((unsigned int *)ptr)= (int)val) }"
  
+ 	<inline: true>
+ 	<var: #ptr type: 'char *'>
+ 	<var: #val type: 'unsigned int'>
- 	self inline: true.
- 	self var: #ptr type: 'char *'.
- 	self var: #val type: 'unsigned int'.
  	^ self cCoerce:
  			((self cCoerce: ptr to: 'unsigned int *')
  				at: 0
  				put: val)
  		to: 'sqInt'!

Item was changed:
  ----- Method: MemoryAccess>>long32At: (in category 'object memory access') -----
  long32At: ptr
  	"#define long32At intAt"
  
+ 	<inline: true>
- 	self inline: true.
  	^ self intAt: ptr
  !

Item was changed:
  ----- Method: MemoryAccess>>long32At:put: (in category 'object memory access') -----
  long32At: ptr put: val
  	"#define long32Atput intAtput"
  
+ 	<inline: true>
+ 	<var: #val type: 'int'>
- 	self inline: true.
- 	self var: #val type: 'int'.
  	^ self intAt: ptr put: val
  !

Item was changed:
  ----- Method: MemoryAccess>>longAt: (in category 'object memory access') -----
  longAt: oop
  	"Answer the object memory word, an sqInt, located at an object memory location.
  	In the original 32-bit object memory implemention, word size was equivalent
  	to C type long. For 64-bit object memory, the method name may be misleading
  	because the sqInt value is of C type long long."
  
  	"sqInt longAt(sqInt oop) { return longAtPointer(pointerForOop(oop)); }"
  
+ 	<inline: true>
- 	self inline: true.
  	^ self longAtPointer: (self pointerForOop: oop)
  !

Item was changed:
  ----- Method: MemoryAccess>>longAt:put: (in category 'object memory access') -----
  longAt: oop put: val
  	"Store an object memory word, an sqInt, at the given object memory location.
  	In the original 32-bit object memory implemention, word size was equivalent
  	to C type long. For 64-bit object memory, the method name may be misleading
  	because the sqInt value is of C type long long."
  
  	"sqInt longAtput(sqInt oop, sqInt val) { return longAtPointerput(pointerForOop(oop), val); }"
  
+ 	<inline: true>
- 	self inline: true.
  	^ self longAtPointer: (self pointerForOop: oop) put: val
  !

Item was changed:
  ----- Method: MemoryAccess>>longAtPointer: (in category 'map address to value') -----
  longAtPointer: ptr
  	"Answer the object memory word, an sqInt, located at a machine address.
  	In the original 32-bit object memory implemention, word size was equivalent
  	to C type long. For 64-bit object memory, the method name may be misleading
  	because the sqInt value is of C type long long."
  
  	"sqInt longAtPointer(char *ptr) { return (sqInt)(*((sqInt *)ptr)) }"
  
+ 	<inline: true>
+ 	<var: #ptr type: 'char *'>
- 	self inline: true.
- 	self var: #ptr type: 'char *'.
  	^ self cCoerce:
  			((self cCoerce: ptr to: 'sqInt *') at: 0)
  		to: 'sqInt'
  !

Item was changed:
  ----- Method: MemoryAccess>>longAtPointer:put: (in category 'map address to value') -----
  longAtPointer: ptr put: val
  	"Store an object memory word, an sqInt, at the given machine address.
  	In the original 32-bit object memory implemention, word size was equivalent
  	to C type long. For 64-bit object memory, the method name may be misleading
  	because the sqInt value is of C type long long."
  
  	"sqInt longAtPointerput(char *ptr, sqInt val) { return (sqInt)(*((sqInt *)ptr)= (sqInt)val) }"
  
+ 	<inline: true>
+ 	<var: #ptr type: 'char *'>
- 	self inline: true.
- 	self var: #ptr type: 'char *'.
  	^ self cCoerce: ((self cCoerce: ptr to: 'sqInt *')
  				at: 0
  				put: val)
  		to: 'sqInt'!

Item was changed:
  ----- Method: MemoryAccess>>oopAt: (in category 'object memory access') -----
  oopAt: oop
  	"Answer the object memory word, an sqInt, located at an object memory location."
  
  	"oopAt(sqInt oop) { return oopAtPointer(pointerForOop(oop)); }"
  
+ 	<inline: true>
- 	self inline: true.
  	^ self oopAtPointer: (self pointerForOop: oop)!

Item was changed:
  ----- Method: MemoryAccess>>oopAt:put: (in category 'object memory access') -----
  oopAt: oop put: val
  	"Store an object memory word, an sqInt, at the given object memory location."
  
  	"sqInt oopAtput(sqInt oop, sqInt val) { return oopAtPointerput(pointerForOop(oop), val); }"
  
+ 	<inline: true>
- 	self inline: true.
  	^ self oopAtPointer: (self pointerForOop: oop) put: val!

Item was changed:
  ----- Method: MemoryAccess>>oopAtPointer: (in category 'map address to value') -----
  oopAtPointer: ptr
  	"Answer the object memory word, an sqInt, located at a machine address."
  
  	"sqInt oopAtPointer(char *ptr) { return (sqInt)(*((sqInt *)ptr)) }"
  
+ 	<inline: true>
+ 	<var: #ptr type: 'char *'>
- 	self inline: true.
- 	self var: #ptr type: 'char *'.
  	^ (self cCoerce: ptr to: 'sqInt *') at: 0!

Item was changed:
  ----- Method: MemoryAccess>>oopAtPointer:put: (in category 'map address to value') -----
  oopAtPointer: ptr put: val
  	"Store an object memory word, an sqInt, at the given machine address."
  
  	"sqInt oopAtPointerput(char *ptr, sqInt val) { return (sqInt)(*((sqInt *)ptr)= (sqInt)val) }"
  
+ 	<inline: true>
+ 	<var: #ptr type: 'char *'>
- 	self inline: true.
- 	self var: #ptr type: 'char *'.
  	^ (self cCoerce: ptr to: 'sqInt *') at: 0 put: val!

Item was changed:
  ----- Method: MemoryAccess>>oopForPointer: (in category 'memory mapping') -----
  oopForPointer: ptr
  	"Answer the oop located at ptr, a machine address. This method maps
  	machine addresses (C pointers) to object memory locations.
  
  	sqInt oopForPointer(char *ptr) { return (sqInt)(ptr - sqMemoryBase); }"
  
+ 	<inline: true>
+ 	<returnTypeC: 'usqInt'>
+ 	<var: #ptr type: 'char *'>
- 	self inline: true.
- 	self returnTypeC: 'usqInt'.
- 	self var: #ptr type: 'char *'.
  	^ self cCoerce: ptr - self sqMemoryBaseAddress to: 'usqInt'!

Item was changed:
  ----- Method: MemoryAccess>>pointerForOop: (in category 'memory mapping') -----
  pointerForOop: oop
  	"Answer the machine address of the object to which oop refers. This method maps
  	object memory locations to their underlying machine addresses (C pointers).
  
  	char *pointerForOop(usqInt oop) { return sqMemoryBase + oop; }"
  
+ 	<inline: true>
+ 	<returnTypeC: 'char *'>
+ 	<var: #oop type: 'usqInt'>
- 	self inline: true.
- 	self returnTypeC: 'char *'.
- 	self var: #oop type: 'usqInt'.
  	^ self sqMemoryBaseAddress + oop!

Item was changed:
  ----- Method: MemoryAccess>>shortAt: (in category 'object memory access') -----
  shortAt: oop
  	"Answer the signed short integer value at an object memory location. The
  	result is a signed sqInt value. Negative values will be sign extended, such
  	that if the short integer value is binary 16rFFFF, the result will be 16rFFFFFFFF
  	for a 32-bit object memory, or 16rFFFFFFFFFFFFFFFF for a 64-bit object memory."
  
  	"sqInt shortAt(sqInt oop) { return shortAtPointer(pointerForOop(oop)); }"
  
+ 	<inline: true>
- 	self inline: true.
  	^ self shortAtPointer: (self pointerForOop: oop)!

Item was changed:
  ----- Method: MemoryAccess>>shortAt:put: (in category 'object memory access') -----
  shortAt: oop put: val
  	"Cast a sqInt value to signed short integer and store its low order bytes at the
  	given object memory location. Assuming that size of a short integer is 2, then two
  	bytes are stored regardless of the size of sqInt (32-bit or 64-bit object memory)."
  
  	"sqInt shortAtput(sqInt oop, int val){ return shortAtPointerput(pointerForOop(oop), val); }"
  
+ 	<inline: true>
+ 	<var: #val type: 'int'>
- 	self inline: true.
- 	self var: #val type: 'int'.
  	^ self shortAtPointer: (self pointerForOop: oop) put: val!

Item was changed:
  ----- Method: MemoryAccess>>shortAtPointer: (in category 'map address to value') -----
  shortAtPointer: ptr 
  	"Answer the signed short integer value at a machine address. The result is a
  	signed sqInt value. Negative values will be sign extended, such that if the
  	short integer value is binary 16rFFFF, the result will be 16rFFFFFFFF for a 32-bit
  	object memory, or 16rFFFFFFFFFFFFFFFF for a 64-bit object memory."
  
  	"sqInt shortAtPointer(char *ptr) { return (sqInt)(*((short *)ptr)) }"
  
+ 	<inline: true>
+ 	<var: #ptr type: 'char *'>
- 	self inline: true.
- 	self var: #ptr type: 'char *'.
  	^ self cCoerce: ((self cCoerce: ptr to: 'short *') at: 0)
  		to: 'sqInt'!

Item was changed:
  ----- Method: MemoryAccess>>shortAtPointer:put: (in category 'map address to value') -----
  shortAtPointer: ptr put: val
  	"Cast a sqInt value to signed short integer and store its low order bytes at the
  	given machine address. Assuming that size of a short integer is 2, then two
  	bytes are stored regardless of the size of sqInt (32-bit or 64-bit object memory)."
  
  	"sqInt shortAtPointerput(char *ptr, int val) { return (sqInt)(*((short *)ptr)= (short)val) }"
  
+ 	<inline: true>
+ 	<var: #ptr type: 'char *'>
+ 	<var: #val type: 'int'>
- 	self inline: true.
- 	self var: #ptr type: 'char *'.
- 	self var: # val type: 'int'.
  	^ self cCoerce:
  			((self cCoerce: ptr to: 'short *')
  				at: 0
  				put: (self cCoerce: val to: 'short'))
  		to: 'sqInt'!

Item was changed:
  ----- Method: MemoryAccess>>shortUnsignedAtPointer: (in category 'map address to value') -----
  shortUnsignedAtPointer: ptr 
  	"Answer the unsigned short integer value at a machine address. The result
  	is a signed sqInt value with value in the range 0 through 16rFFFF, assuming
  	that size of short integer is 2."
  
  	"sqInt shortUnsignedAtPointer(char *ptr) { return (sqInt)(*((unsigned short *)ptr)) }"
  
+ 	<inline: true>
+ 	<var: #ptr type: 'char *'>
- 	self inline: true.
- 	self var: #ptr type: 'char *'.
  	^ self cCoerce: ((self cCoerce: ptr to: 'unsigned short *') at: 0)
  		to: 'sqInt'!

Item was changed:
  ----- Method: MemoryAccess>>sqMemoryBaseAddress (in category 'memory mapping') -----
  sqMemoryBaseAddress
  	"Answer the machine address of the start of object memory."
  
+ 	<inline: true>
+ 	<returnTypeC: 'char *'>
- 	self inline: true.
- 	self returnTypeC: 'char *'.
  	^ self cCode: 'sqMemoryBase'
  !



More information about the Vm-dev mailing list