ObjFLoader.st
changeset 156 2bf6dc265509
parent 155 1884c71a2507
child 157 d7f68808a258
--- a/ObjFLoader.st	Wed Dec 06 11:50:20 1995 +0100
+++ b/ObjFLoader.st	Wed Dec 06 13:42:24 1995 +0100
@@ -828,16 +828,16 @@
 loadMethodObjectFile:aFileName
     "load an object file (.o-file) for a single method into the image; 
      This does a slightly different initialization.
-     Return false on error, true if ok."
-
-    |handle initAddr initName idx|
+     Return the loaded method; nil on error"
+
+    |handle initAddr initName idx m|
 
     "
      load the objectfile
     "
     handle := self loadDynamicObject:aFileName.
     handle isNil ifTrue:[
-	^ false
+	^ nil
     ].
 
     initName := aFileName asString.
@@ -861,26 +861,27 @@
 	    ].
 
 	    self unloadDynamicObject:handle.
-	    ^ false
+	    ^ nil
 	]
     ].
 
-    self
+    m := self
 	callInitFunctionAt:initAddr 
 	specialInit:true
 	forceOld:true 
 	interruptable:false
 	argument:2
 	identifyAs:handle
-	returnsObject:false.
-
-    ^ true
+	returnsObject:true.
+
+    ^ m
 
     "Created: 5.12.1995 / 20:59:46 / cg"
+    "Modified: 6.12.1995 / 13:13:44 / cg"
 !
 
 reloadAllRememberedObjectFiles
-    |oldDummyMethod where|
+    |oldDummyMethod where m|
 
     PreviouslyLoadedObjects notNil ifTrue:[
 	PreviouslyLoadedObjects keysAndValuesDo:[:fileName :handle |
@@ -890,10 +891,18 @@
 	    ] ifFalse:[
 		handle isMethodHandle ifTrue:[
 		    oldDummyMethod := handle method.
-		    where := oldDummyMethod who.
-		    self loadMethodObjectFile:fileName.
-		    where notNil ifTrue:[
-			((where at:1) compiledMethodAt:(where at:2)) source:(oldDummyMethod source)
+		    oldDummyMethod isNil ifTrue:[
+			('OBJFLOADER: ignore obsolete (already collected) method in ' , fileName) infoPrintNL
+		    ] ifFalse:[
+			where := oldDummyMethod who.
+			m := self loadMethodObjectFile:fileName.
+			where notNil ifTrue:[
+			    m == ((where at:1) compiledMethodAt:(where at:2)) ifFalse:[
+				'OBJFLOADER: oops - loaded method installed wrong' errorPrintNL.
+			    ].
+			    handle method:m.
+			    m source:(oldDummyMethod source)
+			]
 		    ]
 		] ifFalse:[
 		    self halt.
@@ -902,6 +911,8 @@
 	].
 	PreviouslyLoadedObjects := nil
     ]
+
+    "Modified: 6.12.1995 / 13:23:07 / cg"
 !
 
 revalidateAllObjectFiles
@@ -2825,6 +2836,6 @@
 !ObjectFileLoader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ObjFLoader.st,v 1.61 1995-12-06 10:50:20 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ObjFLoader.st,v 1.62 1995-12-06 12:42:24 cg Exp $'
 ! !
 ObjectFileLoader initialize!