JavaDecompiler.st
author cg
Sat, 06 Jul 1996 18:16:23 +0000
changeset 119 440cfcb9d0c1
parent 108 235be8e8bd8c
child 124 e30646ab8a71
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
     1
Object subclass:#JavaDecompiler
18
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
     2
	instanceVariableNames:'code pc javaMethod outStream classToCompileFor'
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
     3
	classVariableNames:'DecoderTable'
b23a6474754f intitial checkin
cg
parents:
diff changeset
     4
	poolDictionaries:''
b23a6474754f intitial checkin
cg
parents:
diff changeset
     5
	category:'Java-Support'
b23a6474754f intitial checkin
cg
parents:
diff changeset
     6
!
b23a6474754f intitial checkin
cg
parents:
diff changeset
     7
b23a6474754f intitial checkin
cg
parents:
diff changeset
     8
68
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
     9
!JavaDecompiler  class methodsFor:'initialization'!
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
    10
b23a6474754f intitial checkin
cg
parents:
diff changeset
    11
initialize
b23a6474754f intitial checkin
cg
parents:
diff changeset
    12
    DecoderTable := #(
b23a6474754f intitial checkin
cg
parents:
diff changeset
    13
        (nop)                                   "/ 0
b23a6474754f intitial checkin
cg
parents:
diff changeset
    14
        (aconst_null)                           "/ 1
b23a6474754f intitial checkin
cg
parents:
diff changeset
    15
        (iconst_m1)                             "/ 2
b23a6474754f intitial checkin
cg
parents:
diff changeset
    16
        (iconst_0)                              "/ 3
b23a6474754f intitial checkin
cg
parents:
diff changeset
    17
        (iconst_1)                              "/ 4
b23a6474754f intitial checkin
cg
parents:
diff changeset
    18
        (iconst_2)                              "/ 5
b23a6474754f intitial checkin
cg
parents:
diff changeset
    19
        (iconst_3)                              "/ 6
b23a6474754f intitial checkin
cg
parents:
diff changeset
    20
        (iconst_4)                              "/ 7
b23a6474754f intitial checkin
cg
parents:
diff changeset
    21
        (iconst_5)                              "/ 8
b23a6474754f intitial checkin
cg
parents:
diff changeset
    22
        (lconst_0)                              "/ 9
b23a6474754f intitial checkin
cg
parents:
diff changeset
    23
        
b23a6474754f intitial checkin
cg
parents:
diff changeset
    24
        (lconst_1)                              "/ 10
b23a6474754f intitial checkin
cg
parents:
diff changeset
    25
        (fconst_0)                              "/ 11
b23a6474754f intitial checkin
cg
parents:
diff changeset
    26
        (fconst_1)                              "/ 12
b23a6474754f intitial checkin
cg
parents:
diff changeset
    27
        (fconst_2)                              "/ 13
b23a6474754f intitial checkin
cg
parents:
diff changeset
    28
        (dconst_0)                              "/ 14
b23a6474754f intitial checkin
cg
parents:
diff changeset
    29
        (dconst_1)                              "/ 15
b23a6474754f intitial checkin
cg
parents:
diff changeset
    30
        (bipush signedByte)                     "/ 16
b23a6474754f intitial checkin
cg
parents:
diff changeset
    31
        (sipush signedShort)                    "/ 17
b23a6474754f intitial checkin
cg
parents:
diff changeset
    32
        (ldc1 constIndexByte)                   "/ 18
b23a6474754f intitial checkin
cg
parents:
diff changeset
    33
        (ldc2 constIndexShort)                  "/ 19
b23a6474754f intitial checkin
cg
parents:
diff changeset
    34
b23a6474754f intitial checkin
cg
parents:
diff changeset
    35
        (ldc2w constIndexShort)                 "/ 20
b23a6474754f intitial checkin
cg
parents:
diff changeset
    36
        (iload localIndexByte)                  "/ 21
b23a6474754f intitial checkin
cg
parents:
diff changeset
    37
        (lload localIndexByte)                  "/ 22
b23a6474754f intitial checkin
cg
parents:
diff changeset
    38
        (fload localIndexByte)                  "/ 23
b23a6474754f intitial checkin
cg
parents:
diff changeset
    39
        (dload localIndexByte)                  "/ 24
b23a6474754f intitial checkin
cg
parents:
diff changeset
    40
        (aload localIndexByte)                  "/ 25
24
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
    41
        (iload_0)                               "/ 26
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
    42
        (iload_1)                               "/ 27
b23a6474754f intitial checkin
cg
parents:
diff changeset
    43
        (iload_2)                               "/ 28
b23a6474754f intitial checkin
cg
parents:
diff changeset
    44
        (iload_3)                               "/ 29
b23a6474754f intitial checkin
cg
parents:
diff changeset
    45
b23a6474754f intitial checkin
cg
parents:
diff changeset
    46
        (lload_0)                               "/ 30
b23a6474754f intitial checkin
cg
parents:
diff changeset
    47
        (lload_1)                               "/ 31
b23a6474754f intitial checkin
cg
parents:
diff changeset
    48
        (lload_2)                               "/ 32
b23a6474754f intitial checkin
cg
parents:
diff changeset
    49
        (lload_3)                               "/ 33
b23a6474754f intitial checkin
cg
parents:
diff changeset
    50
        (fload_0)                               "/ 34
b23a6474754f intitial checkin
cg
parents:
diff changeset
    51
        (fload_1)                               "/ 35
b23a6474754f intitial checkin
cg
parents:
diff changeset
    52
        (fload_2)                               "/ 36
b23a6474754f intitial checkin
cg
parents:
diff changeset
    53
        (fload_3)                               "/ 37
b23a6474754f intitial checkin
cg
parents:
diff changeset
    54
        (dload_0)                               "/ 38
