Skip to content

Commit

Permalink
CogVM source as per VMMaker.oscog-eem.3475
Browse files Browse the repository at this point in the history
Fix bad regression introduced by VMMaker.oscog-eem.3444. Functions that
use their arguments precisely once are better inlined, but incorrectly
if their results are assigned to a variable. Don't simplify incorrectly
in this case. This affects at least sendInvokeCallbackContext which
eliminated the assignment to classTag, causing callbacks  to fail.
  • Loading branch information
eliotmiranda committed Dec 7, 2024
1 parent 2fc2d0c commit cfd1161
Show file tree
Hide file tree
Showing 123 changed files with 3,776 additions and 3,035 deletions.
141 changes: 54 additions & 87 deletions src/plugins/ADPCMCodecPlugin/ADPCMCodecPlugin.c

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/plugins/AioPlugin/AioPlugin.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* Automatically generated by
VMPluginCodeGenerator VMMaker.oscog-eem.3456 uuid: e316760f-1758-4b6b-aa08-f84bc7c44ef3
VMPluginCodeGenerator VMMaker.oscog-eem.3475 uuid: d9ef6856-42d8-4074-bde7-82f1e1d41282
(Compiler-eem.512)
from
UnixAioPlugin VMConstruction-Plugins-AioPlugin.oscog-eem.26 uuid: 9d32c4ef-9646-4ce2-b069-44fe86a2dbfb
*/
Expand Down Expand Up @@ -259,6 +260,8 @@ primitiveAioEnable(void)
|| (fd < 0)) {
return primitiveFail();
}

