when generating machine code,
authorClaus Gittinger <cg@exept.de>
Wed, 27 May 1998 12:25:38 +0200
changeset 723 188be048b0b2
parent 722 add7cabbd2bb
child 724 1c1b04b77f16
when generating machine code, all private classes' superclass definitions must be placed into the temporary file.
BCompiler.st
ByteCodeCompiler.st
--- a/BCompiler.st	Wed May 27 12:24:39 1998 +0200
+++ b/BCompiler.st	Wed May 27 12:25:38 1998 +0200
@@ -2444,6 +2444,10 @@
     ].
 
     [
+        |definedClasses|
+
+        definedClasses := IdentitySet new.
+
         sep := stream class chunkSeparator.
 
         class := aClass.
@@ -2460,15 +2464,36 @@
                     ].
                     cls fileOutDefinitionOn:stream.
                     stream nextPut:sep; cr.
+                    definedClasses add:cls.
                 ]
             ]
         ].
         class fileOutDefinitionOn:stream.
         stream nextPut:sep; cr.
+        definedClasses add:class.
 
         class privateClassesSorted do:[:aPrivateClass |
-            aPrivateClass fileOutDefinitionOn:stream.
-            stream nextPut:sep; cr.
+            supers := aPrivateClass allSuperclasses.
+            supers notNil ifTrue:[
+                supers reverseDo:[:cls|
+                    (definedClasses includes:cls) ifFalse:[
+                        cls ~~ Object ifTrue:[
+                            cls isLoaded ifFalse:[
+                                stream close.
+                                ^ #CannotLoad
+                            ].
+                            cls fileOutDefinitionOn:stream.
+                            stream nextPut:sep; cr.
+                            definedClasses add:cls.
+                        ]
+                    ]
+                ]
+            ].
+            (definedClasses includes:aPrivateClass) ifFalse:[
+                aPrivateClass fileOutDefinitionOn:stream.
+                stream nextPut:sep; cr.
+                definedClasses add:aPrivateClass.
+            ]
         ].
 
         class fileOutPrimitiveDefinitionsOn:stream.
@@ -2809,9 +2834,9 @@
      m inspect
     "
 
-    "Modified: 14.9.1995 / 22:33:04 / claus"
-    "Modified: 16.4.1997 / 18:50:54 / cg"
-    "Modified: 11.8.1997 / 12:25:49 / stefan"
+    "Modified: / 14.9.1995 / 22:33:04 / claus"
+    "Modified: / 11.8.1997 / 12:25:49 / stefan"
+    "Modified: / 26.5.1998 / 18:06:10 / cg"
 !
 
 trappingStubMethodFor:aString inCategory:cat
@@ -2855,6 +2880,6 @@
 !ByteCodeCompiler class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.134 1998-05-17 20:01:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.135 1998-05-27 10:25:38 cg Exp $'
 ! !
 ByteCodeCompiler initialize!
--- a/ByteCodeCompiler.st	Wed May 27 12:24:39 1998 +0200
+++ b/ByteCodeCompiler.st	Wed May 27 12:25:38 1998 +0200
@@ -2444,6 +2444,10 @@
     ].
 
     [
+        |definedClasses|
+
+        definedClasses := IdentitySet new.
+
         sep := stream class chunkSeparator.
 
         class := aClass.
@@ -2460,15 +2464,36 @@
                     ].
                     cls fileOutDefinitionOn:stream.
                     stream nextPut:sep; cr.
+                    definedClasses add:cls.
                 ]
             ]
         ].
         class fileOutDefinitionOn:stream.
         stream nextPut:sep; cr.
+        definedClasses add:class.
 
         class privateClassesSorted do:[:aPrivateClass |
-            aPrivateClass fileOutDefinitionOn:stream.
-            stream nextPut:sep; cr.
+            supers := aPrivateClass allSuperclasses.
+            supers notNil ifTrue:[
+                supers reverseDo:[:cls|
+                    (definedClasses includes:cls) ifFalse:[
+                        cls ~~ Object ifTrue:[
+                            cls isLoaded ifFalse:[
+                                stream close.
+                                ^ #CannotLoad
+                            ].
+                            cls fileOutDefinitionOn:stream.
+                            stream nextPut:sep; cr.
+                            definedClasses add:cls.
+                        ]
+                    ]
+                ]
+            ].
+            (definedClasses includes:aPrivateClass) ifFalse:[
+                aPrivateClass fileOutDefinitionOn:stream.
+                stream nextPut:sep; cr.
+                definedClasses add:aPrivateClass.
+            ]
         ].
 
         class fileOutPrimitiveDefinitionsOn:stream.
@@ -2809,9 +2834,9 @@
      m inspect
     "
 
-    "Modified: 14.9.1995 / 22:33:04 / claus"
-    "Modified: 16.4.1997 / 18:50:54 / cg"
-    "Modified: 11.8.1997 / 12:25:49 / stefan"
+    "Modified: / 14.9.1995 / 22:33:04 / claus"
+    "Modified: / 11.8.1997 / 12:25:49 / stefan"
+    "Modified: / 26.5.1998 / 18:06:10 / cg"
 !
 
 trappingStubMethodFor:aString inCategory:cat
@@ -2855,6 +2880,6 @@
 !ByteCodeCompiler class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.134 1998-05-17 20:01:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.135 1998-05-27 10:25:38 cg Exp $'
 ! !
 ByteCodeCompiler initialize!