Skip to content

Commit 2d329f2

Browse files
committed
CogVM source as per VMMaker.oscog-eem.3660
Fix the imbecillic regression in VMMaker.oscog-eem.3637 which should have touched just the return type of stackPointerIndexForFrame:WithSP: but instead broke it for interpreter frames. We now have a working Windows ARMv8 VM!! Refactor checkStackIntegrity so we only need StackInterpreter>>checkStackIntegrity. Simplify cmHomeMethod. No need to test cmIsFullBlock. Eliminate the assert in cogMethodContaining:. Now we use it in click step printing it is used in many more circumstances.
1 parent fe93400 commit 2d329f2

Some content is hidden

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

61 files changed

+5976
-5089
lines changed

src/spur32.cog.lowcode/cogit.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.3658 uuid: fe32aec6-a1d5-4e6a-814c-287d3f6467ab
3-
(Cog-eem.501, Compiler-eem.520)
2+
CCodeGenerator VMMaker.oscog-eem.3660 uuid: e11b031c-e0f4-4561-a732-0fe07bb0183c
3+
(Cog-eem.502, Compiler-eem.520)
44
*/
55

66

src/spur32.cog.lowcode/cogitARMv5.c

Lines changed: 12 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.3658 uuid: fe32aec6-a1d5-4e6a-814c-287d3f6467ab
3-
(Cog-eem.501, Compiler-eem.520)
2+
CCodeGenerator VMMaker.oscog-eem.3660 uuid: e11b031c-e0f4-4561-a732-0fe07bb0183c
3+
(Cog-eem.502, Compiler-eem.520)
44
from
5-
StackToRegisterMappingCogit VMMaker.oscog-eem.3658 uuid: fe32aec6-a1d5-4e6a-814c-287d3f6467ab
5+
StackToRegisterMappingCogit VMMaker.oscog-eem.3660 uuid: e11b031c-e0f4-4561-a732-0fe07bb0183c
66
*/
7-
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3658 uuid: fe32aec6-a1d5-4e6a-814c-287d3f6467ab " __DATE__ ;
7+
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3660 uuid: e11b031c-e0f4-4561-a732-0fe07bb0183c " __DATE__ ;
88
char *__cogitBuildInfo = __buildInfo;
99

1010

@@ -864,7 +864,6 @@ static NoDbgRegParms AbstractInstruction * gSubRRR(sqInt subReg, sqInt fromReg,
864864
static sqInt scanForCleanBlocks(void);
865865
extern void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop);
866866
static NoDbgRegParms sqInt spanForCleanBlockStartingAt(sqInt startPC);
867-
static NoDbgRegParms usqInt stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc);
868867
#if VMInvestigations
869868
static NoDbgRegParms sqInt storeCogMethodDataImportspcpointer(sqInt annotation, char *mcpc, usqInt **importsPtrPtr);
870869
#endif /* VMInvestigations */
@@ -909,7 +908,6 @@ static void followForwardedLiteralsInOpenPICList(void);
909908
static NoDbgRegParms void freeMethod(CogMethod *cogMethod);
910909
static void freeOlderMethodsForCompaction(void);
911910
extern sqInt kosherYoungReferrers(void);
912-
static NoDbgRegParms sqInt mcpcisAtStackCheckOfBlockMethodIn(sqInt mcpc, CogMethod *cogMethod);
913911
extern CogMethod * methodFor(void *address);
914912
#if VMInvestigations
915913
extern sqInt methodsCompiledToMachineCodeInto(sqInt arrayObj);
@@ -1023,7 +1021,7 @@ static sqInt genPrimitiveStringAtPut(void);
10231021
static NoDbgRegParms sqInt genRemoveSmallIntegerTagsInScratchReg(sqInt scratchReg);
10241022
static NoDbgRegParms sqInt genShiftAwaySmallIntegerTagsInScratchReg(sqInt scratchReg);
10251023
static NoDbgRegParms sqInt getLiteralCountOfplusOneinBytesintoscratch(sqInt methodReg, sqInt plusOne, sqInt inBytes, sqInt litCountReg, sqInt scratchReg);
1026-
static NoDbgRegParms sqInt inlineCacheTagForInstance(sqInt oop);
1024+
static NoDbgRegParms usqInt inlineCacheTagForInstance(sqInt oop);
10271025
static NoDbgRegParms AbstractInstruction * jumpNotSmallIntegerUnsignedValueInRegister(sqInt reg);
10281026
static NoDbgRegParms sqInt markAndTraceCacheTagLiteralinatpc(sqInt literal, CogMethod *cogMethodOrNil, usqInt address);
10291027
static sqInt numSmallIntegerBits(void);
@@ -7944,9 +7942,10 @@ zoneCallsAreRelative(AbstractInstruction *self_in_CogARMCompiler)
79447942
static NoDbgRegParms CogMethod *
79457943
cmHomeMethod(CogBlockMethod *self_in_CogBlockMethod)
79467944
{
7947-
return ((self_in_CogBlockMethod->cpicHasMNUCaseOrCMIsFullBlock)
7945+
return (((self_in_CogBlockMethod->cmType)) >= CMMethod
79487946
? ((CogMethod *) self_in_CogBlockMethod)
7949-
: ((CogMethod *) ((((usqInt)self_in_CogBlockMethod)) - ((self_in_CogBlockMethod->homeOffset)))));
7947+
: (assert(CMBlock == (self_in_CogBlockMethod->cmType)),
7948+
((CogMethod *) ((((usqInt)self_in_CogBlockMethod)) - ((self_in_CogBlockMethod->homeOffset))))));
79507949
}
79517950

