Skip to content

Commit

Permalink
CogVM source as per VMMaker.oscog-nice.1933
Browse files Browse the repository at this point in the history
Fix incorrect type inferencing for asUnsignedLongLong which causes a bug in the
v3 format VM in fetchLong64:ofObject:.  This breaks large integer arithmetic.

In this case, type inferencing is used for correct unsigned casting before
left shifting.

TODO: verify that all selectors translated via initializeCTranslationDictionary
have correct type inferencing in returnTypeForSend:in:ifNil:

Sista:
The jumpIfNotInstanceOfOrPop bytecode was interesting but hard to tackle in many
places, leading to hard to write assertion in the JIT.

It has been changed so that it now always consumes the top of the stack,
jumping if the top of the stack is not an instance of one of the class
specified in the literal.

This way that bytecode can also be used easily to optimize PICs.

Fixed machine code generation of UByteNumBytes
  • Loading branch information
eliotmiranda committed Sep 5, 2016
1 parent f39cb11 commit 456992c
Show file tree
Hide file tree
Showing 51 changed files with 452 additions and 450 deletions.
2 changes: 1 addition & 1 deletion nsspur64src/vm/cogit.h
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034
CCodeGenerator VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845
*/


Expand Down
6 changes: 3 additions & 3 deletions nsspur64src/vm/cogitX64.c
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034
CCodeGenerator VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845
from
StackToRegisterMappingCogit VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034
StackToRegisterMappingCogit VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845
*/
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034 " __DATE__ ;
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845 " __DATE__ ;
char *__cogitBuildInfo = __buildInfo;


Expand Down
28 changes: 14 additions & 14 deletions nsspur64src/vm/cointerp.c
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034
CCodeGeneratorGlobalStructure VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845
from
CoInterpreter VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034
CoInterpreter VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845
*/
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034 " __DATE__ ;
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;


Expand Down Expand Up @@ -2459,7 +2459,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */]
};
sqInt checkedPluginName;
char expensiveAsserts = 0;
const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1930";
const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-nice.1933";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
volatile int sendTrace;

Expand Down Expand Up @@ -21449,7 +21449,7 @@ printFrameWithSP(char *theFP, char *theSP)
usqInt index;
sqInt methodField;
usqInt numArgs;
usqInt numTemps;
sqInt numTemps;
char *rcvrAddress;
sqInt rcvrOrClosure;
sqInt theMethod;
Expand Down Expand Up @@ -32448,7 +32448,7 @@ primitiveImmediateAsInteger(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt oop;
char *sp;
usqInt value;
sqInt value;

value = 0;
oop = longAt(GIV(stackPointer));
Expand Down Expand Up @@ -40458,7 +40458,7 @@ changeClassOfto(sqInt rcvr, sqInt argClass)
sqInt fmt;
usqInt instBytes;
sqInt instFormat;
usqInt newFormat;
sqInt newFormat;
sqInt normalizedInstFormat;
usqInt numBytes;
usqInt numSlots;
Expand Down Expand Up @@ -40627,7 +40627,7 @@ changeClassOfto(sqInt rcvr, sqInt argClass)
/* begin set:classIndexTo:formatTo: */
assert(((classIndex >= 0) && (classIndex <= (classIndexMask()))));
assert(((newFormat >= 0) && (newFormat <= (formatMask()))));
longAtput(rcvr, ((longAt(rcvr)) & (~((((sqInt)((usqInt)((formatMask())) << (formatShift())))) + (classIndexMask())))) + (classIndex + (newFormat << (formatShift()))));
longAtput(rcvr, ((longAt(rcvr)) & (~((((sqInt)((usqInt)((formatMask())) << (formatShift())))) + (classIndexMask())))) + (classIndex + (((sqInt)((usqInt)(newFormat) << (formatShift()))))));
return 0;
}

Expand Down Expand Up @@ -42449,7 +42449,7 @@ scavengeFutureSurvivorSpaceStartingAt(sqInt initialAddress)
usqInt numSlots1;
usqInt numSlots2;
sqInt obj;
usqInt ptr;
sqInt ptr;
usqInt slotBytes;

