Skip to content

Commit

Permalink
CogVM source as per VMMaker.oscog-eem.3390
Browse files Browse the repository at this point in the history
Fix a bad bug in V3 large integer support introduced in VMMaker.oscog-eem.3146.
NewObjectMemory>>eeInstantiateSmallClassIndex:format:numBytes: multiplied the
needed byte size by 4 (!!).
  • Loading branch information
eliotmiranda committed Jun 23, 2024
1 parent 53d94a9 commit 877c45a
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 232 deletions.
2 changes: 1 addition & 1 deletion src/v3.cog/cogit.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3
CCodeGenerator VMMaker.oscog-eem.3390 uuid: abfa63fd-6926-4367-a5f6-646910d4778c
*/


Expand Down
57 changes: 32 additions & 25 deletions src/v3.cog/cogitARMv5.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3
CCodeGenerator VMMaker.oscog-eem.3390 uuid: abfa63fd-6926-4367-a5f6-646910d4778c
from
StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3
StackToRegisterMappingCogit VMMaker.oscog-eem.3390 uuid: abfa63fd-6926-4367-a5f6-646910d4778c
*/
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ;
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3390 uuid: abfa63fd-6926-4367-a5f6-646910d4778c " __DATE__ ;
char *__cogitBuildInfo = __buildInfo;