b23a6474754f intitial checkin
cg
parents:
diff changeset
    55
        (dload_1)                               "/ 39
b23a6474754f intitial checkin
cg
parents:
diff changeset
    56
b23a6474754f intitial checkin
cg
parents:
diff changeset
    57
        (dload_2)                               "/ 40
b23a6474754f intitial checkin
cg
parents:
diff changeset
    58
        (dload_3)                               "/ 41
b23a6474754f intitial checkin
cg
parents:
diff changeset
    59
        (aload_0)                               "/ 42
b23a6474754f intitial checkin
cg
parents:
diff changeset
    60
        (aload_1)                               "/ 43
b23a6474754f intitial checkin
cg
parents:
diff changeset
    61
        (aload_2)                               "/ 44
b23a6474754f intitial checkin
cg
parents:
diff changeset
    62
        (aload_3)                               "/ 45
b23a6474754f intitial checkin
cg
parents:
diff changeset
    63
        (iaload)                                "/ 46
b23a6474754f intitial checkin
cg
parents:
diff changeset
    64
        (laload)                                "/ 47
b23a6474754f intitial checkin
cg
parents:
diff changeset
    65
        (faload)                                "/ 48
b23a6474754f intitial checkin
cg
parents:
diff changeset
    66
        (daload)                                "/ 49
b23a6474754f intitial checkin
cg
parents:
diff changeset
    67
b23a6474754f intitial checkin
cg
parents:
diff changeset
    68
        (aaload)                                "/ 50
b23a6474754f intitial checkin
cg
parents:
diff changeset
    69
        (baload)                                "/ 51
b23a6474754f intitial checkin
cg
parents:
diff changeset
    70
        (caload)                                "/ 52
b23a6474754f intitial checkin
cg
parents:
diff changeset
    71
        (saload)                                "/ 53
b23a6474754f intitial checkin
cg
parents:
diff changeset
    72
        (istore localIndexByte)                 "/ 54
b23a6474754f intitial checkin
cg
parents:
diff changeset
    73
        (lstore localIndexByte)                 "/ 55
b23a6474754f intitial checkin
cg
parents:
diff changeset
    74
        (fstore localIndexByte)                 "/ 56
b23a6474754f intitial checkin
cg
parents:
diff changeset
    75
        (dstore localIndexByte)                 "/ 57
b23a6474754f intitial checkin
cg
parents:
diff changeset
    76
        (astore localIndexByte)                 "/ 58
b23a6474754f intitial checkin
cg
parents:
diff changeset
    77
        (istore_0)                              "/ 59
b23a6474754f intitial checkin
cg
parents:
diff changeset
    78
b23a6474754f intitial checkin
cg
parents:
diff changeset
    79
        (istore_1)                              "/ 60
b23a6474754f intitial checkin
cg
parents:
diff changeset
    80
        (istore_2)                              "/ 61
b23a6474754f intitial checkin
cg
parents:
diff changeset
    81
        (istore_3)                              "/ 62
b23a6474754f intitial checkin
cg
parents:
diff changeset
    82
        (lstore_0)                              "/ 63
b23a6474754f intitial checkin
cg
parents:
diff changeset
    83
        (lstore_1)                              "/ 64
b23a6474754f intitial checkin
cg
parents:
diff changeset
    84
        (lstore_2)                              "/ 65
b23a6474754f intitial checkin
cg
parents:
diff changeset
    85
        (lstore_3)                              "/ 66
b23a6474754f intitial checkin
cg
parents:
diff changeset
    86
        (fstore_0)                              "/ 67
b23a6474754f intitial checkin
cg
parents:
diff changeset
    87
        (fstore_1)                              "/ 68
b23a6474754f intitial checkin
cg
parents:
diff changeset
    88
        (fstore_2)                              "/ 69
b23a6474754f intitial checkin
cg
parents:
diff changeset
    89
b23a6474754f intitial checkin
cg
parents:
diff changeset
    90
        (fstore_3)                              "/ 70
b23a6474754f intitial checkin
cg
parents:
diff changeset
    91
        (dstore_0)                              "/ 71
b23a6474754f intitial checkin
cg
parents:
diff changeset
    92
        (dstore_1)                              "/ 72
b23a6474754f intitial checkin
cg
parents:
diff changeset
    93
        (dstore_2)                              "/ 73
b23a6474754f intitial checkin
cg
parents:
diff changeset
    94
        (dstore_3)                              "/ 74
b23a6474754f intitial checkin
cg
parents:
diff changeset
    95
        (astore_0)                              "/ 75
b23a6474754f intitial checkin
cg
parents:
diff changeset
    96
        (astore_1)                              "/ 76
b23a6474754f intitial checkin
cg
parents:
diff changeset
    97
        (astore_2)                              "/ 77
b23a6474754f intitial checkin
cg
parents:
diff changeset
    98
        (astore_3)                              "/ 78
b23a6474754f intitial checkin
cg
parents:
diff changeset
    99
        (iastore)                               "/ 79
b23a6474754f intitial checkin
cg
parents:
diff changeset
   100
b23a6474754f intitial checkin
cg
parents:
diff changeset
   101
        (lastore)                               "/ 80
b23a6474754f intitial checkin
cg
parents:
diff changeset
   102
        (fastore)                               "/ 81
b23a6474754f intitial checkin
cg
parents:
diff changeset
   103
        (dastore)                               "/ 82
b23a6474754f intitial checkin
cg
parents:
diff changeset
   104
        (aastore)                               "/ 83
b23a6474754f intitial checkin
cg
parents:
diff changeset
   105
        (bastore)                               "/ 84
b23a6474754f intitial checkin
cg
parents:
diff changeset
   106
        (castore)                               "/ 85
b23a6474754f intitial checkin
cg
parents:
diff changeset
   107
        (sastore)                               "/ 86
b23a6474754f intitial checkin
cg
parents:
diff changeset
   108
        (pop)                                   "/ 87
