*** empty log message ***
authorcg
Tue, 05 Aug 1997 15:28:43 +0000
changeset 198 5543d1079a4a
parent 197 97fa933db02f
child 199 03a0f25a5524
*** empty log message ***
Java.st
JavaClassReader.st
JavaContext.st
JavaDecompiler.st
JavaMethodref.st
--- a/Java.st	Tue Aug 05 15:03:28 1997 +0000
+++ b/Java.st	Tue Aug 05 15:28:43 1997 +0000
@@ -66,6 +66,15 @@
     "Created: 1.8.1997 / 21:10:07 / cg"
 !
 
+addToSourcePath:aPath
+    (SourceDirectories includes:aPath) ifFalse:[
+        SourceDirectories add:aPath
+    ]
+
+    "Modified: 7.2.1997 / 19:23:55 / cg"
+    "Created: 2.8.1997 / 14:12:31 / cg"
+!
+
 classPath
     ^ ClassPath
 
@@ -88,6 +97,15 @@
     "Created: 1.8.1997 / 21:10:21 / cg"
 !
 
+removeFromSourcePath:aPath
+    (SourceDirectories includes:aPath) ifTrue:[
+        SourceDirectories remove:aPath
+    ]
+
+    "Modified: 7.2.1997 / 19:23:55 / cg"
+    "Created: 2.8.1997 / 14:13:01 / cg"
+!
+
 sourceDirectories
     ^ SourceDirectories
 !
@@ -112,7 +130,7 @@
 
      self initAllStaticFields.
 
-     system := self at:'java.lang.System'.
+     system := self classForName:'java.lang.System'.
      system isInitialized ifFalse:[
          system classInit.
          self initSystemClass.
@@ -124,7 +142,7 @@
         ]
      ]
 
-    "Modified: 18.3.1997 / 14:53:46 / cg"
+    "Modified: 3.8.1997 / 19:42:15 / cg"
 !
 
 initAllStaticFields
@@ -135,27 +153,28 @@
 !
 
 initSystemClass
-     (Java at:'java.lang.System') invoke:#initializeSystemClass
+    |system|
+
+    system := Java at:'java.lang.System'.
+    (system respondsTo:#initializeSystemClass) ifTrue:[
+        system invoke:#initializeSystemClass.
+    ].
 
     "
      Java initSystemClass
     "
 
-    "Modified: 30.7.1997 / 14:08:31 / cg"
+    "Modified: 5.8.1997 / 03:46:06 / cg"
 !
 
 initialize
     self classPath:#(
-                        '/home2/java/jdk1.13/java/lib/classes'
-"/                        '/home2/java/jdk1.02/java/lib/classes'
-"/                        '/home2/java/JDK/classes'
+                        '/usr/lib/java/lib/classes'
                     ).
 
     self
         sourceDirectories:#(
-                        '/home2/java/jdk1.13/java/src'
-"/                        '/home2/java/jdk1.02/java/src'
-"/                        '/home2/java/JDK/src'
+                        '/usr/lib/java/src'
                           ).
 
 
@@ -166,7 +185,7 @@
       Java initialize
      "
 
-    "Modified: 1.8.1997 / 11:08:52 / cg"
+    "Modified: 5.8.1997 / 04:12:22 / cg"
 !
 
 initializePrettyPrintStyle
@@ -403,10 +422,10 @@
     ].
 "/
     self halt.
-    Classes  at:sym put:aJavaClass.
+    Classes at:sym put:aJavaClass.
 
     "Created: 22.3.1997 / 13:44:54 / cg"
-    "Modified: 22.3.1997 / 13:48:14 / cg"
+    "Modified: 5.8.1997 / 14:31:53 / cg"
 !
 
 unresolvedClassRefFor:aClassName
@@ -436,19 +455,24 @@
     "/ first, look in the directory, where the binary
     "/ was loaded from.
 
-    binary := aClass binaryFile asFilename.
-    sourceFileName := binary withSuffix:'java'.
-    sourceFile := sourceFileName asFilename.
+    binary := aClass binaryFile.
+    binary notNil ifTrue:[
+        binary := binary asFilename.
+        sourceFileName := binary withSuffix:'java'.
+        sourceFile := sourceFileName asFilename.
+    ].
 