/* The following is to prevent the need to coerce integers into pointers in clientData */
eventSemaphoreIndices[semaIndex] = semaIndex;
flags = (externalNotification
? AIO_EXT
Expand Down Expand Up @@ -438,9 +441,10 @@ setInterpreter(struct VirtualMachine *anInterpreter)
{
sqInt ok;

interpreterProxy = anInterpreter;

/* This may seem tautological, but in a real plugin it checks that the VM provides
the version the plugin was compiled against which is the version the plugin expects. */
interpreterProxy = anInterpreter;
ok = ((interpreterProxy->majorVersion()) == (VM_PROXY_MAJOR))
&& ((interpreterProxy->minorVersion()) >= (VM_PROXY_MINOR));
if (ok) {
Expand Down
46 changes: 28 additions & 18 deletions src/plugins/AsynchFilePlugin/AsynchFilePlugin.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* Automatically generated by
SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3456 uuid: e316760f-1758-4b6b-aa08-f84bc7c44ef3
SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3475 uuid: d9ef6856-42d8-4074-bde7-82f1e1d41282
(Compiler-eem.512)
from
AsynchFilePlugin VMMaker.oscog-eem.3456 uuid: e316760f-1758-4b6b-aa08-f84bc7c44ef3
AsynchFilePlugin VMMaker.oscog-eem.3475 uuid: d9ef6856-42d8-4074-bde7-82f1e1d41282
*/
static char __buildInfo[] = "AsynchFilePlugin VMMaker.oscog-eem.3456 uuid: e316760f-1758-4b6b-aa08-f84bc7c44ef3 " __DATE__ ;
static char __buildInfo[] = "AsynchFilePlugin VMMaker.oscog-eem.3475 uuid: d9ef6856-42d8-4074-bde7-82f1e1d41282 " __DATE__ ;


#include "config.h"
Expand Down Expand Up @@ -111,7 +112,7 @@ extern sqInt stackValue(sqInt offset);
extern
#endif
struct VirtualMachine* interpreterProxy;
static const char *moduleName = "AsynchFilePlugin VMMaker.oscog-eem.3456 " INT_EXT;
static const char *moduleName = "AsynchFilePlugin VMMaker.oscog-eem.3475 " INT_EXT;
static void * sCOAFfn;


Expand Down Expand Up @@ -150,8 +151,6 @@ EXPORT(sqInt)
moduleUnloaded(char *aModuleName)
{
if (!(strcmp(aModuleName, "SecurityPlugin"))) {

/* The security plugin just shut down. How odd. Zero the function pointer we have into it */
sCOAFfn = 0;
}
return 0;
Expand All @@ -174,7 +173,8 @@ primitiveAsyncFileClose(void)
}
primitiveFailFor(PrimErrBadArgument);
f = null;
l1: /* end asyncFileValueOf: */;
/* end asyncFileValueOf: */
l1:
if (failed()) {
return null;
}
Expand Down Expand Up @@ -205,10 +205,10 @@ primitiveAsyncFileOpen(void)
fileName = firstIndexableField(stackValue(2));
writeFlag = booleanValueOf(stackValue(1));
semaIndex = integerValueOf(semaIndex);
fileNameSize = byteSizeOf(((sqInt)((fileName) - BaseHeaderSize)));

/* If the security plugin can be loaded, use it to check for permission.
If not, assume it's ok */
fileNameSize = byteSizeOf(((sqInt)((fileName) - BaseHeaderSize)));
if (sCOAFfn) {
okToOpen = ((sqInt (*) (char *, sqInt, sqInt)) sCOAFfn)(fileName, fileNameSize, writeFlag);
if (!okToOpen) {
Expand All @@ -225,7 +225,8 @@ primitiveAsyncFileOpen(void)
}
primitiveFailFor(PrimErrBadArgument);
f = null;
l1: /* end asyncFileValueOf: */;
/* end asyncFileValueOf: */
l1:
if (!(failed())) {
asyncFileOpen(f, fileName, fileNameSize, writeFlag, semaIndex);
}
Expand Down Expand Up @@ -268,21 +269,24 @@ primitiveAsyncFileReadResult(void)
}
primitiveFailFor(PrimErrBadArgument);
f = null;
l1: /* end asyncFileValueOf: */;
/* end asyncFileValueOf: */
l1:
count = num;
startIndex = start;
bufferSize = byteSizeOf(buffer);
if (!(isBytes(buffer))) {

/* covert word counts to byte counts */
scaleFactor = bytesPerElement(buffer);
count = count * scaleFactor;
startIndex = ((startIndex - 1) * scaleFactor) + 1;
}

/* covert word counts to byte counts */
if (!((startIndex >= 1)
&& (((startIndex + count) - 1) <= bufferSize))) {
return primitiveFailFor(PrimErrBadIndex);
}

/* adjust for zero-origin indexing */
bufferPtr = ((((char *) (firstIndexableField(buffer)))) + startIndex) - 1;
r = asyncFileReadResult(f, bufferPtr, count);
if (!(failed())) {
Expand Down Expand Up @@ -316,7 +320,8 @@ primitiveAsyncFileReadStart(void)
}
primitiveFailFor(PrimErrBadArgument);
f = null;
l1: /* end asyncFileValueOf: */;
/* end asyncFileValueOf: */
l1:
if (failed()) {
return null;
}
Expand Down Expand Up @@ -345,7 +350,8 @@ primitiveAsyncFileWriteResult(void)
}
primitiveFailFor(PrimErrBadArgument);
f = null;
l1: /* end asyncFileValueOf: */;
/* end asyncFileValueOf: */
l1:
if (failed()) {
return null;
}
Expand Down Expand Up @@ -391,21 +397,24 @@ primitiveAsyncFileWriteStart(void)
}
primitiveFailFor(PrimErrBadArgument);
f = null;
l1: /* end asyncFileValueOf: */;
/* end asyncFileValueOf: */
l1:
count = num;
startIndex = start;
bufferSize = byteSizeOf(buffer);
if (!(isBytes(buffer))) {

/* covert word counts to byte counts */
scaleFactor = bytesPerElement(buffer);
count = count * scaleFactor;
startIndex = ((startIndex - 1) * scaleFactor) + 1;
}

/* covert word counts to byte counts */
if (!((startIndex >= 1)
&& (((startIndex + count) - 1) <= bufferSize))) {
return primitiveFailFor(PrimErrBadIndex);
}

/* adjust for zero-origin indexing */
bufferPtr = ((((char *) (firstIndexableField(buffer)))) + startIndex) - 1;
asyncFileWriteStart(f, fPosition, bufferPtr, count);
if (!(failed())) {
Expand All @@ -423,9 +432,10 @@ setInterpreter(struct VirtualMachine *anInterpreter)
{
sqInt ok;

interpreterProxy = anInterpreter;

/* This may seem tautological, but in a real plugin it checks that the VM provides
the version the plugin was compiled against which is the version the plugin expects. */
interpreterProxy = anInterpreter;
ok = ((interpreterProxy->majorVersion()) == (VM_PROXY_MAJOR))
&& ((interpreterProxy->minorVersion()) >= (VM_PROXY_MINOR));
if (ok) {
Expand Down
Loading

0 comments on commit cfd1161

Please sign in to comment.