Skip to content

Commit 2bb0524

Browse files
committed
CogVM source as per VMMaker.oscog-eem.3547
Fix the remaining longAt:[put:]/byteAt:put: usages that should have been long/byteAtPointer: surfaced by using USE_INLINE_MEMORY_ACCESSORS with strict versions of clang. Fix use of longAt[Pointer]:put: aPointer, which now needs a cast. Introduce singleFloatAt:, floatAt:, & long32AtPointer: for symmetry with the other accessors. Have frameCallerSavedIP: answer an integer instead of a pointer, reducing the number of casts (intructionPointer is an integer, localIP is a pointer). Similarly with allocateMemory:minimum:imageFile:headerSize:. Refactor positiveMachineIntegerValueOf: & signedMachineIntegerValueOf: into inlined code with non-inlined positiveMachineIntegerValueOfObj: & signedMachineIntegerValueOfObj:. Nuke some obsolete code from an abandoned port (marryFrameCopiesTemps & associated).
1 parent 57d3cbc commit 2bb0524

59 files changed

Lines changed: 61520 additions & 75496 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

platforms/Cross/vm/sqMemoryAccess.h

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,6 @@ typedef unsigned long long usqIntptr_t;
153153
static inline sqInt longAtPointerput(char *ptr, sqInt val) { return *(sqInt *)ptr= val; }
154154
static inline sqLong long64AtPointer(char *ptr) { return *(sqLong *)ptr; }
155155
static inline sqLong long64AtPointerput(char *ptr, sqLong val) { return *(sqLong *)ptr= val; }
156-
static inline float singleFloatAtPointer(char *ptr) { return *(float *)ptr; }
157-
static inline float singleFloatAtPointerput(char *ptr, float val) { return *(float *)ptr= val; }
158-
static inline double floatAtPointer(char *ptr) { return *(double *)ptr; }
159-
static inline double floatAtPointerput(char *ptr, double val) { return *(double *)ptr= val; }
160156
static inline sqInt oopAtPointer(char *ptr) { return *(sqInt *)ptr; }
161157
static inline sqInt oopAtPointerput(char *ptr, sqInt val) { return (sqInt)(*(sqInt *)ptr= val); }
162158
# if defined(sqMemoryBase) && !sqMemoryBase
@@ -202,6 +198,14 @@ typedef unsigned long long usqIntptr_t;
202198
static inline usqLong uint64AtPointer(char *ptr) { return (*((usqLong *)ptr)); }
203199
static inline usqLong uint64AtPointerput(char *ptr, usqLong val) { return (*((usqLong *)ptr)= val); }
204200

201+
static inline float singleFloatAtPointer(char *ptr) { return *(float *)ptr; }
202+
static inline float singleFloatAtPointerput(char *ptr, float val) { return *(float *)ptr= val; }
203+
static inline double floatAtPointer(char *ptr) { return *(double *)ptr; }
204+
static inline double floatAtPointerput(char *ptr, double val) { return *(double *)ptr= val; }
205+
static inline float singleFloatAt(sqInt oop) { return *(float *)oop; }
206+
static inline float singleFloatAtput(sqInt oop, float val) { return *(float *)oop= val; }
207+
static inline double floatAt(sqInt oop) { return *(double *)oop; }
208+
static inline double floatAtput(sqInt oop, double val) { return *(double *)oop= val; }
205209
#else /* USE_INLINE_MEMORY_ACCESSORS */
206210
/* Use macros when static inline functions aren't efficient. */
207211
# define byteAtPointer(ptr) ((sqInt)(*((unsigned char *)(ptr))))
@@ -214,12 +218,8 @@ typedef unsigned long long usqIntptr_t;
214218
# define longAtPointerput(ptr,val) (*(sqInt *)(ptr)= (sqInt)(val))
215219
# define long64AtPointer(ptr) (*(sqLong *)(ptr))
216220
# define long64AtPointerput(ptr,val) (*(sqLong *)(ptr)= (sqLong)(val))
217-
# define singleFloatAtPointer(ptr) (*(float*)(ptr))
218-
# define singleFloatAtPointerput(ptr, val) (*(float*)(ptr) = val)
219-
# define floatAtPointer(ptr) (*(double*)(ptr))
220-
# define floatAtPointerput(ptr, val) (*(double*)(ptr) = val)
221221
# define pointerAtPointer(ptr) (*(char**)(ptr))
222-
# define pointerAtPointerput(ptr, val) (*(char**)(ptr) = val)
222+
# define pointerAtPointerput(ptr, val) (*(char**)(ptr) = (val))
223223
# define oopAtPointer(ptr) (*(sqInt *)(ptr))
224224
# define oopAtPointerput(ptr,val) (*(sqInt *)(ptr)= (sqInt)(val))
225225
# if defined(sqMemoryBase) && !sqMemoryBase
@@ -245,24 +245,33 @@ typedef unsigned long long usqIntptr_t;
245245
# define oopAtput(oop,val) oopAtPointerput(atPointerArg(oop), val)
246246