79527951
/* CogBlockMethod>>#isCMBlock */
@@ -8567,7 +8566,7 @@ callCogCodePopReceiverAndClassRegs(void)
85678566
static NoDbgRegParms sqInt
85688567
ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver)
85698568
{
8570-
sqInt cacheTag;
8569+
usqInt cacheTag;
85718570
int errorSelectorOrNil;
85728571
sqInt methodOrSelectorIndex;
85738572
sqInt newTargetMethodOrNil;
@@ -8702,7 +8701,7 @@ ceMalloc(size_t size)
87028701
static NoDbgRegParms sqInt
87038702
ceSICMiss(sqInt receiver)
87048703
{
8705-
sqInt cacheTag;
8704+
usqInt cacheTag;
87068705
sqInt entryPoint;
87078706
int errorSelectorOrNil;
87088707
sqInt extent;
@@ -14390,7 +14389,7 @@ void
1439014389
linkSendAtintooffsetreceiver(sqInt callSiteReturnAddress, CogMethod *sendingMethod, CogMethod *targetMethod, sqInt theEntryOffset, sqInt receiver)
1439114390
{
1439214391
sqInt extent;
14393-
sqInt inlineCacheTag;
14392+
usqInt inlineCacheTag;
1439414393

1439514394
assert((theEntryOffset == cmEntryOffset)
1439614395
|| (theEntryOffset == cmNoCheckEntryOffset));
@@ -16466,19 +16465,6 @@ spanForCleanBlockStartingAt(sqInt startPC)
1646616465
return 0;
1646716466
}
1646816467

16469-
/* Cogit>>#stackCheckOffsetOfBlockAt:isMcpc: */
16470-
static NoDbgRegParms usqInt
16471-
stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc)
16472-
{
16473-
CogBlockMethod *cogBlockMethod;
16474-
16475-
cogBlockMethod = ((CogBlockMethod *) (blockEntryMcpc - (sizeof(CogBlockMethod))));
16476-
if (((((sqInt)cogBlockMethod)) + ((cogBlockMethod->stackCheckOffset))) == mcpc) {
16477-
return ((usqInt)cogBlockMethod);
16478-
}
16479-
return 0;
16480-
}
16481-
1648216468

1648316469
/* Set up things conveniently for stringForEntryPoint:existingImports:limit: */
1648416470

@@ -17850,16 +17836,6 @@ cogMethodContaining(usqInt mcpc)
1785017836
prevMethod = cogMethod;
1785117837
cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd, (((usqInt)cogMethod)) + ((cogMethod->blockSize)))));
1785217838
}
17853-
17854-
/* Since mcpc is actually instructionPointer we expect that it is either at the stack check
17855-
(normal code zone reclamation invoked through checkForEventsMayContextSwitch:)
17856-
or is in a primitive, immediately following the call of the C primitive routine. */
17857-
assert((prevMethod)
17858-
&& ((mcpc == ((((usqInt)prevMethod)) + ((prevMethod->stackCheckOffset))))
17859-
|| ((mcpcisAtStackCheckOfBlockMethodIn(mcpc, prevMethod))
17860-
|| (((primitiveIndexOfMethodheader((prevMethod->methodObject), (prevMethod->methodHeader))) > 0)
17861-
|| ((isCallPrecedingReturnPC(backEnd, mcpc))
17862-
&& ((callTargetFromReturnAddress(backEnd, mcpc)) == (ceCheckForInterruptTrampoline)))))));
1786317839
return prevMethod;
1786417840
}
1786517841

@@ -18104,19 +18080,6 @@ kosherYoungReferrers(void)
1810418080
return 1;
1810518081
}
1810618082