b23a6474754f intitial checkin
cg
parents:
diff changeset
   109
        (pop2)                                  "/ 88
b23a6474754f intitial checkin
cg
parents:
diff changeset
   110
        (dup)                                   "/ 89
b23a6474754f intitial checkin
cg
parents:
diff changeset
   111
b23a6474754f intitial checkin
cg
parents:
diff changeset
   112
        (dup_x1)                                "/ 90
b23a6474754f intitial checkin
cg
parents:
diff changeset
   113
        (dup_x2)                                "/ 91
b23a6474754f intitial checkin
cg
parents:
diff changeset
   114
        (dup2)                                  "/ 92
b23a6474754f intitial checkin
cg
parents:
diff changeset
   115
        (dup2_x1)                               "/ 93
b23a6474754f intitial checkin
cg
parents:
diff changeset
   116
        (dup2_x2)                               "/ 94
b23a6474754f intitial checkin
cg
parents:
diff changeset
   117
        (swap)                                  "/ 95
b23a6474754f intitial checkin
cg
parents:
diff changeset
   118
        (iadd)                                  "/ 96
b23a6474754f intitial checkin
cg
parents:
diff changeset
   119
        (ladd)                                  "/ 97
b23a6474754f intitial checkin
cg
parents:
diff changeset
   120
        (fadd)                                  "/ 98
b23a6474754f intitial checkin
cg
parents:
diff changeset
   121
        (dadd)                                  "/ 99
b23a6474754f intitial checkin
cg
parents:
diff changeset
   122
b23a6474754f intitial checkin
cg
parents:
diff changeset
   123
        (isub)                                  "/ 100
b23a6474754f intitial checkin
cg
parents:
diff changeset
   124
        (lsub)                                  "/ 101
b23a6474754f intitial checkin
cg
parents:
diff changeset
   125
        (fsub)                                  "/ 102
b23a6474754f intitial checkin
cg
parents:
diff changeset
   126
        (dsub)                                  "/ 103
b23a6474754f intitial checkin
cg
parents:
diff changeset
   127
        (imul)                                  "/ 104
b23a6474754f intitial checkin
cg
parents:
diff changeset
   128
        (lmul)                                  "/ 105
b23a6474754f intitial checkin
cg
parents:
diff changeset
   129
        (fmul)                                  "/ 106
b23a6474754f intitial checkin
cg
parents:
diff changeset
   130
        (dmul)                                  "/ 107
b23a6474754f intitial checkin
cg
parents:
diff changeset
   131
        (idiv)                                  "/ 108
b23a6474754f intitial checkin
cg
parents:
diff changeset
   132
        (ldiv)                                  "/ 109
b23a6474754f intitial checkin
cg
parents:
diff changeset
   133
b23a6474754f intitial checkin
cg
parents:
diff changeset
   134
        (fdiv)                                  "/ 110
b23a6474754f intitial checkin
cg
parents:
diff changeset
   135
        (ddiv)                                  "/ 111
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 68
diff changeset
   136
"/        (imod)                                  "/ 112     "/ obsolete
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 68
diff changeset
   137
        (irem)                                  "/ 112
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 68
diff changeset
   138
"/        (lmod)                                  "/ 113     "/ obsolete
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 68
diff changeset
   139
        (lrem)                                  "/ 113
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 68
diff changeset
   140
"/        (fmod)                                  "/ 114     "/ obsolete
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 68
diff changeset
   141
        (frem)                                  "/ 114
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 68
diff changeset
   142
"/        (dmod)                                  "/ 115     "/ obsolete
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 68
diff changeset
   143
        (drem)                                  "/ 115
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   144
        (ineg)                                  "/ 116
b23a6474754f intitial checkin
cg
parents:
diff changeset
   145
        (lneg)                                  "/ 117
b23a6474754f intitial checkin
cg
parents:
diff changeset
   146
        (fneg)                                  "/ 118
b23a6474754f intitial checkin
cg
parents:
diff changeset
   147
        (dneg)                                  "/ 119
b23a6474754f intitial checkin
cg
parents:
diff changeset
   148
b23a6474754f intitial checkin
cg
parents:
diff changeset
   149
        (ishl)                                  "/ 120
b23a6474754f intitial checkin
cg
parents:
diff changeset
   150
        (lshl)                                  "/ 121
b23a6474754f intitial checkin
cg
parents:
diff changeset
   151
        (ishr)                                  "/ 122
b23a6474754f intitial checkin
cg
parents:
diff changeset
   152
        (lshr)                                  "/ 123
b23a6474754f intitial checkin
cg
parents:
diff changeset
   153
        (iushr)                                 "/ 124
b23a6474754f intitial checkin
cg
parents:
diff changeset
   154
        (lushr)                                 "/ 125
b23a6474754f intitial checkin
cg
parents:
diff changeset
   155
        (iand)                                  "/ 126
b23a6474754f intitial checkin
cg
parents:
diff changeset
   156
        (land)                                  "/ 127
b23a6474754f intitial checkin
cg
parents:
diff changeset
   157
        (ior)                                   "/ 128
b23a6474754f intitial checkin
cg
parents:
diff changeset
   158
        (lor)                                   "/ 129
b23a6474754f intitial checkin
cg
parents:
diff changeset
   159
b23a6474754f intitial checkin
cg
parents:
diff changeset
   160
        (ixor)                                  "/ 130
b23a6474754f intitial checkin
cg
parents:
diff changeset
   161
        (lxor)                                  "/ 131
39
20fa5af3b873 checkin from browser
cg
parents: 36
diff changeset
   162
        (iinc localIndexByte signedByte)        "/ 132
68
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   163
        (i2l)                                   "/ 133
44
331e16746ad6 checkin from browser
cg
parents: 41
diff changeset
   164
        (i2f)                                   "/ 134