Expand Down Expand Up @@ -8212,20 +8212,19 @@ ceSICMiss(sqInt receiver)
l1: /* end lookup:for:methodAndErrorSelectorInto: */;
assert(outerReturn == (stackTop()));
cacheTag = inlineCacheTagForInstance(receiver);
if (((errorSelectorOrNil != null)
if ((((errorSelectorOrNil != null)
&& (errorSelectorOrNil != SelectorDoesNotUnderstand))
|| ((inlineCacheTagIsYoung(cacheTag))
|| (((longAt(pcRelativeAddressAt(backEnd, ((usqInt)(outerReturn - 8))))) == 0 /* picAbortDiscriminatorValue */)
|| ((newTargetMethodOrNil == null)
|| (isYoung(newTargetMethodOrNil)))))) {
|| (isYoung(newTargetMethodOrNil)))))
|| ((longAt(pcRelativeAddressAt(backEnd, ((usqInt)(outerReturn - 8))))) == 0 /* picAbortDiscriminatorValue */)) {
result = patchToOpenPICFornumArgsreceiver((targetMethod->selector), (targetMethod->cmNumArgs), receiver);
assert(!result);
return ceSendFromInLineCacheMiss(targetMethod);
}
/* begin ensureWritableCodeZone */
pic = openPICWithSelector((targetMethod->selector));
if ((pic == null)
|| (!1)) {
if ((pic == null)) {

/* otherwise attempt to create a closed PIC for the two cases. */
pic = cogPICSelectornumArgsCase0MethodCase1MethodtagisMNUCase((targetMethod->selector), (targetMethod->cmNumArgs), targetMethod, newTargetMethodOrNil, cacheTag, errorSelectorOrNil == SelectorDoesNotUnderstand);
Expand Down Expand Up @@ -8848,8 +8847,7 @@ cogExtendPICCaseNMethodtagisMNUCase(CogMethod *cPIC, sqInt caseNMethod, sqInt ca
void
cogitPostGCAction(sqInt gcMode)
{
if ((gcMode == GCModeFull)
&& (1)) {
if ((gcMode == GCModeFull)) {
voidYoungReferrersPostTenureAll();
}
assert(allMethodsHaveCorrectHeader());
Expand Down Expand Up @@ -9198,8 +9196,7 @@ collectCogConstituentForAnnotationMcpcBcpcMethod(BytecodeDescriptor *descriptor,
/* Collect any first case classTags for closed PICs. */
cogConstituentIndex += 2;
if (((!(isBackwardBranchAndAnnotation & 1)))
&& (((((usqInt)(isBackwardBranchAndAnnotation)) >> 1) >= IsSendCall)
|| (0))) {
&& (((((usqInt)(isBackwardBranchAndAnnotation)) >> 1) >= IsSendCall))) {
entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
if (entryPoint > methodZoneBase) {

Expand Down Expand Up @@ -11688,8 +11685,7 @@ genTrampolineForcallednumArgsargargargargregsToSavepushLinkRegresultRegappendOpc
static void NoDbgRegParms
genTrampolineReturn(sqInt lnkRegWasPushed)
{
if (lnkRegWasPushed
&& (1)) {
if (lnkRegWasPushed) {
genoperand(PopR, PCReg);
}
else {
Expand Down Expand Up @@ -12549,8 +12545,7 @@ mapObjectReferencesInMachineCodeForFullGC(void)
map -= 1;
}
l2: /* end mapFor:performUntil:arg: */;
if (((cogMethod->cmRefersToYoung))
&& (1)) {
if (((cogMethod->cmRefersToYoung))) {
(writableCogMethod->cmRefersToYoung = 0);
}
}
Expand Down Expand Up @@ -22122,9 +22117,11 @@ compileBlockFrameBuild(BlockStart *blockStart)
AbstractInstruction *abstractInstruction;
AbstractInstruction *anInstruction;
AbstractInstruction *anInstruction1;
AbstractInstruction *anInstruction2;
AbstractInstruction * cascade0;
sqInt constant;
sqInt constant1;
sqInt constant2;
sqInt i;
sqInt ign;

Expand All @@ -22143,7 +22140,18 @@ compileBlockFrameBuild(BlockStart *blockStart)
addDependent(cascade0, annotateAbsolutePCRef(gPushCw(((sqInt)((blockStart->fakeHeader))))));
/* begin setLabelOffset: */
((cascade0->operands))[1] = MFMethodFlagIsBlockFlag;
annotateobjRef(gPushCw(nilObject()), nilObject());
/* begin genPushConstant: */
constant2 = nilObject();
if (shouldAnnotateObjectReference(constant2)) {
annotateobjRef(gPushCw(constant2), constant2);
}
else {
/* begin checkQuickConstant:forInstruction: */
anInstruction = genoperand(PushCq, constant2);
if (usesOutOfLineLiteral(anInstruction)) {
(anInstruction->dependent = locateLiteral(constant2));
}
}
if ((blockStart->hasInstVarRef)) {

/* Use ReceiverResultReg for Context to agree with store check trampoline */
Expand Down Expand Up @@ -22178,9 +22186,9 @@ compileBlockFrameBuild(BlockStart *blockStart)
}
else {
/* begin checkQuickConstant:forInstruction: */
anInstruction = genoperandoperand(MoveCqR, constant, TempReg);
if (usesOutOfLineLiteral(anInstruction)) {
(anInstruction->dependent = locateLiteral(constant));
anInstruction1 = genoperandoperand(MoveCqR, constant, TempReg);
if (usesOutOfLineLiteral(anInstruction1)) {
(anInstruction1->dependent = locateLiteral(constant));
}
}
for (ign = 1; ign <= ((blockStart->numInitialNils)); ign += 1) {
Expand All @@ -22196,9 +22204,9 @@ compileBlockFrameBuild(BlockStart *blockStart)
}
else {
/* begin checkQuickConstant:forInstruction: */
anInstruction1 = genoperand(PushCq, constant1);
if (usesOutOfLineLiteral(anInstruction1)) {
(anInstruction1->dependent = locateLiteral(constant1));
anInstruction2 = genoperand(PushCq, constant1);
if (usesOutOfLineLiteral(anInstruction2)) {
(anInstruction2->dependent = locateLiteral(constant1));
}
}
}
Expand Down Expand Up @@ -23598,8 +23606,7 @@ genMarshalledSendnumArgssendTable(sqInt selectorIndex, sqInt numArgs, sqInt *sen
assert(sendTable == superSendTrampolines);
annotation = IsSuperSend;
l3: /* end annotationForSendTable: */;
if ((annotation == IsSuperSend)
|| (0)) {
if ((annotation == IsSuperSend)) {
/* begin genEnsureOopInRegNotForwarded:scratchReg: */
}
if (numArgs >= (NumSendTrampolines - 1)) {
Expand Down
49 changes: 26 additions & 23 deletions src/v3.cog/cogitIA32.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3
CCodeGenerator VMMaker.oscog-eem.3390 uuid: abfa63fd-6926-4367-a5f6-646910d4778c
from
StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3
StackToRegisterMappingCogit VMMaker.oscog-eem.3390 uuid: abfa63fd-6926-4367-a5f6-646910d4778c
*/
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ;
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3390 uuid: abfa63fd-6926-4367-a5f6-646910d4778c " __DATE__ ;
char *__cogitBuildInfo = __buildInfo;


Expand Down Expand Up @@ -7845,20 +7845,19 @@ ceSICMiss(sqInt receiver)
l1: /* end lookup:for:methodAndErrorSelectorInto: */;
assert(outerReturn == (stackTop()));
cacheTag = inlineCacheTagForInstance(receiver);
if (((errorSelectorOrNil != null)
if ((((errorSelectorOrNil != null)
&& (errorSelectorOrNil != SelectorDoesNotUnderstand))
|| ((inlineCacheTagIsYoung(cacheTag))
|| (((inlineCacheTagAt(backEnd, outerReturn)) == 0 /* picAbortDiscriminatorValue */)
|| ((newTargetMethodOrNil == null)
|| (isYoung(newTargetMethodOrNil)))))) {
|| (isYoung(newTargetMethodOrNil)))))
|| ((inlineCacheTagAt(backEnd, outerReturn)) == 0 /* picAbortDiscriminatorValue */)) {
result = patchToOpenPICFornumArgsreceiver((targetMethod->selector), (targetMethod->cmNumArgs), receiver);
assert(!result);
return ceSendFromInLineCacheMiss(targetMethod);
}
/* begin ensureWritableCodeZone */
pic = openPICWithSelector((targetMethod->selector));
if ((pic == null)
|| (!1)) {
if ((pic == null)) {

/* otherwise attempt to create a closed PIC for the two cases. */
pic = cogPICSelectornumArgsCase0MethodCase1MethodtagisMNUCase((targetMethod->selector), (targetMethod->cmNumArgs), targetMethod, newTargetMethodOrNil, cacheTag, errorSelectorOrNil == SelectorDoesNotUnderstand);
Expand Down Expand Up @@ -8479,8 +8478,7 @@ cogExtendPICCaseNMethodtagisMNUCase(CogMethod *cPIC, sqInt caseNMethod, sqInt ca
void
cogitPostGCAction(sqInt gcMode)
{
if ((gcMode == GCModeFull)
&& (1)) {
if ((gcMode == GCModeFull)) {
voidYoungReferrersPostTenureAll();
}
assert(allMethodsHaveCorrectHeader());
Expand Down Expand Up @@ -8829,8 +8827,7 @@ collectCogConstituentForAnnotationMcpcBcpcMethod(BytecodeDescriptor *descriptor,
/* Collect any first case classTags for closed PICs. */
cogConstituentIndex += 2;
if (((!(isBackwardBranchAndAnnotation & 1)))
&& (((((usqInt)(isBackwardBranchAndAnnotation)) >> 1) >= IsSendCall)
|| (0))) {
&& (((((usqInt)(isBackwardBranchAndAnnotation)) >> 1) >= IsSendCall))) {
entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
if (entryPoint > methodZoneBase) {

Expand Down Expand Up @@ -12028,8 +12025,7 @@ mapObjectReferencesInMachineCodeForFullGC(void)
map -= 1;
}
l2: /* end mapFor:performUntil:arg: */;
if (((cogMethod->cmRefersToYoung))
&& (1)) {
if (((cogMethod->cmRefersToYoung))) {
(writableCogMethod->cmRefersToYoung = 0);
}
}
Expand Down Expand Up @@ -19396,8 +19392,7 @@ genPrimReturnEnterCogCodeEnilopmart(sqInt profiling)
anInstruction16 = genoperandoperand(CmpCqR, 0, TempReg);
/* begin JumpNonZero: */
jmpFail = genConditionalBranchoperand(JumpNonZero, ((sqInt)0));
if (profiling
&& (1)) {
if (profiling) {
/* begin genCheckForProfileTimerTick: */
liveRegisterMask = (0);
flag("endianness");
Expand Down Expand Up @@ -19463,8 +19458,7 @@ genPrimReturnEnterCogCodeEnilopmart(sqInt profiling)
genoperand(PushR, ClassReg);
/* begin RetN: */
genoperand(RetN, BytesPerWord);
if (profiling
&& (1)) {
if (profiling) {

/* Call ceTakeProfileSample: to record sample and then continue. newMethod
should be up-to-date. Need to save and restore the link reg around this call. */
Expand Down Expand Up @@ -20471,9 +20465,11 @@ compileBlockFrameBuild(BlockStart *blockStart)
AbstractInstruction *abstractInstruction;
AbstractInstruction *anInstruction;
AbstractInstruction *anInstruction1;
AbstractInstruction *anInstruction2;
AbstractInstruction * cascade0;
sqInt constant;
sqInt constant1;
sqInt constant2;
sqInt i;
sqInt ign;

Expand All @@ -20490,7 +20486,15 @@ compileBlockFrameBuild(BlockStart *blockStart)
addDependent(cascade0, annotateAbsolutePCRef(checkLiteralforInstruction(((sqInt)((blockStart->fakeHeader))), genoperand(PushCw, ((sqInt)((blockStart->fakeHeader)))))));
/* begin setLabelOffset: */
((cascade0->operands))[1] = MFMethodFlagIsBlockFlag;
annotateobjRef(checkLiteralforInstruction(nilObject(), genoperand(PushCw, nilObject())), nilObject());
/* begin genPushConstant: */
constant2 = nilObject();
if (shouldAnnotateObjectReference(constant2)) {
annotateobjRef(checkLiteralforInstruction(constant2, genoperand(PushCw, constant2)), constant2);
}
else {
/* begin checkQuickConstant:forInstruction: */
anInstruction = genoperand(PushCq, constant2);
}
if ((blockStart->hasInstVarRef)) {

/* Use ReceiverResultReg for Context to agree with store check trampoline */
Expand Down Expand Up @@ -20525,7 +20529,7 @@ compileBlockFrameBuild(BlockStart *blockStart)
}
else {
/* begin checkQuickConstant:forInstruction: */
anInstruction = genoperandoperand(MoveCqR, constant, TempReg);
anInstruction1 = genoperandoperand(MoveCqR, constant, TempReg);
}
for (ign = 1; ign <= ((blockStart->numInitialNils)); ign += 1) {
/* begin PushR: */
Expand All @@ -20540,7 +20544,7 @@ compileBlockFrameBuild(BlockStart *blockStart)
}
else {
/* begin checkQuickConstant:forInstruction: */
anInstruction1 = genoperand(PushCq, constant1);
anInstruction2 = genoperand(PushCq, constant1);
}
}
}
Expand Down Expand Up @@ -21898,8 +21902,7 @@ genMarshalledSendnumArgssendTable(sqInt selectorIndex, sqInt numArgs, sqInt *sen
assert(sendTable == superSendTrampolines);
annotation = IsSuperSend;
l3: /* end annotationForSendTable: */;
if ((annotation == IsSuperSend)
|| (0)) {
if ((annotation == IsSuperSend)) {
/* begin genEnsureOopInRegNotForwarded:scratchReg: */
}
if (numArgs >= (NumSendTrampolines - 1)) {
Expand Down
Loading

0 comments on commit 877c45a

Please sign in to comment.