18107-
18108-
/* For assert checking... */
18109-
18110-
/* CogMethodZone>>#mcpc:isAtStackCheckOfBlockMethodIn: */
18111-
static NoDbgRegParms sqInt
18112-
mcpcisAtStackCheckOfBlockMethodIn(sqInt mcpc, CogMethod *cogMethod)
18113-
{
18114-
if (!((cogMethod->blockEntryOffset))) {
18115-
return 0;
18116-
}
18117-
return (blockDispatchTargetsForperformarg(cogMethod, stackCheckOffsetOfBlockAtisMcpc, mcpc)) != 0;
18118-
}
18119-
1812018083
/* CogMethodZone>>#methodFor: */
1812118084
CogMethod *
1812218085
methodFor(void *address)
@@ -23428,7 +23391,7 @@ getLiteralCountOfplusOneinBytesintoscratch(sqInt methodReg, sqInt plusOne, sqInt
2342823391
c.f. getInlineCacheClassTagFrom:into: & inlineCacheTagForClass: */
2342923392

2343023393
/* CogObjectRepresentationFor32BitSpur>>#inlineCacheTagForInstance: */
23431-
static NoDbgRegParms sqInt
23394+
static NoDbgRegParms usqInt
2343223395
inlineCacheTagForInstance(sqInt oop)
2343323396
{
2343423397
return (isImmediate(oop)

src/spur32.cog.lowcode/cogitIA32.c

Lines changed: 9 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.3658 uuid: fe32aec6-a1d5-4e6a-814c-287d3f6467ab
3-
(Cog-eem.501, Compiler-eem.520)
2+
CCodeGenerator VMMaker.oscog-eem.3660 uuid: e11b031c-e0f4-4561-a732-0fe07bb0183c
3+
(Cog-eem.502, Compiler-eem.520)
44
from
5-
StackToRegisterMappingCogit VMMaker.oscog-eem.3658 uuid: fe32aec6-a1d5-4e6a-814c-287d3f6467ab
5+
StackToRegisterMappingCogit VMMaker.oscog-eem.3660 uuid: e11b031c-e0f4-4561-a732-0fe07bb0183c
66
*/
7-
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3658 uuid: fe32aec6-a1d5-4e6a-814c-287d3f6467ab " __DATE__ ;
7+
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3660 uuid: e11b031c-e0f4-4561-a732-0fe07bb0183c " __DATE__ ;
88
char *__cogitBuildInfo = __buildInfo;
99

1010

@@ -511,7 +511,7 @@ static NoDbgRegParms sqInt callTargetFromReturnAddress(AbstractInstruction *self
511511
static NoDbgRegParms AbstractInstruction * cFloatResultToRd(AbstractInstruction *self_in_CogIA32Compiler, sqInt reg);
512512
static NoDbgRegParms AbstractInstruction * cFloatResultToRs(AbstractInstruction *self_in_CogIA32Compiler, sqInt reg);
513513
static NoDbgRegParms sqInt cmpC32RTempByteSize(AbstractInstruction *self_in_CogIA32Compiler);
514-
static NoDbgRegParms sqInt computeMaximumSize(AbstractInstruction *self_in_CogIA32Compiler);
514+
static NoDbgRegParms int computeMaximumSize(AbstractInstruction *self_in_CogIA32Compiler);
515515
static NoDbgRegParms int computeShiftRRSize(AbstractInstruction *self_in_CogIA32Compiler);
516516
static NoDbgRegParms sqInt concretizeFill32(AbstractInstruction *self_in_CogIA32Compiler);
517517
static NoDbgRegParms sqInt concretizeMovePerfCnt64RRL(AbstractInstruction *self_in_CogIA32Compiler);
@@ -814,7 +814,6 @@ static NoDbgRegParms AbstractInstruction * gSubRRR(sqInt subReg, sqInt fromReg,
814814
static sqInt scanForCleanBlocks(void);
815815
extern void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop);
816816
static NoDbgRegParms sqInt spanForCleanBlockStartingAt(sqInt startPC);
817-
static NoDbgRegParms usqInt stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc);
818817
#if VMInvestigations
819818
static NoDbgRegParms sqInt storeCogMethodDataImportspcpointer(sqInt annotation, char *mcpc, usqInt **importsPtrPtr);
820819
#endif /* VMInvestigations */
@@ -859,7 +858,6 @@ static void followForwardedLiteralsInOpenPICList(void);
859858
static NoDbgRegParms void freeMethod(CogMethod *cogMethod);
860859
static void freeOlderMethodsForCompaction(void);
861860
extern sqInt kosherYoungReferrers(void);
862-
static NoDbgRegParms sqInt mcpcisAtStackCheckOfBlockMethodIn(sqInt mcpc, CogMethod *cogMethod);
863861
extern CogMethod * methodFor(void *address);
864862
#if VMInvestigations
865863
extern sqInt methodsCompiledToMachineCodeInto(sqInt arrayObj);
@@ -3200,9 +3198,10 @@ widthOfPCRelativeLoad(AbstractInstruction *self_in_CogAbstractInstruction, sqInt
32003198
static NoDbgRegParms CogMethod *
32013199
cmHomeMethod(CogBlockMethod *self_in_CogBlockMethod)
32023200
{
3203-
return ((self_in_CogBlockMethod->cpicHasMNUCaseOrCMIsFullBlock)
3201+
return (((self_in_CogBlockMethod->cmType)) >= CMMethod
32043202
? ((CogMethod *) self_in_CogBlockMethod)
3205-
: ((CogMethod *) ((((usqInt)self_in_CogBlockMethod)) - ((self_in_CogBlockMethod->homeOffset)))));
3203+
: (assert(CMBlock == (self_in_CogBlockMethod->cmType)),
3204+
((CogMethod *) ((((usqInt)self_in_CogBlockMethod)) - ((self_in_CogBlockMethod->homeOffset))))));
32063205
}
32073206

32083207
/* CogBlockMethod>>#isCMBlock */
@@ -3333,7 +3332,7 @@ cmpC32RTempByteSize(AbstractInstruction *self_in_CogIA32Compiler)
33333332
limits which are exceeded when each case jumps around the otherwise. */
33343333

33353334
/* CogIA32Compiler>>#computeMaximumSize */
3336-
static NoDbgRegParms sqInt
3335+
static NoDbgRegParms int
33373336
computeMaximumSize(AbstractInstruction *self_in_CogIA32Compiler)
33383337
{
33393338
switch ((self_in_CogIA32Compiler->opcode)) {
@@ -15968,19 +15967,6 @@ spanForCleanBlockStartingAt(sqInt startPC)
1596815967
return 0;
1596915968
}
1597015969

15971-
/* Cogit>>#stackCheckOffsetOfBlockAt:isMcpc: */
15972-
static NoDbgRegParms usqInt
15973-
stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc)
15974-
{
15975-
CogBlockMethod *cogBlockMethod;
15976-
15977-
cogBlockMethod = ((CogBlockMethod *) (blockEntryMcpc - (sizeof(CogBlockMethod))));
15978-
if (((((sqInt)cogBlockMethod)) + ((cogBlockMethod->stackCheckOffset))) == mcpc) {
15979-
return ((usqInt)cogBlockMethod);
15980-
}
15981-
return 0;
15982-
}
15983-
1598415970

1598515971
/* Set up things conveniently for stringForEntryPoint:existingImports:limit: */
1598615972

@@ -17350,16 +17336,6 @@ cogMethodContaining(usqInt mcpc)
1735017336
prevMethod = cogMethod;
1735117337
cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd, (((usqInt)cogMethod)) + ((cogMethod->blockSize)))));
1735217338
}
17353-
17354-
/* Since mcpc is actually instructionPointer we expect that it is either at the stack check
17355-
(normal code zone reclamation invoked through checkForEventsMayContextSwitch:)
17356-
or is in a primitive, immediately following the call of the C primitive routine. */
17357-
assert((prevMethod)
17358-
&& ((mcpc == ((((usqInt)prevMethod)) + ((prevMethod->stackCheckOffset))))
17359-
|| ((mcpcisAtStackCheckOfBlockMethodIn(mcpc, prevMethod))
17360-
|| (((primitiveIndexOfMethodheader((prevMethod->methodObject), (prevMethod->methodHeader))) > 0)
17361-
|| ((isCallPrecedingReturnPC(backEnd, mcpc))
17362-
&& ((callTargetFromReturnAddress(backEnd, mcpc)) == (ceCheckForInterruptTrampoline)))))));
1736317339
return prevMethod;
1736417340
}
1736517341

@@ -17604,19 +17580,6 @@ kosherYoungReferrers(void)
1760417580
return 1;
1760517581
}
1760617582

17607-
17608-
/* For assert checking... */
17609-
17610-
/* CogMethodZone>>#mcpc:isAtStackCheckOfBlockMethodIn: */
17611-
static NoDbgRegParms sqInt
17612-
mcpcisAtStackCheckOfBlockMethodIn(sqInt mcpc, CogMethod *cogMethod)
17613-
{
17614-
if (!((cogMethod->blockEntryOffset))) {
17615-
return 0;
17616-
}
17617-
return (blockDispatchTargetsForperformarg(cogMethod, stackCheckOffsetOfBlockAtisMcpc, mcpc)) != 0;
17618-
}
17619-
1762017583
/* CogMethodZone>>#methodFor: */
1762117584
CogMethod *
1762217585
methodFor(void *address)

0 commit comments

Comments
 (0)