Skip to content

Commit

Permalink
CogVM source as per VMMaker.oscog-eem.3101
Browse files Browse the repository at this point in the history
Interpreter/Simulator:
Revise and refactor frame printing to allow the simulators to prefix frame
addresses with an indication of the various frame/stack pointers (variables,
processor registers).  Extract the printing of the frame address to
printFrameAddress: there-by eliminating quite a few simulator-specific versions
of the frame field printers.

Use %p to print pointers, using extensions to the Printf package, '%P' to print
with the 16r prefix, and '%WP' to print with 16r prefix in a width dependent on
the word size.

Realise that %Ns prints a left-padded string in a width of N characters to
eliminbate the torturous %.*s%s forms using spaces.

Since %p always requires a pointer, cast the arguments to pringHex: et al to
void pointers, and hence get rid of printHexPtr:.

Fix a slip in ObjectMemory>>#printNonPointerDataOf:on:.

Interpreter printing: must use %s to print object strings since they may
contain %'s.

Spur Slang: fix a bug in computing accessor depth chains.  If a primitive
contains different assignments to the same variable (e.g. a primitive which has
different forms for var args such as PSharePlugin>>primitivePostKeyboardEvent
as of 10/26/2021) then the simple test would consider an assignment to the
same variable as an extension of the chain.
  • Loading branch information
eliotmiranda committed Nov 15, 2021
1 parent 2bba565 commit 79e88e6
Show file tree
Hide file tree
Showing 69 changed files with 14,879 additions and 21,817 deletions.
12 changes: 6 additions & 6 deletions src/plugins/B2DPlugin/B2DPlugin.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Automatically generated by
VMPluginCodeGenerator VMMaker.oscog-eem.3090 uuid: 3e2b8343-01bb-4169-ba4c-aecf82b4dcfc
VMPluginCodeGenerator VMMaker.oscog-eem.3101 uuid: 343b46dc-8e9f-48c8-bb97-74b76f1d07cc
from
BalloonEnginePlugin VMMaker.oscog-eem.3090 uuid: 3e2b8343-01bb-4169-ba4c-aecf82b4dcfc
BalloonEnginePlugin VMMaker.oscog-eem.3101 uuid: 343b46dc-8e9f-48c8-bb97-74b76f1d07cc
*/
static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.3090 uuid: 3e2b8343-01bb-4169-ba4c-aecf82b4dcfc " __DATE__ ;
static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.3101 uuid: 343b46dc-8e9f-48c8-bb97-74b76f1d07cc " __DATE__ ;