52
1dc41619b6f8 checkin from browser
cg
parents: 44
diff changeset
   165
        (i2d)                                   "/ 135
44
331e16746ad6 checkin from browser
cg
parents: 41
diff changeset
   166
        (l2i)                                   "/ 136    
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   167
        (l2f)                                   "/ 137
b23a6474754f intitial checkin
cg
parents:
diff changeset
   168
        (l2d)                                   "/ 138
44
331e16746ad6 checkin from browser
cg
parents: 41
diff changeset
   169
        (f2i)                                   "/ 139
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   170
b23a6474754f intitial checkin
cg
parents:
diff changeset
   171
        (f2l)                                   "/ 140
b23a6474754f intitial checkin
cg
parents:
diff changeset
   172
        (f2d)                                   "/ 141
b23a6474754f intitial checkin
cg
parents:
diff changeset
   173
        (d2i)                                   "/ 142
b23a6474754f intitial checkin
cg
parents:
diff changeset
   174
        (d2l)                                   "/ 143
b23a6474754f intitial checkin
cg
parents:
diff changeset
   175
        (d2f)                                   "/ 144
b23a6474754f intitial checkin
cg
parents:
diff changeset
   176
        (int2byte)                              "/ 145
b23a6474754f intitial checkin
cg
parents:
diff changeset
   177
        (int2char)                              "/ 146
b23a6474754f intitial checkin
cg
parents:
diff changeset
   178
        (int2short)                             "/ 147
b23a6474754f intitial checkin
cg
parents:
diff changeset
   179
        (lcmp)                                  "/ 148
b23a6474754f intitial checkin
cg
parents:
diff changeset
   180
        (fcmpl)                                 "/ 149
b23a6474754f intitial checkin
cg
parents:
diff changeset
   181
b23a6474754f intitial checkin
cg
parents:
diff changeset
   182
        (fcmpg)                                 "/ 150
b23a6474754f intitial checkin
cg
parents:
diff changeset
   183
        (dcmpl)                                 "/ 151
b23a6474754f intitial checkin
cg
parents:
diff changeset
   184
        (dcmpg)                                 "/ 152
b23a6474754f intitial checkin
cg
parents:
diff changeset
   185
        (ifeq signedBranchShort)                "/ 153
b23a6474754f intitial checkin
cg
parents:
diff changeset
   186
        (ifne signedBranchShort)                "/ 154
b23a6474754f intitial checkin
cg
parents:
diff changeset
   187
        (iflt signedBranchShort)                "/ 155
b23a6474754f intitial checkin
cg
parents:
diff changeset
   188
        (ifge signedBranchShort)                "/ 156
b23a6474754f intitial checkin
cg
parents:
diff changeset
   189
        (ifgt signedBranchShort)                "/ 157
b23a6474754f intitial checkin
cg
parents:
diff changeset
   190
        (ifle signedBranchShort)                "/ 158
b23a6474754f intitial checkin
cg
parents:
diff changeset
   191
        (if_icmpeq signedBranchShort)           "/ 159
b23a6474754f intitial checkin
cg
parents:
diff changeset
   192
b23a6474754f intitial checkin
cg
parents:
diff changeset
   193
        (if_icmpne signedBranchShort)           "/ 160
b23a6474754f intitial checkin
cg
parents:
diff changeset
   194
        (if_icmplt signedBranchShort)           "/ 161
b23a6474754f intitial checkin
cg
parents:
diff changeset
   195
        (if_icmpge signedBranchShort)           "/ 162
b23a6474754f intitial checkin
cg
parents:
diff changeset
   196
        (if_icmpgt signedBranchShort)           "/ 163
b23a6474754f intitial checkin
cg
parents:
diff changeset
   197
        (if_icmple signedBranchShort)           "/ 164
b23a6474754f intitial checkin
cg
parents:
diff changeset
   198
        (if_acmpeq signedBranchShort)           "/ 165
b23a6474754f intitial checkin
cg
parents:
diff changeset
   199
        (if_acmpne signedBranchShort)           "/ 166
b23a6474754f intitial checkin
cg
parents:
diff changeset
   200
        (goto signedBranchShort)                "/ 167
b23a6474754f intitial checkin
cg
parents:
diff changeset
   201
        (jsr signedBranchShort)                 "/ 168
b23a6474754f intitial checkin
cg
parents:
diff changeset
   202
        (ret localIndexByte)                    "/ 169
b23a6474754f intitial checkin
cg
parents:
diff changeset
   203
b23a6474754f intitial checkin
cg
parents:
diff changeset
   204
        (tableswitch tableSwitchBytes)          "/ 170
b23a6474754f intitial checkin
cg
parents:
diff changeset
   205
        (lookupswitch lookupSwitchBytes)        "/ 171
b23a6474754f intitial checkin
cg
parents:
diff changeset
   206
        (ireturn)                               "/ 172
b23a6474754f intitial checkin
cg
parents:
diff changeset
   207
        (lreturn)                               "/ 173
b23a6474754f intitial checkin
cg
parents:
diff changeset
   208
        (freturn)                               "/ 174
b23a6474754f intitial checkin
cg
parents:
diff changeset
   209
        (dreturn)                               "/ 175
b23a6474754f intitial checkin
cg
parents:
diff changeset
   210
        (areturn)                               "/ 176
b23a6474754f intitial checkin
cg
parents:
diff changeset
   211
        (return)                                "/ 177
b23a6474754f intitial checkin
cg
parents:
diff changeset
   212
        (getstatic constIndexShort)             "/ 178
b23a6474754f intitial checkin
cg
parents:
diff changeset
   213
        (putstatic constIndexShort)             "/ 179
b23a6474754f intitial checkin
cg
parents:
diff changeset
   214
b23a6474754f intitial checkin
cg
parents:
diff changeset
   215
        (getfield constIndexShort)              "/ 180
