Skip to content

Commit

Permalink
CogVM source as per VMMaker.oscog-mt.3362 [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
marceltaeumel committed Apr 16, 2024
1 parent 1b153ff commit 8e5c04d
Show file tree
Hide file tree
Showing 57 changed files with 5,149 additions and 3,917 deletions.
81 changes: 24 additions & 57 deletions src/plugins/FilePlugin/FilePlugin.c
@@ -1,9 +1,9 @@
/* Automatically generated by
VMPluginCodeGenerator VMMaker.oscog-eem.3349 uuid: 09001547-129a-4b6b-9fed-ccdd6790c8f4
VMPluginCodeGenerator VMMaker.oscog-mt.3362 uuid: b8f74e14-6430-924d-93fb-2fc1cd50ba34
from
FilePlugin VMMaker.oscog-eem.3349 uuid: 09001547-129a-4b6b-9fed-ccdd6790c8f4
FilePlugin VMMaker.oscog-mt.3362 uuid: b8f74e14-6430-924d-93fb-2fc1cd50ba34
*/
static char __buildInfo[] = "FilePlugin VMMaker.oscog-eem.3349 uuid: 09001547-129a-4b6b-9fed-ccdd6790c8f4 " __DATE__ ;
static char __buildInfo[] = "FilePlugin VMMaker.oscog-mt.3362 uuid: b8f74e14-6430-924d-93fb-2fc1cd50ba34 " __DATE__ ;


#include "config.h"
Expand Down Expand Up @@ -99,7 +99,7 @@ static sqInt (*characterTable)(void);
static sqInt (*classArray)(void);
static sqInt (*classByteArray)(void);
static sqInt (*classString)(void);
static sqInt (*disownVM)(sqInt flags);
static void * (*disownVM)(sqInt flags);
static sqInt (*failed)(void);
static sqInt (*falseObject)(void);
static sqInt (*fetchPointerofObject)(sqInt index, sqInt oop);
Expand All @@ -121,8 +121,7 @@ static sqInt (*methodReturnBool)(sqInt boolean);
static sqInt (*methodReturnInteger)(sqInt integer);
static sqInt (*methodReturnValue)(sqInt oop);
static sqInt (*nilObject)(void);
static sqInt (*ownVM)(sqInt flags);
static sqInt (*pinObject)(sqInt anObject);
static sqInt (*ownVM)(void *handle);
static sqInt (*pop)(sqInt nItems);
static sqInt (*popthenPush)(sqInt nItems, sqInt oop);
static sqInt (*popRemappableOop)(void);
Expand All @@ -143,7 +142,6 @@ static sqInt (*storePointerofObjectwithValue)(sqInt index, sqInt oop, sqInt valu
static void (*tenuringIncrementalGC)(void);
static sqInt (*topRemappableOop)(void);
static sqInt (*trueObject)(void);
static sqInt (*unpinObject)(sqInt anObject);
#else /* !defined(SQUEAK_BUILTIN_PLUGIN) */
extern sqInt booleanValueOf(sqInt obj);
extern sqInt byteSizeOf(sqInt oop);
Expand All @@ -156,7 +154,7 @@ extern sqInt characterTable(void);
extern sqInt classArray(void);
extern sqInt classByteArray(void);
extern sqInt classString(void);
extern sqInt disownVM(sqInt flags);
extern void * disownVM(sqInt flags);
extern sqInt failed(void);
extern sqInt falseObject(void);
extern sqInt fetchPointerofObject(sqInt index, sqInt oop);
Expand All @@ -182,12 +180,7 @@ extern sqInt methodReturnBool(sqInt boolean);
extern sqInt methodReturnInteger(sqInt integer);
extern sqInt methodReturnValue(sqInt oop);
extern sqInt nilObject(void);
extern sqInt ownVM(sqInt flags);
#if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 13)
extern sqInt pinObject(sqInt anObject);
#else
# define pinObject(anObject) 0
#endif
extern sqInt ownVM(void *handle);
extern sqInt pop(sqInt nItems);
extern sqInt popthenPush(sqInt nItems, sqInt oop);
extern sqInt popRemappableOop(void);
Expand All @@ -212,15 +205,10 @@ extern sqInt storePointerofObjectwithValue(sqInt index, sqInt oop, sqInt valuePo
extern void tenuringIncrementalGC(void);
extern sqInt topRemappableOop(void);
extern sqInt trueObject(void);
#if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 13)
extern sqInt unpinObject(sqInt anObject);
#else
# define unpinObject(anObject) 0
#endif
extern
#endif
struct VirtualMachine* interpreterProxy;
static const char *moduleName = "FilePlugin VMMaker.oscog-eem.3349 " INT_EXT;
static const char *moduleName = "FilePlugin VMMaker.oscog-mt.3362 " INT_EXT;
static void * sCCPfn;
static void * sCDFfn;
static void * sCDPfn;
Expand Down Expand Up @@ -1235,8 +1223,7 @@ primitiveFileRead(void)
size_t startIndex;
size_t startIndex1;
size_t startIndex2;
sqInt vmHandle;
sqInt wasPinned;
void *vmHandle;


# if SPURVM
Expand All @@ -1255,6 +1242,7 @@ primitiveFileRead(void)
}
file = firstIndexableField(objectPointer);
l1: /* end fileValueOf: */;
vmHandle = null;
if ((failed())
|| (!(isWordsOrBytes(array)))) {
primitiveFailFor(PrimErrBadArgument);
Expand All @@ -1266,19 +1254,15 @@ primitiveFileRead(void)
primitiveFailFor(PrimErrBadIndex);
goto l2;
}
if (!((wasPinned = isPinned(array)))) {
array = pinObject(array);
}

/* Note: adjust startIndex for zero-origin byte indexing */
vmHandle = disownVM(DisownVMForThreading);
elementSize = (slotSize == 0
? 1
: (byteSizeOf(array)) / slotSize);
if (isPinned(array)) {
vmHandle = disownVM(DisownVMForThreading);
}
bytesRead = sqFileReadIntoAt(file, count * elementSize, ((char *) (firstIndexableField(array))), (startIndex - 1) * elementSize);
ownVM(vmHandle);
if (!wasPinned) {
unpinObject(array);
if (!(vmHandle == null)) {
ownVM(vmHandle);
}
if (!(failed())) {
methodReturnInteger(bytesRead / elementSize);
Expand Down Expand Up @@ -1365,7 +1349,8 @@ primitiveFileRead(void)


/* This version of primitiveFileRead is for garbage collectors that support
pinning and the multi-threaded VM. It actually does the own/disown dance. */
pinning and the multi-threaded VM. It actually does the own/disown dance
if the bytearray is pinned. */

/* FilePlugin>>#primitiveFileReadPinningAndDisowning */
static sqInt
Expand All @@ -1379,8 +1364,7 @@ primitiveFileReadPinningAndDisowning(void)
sqInt objectPointer;
size_t slotSize;
size_t startIndex;
sqInt vmHandle;
sqInt wasPinned;
void *vmHandle;

count = positiveMachineIntegerValueOf(stackValue(0));
startIndex = positiveMachineIntegerValueOf(stackValue(1));
Expand All @@ -1395,6 +1379,7 @@ primitiveFileReadPinningAndDisowning(void)
}
file = firstIndexableField(objectPointer);
l1: /* end fileValueOf: */;
vmHandle = null;
if ((failed())
|| (!(isWordsOrBytes(array)))) {
return primitiveFailFor(PrimErrBadArgument);
Expand All @@ -1404,19 +1389,15 @@ primitiveFileReadPinningAndDisowning(void)
&& (((startIndex + count) - 1) <= slotSize))) {
return primitiveFailFor(PrimErrBadIndex);
}
if (!((wasPinned = isPinned(array)))) {
array = pinObject(array);
}

/* Note: adjust startIndex for zero-origin byte indexing */
vmHandle = disownVM(DisownVMForThreading);
elementSize = (slotSize == 0
? 1
: (byteSizeOf(array)) / slotSize);
if (isPinned(array)) {
vmHandle = disownVM(DisownVMForThreading);
}
bytesRead = sqFileReadIntoAt(file, count * elementSize, ((char *) (firstIndexableField(array))), (startIndex - 1) * elementSize);
ownVM(vmHandle);
if (!wasPinned) {
unpinObject(array);
if (!(vmHandle == null)) {
ownVM(vmHandle);
}
if (!(failed())) {
methodReturnInteger(bytesRead / elementSize);
Expand Down Expand Up @@ -1865,13 +1846,6 @@ setInterpreter(struct VirtualMachine *anInterpreter)
methodReturnValue = interpreterProxy->methodReturnValue;
nilObject = interpreterProxy->nilObject;
ownVM = interpreterProxy->ownVM;
#if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 13)
pinObject = interpreterProxy->pinObject;
#else
#if !defined(pinObject)
pinObject = 0;
#endif
#endif
pop = interpreterProxy->pop;
popthenPush = interpreterProxy->popthenPush;
popRemappableOop = interpreterProxy->popRemappableOop;
Expand All @@ -1898,13 +1872,6 @@ setInterpreter(struct VirtualMachine *anInterpreter)
tenuringIncrementalGC = interpreterProxy->tenuringIncrementalGC;
topRemappableOop = interpreterProxy->topRemappableOop;
trueObject = interpreterProxy->trueObject;
#if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 13)
unpinObject = interpreterProxy->unpinObject;
#else
#if !defined(unpinObject)
unpinObject = 0;
#endif
#endif
#endif /* !defined(SQUEAK_BUILTIN_PLUGIN) */
}
return ok;
Expand Down
46 changes: 42 additions & 4 deletions src/plugins/SocketPlugin/SocketPlugin.c
@@ -1,9 +1,9 @@
/* Automatically generated by
SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3275 uuid: 86b52edc-43a4-467b-9f26-1eec38a0726b
SmartSyntaxPluginCodeGenerator VMMaker.oscog-mt.3362 uuid: b8f74e14-6430-924d-93fb-2fc1cd50ba34
from
SocketPlugin VMMaker.oscog-eem.3275 uuid: 86b52edc-43a4-467b-9f26-1eec38a0726b
SocketPlugin VMMaker.oscog-mt.3362 uuid: b8f74e14-6430-924d-93fb-2fc1cd50ba34
*/
static char __buildInfo[] = "SocketPlugin VMMaker.oscog-eem.3275 uuid: 86b52edc-43a4-467b-9f26-1eec38a0726b " __DATE__ ;
static char __buildInfo[] = "SocketPlugin VMMaker.oscog-mt.3362 uuid: b8f74e14-6430-924d-93fb-2fc1cd50ba34 " __DATE__ ;


#include "config.h"
Expand Down Expand Up @@ -34,6 +34,10 @@ static char __buildInfo[] = "SocketPlugin VMMaker.oscog-eem.3275 uuid: 86b52edc-
#endif


/*** Constants ***/
#define DisownVMForThreading 32


/*** Function Prototypes ***/
EXPORT(const char*) getModuleName(void);
EXPORT(sqInt) initialiseModule(void);
Expand Down Expand Up @@ -113,6 +117,7 @@ static sqInt (*bytesPerElement)(sqInt oop);
static sqInt (*classArray)(void);
static sqInt (*classByteArray)(void);
static sqInt (*classString)(void);
static void * (*disownVM)(sqInt flags);
static sqInt (*failed)(void);
static sqInt (*falseObject)(void);
static void * (*firstIndexableField)(sqInt oop);
Expand All @@ -125,12 +130,14 @@ static sqInt (*isBytes)(sqInt oop);
#if !defined(isIntegerObject)
static sqInt (*isIntegerObject)(sqInt objectPointer);
#endif
static sqInt (*isPinned)(sqInt anObject);
static sqInt (*isWords)(sqInt oop);
static sqInt (*isWordsOrBytes)(sqInt oop);
static sqInt (*methodArgumentCount)(void);
static sqInt (*methodReturnBool)(sqInt boolean);
static sqInt (*methodReturnInteger)(sqInt integer);
static sqInt (*methodReturnValue)(sqInt oop);
static sqInt (*ownVM)(void *handle);
static sqInt (*pop)(sqInt nItems);
static sqInt (*popRemappableOop)(void);
static sqInt (*primitiveFail)(void);
Expand All @@ -152,6 +159,7 @@ extern sqInt bytesPerElement(sqInt oop);
extern sqInt classArray(void);
extern sqInt classByteArray(void);
extern sqInt classString(void);
extern void * disownVM(sqInt flags);
extern sqInt failed(void);
extern sqInt falseObject(void);
extern void * firstIndexableField(sqInt oop);
Expand All @@ -164,12 +172,18 @@ extern sqInt isBytes(sqInt oop);
#if !defined(isIntegerObject)
extern sqInt isIntegerObject(sqInt objectPointer);
#endif
#if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 13)
extern sqInt isPinned(sqInt anObject);
#else
# define isPinned(anObject) 0
#endif
extern sqInt isWords(sqInt oop);
extern sqInt isWordsOrBytes(sqInt oop);
extern sqInt methodArgumentCount(void);
extern sqInt methodReturnBool(sqInt boolean);
extern sqInt methodReturnInteger(sqInt integer);
extern sqInt methodReturnValue(sqInt oop);
extern sqInt ownVM(void *handle);
extern sqInt pop(sqInt nItems);
extern sqInt popRemappableOop(void);
extern sqInt primitiveFail(void);
Expand All @@ -184,7 +198,7 @@ extern sqInt trueObject(void);
extern
#endif
struct VirtualMachine* interpreterProxy;
static const char *moduleName = "SocketPlugin VMMaker.oscog-eem.3275 " INT_EXT;
static const char *moduleName = "SocketPlugin VMMaker.oscog-mt.3362 " INT_EXT;
static void * sCCLOPfn;
static void * sCCSOTfn;
static void * sCCTPfn;
Expand Down Expand Up @@ -982,9 +996,12 @@ primitiveSocketBindToPort(void)
EXPORT(sqInt)
primitiveSocketCloseConnection(void)
{
void *handle;
sqInt isSocketPinned;
SocketPtr s;
sqInt socket;

handle = ((void *) 0);
socket = stackValue(0);
/* begin socketValueOf: */
if ((isBytes(socket))
Expand All @@ -996,7 +1013,19 @@ primitiveSocketCloseConnection(void)
s = null;
}
if (!(failed())) {
# if COGMTVM
/* begin sqSocketCloseConnection:isPinned: */
isSocketPinned = isPinned(socket);
if (isSocketPinned) {
handle = disownVM(DisownVMForThreading);
}
sqSocketCloseConnection(s);
if (isSocketPinned) {
ownVM(handle);
}
# else // COGMTVM
sqSocketCloseConnection(s);
# endif
}
if (!(failed())) {
pop(1);
Expand Down Expand Up @@ -2228,6 +2257,7 @@ setInterpreter(struct VirtualMachine *anInterpreter)
classArray = interpreterProxy->classArray;
classByteArray = interpreterProxy->classByteArray;
classString = interpreterProxy->classString;
disownVM = interpreterProxy->disownVM;
failed = interpreterProxy->failed;
falseObject = interpreterProxy->falseObject;
firstIndexableField = interpreterProxy->firstIndexableField;
Expand All @@ -2239,13 +2269,21 @@ setInterpreter(struct VirtualMachine *anInterpreter)
isBytes = interpreterProxy->isBytes;
#if !defined(isIntegerObject)
isIntegerObject = interpreterProxy->isIntegerObject;
#endif
#if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 13)
isPinned = interpreterProxy->isPinned;
#else
#if !defined(isPinned)
isPinned = 0;
#endif
#endif
isWords = interpreterProxy->isWords;
isWordsOrBytes = interpreterProxy->isWordsOrBytes;
methodArgumentCount = interpreterProxy->methodArgumentCount;
methodReturnBool = interpreterProxy->methodReturnBool;
methodReturnInteger = interpreterProxy->methodReturnInteger;
methodReturnValue = interpreterProxy->methodReturnValue;
ownVM = interpreterProxy->ownVM;
pop = interpreterProxy->pop;
popRemappableOop = interpreterProxy->popRemappableOop;
primitiveFail = interpreterProxy->primitiveFail;
Expand Down

0 comments on commit 8e5c04d

Please sign in to comment.