dont compile inline-c stuff lazy
authorClaus Gittinger <cg@exept.de>
Fri, 01 Dec 2000 23:16:43 +0100
changeset 1122 ae6b9ea5c7ba
parent 1121 161afbb078ff
child 1123 99b2aa91e992
dont compile inline-c stuff lazy
ByteCodeCompiler.st
--- a/ByteCodeCompiler.st	Fri Dec 01 16:43:31 2000 +0100
+++ b/ByteCodeCompiler.st	Fri Dec 01 23:16:43 2000 +0100
@@ -711,46 +711,45 @@
         ^ nil
     ].
 
-    lazy ifFalse:[
-        "
-         freak-out support for inline C-code...
-        "
-        ((compiler hasNonOptionalPrimitiveCode 
-        or:[(compiler hasPrimitiveCode and:[self canCreateMachineCode])
-        or:[STCCompilation == #always and:[sel ~~ #doIt]]])
-        and:[(STCCompilation ~~ #never)
-        and:[NewPrimitives ~~ true]]) ifTrue:[
-            install ifFalse:[ ^ nil].
-
-            newMethod := compiler 
-                            compileToMachineCode:aString 
-                            forClass:aClass 
-                            inCategory:cat 
-                            notifying:requestor
-                            install:install 
-                            skipIfSame:skipIfSame 
-                            silent:silent.
-
-            newMethod == #Error ifTrue:[
-                compiler showErrorMessageForClass:aClass.
-                ^ #Error
-            ].
-
-            (newMethod == #CannotLoad) ifTrue:[
-                newMethod := compiler trappingStubMethodFor:aString inCategory:cat.
-                newMethod setPackage:pkg.
-                keptOldCode := false.
-                install ifTrue:[
-                    "/
-                    "/ be very careful with existing methods
-                    "/ (otherwise, you could easily make your system unusable in systems which cannot load)
-                    "/
-                    sel notNil ifTrue:[
-                        oldMethod := aClass compiledMethodAt:sel 
-                    ].
-                    (oldMethod notNil and:[oldMethod code ~= newMethod code]) ifTrue:[
-                        answer := Dialog
-                                     confirm:
+    "
+     freak-out support for inline C-code...
+    "
+    ((compiler hasNonOptionalPrimitiveCode 
+    or:[(compiler hasPrimitiveCode and:[self canCreateMachineCode])
+    or:[STCCompilation == #always and:[sel ~~ #doIt]]])
+    and:[(STCCompilation ~~ #never)
+    and:[NewPrimitives ~~ true]]) ifTrue:[
+        install ifFalse:[ ^ nil].
+
+        newMethod := compiler 
+                        compileToMachineCode:aString 
+                        forClass:aClass 
+                        inCategory:cat 
+                        notifying:requestor
+                        install:install 
+                        skipIfSame:skipIfSame 
+                        silent:silent.
+
+        newMethod == #Error ifTrue:[
+            compiler showErrorMessageForClass:aClass.
+            ^ #Error
+        ].
+
+        (newMethod == #CannotLoad) ifTrue:[
+            newMethod := compiler trappingStubMethodFor:aString inCategory:cat.
+            newMethod setPackage:pkg.
+            keptOldCode := false.
+            install ifTrue:[
+                "/
+                "/ be very careful with existing methods
+                "/ (otherwise, you could easily make your system unusable in systems which cannot load)
+                "/
+                sel notNil ifTrue:[
+                    oldMethod := aClass compiledMethodAt:sel 
+                ].
+                (oldMethod notNil and:[oldMethod code ~= newMethod code]) ifTrue:[
+                    answer := Dialog
+                                 confirm:
 'installation of binary code for ''' , aClass name , '>>' , compiler selector , '''
 is not possible or disabled.
 
@@ -763,31 +762,30 @@
 
 Close this warnBox to abort the compilation.
 '
-                                     yesLabel:'trap code'
-                                     noLabel:'keep old'.
-                        answer isNil ifTrue:[
-                            ^ #Error
-                        ].
-                        answer == false ifTrue:[
-                            newMethod code:(oldMethod code).
-                            keptOldCode := true.
-                        ].
+                                 yesLabel:'trap code'
+                                 noLabel:'keep old'.
+                    answer isNil ifTrue:[
+                        ^ #Error
                     ].
-                    aClass addSelector:sel withMethod:newMethod
+                    answer == false ifTrue:[
+                        newMethod code:(oldMethod code).
+                        keptOldCode := true.
+                    ].
                 ].
-                Transcript show:'*** '.
-                sel notNil ifTrue:[
-                    Transcript show:(sel ,' ')
-                ].
-                keptOldCode ifTrue:[
-                    msg := 'not really compiled - method still shows previous behavior'.
-                ] ifFalse:[
-                    msg := 'not compiled to machine code - created a stub instead.'.
-                ].
-                Transcript showCR:msg.
+                aClass addSelector:sel withMethod:newMethod
+            ].
+            Transcript show:'*** '.
+            sel notNil ifTrue:[
+                Transcript show:(sel ,' ')
             ].
-            ^ newMethod
+            keptOldCode ifTrue:[
+                msg := 'not really compiled - method still shows previous behavior'.
+            ] ifFalse:[
+                msg := 'not compiled to machine code - created a stub instead.'.
+            ].
+            Transcript showCR:msg.
         ].
+        ^ newMethod
     ].
 
     compiler hasNonOptionalPrimitiveCode ifTrue:[
@@ -3717,6 +3715,6 @@
 !ByteCodeCompiler class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.178 2000-11-22 11:01:45 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.179 2000-12-01 22:16:43 cg Exp $'
 ! !
 ByteCodeCompiler initialize!