[Vm-dev] [commit][3321] Fork from VMMaker.oscog-eem.1034 for stable
Glue.
commits at squeakvm.org
commits at squeakvm.org
Wed May 6 21:11:48 UTC 2015
Revision: 3321
Author: eliot
Date: 2015-05-06 14:11:38 -0700 (Wed, 06 May 2015)
Log Message:
-----------
Fork from VMMaker.oscog-eem.1034 for stable Glue.
Changes from VMMaker.oscog-eem.1288 &
VMMaker.oscog-eem.1291:
Implement remembered table pruning via ref counts.
The algorithm selectively tenures objects to reduce
the remembered table, instead of merely tenuring
everything.
Be selective about remembering tenured objects;
actually scan their contents before remembering
willy-nilly.
Nuke obsolete copyToOldSpace: methods.
Change computeRefCountToShrinkRT to
- compute the ref counts and population in a single
pass over the RT
- determine the ref count for tenuring based on
half the population of remembered objects, /not/
half the size of the RT.
Modified Paths:
--------------
branches/Glue/README
branches/Glue/nscogsrc/plugins/AioPlugin/AioPlugin.c
branches/Glue/nscogsrc/plugins/AsynchFilePlugin/AsynchFilePlugin.c
branches/Glue/nscogsrc/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c
branches/Glue/nscogsrc/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c
branches/Glue/nscogsrc/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c
branches/Glue/nscogsrc/vm/cointerp.c
branches/Glue/nscogsrc/vm/cointerp.h
branches/Glue/nscogsrc/vm/gcc3x-cointerp.c
branches/Glue/nsspursrc/vm/cointerp.c
branches/Glue/nsspursrc/vm/cointerp.h
branches/Glue/nsspursrc/vm/gcc3x-cointerp.c
branches/Glue/nsspurstacksrc/vm/gcc3x-interp.c
branches/Glue/nsspurstacksrc/vm/interp.c
branches/Glue/sistasrc/vm/cointerp.c
branches/Glue/sistasrc/vm/cointerp.h
branches/Glue/sistasrc/vm/gcc3x-cointerp.c
branches/Glue/spursistasrc/vm/cointerp.c
branches/Glue/spursistasrc/vm/cointerp.h
branches/Glue/spursistasrc/vm/gcc3x-cointerp.c
branches/Glue/spursrc/vm/cointerp.c
branches/Glue/spursrc/vm/cointerp.h
branches/Glue/spursrc/vm/gcc3x-cointerp.c
branches/Glue/spurstack64src/vm/gcc3x-interp.c
branches/Glue/spurstack64src/vm/interp.c
branches/Glue/spurstacksrc/vm/gcc3x-interp.c
branches/Glue/spurstacksrc/vm/interp.c
branches/Glue/src/plugins/ADPCMCodecPlugin/ADPCMCodecPlugin.c
branches/Glue/src/plugins/AioPlugin/AioPlugin.c
branches/Glue/src/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c
branches/Glue/src/plugins/SoundGenerationPlugin/SoundGenerationPlugin.c
branches/Glue/src/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c
branches/Glue/src/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c
branches/Glue/src/vm/cointerp.c
branches/Glue/src/vm/cointerp.h
branches/Glue/src/vm/cointerpmt.c
branches/Glue/src/vm/cointerpmt.h
branches/Glue/src/vm/gcc3x-cointerp.c
branches/Glue/src/vm/gcc3x-cointerpmt.c
branches/Glue/stacksrc/vm/gcc3x-interp.c
branches/Glue/stacksrc/vm/interp.c
Property Changed:
----------------
branches/Glue/platforms/Cross/vm/sqSCCSVersion.h
Modified: branches/Glue/README
===================================================================
--- branches/Glue/README 2015-05-06 19:25:17 UTC (rev 3320)
+++ branches/Glue/README 2015-05-06 21:11:38 UTC (rev 3321)
@@ -1,4 +1,4 @@
-The Cog VM source tree
+Branch of the Cog VM source tree for Cadence Glue Emergencies.
---------------------
This is the README for the Cog subversion source tree:
http://www.squeakvm.org/svn/squeak/branches/Cog
Modified: branches/Glue/nscogsrc/plugins/AioPlugin/AioPlugin.c
===================================================================
--- branches/Glue/nscogsrc/plugins/AioPlugin/AioPlugin.c 2015-05-06 19:25:17 UTC (rev 3320)
+++ branches/Glue/nscogsrc/plugins/AioPlugin/AioPlugin.c 2015-05-06 21:11:38 UTC (rev 3321)
@@ -1,9 +1,9 @@
/* Automatically generated by
- VMPluginCodeGenerator VMMaker.oscog-eem.983 uuid: 4cdca841-6318-4c49-95de-8c47d0d7e91d
+ VMPluginCodeGenerator VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
from
- UnixAioPlugin VMConstruction-Plugins-AioPlugin-eem.17 uuid: a2b39cb2-e681-4bc3-a777-f03b2e3f2de0
+ UnixAioPlugin VMConstruction-Plugins-AioPlugin-eem.18 uuid: c426ab70-05a2-43a1-a899-e324aaf8f92f
*/
-static char __buildInfo[] = "UnixAioPlugin VMConstruction-Plugins-AioPlugin-eem.17 uuid: a2b39cb2-e681-4bc3-a777-f03b2e3f2de0 " __DATE__ ;
+static char __buildInfo[] = "UnixAioPlugin VMConstruction-Plugins-AioPlugin-eem.18 uuid: c426ab70-05a2-43a1-a899-e324aaf8f92f " __DATE__ ;
@@ -120,9 +120,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "AioPlugin VMConstruction-Plugins-AioPlugin-eem.17 (i)"
+ "AioPlugin VMConstruction-Plugins-AioPlugin-eem.18 (i)"
#else
- "AioPlugin VMConstruction-Plugins-AioPlugin-eem.17 (e)"
+ "AioPlugin VMConstruction-Plugins-AioPlugin-eem.18 (e)"
#endif
;
@@ -256,7 +256,7 @@
sqSocketBytes = arrayValueOf(objectPointer);
idx = 0;
- while (idx < (socketRecordSize())) {
+ while (idx < (sizeof(SQSocket))) {
if ((sqSocketBytes[idx]) != 0) {
return 0;
}
@@ -291,7 +291,7 @@
isSQSocketObject(sqInt objectPointer)
{
return ((isBytes(objectPointer))
- && ((byteSizeOf(objectPointer)) == (socketRecordSize())))
+ && ((byteSizeOf(objectPointer)) == (sizeof(SQSocket))))
&& (!(isNullSQSocket(objectPointer)));
}
@@ -523,7 +523,7 @@
sqSocketOop = stackValue(0);
if (!(((isBytes(sqSocketOop))
- && ((byteSizeOf(sqSocketOop)) == (socketRecordSize())))
+ && ((byteSizeOf(sqSocketOop)) == (sizeof(SQSocket))))
&& (!(isNullSQSocket(sqSocketOop))))) {
return primitiveFail();
}
Modified: branches/Glue/nscogsrc/plugins/AsynchFilePlugin/AsynchFilePlugin.c
===================================================================
--- branches/Glue/nscogsrc/plugins/AsynchFilePlugin/AsynchFilePlugin.c 2015-05-06 19:25:17 UTC (rev 3320)
+++ branches/Glue/nscogsrc/plugins/AsynchFilePlugin/AsynchFilePlugin.c 2015-05-06 21:11:38 UTC (rev 3321)
@@ -1,9 +1,9 @@
/* Automatically generated by
- SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.983 uuid: 4cdca841-6318-4c49-95de-8c47d0d7e91d
+ SmartSyntaxPluginCodeGenerator VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
from
- AsynchFilePlugin VMMaker.oscog-eem.983 uuid: 4cdca841-6318-4c49-95de-8c47d0d7e91d
+ AsynchFilePlugin VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
*/
-static char __buildInfo[] = "AsynchFilePlugin VMMaker.oscog-eem.983 uuid: 4cdca841-6318-4c49-95de-8c47d0d7e91d " __DATE__ ;
+static char __buildInfo[] = "AsynchFilePlugin VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba " __DATE__ ;
@@ -102,9 +102,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "AsynchFilePlugin VMMaker.oscog-eem.983 (i)"
+ "AsynchFilePlugin VMMaker.oscogglue-eem.1036 (i)"
#else
- "AsynchFilePlugin VMMaker.oscog-eem.983 (e)"
+ "AsynchFilePlugin VMMaker.oscogglue-eem.1036 (e)"
#endif
;
static void * sCOAFfn;
@@ -182,6 +182,9 @@
primitiveFailFor(PrimErrBadArgument);
f = null;
l1: /* end asyncFileValueOf: */;
+ if (failed()) {
+ return null;
+ }
asyncFileClose(f);
if (failed()) {
return null;
@@ -287,13 +290,11 @@
}
success((startIndex >= 1)
&& (((startIndex + count) - 1) <= bufferSize));
-
- /* adjust for zero-origin indexing */
-
+ if (failed()) {
+ return null;
+ }
bufferPtr = ((((sqInt) (firstIndexableField(buffer)))) + startIndex) - 1;
- if (!(failed())) {
- r = asyncFileReadResult(f, bufferPtr, count);
- }
+ r = asyncFileReadResult(f, ((void *)bufferPtr), count);
_return_value = integerObjectOf(r);
if (failed()) {
return null;
@@ -325,6 +326,9 @@
primitiveFailFor(PrimErrBadArgument);
f = null;
l1: /* end asyncFileValueOf: */;
+ if (failed()) {
+ return null;
+ }
asyncFileReadStart(f, fPosition, count);
if (failed()) {
return null;
@@ -354,7 +358,10 @@
primitiveFailFor(PrimErrBadArgument);
f = null;
l1: /* end asyncFileValueOf: */;
- r = asyncFileWriteResult(f);
+ if (failed()) {
+ return null;
+ }
+ r = asyncFileWriteResult(f);
_return_value = integerObjectOf(r);
if (failed()) {
return null;
@@ -394,9 +401,6 @@
primitiveFailFor(PrimErrBadArgument);
f = null;
l1: /* end asyncFileValueOf: */;
- if (failed()) {
- return null;
- }
count = num;
startIndex = start;
@@ -413,13 +417,11 @@
}
success((startIndex >= 1)
&& (((startIndex + count) - 1) <= bufferSize));
-
- /* adjust for zero-origin indexing */
-
+ if (failed()) {
+ return null;
+ }
bufferPtr = ((((sqInt) (firstIndexableField(buffer)))) + startIndex) - 1;
- if (!(failed())) {
- asyncFileWriteStart(f, fPosition, bufferPtr, count);
- }
+ asyncFileWriteStart(f, fPosition, ((void *)bufferPtr), count);
if (failed()) {
return null;
}
Modified: branches/Glue/nscogsrc/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c
===================================================================
--- branches/Glue/nscogsrc/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c 2015-05-06 19:25:17 UTC (rev 3320)
+++ branches/Glue/nscogsrc/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c 2015-05-06 21:11:38 UTC (rev 3321)
@@ -1,17 +1,17 @@
/* Automatically generated by
- VMPluginCodeGenerator VMMaker.oscog-eem.983 uuid: 4cdca841-6318-4c49-95de-8c47d0d7e91d
+ VMPluginCodeGenerator VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
from
- MiscPrimitivePlugin VMMaker.oscog-eem.983 uuid: 4cdca841-6318-4c49-95de-8c47d0d7e91d
- Bitmap * Graphics-bf.303 uuid: 59c75040-7563-4061-8425-81f4467d3eb8
- ByteArray * Collections.spur-bf.588 uuid: 80ef5d3c-140e-4225-98f4-354435f1372e
- ByteString * Collections.spur-bf.588 uuid: 80ef5d3c-140e-4225-98f4-354435f1372e
- SampledSound Sound-bf.42 uuid: 01b2784a-0ad7-4a6b-a996-3388ab820acd
+ MiscPrimitivePlugin VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
+ Bitmap * Graphics-mt.312 uuid: ad5f17db-6eed-a44f-a07c-cbfb9d4e09ee
+ ByteArray * Collections.spur-ul.610, Collections.spur-ul.627, Collections.spur-mt.631 uuid: 3448b17a-1361-47a8-af38-4c26b42dc028
+ ByteString * Collections.spur-ul.610, Collections.spur-ul.627, Collections.spur-mt.631 uuid: 3448b17a-1361-47a8-af38-4c26b42dc028
+ SampledSound Sound-topa.43 uuid: c1c2b948-6c86-4cf8-877d-1620433f558e
*/
-static char __buildInfo[] = "MiscPrimitivePlugin VMMaker.oscog-eem.983 uuid: 4cdca841-6318-4c49-95de-8c47d0d7e91d\n\
-Bitmap * Graphics-bf.303 uuid: 59c75040-7563-4061-8425-81f4467d3eb8\n\
-ByteArray * Collections.spur-bf.588 uuid: 80ef5d3c-140e-4225-98f4-354435f1372e\n\
-ByteString * Collections.spur-bf.588 uuid: 80ef5d3c-140e-4225-98f4-354435f1372e\n\
-SampledSound Sound-bf.42 uuid: 01b2784a-0ad7-4a6b-a996-3388ab820acd " __DATE__ ;
+static char __buildInfo[] = "MiscPrimitivePlugin VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba\n\
+Bitmap * Graphics-mt.312 uuid: ad5f17db-6eed-a44f-a07c-cbfb9d4e09ee\n\
+ByteArray * Collections.spur-ul.610, Collections.spur-ul.627, Collections.spur-mt.631 uuid: 3448b17a-1361-47a8-af38-4c26b42dc028\n\
+ByteString * Collections.spur-ul.610, Collections.spur-ul.627, Collections.spur-mt.631 uuid: 3448b17a-1361-47a8-af38-4c26b42dc028\n\
+SampledSound Sound-topa.43 uuid: c1c2b948-6c86-4cf8-877d-1620433f558e " __DATE__ ;
@@ -94,9 +94,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "MiscPrimitivePlugin VMMaker.oscog-eem.983 (i)"
+ "MiscPrimitivePlugin VMMaker.oscogglue-eem.1036 (i)"
#else
- "MiscPrimitivePlugin VMMaker.oscog-eem.983 (e)"
+ "MiscPrimitivePlugin VMMaker.oscogglue-eem.1036 (e)"
#endif
;
@@ -764,7 +764,7 @@
pushInteger(0);
return null;
}
- for (startIndex = start, startIndexLimiT = (((sizeOfSTArrayFromCPrimitive(body + 1)) - (sizeOfSTArrayFromCPrimitive(key + 1))) + 1); startIndex <= startIndexLimiT; startIndex += 1) {
+ for (startIndex = (((start < 1) ? 1 : start)), startIndexLimiT = (((sizeOfSTArrayFromCPrimitive(body + 1)) - (sizeOfSTArrayFromCPrimitive(key + 1))) + 1); startIndex <= startIndexLimiT; startIndex += 1) {
index = 1;
while ((matchTable[(asciiValue(body[(startIndex + index) - 1])) + 1]) == (matchTable[(asciiValue(key[index])) + 1])) {
if (index == (sizeOfSTArrayFromCPrimitive(key + 1))) {
Modified: branches/Glue/nscogsrc/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c
===================================================================
--- branches/Glue/nscogsrc/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c 2015-05-06 19:25:17 UTC (rev 3320)
+++ branches/Glue/nscogsrc/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c 2015-05-06 21:11:38 UTC (rev 3321)
@@ -1,9 +1,9 @@
/* Automatically generated by
- VMPluginCodeGenerator VMMaker.oscog-eem.985 uuid: f455e095-e61a-46a0-8994-c4bc33bb8a46
+ VMPluginCodeGenerator VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
from
- UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.49 uuid: dbbde2e2-9103-4ba8-96a9-33c29e7ee7e4
+ UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.50 uuid: 67b1e805-4efd-476c-8cf3-b4a5e14e22a9
*/
-static char __buildInfo[] = "UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.49 uuid: dbbde2e2-9103-4ba8-96a9-33c29e7ee7e4 " __DATE__ ;
+static char __buildInfo[] = "UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.50 uuid: 67b1e805-4efd-476c-8cf3-b4a5e14e22a9 " __DATE__ ;
/* D T Lewis - UnixOSProcessPlugin.c translated from class
UnixOSProcessPlugin of OSProcessPlugin version 4.3.3 Cog */
@@ -316,9 +316,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.49 (i)"
+ "UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.50 (i)"
#else
- "UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.49 (e)"
+ "UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.50 (e)"
#endif
;
static void *originalSigHandlers[NSIG];
@@ -1070,7 +1070,7 @@
sqSocketBytes = arrayValueOf(objectPointer);
idx = 0;
- while (idx < (socketRecordSize())) {
+ while (idx < (sizeof(SQSocket))) {
if ((sqSocketBytes[idx]) != 0) {
return 0;
}
@@ -1105,7 +1105,7 @@
isSQSocketObject(sqInt objectPointer)
{
return ((isBytes(objectPointer))
- && ((byteSizeOf(objectPointer)) == (socketRecordSize())))
+ && ((byteSizeOf(objectPointer)) == (sizeof(SQSocket))))
&& (!(isNullSQSocket(objectPointer)));
}
@@ -1302,7 +1302,7 @@
static sqInt
newSQSocketByteArray(void)
{
- return instantiateClassindexableSize(classByteArray(), socketRecordSize());
+ return instantiateClassindexableSize(classByteArray(), sizeof(SQSocket));
}
@@ -1329,12 +1329,12 @@
unsigned char *ptr;
if (!((isBytes(aByteArray))
- && ((stSizeOf(aByteArray)) == (sizeOfPointer())))) {
+ && ((stSizeOf(aByteArray)) == (sizeof(void *))))) {
return null;
}
ptr = arrayValueOf(aByteArray);
idx = 0;
- while (idx < (sizeOfPointer())) {
+ while (idx < (sizeof(void *))) {
pointerUnion.bytes[idx] = ptr[idx];
idx += 1;
}
@@ -1962,11 +1962,11 @@
if (handler == (sigErrorNumber())) {
return primitiveFail();
}
- priorHandlerObject = instantiateClassindexableSize(classByteArray(), sizeOfPointer());
+ priorHandlerObject = instantiateClassindexableSize(classByteArray(), sizeof(void *));
hPtr = arrayValueOf(priorHandlerObject);
priorHandler.handler = handler;
idx = 0;
- while (idx < (sizeOfPointer())) {
+ while (idx < (sizeof(void *))) {
hPtr[idx] = priorHandler.bytes[idx];
idx += 1;
}
@@ -3336,7 +3336,7 @@
primitiveSizeOfInt(void)
{
pop(1);
- pushInteger(sizeOfInt());
+ pushInteger(sizeof(int));
}
@@ -3346,7 +3346,7 @@
primitiveSizeOfPointer(void)
{
pop(1);
- pushInteger(sizeOfPointer());
+ pushInteger(sizeof(void *));
}
Modified: branches/Glue/nscogsrc/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c
===================================================================
--- branches/Glue/nscogsrc/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c 2015-05-06 19:25:17 UTC (rev 3320)
+++ branches/Glue/nscogsrc/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c 2015-05-06 21:11:38 UTC (rev 3321)
@@ -1,9 +1,9 @@
/* Automatically generated by
- VMPluginCodeGenerator VMMaker.oscog-eem.983 uuid: 4cdca841-6318-4c49-95de-8c47d0d7e91d
+ VMPluginCodeGenerator VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
from
- Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.49 uuid: dbbde2e2-9103-4ba8-96a9-33c29e7ee7e4
+ Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.50 uuid: 67b1e805-4efd-476c-8cf3-b4a5e14e22a9
*/
-static char __buildInfo[] = "Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.49 uuid: dbbde2e2-9103-4ba8-96a9-33c29e7ee7e4 " __DATE__ ;
+static char __buildInfo[] = "Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.50 uuid: 67b1e805-4efd-476c-8cf3-b4a5e14e22a9 " __DATE__ ;
/* D T Lewis - Win32OSProcessPlugin.c translated from class
Win32OSProcessPlugin of OSProcessPlugin version 4.3.3 Cog */
@@ -222,9 +222,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.49 (i)"
+ "Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.50 (i)"
#else
- "Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.49 (e)"
+ "Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.50 (e)"
#endif
;
static int osprocessSandboxSecurity;
@@ -560,7 +560,7 @@
sqSocketBytes = arrayValueOf(objectPointer);
idx = 0;
- while (idx < (socketRecordSize())) {
+ while (idx < (sizeof(SQSocket))) {
if ((sqSocketBytes[idx]) != 0) {
return 0;
}
@@ -595,7 +595,7 @@
isSQSocketObject(sqInt objectPointer)
{
return ((isBytes(objectPointer))
- && ((byteSizeOf(objectPointer)) == (socketRecordSize())))
+ && ((byteSizeOf(objectPointer)) == (sizeof(SQSocket))))
&& (!(isNullSQSocket(objectPointer)));
}
@@ -644,7 +644,7 @@
static sqInt
newSQSocketByteArray(void)
{
- return instantiateClassindexableSize(classByteArray(), socketRecordSize());
+ return instantiateClassindexableSize(classByteArray(), sizeof(SQSocket));
}
@@ -658,12 +658,12 @@
unsigned char *ptr;
if (!((isBytes(aByteArray))
- && ((stSizeOf(aByteArray)) == (sizeOfPointer())))) {
+ && ((stSizeOf(aByteArray)) == (sizeof(void *))))) {
return null;
}
ptr = arrayValueOf(aByteArray);
idx = 0;
- while (idx < (sizeOfPointer())) {
+ while (idx < (sizeof(void *))) {
pointerUnion.bytes[idx] = ptr[idx];
idx += 1;
}
@@ -1750,7 +1750,7 @@
primitiveSizeOfInt(void)
{
pop(1);
- pushInteger(sizeOfInt());
+ pushInteger(sizeof(int));
}
@@ -1760,7 +1760,7 @@
primitiveSizeOfPointer(void)
{
pop(1);
- pushInteger(sizeOfPointer());
+ pushInteger(sizeof(void *));
}
Modified: branches/Glue/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Glue/nscogsrc/vm/cointerp.c 2015-05-06 19:25:17 UTC (rev 3320)
+++ branches/Glue/nscogsrc/vm/cointerp.c 2015-05-06 21:11:38 UTC (rev 3321)
@@ -1,9 +1,9 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1029 uuid: a2c6da7a-d111-4184-bf10-039ed2bea424
+ CCodeGeneratorGlobalStructure VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
from
- CoInterpreter VMMaker.oscog-eem.1029 uuid: a2c6da7a-d111-4184-bf10-039ed2bea424
+ CoInterpreter VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
*/
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1029 uuid: a2c6da7a-d111-4184-bf10-039ed2bea424 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba " __DATE__ ;
char *__interpBuildInfo = __buildInfo;
@@ -2097,7 +2097,7 @@
/* 575 */ (void (*)(void))0,
0 };
char expensiveAsserts = 0;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1029";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscogglue-eem.1036";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
volatile int sendTrace;
Modified: branches/Glue/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Glue/nscogsrc/vm/cointerp.h 2015-05-06 19:25:17 UTC (rev 3320)
+++ branches/Glue/nscogsrc/vm/cointerp.h 2015-05-06 21:11:38 UTC (rev 3321)
@@ -1,5 +1,5 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1029 uuid: a2c6da7a-d111-4184-bf10-039ed2bea424
+ CCodeGeneratorGlobalStructure VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
*/
Modified: branches/Glue/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Glue/nscogsrc/vm/gcc3x-cointerp.c 2015-05-06 19:25:17 UTC (rev 3320)
+++ branches/Glue/nscogsrc/vm/gcc3x-cointerp.c 2015-05-06 21:11:38 UTC (rev 3321)
@@ -2,11 +2,11 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1029 uuid: a2c6da7a-d111-4184-bf10-039ed2bea424
+ CCodeGeneratorGlobalStructure VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
from
- CoInterpreter VMMaker.oscog-eem.1029 uuid: a2c6da7a-d111-4184-bf10-039ed2bea424
+ CoInterpreter VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
*/
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1029 uuid: a2c6da7a-d111-4184-bf10-039ed2bea424 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba " __DATE__ ;
char *__interpBuildInfo = __buildInfo;
@@ -2100,7 +2100,7 @@
/* 575 */ (void (*)(void))0,
0 };
char expensiveAsserts = 0;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1029";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscogglue-eem.1036";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
volatile int sendTrace;
Modified: branches/Glue/nsspursrc/vm/cointerp.c
===================================================================
--- branches/Glue/nsspursrc/vm/cointerp.c 2015-05-06 19:25:17 UTC (rev 3320)
+++ branches/Glue/nsspursrc/vm/cointerp.c 2015-05-06 21:11:38 UTC (rev 3321)
@@ -1,9 +1,9 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1034 uuid: 1a93b31c-cf2c-4a2c-b53f-9eae1d7863c7
+ CCodeGeneratorGlobalStructure VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
from
- CoInterpreter VMMaker.oscog-eem.1034 uuid: 1a93b31c-cf2c-4a2c-b53f-9eae1d7863c7
+ CoInterpreter VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
*/
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1034 uuid: 1a93b31c-cf2c-4a2c-b53f-9eae1d7863c7 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba " __DATE__ ;
char *__interpBuildInfo = __buildInfo;
@@ -209,7 +209,6 @@
#define CSWait 10
#define CSYield 11
#define CtxtTempFrameStart 6
-#define DontTenureButDoUnmark 4
#define DumpStackOnLowSpace 0
#define EnclosingMixinIndex 3
#define EnclosingObjectIndex 4
@@ -252,6 +251,7 @@
#define MaxLiteralCountForCompile 60
#define MaxPrimitiveIndex 575
#define MaxQuickPrimitiveIndex 519
+#define MaxRTRefCount 7
#define MessageArgumentsIndex 1
#define MessageLookupClassIndex 2
#define MessageSelectorIndex 0
@@ -343,6 +343,7 @@
#define SuspendedContextIndex 1
#define TenureByAge 1
#define TenureByClass 2
+#define TenureToShrinkRT 3
#define TheDisplay 14
#define TheFinalizationSemaphore 41
#define TheInputSemaphore null
@@ -837,8 +838,11 @@
static sqInt wordIndexableFormat(void);
static void addToEphemeronList(sqInt ephemeronCorpse) NoDbgRegParms;
static void addToWeakList(sqInt weakCorpse) NoDbgRegParms;
+static sqInt allNewSpaceObjectsHaveZeroRTRefCount(void);
static sqInt allWeakSurvivorsOnWeakList(void);
+static void computeRefCountToShrinkRT(void) NeverInline;
static sqInt copyAndForward(sqInt survivor) NoDbgRegParms;
+static sqInt copyToOldSpacebytesformat(sqInt survivor, sqInt bytesInObject, sqInt formatOfSurvivor) NoDbgRegParms NeverInline;
static sqInt firstCorpse(sqInt headOfCorpseList) NoDbgRegParms;
static void growRememberedSet(void);
static sqInt isInRememberedSet(sqInt objOop) NoDbgRegParms;
@@ -1557,8 +1561,8 @@
_iss usqInt scavengeThreshold;
_iss sqInt remapBufferCount;
_iss sqInt * freeLists;
+_iss sqInt rememberedSetSize;
_iss char * stackLimit;
-_iss sqInt rememberedSetSize;
_iss sqInt tempOop;
_iss sqInt * rememberedSet;
_iss sqInt classTableFirstPage;
@@ -1582,10 +1586,10 @@
_iss sqLong nextProfileTick;
_iss sqInt numRememberedEphemerons;
_iss sqInt jmpDepth;
+_iss SpurNewSpaceSpace eden;
_iss sqInt futureSurvivorStart;
_iss char * objStackInvalidBecause;
_iss usqInt lastFreeChunk;
-_iss SpurNewSpaceSpace eden;
_iss sqInt ephemeronList;
_iss usqInt freeOldSpaceStart;
_iss sqInt tenureThreshold;
@@ -1596,6 +1600,7 @@
_iss sqInt classNameIndex;
_iss sqInt growHeadroom;
_iss sqInt ephemeronQueue;
+_iss sqInt tenureCriterion;
_iss sqInt lastMethodCacheProbeWrite;
_iss sqInt metaclassNumSlots;
_iss sqInt preemptionYields;
@@ -1622,6 +1627,7 @@
_iss sqInt noThreadingOfGUIThread;
_iss sqInt pendingFinalizationSignals;
_iss sqInt processHasThreadId;
+_iss sqInt rememberedSetLimit;
_iss sqInt shrinkThreshold;
_iss usqLong statIOProcessEvents;
_iss sqInt lastHash;
@@ -1629,9 +1635,7 @@
_iss sqInt marking;
_iss usqInt memory;
_iss sqInt numCompactionPasses;
-_iss sqInt rememberedSetLimit;
_iss sqInt scavengeInProgress;
-_iss sqInt tenureCriterion;
_iss sqInt fullScreenFlag;
_iss float heapGrowthToSizeGCRatio;
_iss usqInt heapSizeAtPreviousGC;
@@ -1639,6 +1643,7 @@
_iss sqInt interruptPending;
_iss sqInt methodDictLinearSearchLimit;
_iss usqLong nextPollUsecs;
+_iss sqInt rememberedSetRedZone;
_iss sqInt statCompactPassCount;
_iss usqLong statForceInterruptCheck;
_iss usqLong statFullGCUsecs;
@@ -1658,7 +1663,6 @@
_iss sqInt imageFloatsBigEndian;
_iss sqInt longRunningPrimitiveSignalUndelivered;
_iss sqInt maxExtSemTabSizeSet;
-_iss sqInt rememberedSetRedZone;
_iss sqInt savedWindowSize;
_iss sqInt signalLowSpace;
_iss sqInt statCodeCompactionCount;
@@ -1672,6 +1676,7 @@
_iss usqLong longRunningPrimitiveGCUsecs;
_iss sqInt overflowLimit;
_iss StackPage * overflowedPage;
+_iss sqInt refCountToShrinkRT;
_iss sqInt statCoalesces;
_iss usqLong statIGCDeltaUsecs;
_iss usqLong statIncrGCUsecs;
@@ -2353,7 +2358,7 @@
/*560*/ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0,-1,-1
};
char expensiveAsserts = 0;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1034";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscogglue-eem.1036";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
volatile int sendTrace;
@@ -2396,6 +2401,7 @@
#define futureSpace() GIV(futureSpace)
#define futureSurvivorStart() GIV(futureSurvivorStart)
#define pastSpace() GIV(pastSpace)
+#define rememberedSetLimit() GIV(rememberedSetLimit)
#define rememberedSetSize() GIV(rememberedSetSize)
#define endOfMemory() GIV(endOfMemory)
#define freeStart() GIV(freeStart)
@@ -2403,6 +2409,8 @@
#define newSpaceLimit() GIV(newSpaceLimit)
#define oldSpaceStart() GIV(oldSpaceStart)
#define remapBufferCount() GIV(remapBufferCount)
+#define rootTableCapacity() GIV(rememberedSetLimit)
+#define rootTableCount() GIV(rememberedSetSize)
#define numSegments() GIV(numSegments)
#define checkAllocFiller() GIV(checkAllocFiller)
#define dispatchFunctionPointer(aFunctionPointer) (aFunctionPointer)()
@@ -41270,6 +41278,68 @@
}
static sqInt
+allNewSpaceObjectsHaveZeroRTRefCount(void)
+{ DECL_MAYBE_SQ_GLOBAL_STRUCT
+ sqInt address;
+ sqInt address1;
+ sqInt limit;
+ usqInt numSlots;
+ usqInt numSlots1;
+ sqInt obj;
+ sqInt objOop;
+ sqInt objOop1;
+ sqInt prevObj;
+ sqInt prevPrevObj;
+
+ /* begin allNewSpaceObjectsDo: */
+ /* begin allNewSpaceEntitiesDo: */
+
+ /* After a scavenge eden is empty, futureSpace is empty, and all newSpace objects are
+ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
+
+ prevPrevObj = (prevObj = null);
+ assert((((pastSpace()).start)) < (((eden()).start)));
+ /* begin objectStartingAt: */
+ address = ((pastSpace()).start);
+ numSlots = byteAt(address + 7);
+ objOop1 = (numSlots == 0xFF
+ ? address + BaseHeaderSize
+ : address);
+ limit = GIV(pastSpaceStart);
+ while ((((usqInt) objOop1)) < (((usqInt) limit))) {
+ assert(isEnumerableObjectNoAssert(objOop1));
+ if (((((usqInt) (longAt(objOop1))) >> 29) & MaxRTRefCount) > 0) {
+ return 0;
+ }
+
+
+ prevPrevObj = prevObj;
+ prevObj = objOop1;
+ objOop1 = objectAfterlimit(objOop1, limit);
+ }
+ /* begin objectStartingAt: */
+ address1 = ((eden()).start);
+ numSlots1 = byteAt(address1 + 7);
+ objOop1 = (numSlots1 == 0xFF
+ ? address1 + BaseHeaderSize
+ : address1);
+ while ((((usqInt) objOop1)) < (((usqInt) GIV(freeStart)))) {
+ assert(isEnumerableObjectNoAssert(objOop1));
+ if (((((usqInt) (longAt(objOop1))) >> 29) & MaxRTRefCount) > 0) {
+ return 0;
+ }
+
+
+ prevPrevObj = prevObj;
+ prevObj = objOop1;
+ objOop1 = objectAfterlimit(objOop1, GIV(freeStart));
+ }
+
+
+ return 1;
+}
+
+static sqInt
allWeakSurvivorsOnWeakList(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt address;
@@ -41304,6 +41374,97 @@
}
+/* Some time in every scavenger's life there may come a time when someone
+ writes code that stresses
+ the remembered table. One might conclude that if the remembered table is
+ full, then the right thing
+ to do is simply to tenure everything, emptying the remembered table. Bt in
+ some circumstances this
+ can be counter-productive, and result in the same situation arising soon
+ after tenuring everything.
+ Instead, we can try and selectively prune the remembered table, tenuring
+ only those objects that
+ are referenced by many objects in the remembered table. That's what this
+ algorithm does. It
+ reference counts young objects referenced from the remembered set, and
+ then sets a threshold
+ used to tenure objects oft referenced from the remembered set, thereby
+ allowing the remembered
+ set to shrink, while not tenuring everything.
+
+ Once in a network monitoring application in a galaxy not dissimilar from
+ the one this code inhabits,
+ a tree of nodes referring to large integers was in precisely this
+ situation. The nodes were old, and
+ the integers were in new space. Some of the nodes referred to shared
+ numbers, some their own
+ unique numbers. The numbers were updated frequently. Were new space simply
+ tenured when the
+ remembered table was full, the remembered table would soon fill up as new
+ numbers were computed.
+ Only by selectively pruning the remembered table of nodes that shared
+ data, was a balance achieved
+ whereby the remembered table population was kept small, and tenuring rates
+ were low. */
+
+static void
+computeRefCountToShrinkRT(void)
+{ DECL_MAYBE_SQ_GLOBAL_STRUCT
+ sqInt count;
+ sqInt elephant;
+ sqInt entirePopulation;
+ sqInt header;
+ sqInt i;
+ sqInt i1;
+ sqInt j;
+ sqInt j1;
+ sqInt jLimiT;
+ long population[MaxRTRefCount + 1];
+ sqInt refCount;
+ sqInt referent;
+
+ memset(population, 0, (sizeof(long)) * (MaxRTRefCount + 1));
+ assert(allNewSpaceObjectsHaveZeroRTRefCount());
+ /* begin referenceCountRememberedReferents: */
+ for (i1 = 0; i1 < GIV(rememberedSetSize); i1 += 1) {
+ elephant = GIV(rememberedSet)[i1];
+ for (j1 = 0, jLimiT = ((numPointerSlotsOf(elephant)) - 1); j1 <= jLimiT; j1 += 1) {
+ referent = longAt((elephant + BaseHeaderSize) + (j1 << (shiftForWord())));
+ if (((referent & 3) == 0)
+ && (isReallyYoungObject(referent))) {
+ refCount = (((usqInt) (longAt(referent))) >> 29) & MaxRTRefCount;
+ if (refCount < MaxRTRefCount) {
+ if (refCount > 0) {
+ population[refCount] = ((population[refCount]) - 1);
+ }
+ refCount += 1;
+ /* begin rtRefCountOf:put: */
+ assert(((refCount >= 0) && (refCount <= MaxRTRefCount)));
+ header = longAt(referent);
+ header = header & ((unsigned int)~(7 << 29));
+ header += refCount << 29;
+ longAtput(referent, header);
+ population[refCount] = ((population[refCount]) + 1);
+ }
+ }
+ }
+ }
+ /* begin setRefCountToShrinkRT: */
+ assert((population[0]) == 0);
+ entirePopulation = 0;
+ for (j = 1; j <= MaxRTRefCount; j += 1) {
+ entirePopulation += population[j];
+ }
+ count = 0;
+ i = MaxRTRefCount + 1;
+ while ((count < (entirePopulation / 2))
+ && (((i -= 1)) >= 0)) {
+ count += population[i];
+ }
+ GIV(refCountToShrinkRT) = ((i < 0) ? 0 : i);
+}
+
+
/* copyAndForward: survivor copies a survivor object either to
futureSurvivorSpace or, if it is to be promoted, to oldSpace.
It leaves a forwarding pointer behind. If the object is weak
@@ -41314,13 +41475,10 @@
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
usqInt bytesInObj;
sqInt format;
+ sqInt header;
sqInt newLocation;
- sqInt newOop;
sqInt newStart;
- sqInt newStart1;
- sqInt nTenures;
sqInt startOfSurvivor;
- sqInt startOfSurvivor1;
sqInt tenure;
assert((isInEden(survivor))
@@ -41340,9 +41498,8 @@
tenure = ((longAt(survivor)) & 0x3FFFFF) == GIV(tenuringClassIndex);
break;
- case DontTenureButDoUnmark:
- setIsMarkedOfto(survivor, 0);
- tenure = 0;
+ case TenureToShrinkRT:
+ tenure = ((((usqInt) (longAt(survivor))) >> 29) & MaxRTRefCount) >= GIV(refCountToShrinkRT);
break;
default:
@@ -41351,46 +41508,26 @@
}
if (tenure
|| ((GIV(futureSurvivorStart) + bytesInObj) > ((GIV(futureSpace).limit)))) {
- /* begin copyToOldSpace:bytes:format: */
- assert((format == (formatOf(survivor)))
- && (((!(isMarked(survivor)))
- || (GIV(tenureCriterion) == MarkOnTenure))
- && ((!(isPinned(survivor)))
- && (!(isRemembered(survivor))))));
- nTenures = GIV(statTenures);
- startOfSurvivor = ((byteAt(survivor + 7)) == 0xFF
- ? survivor - BaseHeaderSize
- : survivor);
- newStart = allocateOldSpaceChunkOfBytes(bytesInObj);
- if (!(newStart)) {
- growOldSpaceByAtLeast(0);
- newStart = allocateOldSpaceChunkOfBytes(bytesInObj);
- if (!(newStart)) {
- error("out of memory");
- }
- }
- memcpy(((void *)newStart), ((void *)startOfSurvivor), bytesInObj);
- newOop = newStart + (survivor - startOfSurvivor);
- if ((format <= 5)
- || (format >= 24)) {
- remember(newOop);
- }
- if (GIV(tenureCriterion) == MarkOnTenure) {
- setIsMarkedOfto(newOop, 1);
- }
- GIV(statTenures) = nTenures + 1;
- newLocation = newOop;
+ newLocation = copyToOldSpacebytesformat(survivor, bytesInObj, format);
}
else {
/* begin copyToFutureSpace:bytes: */
assert((GIV(futureSurvivorStart) + bytesInObj) <= ((GIV(futureSpace).limit)));
- startOfSurvivor1 = ((byteAt(survivor + 7)) == 0xFF
+ startOfSurvivor = ((byteAt(survivor + 7)) == 0xFF
? survivor - BaseHeaderSize
: survivor);
- newStart1 = GIV(futureSurvivorStart);
+ newStart = GIV(futureSurvivorStart);
GIV(futureSurvivorStart) += bytesInObj;
- memcpy(((void *)newStart1), ((void *)startOfSurvivor1), bytesInObj);
- newLocation = newStart1 + (survivor - startOfSurvivor1);
+ memcpy(((void *)newStart), ((void *)startOfSurvivor), bytesInObj);
+ if (GIV(tenureCriterion) == TenureToShrinkRT) {
+ /* begin rtRefCountOf:put: */
+ assert(((0 >= 0) && (0 <= MaxRTRefCount)));
+ header = longAt(newStart + (survivor - startOfSurvivor));
+ header = header & ((unsigned int)~(7 << 29));
+ header += 0 << 29;
+ longAtput(newStart + (survivor - startOfSurvivor), header);
+ }
+ newLocation = newStart + (survivor - startOfSurvivor);
}
/* begin forwardSurvivor:to: */
assert(isInNewSpace(survivor));
@@ -41414,7 +41551,77 @@
return newLocation;
}
+
+/* Copy survivor to oldSpace. Answer the new oop of the object. */
+/* Should be too infrequent to lower icache density of copyAndForward: */
+
static sqInt
+copyToOldSpacebytesformat(sqInt survivor, sqInt bytesInObject, sqInt formatOfSurvivor)
+{ DECL_MAYBE_SQ_GLOBAL_STRUCT
+ sqInt field;
+ sqInt header;
+ sqInt newOop;
+ sqInt newStart;
+ sqInt nTenures;
+ sqInt p;
+ sqInt startOfSurvivor;
+
+ assert((formatOfSurvivor == (formatOf(survivor)))
+ && (((!(isMarked(survivor)))
+ || (GIV(tenureCriterion) == MarkOnTenure))
+ && ((GIV(tenureCriterion) == TenureToShrinkRT)
+ || ((!(isPinned(survivor)))
+ && (!(isRemembered(survivor)))))));
+ nTenures = GIV(statTenures);
+ startOfSurvivor = ((byteAt(survivor + 7)) == 0xFF
+ ? survivor - BaseHeaderSize
+ : survivor);
+ newStart = allocateOldSpaceChunkOfBytes(bytesInObject);
+ if (!(newStart)) {
+ growOldSpaceByAtLeast(0);
+ newStart = allocateOldSpaceChunkOfBytes(bytesInObject);
+ if (!(newStart)) {
+ error("out of memory");
+ }
+ }
+ memcpy(((void *)newStart), ((void *)startOfSurvivor), bytesInObject);
+ newOop = newStart + (survivor - startOfSurvivor);
+ if (GIV(tenureCriterion) >= (((TenureToShrinkRT < MarkOnTenure) ? TenureToShrinkRT : MarkOnTenure))) {
+ if (GIV(tenureCriterion) == TenureToShrinkRT) {
+ /* begin rtRefCountOf:put: */
+ assert(((0 >= 0) && (0 <= MaxRTRefCount)));
+ header = longAt(newOop);
+ header = header & ((unsigned int)~(7 << 29));
+ header += 0 << 29;
+ longAtput(newOop, header);
+ }
+ if (GIV(tenureCriterion) == MarkOnTenure) {
+ setIsMarkedOfto(newOop, 1);
+ }
+ }
+ GIV(statTenures) = nTenures + 1;
+ if ((formatOfSurvivor <= 5)
+ || (formatOfSurvivor >= 24)) {
+
+ /* A very quick and dirty scan to find young referents. If we misidentify bytes
+ in a CompiledMethod as young we don't care; it's unlikely, and a subsequent
+ scan of the rt will filter the object out. But it's good to filter here because
+ otherwise an attempt to shrink the RT may simply fill it up with new objects,
+ and here the data is likely in the cache. */
+
+ for (p = BaseHeaderSize; p <= ((bytesInObject - (survivor - startOfSurvivor)) - BytesPerWord); p += BytesPerWord) {
+ field = longAt(survivor + p);
+ if (((field & 3) == 0)
+ && (isReallyYoungObject(field))) {
+ remember(newOop);
+ return newOop;
+ }
+ }
+ }
+ return newOop;
+}
+
+static sqInt
firstCorpse(sqInt headOfCorpseList)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
return ((headOfCorpseList - 1) << 3) + GIV(newSpaceStart);
@@ -41424,10 +41631,12 @@
growRememberedSet(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt *base;
+ sqInt fudge;
sqInt i;
sqInt newObj;
usqInt numSlots;
usqInt numSlots1;
+ usqInt numSlots2;
sqInt obj;
sqInt obj1;
sqInt obj2;
@@ -41496,8 +41705,16 @@
}
freeObject(obj);
GIV(rememberedSet) = base;
- GIV(rememberedSetLimit) = numSlots * 2;
- GIV(rememberedSetRedZone) = ((GIV(rememberedSetLimit) * 3) + 3) / 4;
+ /* begin numSlotsOf: */
+ flag("endianness");
+ assert((classIndexOf(newObj)) > (isForwardedObjectClassIndexPun()));
+ numSlots2 = byteAt(newObj + 7);
+ GIV(rememberedSetLimit) = ((usqInt) ((numSlots2 == 0xFF
+ ? longAt(newObj - BaseHeaderSize)
+ : numSlots2)));
+ /* begin setRememberedSetRedZone */
+ fudge = ((((GIV(eden).limit)) - ((GIV(eden).start))) / BytesPerWord) / 1024;
+ GIV(rememberedSetRedZone) = ((((GIV(rememberedSetLimit) * 3) / 4) < fudge) ? fudge : ((GIV(rememberedSetLimit) * 3) / 4));
}
static sqInt
@@ -46377,6 +46594,12 @@
GIV(scavengeInProgress) = 1;
/* begin scavenge: */
GIV(tenureCriterion) = tenuringCriterion;
+ /* begin strategizeToLimitRememberedTable */
+ if ((GIV(tenureCriterion) == TenureByAge)
+ && (GIV(rememberedSetSize) >= GIV(rememberedSetRedZone))) {
+ GIV(tenureCriterion) = TenureToShrinkRT;
+ computeRefCountToShrinkRT();
+ }
scavengeLoop();
processWeaklings();
/* begin computeTenuringThreshold */
@@ -48701,6 +48924,7 @@
sqInt freeChunk;
sqInt freeListObj;
usqLong freeOldStart;
+ sqInt fudge;
sqInt i;
sqInt i1;
sqInt i2;
@@ -48910,7 +49134,9 @@
GIV(rememberedSetLimit) = ((usqInt) ((numSlots == 0xFF
? longAt(obj - BaseHeaderSize)
: numSlots)));
- GIV(rememberedSetRedZone) = ((GIV(rememberedSetLimit) * 3) + 3) / 4;
+ /* begin setRememberedSetRedZone */
+ fudge = ((((GIV(eden).limit)) - ((GIV(eden).start))) / BytesPerWord) / 1024;
+ GIV(rememberedSetRedZone) = ((((GIV(rememberedSetLimit) * 3) / 4) < fudge) ? fudge : ((GIV(rememberedSetLimit) * 3) / 4));
checkSegments();
/* These defaults should depend on machine size; e.g. too small on a powerful laptop, too big on a Pi. */
@@ -77965,7 +78191,7 @@
longAtput((result + BaseHeaderSize) + (i << (shiftForWord())), ConstZero);
}
/* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer9 = (((rememberedSetSize()) << 1) | 1);
+ valuePointer9 = (((rootTableCount()) << 1) | 1);
assert(!(isForwarded(result)));
longAtput((result + BaseHeaderSize) + (20 << (shiftForWord())), valuePointer9);
/* begin storePointerUnchecked:ofObject:withValue: */
@@ -78065,7 +78291,7 @@
assert(!(isForwarded(result)));
longAtput((result + BaseHeaderSize) + (48 << (shiftForWord())), valuePointer16);
/* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer17 = (((numSlotsOf(longAt((GIV(hiddenRootsObj) + BaseHeaderSize) + (RememberedSetRootIndex << (shiftForWord()))))) << 1) | 1);
+ valuePointer17 = (((rootTableCapacity()) << 1) | 1);
assert(!(isForwarded(result)));
longAtput((result + BaseHeaderSize) + (51 << (shiftForWord())), valuePointer17);
/* begin storePointerUnchecked:ofObject:withValue: */
@@ -78282,7 +78508,7 @@
result = ConstZero;
}
if (arg == 21) {
- result = (((rememberedSetSize()) << 1) | 1);
+ result = (((rootTableCount()) << 1) | 1);
}
if (arg == 22) {
result = ((GIV(statRootTableOverflows) << 1) | 1);
@@ -78380,7 +78606,7 @@
result = (((ioGetMaxExtSemTableSize()) << 1) | 1);
}
if (arg == 52) {
- result = (((numSlotsOf(longAt((GIV(hiddenRootsObj) + BaseHeaderSize) + (RememberedSetRootIndex << (shiftForWord()))))) << 1) | 1);
+ result = (((rootTableCapacity()) << 1) | 1);
}
if ((arg == 53)
&& (1)) {
Modified: branches/Glue/nsspursrc/vm/cointerp.h
===================================================================
--- branches/Glue/nsspursrc/vm/cointerp.h 2015-05-06 19:25:17 UTC (rev 3320)
+++ branches/Glue/nsspursrc/vm/cointerp.h 2015-05-06 21:11:38 UTC (rev 3321)
@@ -1,5 +1,5 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1034 uuid: 1a93b31c-cf2c-4a2c-b53f-9eae1d7863c7
+ CCodeGeneratorGlobalStructure VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
*/
Modified: branches/Glue/nsspursrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Glue/nsspursrc/vm/gcc3x-cointerp.c 2015-05-06 19:25:17 UTC (rev 3320)
+++ branches/Glue/nsspursrc/vm/gcc3x-cointerp.c 2015-05-06 21:11:38 UTC (rev 3321)
@@ -2,11 +2,11 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1034 uuid: 1a93b31c-cf2c-4a2c-b53f-9eae1d7863c7
+ CCodeGeneratorGlobalStructure VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
from
- CoInterpreter VMMaker.oscog-eem.1034 uuid: 1a93b31c-cf2c-4a2c-b53f-9eae1d7863c7
+ CoInterpreter VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba
*/
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1034 uuid: 1a93b31c-cf2c-4a2c-b53f-9eae1d7863c7 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscogglue-eem.1036 uuid: 054ce1b0-7472-4245-98f8-cb91bbcf5cba " __DATE__ ;
char *__interpBuildInfo = __buildInfo;
@@ -212,7 +212,6 @@
#define CSWait 10
#define CSYield 11
#define CtxtTempFrameStart 6
-#define DontTenureButDoUnmark 4
#define DumpStackOnLowSpace 0
#define EnclosingMixinIndex 3
#define EnclosingObjectIndex 4
@@ -255,6 +254,7 @@
#define MaxLiteralCountForCompile 60
#define MaxPrimitiveIndex 575
#define MaxQuickPrimitiveIndex 519
+#define MaxRTRefCount 7
#define MessageArgumentsIndex 1
#define MessageLookupClassIndex 2
#define MessageSelectorIndex 0
@@ -346,6 +346,7 @@
#define SuspendedContextIndex 1
#define TenureByAge 1
#define TenureByClass 2
+#define TenureToShrinkRT 3
#define TheDisplay 14
#define TheFinalizationSemaphore 41
#define TheInputSemaphore null
@@ -840,8 +841,11 @@
static sqInt wordIndexableFormat(void);
static void addToEphemeronList(sqInt ephemeronCorpse) NoDbgRegParms;
static void addToWeakList(sqInt weakCorpse) NoDbgRegParms;
+static sqInt allNewSpaceObjectsHaveZeroRTRefCount(void);
static sqInt allWeakSurvivorsOnWeakList(void);
+static void computeRefCountToShrinkRT(void) NeverInline;
static sqInt copyAndForward(sqInt survivor) NoDbgRegParms;
+static sqInt copyToOldSpacebytesformat(sqInt survivor, sqInt bytesInObject, sqInt formatOfSurvivor) NoDbgRegParms NeverInline;
static sqInt firstCorpse(sqInt headOfCorpseList) NoDbgRegParms;
static void growRememberedSet(void);
static sqInt isInRememberedSet(sqInt objOop) NoDbgRegParms;
@@ -1560,8 +1564,8 @@
_iss usqInt scavengeThreshold;
_iss sqInt remapBufferCount;
_iss sqInt * freeLists;
+_iss sqInt rememberedSetSize;
_iss char * stackLimit;
-_iss sqInt rememberedSetSize;
_iss sqInt tempOop;
_iss sqInt * rememberedSet;
_iss sqInt classTableFirstPage;
@@ -1585,10 +1589,10 @@
_iss sqLong nextProfileTick;
_iss sqInt numRememberedEphemerons;
_iss sqInt jmpDepth;
+_iss SpurNewSpaceSpace eden;
_iss sqInt futureSurvivorStart;
_iss char * objStackInvalidBecause;
_iss usqInt lastFreeChunk;
-_iss SpurNewSpaceSpace eden;
_iss sqInt ephemeronList;
_iss usqInt freeOldSpaceStart;
_iss sqInt tenureThreshold;
@@ -1599,6 +1603,7 @@
_iss sqInt classNameIndex;
_iss sqInt growHeadroom;
_iss sqInt ephemeronQueue;
+_iss sqInt tenureCriterion;
_iss sqInt lastMethodCacheProbeWrite;
_iss sqInt metaclassNumSlots;
_iss sqInt preemptionYields;
@@ -1625,6 +1630,7 @@
_iss sqInt noThreadingOfGUIThread;
_iss sqInt pendingFinalizationSignals;
_iss sqInt processHasThreadId;
+_iss sqInt rememberedSetLimit;
_iss sqInt shrinkThreshold;
_iss usqLong statIOProcessEvents;
_iss sqInt lastHash;
@@ -1632,9 +1638,7 @@
_iss sqInt marking;
_iss usqInt memory;
_iss sqInt numCompactionPasses;
-_iss sqInt rememberedSetLimit;
_iss sqInt scavengeInProgress;
-_iss sqInt tenureCriterion;
_iss sqInt fullScreenFlag;
_iss float heapGrowthToSizeGCRatio;
_iss usqInt heapSizeAtPreviousGC;
@@ -1642,6 +1646,7 @@
_iss sqInt interruptPending;
_iss sqInt methodDictLinearSearchLimit;
_iss usqLong nextPollUsecs;
+_iss sqInt rememberedSetRedZone;
_iss sqInt statCompactPassCount;
_iss usqLong statForceInterruptCheck;
_iss usqLong statFullGCUsecs;
@@ -1661,7 +1666,6 @@
_iss sqInt imageFloatsBigEndian;
_iss sqInt longRunningPrimitiveSignalUndelivered;
_iss sqInt maxExtSemTabSizeSet;
-_iss sqInt rememberedSetRedZone;
_iss sqInt savedWindowSize;
_iss sqInt signalLowSpace;
_iss sqInt statCodeCompactionCount;
@@ -1675,6 +1679,7 @@
_iss usqLong longRunningPrimitiveGCUsecs;
_iss sqInt overflowLimit;
_iss StackPage * overflowedPage;
+_iss sqInt refCountToShrinkRT;
_iss sqInt statCoalesces;
_iss usqLong statIGCDeltaUsecs;
_iss usqLong statIncrGCUsecs;
@@ -2356,7 +2361,7 @@
/*560*/ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0,-1,-1
};
char expensiveAsserts = 0;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1034";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscogglue-eem.1036";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
volatile int sendTrace;
@@ -2399,6 +2404,7 @@
#define futureSpace() GIV(futureSpace)
#define futureSurvivorStart() GIV(futureSurvivorStart)
#define pastSpace() GIV(pastSpace)
+#define rememberedSetLimit() GIV(rememberedSetLimit)
#define rememberedSetSize() GIV(rememberedSetSize)
#define endOfMemory() GIV(endOfMemory)
#define freeStart() GIV(freeStart)
@@ -2406,6 +2412,8 @@
#define newSpaceLimit() GIV(newSpaceLimit)
#define oldSpaceStart() GIV(oldSpaceStart)
#define remapBufferCount() GIV(remapBufferCount)
+#define rootTableCapacity() GIV(rememberedSetLimit)
+#define rootTableCount() GIV(rememberedSetSize)
#define numSegments() GIV(numSegments)
#define checkAllocFiller() GIV(checkAllocFiller)
#define dispatchFunctionPointer(aFunctionPointer) (aFunctionPointer)()
@@ -41279,6 +41287,68 @@
}
static sqInt
+allNewSpaceObjectsHaveZeroRTRefCount(void)
+{ DECL_MAYBE_SQ_GLOBAL_STRUCT
+ sqInt address;
+ sqInt address1;
+ sqInt limit;
+ usqInt numSlots;
+ usqInt numSlots1;
+ sqInt obj;
+ sqInt objOop;
+ sqInt objOop1;
+ sqInt prevObj;
+ sqInt prevPrevObj;
+
+ /* begin allNewSpaceObjectsDo: */
+ /* begin allNewSpaceEntitiesDo: */
+
+ /* After a scavenge eden is empty, futureSpace is empty, and all newSpace objects are
+ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
+
+ prevPrevObj = (prevObj = null);
+ assert((((pastSpace()).start)) < (((eden()).start)));
+ /* begin objectStartingAt: */
+ address = ((pastSpace()).start);
+ numSlots = byteAt(address + 7);
+ objOop1 = (numSlots == 0xFF
+ ? address + BaseHeaderSize
+ : address);
+ limit = GIV(pastSpaceStart);
+ while ((((usqInt) objOop1)) < (((usqInt) limit))) {
+ assert(isEnumerableObjectNoAssert(objOop1));
+ if (((((usqInt) (longAt(objOop1))) >> 29) & MaxRTRefCount) > 0) {
+ return 0;
+ }
+
+
+ prevPrevObj = prevObj;
+ prevObj = objOop1;
+ objOop1 = objectAfterlimit(objOop1, limit);
+ }
+ /* begin objectStartingAt: */
+ address1 = ((eden()).start);
+ numSlots1 = byteAt(address1 + 7);
+ objOop1 = (numSlots1 == 0xFF
+ ? address1 + BaseHeaderSize
+ : address1);
+ while ((((usqInt) objOop1)) < (((usqInt) GIV(freeStart)))) {
+ assert(isEnumerableObjectNoAssert(objOop1));
+ if (((((usqInt) (longAt(objOop1))) >> 29) & MaxRTRefCount) > 0) {
+ return 0;
+ }
+
+
+ prevPrevObj = prevObj;
+ prevObj = objOop1;
+ objOop1 = objectAfterlimit(objOop1, GIV(freeStart));
+ }
+
+
+ return 1;
+}
+
+static sqInt
allWeakSurvivorsOnWeakList(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt address;
@@ -41313,6 +41383,97 @@
}
+/* Some time in every scavenger's life there may come a time when someone
+ writes code that stresses
+ the remembered table. One might conclude that if the remembered table is
+ full, then the right thing
+ to do is simply to tenure everything, emptying the remembered table. Bt in
+ some circumstances this
+ can be counter-productive, and result in the same situation arising soon
+ after tenuring everything.
+ Instead, we can try and selectively prune the remembered table, tenuring
+ only those objects that
+ are referenced by many objects in the remembered table. That's what this
+ algorithm does. It
+ reference counts young objects referenced from the remembered set, and
+ then sets a threshold
+ used to tenure objects oft referenced from the remembered set, thereby
+ allowing the remembered
+ set to shrink, while not tenuring everything.
+
+ Once in a network monitoring application in a galaxy not dissimilar from
+ the one this code inhabits,
+ a tree of nodes referring to large integers was in precisely this
+ situation. The nodes were old, and
+ the integers were in new space. Some of the nodes referred to shared
+ numbers, some their own
+ unique numbers. The numbers were updated frequently. Were new space simply
+ tenured when the
+ remembered table was full, the remembered table would soon fill up as new
+ numbers were computed.
+ Only by selectively pruning the remembered table of nodes that shared
+ data, was a balance achieved
+ whereby the remembered table population was kept small, and tenuring rates
+ were low. */
+
+static void
+computeRefCountToShrinkRT(void)
+{ DECL_MAYBE_SQ_GLOBAL_STRUCT
+ sqInt count;
+ sqInt elephant;
+ sqInt entirePopulation;
+ sqInt header;
+ sqInt i;
+ sqInt i1;
+ sqInt j;
+ sqInt j1;
+ sqInt jLimiT;
+ long population[MaxRTRefCount + 1];
+ sqInt refCount;
+ sqInt referent;
+
+ memset(population, 0, (sizeof(long)) * (MaxRTRefCount + 1));
+ assert(allNewSpaceObjectsHaveZeroRTRefCount());
+ /* begin referenceCountRememberedReferents: */
+ for (i1 = 0; i1 < GIV(rememberedSetSize); i1 += 1) {
+ elephant = GIV(rememberedSet)[i1];
+ for (j1 = 0, jLimiT = ((numPointerSlotsOf(elephant)) - 1); j1 <= jLimiT; j1 += 1) {
+ referent = longAt((elephant + BaseHeaderSize) + (j1 << (shiftForWord())));
+ if (((referent & 3) == 0)
+ && (isReallyYoungObject(referent))) {
+ refCount = (((usqInt) (longAt(referent))) >> 29) & MaxRTRefCount;
+ if (refCount < MaxRTRefCount) {
+ if (refCount > 0) {
+ population[refCount] = ((population[refCount]) - 1);
+ }
+ refCount += 1;
+ /* begin rtRefCountOf:put: */
+ assert(((refCount >= 0) && (refCount <= MaxRTRefCount)));
+ header = longAt(referent);
+ header = header & ((unsigned int)~(7 << 29));
+ header += refCount << 29;
+ longAtput(referent, header);
+ population[refCount] = ((population[refCount]) + 1);
+ }
+ }
+ }
+ }
+ /* begin setRefCountToShrinkRT: */
+ assert((population[0]) == 0);
+ entirePopulation = 0;
+ for (j = 1; j <= MaxRTRefCount; j += 1) {
+ entirePopulation += population[j];
+ }
+ count = 0;
+ i = MaxRTRefCount + 1;
+ while ((count < (entirePopulation / 2))
+ && (((i -= 1)) >= 0)) {
+ count += population[i];
+ }
+ GIV(refCountToShrinkRT) = ((i < 0) ? 0 : i);
+}
+
+
/* copyAndForward: survivor copies a survivor object either to
@@ Diff output truncated at 50000 characters. @@
More information about the Vm-dev
mailing list