Skip to content

Commit 268e45d

Browse files
committed
CogVm source as per VMMaker.oscog-eem.2836
Cogit: Fix an occasional initialization crash due to address space randomization. Don't enforce the range check in rewriteCallAt:target: et al until the Cogit is initializaed hence avoiding crashes during expectedClosedPICPrototype:'s validation. Eliminate the <windows.h> warning by making them all <Windows.h>. CameraPlugin: implement the interrupt-driven interface on Windows.
1 parent 87afa4d commit 268e45d

File tree

109 files changed

+1883
-1399
lines changed

Some content is hidden

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

109 files changed

+1883
-1399
lines changed

nsspur64src/vm/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.2831 uuid: f4fed277-6b62-4e79-9147-c5405589f2b1
2+
CCodeGenerator VMMaker.oscog-eem.2836 uuid: 9203f225-3af0-4c06-b652-99c13e86694a
33
*/
44

55

nsspur64src/vm/cogitARMv8.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.2824 uuid: 8f091e5b-fc0f-4b4b-ab5e-e90e598f75ee
2+
CCodeGenerator VMMaker.oscog-eem.2836 uuid: 9203f225-3af0-4c06-b652-99c13e86694a
33
from
4-
StackToRegisterMappingCogit VMMaker.oscog-eem.2824 uuid: 8f091e5b-fc0f-4b4b-ab5e-e90e598f75ee
5-
CogARMv8Compiler ClosedVMMaker-eem.99 uuid: ff091b56-b1c9-411d-8e2d-1e9767d408ee
4+
StackToRegisterMappingCogit VMMaker.oscog-eem.2836 uuid: 9203f225-3af0-4c06-b652-99c13e86694a
5+
CogARMv8Compiler * ClosedVMMaker-eem.99 uuid: ff091b56-b1c9-411d-8e2d-1e9767d408ee
66
*/
7-
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2824 uuid: 8f091e5b-fc0f-4b4b-ab5e-e90e598f75ee\n\
8-
CogARMv8Compiler ClosedVMMaker-eem.99 uuid: ff091b56-b1c9-411d-8e2d-1e9767d408ee " __DATE__ ;
7+
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2836 uuid: 9203f225-3af0-4c06-b652-99c13e86694a\n\
8+
CogARMv8Compiler * ClosedVMMaker-eem.99 uuid: ff091b56-b1c9-411d-8e2d-1e9767d408ee " __DATE__ ;
99
char *__cogitBuildInfo = __buildInfo;
1010

1111

