ObjectFileLoader.st
changeset 1018 011f0c9fa19d
parent 1014 5a62d96fd129
child 1019 f1098d024b00
--- a/ObjectFileLoader.st	Sat Jan 08 01:20:34 2000 +0100
+++ b/ObjectFileLoader.st	Mon Jan 10 22:05:12 2000 +0100
@@ -15,7 +15,7 @@
 	classVariableNames:'MySymbolTable Verbose LastError LinkErrorMessage NextHandleID
 		LoadedObjects PreviouslyLoadedObjects ActuallyLoadedObjects
 		SearchedLibraries LibPath LoadLibraryPath ErrorPrinting
-		LinkCommand LinkArgs LastErrorNumber'
+		LinkCommand LinkArgs LastErrorNumber OldSpaceReserve'
 	poolDictionaries:''
 	category:'System-Compiler'
 !
@@ -3641,13 +3641,22 @@
      (it should then NOT install it, but return the method object instead).
 
      DANGER: Internal & highly specialized. Dont use in your programs.
-	     This interface may change without notice."
-
-    |moduleID retVal|
+             This interface may change without notice."
+
+    |moduleID retVal oldSpaceReserve|
 
     handle notNil ifTrue:[
-	moduleID := handle moduleID
+        moduleID := handle moduleID
     ].
+    "/
+    "/ for various reasons, classes, methods, literals, methodDicts etc.
+    "/ must be allocated in oldSpace when coming from a compiled
+    "/ classLibrary, and no compressing grabage collect is allowed during
+    "/ the creation of those.
+    "/ Therefore, we must ensure, that enough oldSpace reserve is available ...
+    "/ (how much is enough ?)
+    "/
+    oldSpaceReserve := OldSpaceReserve ? (1024*1024).
 
 %{  /* CALLSSTACK: 32000 */
     OBJ (*addr)();
@@ -3658,60 +3667,61 @@
     extern int __oldSpaceSize(), __oldSpaceUsed();
 
     if (__isInteger(address)) {
-	if (_isSmallInteger(argument)) {
-	    arg = __intVal(argument);
-
-	    addr = (OBJFUNC)(__longIntVal(address));
-
-	    /*
-	     * allow function to be interrupted
-	     */
-	    if (interruptable != true) {
-		wasBlocked = (__BLOCKINTERRUPTS() == true);
-	    }
-
-	    force = (forceOld == true);
-	    if (force) {
-		if ((__oldSpaceSize() - __oldSpaceUsed()) < (512*1024)) {
-		    __moreOldSpace(__thisContext, 512*1024);
-		} 
-		prevSpace = __allocForceSpace(OLDSPACE);
-	    }
+        if (_isSmallInteger(argument)) {
+            arg = __intVal(argument);
+
+            addr = (OBJFUNC)(__longIntVal(address));
+
+            /*
+             * allow function to be interrupted
+             */
+            if (interruptable != true) {
+                wasBlocked = (__BLOCKINTERRUPTS() == true);
+            }
+
+            force = (forceOld == true);
+            if (force) {
+                int reserve = __intVal(oldSpaceReserve);
+                if ((__oldSpaceSize() - __oldSpaceUsed()) < reserve) {
+                    __moreOldSpace(__thisContext, reserve);
+                } 
+                prevSpace = __allocForceSpace(OLDSPACE);
+            }
 
 #ifdef alpha
-	    if (@global(Verbose) == true)
-		printf("calling initfunc %lx ...\n", addr);
+            if (@global(Verbose) == true)
+                printf("calling initfunc %lx ...\n", addr);
 #else
-	    if (@global(Verbose) == true)
-		printf("calling initfunc %x ...\n", addr);
+            if (@global(Verbose) == true)
+                printf("calling initfunc %x ...\n", addr);
 #endif
-	    if (special == true) {
-		if (__isSmallInteger(moduleID)) {
-		    __SET_MODULE_ID(__intVal(moduleID));
-		}
-		retVal = (*addr)(arg, __pRT__);
-		__SET_MODULE_ID(0);
-		if (returnsObject != true) {
-		    retVal = nil;
-		}
-	    } else {
-		if (returnsObject == true) {
-		    retVal = (*addr)(arg);
-		} else {
-		    ret = (int) ((*addr)(arg));
-		    retVal = __MKSMALLINT(ret);
-	       }
-	    }
-
-	    if (force) {
-		__allocForceSpace(prevSpace);
-	    }
-
-	    if (! wasBlocked) {
-		__UNBLOCKINTERRUPTS();
-	    }
-	    RETURN (retVal);
-	}
+            if (special == true) {
+                if (__isSmallInteger(moduleID)) {
+                    __SET_MODULE_ID(__intVal(moduleID));
+                }
+                retVal = (*addr)(arg, __pRT__);
+                __SET_MODULE_ID(0);
+                if (returnsObject != true) {
+                    retVal = nil;
+                }
+            } else {
+                if (returnsObject == true) {
+                    retVal = (*addr)(arg);
+                } else {
+                    ret = (int) ((*addr)(arg));
+                    retVal = __MKSMALLINT(ret);
+               }
+            }
+
+            if (force) {
+                __allocForceSpace(prevSpace);
+            }
+
+            if (! wasBlocked) {
+                __UNBLOCKINTERRUPTS();
+            }
+            RETURN (retVal);
+        }
     }
 %}.
     self primitiveFailed
@@ -4038,6 +4048,6 @@
 !ObjectFileLoader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.212 1999-12-23 20:08:47 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.213 2000-01-10 21:05:12 cg Exp $'
 ! !
 ObjectFileLoader initialize!