247247
# define int8AtPointer(ptr) (*(signed char*)(ptr))
248-
# define int8AtPointerput(ptr, val) (*(signed char*)(ptr) = val)
248+
# define int8AtPointerput(ptr, val) (*(signed char*)(ptr) = (val))
249249
# define uint8AtPointer(ptr) (*(unsigned char*)(ptr))
250-
# define uint8AtPointerput(ptr, val) (*(unsigned char*)(ptr) = val)
250+
# define uint8AtPointerput(ptr, val) (*(unsigned char*)(ptr) = (val))
251251

252252
# define int16AtPointer(ptr) (*(signed short*)(ptr))
253-
# define int16AtPointerput(ptr, val) (*(signed short*)(ptr) = val)
253+
# define int16AtPointerput(ptr, val) (*(signed short*)(ptr) = (val))
254254
# define uint16AtPointer(ptr) (*(unsigned short*)(ptr))
255-
# define uint16AtPointerput(ptr, val) (*(unsigned short*)(ptr) = val)
255+
# define uint16AtPointerput(ptr, val) (*(unsigned short*)(ptr) = (val))
256256

257257
# define int32AtPointer(ptr) (*(signed int*)(ptr))
258-
# define int32AtPointerput(ptr, val) (*(signed int*)(ptr) = val)
258+
# define int32AtPointerput(ptr, val) (*(signed int*)(ptr) = (val))
259259
# define uint32AtPointer(ptr) (*(unsigned int*)(ptr))
260-
# define uint32AtPointerput(ptr, val) (*(unsigned int*)(ptr) = val)
260+
# define uint32AtPointerput(ptr, val) (*(unsigned int*)(ptr) = (val))
261261

262262
# define int64AtPointer(ptr) (*(sqLong*)(ptr))
263-
# define int64AtPointerput(ptr, val) (*(sqLong*)(ptr) = val)
263+
# define int64AtPointerput(ptr, val) (*(sqLong*)(ptr) = (val))
264264
# define uint64AtPointer(ptr) (*(usqLong*)(ptr))
265-
# define uint64AtPointerput(ptr, val) (*(usqLong*)(ptr) = val)
265+
# define uint64AtPointerput(ptr, val) (*(usqLong*)(ptr) = (val))
266+
267+
# define singleFloatAt(oop) (*(float*)(oop))
268+
# define singleFloatAtPointer(ptr) (*(float*)(ptr))
269+
# define singleFloatAtput(oop, val) (*(float*)(oop) = (val))
270+
# define singleFloatAtPointerput(ptr, val) (*(float*)(ptr) = (val))
271+
# define floatAt(oop) (*(double*)(oop))
272+
# define floatAtPointer(ptr) (*(double*)(ptr))
273+
# define floatAtput(oop, val) (*(double*)(oop) = (val))
274+
# define floatAtPointerput(ptr, val) (*(double*)(ptr) = (val))
266275
#endif /* USE_INLINE_MEMORY_ACCESSORS */
267276

268277
static inline sqLong asIEEE64BitWord(double val)
@@ -289,6 +298,8 @@ static inline unsigned int asIEEE32BitWord(float val)
289298

290299
#define long32At intAt
291300
#define long32Atput intAtput
301+
#define long32AtPointer intAtPointer
302+
#define long32AtPointerput intAtPointerput
292303

293304
/* platform-dependent float conversion macros.
294305
* Note: Second argument must be a variable name, not an expression!

src/spur32.cog.lowcode/cogit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.3546 uuid: c0fdd7da-d7a5-4bce-8e52-40f2876838bc
2+
CCodeGenerator VMMaker.oscog-eem.3547 uuid: 9fdd05e7-6928-4a10-a546-c1b12df6ca8a
33
(Compiler-eem.514)
44
*/
55

src/spur32.cog.lowcode/cogitARMv5.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.3546 uuid: c0fdd7da-d7a5-4bce-8e52-40f2876838bc
2+
CCodeGenerator VMMaker.oscog-eem.3547 uuid: 9fdd05e7-6928-4a10-a546-c1b12df6ca8a
33
(Compiler-eem.514)
44
from
5-
StackToRegisterMappingCogit VMMaker.oscog-eem.3546 uuid: c0fdd7da-d7a5-4bce-8e52-40f2876838bc
5+
StackToRegisterMappingCogit VMMaker.oscog-eem.3547 uuid: 9fdd05e7-6928-4a10-a546-c1b12df6ca8a
66
*/
7-
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3546 uuid: c0fdd7da-d7a5-4bce-8e52-40f2876838bc " __DATE__ ;
7+
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3547 uuid: 9fdd05e7-6928-4a10-a546-c1b12df6ca8a " __DATE__ ;
88
char *__cogitBuildInfo = __buildInfo;
99