#include "config.h"
Expand Down Expand Up @@ -840,7 +840,7 @@ extern
#endif
struct VirtualMachine* interpreterProxy;
static void * loadBBFn;
static const char *moduleName = "B2DPlugin VMMaker.oscog-eem.3090 " INT_EXT;
static const char *moduleName = "B2DPlugin VMMaker.oscog-eem.3101 " INT_EXT;
static int* objBuffer;
static sqInt objUsed;
static unsigned int* spanBuffer;
Expand Down Expand Up @@ -15140,7 +15140,7 @@ void* B2DPlugin_exports[][3] = {
{(void*)_m, "primitiveAddBezier\000\002\003", (void*)primitiveAddBezier},
{(void*)_m, "primitiveAddBezierShape\000\002\003", (void*)primitiveAddBezierShape},
{(void*)_m, "primitiveAddBitmapFill\000\002\003", (void*)primitiveAddBitmapFill},
{(void*)_m, "primitiveAddCompressedShape\000\003\003", (void*)primitiveAddCompressedShape},
{(void*)_m, "primitiveAddCompressedShape\000\002\003", (void*)primitiveAddCompressedShape},
{(void*)_m, "primitiveAddGradientFill\000\002\003", (void*)primitiveAddGradientFill},
{(void*)_m, "primitiveAddLine\000\002\003", (void*)primitiveAddLine},
{(void*)_m, "primitiveAddOval\000\002\003", (void*)primitiveAddOval},
Expand Down Expand Up @@ -15190,7 +15190,7 @@ EXPORT(signed short) primitiveAddActiveEdgeEntryMetadata = 515;
EXPORT(signed short) primitiveAddBezierMetadata = 515;
EXPORT(signed short) primitiveAddBezierShapeMetadata = 515;
EXPORT(signed short) primitiveAddBitmapFillMetadata = 515;
EXPORT(signed short) primitiveAddCompressedShapeMetadata = 771;
EXPORT(signed short) primitiveAddCompressedShapeMetadata = 515;
EXPORT(signed short) primitiveAddGradientFillMetadata = 515;
EXPORT(signed short) primitiveAddLineMetadata = 515;
EXPORT(signed short) primitiveAddOvalMetadata = 515;
Expand Down
28 changes: 9 additions & 19 deletions src/plugins/BitBltPlugin/BitBltPlugin.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Automatically generated by
SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3090 uuid: 3e2b8343-01bb-4169-ba4c-aecf82b4dcfc
SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3101 uuid: 343b46dc-8e9f-48c8-bb97-74b76f1d07cc
from
BitBltSimulation VMMaker.oscog-eem.3090 uuid: 3e2b8343-01bb-4169-ba4c-aecf82b4dcfc
BitBltSimulation VMMaker.oscog-eem.3101 uuid: 343b46dc-8e9f-48c8-bb97-74b76f1d07cc
*/
static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.3090 uuid: 3e2b8343-01bb-4169-ba4c-aecf82b4dcfc " __DATE__ ;
static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.3101 uuid: 343b46dc-8e9f-48c8-bb97-74b76f1d07cc " __DATE__ ;


#include "config.h"
Expand Down Expand Up @@ -361,7 +361,7 @@ static int maskTable[33] = {
0, 1, 3, 0, 15, 31, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 65535,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1
};
static const char *moduleName = "BitBltPlugin VMMaker.oscog-eem.3090 " INT_EXT;
static const char *moduleName = "BitBltPlugin VMMaker.oscog-eem.3101 " INT_EXT;
static sqInt noHalftone;
static sqInt noSource;
static sqInt numGCsOnInvocation;
Expand Down Expand Up @@ -4235,10 +4235,6 @@ OLDtallyIntoMapwith(sqInt sourceWord, sqInt destinationWord)
sqInt srcPix;
sqInt srcPix1;
sqInt srcPix2;
sqInt value;
sqInt value1;
sqInt value2;
sqInt value3;

if (!((cmFlags & (ColorMapPresent | ColorMapIndexedPart)) == (ColorMapPresent | ColorMapIndexedPart))) {
return destinationWord;
Expand All @@ -4251,8 +4247,7 @@ OLDtallyIntoMapwith(sqInt sourceWord, sqInt destinationWord)
for (i = 1; i <= destPPW; i += 1) {
mapIndex = shiftWord & pixMask;
/* begin tallyMapAt:put: */
value = (cmLookupTable[mapIndex & cmMask]) + 1;
cmLookupTable[mapIndex & cmMask] = value;
cmLookupTable[mapIndex & cmMask] = ((cmLookupTable[mapIndex & cmMask]) + 1);
shiftWord = ((usqInt)(shiftWord)) >> destDepth;
}
return destinationWord;
Expand Down Expand Up @@ -4318,8 +4313,7 @@ OLDtallyIntoMapwith(sqInt sourceWord, sqInt destinationWord)
}
l2: /* end rgbMap:from:to: */;
/* begin tallyMapAt:put: */
value1 = (cmLookupTable[mapIndex & cmMask]) + 1;
cmLookupTable[mapIndex & cmMask] = value1;
cmLookupTable[mapIndex & cmMask] = ((cmLookupTable[mapIndex & cmMask]) + 1);
/* begin rgbMap:from:to: */
if (((d1 = cmBitsPerColor - 5)) > 0) {

Expand Down Expand Up @@ -4378,8 +4372,7 @@ OLDtallyIntoMapwith(sqInt sourceWord, sqInt destinationWord)
}
l4: /* end rgbMap:from:to: */;
/* begin tallyMapAt:put: */
value2 = (cmLookupTable[mapIndex & cmMask]) + 1;
cmLookupTable[mapIndex & cmMask] = value2;
cmLookupTable[mapIndex & cmMask] = ((cmLookupTable[mapIndex & cmMask]) + 1);
}
else {

Expand Down Expand Up @@ -4442,8 +4435,7 @@ OLDtallyIntoMapwith(sqInt sourceWord, sqInt destinationWord)
}
l6: /* end rgbMap:from:to: */;
/* begin tallyMapAt:put: */
value3 = (cmLookupTable[mapIndex & cmMask]) + 1;
cmLookupTable[mapIndex & cmMask] = value3;
cmLookupTable[mapIndex & cmMask] = ((cmLookupTable[mapIndex & cmMask]) + 1);
}
return destinationWord;
}
Expand Down Expand Up @@ -7007,7 +6999,6 @@ tallyIntoMapwith(unsigned int sourceWord, unsigned int destinationWord)
unsigned int pixVal;
sqInt srcPix;
sqInt srcPix1;
sqInt value;