ptr = initialAddress;
Expand Down Expand Up @@ -47629,7 +47629,7 @@ eliminateAndFreeForwardersForPigCompact(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt address;
sqInt address1;
usqInt bytes;
sqInt bytes;
sqInt endOfFreeRun;
sqInt f;
sqInt firstOfFreeRun;
Expand Down Expand Up @@ -53812,7 +53812,7 @@ maybeSplObj(sqInt index)
static sqInt NoDbgRegParms
moveARunOfObjectsStartingAtupTo(usqInt startAddress, usqInt limit)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
usqInt chunkBytes;
sqInt chunkBytes;
sqInt classIndex;
sqInt classIndex1;
sqInt dest;
Expand Down Expand Up @@ -60244,8 +60244,8 @@ writeSegmentnextSegmenttoFile(SpurSegmentInfo *segment, SpurSegmentInfo *nextSeg
{
usqLong firstSavedBridgeWord;
sqInt nWritten;
sqInt pier1;
sqInt pier2;
usqInt pier1;
usqInt pier2;
usqLong secondSavedBridgeWord;

pier1 = (((segment->segSize)) + ((segment->segStart))) - (2 * BaseHeaderSize);
Expand Down Expand Up @@ -70967,7 +70967,7 @@ removeFirstLinkOfList(sqInt aList)
static sqInt
retryPrimitiveOnFailure(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
signed char accessorDepth;
sqInt accessorDepth;
sqInt canRetry;
sqInt firstBytecode;
sqInt followDone;
Expand Down
2 changes: 1 addition & 1 deletion nsspur64src/vm/cointerp.h
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034
CCodeGeneratorGlobalStructure VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845
*/


Expand Down
28 changes: 14 additions & 14 deletions nsspur64src/vm/gcc3x-cointerp.c
Expand Up @@ -2,11 +2,11 @@


/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034
CCodeGeneratorGlobalStructure VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845
from
CoInterpreter VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034
CoInterpreter VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845
*/
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034 " __DATE__ ;
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;


Expand Down Expand Up @@ -2462,7 +2462,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */]
};
sqInt checkedPluginName;
char expensiveAsserts = 0;
const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1930";
const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-nice.1933";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
volatile int sendTrace;

Expand Down Expand Up @@ -21458,7 +21458,7 @@ printFrameWithSP(char *theFP, char *theSP)
usqInt index;
sqInt methodField;
usqInt numArgs;
usqInt numTemps;
sqInt numTemps;
char *rcvrAddress;
sqInt rcvrOrClosure;
sqInt theMethod;
Expand Down Expand Up @@ -32457,7 +32457,7 @@ primitiveImmediateAsInteger(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt oop;
char *sp;
usqInt value;
sqInt value;

value = 0;
oop = longAt(GIV(stackPointer));
Expand Down Expand Up @@ -40467,7 +40467,7 @@ changeClassOfto(sqInt rcvr, sqInt argClass)
sqInt fmt;
usqInt instBytes;
sqInt instFormat;
usqInt newFormat;
sqInt newFormat;
sqInt normalizedInstFormat;
usqInt numBytes;
usqInt numSlots;
Expand Down Expand Up @@ -40636,7 +40636,7 @@ changeClassOfto(sqInt rcvr, sqInt argClass)
/* begin set:classIndexTo:formatTo: */
assert(((classIndex >= 0) && (classIndex <= (classIndexMask()))));
assert(((newFormat >= 0) && (newFormat <= (formatMask()))));
longAtput(rcvr, ((longAt(rcvr)) & (~((((sqInt)((usqInt)((formatMask())) << (formatShift())))) + (classIndexMask())))) + (classIndex + (newFormat << (formatShift()))));
longAtput(rcvr, ((longAt(rcvr)) & (~((((sqInt)((usqInt)((formatMask())) << (formatShift())))) + (classIndexMask())))) + (classIndex + (((sqInt)((usqInt)(newFormat) << (formatShift()))))));
return 0;
}

Expand Down Expand Up @@ -42458,7 +42458,7 @@ scavengeFutureSurvivorSpaceStartingAt(sqInt initialAddress)
usqInt numSlots1;
usqInt numSlots2;
sqInt obj;
usqInt ptr;
sqInt ptr;
usqInt slotBytes;

ptr = initialAddress;
Expand Down Expand Up @@ -47638,7 +47638,7 @@ eliminateAndFreeForwardersForPigCompact(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt address;
sqInt address1;
usqInt bytes;
sqInt bytes;
sqInt endOfFreeRun;
sqInt f;
sqInt firstOfFreeRun;
Expand Down Expand Up @@ -53821,7 +53821,7 @@ maybeSplObj(sqInt index)
static sqInt NoDbgRegParms
moveARunOfObjectsStartingAtupTo(usqInt startAddress, usqInt limit)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
usqInt chunkBytes;
sqInt chunkBytes;
sqInt classIndex;
sqInt classIndex1;
sqInt dest;
Expand Down Expand Up @@ -60253,8 +60253,8 @@ writeSegmentnextSegmenttoFile(SpurSegmentInfo *segment, SpurSegmentInfo *nextSeg
{
usqLong firstSavedBridgeWord;
sqInt nWritten;
sqInt pier1;
sqInt pier2;
usqInt pier1;
usqInt pier2;
usqLong secondSavedBridgeWord;

pier1 = (((segment->segSize)) + ((segment->segStart))) - (2 * BaseHeaderSize);
Expand Down Expand Up @@ -70976,7 +70976,7 @@ removeFirstLinkOfList(sqInt aList)
static sqInt
retryPrimitiveOnFailure(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
signed char accessorDepth;
sqInt accessorDepth;
sqInt canRetry;
sqInt firstBytecode;
sqInt followDone;
Expand Down
2 changes: 1 addition & 1 deletion nsspursrc/vm/cogit.h
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034
CCodeGenerator VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845
*/


Expand Down
10 changes: 5 additions & 5 deletions nsspursrc/vm/cogitARMv5.c
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034
CCodeGenerator VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845
from
StackToRegisterMappingCogit VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034
StackToRegisterMappingCogit VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845
*/
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034 " __DATE__ ;
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845 " __DATE__ ;
char *__cogitBuildInfo = __buildInfo;


Expand Down Expand Up @@ -711,7 +711,7 @@ static AbstractInstruction * NoDbgRegParms gMoveCwR(sqInt wordConstant, sqInt re
static AbstractInstruction * NoDbgRegParms gMoveMwrR(sqInt offset, sqInt baseReg, sqInt destReg);
static AbstractInstruction * NoDbgRegParms gMoveRMwr(sqInt sourceReg, sqInt offset, sqInt baseReg);
static AbstractInstruction * NoDbgRegParms gMoveRR(sqInt reg1, sqInt reg2);
static usqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod);
static sqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod);
static sqInt NoDbgRegParms mapForperformUntilarg(CogMethod *cogMethod, sqInt (*functionSymbol)(sqInt annotation, char *mcpc, sqInt arg), sqInt arg);
static sqInt NoDbgRegParms mapObjectReferencesInClosedPIC(CogMethod *cPIC);
static void mapObjectReferencesInGeneratedRuntime(void);
Expand Down Expand Up @@ -12129,7 +12129,7 @@ gMoveRR(sqInt reg1, sqInt reg2)
/* Answer the address of the null byte at the end of the method map. */

/* Cogit>>#mapEndFor: */
static usqInt NoDbgRegParms
static sqInt NoDbgRegParms
mapEndFor(CogMethod *cogMethod)
{
usqInt end;
Expand Down
10 changes: 5 additions & 5 deletions nsspursrc/vm/cogitIA32.c
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034
CCodeGenerator VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845
from
StackToRegisterMappingCogit VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034
StackToRegisterMappingCogit VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845
*/
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1930 uuid: e01f4bfc-2f0a-40e1-9491-d744cde15034 " __DATE__ ;
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-nice.1933 uuid: 18f1dc32-84e8-43aa-baba-937ea911b845 " __DATE__ ;
char *__cogitBuildInfo = __buildInfo;


Expand Down Expand Up @@ -656,7 +656,7 @@ static AbstractInstruction * NoDbgRegParms gMoveCwR(sqInt wordConstant, sqInt re
static AbstractInstruction * NoDbgRegParms gMoveMwrR(sqInt offset, sqInt baseReg, sqInt destReg);
static AbstractInstruction * NoDbgRegParms gMoveRMwr(sqInt sourceReg, sqInt offset, sqInt baseReg);
static AbstractInstruction * NoDbgRegParms gMoveRR(sqInt reg1, sqInt reg2);
static usqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod);
static sqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod);
static sqInt NoDbgRegParms mapForperformUntilarg(CogMethod *cogMethod, sqInt (*functionSymbol)(sqInt annotation, char *mcpc, sqInt arg), sqInt arg);
static sqInt NoDbgRegParms mapObjectReferencesInClosedPIC(CogMethod *cPIC);
static void mapObjectReferencesInGeneratedRuntime(void);
Expand Down Expand Up @@ -11085,7 +11085,7 @@ gMoveRR(sqInt reg1, sqInt reg2)
/* Answer the address of the null byte at the end of the method map. */

/* Cogit>>#mapEndFor: */
static usqInt NoDbgRegParms
static sqInt NoDbgRegParms
mapEndFor(CogMethod *cogMethod)
{
usqInt end;
Expand Down

0 comments on commit 456992c

Please sign in to comment.