From 1f817751ec059623860466136ba917c76704f9fe Mon Sep 17 00:00:00 2001 From: Eliot Miranda Date: Sat, 18 Mar 2017 22:30:56 -0700 Subject: [PATCH] CogVM source as per VMMaker.oscog-eem.2166 InterpreterPrimitives: Add a proper getenv: primitive, with full control for disabling from the SecurityPlugin. A valid declaration is . SecurityPlugin: Ad support for environment access control. Make all platforms agree that the ioDisableFoo calls answer zero on success (unix answered 1). Cut down the amount of white space in the platform SecurityPlugin support files. Cogit: Fix the regression introduced in VMMaker.oscog-eem.2161 & VMMaker.oscog-eem.2160 when reintroducing the ceNewHash: trampoline. ceNewhash: must /not/ be called from Behavior's identityHash (175) only from ProtoObject's (75). Sista: Fix the determination of how much to free for the SistaMethodZone. --- nsspur64src/vm/cogit.h | 2 +- nsspur64src/vm/cogitX64.c | 19 ++-- nsspur64src/vm/cointerp.c | 65 +++++++++++-- nsspur64src/vm/cointerp.h | 2 +- nsspur64src/vm/gcc3x-cointerp.c | 65 +++++++++++-- nsspursrc/vm/cogit.h | 2 +- nsspursrc/vm/cogitARMv5.c | 17 ++-- nsspursrc/vm/cogitIA32.c | 13 ++- nsspursrc/vm/cogitMIPSEL.c | 25 ++--- nsspursrc/vm/cointerp.c | 69 ++++++++++++-- nsspursrc/vm/cointerp.h | 2 +- nsspursrc/vm/gcc3x-cointerp.c | 69 ++++++++++++-- nsspurstack64src/vm/gcc3x-interp.c | 59 +++++++++++- nsspurstack64src/vm/interp.c | 59 +++++++++++- nsspurstacksrc/vm/gcc3x-interp.c | 59 +++++++++++- nsspurstacksrc/vm/interp.c | 59 +++++++++++- platforms/Cross/vm/sqVirtualMachine.c | 5 +- platforms/Cross/vm/sqVirtualMachine.h | 2 +- .../plugins/SecurityPlugin/sqMacSecurity.c | 28 +++--- .../plugins/SecurityPlugin/sqRPCSecurity.c | 60 +++--------- .../plugins/SecurityPlugin/sqMacSecurity.c | 40 ++++---- .../plugins/SecurityPlugin/sqUnixSecurity.c | 67 +++---------- .../plugins/SecurityPlugin/sqWin32Security.c | 49 ++++------ spur64src/vm/cogit.h | 2 +- spur64src/vm/cogitX64.c | 9 +- spur64src/vm/cointerp.c | 79 +++++++++++++--- spur64src/vm/cointerp.h | 2 +- spur64src/vm/gcc3x-cointerp.c | 79 +++++++++++++--- spurlowcode64src/vm/cogit.h | 2 +- spurlowcode64src/vm/cogitX64.c | 21 +++-- spurlowcode64src/vm/cointerp.c | 67 +++++++++++-- spurlowcode64src/vm/cointerp.h | 2 +- spurlowcode64src/vm/gcc3x-cointerp.c | 67 +++++++++++-- spurlowcodesrc/vm/cogit.h | 2 +- spurlowcodesrc/vm/cogitARMv5.c | 21 +++-- spurlowcodesrc/vm/cogitIA32.c | 13 ++- spurlowcodesrc/vm/cogitMIPSEL.c | 23 +++-- spurlowcodesrc/vm/cointerp.c | 65 +++++++++++-- spurlowcodesrc/vm/cointerp.h | 2 +- spurlowcodesrc/vm/gcc3x-cointerp.c | 65 +++++++++++-- spurlowcodestack64src/vm/gcc3x-interp.c | 59 +++++++++++- spurlowcodestack64src/vm/interp.c | 59 +++++++++++- spurlowcodestacksrc/vm/gcc3x-interp.c | 59 +++++++++++- spurlowcodestacksrc/vm/interp.c | 59 +++++++++++- spursista64src/vm/cogit.h | 2 +- spursista64src/vm/cogitX64.c | 15 +-- spursista64src/vm/cointerp.c | 71 ++++++++++++-- spursista64src/vm/cointerp.h | 2 +- spursista64src/vm/gcc3x-cointerp.c | 71 ++++++++++++-- spursistasrc/vm/cogit.h | 2 +- spursistasrc/vm/cogitARMv5.c | 17 ++-- spursistasrc/vm/cogitIA32.c | 17 ++-- spursistasrc/vm/cogitMIPSEL.c | 25 ++--- spursistasrc/vm/cointerp.c | 93 +++++++++++++++---- spursistasrc/vm/cointerp.h | 2 +- spursistasrc/vm/gcc3x-cointerp.c | 93 +++++++++++++++---- spursrc/vm/cogit.h | 2 +- spursrc/vm/cogitARMv5.c | 9 +- spursrc/vm/cogitIA32.c | 17 ++-- spursrc/vm/cogitMIPSEL.c | 17 ++-- spursrc/vm/cointerp.c | 75 ++++++++++++--- spursrc/vm/cointerp.h | 4 +- spursrc/vm/gcc3x-cointerp.c | 75 ++++++++++++--- spurstack64src/vm/gcc3x-interp.c | 59 +++++++++++- spurstack64src/vm/interp.c | 59 +++++++++++- spurstacksrc/vm/gcc3x-interp.c | 59 +++++++++++- spurstacksrc/vm/interp.c | 59 +++++++++++- src/plugins/SecurityPlugin/SecurityPlugin.c | 19 +++- src/vm/cogit.h | 2 +- src/vm/cogitARMv5.c | 14 +-- src/vm/cogitIA32.c | 16 ++-- src/vm/cogitMIPSEL.c | 22 ++--- src/vm/cointerp.c | 69 ++++++++++++-- src/vm/cointerp.h | 2 +- src/vm/cointerpmt.c | 75 ++++++++++++--- src/vm/cointerpmt.h | 2 +- src/vm/gcc3x-cointerp.c | 69 ++++++++++++-- src/vm/gcc3x-cointerpmt.c | 75 ++++++++++++--- stacksrc/vm/gcc3x-interp.c | 59 +++++++++++- stacksrc/vm/interp.c | 59 +++++++++++- 80 files changed, 2314 insertions(+), 608 deletions(-) diff --git a/nsspur64src/vm/cogit.h b/nsspur64src/vm/cogit.h index dcc376c4a..20f6166cd 100644 --- a/nsspur64src/vm/cogit.h +++ b/nsspur64src/vm/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ diff --git a/nsspur64src/vm/cogitX64.c b/nsspur64src/vm/cogitX64.c index d858c8307..21cae8d1b 100644 --- a/nsspur64src/vm/cogitX64.c +++ b/nsspur64src/vm/cogitX64.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -572,7 +572,7 @@ static sqInt NoDbgRegParms fillInBlockHeadersAt(sqInt startAddress); static CogMethod * NoDbgRegParms fillInMethodHeadersizeselector(CogMethod *method, sqInt size, sqInt selector); static sqInt NoDbgRegParms findBackwardBranchIsBackwardBranchMcpcBcpcMatchingBcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetBcpc); static usqInt NoDbgRegParms findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc); -static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); +static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); extern CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); static sqInt NoDbgRegParms findIsBackwardBranchMcpcBcpcMatchingMcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetMcpc); static usqInt NoDbgRegParms firstMappedPCFor(CogMethod *cogMethod); @@ -644,7 +644,7 @@ static BytecodeDescriptor * loadBytesAndGetDescriptor(void); static void NoDbgRegParms loadSubsequentBytesForDescriptorat(BytecodeDescriptor *descriptor, sqInt pc); static AbstractInstruction * NoDbgRegParms gMoveAwR(sqInt address, sqInt reg); static AbstractInstruction * NoDbgRegParms gMoveCwR(sqInt wordConstant, sqInt reg); -static sqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); +static usqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); static sqInt NoDbgRegParms mapForperformUntilarg(CogMethod *cogMethod, sqInt (*functionSymbol)(sqInt annotation, char *mcpc, sqInt arg), sqInt arg); static sqInt NoDbgRegParms mapObjectReferencesInClosedPIC(CogMethod *cPIC); static void mapObjectReferencesInGeneratedRuntime(void); @@ -2815,7 +2815,7 @@ static sqInt NoDbgRegParms blockDispatchTargetsForperformarg(CogMethod *cogMethod, usqInt (*binaryFunction)(sqInt mcpc, sqInt arg), sqInt arg) { sqInt blockEntry; - sqInt end; + usqInt end; sqInt pc; sqInt result; usqInt targetpc; @@ -5434,7 +5434,7 @@ findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc) } /* Cogit>>#findMapLocationForMcpc:inMethod: */ -static sqInt NoDbgRegParms +static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) { sqInt annotation; @@ -7266,7 +7266,7 @@ gMoveCwR(sqInt wordConstant, sqInt reg) /* Answer the address of the null byte at the end of the method map. */ /* Cogit>>#mapEndFor: */ -static sqInt NoDbgRegParms +static usqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod) { usqInt end; @@ -13423,6 +13423,9 @@ genPrimitiveIdentityHash(void) genoperand(RetN, 0); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); diff --git a/nsspur64src/vm/cointerp.c b/nsspur64src/vm/cointerp.c index fc8e07e54..d931b29ba 100644 --- a/nsspur64src/vm/cointerp.c +++ b/nsspur64src/vm/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -738,6 +738,7 @@ static void primitiveForceDisplayUpdate(void); static void primitiveFormPrint(void); static void primitiveFractionalPart(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1906,6 +1907,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2518,7 +2520,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.2161"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.2165"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -18352,7 +18354,7 @@ ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize sqInt oop; char *p; char *sp; - sqInt startBcpc; + unsigned short startBcpc; sqInt top; assert(addressCouldBeOop(aNonBooleanObject)); @@ -22970,7 +22972,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - usqInt numTemps; + sqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; sqInt theMethod; @@ -23815,6 +23817,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -33680,6 +33683,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -74838,7 +74888,7 @@ removeFirstLinkOfList(sqInt aList) static sqInt retryPrimitiveOnFailure(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - signed char accessorDepth; + sqInt accessorDepth; sqInt canRetry; sqInt firstBytecode; sqInt followDone; @@ -82229,6 +82279,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/nsspur64src/vm/cointerp.h b/nsspur64src/vm/cointerp.h index 8cec2df6b..a921774b2 100644 --- a/nsspur64src/vm/cointerp.h +++ b/nsspur64src/vm/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ diff --git a/nsspur64src/vm/gcc3x-cointerp.c b/nsspur64src/vm/gcc3x-cointerp.c index 85ef1a88e..e976595a2 100644 --- a/nsspur64src/vm/gcc3x-cointerp.c +++ b/nsspur64src/vm/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -741,6 +741,7 @@ static void primitiveForceDisplayUpdate(void); static void primitiveFormPrint(void); static void primitiveFractionalPart(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1909,6 +1910,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2521,7 +2523,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.2161"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.2165"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -18361,7 +18363,7 @@ ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize sqInt oop; char *p; char *sp; - sqInt startBcpc; + unsigned short startBcpc; sqInt top; assert(addressCouldBeOop(aNonBooleanObject)); @@ -22979,7 +22981,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - usqInt numTemps; + sqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; sqInt theMethod; @@ -23824,6 +23826,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -33689,6 +33692,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -74847,7 +74897,7 @@ removeFirstLinkOfList(sqInt aList) static sqInt retryPrimitiveOnFailure(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - signed char accessorDepth; + sqInt accessorDepth; sqInt canRetry; sqInt firstBytecode; sqInt followDone; @@ -82238,6 +82288,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/nsspursrc/vm/cogit.h b/nsspursrc/vm/cogit.h index dcc376c4a..20f6166cd 100644 --- a/nsspursrc/vm/cogit.h +++ b/nsspursrc/vm/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ diff --git a/nsspursrc/vm/cogitARMv5.c b/nsspursrc/vm/cogitARMv5.c index c6eff613b..498b45a7a 100644 --- a/nsspursrc/vm/cogitARMv5.c +++ b/nsspursrc/vm/cogitARMv5.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -647,7 +647,7 @@ static sqInt NoDbgRegParms fillInBlockHeadersAt(sqInt startAddress); static CogMethod * NoDbgRegParms fillInMethodHeadersizeselector(CogMethod *method, sqInt size, sqInt selector); static sqInt NoDbgRegParms findBackwardBranchIsBackwardBranchMcpcBcpcMatchingBcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetBcpc); static usqInt NoDbgRegParms findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc); -static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); +static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); extern CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); static sqInt NoDbgRegParms findIsBackwardBranchMcpcBcpcMatchingMcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetMcpc); static usqInt NoDbgRegParms firstMappedPCFor(CogMethod *cogMethod); @@ -720,7 +720,7 @@ static BytecodeDescriptor * loadBytesAndGetDescriptor(void); static void NoDbgRegParms loadSubsequentBytesForDescriptorat(BytecodeDescriptor *descriptor, sqInt pc); static AbstractInstruction * NoDbgRegParms gMoveAwR(sqInt address, sqInt reg); static AbstractInstruction * NoDbgRegParms gMoveCwR(sqInt wordConstant, sqInt reg); -static usqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); +static sqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); static sqInt NoDbgRegParms mapForperformUntilarg(CogMethod *cogMethod, sqInt (*functionSymbol)(sqInt annotation, char *mcpc, sqInt arg), sqInt arg); static sqInt NoDbgRegParms mapObjectReferencesInClosedPIC(CogMethod *cPIC); static void mapObjectReferencesInGeneratedRuntime(void); @@ -10252,7 +10252,7 @@ findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc) } /* Cogit>>#findMapLocationForMcpc:inMethod: */ -static usqInt NoDbgRegParms +static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) { sqInt annotation; @@ -12150,7 +12150,7 @@ gMoveCwR(sqInt wordConstant, sqInt reg) /* Answer the address of the null byte at the end of the method map. */ /* Cogit>>#mapEndFor: */ -static usqInt NoDbgRegParms +static sqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod) { usqInt end; @@ -18123,6 +18123,9 @@ genPrimitiveIdentityHash(void) /* begin Jump: */ genoperand(Jump, ((sqInt)ret)); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); diff --git a/nsspursrc/vm/cogitIA32.c b/nsspursrc/vm/cogitIA32.c index 1caa13604..41451f29b 100644 --- a/nsspursrc/vm/cogitIA32.c +++ b/nsspursrc/vm/cogitIA32.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -636,7 +636,7 @@ static sqInt NoDbgRegParms fillInBlockHeadersAt(sqInt startAddress); static CogMethod * NoDbgRegParms fillInMethodHeadersizeselector(CogMethod *method, sqInt size, sqInt selector); static sqInt NoDbgRegParms findBackwardBranchIsBackwardBranchMcpcBcpcMatchingBcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetBcpc); static usqInt NoDbgRegParms findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc); -static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); +static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); extern CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); static sqInt NoDbgRegParms findIsBackwardBranchMcpcBcpcMatchingMcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetMcpc); static usqInt NoDbgRegParms firstMappedPCFor(CogMethod *cogMethod); @@ -10143,7 +10143,7 @@ findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc) } /* Cogit>>#findMapLocationForMcpc:inMethod: */ -static sqInt NoDbgRegParms +static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) { sqInt annotation; @@ -17734,6 +17734,9 @@ genPrimitiveIdentityHash(void) /* begin Jump: */ genoperand(Jump, ((sqInt)ret)); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); diff --git a/nsspursrc/vm/cogitMIPSEL.c b/nsspursrc/vm/cogitMIPSEL.c index 85f02e558..1dbe22c62 100644 --- a/nsspursrc/vm/cogitMIPSEL.c +++ b/nsspursrc/vm/cogitMIPSEL.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -578,7 +578,7 @@ static sqInt NoDbgRegParms fillInBlockHeadersAt(sqInt startAddress); static CogMethod * NoDbgRegParms fillInMethodHeadersizeselector(CogMethod *method, sqInt size, sqInt selector); static sqInt NoDbgRegParms findBackwardBranchIsBackwardBranchMcpcBcpcMatchingBcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetBcpc); static usqInt NoDbgRegParms findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc); -static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); +static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); extern CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); static sqInt NoDbgRegParms findIsBackwardBranchMcpcBcpcMatchingMcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetMcpc); static usqInt NoDbgRegParms firstMappedPCFor(CogMethod *cogMethod); @@ -5284,7 +5284,7 @@ findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc) } /* Cogit>>#findMapLocationForMcpc:inMethod: */ -static sqInt NoDbgRegParms +static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) { sqInt annotation; @@ -6631,7 +6631,7 @@ static sqInt NoDbgRegParms incrementUsageOfTargetIfLinkedSendmcpcignored(sqInt annotation, char *mcpc, sqInt superfluity) { usqInt cacheAddress; - sqInt entryPoint; + usqInt entryPoint; usqInt entryPoint1; char *mcpc1; NSSendCache *nsSendCache; @@ -8824,7 +8824,7 @@ static void NoDbgRegParms relocateCallsInClosedPIC(CogMethod *cPIC) { sqLong callDelta; - sqInt entryPoint; + usqInt entryPoint; sqInt i; sqInt pc; sqLong refDelta; @@ -8874,7 +8874,7 @@ relocateIfCallOrMethodReferencemcpcdelta(sqInt annotation, char *mcpc, sqInt ref { usqInt cacheAddress; sqInt callDelta; - sqInt entryPoint; + usqInt entryPoint; usqInt entryPoint1; char *mcpc1; NSSendCache *nsSendCache; @@ -9393,7 +9393,7 @@ static sqInt NoDbgRegParms unlinkIfFreeOrLinkedSendpcof(sqInt annotation, char *mcpc, sqInt theSelector) { usqInt cacheAddress; - sqInt entryPoint; + usqInt entryPoint; usqInt entryPoint1; char *mcpc1; NSSendCache *nsSendCache; @@ -14859,7 +14859,7 @@ relocateCallBeforeReturnPCby(AbstractInstruction * self_in_relocateCallBeforeRet static AbstractInstruction * NoDbgRegParms relocateJumpLongBeforeFollowingAddressby(AbstractInstruction * self_in_relocateJumpLongBeforeFollowingAddressby, sqInt pc, sqInt delta) { - usqInt newTarget; + sqInt newTarget; usqInt oldTarget; assert((delta % 4) == 0); @@ -14912,7 +14912,7 @@ relocateJumpLongConditionalBeforeFollowingAddressby(AbstractInstruction * self_i static AbstractInstruction * NoDbgRegParms relocateMethodReferenceBeforeAddressby(AbstractInstruction * self_in_relocateMethodReferenceBeforeAddressby, sqInt pc, sqInt delta) { - sqInt newValue; + usqInt newValue; usqInt oldValue; if (((opcodeAtAddress(self_in_relocateMethodReferenceBeforeAddressby, pc - 8)) == ADDIU) @@ -17061,6 +17061,9 @@ genPrimitiveIdentityHash(void) /* begin Jump: */ genoperand(Jump, ((sqInt)ret)); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); diff --git a/nsspursrc/vm/cointerp.c b/nsspursrc/vm/cointerp.c index 6d6127101..936909d5b 100644 --- a/nsspursrc/vm/cointerp.c +++ b/nsspursrc/vm/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -738,6 +738,7 @@ static void primitiveForceDisplayUpdate(void); static void primitiveFormPrint(void); static void primitiveFractionalPart(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1884,6 +1885,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2496,7 +2498,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.2161"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.2165"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -18123,7 +18125,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - sqInt oop; + usqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -23170,6 +23172,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -33022,6 +33025,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -33759,7 +33809,7 @@ primitiveImmediateAsInteger(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt oop; char *sp; - sqInt value; + usqInt value; value = 0; oop = longAt(GIV(stackPointer)); @@ -33778,7 +33828,7 @@ primitiveImmediateAsInteger(void) } } /* begin pop:thenPushInteger: */ - longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (((usqInt)value << 1) | 1)); + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((value << 1) | 1)); GIV(stackPointer) = sp; } @@ -42785,7 +42835,7 @@ scavengeFutureSurvivorSpaceStartingAt(sqInt initialAddress) usqInt numSlots1; usqInt numSlots2; sqInt obj; - sqInt ptr; + usqInt ptr; usqInt slotBytes; ptr = initialAddress; @@ -73243,7 +73293,7 @@ removeFirstLinkOfList(sqInt aList) static sqInt retryPrimitiveOnFailure(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt accessorDepth; + signed char accessorDepth; sqInt canRetry; sqInt firstBytecode; sqInt followDone; @@ -80870,6 +80920,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/nsspursrc/vm/cointerp.h b/nsspursrc/vm/cointerp.h index 2643f0866..48c3f9b6f 100644 --- a/nsspursrc/vm/cointerp.h +++ b/nsspursrc/vm/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ diff --git a/nsspursrc/vm/gcc3x-cointerp.c b/nsspursrc/vm/gcc3x-cointerp.c index 639a8a3b6..d74860644 100644 --- a/nsspursrc/vm/gcc3x-cointerp.c +++ b/nsspursrc/vm/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -741,6 +741,7 @@ static void primitiveForceDisplayUpdate(void); static void primitiveFormPrint(void); static void primitiveFractionalPart(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1887,6 +1888,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2499,7 +2501,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.2161"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.2165"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -18132,7 +18134,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - sqInt oop; + usqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -23179,6 +23181,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -33031,6 +33034,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -33768,7 +33818,7 @@ primitiveImmediateAsInteger(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt oop; char *sp; - sqInt value; + usqInt value; value = 0; oop = longAt(GIV(stackPointer)); @@ -33787,7 +33837,7 @@ primitiveImmediateAsInteger(void) } } /* begin pop:thenPushInteger: */ - longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (((usqInt)value << 1) | 1)); + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((value << 1) | 1)); GIV(stackPointer) = sp; } @@ -42794,7 +42844,7 @@ scavengeFutureSurvivorSpaceStartingAt(sqInt initialAddress) usqInt numSlots1; usqInt numSlots2; sqInt obj; - sqInt ptr; + usqInt ptr; usqInt slotBytes; ptr = initialAddress; @@ -73252,7 +73302,7 @@ removeFirstLinkOfList(sqInt aList) static sqInt retryPrimitiveOnFailure(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt accessorDepth; + signed char accessorDepth; sqInt canRetry; sqInt firstBytecode; sqInt followDone; @@ -80879,6 +80929,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/nsspurstack64src/vm/gcc3x-interp.c b/nsspurstack64src/vm/gcc3x-interp.c index f9aa2a81e..eb0a44c7f 100644 --- a/nsspurstack64src/vm/gcc3x-interp.c +++ b/nsspurstack64src/vm/gcc3x-interp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -471,6 +471,7 @@ static void primitiveForceDisplayUpdate(void); static void primitiveFormPrint(void); static void primitiveFractionalPart(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1668,6 +1669,7 @@ static void (*interruptCheckChain)(void) = 0; char * breakSelector; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2249,7 +2251,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreterPrimitives_VMMaker.oscog-eem.2160"; +const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreterPrimitives_VMMaker.oscog-eem.2165"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -21619,6 +21621,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -64414,6 +64463,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); return dataSize; } @@ -74030,6 +74080,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/nsspurstack64src/vm/interp.c b/nsspurstack64src/vm/interp.c index 790aee7cd..ba1717ac3 100644 --- a/nsspurstack64src/vm/interp.c +++ b/nsspurstack64src/vm/interp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -468,6 +468,7 @@ static void primitiveForceDisplayUpdate(void); static void primitiveFormPrint(void); static void primitiveFractionalPart(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1665,6 +1666,7 @@ static void (*interruptCheckChain)(void) = 0; char * breakSelector; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2246,7 +2248,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreterPrimitives_VMMaker.oscog-eem.2160"; +const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreterPrimitives_VMMaker.oscog-eem.2165"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -21610,6 +21612,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -64405,6 +64454,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); return dataSize; } @@ -74021,6 +74071,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/nsspurstacksrc/vm/gcc3x-interp.c b/nsspurstacksrc/vm/gcc3x-interp.c index f28828d45..9ae907c10 100644 --- a/nsspurstacksrc/vm/gcc3x-interp.c +++ b/nsspurstacksrc/vm/gcc3x-interp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -471,6 +471,7 @@ static void primitiveForceDisplayUpdate(void); static void primitiveFormPrint(void); static void primitiveFractionalPart(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1648,6 +1649,7 @@ static void (*interruptCheckChain)(void) = 0; char * breakSelector; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2229,7 +2231,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreterPrimitives_VMMaker.oscog-eem.2160"; +const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreterPrimitives_VMMaker.oscog-eem.2165"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -20883,6 +20885,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -62787,6 +62836,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); return dataSize; } @@ -72638,6 +72688,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/nsspurstacksrc/vm/interp.c b/nsspurstacksrc/vm/interp.c index 647720f59..29546d04e 100644 --- a/nsspurstacksrc/vm/interp.c +++ b/nsspurstacksrc/vm/interp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -468,6 +468,7 @@ static void primitiveForceDisplayUpdate(void); static void primitiveFormPrint(void); static void primitiveFractionalPart(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1645,6 +1646,7 @@ static void (*interruptCheckChain)(void) = 0; char * breakSelector; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2226,7 +2228,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreterPrimitives_VMMaker.oscog-eem.2160"; +const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreterPrimitives_VMMaker.oscog-eem.2165"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -20874,6 +20876,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -62778,6 +62827,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); return dataSize; } @@ -72629,6 +72679,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/platforms/Cross/vm/sqVirtualMachine.c b/platforms/Cross/vm/sqVirtualMachine.c index 512562985..5bbd13bc1 100755 --- a/platforms/Cross/vm/sqVirtualMachine.c +++ b/platforms/Cross/vm/sqVirtualMachine.c @@ -192,11 +192,12 @@ sqInt characterValueOf(sqInt oop); sqInt isPinned(sqInt objOop); sqInt pinObject(sqInt objOop); sqInt unpinObject(sqInt objOop); +char *cStringOrNullFor(sqInt); #endif #if VM_PROXY_MINOR > 13 /* More Spur */ sqInt statNumGCs(void); +sqInt stringForCString(char *); #endif -char *cStringOrNullFor(sqInt); void *ioLoadFunctionFrom(char *fnName, char *modName); @@ -511,7 +512,7 @@ struct VirtualMachine* sqGetInterpreterProxy(void) #if VM_PROXY_MINOR > 13 /* More Spur */ VM->statNumGCs = statNumGCs; - VM->AS_YET_UNUSED = 0; + VM->stringForCString = stringForCString; #endif return VM; diff --git a/platforms/Cross/vm/sqVirtualMachine.h b/platforms/Cross/vm/sqVirtualMachine.h index 80d83e65d..49ce2d533 100755 --- a/platforms/Cross/vm/sqVirtualMachine.h +++ b/platforms/Cross/vm/sqVirtualMachine.h @@ -175,7 +175,7 @@ typedef struct VirtualMachine { # if VM_PROXY_MINOR > 13 /* Reuse these now that Cog provides a production JIT. */ sqInt (*statNumGCs)(void); - sqInt (*AS_YET_UNUSED)(void); + sqInt (*stringForCString)(char *nullTerminatedCString); # else /* InterpreterProxy methodsFor: 'compiler' */ diff --git a/platforms/Mac OS/plugins/SecurityPlugin/sqMacSecurity.c b/platforms/Mac OS/plugins/SecurityPlugin/sqMacSecurity.c index 49d254af2..ff14f9648 100644 --- a/platforms/Mac OS/plugins/SecurityPlugin/sqMacSecurity.c +++ b/platforms/Mac OS/plugins/SecurityPlugin/sqMacSecurity.c @@ -27,6 +27,16 @@ static char secureUserDirectory[PATH_MAX]; static char untrustedUserDirectory[PATH_MAX]; static Boolean gInitialized = false; +/***************************************************************************/ +/***************************************************************************/ +/***************************************************************************/ +/***************************************************************************/ +/* environment security */ +static int allowEnvironmentAccess = 1; /* full access to C environment */ + +sqInt ioDisableEnvironmentAccess(void) { return allowEnvironmentAccess = 0; } +sqInt ioHasEnvironmentAccess(void) { return allowEnvironmentAccess; } + /***************************************************************************/ /***************************************************************************/ /***************************************************************************/ @@ -108,11 +118,7 @@ sqInt ioCanSetFileTypeOfSize(char* pathString, sqInt pathStringLength) { } /* disabling/querying */ -sqInt ioDisableFileAccess(void) { - allowFileAccess = 0; - return 0; -} - +sqInt ioDisableFileAccess(void) { return allowFileAccess = 0; } sqInt ioHasFileAccess(void) { return allowFileAccess; } /***************************************************************************/ @@ -128,11 +134,7 @@ sqInt ioCanRenameImage(void) { } sqInt ioCanWriteImage() { return allowImageWrite; } - -sqInt ioDisableImageWrite() { - allowImageWrite = 0; - return 0; -} +sqInt ioDisableImageWrite() { return allowImageWrite = 0; } /***************************************************************************/ @@ -157,11 +159,7 @@ sqInt ioCanListenOnPort(sqInt s, sqInt port) { return allowSocketAccess; } -sqInt ioDisableSocketAccess() { - allowSocketAccess = 0; - return 0; -} - +sqInt ioDisableSocketAccess() { return allowSocketAccess = 0; } sqInt ioHasSocketAccess() { return allowSocketAccess; } /***************************************************************************/ diff --git a/platforms/RiscOS/plugins/SecurityPlugin/sqRPCSecurity.c b/platforms/RiscOS/plugins/SecurityPlugin/sqRPCSecurity.c index d3b2b46b1..b550ea999 100644 --- a/platforms/RiscOS/plugins/SecurityPlugin/sqRPCSecurity.c +++ b/platforms/RiscOS/plugins/SecurityPlugin/sqRPCSecurity.c @@ -39,9 +39,13 @@ static char untrustedUserDirectory[MAXDIRNAMELENGTH]; /* imagepath/untrusted/ */ static int untrustedUserDirectoryLen; char name[MAXDIRNAMELENGTH]; -/* file security ***********************************************************/ +/* environment security *******************************************************/ +static int allowEnvironmentAccess = 1; /* full access to C environment */ +sqInt ioDisableEnvironmentAccess(void) { return allowEnvironmentAccess = 0; } +sqInt ioHasEnvironmentAccess(void) { return allowEnvironmentAccess; } +/* file security ***********************************************************/ static int allowFileAccess= 1; /* full access to files */ @@ -128,17 +132,8 @@ int ioCanSetFileTypeOfSize(char* pathString, int pathStringLength) { /* disabling/querying */ - - -int ioDisableFileAccess(void) { - allowFileAccess= 0; - return 1; -} - - -int ioHasFileAccess(void) { - return allowFileAccess; -} +int ioDisableFileAccess(void) { return allowFileAccess = 0; } +int ioHasFileAccess(void) { return allowFileAccess; } /* image security **********************************************************/ @@ -151,51 +146,22 @@ int ioCanRenameImage(void) { return allowImageWrite; /* only when we're allowed to save the image */ } -int ioCanWriteImage(void) { - return allowImageWrite; -} - -int ioDisableImageWrite(void) { - allowImageWrite= 0; - return 1; -} +int ioCanWriteImage(void) { return allowImageWrite; } +int ioDisableImageWrite(void) { return allowImageWrite = 0; } /* socket security - for now it's all or nothing ***************************/ - - static int allowSocketAccess= 1; /* allow access to sockets */ - - int ioCanCreateSocketOfType(int netType, int socketType) { return allowSocketAccess; } - - -int ioCanConnectToPort(int netAddr, int port) { - return allowSocketAccess; -} - - -int ioCanListenOnPort(int s, int port) { - return allowSocketAccess; -} - - -int ioDisableSocketAccess() { - allowSocketAccess= 0; - return 1; -} - - -int ioHasSocketAccess() { - return allowSocketAccess; -} +int ioCanConnectToPort(int netAddr, int port) { return allowSocketAccess; } +int ioCanListenOnPort(int s, int port) { return allowSocketAccess; } +int ioDisableSocketAccess() { return allowSocketAccess = 0; } +int ioHasSocketAccess() { return allowSocketAccess; } /* SecurityPlugin primitive support ****************************************/ - - char *ioGetSecureUserDirectory(void) { PRINTF(("\\t sec: getSecureUserDir - %s\n", secureUserDirectory)); return secureUserDirectory; diff --git a/platforms/iOS/plugins/SecurityPlugin/sqMacSecurity.c b/platforms/iOS/plugins/SecurityPlugin/sqMacSecurity.c index d8de4f12e..ca2aca510 100644 --- a/platforms/iOS/plugins/SecurityPlugin/sqMacSecurity.c +++ b/platforms/iOS/plugins/SecurityPlugin/sqMacSecurity.c @@ -58,6 +58,16 @@ static char secureUserDirectory[PATH_MAX]; static char untrustedUserDirectory[PATH_MAX]; static Boolean gInitialized = false; +/***************************************************************************/ +/***************************************************************************/ +/***************************************************************************/ +/***************************************************************************/ +/* environment security */ +static int allowEnvironmentAccess = 1; /* full access to C environment */ + +sqInt ioDisableEnvironmentAccess(void) { return allowEnvironmentAccess = 0; } +sqInt ioHasEnvironmentAccess(void) { return allowEnvironmentAccess; } + /***************************************************************************/ /***************************************************************************/ /***************************************************************************/ @@ -139,14 +149,8 @@ sqInt ioCanSetFileTypeOfSize(char* pathString, sqInt pathStringLength) { } /* disabling/querying */ -sqInt ioDisableFileAccess(void) { - allowFileAccess = 0; - return 0; -} - -sqInt ioHasFileAccess(void) { - return allowFileAccess; -} +sqInt ioDisableFileAccess(void) { return allowFileAccess = 0; } +sqInt ioHasFileAccess(void) { return allowFileAccess; } /***************************************************************************/ /***************************************************************************/ @@ -160,14 +164,8 @@ sqInt ioCanRenameImage(void) { return allowImageWrite; /* only when we're allowed to save the image */ } -sqInt ioCanWriteImage() { - return allowImageWrite; -} - -sqInt ioDisableImageWrite() { - allowImageWrite = 0; - return 0; -} +sqInt ioCanWriteImage() { return allowImageWrite; } +sqInt ioDisableImageWrite() { return allowImageWrite = 0; } /***************************************************************************/ @@ -192,14 +190,8 @@ sqInt ioCanListenOnPort(sqInt s, sqInt port) { return allowSocketAccess; } -sqInt ioDisableSocketAccess() { - allowSocketAccess = 0; - return 0; -} - -sqInt ioHasSocketAccess() { - return allowSocketAccess; -} +sqInt ioDisableSocketAccess() { return allowSocketAccess = 0; } +sqInt ioHasSocketAccess() { return allowSocketAccess; } /***************************************************************************/ /***************************************************************************/ diff --git a/platforms/unix/plugins/SecurityPlugin/sqUnixSecurity.c b/platforms/unix/plugins/SecurityPlugin/sqUnixSecurity.c index fc0fccbab..5d9771cdf 100644 --- a/platforms/unix/plugins/SecurityPlugin/sqUnixSecurity.c +++ b/platforms/unix/plugins/SecurityPlugin/sqUnixSecurity.c @@ -29,9 +29,13 @@ static char* fromSqueak(char* string, int len) return buf; } -/* file security ***********************************************************/ +/* environment security *******************************************************/ +static int allowEnvironmentAccess = 1; /* full access to C environment */ +sqInt ioDisableEnvironmentAccess(void) { return return allowEnvironmentAccess = 0; } +sqInt ioHasEnvironmentAccess(void) { return allowEnvironmentAccess; } +/* file security ***********************************************************/ static sqInt allowFileAccess= 1; /* full access to files */ @@ -128,82 +132,37 @@ sqInt ioCanSetFileTypeOfSize(char* pathString, sqInt pathStringLength) /* disabling/querying */ -sqInt ioDisableFileAccess(void) -{ - allowFileAccess= 0; - return 1; -} - - -sqInt ioHasFileAccess(void) -{ - return allowFileAccess; -} +sqInt ioDisableFileAccess(void) { return return allowFileAccess = 0; } +sqInt ioHasFileAccess(void) { return allowFileAccess; } /* image security **********************************************************/ - - static sqInt allowImageWrite= 1; /* allow writing the image */ - sqInt ioCanRenameImage(void) { return allowImageWrite; /* only when we're allowed to save the image */ } -sqInt ioCanWriteImage(void) -{ - return allowImageWrite; -} - -sqInt ioDisableImageWrite(void) -{ - allowImageWrite= 0; - return 1; -} +sqInt ioCanWriteImage(void) { return allowImageWrite; } +sqInt ioDisableImageWrite(void) { return allowImageWrite= 0; } /* socket security - for now it's all or nothing ***************************/ - - static sqInt allowSocketAccess= 1; /* allow access to sockets */ - sqInt ioCanCreateSocketOfType(sqInt netType, sqInt socketType) { return allowSocketAccess; } - - -sqInt ioCanConnectToPort(sqInt netAddr, sqInt port) -{ - return allowSocketAccess; -} - - -sqInt ioCanListenOnPort(sqInt s, sqInt port) -{ - return allowSocketAccess; -} - - -sqInt ioDisableSocketAccess() -{ - allowSocketAccess= 0; - return 1; -} - - -sqInt ioHasSocketAccess() -{ - return allowSocketAccess; -} +sqInt ioCanConnectToPort(sqInt addr, sqInt port) { return allowSocketAccess; } +sqInt ioCanListenOnPort(sqInt s, sqInt port) { return allowSocketAccess; } +sqInt ioDisableSocketAccess() { return allowSocketAccess = 0; } +sqInt ioHasSocketAccess() { return allowSocketAccess; } /* SecurityPlugin primitive support ****************************************/ - char *ioGetSecureUserDirectory(void) { if (secureUserDirectory[0] == '\0') diff --git a/platforms/win32/plugins/SecurityPlugin/sqWin32Security.c b/platforms/win32/plugins/SecurityPlugin/sqWin32Security.c index ca7496895..53908291e 100644 --- a/platforms/win32/plugins/SecurityPlugin/sqWin32Security.c +++ b/platforms/win32/plugins/SecurityPlugin/sqWin32Security.c @@ -30,6 +30,16 @@ extern TCHAR squeakIniName[MAX_PATH]; extern BOOL fLowRights; /* started as low integrity process, need to use alternate untrustedUserDirectory */ +/***************************************************************************/ +/***************************************************************************/ +/***************************************************************************/ +/***************************************************************************/ +/* environment security */ +static int allowEnvironmentAccess = 1; /* full access to C environment */ + +sqInt ioDisableEnvironmentAccess(void) { return allowEnvironmentAccess = 0; } +sqInt ioHasEnvironmentAccess(void) { return allowEnvironmentAccess; } + /***************************************************************************/ /***************************************************************************/ /***************************************************************************/ @@ -138,14 +148,8 @@ int ioCanSetFileTypeOfSize(char* pathString, int pathStringLength) { } /* disabling/querying */ -int ioDisableFileAccess(void) { - allowFileAccess = 0; - return 0; -} - -int ioHasFileAccess(void) { - return allowFileAccess; -} +int ioDisableFileAccess(void) { return allowFileAccess = 0; } +int ioHasFileAccess(void) { return allowFileAccess; } /***************************************************************************/ /***************************************************************************/ @@ -158,14 +162,9 @@ sqInt ioCanRenameImage(void) { return allowImageWrite; /* only when we're allowed to save the image */ } -sqInt ioCanWriteImage(void) { - return allowImageWrite; -} +sqInt ioCanWriteImage(void) { return allowImageWrite; } +sqInt ioDisableImageWrite(void) { return allowImageWrite = 0; } -sqInt ioDisableImageWrite(void) { - allowImageWrite = 0; - return 0; -} /***************************************************************************/ /***************************************************************************/ /***************************************************************************/ @@ -177,22 +176,10 @@ int ioCanCreateSocketOfType(int netType, int socketType) { return allowSocketAccess; } -int ioCanConnectToPort(int netAddr, int port) { - return allowSocketAccess; -} - -int ioCanListenOnPort(void* s, int port) { - return allowSocketAccess; -} - -int ioDisableSocketAccess() { - allowSocketAccess = 0; - return 0; -} - -int ioHasSocketAccess() { - return allowSocketAccess; -} +int ioCanConnectToPort(int netAddr, int port) { return allowSocketAccess; } +int ioCanListenOnPort(void* s, int port) { return allowSocketAccess; } +int ioDisableSocketAccess() { return allowSocketAccess = 0; } +int ioHasSocketAccess() { return allowSocketAccess; } /***************************************************************************/ /***************************************************************************/ diff --git a/spur64src/vm/cogit.h b/spur64src/vm/cogit.h index ac7d585df..689693fa9 100644 --- a/spur64src/vm/cogit.h +++ b/spur64src/vm/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ diff --git a/spur64src/vm/cogitX64.c b/spur64src/vm/cogitX64.c index 021efbe16..e9a7aa8e3 100644 --- a/spur64src/vm/cogitX64.c +++ b/spur64src/vm/cogitX64.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -12838,6 +12838,9 @@ genPrimitiveIdentityHash(void) genoperand(RetN, 0); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); diff --git a/spur64src/vm/cointerp.c b/spur64src/vm/cointerp.c index 71d3e0ac2..86e4bb5aa 100644 --- a/spur64src/vm/cointerp.c +++ b/spur64src/vm/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -722,6 +722,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1447,7 +1448,7 @@ static sqInt NoDbgRegParms lookupMNUInClass(sqInt class); static sqInt NoDbgRegParms lookupOrdinaryNoMNUEtcInClass(sqInt class); extern sqInt lookupSelectorinClass(sqInt selector, sqInt class); static void NoDbgRegParms makeContextSnapshotSafe(sqInt ctxt); -extern usqInt makePointwithxValueyValue(sqInt xValue, sqInt yValue); +extern sqInt makePointwithxValueyValue(sqInt xValue, sqInt yValue); static void mapInterpreterOops(void); static sqInt NoDbgRegParms markAndTraceStackPages(sqInt fullGCFlag); static void markAndTraceUntracedReachableStackPages(void); @@ -1879,6 +1880,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2491,7 +2493,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -7252,7 +7254,7 @@ interpret(void) sqInt context; sqInt i; sqInt initialIP; - usqInt newClosure; + sqInt newClosure; usqInt newClosure1; usqInt newObj; sqInt numArgs; @@ -13688,7 +13690,7 @@ interpret(void) sqInt header1; sqInt i; int ignoreContext; - usqInt newClosure; + sqInt newClosure; usqInt newClosure1; usqInt newObj; sqInt numArgs; @@ -13833,7 +13835,7 @@ interpret(void) sqInt context; sqInt i; sqInt initialIP; - usqInt newClosure; + sqInt newClosure; usqInt newClosure1; usqInt newObj; sqInt numArgs; @@ -16729,7 +16731,7 @@ ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize sqInt oop; char *p; char *sp; - unsigned short startBcpc; + sqInt startBcpc; sqInt top; assert(addressCouldBeOop(aNonBooleanObject)); @@ -17490,7 +17492,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - sqInt oop; + usqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -21128,7 +21130,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - sqInt numTemps; + usqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; sqInt theMethod; @@ -21975,6 +21977,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -32642,6 +32645,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -43342,7 +43392,7 @@ scavengeFutureSurvivorSpaceStartingAt(sqInt initialAddress) usqInt numSlots1; usqInt numSlots2; sqInt obj; - usqInt ptr; + sqInt ptr; usqInt slotBytes; ptr = initialAddress; @@ -68511,7 +68561,7 @@ makeContextSnapshotSafe(sqInt ctxt) We know both will be integers so no value nor root checking is needed */ /* StackInterpreter>>#makePointwithxValue:yValue: */ -usqInt +sqInt makePointwithxValueyValue(sqInt xValue, sqInt yValue) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classObj; @@ -72862,7 +72912,7 @@ removeFirstLinkOfList(sqInt aList) static sqInt retryPrimitiveOnFailure(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt accessorDepth; + signed char accessorDepth; sqInt canRetry; sqInt firstBytecode; sqInt followDone; @@ -80253,6 +80303,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spur64src/vm/cointerp.h b/spur64src/vm/cointerp.h index a0dd0720e..98b1fcd77 100644 --- a/spur64src/vm/cointerp.h +++ b/spur64src/vm/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ diff --git a/spur64src/vm/gcc3x-cointerp.c b/spur64src/vm/gcc3x-cointerp.c index 56993d383..6238fb481 100644 --- a/spur64src/vm/gcc3x-cointerp.c +++ b/spur64src/vm/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -725,6 +725,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1450,7 +1451,7 @@ static sqInt NoDbgRegParms lookupMNUInClass(sqInt class); static sqInt NoDbgRegParms lookupOrdinaryNoMNUEtcInClass(sqInt class); extern sqInt lookupSelectorinClass(sqInt selector, sqInt class); static void NoDbgRegParms makeContextSnapshotSafe(sqInt ctxt); -extern usqInt makePointwithxValueyValue(sqInt xValue, sqInt yValue); +extern sqInt makePointwithxValueyValue(sqInt xValue, sqInt yValue); static void mapInterpreterOops(void); static sqInt NoDbgRegParms markAndTraceStackPages(sqInt fullGCFlag); static void markAndTraceUntracedReachableStackPages(void); @@ -1882,6 +1883,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2494,7 +2496,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -7261,7 +7263,7 @@ interpret(void) sqInt context; sqInt i; sqInt initialIP; - usqInt newClosure; + sqInt newClosure; usqInt newClosure1; usqInt newObj; sqInt numArgs; @@ -13697,7 +13699,7 @@ interpret(void) sqInt header1; sqInt i; int ignoreContext; - usqInt newClosure; + sqInt newClosure; usqInt newClosure1; usqInt newObj; sqInt numArgs; @@ -13842,7 +13844,7 @@ interpret(void) sqInt context; sqInt i; sqInt initialIP; - usqInt newClosure; + sqInt newClosure; usqInt newClosure1; usqInt newObj; sqInt numArgs; @@ -16738,7 +16740,7 @@ ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize sqInt oop; char *p; char *sp; - unsigned short startBcpc; + sqInt startBcpc; sqInt top; assert(addressCouldBeOop(aNonBooleanObject)); @@ -17499,7 +17501,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - sqInt oop; + usqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -21137,7 +21139,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - sqInt numTemps; + usqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; sqInt theMethod; @@ -21984,6 +21986,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -32651,6 +32654,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -43351,7 +43401,7 @@ scavengeFutureSurvivorSpaceStartingAt(sqInt initialAddress) usqInt numSlots1; usqInt numSlots2; sqInt obj; - usqInt ptr; + sqInt ptr; usqInt slotBytes; ptr = initialAddress; @@ -68520,7 +68570,7 @@ makeContextSnapshotSafe(sqInt ctxt) We know both will be integers so no value nor root checking is needed */ /* StackInterpreter>>#makePointwithxValue:yValue: */ -usqInt +sqInt makePointwithxValueyValue(sqInt xValue, sqInt yValue) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classObj; @@ -72871,7 +72921,7 @@ removeFirstLinkOfList(sqInt aList) static sqInt retryPrimitiveOnFailure(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt accessorDepth; + signed char accessorDepth; sqInt canRetry; sqInt firstBytecode; sqInt followDone; @@ -80262,6 +80312,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spurlowcode64src/vm/cogit.h b/spurlowcode64src/vm/cogit.h index dd101f1db..7e8c42158 100644 --- a/spurlowcode64src/vm/cogit.h +++ b/spurlowcode64src/vm/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ diff --git a/spurlowcode64src/vm/cogitX64.c b/spurlowcode64src/vm/cogitX64.c index 306e2b7e8..6c212f9df 100644 --- a/spurlowcode64src/vm/cogitX64.c +++ b/spurlowcode64src/vm/cogitX64.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -616,7 +616,7 @@ static sqInt NoDbgRegParms fillInBlockHeadersAt(sqInt startAddress); static CogMethod * NoDbgRegParms fillInMethodHeadersizeselector(CogMethod *method, sqInt size, sqInt selector); static sqInt NoDbgRegParms findBackwardBranchIsBackwardBranchMcpcBcpcMatchingBcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetBcpc); static usqInt NoDbgRegParms findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc); -static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); +static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); extern CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); static sqInt NoDbgRegParms findIsBackwardBranchMcpcBcpcMatchingMcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetMcpc); static usqInt NoDbgRegParms firstMappedPCFor(CogMethod *cogMethod); @@ -694,7 +694,7 @@ static BytecodeDescriptor * loadBytesAndGetDescriptor(void); static void NoDbgRegParms loadSubsequentBytesForDescriptorat(BytecodeDescriptor *descriptor, sqInt pc); static AbstractInstruction * NoDbgRegParms gMoveAwR(sqInt address, sqInt reg); static AbstractInstruction * NoDbgRegParms gMoveCwR(sqInt wordConstant, sqInt reg); -static sqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); +static usqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); static sqInt NoDbgRegParms mapForperformUntilarg(CogMethod *cogMethod, sqInt (*functionSymbol)(sqInt annotation, char *mcpc, sqInt arg), sqInt arg); static sqInt NoDbgRegParms mapObjectReferencesInClosedPIC(CogMethod *cPIC); static void mapObjectReferencesInGeneratedRuntime(void); @@ -6058,7 +6058,7 @@ findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc) } /* Cogit>>#findMapLocationForMcpc:inMethod: */ -static usqInt NoDbgRegParms +static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) { sqInt annotation; @@ -7967,7 +7967,7 @@ gMoveCwR(sqInt wordConstant, sqInt reg) /* Answer the address of the null byte at the end of the method map. */ /* Cogit>>#mapEndFor: */ -static sqInt NoDbgRegParms +static usqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod) { usqInt end; @@ -10927,8 +10927,8 @@ freeOlderMethodsForCompaction(void) sqInt initialFreeSpace; sqInt zoneSize; - zoneSize = limitAddress - baseAddress; - initialFreeSpace = (limitAddress - mzFreeStart) + methodBytesFreedSinceLastCompaction; + zoneSize = ((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - baseAddress; + initialFreeSpace = (((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - mzFreeStart) + methodBytesFreedSinceLastCompaction; freedSoFar = initialFreeSpace; /* 4 needs to be e.g. a start-up parameter */ @@ -14202,6 +14202,9 @@ genPrimitiveIdentityHash(void) genoperand(RetN, 0); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); diff --git a/spurlowcode64src/vm/cointerp.c b/spurlowcode64src/vm/cointerp.c index cac71a857..79fda06cc 100644 --- a/spurlowcode64src/vm/cointerp.c +++ b/spurlowcode64src/vm/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -732,6 +732,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1893,6 +1894,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2505,7 +2507,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -31850,7 +31852,7 @@ interpret(void) sqInt header1; sqInt i; int ignoreContext; - usqInt newClosure; + sqInt newClosure; usqInt newClosure1; usqInt newObj; sqInt numArgs; @@ -35698,7 +35700,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - usqInt oop; + sqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -40234,6 +40236,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -50928,6 +50931,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -61607,7 +61657,7 @@ scavengeFutureSurvivorSpaceStartingAt(sqInt initialAddress) usqInt numSlots1; usqInt numSlots2; sqInt obj; - usqInt ptr; + sqInt ptr; usqInt slotBytes; ptr = initialAddress; @@ -91207,7 +91257,7 @@ removeFirstLinkOfList(sqInt aList) static sqInt retryPrimitiveOnFailure(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - signed char accessorDepth; + sqInt accessorDepth; sqInt canRetry; sqInt firstBytecode; sqInt followDone; @@ -98631,6 +98681,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spurlowcode64src/vm/cointerp.h b/spurlowcode64src/vm/cointerp.h index b47e089e8..f3ac0fb14 100644 --- a/spurlowcode64src/vm/cointerp.h +++ b/spurlowcode64src/vm/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ diff --git a/spurlowcode64src/vm/gcc3x-cointerp.c b/spurlowcode64src/vm/gcc3x-cointerp.c index f23766c6b..57606e329 100644 --- a/spurlowcode64src/vm/gcc3x-cointerp.c +++ b/spurlowcode64src/vm/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -735,6 +735,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1896,6 +1897,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2508,7 +2510,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -31859,7 +31861,7 @@ interpret(void) sqInt header1; sqInt i; int ignoreContext; - usqInt newClosure; + sqInt newClosure; usqInt newClosure1; usqInt newObj; sqInt numArgs; @@ -35707,7 +35709,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - usqInt oop; + sqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -40243,6 +40245,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -50937,6 +50940,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -61616,7 +61666,7 @@ scavengeFutureSurvivorSpaceStartingAt(sqInt initialAddress) usqInt numSlots1; usqInt numSlots2; sqInt obj; - usqInt ptr; + sqInt ptr; usqInt slotBytes; ptr = initialAddress; @@ -91216,7 +91266,7 @@ removeFirstLinkOfList(sqInt aList) static sqInt retryPrimitiveOnFailure(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - signed char accessorDepth; + sqInt accessorDepth; sqInt canRetry; sqInt firstBytecode; sqInt followDone; @@ -98640,6 +98690,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spurlowcodesrc/vm/cogit.h b/spurlowcodesrc/vm/cogit.h index dd101f1db..7e8c42158 100644 --- a/spurlowcodesrc/vm/cogit.h +++ b/spurlowcodesrc/vm/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ diff --git a/spurlowcodesrc/vm/cogitARMv5.c b/spurlowcodesrc/vm/cogitARMv5.c index 62ff1f085..8a2998f2b 100644 --- a/spurlowcodesrc/vm/cogitARMv5.c +++ b/spurlowcodesrc/vm/cogitARMv5.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -715,7 +715,7 @@ static sqInt NoDbgRegParms fillInBlockHeadersAt(sqInt startAddress); static CogMethod * NoDbgRegParms fillInMethodHeadersizeselector(CogMethod *method, sqInt size, sqInt selector); static sqInt NoDbgRegParms findBackwardBranchIsBackwardBranchMcpcBcpcMatchingBcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetBcpc); static usqInt NoDbgRegParms findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc); -static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); +static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); extern CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); static sqInt NoDbgRegParms findIsBackwardBranchMcpcBcpcMatchingMcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetMcpc); static usqInt NoDbgRegParms firstMappedPCFor(CogMethod *cogMethod); @@ -794,7 +794,7 @@ static BytecodeDescriptor * loadBytesAndGetDescriptor(void); static void NoDbgRegParms loadSubsequentBytesForDescriptorat(BytecodeDescriptor *descriptor, sqInt pc); static AbstractInstruction * NoDbgRegParms gMoveAwR(sqInt address, sqInt reg); static AbstractInstruction * NoDbgRegParms gMoveCwR(sqInt wordConstant, sqInt reg); -static usqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); +static sqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); static sqInt NoDbgRegParms mapForperformUntilarg(CogMethod *cogMethod, sqInt (*functionSymbol)(sqInt annotation, char *mcpc, sqInt arg), sqInt arg); static sqInt NoDbgRegParms mapObjectReferencesInClosedPIC(CogMethod *cPIC); static void mapObjectReferencesInGeneratedRuntime(void); @@ -10831,7 +10831,7 @@ findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc) } /* Cogit>>#findMapLocationForMcpc:inMethod: */ -static usqInt NoDbgRegParms +static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) { sqInt annotation; @@ -12794,7 +12794,7 @@ gMoveCwR(sqInt wordConstant, sqInt reg) /* Answer the address of the null byte at the end of the method map. */ /* Cogit>>#mapEndFor: */ -static usqInt NoDbgRegParms +static sqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod) { usqInt end; @@ -15722,8 +15722,8 @@ freeOlderMethodsForCompaction(void) sqInt initialFreeSpace; sqInt zoneSize; - zoneSize = limitAddress - baseAddress; - initialFreeSpace = (limitAddress - mzFreeStart) + methodBytesFreedSinceLastCompaction; + zoneSize = ((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - baseAddress; + initialFreeSpace = (((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - mzFreeStart) + methodBytesFreedSinceLastCompaction; freedSoFar = initialFreeSpace; /* 4 needs to be e.g. a start-up parameter */ @@ -18882,6 +18882,9 @@ genPrimitiveIdentityHash(void) /* begin Jump: */ genoperand(Jump, ((sqInt)ret)); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); diff --git a/spurlowcodesrc/vm/cogitIA32.c b/spurlowcodesrc/vm/cogitIA32.c index 79fe15d0f..0f9fcd0df 100644 --- a/spurlowcodesrc/vm/cogitIA32.c +++ b/spurlowcodesrc/vm/cogitIA32.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -15557,8 +15557,8 @@ freeOlderMethodsForCompaction(void) sqInt initialFreeSpace; sqInt zoneSize; - zoneSize = limitAddress - baseAddress; - initialFreeSpace = (limitAddress - mzFreeStart) + methodBytesFreedSinceLastCompaction; + zoneSize = ((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - baseAddress; + initialFreeSpace = (((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - mzFreeStart) + methodBytesFreedSinceLastCompaction; freedSoFar = initialFreeSpace; /* 4 needs to be e.g. a start-up parameter */ @@ -18488,6 +18488,9 @@ genPrimitiveIdentityHash(void) /* begin Jump: */ genoperand(Jump, ((sqInt)ret)); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); diff --git a/spurlowcodesrc/vm/cogitMIPSEL.c b/spurlowcodesrc/vm/cogitMIPSEL.c index ed074debe..f88eefd33 100644 --- a/spurlowcodesrc/vm/cogitMIPSEL.c +++ b/spurlowcodesrc/vm/cogitMIPSEL.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -2859,7 +2859,7 @@ static sqInt NoDbgRegParms blockDispatchTargetsForperformarg(CogMethod *cogMethod, usqInt (*binaryFunction)(sqInt mcpc, sqInt arg), sqInt arg) { sqInt blockEntry; - usqInt end; + sqInt end; sqInt pc; sqInt result; usqInt targetpc; @@ -5309,7 +5309,7 @@ configureMNUCPICmethodOperandnumArgsdelta(CogMethod *cPIC, sqInt methodOperand, static sqInt NoDbgRegParms cPICCompactAndIsNowEmpty(CogMethod *cPIC) { - sqInt entryPoint; + usqInt entryPoint; sqInt followingAddress; sqInt i; sqInt methods[MaxCPICCases]; @@ -5410,7 +5410,7 @@ cPICHasForwardedClass(CogMethod *cPIC) static sqInt NoDbgRegParms cPICHasFreedTargets(CogMethod *cPIC) { - usqInt entryPoint; + sqInt entryPoint; sqInt i; sqInt pc; CogMethod *targetMethod; @@ -9300,7 +9300,7 @@ static void NoDbgRegParms relocateCallsInClosedPIC(CogMethod *cPIC) { sqLong callDelta; - usqInt entryPoint; + sqInt entryPoint; sqInt i; sqInt pc; sqLong refDelta; @@ -10629,8 +10629,8 @@ freeOlderMethodsForCompaction(void) sqInt initialFreeSpace; sqInt zoneSize; - zoneSize = limitAddress - baseAddress; - initialFreeSpace = (limitAddress - mzFreeStart) + methodBytesFreedSinceLastCompaction; + zoneSize = ((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - baseAddress; + initialFreeSpace = (((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - mzFreeStart) + methodBytesFreedSinceLastCompaction; freedSoFar = initialFreeSpace; /* 4 needs to be e.g. a start-up parameter */ @@ -15068,7 +15068,7 @@ relocateCallBeforeReturnPCby(AbstractInstruction * self_in_relocateCallBeforeRet static AbstractInstruction * NoDbgRegParms relocateJumpLongBeforeFollowingAddressby(AbstractInstruction * self_in_relocateJumpLongBeforeFollowingAddressby, sqInt pc, sqInt delta) { - sqInt newTarget; + usqInt newTarget; usqInt oldTarget; assert((delta % 4) == 0); @@ -17751,6 +17751,9 @@ genPrimitiveIdentityHash(void) /* begin Jump: */ genoperand(Jump, ((sqInt)ret)); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); diff --git a/spurlowcodesrc/vm/cointerp.c b/spurlowcodesrc/vm/cointerp.c index b5c10b976..a92ad6e3a 100644 --- a/spurlowcodesrc/vm/cointerp.c +++ b/spurlowcodesrc/vm/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -732,6 +732,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1871,6 +1872,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2483,7 +2485,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -34186,7 +34188,7 @@ ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize sqInt oop; char *p; char *sp; - sqInt startBcpc; + unsigned short startBcpc; sqInt top; assert(addressCouldBeOop(aNonBooleanObject)); @@ -34990,7 +34992,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - usqInt oop; + sqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -39679,6 +39681,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -50360,6 +50363,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -89706,7 +89756,7 @@ removeFirstLinkOfList(sqInt aList) static sqInt retryPrimitiveOnFailure(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - signed char accessorDepth; + sqInt accessorDepth; sqInt canRetry; sqInt firstBytecode; sqInt followDone; @@ -97366,6 +97416,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spurlowcodesrc/vm/cointerp.h b/spurlowcodesrc/vm/cointerp.h index 4c4f2ffd9..7adcf7551 100644 --- a/spurlowcodesrc/vm/cointerp.h +++ b/spurlowcodesrc/vm/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ diff --git a/spurlowcodesrc/vm/gcc3x-cointerp.c b/spurlowcodesrc/vm/gcc3x-cointerp.c index 009fda2ac..1aa80bd91 100644 --- a/spurlowcodesrc/vm/gcc3x-cointerp.c +++ b/spurlowcodesrc/vm/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -735,6 +735,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1874,6 +1875,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2486,7 +2488,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -34195,7 +34197,7 @@ ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize sqInt oop; char *p; char *sp; - sqInt startBcpc; + unsigned short startBcpc; sqInt top; assert(addressCouldBeOop(aNonBooleanObject)); @@ -34999,7 +35001,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - usqInt oop; + sqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -39688,6 +39690,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -50369,6 +50372,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -89715,7 +89765,7 @@ removeFirstLinkOfList(sqInt aList) static sqInt retryPrimitiveOnFailure(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - signed char accessorDepth; + sqInt accessorDepth; sqInt canRetry; sqInt firstBytecode; sqInt followDone; @@ -97375,6 +97425,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spurlowcodestack64src/vm/gcc3x-interp.c b/spurlowcodestack64src/vm/gcc3x-interp.c index d93ff6454..8df0ebf5f 100644 --- a/spurlowcodestack64src/vm/gcc3x-interp.c +++ b/spurlowcodestack64src/vm/gcc3x-interp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -458,6 +458,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1655,6 +1656,7 @@ static void (*interruptCheckChain)(void) = 0; char * breakSelector; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2236,7 +2238,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2160]"; +const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2165]"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -32667,6 +32669,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -74616,6 +74665,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); return dataSize; } @@ -84279,6 +84329,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spurlowcodestack64src/vm/interp.c b/spurlowcodestack64src/vm/interp.c index 16c7a9f57..a2be55a8b 100644 --- a/spurlowcodestack64src/vm/interp.c +++ b/spurlowcodestack64src/vm/interp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -455,6 +455,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1652,6 +1653,7 @@ static void (*interruptCheckChain)(void) = 0; char * breakSelector; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2233,7 +2235,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2160]"; +const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2165]"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -32658,6 +32660,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -74607,6 +74656,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); return dataSize; } @@ -84270,6 +84320,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spurlowcodestacksrc/vm/gcc3x-interp.c b/spurlowcodestacksrc/vm/gcc3x-interp.c index fd35c9323..f78608143 100644 --- a/spurlowcodestacksrc/vm/gcc3x-interp.c +++ b/spurlowcodestacksrc/vm/gcc3x-interp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -458,6 +458,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1635,6 +1636,7 @@ static void (*interruptCheckChain)(void) = 0; char * breakSelector; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2216,7 +2218,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2160]"; +const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2165]"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -32077,6 +32079,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -73139,6 +73188,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); return dataSize; } @@ -83037,6 +83087,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spurlowcodestacksrc/vm/interp.c b/spurlowcodestacksrc/vm/interp.c index 3fc14a298..032ffa74a 100644 --- a/spurlowcodestacksrc/vm/interp.c +++ b/spurlowcodestacksrc/vm/interp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -455,6 +455,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1632,6 +1633,7 @@ static void (*interruptCheckChain)(void) = 0; char * breakSelector; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2213,7 +2215,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2160]"; +const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2165]"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -32068,6 +32070,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -73130,6 +73179,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); return dataSize; } @@ -83028,6 +83078,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spursista64src/vm/cogit.h b/spursista64src/vm/cogit.h index 8765be490..f359d988f 100644 --- a/spursista64src/vm/cogit.h +++ b/spursista64src/vm/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ diff --git a/spursista64src/vm/cogitX64.c b/spursista64src/vm/cogitX64.c index eac4ffd19..07e47c8aa 100644 --- a/spursista64src/vm/cogitX64.c +++ b/spursista64src/vm/cogitX64.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - SistaCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + SistaCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -3733,7 +3733,7 @@ static sqInt NoDbgRegParms closedPICRefersToUnmarkedObject(CogMethod *cPIC) { sqInt i; - usqInt object; + sqInt object; sqInt pc; if (!((isImmediate((cPIC->selector))) @@ -10047,8 +10047,8 @@ freeOlderMethodsForCompaction(void) sqInt initialFreeSpace; sqInt zoneSize; - zoneSize = limitAddress - baseAddress; - initialFreeSpace = (limitAddress - mzFreeStart) + methodBytesFreedSinceLastCompaction; + zoneSize = ((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - baseAddress; + initialFreeSpace = (((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - mzFreeStart) + methodBytesFreedSinceLastCompaction; freedSoFar = initialFreeSpace; /* 4 needs to be e.g. a start-up parameter */ @@ -13038,6 +13038,9 @@ genPrimitiveIdentityHash(void) genoperand(RetN, 0); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); diff --git a/spursista64src/vm/cointerp.c b/spursista64src/vm/cointerp.c index ee86a5cca..503886b58 100644 --- a/spursista64src/vm/cointerp.c +++ b/spursista64src/vm/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -729,6 +729,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1887,6 +1888,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2499,7 +2501,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -17978,7 +17980,7 @@ ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize sqInt oop; char *p; char *sp; - sqInt startBcpc; + unsigned short startBcpc; sqInt top; assert(addressCouldBeOop(aNonBooleanObject)); @@ -18780,7 +18782,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - sqInt oop; + usqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -22424,7 +22426,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - usqInt numTemps; + sqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; sqInt theMethod; @@ -23271,6 +23273,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -34046,6 +34049,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -34689,7 +34739,7 @@ primitiveImmediateAsInteger(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt oop; char *sp; - sqInt value; + usqInt value; value = 0; oop = longAt(GIV(stackPointer)); @@ -34716,7 +34766,7 @@ primitiveImmediateAsInteger(void) } } /* begin pop:thenPushInteger: */ - longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (((usqInt)value << 3) | 1)); + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((value << 3) | 1)); GIV(stackPointer) = sp; } @@ -44746,7 +44796,7 @@ scavengeFutureSurvivorSpaceStartingAt(sqInt initialAddress) usqInt numSlots1; usqInt numSlots2; sqInt obj; - sqInt ptr; + usqInt ptr; usqInt slotBytes; ptr = initialAddress; @@ -81692,6 +81742,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spursista64src/vm/cointerp.h b/spursista64src/vm/cointerp.h index 41d12847a..656ad93d8 100644 --- a/spursista64src/vm/cointerp.h +++ b/spursista64src/vm/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ diff --git a/spursista64src/vm/gcc3x-cointerp.c b/spursista64src/vm/gcc3x-cointerp.c index d5c95592c..7beeb4356 100644 --- a/spursista64src/vm/gcc3x-cointerp.c +++ b/spursista64src/vm/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -732,6 +732,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1890,6 +1891,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2502,7 +2504,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -17987,7 +17989,7 @@ ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize sqInt oop; char *p; char *sp; - sqInt startBcpc; + unsigned short startBcpc; sqInt top; assert(addressCouldBeOop(aNonBooleanObject)); @@ -18789,7 +18791,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - sqInt oop; + usqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -22433,7 +22435,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - usqInt numTemps; + sqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; sqInt theMethod; @@ -23280,6 +23282,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -34055,6 +34058,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -34698,7 +34748,7 @@ primitiveImmediateAsInteger(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt oop; char *sp; - sqInt value; + usqInt value; value = 0; oop = longAt(GIV(stackPointer)); @@ -34725,7 +34775,7 @@ primitiveImmediateAsInteger(void) } } /* begin pop:thenPushInteger: */ - longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (((usqInt)value << 3) | 1)); + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((value << 3) | 1)); GIV(stackPointer) = sp; } @@ -44755,7 +44805,7 @@ scavengeFutureSurvivorSpaceStartingAt(sqInt initialAddress) usqInt numSlots1; usqInt numSlots2; sqInt obj; - sqInt ptr; + usqInt ptr; usqInt slotBytes; ptr = initialAddress; @@ -81701,6 +81751,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spursistasrc/vm/cogit.h b/spursistasrc/vm/cogit.h index 8765be490..f359d988f 100644 --- a/spursistasrc/vm/cogit.h +++ b/spursistasrc/vm/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ diff --git a/spursistasrc/vm/cogitARMv5.c b/spursistasrc/vm/cogitARMv5.c index 8dc80a0ae..52537c270 100644 --- a/spursistasrc/vm/cogitARMv5.c +++ b/spursistasrc/vm/cogitARMv5.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - SistaCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + SistaCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -2902,7 +2902,7 @@ concretizeConditionalInstruction(AbstractInstruction * self_in_concretizeConditi { sqInt aWord; sqInt i; - usqInt instr; + sqInt instr; unsigned char savedCond; assert(((self_in_concretizeConditionalInstruction->conditionOrNil)) != null); @@ -7627,7 +7627,7 @@ static sqInt NoDbgRegParms blockDispatchTargetsForperformarg(CogMethod *cogMethod, usqInt (*binaryFunction)(sqInt mcpc, sqInt arg), sqInt arg) { sqInt blockEntry; - sqInt end; + usqInt end; sqInt pc; sqInt result; usqInt targetpc; @@ -14911,8 +14911,8 @@ freeOlderMethodsForCompaction(void) sqInt initialFreeSpace; sqInt zoneSize; - zoneSize = limitAddress - baseAddress; - initialFreeSpace = (limitAddress - mzFreeStart) + methodBytesFreedSinceLastCompaction; + zoneSize = ((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - baseAddress; + initialFreeSpace = (((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - mzFreeStart) + methodBytesFreedSinceLastCompaction; freedSoFar = initialFreeSpace; /* 4 needs to be e.g. a start-up parameter */ @@ -17622,6 +17622,9 @@ genPrimitiveIdentityHash(void) /* begin Jump: */ genoperand(Jump, ((sqInt)ret)); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); diff --git a/spursistasrc/vm/cogitIA32.c b/spursistasrc/vm/cogitIA32.c index 100fe4b3f..ae8ea5a84 100644 --- a/spursistasrc/vm/cogitIA32.c +++ b/spursistasrc/vm/cogitIA32.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - SistaCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + SistaCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -636,7 +636,7 @@ static sqInt extBBytecode(void); static sqInt NoDbgRegParms fillInBlockHeadersAt(sqInt startAddress); static sqInt NoDbgRegParms findBackwardBranchIsBackwardBranchMcpcBcpcMatchingBcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetBcpc); static usqInt NoDbgRegParms findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc); -static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); +static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); extern CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); static sqInt NoDbgRegParms findIsBackwardBranchMcpcBcpcMatchingMcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetMcpc); static usqInt NoDbgRegParms firstMappedPCFor(CogMethod *cogMethod); @@ -10111,7 +10111,7 @@ findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc) } /* Cogit>>#findMapLocationForMcpc:inMethod: */ -static usqInt NoDbgRegParms +static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) { sqInt annotation; @@ -14703,8 +14703,8 @@ freeOlderMethodsForCompaction(void) sqInt initialFreeSpace; sqInt zoneSize; - zoneSize = limitAddress - baseAddress; - initialFreeSpace = (limitAddress - mzFreeStart) + methodBytesFreedSinceLastCompaction; + zoneSize = ((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - baseAddress; + initialFreeSpace = (((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - mzFreeStart) + methodBytesFreedSinceLastCompaction; freedSoFar = initialFreeSpace; /* 4 needs to be e.g. a start-up parameter */ @@ -17194,6 +17194,9 @@ genPrimitiveIdentityHash(void) /* begin Jump: */ genoperand(Jump, ((sqInt)ret)); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); diff --git a/spursistasrc/vm/cogitMIPSEL.c b/spursistasrc/vm/cogitMIPSEL.c index 3ae1f7318..492e6948f 100644 --- a/spursistasrc/vm/cogitMIPSEL.c +++ b/spursistasrc/vm/cogitMIPSEL.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - SistaCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + SistaCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -646,7 +646,7 @@ static BytecodeDescriptor * loadBytesAndGetDescriptor(void); static void NoDbgRegParms loadSubsequentBytesForDescriptorat(BytecodeDescriptor *descriptor, sqInt pc); static AbstractInstruction * NoDbgRegParms gMoveAwR(sqInt address, sqInt reg); static AbstractInstruction * NoDbgRegParms gMoveCwR(sqInt wordConstant, sqInt reg); -static sqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); +static usqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); static sqInt NoDbgRegParms mapForperformUntilarg(CogMethod *cogMethod, sqInt (*functionSymbol)(sqInt annotation, char *mcpc, sqInt arg), sqInt arg); static sqInt NoDbgRegParms mapObjectReferencesInClosedPIC(CogMethod *cPIC); static void mapObjectReferencesInGeneratedRuntime(void); @@ -2724,7 +2724,7 @@ static sqInt NoDbgRegParms blockDispatchTargetsForperformarg(CogMethod *cogMethod, usqInt (*binaryFunction)(sqInt mcpc, sqInt arg), sqInt arg) { sqInt blockEntry; - sqInt end; + usqInt end; sqInt pc; sqInt result; usqInt targetpc; @@ -6940,7 +6940,7 @@ gMoveCwR(sqInt wordConstant, sqInt reg) /* Answer the address of the null byte at the end of the method map. */ /* Cogit>>#mapEndFor: */ -static sqInt NoDbgRegParms +static usqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod) { usqInt end; @@ -8535,7 +8535,7 @@ static void NoDbgRegParms relocateCallsInClosedPIC(CogMethod *cPIC) { sqLong callDelta; - usqInt entryPoint; + sqInt entryPoint; sqInt i; sqInt pc; sqLong refDelta; @@ -9853,8 +9853,8 @@ freeOlderMethodsForCompaction(void) sqInt initialFreeSpace; sqInt zoneSize; - zoneSize = limitAddress - baseAddress; - initialFreeSpace = (limitAddress - mzFreeStart) + methodBytesFreedSinceLastCompaction; + zoneSize = ((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - baseAddress; + initialFreeSpace = (((((limitAddress) < allocationThreshold) ? (limitAddress) : allocationThreshold)) - mzFreeStart) + methodBytesFreedSinceLastCompaction; freedSoFar = initialFreeSpace; /* 4 needs to be e.g. a start-up parameter */ @@ -14292,7 +14292,7 @@ relocateCallBeforeReturnPCby(AbstractInstruction * self_in_relocateCallBeforeRet static AbstractInstruction * NoDbgRegParms relocateJumpLongBeforeFollowingAddressby(AbstractInstruction * self_in_relocateJumpLongBeforeFollowingAddressby, sqInt pc, sqInt delta) { - sqInt newTarget; + usqInt newTarget; usqInt oldTarget; assert((delta % 4) == 0); @@ -16535,6 +16535,9 @@ genPrimitiveIdentityHash(void) /* begin Jump: */ genoperand(Jump, ((sqInt)ret)); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); @@ -26727,7 +26730,7 @@ populatewithPICInfoForfirstCacheTag(sqInt tuple, CogMethod *cPIC, sqInt firstCac { sqInt cacheTag; sqInt classOop; - usqInt entryPoint; + sqInt entryPoint; sqInt i; sqInt pc; CogMethod *targetMethod; diff --git a/spursistasrc/vm/cointerp.c b/spursistasrc/vm/cointerp.c index c57dffb80..3392ef882 100644 --- a/spursistasrc/vm/cointerp.c +++ b/spursistasrc/vm/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -729,6 +729,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1865,6 +1866,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2477,7 +2479,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -17136,7 +17138,7 @@ ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize sqInt oop; char *p; char *sp; - unsigned short startBcpc; + sqInt startBcpc; sqInt top; assert(addressCouldBeOop(aNonBooleanObject)); @@ -17940,7 +17942,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - usqInt oop; + sqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -20646,9 +20648,10 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; + sqInt fieldIndex; sqInt hash; sqInt hash1; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -20707,7 +20710,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l15; @@ -20725,10 +20728,12 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + fieldIndex = index - SelectorStart; + /* begin fetchPointer:ofObject: */ + objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); if (((objOop1 & (tagMask())) == 0) && (((longAt(objOop1)) & (classIndexMask())) == (isForwardedObjectClassIndexPun()))) { - objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); + objOop1 = fixFollowedFieldofObjectwithInitialValue(fieldIndex, methodArray, objOop1); } mnuMethod = objOop1; goto l15; @@ -21741,7 +21746,7 @@ printFrameWithSP(char *theFP, char *theSP) char *rcvrAddress; sqInt rcvrOrClosure; sqInt theMethod; - sqInt theMethodEnd; + usqInt theMethodEnd; sqInt topThing; if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) @@ -22584,6 +22589,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -33344,6 +33350,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -34081,7 +34134,7 @@ primitiveImmediateAsInteger(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt oop; char *sp; - sqInt value; + usqInt value; value = 0; oop = longAt(GIV(stackPointer)); @@ -34100,7 +34153,7 @@ primitiveImmediateAsInteger(void) } } /* begin pop:thenPushInteger: */ - longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (((usqInt)value << 1) | 1)); + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((value << 1) | 1)); GIV(stackPointer) = sp; } @@ -43077,7 +43130,7 @@ scavengeFutureSurvivorSpaceStartingAt(sqInt initialAddress) usqInt numSlots1; usqInt numSlots2; sqInt obj; - usqInt ptr; + sqInt ptr; usqInt slotBytes; ptr = initialAddress; @@ -68055,9 +68108,10 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; + sqInt fieldIndex; sqInt hash; sqInt hash1; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -68111,7 +68165,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l12; @@ -68129,10 +68183,12 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop11 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + fieldIndex = index - SelectorStart; + /* begin fetchPointer:ofObject: */ + objOop11 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); if (((objOop11 & (tagMask())) == 0) && (((longAt(objOop11)) & (classIndexMask())) == (isForwardedObjectClassIndexPun()))) { - objOop11 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop11); + objOop11 = fixFollowedFieldofObjectwithInitialValue(fieldIndex, methodArray, objOop11); } meth = objOop11; goto l12; @@ -80280,6 +80336,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spursistasrc/vm/cointerp.h b/spursistasrc/vm/cointerp.h index dd828f6db..f92cabf26 100644 --- a/spursistasrc/vm/cointerp.h +++ b/spursistasrc/vm/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ diff --git a/spursistasrc/vm/gcc3x-cointerp.c b/spursistasrc/vm/gcc3x-cointerp.c index ec7e87bd4..0fcba14c3 100644 --- a/spursistasrc/vm/gcc3x-cointerp.c +++ b/spursistasrc/vm/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -732,6 +732,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1868,6 +1869,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2480,7 +2482,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -17145,7 +17147,7 @@ ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize sqInt oop; char *p; char *sp; - unsigned short startBcpc; + sqInt startBcpc; sqInt top; assert(addressCouldBeOop(aNonBooleanObject)); @@ -17949,7 +17951,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - usqInt oop; + sqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -20655,9 +20657,10 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; + sqInt fieldIndex; sqInt hash; sqInt hash1; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -20716,7 +20719,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l15; @@ -20734,10 +20737,12 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + fieldIndex = index - SelectorStart; + /* begin fetchPointer:ofObject: */ + objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); if (((objOop1 & (tagMask())) == 0) && (((longAt(objOop1)) & (classIndexMask())) == (isForwardedObjectClassIndexPun()))) { - objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); + objOop1 = fixFollowedFieldofObjectwithInitialValue(fieldIndex, methodArray, objOop1); } mnuMethod = objOop1; goto l15; @@ -21750,7 +21755,7 @@ printFrameWithSP(char *theFP, char *theSP) char *rcvrAddress; sqInt rcvrOrClosure; sqInt theMethod; - sqInt theMethodEnd; + usqInt theMethodEnd; sqInt topThing; if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) @@ -22593,6 +22598,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -33353,6 +33359,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -34090,7 +34143,7 @@ primitiveImmediateAsInteger(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt oop; char *sp; - sqInt value; + usqInt value; value = 0; oop = longAt(GIV(stackPointer)); @@ -34109,7 +34162,7 @@ primitiveImmediateAsInteger(void) } } /* begin pop:thenPushInteger: */ - longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (((usqInt)value << 1) | 1)); + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((value << 1) | 1)); GIV(stackPointer) = sp; } @@ -43086,7 +43139,7 @@ scavengeFutureSurvivorSpaceStartingAt(sqInt initialAddress) usqInt numSlots1; usqInt numSlots2; sqInt obj; - usqInt ptr; + sqInt ptr; usqInt slotBytes; ptr = initialAddress; @@ -68064,9 +68117,10 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; + sqInt fieldIndex; sqInt hash; sqInt hash1; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -68120,7 +68174,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l12; @@ -68138,10 +68192,12 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop11 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + fieldIndex = index - SelectorStart; + /* begin fetchPointer:ofObject: */ + objOop11 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); if (((objOop11 & (tagMask())) == 0) && (((longAt(objOop11)) & (classIndexMask())) == (isForwardedObjectClassIndexPun()))) { - objOop11 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop11); + objOop11 = fixFollowedFieldofObjectwithInitialValue(fieldIndex, methodArray, objOop11); } meth = objOop11; goto l12; @@ -80289,6 +80345,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spursrc/vm/cogit.h b/spursrc/vm/cogit.h index ac7d585df..689693fa9 100644 --- a/spursrc/vm/cogit.h +++ b/spursrc/vm/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ diff --git a/spursrc/vm/cogitARMv5.c b/spursrc/vm/cogitARMv5.c index f4b03dee1..27fb57e9c 100644 --- a/spursrc/vm/cogitARMv5.c +++ b/spursrc/vm/cogitARMv5.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -17542,6 +17542,9 @@ genPrimitiveIdentityHash(void) /* begin Jump: */ genoperand(Jump, ((sqInt)ret)); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); diff --git a/spursrc/vm/cogitIA32.c b/spursrc/vm/cogitIA32.c index 9a366681e..016a21ac2 100644 --- a/spursrc/vm/cogitIA32.c +++ b/spursrc/vm/cogitIA32.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -632,7 +632,7 @@ static sqInt NoDbgRegParms fillInBlockHeadersAt(sqInt startAddress); static CogMethod * NoDbgRegParms fillInMethodHeadersizeselector(CogMethod *method, sqInt size, sqInt selector); static sqInt NoDbgRegParms findBackwardBranchIsBackwardBranchMcpcBcpcMatchingBcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetBcpc); static usqInt NoDbgRegParms findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc); -static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); +static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); extern CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); static sqInt NoDbgRegParms findIsBackwardBranchMcpcBcpcMatchingMcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetMcpc); static usqInt NoDbgRegParms firstMappedPCFor(CogMethod *cogMethod); @@ -701,7 +701,7 @@ static BytecodeDescriptor * loadBytesAndGetDescriptor(void); static void NoDbgRegParms loadSubsequentBytesForDescriptorat(BytecodeDescriptor *descriptor, sqInt pc); static AbstractInstruction * NoDbgRegParms gMoveAwR(sqInt address, sqInt reg); static AbstractInstruction * NoDbgRegParms gMoveCwR(sqInt wordConstant, sqInt reg); -static sqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); +static usqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); static sqInt NoDbgRegParms mapForperformUntilarg(CogMethod *cogMethod, sqInt (*functionSymbol)(sqInt annotation, char *mcpc, sqInt arg), sqInt arg); static sqInt NoDbgRegParms mapObjectReferencesInClosedPIC(CogMethod *cPIC); static void mapObjectReferencesInGeneratedRuntime(void); @@ -10093,7 +10093,7 @@ findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc) } /* Cogit>>#findMapLocationForMcpc:inMethod: */ -static sqInt NoDbgRegParms +static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) { sqInt annotation; @@ -11835,7 +11835,7 @@ gMoveCwR(sqInt wordConstant, sqInt reg) /* Answer the address of the null byte at the end of the method map. */ /* Cogit>>#mapEndFor: */ -static sqInt NoDbgRegParms +static usqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod) { usqInt end; @@ -17138,6 +17138,9 @@ genPrimitiveIdentityHash(void) /* begin Jump: */ genoperand(Jump, ((sqInt)ret)); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); diff --git a/spursrc/vm/cogitMIPSEL.c b/spursrc/vm/cogitMIPSEL.c index 58e07f165..afceba9fd 100644 --- a/spursrc/vm/cogitMIPSEL.c +++ b/spursrc/vm/cogitMIPSEL.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -4749,7 +4749,7 @@ configureMNUCPICmethodOperandnumArgsdelta(CogMethod *cPIC, sqInt methodOperand, static sqInt NoDbgRegParms cPICCompactAndIsNowEmpty(CogMethod *cPIC) { - usqInt entryPoint; + sqInt entryPoint; sqInt followingAddress; sqInt i; sqInt methods[MaxCPICCases]; @@ -4850,7 +4850,7 @@ cPICHasForwardedClass(CogMethod *cPIC) static sqInt NoDbgRegParms cPICHasFreedTargets(CogMethod *cPIC) { - usqInt entryPoint; + sqInt entryPoint; sqInt i; sqInt pc; CogMethod *targetMethod; @@ -14256,7 +14256,7 @@ relocateCallBeforeReturnPCby(AbstractInstruction * self_in_relocateCallBeforeRet static AbstractInstruction * NoDbgRegParms relocateJumpLongBeforeFollowingAddressby(AbstractInstruction * self_in_relocateJumpLongBeforeFollowingAddressby, sqInt pc, sqInt delta) { - sqInt newTarget; + usqInt newTarget; usqInt oldTarget; assert((delta % 4) == 0); @@ -14309,7 +14309,7 @@ relocateJumpLongConditionalBeforeFollowingAddressby(AbstractInstruction * self_i static AbstractInstruction * NoDbgRegParms relocateMethodReferenceBeforeAddressby(AbstractInstruction * self_in_relocateMethodReferenceBeforeAddressby, sqInt pc, sqInt delta) { - sqInt newValue; + usqInt newValue; usqInt oldValue; if (((opcodeAtAddress(self_in_relocateMethodReferenceBeforeAddressby, pc - 8)) == ADDIU) @@ -16458,6 +16458,9 @@ genPrimitiveIdentityHash(void) /* begin Jump: */ genoperand(Jump, ((sqInt)ret)); jmpTarget(jumpNotSet, genoperandoperand(Label, (labelCounter += 1), bytecodePC)); + if (!(primitiveIndex == 75)) { + return 0; + } /* begin CallRT: */ abstractInstruction = genoperand(Call, ceNewHashTrampoline); (abstractInstruction->annotation = IsRelativeCall); diff --git a/spursrc/vm/cointerp.c b/spursrc/vm/cointerp.c index cecdff74e..643586ef6 100644 --- a/spursrc/vm/cointerp.c +++ b/spursrc/vm/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -722,6 +722,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -870,7 +871,7 @@ static sqInt NoDbgRegParms changeClassOfto(sqInt rcvr, sqInt argClass); static double NoDbgRegParms dbgFloatValueOf(sqInt oop); static sqInt defaultEdenBytes(void); extern sqInt fetchClassTagOf(sqInt oop); -extern usqInt floatObjectOf(double aFloat); +extern sqInt floatObjectOf(double aFloat); extern double floatValueOf(sqInt oop); static sqInt hasSixtyFourBitImmediates(void); extern sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader); @@ -1857,6 +1858,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2469,7 +2471,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -15887,7 +15889,7 @@ ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize sqInt oop; char *p; char *sp; - unsigned short startBcpc; + sqInt startBcpc; sqInt top; assert(addressCouldBeOop(aNonBooleanObject)); @@ -16650,7 +16652,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - usqInt oop; + sqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -20448,7 +20450,7 @@ printFrameWithSP(char *theFP, char *theSP) char *rcvrAddress; sqInt rcvrOrClosure; sqInt theMethod; - usqInt theMethodEnd; + sqInt theMethodEnd; sqInt topThing; if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) @@ -21291,6 +21293,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -31945,6 +31948,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -32682,7 +32732,7 @@ primitiveImmediateAsInteger(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt oop; char *sp; - usqInt value; + sqInt value; value = 0; oop = longAt(GIV(stackPointer)); @@ -32701,7 +32751,7 @@ primitiveImmediateAsInteger(void) } } /* begin pop:thenPushInteger: */ - longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((value << 1) | 1)); + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (((usqInt)value << 1) | 1)); GIV(stackPointer) = sp; } @@ -39978,7 +40028,7 @@ fetchClassTagOf(sqInt oop) } /* Spur32BitMemoryManager>>#floatObjectOf: */ -usqInt +sqInt floatObjectOf(double aFloat) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt newFloatObj; @@ -71222,7 +71272,7 @@ removeFirstLinkOfList(sqInt aList) static sqInt retryPrimitiveOnFailure(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - signed char accessorDepth; + sqInt accessorDepth; sqInt canRetry; sqInt firstBytecode; sqInt followDone; @@ -78849,6 +78899,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spursrc/vm/cointerp.h b/spursrc/vm/cointerp.h index 47de02cb0..274bf5b77 100644 --- a/spursrc/vm/cointerp.h +++ b/spursrc/vm/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ @@ -139,7 +139,7 @@ extern usqInt scavengeThresholdAddress(void); extern sqInt withoutForwardingOnandwithsendToCogit(sqInt obj1, sqInt obj2, sqInt aBool, sqInt (*selector)(sqInt,sqInt,sqInt)); extern sqInt byteSwapped(sqInt w); extern sqInt fetchClassTagOf(sqInt oop); -extern usqInt floatObjectOf(double aFloat); +extern sqInt floatObjectOf(double aFloat); extern sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader); extern sqInt instantiateClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt isIntegerValue(sqInt intValue); diff --git a/spursrc/vm/gcc3x-cointerp.c b/spursrc/vm/gcc3x-cointerp.c index 83e8c6fb7..b21d1ffc4 100644 --- a/spursrc/vm/gcc3x-cointerp.c +++ b/spursrc/vm/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -725,6 +725,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -873,7 +874,7 @@ static sqInt NoDbgRegParms changeClassOfto(sqInt rcvr, sqInt argClass); static double NoDbgRegParms dbgFloatValueOf(sqInt oop); static sqInt defaultEdenBytes(void); extern sqInt fetchClassTagOf(sqInt oop); -extern usqInt floatObjectOf(double aFloat); +extern sqInt floatObjectOf(double aFloat); extern double floatValueOf(sqInt oop); static sqInt hasSixtyFourBitImmediates(void); extern sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader); @@ -1860,6 +1861,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2472,7 +2474,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */] }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -15896,7 +15898,7 @@ ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize sqInt oop; char *p; char *sp; - unsigned short startBcpc; + sqInt startBcpc; sqInt top; assert(addressCouldBeOop(aNonBooleanObject)); @@ -16659,7 +16661,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - usqInt oop; + sqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -20457,7 +20459,7 @@ printFrameWithSP(char *theFP, char *theSP) char *rcvrAddress; sqInt rcvrOrClosure; sqInt theMethod; - usqInt theMethodEnd; + sqInt theMethodEnd; sqInt topThing; if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) @@ -21300,6 +21302,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -31954,6 +31957,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -32691,7 +32741,7 @@ primitiveImmediateAsInteger(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt oop; char *sp; - usqInt value; + sqInt value; value = 0; oop = longAt(GIV(stackPointer)); @@ -32710,7 +32760,7 @@ primitiveImmediateAsInteger(void) } } /* begin pop:thenPushInteger: */ - longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((value << 1) | 1)); + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (((usqInt)value << 1) | 1)); GIV(stackPointer) = sp; } @@ -39987,7 +40037,7 @@ fetchClassTagOf(sqInt oop) } /* Spur32BitMemoryManager>>#floatObjectOf: */ -usqInt +sqInt floatObjectOf(double aFloat) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt newFloatObj; @@ -71231,7 +71281,7 @@ removeFirstLinkOfList(sqInt aList) static sqInt retryPrimitiveOnFailure(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - signed char accessorDepth; + sqInt accessorDepth; sqInt canRetry; sqInt firstBytecode; sqInt followDone; @@ -78858,6 +78908,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spurstack64src/vm/gcc3x-interp.c b/spurstack64src/vm/gcc3x-interp.c index 6b5abde03..adfbc3efc 100644 --- a/spurstack64src/vm/gcc3x-interp.c +++ b/spurstack64src/vm/gcc3x-interp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -455,6 +455,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1640,6 +1641,7 @@ static void (*interruptCheckChain)(void) = 0; char * breakSelector; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2221,7 +2223,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2160]"; +const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2165]"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -21252,6 +21254,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -63099,6 +63148,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); return dataSize; } @@ -72715,6 +72765,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spurstack64src/vm/interp.c b/spurstack64src/vm/interp.c index 40b4b6230..36e192272 100644 --- a/spurstack64src/vm/interp.c +++ b/spurstack64src/vm/interp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -452,6 +452,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1637,6 +1638,7 @@ static void (*interruptCheckChain)(void) = 0; char * breakSelector; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2218,7 +2220,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2160]"; +const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2165]"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -21243,6 +21245,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -63090,6 +63139,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); return dataSize; } @@ -72706,6 +72756,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spurstacksrc/vm/gcc3x-interp.c b/spurstacksrc/vm/gcc3x-interp.c index 8b9f8b9f9..766ca7ec3 100644 --- a/spurstacksrc/vm/gcc3x-interp.c +++ b/spurstacksrc/vm/gcc3x-interp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -455,6 +455,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1620,6 +1621,7 @@ static void (*interruptCheckChain)(void) = 0; char * breakSelector; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2201,7 +2203,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2160]"; +const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2165]"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -20516,6 +20518,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -61463,6 +61512,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); return dataSize; } @@ -71314,6 +71364,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/spurstacksrc/vm/interp.c b/spurstacksrc/vm/interp.c index cc74485ac..7934a0d98 100644 --- a/spurstacksrc/vm/interp.c +++ b/spurstacksrc/vm/interp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -452,6 +452,7 @@ static void primitiveFullClosureValue(void); extern void primitiveFullClosureValueNoContextSwitch(void); static void primitiveFullClosureValueWithArgs(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1617,6 +1618,7 @@ static void (*interruptCheckChain)(void) = 0; char * breakSelector; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { /* 0 */ (void (*)(void))0, @@ -2198,7 +2200,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2160]"; +const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2165]"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -20507,6 +20509,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -61454,6 +61503,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); return dataSize; } @@ -71305,6 +71355,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveDivLargeIntegers\000\377", (void*)primitiveDivLargeIntegers}, {(void*)_m, "primitiveEqualLargeIntegers\000\377", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl\000\377", (void*)primitiveEventProcessingControl}, + {(void*)_m, "primitiveGetenv\000\377", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory\000\377", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel\000\377", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize\000\377", (void*)primitiveGetWindowSize}, diff --git a/src/plugins/SecurityPlugin/SecurityPlugin.c b/src/plugins/SecurityPlugin/SecurityPlugin.c index 4ad13249e..902be28d5 100644 --- a/src/plugins/SecurityPlugin/SecurityPlugin.c +++ b/src/plugins/SecurityPlugin/SecurityPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.1975 uuid: 76250913-236f-47e0-832c-27b05d488807 + VMPluginCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - SecurityPlugin VMMaker.oscog-eem.1975 uuid: 76250913-236f-47e0-832c-27b05d488807 + SecurityPlugin VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "SecurityPlugin VMMaker.oscog-eem.1975 uuid: 76250913-236f-47e0-832c-27b05d488807 " __DATE__ ; +static char __buildInfo[] = "SecurityPlugin VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; @@ -56,6 +56,7 @@ EXPORT(sqInt) secCanWriteImage(void); EXPORT(sqInt) secCanListenOnPort(sqInt socket, sqInt port); EXPORT(sqInt) secDisableFileAccess(void); EXPORT(sqInt) secDisableSocketAccess(void); +EXPORT(sqInt) secHasEnvironmentAccess(void); EXPORT(sqInt) secHasFileAccess(void); EXPORT(sqInt) secHasSocketAccess(void); EXPORT(sqInt) setInterpreter(struct VirtualMachine*anInterpreter); @@ -86,9 +87,9 @@ extern struct VirtualMachine* interpreterProxy; static const char *moduleName = #ifdef SQUEAK_BUILTIN_PLUGIN - "SecurityPlugin VMMaker.oscog-eem.1975 (i)" + "SecurityPlugin VMMaker.oscog-eem.2166 (i)" #else - "SecurityPlugin VMMaker.oscog-eem.1975 (e)" + "SecurityPlugin VMMaker.oscog-eem.2166 (e)" #endif ; @@ -304,6 +305,13 @@ secDisableSocketAccess(void) return ioDisableSocketAccess(); } + /* SecurityPlugin>>#secHasEnvironmentAccess */ +EXPORT(sqInt) +secHasEnvironmentAccess(void) +{ + return ioHasEnvironmentAccess(); +} + /* SecurityPlugin>>#secHasFileAccess */ EXPORT(sqInt) secHasFileAccess(void) @@ -373,6 +381,7 @@ void* SecurityPlugin_exports[][3] = { {(void*)_m, "secCanListenOnPort", (void*)secCanListenOnPort}, {(void*)_m, "secDisableFileAccess\000\377", (void*)secDisableFileAccess}, {(void*)_m, "secDisableSocketAccess\000\377", (void*)secDisableSocketAccess}, + {(void*)_m, "secHasEnvironmentAccess\000\377", (void*)secHasEnvironmentAccess}, {(void*)_m, "secHasFileAccess\000\377", (void*)secHasFileAccess}, {(void*)_m, "secHasSocketAccess\000\377", (void*)secHasSocketAccess}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, diff --git a/src/vm/cogit.h b/src/vm/cogit.h index 262e14cb6..e90e7b65c 100644 --- a/src/vm/cogit.h +++ b/src/vm/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ diff --git a/src/vm/cogitARMv5.c b/src/vm/cogitARMv5.c index 46576083d..3d484131d 100644 --- a/src/vm/cogitARMv5.c +++ b/src/vm/cogitARMv5.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -630,7 +630,7 @@ static sqInt NoDbgRegParms fillInBlockHeadersAt(sqInt startAddress); static CogMethod * NoDbgRegParms fillInMethodHeadersizeselector(CogMethod *method, sqInt size, sqInt selector); static sqInt NoDbgRegParms findBackwardBranchIsBackwardBranchMcpcBcpcMatchingBcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetBcpc); static usqInt NoDbgRegParms findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc); -static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); +static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); extern CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); static sqInt NoDbgRegParms findIsBackwardBranchMcpcBcpcMatchingMcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetMcpc); static usqInt NoDbgRegParms firstMappedPCFor(CogMethod *cogMethod); @@ -2466,7 +2466,7 @@ concretizeConditionalInstruction(AbstractInstruction * self_in_concretizeConditi { sqInt aWord; sqInt i; - sqInt instr; + usqInt instr; unsigned char savedCond; assert(((self_in_concretizeConditionalInstruction->conditionOrNil)) != null); @@ -7118,7 +7118,7 @@ static sqInt NoDbgRegParms blockDispatchTargetsForperformarg(CogMethod *cogMethod, usqInt (*binaryFunction)(sqInt mcpc, sqInt arg), sqInt arg) { sqInt blockEntry; - usqInt end; + sqInt end; sqInt pc; sqInt result; usqInt targetpc; @@ -9570,7 +9570,7 @@ findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc) } /* Cogit>>#findMapLocationForMcpc:inMethod: */ -static usqInt NoDbgRegParms +static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) { sqInt annotation; diff --git a/src/vm/cogitIA32.c b/src/vm/cogitIA32.c index 94ba15bad..93fe73a45 100644 --- a/src/vm/cogitIA32.c +++ b/src/vm/cogitIA32.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -617,7 +617,7 @@ static sqInt NoDbgRegParms fillInBlockHeadersAt(sqInt startAddress); static CogMethod * NoDbgRegParms fillInMethodHeadersizeselector(CogMethod *method, sqInt size, sqInt selector); static sqInt NoDbgRegParms findBackwardBranchIsBackwardBranchMcpcBcpcMatchingBcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetBcpc); static usqInt NoDbgRegParms findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc); -static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); +static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); extern CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); static sqInt NoDbgRegParms findIsBackwardBranchMcpcBcpcMatchingMcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetMcpc); static usqInt NoDbgRegParms firstMappedPCFor(CogMethod *cogMethod); @@ -681,7 +681,7 @@ static void NoDbgRegParms loadSubsequentBytesForDescriptorat(BytecodeDescriptor static AbstractInstruction * NoDbgRegParms gMoveAwR(sqInt address, sqInt reg); static AbstractInstruction * NoDbgRegParms gMoveCwR(sqInt wordConstant, sqInt reg); static AbstractInstruction * NoDbgRegParms gMoveMwrR(sqInt offset, sqInt baseReg, sqInt destReg); -static sqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); +static usqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); static sqInt NoDbgRegParms mapForperformUntilarg(CogMethod *cogMethod, sqInt (*functionSymbol)(sqInt annotation, char *mcpc, sqInt arg), sqInt arg); static sqInt NoDbgRegParms mapObjectReferencesInClosedPIC(CogMethod *cPIC); static void mapObjectReferencesInGeneratedRuntime(void); @@ -7086,7 +7086,7 @@ static sqInt NoDbgRegParms blockDispatchTargetsForperformarg(CogMethod *cogMethod, usqInt (*binaryFunction)(sqInt mcpc, sqInt arg), sqInt arg) { sqInt blockEntry; - sqInt end; + usqInt end; sqInt pc; sqInt result; usqInt targetpc; @@ -9463,7 +9463,7 @@ findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc) } /* Cogit>>#findMapLocationForMcpc:inMethod: */ -static sqInt NoDbgRegParms +static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) { sqInt annotation; @@ -10991,7 +10991,7 @@ gMoveMwrR(sqInt offset, sqInt baseReg, sqInt destReg) /* Answer the address of the null byte at the end of the method map. */ /* Cogit>>#mapEndFor: */ -static sqInt NoDbgRegParms +static usqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod) { usqInt end; diff --git a/src/vm/cogitMIPSEL.c b/src/vm/cogitMIPSEL.c index d853b501f..838cf86c9 100644 --- a/src/vm/cogitMIPSEL.c +++ b/src/vm/cogitMIPSEL.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGenerator VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 from - StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2166 uuid: 7471b7ee-fa31-444f-bc3d-dee21ee090f2 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -559,7 +559,7 @@ static sqInt NoDbgRegParms fillInBlockHeadersAt(sqInt startAddress); static CogMethod * NoDbgRegParms fillInMethodHeadersizeselector(CogMethod *method, sqInt size, sqInt selector); static sqInt NoDbgRegParms findBackwardBranchIsBackwardBranchMcpcBcpcMatchingBcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetBcpc); static usqInt NoDbgRegParms findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc); -static usqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); +static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod); extern CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); static sqInt NoDbgRegParms findIsBackwardBranchMcpcBcpcMatchingMcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranchAndAnnotation, char *mcpc, sqInt bcpc, void *targetMcpc); static usqInt NoDbgRegParms firstMappedPCFor(CogMethod *cogMethod); @@ -623,7 +623,7 @@ static void NoDbgRegParms loadSubsequentBytesForDescriptorat(BytecodeDescriptor static AbstractInstruction * NoDbgRegParms gMoveAwR(sqInt address, sqInt reg); static AbstractInstruction * NoDbgRegParms gMoveCwR(sqInt wordConstant, sqInt reg); static AbstractInstruction * NoDbgRegParms gMoveMwrR(sqInt offset, sqInt baseReg, sqInt destReg); -static usqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); +static sqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod); static sqInt NoDbgRegParms mapForperformUntilarg(CogMethod *cogMethod, sqInt (*functionSymbol)(sqInt annotation, char *mcpc, sqInt arg), sqInt arg); static sqInt NoDbgRegParms mapObjectReferencesInClosedPIC(CogMethod *cPIC); static void mapObjectReferencesInGeneratedRuntime(void); @@ -4166,7 +4166,7 @@ configureMNUCPICmethodOperandnumArgsdelta(CogMethod *cPIC, sqInt methodOperand, static sqInt NoDbgRegParms cPICCompactAndIsNowEmpty(CogMethod *cPIC) { - usqInt entryPoint; + sqInt entryPoint; sqInt followingAddress; sqInt i; sqInt methods[MaxCPICCases]; @@ -4240,7 +4240,7 @@ cPICCompactAndIsNowEmpty(CogMethod *cPIC) static sqInt NoDbgRegParms cPICHasFreedTargets(CogMethod *cPIC) { - sqInt entryPoint; + usqInt entryPoint; sqInt i; sqInt pc; CogMethod *targetMethod; @@ -4609,7 +4609,7 @@ findBlockMethodWithEntrystartBcpc(sqInt blockEntryMcpc, sqInt startBcpc) } /* Cogit>>#findMapLocationForMcpc:inMethod: */ -static usqInt NoDbgRegParms +static sqInt NoDbgRegParms findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) { sqInt annotation; @@ -6124,7 +6124,7 @@ gMoveMwrR(sqInt offset, sqInt baseReg, sqInt destReg) /* Answer the address of the null byte at the end of the method map. */ /* Cogit>>#mapEndFor: */ -static usqInt NoDbgRegParms +static sqInt NoDbgRegParms mapEndFor(CogMethod *cogMethod) { usqInt end; @@ -7712,7 +7712,7 @@ static void NoDbgRegParms relocateCallsInClosedPIC(CogMethod *cPIC) { sqInt callDelta; - sqInt entryPoint; + usqInt entryPoint; sqInt i; sqInt pc; sqInt refDelta; @@ -13207,7 +13207,7 @@ relocateCallBeforeReturnPCby(AbstractInstruction * self_in_relocateCallBeforeRet static AbstractInstruction * NoDbgRegParms relocateJumpLongBeforeFollowingAddressby(AbstractInstruction * self_in_relocateJumpLongBeforeFollowingAddressby, sqInt pc, sqInt delta) { - usqInt newTarget; + sqInt newTarget; usqInt oldTarget; assert((delta % 4) == 0); diff --git a/src/vm/cointerp.c b/src/vm/cointerp.c index df2282300..12f2e784d 100644 --- a/src/vm/cointerp.c +++ b/src/vm/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -694,6 +694,7 @@ EXPORT(sqInt) primitiveForceTenure(void); static void primitiveFormPrint(void); static void primitiveFractionalPart(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1574,6 +1575,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static const sqInt headerTypeBytes[] = { 8, 4, 0, 0 }; @@ -2158,7 +2160,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog[SqueakV3] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog[SqueakV3] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -10832,7 +10834,7 @@ ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize sqInt oop; char *p; char *sp; - unsigned short startBcpc; + sqInt startBcpc; sqInt top; assert(addressCouldBeOop(aNonBooleanObject)); @@ -15478,6 +15480,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -24654,6 +24657,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -32488,12 +32538,12 @@ eeInstantiateClassindexableSize(sqInt classPointer, sqInt size) sqInt binc; sqInt bm1; sqInt byteSize; - usqInt cClass; + sqInt cClass; sqInt classFormat; sqInt format; usqInt hash; int hdrSize; - usqInt header1; + sqInt header1; sqInt header2; sqInt header3; usqInt newChunk; @@ -32634,7 +32684,7 @@ static sqInt NoDbgRegParms eeInstantiateMethodContextSlots(sqInt numSlots) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt hash; - usqInt header1; + sqInt header1; usqInt newChunk; usqInt newFreeStart; sqInt newObj; @@ -32773,7 +32823,7 @@ eeInstantiateSmallClassnumSlots(sqInt classPointer, sqInt numSlots) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt hash; int hdrSize; - usqInt header1; + sqInt header1; sqInt header2; usqInt newChunk; usqInt newFreeStart; @@ -54818,6 +54868,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveEqualLargeIntegers", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl", (void*)primitiveEventProcessingControl}, {(void*)_m, "primitiveForceTenure", (void*)primitiveForceTenure}, + {(void*)_m, "primitiveGetenv", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize", (void*)primitiveGetWindowSize}, diff --git a/src/vm/cointerp.h b/src/vm/cointerp.h index a90415146..68c1cd34b 100644 --- a/src/vm/cointerp.h +++ b/src/vm/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ diff --git a/src/vm/cointerpmt.c b/src/vm/cointerpmt.c index 15fa1b684..f0de70abd 100644 --- a/src/vm/cointerpmt.c +++ b/src/vm/cointerpmt.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreterMT VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreterMT VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -780,6 +780,7 @@ EXPORT(sqInt) primitiveForceTenure(void); static void primitiveFormPrint(void); static void primitiveFractionalPart(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1671,6 +1672,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static const sqInt headerTypeBytes[] = { 8, 4, 0, 0 }; @@ -2255,7 +2257,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; sqInt willNotThreadWarnCount; @@ -11840,7 +11842,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - sqInt oop; + usqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -15038,7 +15040,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - sqInt numTemps; + usqInt numTemps; sqInt oop; char *rcvrAddress; sqInt rcvrOrClosure; @@ -15786,6 +15788,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); GIV(foreignCallbackProcessSlot) = ((lengthOf(GIV(specialObjectsOop))) > ForeignCallbackProcess ? ForeignCallbackProcess : NilObject); @@ -27111,6 +27114,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -34491,7 +34541,7 @@ clone(sqInt obj) sqInt extraHdrBytes; usqInt fromIndex; usqInt hash; - usqInt header; + sqInt header; sqInt header1; usqInt lastFrom; sqInt newChunk; @@ -34649,14 +34699,14 @@ eeInstantiateAndInitializeClassindexableSize(sqInt classPointer, sqInt size) sqInt binc; sqInt bm1; sqInt byteSize; - usqInt cClass; + sqInt cClass; sqInt classFormat; usqInt end; sqInt fillWord; sqInt format; usqInt hash; int hdrSize; - usqInt header1; + sqInt header1; sqInt header2; sqInt header3; usqInt i; @@ -34813,7 +34863,7 @@ eeInstantiateClassIndexformatnumSlots(sqInt compactClassIndex, sqInt objFormat, sqInt byteSize; usqInt hash; sqInt hdrSize; - usqInt header1; + sqInt header1; sqInt header2; sqInt header3; usqInt newChunk; @@ -34916,12 +34966,12 @@ eeInstantiateClassindexableSize(sqInt classPointer, sqInt size) sqInt binc; sqInt bm1; sqInt byteSize; - usqInt cClass; + sqInt cClass; sqInt classFormat; sqInt format; usqInt hash; int hdrSize; - usqInt header1; + sqInt header1; sqInt header2; sqInt header3; usqInt newChunk; @@ -56794,6 +56844,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveEqualLargeIntegers", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl", (void*)primitiveEventProcessingControl}, {(void*)_m, "primitiveForceTenure", (void*)primitiveForceTenure}, + {(void*)_m, "primitiveGetenv", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize", (void*)primitiveGetWindowSize}, diff --git a/src/vm/cointerpmt.h b/src/vm/cointerpmt.h index 5c8873592..6b7b9d7e0 100644 --- a/src/vm/cointerpmt.h +++ b/src/vm/cointerpmt.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ diff --git a/src/vm/gcc3x-cointerp.c b/src/vm/gcc3x-cointerp.c index 23940b32b..389ca804c 100644 --- a/src/vm/gcc3x-cointerp.c +++ b/src/vm/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -697,6 +697,7 @@ EXPORT(sqInt) primitiveForceTenure(void); static void primitiveFormPrint(void); static void primitiveFractionalPart(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1577,6 +1578,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static const sqInt headerTypeBytes[] = { 8, 4, 0, 0 }; @@ -2161,7 +2163,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog[SqueakV3] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog[SqueakV3] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; @@ -10841,7 +10843,7 @@ ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize sqInt oop; char *p; char *sp; - unsigned short startBcpc; + sqInt startBcpc; sqInt top; assert(addressCouldBeOop(aNonBooleanObject)); @@ -15487,6 +15489,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); /* begin initializeCodeGenerator */ initializeCodeZoneFromupTo(memory(), (memory()) + GIV(cogCodeSize)); return dataSize; @@ -24663,6 +24666,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -32497,12 +32547,12 @@ eeInstantiateClassindexableSize(sqInt classPointer, sqInt size) sqInt binc; sqInt bm1; sqInt byteSize; - usqInt cClass; + sqInt cClass; sqInt classFormat; sqInt format; usqInt hash; int hdrSize; - usqInt header1; + sqInt header1; sqInt header2; sqInt header3; usqInt newChunk; @@ -32643,7 +32693,7 @@ static sqInt NoDbgRegParms eeInstantiateMethodContextSlots(sqInt numSlots) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt hash; - usqInt header1; + sqInt header1; usqInt newChunk; usqInt newFreeStart; sqInt newObj; @@ -32782,7 +32832,7 @@ eeInstantiateSmallClassnumSlots(sqInt classPointer, sqInt numSlots) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt hash; int hdrSize; - usqInt header1; + sqInt header1; sqInt header2; usqInt newChunk; usqInt newFreeStart; @@ -54827,6 +54877,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveEqualLargeIntegers", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl", (void*)primitiveEventProcessingControl}, {(void*)_m, "primitiveForceTenure", (void*)primitiveForceTenure}, + {(void*)_m, "primitiveGetenv", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize", (void*)primitiveGetWindowSize}, diff --git a/src/vm/gcc3x-cointerpmt.c b/src/vm/gcc3x-cointerpmt.c index 8e7dccf1f..31f515096 100644 --- a/src/vm/gcc3x-cointerpmt.c +++ b/src/vm/gcc3x-cointerpmt.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - CoInterpreterMT VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba + CoInterpreterMT VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.2161 uuid: 6fbb916c-04e5-42c8-b844-12c5eead9dba " __DATE__ ; +static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -783,6 +783,7 @@ EXPORT(sqInt) primitiveForceTenure(void); static void primitiveFormPrint(void); static void primitiveFractionalPart(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1674,6 +1675,7 @@ static void (*interruptCheckChain)(void) = 0; sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static const sqInt headerTypeBytes[] = { 8, 4, 0, 0 }; @@ -2258,7 +2260,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.2161]"; +const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.2165]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; volatile int sendTrace; sqInt willNotThreadWarnCount; @@ -11849,7 +11851,7 @@ checkStackIntegrity(void) sqInt i; sqInt methodField; sqInt ok; - sqInt oop; + usqInt oop; char *theFP; StackPage *thePage; char *theSP; @@ -15047,7 +15049,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - sqInt numTemps; + usqInt numTemps; sqInt oop; char *rcvrAddress; sqInt rcvrOrClosure; @@ -15795,6 +15797,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); GIV(foreignCallbackProcessSlot) = ((lengthOf(GIV(specialObjectsOop))) > ForeignCallbackProcess ? ForeignCallbackProcess : NilObject); @@ -27120,6 +27123,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -34500,7 +34550,7 @@ clone(sqInt obj) sqInt extraHdrBytes; usqInt fromIndex; usqInt hash; - usqInt header; + sqInt header; sqInt header1; usqInt lastFrom; sqInt newChunk; @@ -34658,14 +34708,14 @@ eeInstantiateAndInitializeClassindexableSize(sqInt classPointer, sqInt size) sqInt binc; sqInt bm1; sqInt byteSize; - usqInt cClass; + sqInt cClass; sqInt classFormat; usqInt end; sqInt fillWord; sqInt format; usqInt hash; int hdrSize; - usqInt header1; + sqInt header1; sqInt header2; sqInt header3; usqInt i; @@ -34822,7 +34872,7 @@ eeInstantiateClassIndexformatnumSlots(sqInt compactClassIndex, sqInt objFormat, sqInt byteSize; usqInt hash; sqInt hdrSize; - usqInt header1; + sqInt header1; sqInt header2; sqInt header3; usqInt newChunk; @@ -34925,12 +34975,12 @@ eeInstantiateClassindexableSize(sqInt classPointer, sqInt size) sqInt binc; sqInt bm1; sqInt byteSize; - usqInt cClass; + sqInt cClass; sqInt classFormat; sqInt format; usqInt hash; int hdrSize; - usqInt header1; + sqInt header1; sqInt header2; sqInt header3; usqInt newChunk; @@ -56803,6 +56853,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveEqualLargeIntegers", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl", (void*)primitiveEventProcessingControl}, {(void*)_m, "primitiveForceTenure", (void*)primitiveForceTenure}, + {(void*)_m, "primitiveGetenv", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize", (void*)primitiveGetWindowSize}, diff --git a/stacksrc/vm/gcc3x-interp.c b/stacksrc/vm/gcc3x-interp.c index cd570a388..abf16c102 100644 --- a/stacksrc/vm/gcc3x-interp.c +++ b/stacksrc/vm/gcc3x-interp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -432,6 +432,7 @@ EXPORT(sqInt) primitiveForceTenure(void); static void primitiveFormPrint(void); static void primitiveFractionalPart(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1341,6 +1342,7 @@ static void (*interruptCheckChain)(void) = 0; char * breakSelector; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static const sqInt headerTypeBytes[] = { 8, 4, 0, 0 }; @@ -1925,7 +1927,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2160]"; +const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2165]"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -14580,6 +14582,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -39960,6 +40009,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); return dataSize; } @@ -47865,6 +47915,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveEqualLargeIntegers", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl", (void*)primitiveEventProcessingControl}, {(void*)_m, "primitiveForceTenure", (void*)primitiveForceTenure}, + {(void*)_m, "primitiveGetenv", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize", (void*)primitiveGetWindowSize}, diff --git a/stacksrc/vm/interp.c b/stacksrc/vm/interp.c index fbaa6b416..254698431 100644 --- a/stacksrc/vm/interp.c +++ b/stacksrc/vm/interp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 from - StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 + StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2160 uuid: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2165 uuid: 2fa022b2-1323-47d7-b2cd-66682edbaf80 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -429,6 +429,7 @@ EXPORT(sqInt) primitiveForceTenure(void); static void primitiveFormPrint(void); static void primitiveFractionalPart(void); static void primitiveGetAttribute(void); +EXPORT(sqInt) primitiveGetenv(void); #if IMMUTABILITY static void primitiveGetImmutability(void); #else @@ -1338,6 +1339,7 @@ static void (*interruptCheckChain)(void) = 0; char * breakSelector; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +static int (*sHEAFn)() = 0; static const sqInt headerTypeBytes[] = { 8, 4, 0, 0 }; @@ -1922,7 +1924,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = { 0 }; sqInt checkedPluginName; char expensiveAsserts = 0; -const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2160]"; +const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2165]"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -14571,6 +14573,53 @@ primitiveGetAttribute(void) } } + +/* Access to environment variables via getenv. No putenv or setenv as yet. */ + + /* InterpreterPrimitives>>#primitiveGetenv */ +EXPORT(sqInt) +primitiveGetenv(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *result; + char *sp; + char *var; + + if (sHEAFn != 0) { + + /* secHasEnvironmentAccess */ + if (!(sHEAFn())) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrInappropriate); + } + } + var = cStringOrNullFor(longAt(GIV(stackPointer))); + if (var == 0) { + if (!GIV(primFailCode)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrBadArgument); + } + return 0; + } + result = getenv(var); + free(var); + if (result != 0) { + result = stringForCString(result); + if (!(result)) { + /* begin primitiveFailFor: */ + return (GIV(primFailCode) = PrimErrNoMemory); + } + } + assert(GIV(primFailCode) == 0); + /* begin pop:thenPush: */ + oop = (result == 0 + ? GIV(nilObj) + : result); + longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; + return 0; +} + /* InterpreterPrimitives>>#primitiveGetImmutability */ #if IMMUTABILITY static void @@ -39951,6 +40000,7 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea while (GIV(globalSessionID) == 0) { GIV(globalSessionID) = (time(NULL)) + (ioMSecs()); } + sHEAFn = ioLoadFunctionFrom("secHasEnvironmentAccess", "SecurityPlugin"); return dataSize; } @@ -47856,6 +47906,7 @@ void* vm_exports[][3] = { {(void*)_m, "primitiveEqualLargeIntegers", (void*)primitiveEqualLargeIntegers}, {(void*)_m, "primitiveEventProcessingControl", (void*)primitiveEventProcessingControl}, {(void*)_m, "primitiveForceTenure", (void*)primitiveForceTenure}, + {(void*)_m, "primitiveGetenv", (void*)primitiveGetenv}, {(void*)_m, "primitiveGetLogDirectory", (void*)primitiveGetLogDirectory}, {(void*)_m, "primitiveGetWindowLabel", (void*)primitiveGetWindowLabel}, {(void*)_m, "primitiveGetWindowSize", (void*)primitiveGetWindowSize},