if (!((cmFlags & (ColorMapPresent | ColorMapIndexedPart)) == (ColorMapPresent | ColorMapIndexedPart))) {
return destinationWord;
Expand Down Expand Up @@ -7144,8 +7135,7 @@ tallyIntoMapwith(unsigned int sourceWord, unsigned int destinationWord)
}
}
/* begin tallyMapAt:put: */
value = (cmLookupTable[mapIndex & cmMask]) + 1;
cmLookupTable[mapIndex & cmMask] = value;
cmLookupTable[mapIndex & cmMask] = ((cmLookupTable[mapIndex & cmMask]) + 1);
}
maskShifted = ((usqInt)(maskShifted)) >> destDepth;
destShifted = ((usqInt)(destShifted)) >> destDepth;
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/CameraPlugin/CameraPlugin.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Automatically generated by
VMPluginCodeGenerator VMMaker.oscog-eem.3090 uuid: 3e2b8343-01bb-4169-ba4c-aecf82b4dcfc
VMPluginCodeGenerator VMMaker.oscog-eem.3101 uuid: 343b46dc-8e9f-48c8-bb97-74b76f1d07cc
from
CameraPlugin VMMaker.oscog-eem.3090 uuid: 3e2b8343-01bb-4169-ba4c-aecf82b4dcfc
CameraPlugin VMMaker.oscog-eem.3101 uuid: 343b46dc-8e9f-48c8-bb97-74b76f1d07cc
*/
static char __buildInfo[] = "CameraPlugin VMMaker.oscog-eem.3090 uuid: 3e2b8343-01bb-4169-ba4c-aecf82b4dcfc " __DATE__ ;
static char __buildInfo[] = "CameraPlugin VMMaker.oscog-eem.3101 uuid: 343b46dc-8e9f-48c8-bb97-74b76f1d07cc " __DATE__ ;


#include "config.h"
Expand Down Expand Up @@ -112,7 +112,7 @@ extern sqInt success(sqInt aBoolean);
extern
#endif
struct VirtualMachine* interpreterProxy;
static const char *moduleName = "CameraPlugin VMMaker.oscog-eem.3090 " INT_EXT;
static const char *moduleName = "CameraPlugin VMMaker.oscog-eem.3101 " INT_EXT;