@@ -6891,7 +6891,8 @@ rewriteInlineCacheAttagtarget(AbstractInstruction * self_in_rewriteInlineCacheAt
68916891
sqInt call;
68926892
usqInt callDistance;
68936893

6894-
if (!(callTargetAddress >= (minCallAddress()))) {
6894+
if (openPICSize
6895+
&& (callTargetAddress < (minCallAddress()))) {
68956896
error("linking callsite to invalid address");
68966897
}
68976898

nsspur64src/vm/cogitX64SysV.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.2824 uuid: 8f091e5b-fc0f-4b4b-ab5e-e90e598f75ee
2+
CCodeGenerator VMMaker.oscog-eem.2836 uuid: 9203f225-3af0-4c06-b652-99c13e86694a
33
from
4-
StackToRegisterMappingCogit VMMaker.oscog-eem.2824 uuid: 8f091e5b-fc0f-4b4b-ab5e-e90e598f75ee
4+
StackToRegisterMappingCogit VMMaker.oscog-eem.2836 uuid: 9203f225-3af0-4c06-b652-99c13e86694a
55
*/
6-
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2824 uuid: 8f091e5b-fc0f-4b4b-ab5e-e90e598f75ee " __DATE__ ;
6+
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2836 uuid: 9203f225-3af0-4c06-b652-99c13e86694a " __DATE__ ;
77
char *__cogitBuildInfo = __buildInfo;
88

99

@@ -25132,7 +25132,8 @@ rewriteCallAttarget(AbstractInstruction * self_in_rewriteCallAttarget, usqInt ca
2513225132
{
2513325133
usqInt callDistance;
2513425134

25135-
if (!(callTargetAddress >= (minCallAddress()))) {
25135+
if (openPICSize
25136+
&& (callTargetAddress < (minCallAddress()))) {
2513625137
error("linking callsite to invalid address");
2513725138
}
2513825139
callDistance = ((usqInt) (int)(callTargetAddress - callSiteReturnAddress));
@@ -25198,7 +25199,8 @@ rewriteInlineCacheAttagtarget(AbstractInstruction * self_in_rewriteInlineCacheAt
2519825199
{
2519925200
usqInt callDistance;
2520025201

25201-
if (!(callTargetAddress >= (minCallAddress()))) {
25202+
if (openPICSize
25203+
&& (callTargetAddress < (minCallAddress()))) {
2520225204
error("linking callsite to invalid address");
2520325205
}
2520425206
callDistance = ((usqInt) (int)(callTargetAddress - callSiteReturnAddress));

nsspur64src/vm/cogitX64WIN64.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.2824 uuid: 8f091e5b-fc0f-4b4b-ab5e-e90e598f75ee
2+
CCodeGenerator VMMaker.oscog-eem.2836 uuid: 9203f225-3af0-4c06-b652-99c13e86694a
33
from
4-
StackToRegisterMappingCogit VMMaker.oscog-eem.2824 uuid: 8f091e5b-fc0f-4b4b-ab5e-e90e598f75ee
4+
StackToRegisterMappingCogit VMMaker.oscog-eem.2836 uuid: 9203f225-3af0-4c06-b652-99c13e86694a
55
*/
6-
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2824 uuid: 8f091e5b-fc0f-4b4b-ab5e-e90e598f75ee " __DATE__ ;
6+
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2836 uuid: 9203f225-3af0-4c06-b652-99c13e86694a " __DATE__ ;
77
char *__cogitBuildInfo = __buildInfo;
88

99

@@ -25149,7 +25149,8 @@ rewriteCallAttarget(AbstractInstruction * self_in_rewriteCallAttarget, usqInt ca
2514925149
{
2515025150
usqInt callDistance;
2515125151

25152-
if (!(callTargetAddress >= (minCallAddress()))) {
25152+
if (openPICSize
25153+
&& (callTargetAddress < (minCallAddress()))) {
2515325154
error("linking callsite to invalid address");
2515425155
}
2515525156
callDistance = ((usqInt) (int)(callTargetAddress - callSiteReturnAddress));
@@ -25215,7 +25216,8 @@ rewriteInlineCacheAttagtarget(AbstractInstruction * self_in_rewriteInlineCacheAt
2521525216
{
2521625217
usqInt callDistance;
2521725218

25218-
if (!(callTargetAddress >= (minCallAddress()))) {
25219+
if (openPICSize
25220+
&& (callTargetAddress < (minCallAddress()))) {
2521925221
error("linking callsite to invalid address");
2522025222
}
2522125223
callDistance = ((usqInt) (int)(callTargetAddress - callSiteReturnAddress));

nsspur64src/vm/cointerp.c

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* Automatically generated by
2-
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2831 uuid: f4fed277-6b62-4e79-9147-c5405589f2b1
2+
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2836 uuid: 9203f225-3af0-4c06-b652-99c13e86694a
33
from
4-
CoInterpreter VMMaker.oscog-eem.2831 uuid: f4fed277-6b62-4e79-9147-c5405589f2b1
4+
CoInterpreter VMMaker.oscog-eem.2836 uuid: 9203f225-3af0-4c06-b652-99c13e86694a
55
*/
6-
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2831 uuid: f4fed277-6b62-4e79-9147-c5405589f2b1 " __DATE__ ;
6+
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2836 uuid: 9203f225-3af0-4c06-b652-99c13e86694a " __DATE__ ;
77
char *__interpBuildInfo = __buildInfo;
88

99

@@ -1269,7 +1269,7 @@ extern sqInt nonIndexablePointerFormat(void);
12691269
static sqInt noUnscannedEphemerons(void);
12701270
static sqInt NoDbgRegParms numBytesOfBytes(sqInt objOop);
12711271
extern sqInt numBytesOf(sqInt objOop);
1272-
extern usqInt numPointerSlotsOf(sqInt objOop);
1272+
extern sqInt numPointerSlotsOf(sqInt objOop);
12731273
static usqInt NoDbgRegParms numSlotsOfAny(sqInt objOop);
12741274
extern usqInt numSlotsOf(sqInt objOop);
12751275
static sqInt NoDbgRegParms numStrongSlotsOfInephemeral(sqInt objOop);
@@ -2628,7 +2628,7 @@ sqInt debugCallbackInvokes;
26282628
sqInt debugCallbackReturns;
26292629
sqInt ffiExceptionResponse;
26302630
sqInt checkedPluginName;
2631-
const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] CoInterpreterPrimitives_VMMaker.oscog-eem.2831";
2631+
const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] CoInterpreterPrimitives_VMMaker.oscog-eem.2836";
26322632
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
26332633
int displayWidth;
26342634
int displayDepth;
@@ -2698,6 +2698,7 @@ volatile int sendTrace;
26982698
#define classTableFirstPage() classTableFirstPage
26992699
#define classTableMajorIndexShift() 10
27002700
#define endOfMemory() GIV(endOfMemory)
2701+
#define extraAlignedBitShift() 24
27012702
#define firstByteFormat() 16
27022703
#define firstClassIndexPun() 16
27032704
#define firstCompiledMethodFormat() 24
@@ -18796,6 +18797,12 @@ externalInstVarofContext(sqInt offset, sqInt aContext)
1879618797
&& (!(isWidowedContext(aContext)))) {
1879718798
return fetchPointerofMarriedContext(offset, aContext);
1879818799
}
18800+
18801+
/* Why not update the slot to refer to the mapped pc? We're damned if we do, and damned if
18802+
we don't. If it is and the context is live and is returned to, then the pc will be mapped back
18803+
to machine code. If we don't then the mapping will be repeated on every access. What we
18804+
need are stats that show whether or not a read here predicts one or other outcome with any
18805+
certainty. For now, we keep it as it has been for a long time and do not update the slot. */
1879918806
value = longAt((aContext + BaseHeaderSize) + (((sqInt)((usqInt)(offset) << (shiftForWord())))));
1880018807
if ((offset == InstructionPointerIndex)
1880118808
&& (((((value) & 7) == 1))
@@ -37602,8 +37609,8 @@ primitiveSecondsClock(void)
3760237609
}
3760337610

3760437611

37605-
/* Set to OS to the requested display mode.
37606-
See also DisplayScreen setDisplayDepth:extent:fullscreen: */
37612+
/* Ask the GUI to set the requested display mode.
37613+
See DisplayScreen class depth:width:height:fullscreen: */
3760737614

3760837615
/* InterpreterPrimitives>>#primitiveSetDisplayMode */
3760937616
static void
@@ -37619,15 +37626,14 @@ primitiveSetDisplayMode(void)
3761937626
char *sp;
3762037627
sqInt w;
3762137628

37622-
okay = 0;
3762337629
/* begin booleanValueOf: */
3762437630
if ((longAt(GIV(stackPointer))) == GIV(trueObj)) {
3762537631
fsFlag = 1;
37626-
goto l1;
37632+
goto l3;
3762737633
}
3762837634
if ((longAt(GIV(stackPointer))) == GIV(falseObj)) {
3762937635
fsFlag = 0;
37630-
goto l1;
37636+
goto l3;
3763137637
}
3763237638
/* begin success: */
3763337639

@@ -37636,65 +37642,73 @@ primitiveSetDisplayMode(void)
3763637642
GIV(primFailCode) = 1;
3763737643
}
3763837644
fsFlag = null;
37639-
l1: /* end booleanValueOf: */;
37645+
l3: /* end booleanValueOf: */;
3764037646
/* begin stackIntegerValue: */
3764137647
integerPointer = longAt(GIV(stackPointer) + (1 * BytesPerWord));
3764237648
/* begin checkedIntegerValueOf: */
3764337649
if ((((integerPointer) & 7) == 1)) {
3764437650
h = (integerPointer >> 3);
37645-
goto l2;
37651+
goto l4;
3764637652
}
3764737653
else {
3764837654
/* begin primitiveFail */
3764937655
if (!GIV(primFailCode)) {
3765037656
GIV(primFailCode) = 1;
3765137657
}
3765237658
h = 0;
37653-
goto l2;
37659+
goto l4;
3765437660
}
37655-
l2: /* end stackIntegerValue: */;
37661+
l4: /* end stackIntegerValue: */;
3765637662
/* begin stackIntegerValue: */
3765737663
integerPointer1 = longAt(GIV(stackPointer) + (2 * BytesPerWord));
3765837664
/* begin checkedIntegerValueOf: */
3765937665
if ((((integerPointer1) & 7) == 1)) {
3766037666
w = (integerPointer1 >> 3);
37661-
goto l3;
37667+
goto l5;
3766237668
}
3766337669
else {
3766437670
/* begin primitiveFail */
3766537671
if (!GIV(primFailCode)) {
3766637672
GIV(primFailCode) = 1;
3766737673
}
3766837674
w = 0;
37669-
goto l3;
37675+
goto l5;
3767037676
}
37671-
l3: /* end stackIntegerValue: */;
37677+
l5: /* end stackIntegerValue: */;
3767237678
/* begin stackIntegerValue: */
3767337679
integerPointer2 = longAt(GIV(stackPointer) + (3 * BytesPerWord));
3767437680
/* begin checkedIntegerValueOf: */
3767537681
if ((((integerPointer2) & 7) == 1)) {
3767637682
d = (integerPointer2 >> 3);
37677-
goto l4;
37683+
goto l6;
3767837684
}
3767937685
else {
3768037686
/* begin primitiveFail */
3768137687
if (!GIV(primFailCode)) {
3768237688
GIV(primFailCode) = 1;
3768337689
}
3768437690
d = 0;
37685-
goto l4;
37691+
goto l6;
3768637692
}
37687-
l4: /* end stackIntegerValue: */;
37688-
if (!GIV(primFailCode)) {
37689-
okay = ioSetDisplayMode(w, h, d, fsFlag);
37693+
l6: /* end stackIntegerValue: */;
37694+
if (GIV(primFailCode)) {
37695+
/* begin primitiveFailFor: */
37696+
GIV(primFailCode) = PrimErrBadArgument;
37697+
return;
3769037698
}
37691-
if (!GIV(primFailCode)) {
37692-
/* begin pop:thenPushBool: */
37693-
longAtput((sp = GIV(stackPointer) + ((4) * BytesPerWord)), (okay
37694-
? GIV(trueObj)
37695-
: GIV(falseObj)));
37696-
GIV(stackPointer) = sp;
37699+
okay = ioSetDisplayMode(w, h, d, fsFlag);
37700+
if (GIV(primFailCode)) {
37701+
/* begin primitiveFailFor: */
37702+
GIV(primFailCode) = PrimErrOperationFailed;
37703+
return;
3769737704
}
37705+
/* begin methodReturnBool: */
37706+
assert(!((failed())));
37707+
/* begin pop:thenPushBool: */
37708+
longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (okay
37709+
? GIV(trueObj)
37710+
: GIV(falseObj)));
37711+
GIV(stackPointer) = sp;
3769837712
}
3769937713

3770037714

@@ -41476,7 +41490,7 @@ followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth)
4147641490
sqInt header1;
4147741491
sqInt i;
4147841492
sqInt numLiterals;
41479-
usqInt numSlots;
41493+
sqInt numSlots;
4148041494
usqInt numSlots1;
4148141495
sqInt oop;
4148241496
sqInt referent;
@@ -49098,7 +49112,7 @@ copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endS
4909849112
sqInt iLimiT;
4909949113
sqInt methodHeader;
4910049114
sqInt numLiterals;
49101-
usqInt numMediatedSlots;
49115+
sqInt numMediatedSlots;
4910249116
usqInt numSlots;
4910349117
usqInt numSlots1;
4910449118
sqInt oop;
@@ -50786,7 +50800,7 @@ growOldSpaceByAtLeast(sqInt minAmmount)
5078650800
| 22: identityHash | (on a word boundary)
5078750801
| 3 bits | (msb <-> lsb = {isGrey,isPinned,isRemembered}
5078850802
| 5: format | (on a byte boundary)
50789-
| 2 bits | (msb,lsb = {isImmutable,?})
50803+
| 2 bits | (msb,lsb = {isImmutable,isExtraAligned})
5079050804
| 22: classIndex | (on a word boundary) : LSB
5079150805
The remaining bits (7) are used for
5079250806
isImmutable (bit 23)
@@ -55356,7 +55370,7 @@ numBytesOf(sqInt objOop)
5535655370
Works with CompiledMethods, as well as ordinary objects. */
5535755371

5535855372
/* SpurMemoryManager>>#numPointerSlotsOf: */
55359-
usqInt
55373+
sqInt
5536055374
numPointerSlotsOf(sqInt objOop)
5536155375
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
5536255376
sqInt contextSize;
@@ -58351,7 +58365,7 @@ printReferencesTo(sqInt anOop)
5835158365
assert((ReceiverIndex + ((sp >> 3))) < (lengthOf(objOop1)));
5835258366
contextSize = (sp >> 3);
5835358367
l9: /* end fetchStackPointerOf: */;
58354-
i = ((usqInt) (CtxtTempFrameStart + contextSize));
58368+
i = CtxtTempFrameStart + contextSize;
5835558369
goto l10;
5835658370
}
5835758371
/* begin numSlotsOf: */
@@ -58384,7 +58398,7 @@ printReferencesTo(sqInt anOop)
5838458398
/* begin literalCountOfMethodHeader: */
5838558399
assert((((header) & 7) == 1));
5838658400
numLiterals = ((header >> 3)) & AlternateHeaderNumLiteralsMask;
58387-
i = ((usqInt) (numLiterals + LiteralStart));
58401+
i = numLiterals + LiteralStart;
5838858402
l10: /* end numPointerSlotsOf: */;
5838958403
while (((i -= 1)) >= 0) {
5839058404
if (anOop == (longAt((objOop1 + BaseHeaderSize) + (((sqInt)((usqInt)(i) << (shiftForWord()))))))) {
@@ -61532,10 +61546,10 @@ updatePointers(void)
6153261546
sqInt numLiterals1;
6153361547
sqInt numLiterals2;
6153461548
sqInt numLiterals3;
61535-
usqInt numPointerSlots;
61536-
usqInt numPointerSlots1;
61537-
usqInt numPointerSlots2;
61538-
usqInt numPointerSlots3;
61549+
sqInt numPointerSlots;
61550+
sqInt numPointerSlots1;
61551+
sqInt numPointerSlots2;
61552+
sqInt numPointerSlots3;
6153961553
usqInt numSlots;
6154061554
usqInt numSlots1;
6154161555
usqInt numSlots11;

nsspur64src/vm/cointerp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Automatically generated by
2-
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2831 uuid: f4fed277-6b62-4e79-9147-c5405589f2b1
2+
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2836 uuid: 9203f225-3af0-4c06-b652-99c13e86694a
33
*/
44

55

@@ -256,7 +256,7 @@ extern sqInt minSlotsForShortening(void);
256256
extern sqInt nilObject(void);
257257
extern sqInt nonIndexablePointerFormat(void);
258258
extern sqInt numBytesOf(sqInt objOop);
259-
extern usqInt numPointerSlotsOf(sqInt objOop);
259+
extern sqInt numPointerSlotsOf(sqInt objOop);
260260
extern usqInt numSlotsOf(sqInt objOop);
261261
extern sqInt numStrongSlotsOfWeakling(sqInt objOop);
262262
extern sqInt objectAfter(sqInt objOop);

0 commit comments

Comments
 (0)