1010

@@ -1004,7 +1004,7 @@ static sqInt genPrimitiveStringAtPut(void);
10041004
static NoDbgRegParms sqInt genRemoveSmallIntegerTagsInScratchReg(sqInt scratchReg);
10051005
static NoDbgRegParms sqInt genShiftAwaySmallIntegerTagsInScratchReg(sqInt scratchReg);
10061006
static NoDbgRegParms sqInt getLiteralCountOfplusOneinBytesintoscratch(sqInt methodReg, sqInt plusOne, sqInt inBytes, sqInt litCountReg, sqInt scratchReg);
1007-
static NoDbgRegParms usqInt inlineCacheTagForInstance(sqInt oop);
1007+
static NoDbgRegParms sqInt inlineCacheTagForInstance(sqInt oop);
10081008
static NoDbgRegParms AbstractInstruction * jumpNotSmallIntegerUnsignedValueInRegister(sqInt reg);
10091009
static NoDbgRegParms sqInt markAndTraceCacheTagLiteralinatpc(sqInt literal, CogMethod *cogMethodOrNil, usqInt address);
10101010
static sqInt numSmallIntegerBits(void);
@@ -8516,7 +8516,7 @@ callCogCodePopReceiverAndClassRegs(void)
85168516
static NoDbgRegParms sqInt
85178517
ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver)
85188518
{
8519-
usqInt cacheTag;
8519+
sqInt cacheTag;
85208520
sqInt errorSelectorOrNil;
85218521
sqInt methodOrSelectorIndex;
85228522
sqInt newTargetMethodOrNil;
@@ -8651,7 +8651,7 @@ ceMalloc(size_t size)
86518651
static NoDbgRegParms sqInt
86528652
ceSICMiss(sqInt receiver)
86538653
{
8654-
usqInt cacheTag;
8654+
sqInt cacheTag;
86558655
sqInt entryPoint;
86568656
sqInt errorSelectorOrNil;
86578657
sqInt extent;
@@ -13882,7 +13882,7 @@ void
1388213882
linkSendAtintooffsetreceiver(sqInt callSiteReturnAddress, CogMethod *sendingMethod, CogMethod *targetMethod, sqInt theEntryOffset, sqInt receiver)
1388313883
{
1388413884
sqInt extent;
13885-
usqInt inlineCacheTag;
13885+
sqInt inlineCacheTag;
1388613886

1388713887
assert((theEntryOffset == cmEntryOffset)
1388813888
|| (theEntryOffset == cmNoCheckEntryOffset));
@@ -22878,7 +22878,7 @@ getLiteralCountOfplusOneinBytesintoscratch(sqInt methodReg, sqInt plusOne, sqInt
2287822878
c.f. getInlineCacheClassTagFrom:into: & inlineCacheTagForClass: */
2287922879

2288022880
/* CogObjectRepresentationFor32BitSpur>>#inlineCacheTagForInstance: */
22881-
static NoDbgRegParms usqInt
22881+
static NoDbgRegParms sqInt
2288222882
inlineCacheTagForInstance(sqInt oop)
2288322883
{
2288422884
return (isImmediate(oop)

src/spur32.cog.lowcode/cogitIA32.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.3546 uuid: c0fdd7da-d7a5-4bce-8e52-40f2876838bc
2+
CCodeGenerator VMMaker.oscog-eem.3547 uuid: 9fdd05e7-6928-4a10-a546-c1b12df6ca8a
33
(Compiler-eem.514)
44
from
5-
StackToRegisterMappingCogit VMMaker.oscog-eem.3546 uuid: c0fdd7da-d7a5-4bce-8e52-40f2876838bc
5+
StackToRegisterMappingCogit VMMaker.oscog-eem.3547 uuid: 9fdd05e7-6928-4a10-a546-c1b12df6ca8a
66
*/
7-
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3546 uuid: c0fdd7da-d7a5-4bce-8e52-40f2876838bc " __DATE__ ;
7+
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3547 uuid: 9fdd05e7-6928-4a10-a546-c1b12df6ca8a " __DATE__ ;
88
char *__cogitBuildInfo = __buildInfo;
99

1010

0 commit comments

Comments
 (0)