Expand Down Expand Up @@ -496,7 +496,7 @@ void* CameraPlugin_exports[][3] = {
{(void*)_m, "primGetFrame\000\001\000", (void*)primGetFrame},
{(void*)_m, "primGetParam\000\000\000", (void*)primGetParam},
{(void*)_m, "primOpenCamera\000\000\000", (void*)primOpenCamera},
{(void*)_m, "primSetCameraBuffers\000\001\000", (void*)primSetCameraBuffers},
{(void*)_m, "primSetCameraBuffers\000\000\000", (void*)primSetCameraBuffers},
{(void*)_m, "primSetCameraSemaphore\000\000\000", (void*)primSetCameraSemaphore},
{(void*)_m, "setInterpreter", (void*)setInterpreter},
{(void*)_m, "shutdownModule", (void*)shutdownModule},
Expand All @@ -515,7 +515,7 @@ EXPORT(signed short) primGetCameraSemaphoreMetadata = 0;
EXPORT(signed short) primGetFrameMetadata = 0x100;
EXPORT(signed short) primGetParamMetadata = 0;
EXPORT(signed short) primOpenCameraMetadata = 0;
EXPORT(signed short) primSetCameraBuffersMetadata = 0x100;
EXPORT(signed short) primSetCameraBuffersMetadata = 0;
EXPORT(signed short) primSetCameraSemaphoreMetadata = 0;
#endif // SPURVM

Expand Down
16 changes: 6 additions & 10 deletions src/plugins/LargeIntegers/LargeIntegers.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Automatically generated by
SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3090 uuid: 3e2b8343-01bb-4169-ba4c-aecf82b4dcfc
SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3101 uuid: 343b46dc-8e9f-48c8-bb97-74b76f1d07cc
from
LargeIntegersPlugin VMMaker.oscog-eem.3090 uuid: 3e2b8343-01bb-4169-ba4c-aecf82b4dcfc
LargeIntegersPlugin VMMaker.oscog-eem.3101 uuid: 343b46dc-8e9f-48c8-bb97-74b76f1d07cc
*/
static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.3090 uuid: 3e2b8343-01bb-4169-ba4c-aecf82b4dcfc " __DATE__ ;
static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.3101 uuid: 343b46dc-8e9f-48c8-bb97-74b76f1d07cc " __DATE__ ;


#include "config.h"
Expand Down Expand Up @@ -197,7 +197,7 @@ extern sqInt trueObject(void);
extern
#endif
struct VirtualMachine* interpreterProxy;
static const char *moduleName = "LargeIntegers v2.0 VMMaker.oscog-eem.3090 " INT_EXT;
static const char *moduleName = "LargeIntegers v2.0 VMMaker.oscog-eem.3101 " INT_EXT;
static const int andOpIndex = 0;
static const int orOpIndex = 1;
static const int xorOpIndex = 2;
Expand All @@ -220,7 +220,6 @@ anyBitOfLargeIntfromto(sqInt anOop, sqInt start, sqInt stopArg)
unsigned int lastMask;
sqInt magnitude;
sqInt stop;
sqInt zeroBasedDigitIndex;

magnitude = anOop;
stop = ((stopArg < (cDigitHighBitlen(((unsigned int *) (firstIndexableField(magnitude))), ((byteSizeOf(magnitude)) + 3) / 4))) ? stopArg : (cDigitHighBitlen(((unsigned int *) (firstIndexableField(magnitude))), ((byteSizeOf(magnitude)) + 3) / 4)));
Expand All @@ -234,8 +233,7 @@ anyBitOfLargeIntfromto(sqInt anOop, sqInt start, sqInt stopArg)
if (firstDigitIx == lastDigitIx) {
/* begin cDigitOf:at: */
cPointer = ((unsigned int *) (firstIndexableField(magnitude)));
zeroBasedDigitIndex = firstDigitIx - 1;
digit = SQ_SWAP_4_BYTES_IF_BIGENDIAN((cPointer[zeroBasedDigitIndex]));
digit = SQ_SWAP_4_BYTES_IF_BIGENDIAN((cPointer[firstDigitIx - 1]));
return (digit & (firstMask & lastMask)) != 0;
}
if (((cDigitOfat(((unsigned int *) (firstIndexableField(magnitude))), firstDigitIx - 1)) & firstMask) != 0) {
Expand Down Expand Up @@ -2319,7 +2317,6 @@ primAnyBitFromTo(void)
sqInt to;
sqInt val;
sqInt _return_value;
sqInt zeroBasedDigitIndex;

if (!((isIntegerObject((from = stackValue(1))))
&& (isIntegerObject((to = stackValue(0)))))) {
Expand Down Expand Up @@ -2366,8 +2363,7 @@ primAnyBitFromTo(void)
if (firstDigitIx == lastDigitIx) {
/* begin cDigitOf:at: */
cPointer = ((unsigned int *) (firstIndexableField(magnitude)));
zeroBasedDigitIndex = firstDigitIx - 1;
digit = SQ_SWAP_4_BYTES_IF_BIGENDIAN((cPointer[zeroBasedDigitIndex]));
digit = SQ_SWAP_4_BYTES_IF_BIGENDIAN((cPointer[firstDigitIx - 1]));
someBitIsSet = (digit & (firstMask & lastMask)) != 0;
goto l2;
}
Expand Down
Loading

0 comments on commit 79e88e6

Please sign in to comment.