-    sourceFile exists ifFalse:[
-        sourceFileName := binary withSuffix:'jav'.
-        sourceFile := sourceFileName asFilename.
+    sourceFile notNil ifTrue:[
         sourceFile exists ifFalse:[
-            sourceFileName := binary withSuffix:'JAV'.
+            sourceFileName := binary withSuffix:'jav'.
             sourceFile := sourceFileName asFilename.
             sourceFile exists ifFalse:[
-                sourceFileName := binary withSuffix:'JAVA'.
+                sourceFileName := binary withSuffix:'JAV'.
                 sourceFile := sourceFileName asFilename.
+                sourceFile exists ifFalse:[
+                    sourceFileName := binary withSuffix:'JAVA'.
+                    sourceFile := sourceFileName asFilename.
+                ].
             ].
         ].
     ].
@@ -456,15 +480,17 @@
     "/ special case: there were multiple classes in a single
     "/ source file.
 
-    binary withoutSuffix baseName ~= aClass sourceFile asFilename withoutSuffix baseName ifTrue:[
-        'JAVA: trouble extracting fileName: ' print.
-        binary withoutSuffix baseName print. ' vs. ' print.
-        aClass sourceFile asFilename withoutSuffix baseName printCR.
+    binary notNil ifTrue:[
+        binary withoutSuffix baseName ~= aClass sourceFile asFilename withoutSuffix baseName ifTrue:[
+            'JAVA: trouble extracting fileName: ' print.
+            binary withoutSuffix baseName print. ' vs. ' print.
+            aClass sourceFile asFilename withoutSuffix baseName printCR.
+        ].
     ].
 
     "/ if that fails, look in standard places
 
-    sourceFile exists ifFalse:[
+    (sourceFile isNil or:[sourceFile exists not]) ifTrue:[
         sourceFileName := aClass sourceFile.
         sourceFile := sourceFileName asFilename.
         sourceFile exists ifFalse:[
@@ -505,7 +531,7 @@
     ].
     ^ (sourceFile contentsOfEntireFile).
 
-    "Modified: 30.7.1997 / 14:28:55 / cg"
+    "Modified: 3.8.1997 / 19:24:28 / cg"
 !
 
 findSourceDirOf:fileName inPackage:aPackage
@@ -529,6 +555,6 @@
 !Java class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/Java.st,v 1.31 1997/08/01 19:51:54 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/Java.st,v 1.32 1997/08/05 15:28:43 cg Exp $'
 ! !
 Java initialize!
--- a/JavaClassReader.st	Tue Aug 05 15:03:28 1997 +0000
+++ b/JavaClassReader.st	Tue Aug 05 15:28:43 1997 +0000
@@ -1,7 +1,8 @@
 Object subclass:#JavaClassReader
 	instanceVariableNames:'inStream msb constants majorVsn minorVsn constNeeds2Slots
 		constSlot'
-	classVariableNames:'Verbose Silent AbsolutelySilent LazyClassLoading'
+	classVariableNames:'Verbose Silent AbsolutelySilent LazyClassLoading
+		InvalidClassFormatSignal'
 	poolDictionaries:''
 	category:'Java-Support'
 !
@@ -10,6 +11,10 @@
 !JavaClassReader class methodsFor:'initialization'!
 
 initialize
+    InvalidClassFormatSignal := Signal new mayProceed:true.
+    InvalidClassFormatSignal notifierString:'class load failure'.
+    InvalidClassFormatSignal nameClass:self message:#invalidClassFormatSignal.
+
     Verbose := false. 
     Silent := true.
     AbsolutelySilent := false.
@@ -20,7 +25,15 @@
      JavaClassReader initialize
     "
 
-    "Modified: 7.2.1997 / 19:25:23 / cg"
+    "Modified: 3.8.1997 / 18:17:04 / cg"
+! !
+
+!JavaClassReader class methodsFor:'Signal constants'!
+
+invalidClassFormatSignal
+    ^ InvalidClassFormatSignal
+
+    "Created: 3.8.1997 / 18:17:21 / cg"
 ! !
 
 !JavaClassReader class methodsFor:'debugging'!
@@ -116,16 +129,22 @@
         (p endsWith:Filename separator) ifFalse:[
             p := p , (Filename separator asString)
         ].
-        (nm := p , clsName , '.class') asFilename exists ifTrue:[
-            rslt := self loadFileLazy:nm ignoring:loadedClass.
-            rslt notNil ifTrue:[^ rslt].
+        (Array 
+            with:clsName
+            with:clsName asLowercase
+            with:clsName asUppercase) 
+        do:[:tryName |
+            (nm := p , tryName , '.class') asFilename exists ifTrue:[
+                rslt := self loadFileLazy:nm ignoring:loadedClass.
+                rslt notNil ifTrue:[^ rslt].
+            ].
         ]
     ].
 
     ('JAVA: no file found for: ' , clsName) infoPrintCR.
     ^ nil
 
-    "Modified: 30.7.1997 / 16:58:30 / cg"
+    "Modified: 4.8.1997 / 00:13:15 / cg"
 !
 
 loadFile:aFilename
@@ -298,6 +317,24 @@
     "Created: 15.4.1996 / 14:58:53 / cg"
 !
 
+readStream:aStream
+    "reads a class from aStream and returns it.
+     The JavaClass is installed as global"
+
+    |javaClass|
+
+    javaClass := self readStream:aStream ignoring:(Set new).
+    javaClass notNil ifTrue:[
+        self postLoadActions.
+        Java at:(javaClass fullName asSymbol) put:javaClass.
+
+        JavaUnresolvedConstant resolveFor:javaClass.
+    ].
+    ^ javaClass
+
+    "Modified: 3.8.1997 / 19:48:45 / cg"
+!
+
 readStream:aStream ignoring:classesBeingLoaded
     "reads a class from aStream and returns it.
      The JavaClass is not installed as global"
@@ -330,7 +367,7 @@
     magic := inStream nextUnsignedLongMSB:msb.
     magic = 16rCAFEBABE ifFalse:[
         magic = 16rBEBAFECA ifFalse:[
-            self error:'not a java class file'.
+            InvalidClassFormatSignal raiseErrorString:'not a java class file'.
             ^ nil
         ].
         msb := false.
@@ -451,7 +488,7 @@
     "
 
     "Created: 15.4.1996 / 15:02:47 / cg"
-    "Modified: 31.7.1997 / 22:45:09 / cg"
+    "Modified: 3.8.1997 / 18:18:56 / cg"
 !
 
 readSourceFileAttributeFor:aJavaClass
@@ -1281,6 +1318,6 @@
 !JavaClassReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClassReader.st,v 1.42 1997/08/01 19:52:57 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClassReader.st,v 1.43 1997/08/05 15:28:23 cg Exp $'
 ! !
 JavaClassReader initialize!
--- a/JavaContext.st	Tue Aug 05 15:03:28 1997 +0000
+++ b/JavaContext.st	Tue Aug 05 15:28:43 1997 +0000
@@ -92,10 +92,12 @@
     frameBase > stack size ifTrue:[
         ^ nil
     ].
+"/ method displayString printCR.
+"/ frameBase print. ' -> ' print. (stack at:frameBase) printCR.
     ^ stack at:frameBase
 
     "Created: 1.5.1996 / 15:04:03 / cg"
-    "Modified: 1.5.1996 / 17:43:17 / cg"
+    "Modified: 4.8.1997 / 23:39:01 / cg"
 !
 
 selector            
@@ -113,7 +115,17 @@
  'oops - negative stackFrame' errorPrintCR.
  ^ #()
 ].
+
+"/ method displayString printCR.
+"/ frameBase print. ' ... ' print. (sp-1) printCR.
+"/ (stack collect:[:e | e class name]) printCR.
+
+"/    method isStatic ifFalse:[
+"/        ^ stack copyFrom:frameBase+1 to:(sp-1)
+"/    ].
     ^ stack copyFrom:frameBase to:(sp-1)
+
+    "Modified: 4.8.1997 / 23:39:38 / cg"
 ! !
 
 !JavaContext methodsFor:'accessing'!
@@ -228,5 +240,5 @@
 !JavaContext class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaContext.st,v 1.11 1997/03/20 14:38:56 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaContext.st,v 1.12 1997/08/05 15:28:38 cg Exp $'
 ! !
--- a/JavaDecompiler.st	Tue Aug 05 15:03:28 1997 +0000
+++ b/JavaDecompiler.st	Tue Aug 05 15:28:43 1997 +0000
@@ -230,7 +230,7 @@
         (monitorenter)                          "/ 194
         (monitorexit)                           "/ 195
 "/        (verifystack)                           "/ 196 obsolete (Alpha release)
-        (wide localIndexByte)                   "/ 196
+        (wide)                                  "/ 196
         (multianewarray constIndexShort dimensionsByte) "/ 197
 
         (ifnull    signedBranchShort)           "/ 198
@@ -305,7 +305,7 @@
      JavaDecompiler initialize
     "
 
-    "Modified: 16.4.1996 / 14:56:13 / cg"
+    "Modified: 4.8.1997 / 19:12:45 / cg"
 ! !
 
 !JavaDecompiler class methodsFor:'accessing'!
@@ -610,7 +610,7 @@
 !JavaDecompiler methodsFor:'decompiling'!
 
 decompile:aJavaMethod to:aStream
-    |who endPC insn spec op|
+    |who endPC insn spec op wide|
 
     outStream := aStream.
 
@@ -639,6 +639,7 @@
         ^ self
     ].
 
+    wide := false.
     pc := 1.
     [pc <= endPC] whileTrue:[
         insn := code at:pc.
@@ -655,16 +656,26 @@
             show:op; 
             show:' '.
 
-        spec notNil ifTrue:[
-            spec from:2 to:spec size do:[:what |
-                self perform:what
+        op == #wide ifTrue:[
+            wide := true.
+        ] ifFalse:[
+            spec notNil ifTrue:[
+                spec from:2 to:spec size do:[:what |
+                    wide ifTrue:[
+                        self perform:(what , '_wide') asSymbol.
+                        wide := false
+                    ] ifFalse:[
+                        self perform:what
+                    ]
+                ].
             ].
+            wide := false.
         ].
         outStream cr.
     ]
 
     "Created: 16.4.1996 / 14:59:29 / cg"
-    "Modified: 30.7.1997 / 16:13:04 / cg"
+    "Modified: 4.8.1997 / 19:14:04 / cg"
 ! !
 
 !JavaDecompiler methodsFor:'operand decoding'!
@@ -727,7 +738,7 @@
 !
 
 localIndexByte
-    |hi low index constants|
+    |index|
 
     index := code at:pc.
     pc := pc + 1.
@@ -737,7 +748,21 @@
         show:' '
 
     "Created: 16.4.1996 / 15:00:04 / cg"
+    "Modified: 4.8.1997 / 19:01:52 / cg"
+!
+
+localIndexByte_wide
+    |index|
+
+    index := code wordAt:pc MSB:true.
+    pc := pc + 2.
+
+    outStream
+        show:index; 
+        show:' '
+
     "Modified: 16.4.1996 / 15:30:55 / cg"
+    "Created: 4.8.1997 / 19:02:09 / cg"
 !
 
 lookupSwitchBytes
@@ -907,6 +932,6 @@
 !JavaDecompiler class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaDecompiler.st,v 1.28 1997/08/01 10:30:20 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaDecompiler.st,v 1.29 1997/08/05 15:28:16 cg Exp $'
 ! !
 JavaDecompiler initialize!
--- a/JavaMethodref.st	Tue Aug 05 15:03:28 1997 +0000
+++ b/JavaMethodref.st	Tue Aug 05 15:28:43 1997 +0000
@@ -48,6 +48,15 @@
 
     lastMethod := something.!
 
+lastMethod:someMethod lastClass:someClass
+    "set lastMethod & lastClass"
+
+    lastMethod := someMethod.
+    lastClass := someClass.
+
+    "Created: 4.8.1997 / 18:21:11 / cg"
+!
+
 name
     ^ nameandType name.
 !
@@ -179,5 +188,5 @@
 !JavaMethodref class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaMethodref.st,v 1.25 1997/07/31 20:16:29 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaMethodref.st,v 1.26 1997/08/05 15:27:13 cg Exp $'
 ! !