b23a6474754f intitial checkin
cg
parents:
diff changeset
   216
        (putfield constIndexShort)              "/ 181
b23a6474754f intitial checkin
cg
parents:
diff changeset
   217
        (invokevirtual constIndexShort)         "/ 182
b23a6474754f intitial checkin
cg
parents:
diff changeset
   218
        (invokenonvirtual constIndexShort)      "/ 183
b23a6474754f intitial checkin
cg
parents:
diff changeset
   219
        (invokestatic constIndexShort)          "/ 184
b23a6474754f intitial checkin
cg
parents:
diff changeset
   220
        (invokeinterface constIndexShort nargsByte reservedByte)          "/ 185
b23a6474754f intitial checkin
cg
parents:
diff changeset
   221
        (newfromname)                           "/ 186
b23a6474754f intitial checkin
cg
parents:
diff changeset
   222
        (new constIndexShort)                   "/ 187
b23a6474754f intitial checkin
cg
parents:
diff changeset
   223
        (newarray arrayTypeByte)                "/ 188
b23a6474754f intitial checkin
cg
parents:
diff changeset
   224
        (anewarray constIndexShort)             "/ 189
b23a6474754f intitial checkin
cg
parents:
diff changeset
   225
b23a6474754f intitial checkin
cg
parents:
diff changeset
   226
        (arraylength)                           "/ 190
32
0dbaa43a73db checkin from browser
cg
parents: 27
diff changeset
   227
        (athrow)                                "/ 191
27
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   228
        (checkcast constIndexShort)             "/ 192
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   229
        (instanceof constIndexShort)            "/ 193
b23a6474754f intitial checkin
cg
parents:
diff changeset
   230
        (monitorenter)                          "/ 194
b23a6474754f intitial checkin
cg
parents:
diff changeset
   231
        (monitorexit)                           "/ 195
68
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   232
"/        (verifystack)                           "/ 196 obsolete (Alpha release)
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   233
        (wide localIndexByte)                   "/ 196
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   234
        (multianewarray constIndexShort dimensionsByte) "/ 197
41
eb7974d88088 checkin from browser
cg
parents: 40
diff changeset
   235
68
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   236
        (ifnull    signedBranchShort)           "/ 198
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   237
        (ifnonnull signedBranchShort)           "/ 199
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   238
68
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   239
        (#'goto_w' signedBranchLong)            "/ 200
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   240
        (#'jsr_w' signedBranchShort)            "/ 201
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   241
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   242
        (breakpoint)                            "/ 202
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   243
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   244
        nil                                     "/ 203
b23a6474754f intitial checkin
cg
parents:
diff changeset
   245
        nil                                     "/ 204
b23a6474754f intitial checkin
cg
parents:
diff changeset
   246
        nil                                     "/ 205
68
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   247
        nil                                     "/ 206
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   248
        nil                                     "/ 207
b23a6474754f intitial checkin
cg
parents:
diff changeset
   249
        nil                                     "/ 208
68
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   250
        (#'ret_w' signedBranchShort)            "/ 209
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   251
                                         
b23a6474754f intitial checkin
cg
parents:
diff changeset
   252
        nil                                     "/ 210
b23a6474754f intitial checkin
cg
parents:
diff changeset
   253
        nil                                     "/ 211
b23a6474754f intitial checkin
cg
parents:
diff changeset
   254
        nil                                     "/ 212
b23a6474754f intitial checkin
cg
parents:
diff changeset
   255
        nil                                     "/ 213
b23a6474754f intitial checkin
cg
parents:
diff changeset
   256
        nil                                     "/ 214
b23a6474754f intitial checkin
cg
parents:
diff changeset
   257
        nil                                     "/ 215
b23a6474754f intitial checkin
cg
parents:
diff changeset
   258
        nil                                     "/ 216
b23a6474754f intitial checkin
cg
parents:
diff changeset
   259
        nil                                     "/ 217
b23a6474754f intitial checkin
cg
parents:
diff changeset
   260
        nil                                     "/ 218
b23a6474754f intitial checkin
cg
parents:
diff changeset
   261
        nil                                     "/ 219
b23a6474754f intitial checkin
cg
parents:
diff changeset
   262
b23a6474754f intitial checkin
cg
parents:
diff changeset
   263
        nil                                     "/ 220
b23a6474754f intitial checkin
cg
parents:
diff changeset
   264
        nil                                     "/ 221
b23a6474754f intitial checkin
cg
parents:
diff changeset
   265
        nil                                     "/ 222
b23a6474754f intitial checkin
cg
parents:
diff changeset
   266
        nil                                     "/ 223
b23a6474754f intitial checkin
cg
parents:
diff changeset
   267
        nil                                     "/ 224
b23a6474754f intitial checkin
cg
parents:
diff changeset
   268
        nil                                     "/ 225
b23a6474754f intitial checkin
cg
parents:
diff changeset
   269
        nil                                     "/ 226
b23a6474754f intitial checkin
cg
parents:
diff changeset
   270
        nil                                     "/ 227
b23a6474754f intitial checkin
cg
parents:
diff changeset
   271
        nil                                     "/ 228
b23a6474754f intitial checkin
cg
parents:
diff changeset
   272
        nil                                     "/ 229
b23a6474754f intitial checkin
cg
parents:
diff changeset
   273
                                    
b23a6474754f intitial checkin
cg
parents:
diff changeset
   274
        nil                                     "/ 230
b23a6474754f intitial checkin
cg
parents:
diff changeset
   275
        nil                                     "/ 231
b23a6474754f intitial checkin
cg
parents:
diff changeset
   276
        nil                                     "/ 232
b23a6474754f intitial checkin
cg
parents:
diff changeset
   277
        nil                                     "/ 233
b23a6474754f intitial checkin
cg
parents:
diff changeset
   278
        nil                                     "/ 234
b23a6474754f intitial checkin
cg
parents:
diff changeset
   279
        nil                                     "/ 235
b23a6474754f intitial checkin
cg
parents:
diff changeset
   280
        nil                                     "/ 236
b23a6474754f intitial checkin
cg
parents:
diff changeset
   281
        nil                                     "/ 237
b23a6474754f intitial checkin
cg
parents:
diff changeset
   282
        nil                                     "/ 238
b23a6474754f intitial checkin
cg
parents:
diff changeset
   283
        nil                                     "/ 239
b23a6474754f intitial checkin
cg
parents:
diff changeset
   284
b23a6474754f intitial checkin
cg
parents:
diff changeset
   285
        nil                                     "/ 240
b23a6474754f intitial checkin
cg
parents:
diff changeset
   286
        nil                                     "/ 241
b23a6474754f intitial checkin
cg
parents:
diff changeset
   287
        nil                                     "/ 242
b23a6474754f intitial checkin
cg
parents:
diff changeset
   288
        nil                                     "/ 243
b23a6474754f intitial checkin
cg
parents:
diff changeset
   289
        nil                                     "/ 244
b23a6474754f intitial checkin
cg
parents:
diff changeset
   290
        nil                                     "/ 245
b23a6474754f intitial checkin
cg
parents:
diff changeset
   291
        nil                                     "/ 246
b23a6474754f intitial checkin
cg
parents:
diff changeset
   292
        nil                                     "/ 247
b23a6474754f intitial checkin
cg
parents:
diff changeset
   293
        nil                                     "/ 248
b23a6474754f intitial checkin
cg
parents:
diff changeset
   294
        nil                                     "/ 249
b23a6474754f intitial checkin
cg
parents:
diff changeset
   295
                                              
b23a6474754f intitial checkin
cg
parents:
diff changeset
   296
        nil                                     "/ 250
b23a6474754f intitial checkin
cg
parents:
diff changeset
   297
        nil                                     "/ 251
b23a6474754f intitial checkin
cg
parents:
diff changeset
   298
        nil                                     "/ 252
b23a6474754f intitial checkin
cg
parents:
diff changeset
   299
        nil                                     "/ 253
b23a6474754f intitial checkin
cg
parents:
diff changeset
   300
        nil                                     "/ 254
b23a6474754f intitial checkin
cg
parents:
diff changeset
   301
        nil                                     "/ 255
b23a6474754f intitial checkin
cg
parents:
diff changeset
   302
    )
b23a6474754f intitial checkin
cg
parents:
diff changeset
   303
b23a6474754f intitial checkin
cg
parents:
diff changeset
   304
    "
b23a6474754f intitial checkin
cg
parents:
diff changeset
   305
     JavaDecompiler initialize
b23a6474754f intitial checkin
cg
parents:
diff changeset
   306
    "
b23a6474754f intitial checkin
cg
parents:
diff changeset
   307
b23a6474754f intitial checkin
cg
parents:
diff changeset
   308
    "Modified: 16.4.1996 / 14:56:13 / cg"
b23a6474754f intitial checkin
cg
parents:
diff changeset
   309
! !
b23a6474754f intitial checkin
cg
parents:
diff changeset
   310
68
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   311
!JavaDecompiler  class methodsFor:'accessing'!
27
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   312
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   313
instructionTable
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   314
    ^ DecoderTable
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   315
! !
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   316
68
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   317
!JavaDecompiler  class methodsFor:'decompiling'!
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   318
b23a6474754f intitial checkin
cg
parents:
diff changeset
   319
decompile:aJavaMethod
18
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   320
    self decompile:aJavaMethod to:Transcript
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   321
!
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   322
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   323
decompile:aJavaMethod to:aStream
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   324
    self new decompile:aJavaMethod to:aStream
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   325
! !
b23a6474754f intitial checkin
cg
parents:
diff changeset
   326
b23a6474754f intitial checkin
cg
parents:
diff changeset
   327
!JavaDecompiler methodsFor:'decompiling'!
b23a6474754f intitial checkin
cg
parents:
diff changeset
   328
18
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   329
decompile:aJavaMethod to:aStream
27
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   330
    |who endPC insn spec op|
18
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   331
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   332
    outStream := aStream.
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   333
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   334
    who := aJavaMethod who.
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   335
    who notNil ifTrue:[
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   336
        classToCompileFor := who first.
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   337
        aStream cr.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 52
diff changeset
   338
"/        aStream showCR:'decompiling ' , classToCompileFor name , '>>' , (who at:2) , ':'.
ff1579eb825f showCr: -> showCR:
cg
parents: 52
diff changeset
   339
        aStream showCR:'decompiling ' , aJavaMethod displayString , ':'.
119
440cfcb9d0c1 checkin from browser
cg
parents: 108
diff changeset
   340
        aJavaMethod isStatic ifTrue:[
440cfcb9d0c1 checkin from browser
cg
parents: 108
diff changeset
   341
            aStream show:'static method'.
440cfcb9d0c1 checkin from browser
cg
parents: 108
diff changeset
   342
        ].
440cfcb9d0c1 checkin from browser
cg
parents: 108
diff changeset
   343
        aStream cr.
18
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   344
        aStream cr.
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   345
    ].
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   346
b23a6474754f intitial checkin
cg
parents:
diff changeset
   347
    javaMethod := aJavaMethod.
b23a6474754f intitial checkin
cg
parents:
diff changeset
   348
    code := aJavaMethod javaByteCode.
b23a6474754f intitial checkin
cg
parents:
diff changeset
   349
    endPC := code size.
18
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   350
    endPC == 0 ifTrue:[
19
512a19e2d46f checkin from browser
cg
parents: 18
diff changeset
   351
        javaMethod isNative ifTrue:[
18
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   352
            outStream nextPutAll:'implemented in C'; cr
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   353
        ] ifFalse:[
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   354
            outStream nextPutAll:'no bytecode'; cr
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   355
        ].
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   356
        ^ self
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   357
    ].
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   358
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   359
    pc := 1.
b23a6474754f intitial checkin
cg
parents:
diff changeset
   360
    [pc <= endPC] whileTrue:[
b23a6474754f intitial checkin
cg
parents:
diff changeset
   361
        insn := code at:pc.
b23a6474754f intitial checkin
cg
parents:
diff changeset
   362
        pc := pc + 1.
b23a6474754f intitial checkin
cg
parents:
diff changeset
   363
        spec := DecoderTable at:(insn + 1).
27
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   364
        spec isNil ifTrue:[
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   365
            op := '** invalid opcode: ',insn printString, ' **'
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   366
        ] ifFalse:[
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   367
            op := spec at:1
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   368
        ].
23
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   369
        outStream 
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   370
            show:((pc - 1) printStringPaddedTo:4); 
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   371
            show:' '; 
27
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   372
            show:op; 
23
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   373
            show:' '.
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   374
27
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   375
        spec notNil ifTrue:[
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   376
            spec from:2 to:spec size do:[:what |
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   377
                self perform:what
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   378
            ].
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   379
        ].
18
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   380
        outStream cr.
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   381
    ]
b23a6474754f intitial checkin
cg
parents:
diff changeset
   382
b23a6474754f intitial checkin
cg
parents:
diff changeset
   383
    "Created: 16.4.1996 / 14:59:29 / cg"
b23a6474754f intitial checkin
cg
parents:
diff changeset
   384
    "Modified: 16.4.1996 / 15:27:05 / cg"
b23a6474754f intitial checkin
cg
parents:
diff changeset
   385
! !
b23a6474754f intitial checkin
cg
parents:
diff changeset
   386
b23a6474754f intitial checkin
cg
parents:
diff changeset
   387
!JavaDecompiler methodsFor:'operand decoding'!
b23a6474754f intitial checkin
cg
parents:
diff changeset
   388
23
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   389
arrayTypeByte
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   390
    |hi low index type|
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   391
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   392
    index := code at:pc.
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   393
    pc := pc + 1.
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   394
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   395
    type := #('T_ARRAY' 'invalid' 'invalid'  'T_BOOLEAN'
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   396
              'T_CHAR'  'T_FLOAT' 'T_DOUBLE' 'T_BYTE' 
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   397
              'T_INT'   'T_LONG' ) at:index ifAbsent:'invalid'.
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   398
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   399
    outStream
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   400
        show:index; 
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   401
        show:' [';
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   402
        show:type;
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   403
        show:']'
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   404
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   405
    "Created: 16.4.1996 / 15:00:04 / cg"
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   406
    "Modified: 16.4.1996 / 15:30:55 / cg"
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   407
!
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   408
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   409
constIndexByte
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   410
    |hi low index constants|
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   411
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   412
    index := code at:pc.
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   413
    pc := pc + 1.
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   414
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   415
    outStream
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   416
        show:index; 
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   417
        show:' ['; 
27
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   418
        show:(javaMethod constantPool at:index ifAbsent:['??']) displayString; 
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   419
        show:'] '
23
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   420
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   421
    "Created: 16.4.1996 / 15:00:04 / cg"
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   422
    "Modified: 16.4.1996 / 15:30:55 / cg"
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   423
!
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   424
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   425
constIndexShort
24
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   426
    |index constants|
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   427
24
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   428
    index := code wordAt:pc MSB:true.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   429
    pc := pc + 2.
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   430
18
6c07dc4b1118 checkin from browser
cg
parents: 6
diff changeset
   431
    outStream
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   432
        show:index; 
b23a6474754f intitial checkin
cg
parents:
diff changeset
   433
        show:' ['; 
27
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   434
        show:(javaMethod constantPool at:index ifAbsent:'???') displayString; 
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   435
        show:'] '
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   436
b23a6474754f intitial checkin
cg
parents:
diff changeset
   437
    "Created: 16.4.1996 / 15:00:04 / cg"
b23a6474754f intitial checkin
cg
parents:
diff changeset
   438
    "Modified: 16.4.1996 / 15:30:55 / cg"
23
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   439
!
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   440
27
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   441
dimensionsByte
108
235be8e8bd8c *** empty log message ***
cg
parents: 91
diff changeset
   442
    outStream show:' dims= '. 
27
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   443
    self unsignedByte
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   444
!
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   445
23
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   446
localIndexByte
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   447
    |hi low index constants|
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   448
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   449
    index := code at:pc.
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   450
    pc := pc + 1.
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   451
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   452
    outStream
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   453
        show:index; 
39
20fa5af3b873 checkin from browser
cg
parents: 36
diff changeset
   454
        show:' '
23
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   455
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   456
    "Created: 16.4.1996 / 15:00:04 / cg"
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   457
    "Modified: 16.4.1996 / 15:30:55 / cg"
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   458
!
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   459
27
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   460
lookupSwitchBytes
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   461
    |defaultOffset delta nPairs match pc0|
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   462
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   463
    pc0 := pc-1.  "/ i.e. the pc of the tableSwitch op
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   464
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   465
    [(pc-1) \\ 4 ~~ 0] whileTrue:[
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   466
        pc := pc + 1
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   467
    ].
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   468
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   469
    defaultOffset := code signedDoubleWordAt:pc MSB:true.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   470
    pc := pc + 4.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   471
    nPairs := code signedDoubleWordAt:pc MSB:true.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   472
    pc := pc + 4.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   473
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   474
    outStream show:'n='; show:nPairs; cr.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   475
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   476
    nPairs timesRepeat:[
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   477
        match := code signedDoubleWordAt:pc MSB:true.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   478
        pc := pc + 4.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   479
        delta := code signedDoubleWordAt:pc MSB:true.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   480
        pc := pc + 4.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   481
        outStream show:'    '; 
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   482
                  show:match;
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   483
                  show:' -> ';
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   484
                  show:delta;
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   485
                  show:' [';
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   486
                  show:(pc0 + delta);
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   487
                  show:']';
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   488
                  cr.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   489
    ].
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   490
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   491
    outStream show:'    '; 
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   492
              show:'default';
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   493
              show:' -> ';
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   494
              show:defaultOffset;
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   495
              show:' [';
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   496
              show:(pc0 + defaultOffset);
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   497
              show:']'.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   498
!
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   499
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   500
nargsByte
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   501
    |byte constants|
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   502
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   503
    byte := code byteAt:pc.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   504
    pc := pc + 1.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   505
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   506
    outStream
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   507
        show:byte 
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   508
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   509
    "Created: 16.4.1996 / 15:00:04 / cg"
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   510
    "Modified: 16.4.1996 / 15:30:55 / cg"
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   511
!
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   512
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   513
reservedByte
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   514
    |byte constants|
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   515
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   516
    byte := code byteAt:pc.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   517
    pc := pc + 1.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   518
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   519
    outStream
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   520
        show:byte 
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   521
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   522
    "Created: 16.4.1996 / 15:00:04 / cg"
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   523
    "Modified: 16.4.1996 / 15:30:55 / cg"
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   524
!
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   525
23
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   526
signedBranchShort
24
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   527
    |index constants|
23
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   528
24
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   529
    index := code signedWordAt:pc MSB:true.
23
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   530
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   531
    outStream
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   532
        show:index; 
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   533
        show:' ['; 
25
735dde512f03 Fix signedBranchShort
stefan
parents: 24
diff changeset
   534
        show:(pc + index - 1); 
735dde512f03 Fix signedBranchShort
stefan
parents: 24
diff changeset
   535
        show:']'.
735dde512f03 Fix signedBranchShort
stefan
parents: 24
diff changeset
   536
735dde512f03 Fix signedBranchShort
stefan
parents: 24
diff changeset
   537
    pc := pc + 2.
23
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   538
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   539
    "Created: 16.4.1996 / 15:00:04 / cg"
3e20532cd5bc checkin from browser
cg
parents: 19
diff changeset
   540
    "Modified: 16.4.1996 / 15:30:55 / cg"
24
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   541
!
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   542
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   543
signedByte
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   544
    |byte constants|
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   545
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   546
    byte := code signedByteAt:pc.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   547
    pc := pc + 1.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   548
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   549
    outStream
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   550
        show:byte 
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   551
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   552
    "Created: 16.4.1996 / 15:00:04 / cg"
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   553
    "Modified: 16.4.1996 / 15:30:55 / cg"
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   554
!
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   555
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   556
signedShort
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   557
    |word constants|
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   558
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   559
    word := code signedWordAt:pc MSB:true.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   560
    pc := pc + 2.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   561
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   562
    outStream
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   563
        show:word 
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   564
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   565
    "Created: 16.4.1996 / 15:00:04 / cg"
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   566
    "Modified: 16.4.1996 / 15:30:55 / cg"
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   567
!
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   568
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   569
tableSwitchBytes
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   570
    |defaultOffset delta low high pc0|
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   571
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   572
    pc0 := pc-1.  "/ i.e. the pc of the tableSwitch op
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   573
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   574
    [(pc-1) \\ 4 ~~ 0] whileTrue:[
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   575
        pc := pc + 1
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   576
    ].
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   577
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   578
    defaultOffset := code signedDoubleWordAt:pc MSB:true.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   579
    pc := pc + 4.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   580
    low := code signedDoubleWordAt:pc MSB:true.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   581
    pc := pc + 4.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   582
    high := code signedDoubleWordAt:pc MSB:true.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   583
    pc := pc + 4.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   584
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   585
    outStream cr.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   586
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   587
    low to:high do:[:switchValue |
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   588
        delta := code signedDoubleWordAt:pc MSB:true.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   589
        pc := pc + 4.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   590
        outStream show:'    '; 
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   591
                  show:switchValue;
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   592
                  show:' -> ';
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   593
                  show:delta;
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   594
                  show:' [';
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   595
                  show:(pc0 + delta);
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   596
                  show:']';
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   597
                  cr.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   598
    ].
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   599
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   600
    outStream show:'    '; 
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   601
              show:'default';
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   602
              show:' -> ';
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   603
              show:defaultOffset;
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   604
              show:' [';
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   605
              show:(pc0 + defaultOffset);
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   606
              show:']'.
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   607
4a9822b95fc0 checkin from browser
cg
parents: 23
diff changeset
   608
27
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   609
!
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   610
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   611
unsignedByte
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   612
    |byte constants|
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   613
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   614
    byte := code byteAt:pc.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   615
    pc := pc + 1.
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   616
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   617
    outStream
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   618
        show:byte 
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   619
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   620
    "Created: 16.4.1996 / 15:00:04 / cg"
4560bb77bb36 checkin from browser
cg
parents: 25
diff changeset
   621
    "Modified: 16.4.1996 / 15:30:55 / cg"
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   622
! !
b23a6474754f intitial checkin
cg
parents:
diff changeset
   623
68
ae0e5262ad38 Beta changes (some insns changed opcodes)
cg
parents: 61
diff changeset
   624
!JavaDecompiler  class methodsFor:'documentation'!
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   625
b23a6474754f intitial checkin
cg
parents:
diff changeset
   626
version
119
440cfcb9d0c1 checkin from browser
cg
parents: 108
diff changeset
   627
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaDecompiler.st,v 1.19 1996/07/06 18:16:23 cg Exp $'
6
b23a6474754f intitial checkin
cg
parents:
diff changeset
   628
! !
b23a6474754f intitial checkin
cg
parents:
diff changeset
   629
JavaDecompiler initialize!