Home | History | Annotate | Download | only in d
      1 ; Copyright (C) 2008 The Android Open Source Project
      2 ;
      3 ; Licensed under the Apache License, Version 2.0 (the "License");
      4 ; you may not use this file except in compliance with the License.
      5 ; You may obtain a copy of the License at
      6 ;
      7 ;      http://www.apache.org/licenses/LICENSE-2.0
      8 ;
      9 ; Unless required by applicable law or agreed to in writing, software
     10 ; distributed under the License is distributed on an "AS IS" BASIS,
     11 ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 ; See the License for the specific language governing permissions and
     13 ; limitations under the License.
     14 
     15 .source TestStubs.java
     16 .interface public dot.junit.opcodes.check_cast.d.T_check_cast_2.SuperInterface
     17 
     18 .source TestStubs.java
     19 .interface public dot.junit.opcodes.check_cast.d.T_check_cast_2.SuperInterface2
     20 
     21 .source TestStubs.java
     22 .class public dot.junit.opcodes.check_cast.d.T_check_cast_2.SuperClass
     23 .super java/lang/Object
     24 .implements dot/junit/opcodes/check_cast/d/T_check_cast_2/SuperInterface
     25 
     26 .method public <init>()V
     27 .limit regs 1
     28 
     29        invoke-direct {v0}, java/lang/Object/<init>()V
     30        return-void
     31 .end method
     32 
     33 .source TestStubs.java
     34 .class public dot.junit.opcodes.check_cast.d.T_check_cast_2.SubClass
     35 .super dot/junit/opcodes/check_cast/d/T_check_cast_2/SuperClass
     36 
     37 .method public <init>()V
     38 .limit regs 1
     39 
     40        invoke-direct {v0}, dot/junit/opcodes/check_cast/d/T_check_cast_2/SuperClass/<init>()V
     41        return-void
     42 .end method
     43 
     44 
     45 .source T_check_cast_2.java
     46 .class public dot.junit.opcodes.check_cast.d.T_check_cast_2
     47 .super java/lang/Object
     48 
     49 
     50 .method public <init>()V
     51 .limit regs 1
     52 
     53        invoke-direct {v0}, java/lang/Object/<init>()V
     54        return-void
     55 .end method
     56 
     57 .method public run()I
     58 .limit regs 20
     59 
     60     const v1, 0
     61 
     62 ; (SubClass instanceof SuperClass)
     63     new-instance v10, dot/junit/opcodes/check_cast/d/T_check_cast_2/SubClass
     64     invoke-direct {v10}, dot/junit/opcodes/check_cast/d/T_check_cast_2/SubClass/<init>()V
     65     check-cast v10, dot/junit/opcodes/check_cast/d/T_check_cast_2/SuperClass
     66 
     67 ; (SubClass[] instanceof SuperClass[])
     68     const v11, 1
     69     new-array v10, v11, [Ldot/junit/opcodes/check_cast/d/T_check_cast_2/SubClass;
     70     check-cast v10, [Ldot/junit/opcodes/check_cast/d/T_check_cast_2/SuperClass;
     71 
     72 
     73 ; (SubClass[] instanceof Object)
     74     new-array v10, v11, [Ldot/junit/opcodes/check_cast/d/T_check_cast_2/SubClass;
     75     check-cast v10, java/lang/Object
     76 
     77 ; (SubClass instanceof SuperInterface)
     78     new-instance v10, dot/junit/opcodes/check_cast/d/T_check_cast_2/SubClass
     79     invoke-direct {v10}, dot/junit/opcodes/check_cast/d/T_check_cast_2/SubClass/<init>()V
     80     check-cast v10, dot/junit/opcodes/check_cast/d/T_check_cast_2/SuperInterface
     81 
     82 
     83 ; !(SuperClass instanceof SubClass)
     84 Label1:
     85     new-instance v10, dot/junit/opcodes/check_cast/d/T_check_cast_2/SuperClass
     86     invoke-direct {v10}, dot/junit/opcodes/check_cast/d/T_check_cast_2/SuperClass/<init>()V
     87 Label10:
     88     check-cast v10, dot/junit/opcodes/check_cast/d/T_check_cast_2/SubClass
     89 Label11:
     90     goto Label2
     91 Label12:
     92     add-int/lit16 v1, v1, 1
     93     goto Label2
     94 
     95 ; !(SubClass instanceof SuperInterface2)
     96 Label2:
     97     new-instance v10, dot/junit/opcodes/check_cast/d/T_check_cast_2/SubClass
     98     invoke-direct {v10}, dot/junit/opcodes/check_cast/d/T_check_cast_2/SubClass/<init>()V
     99 Label20:
    100     check-cast v10, dot/junit/opcodes/check_cast/d/T_check_cast_2/SuperInterface2
    101 Label21:
    102     goto Label3
    103 Label22:
    104     add-int/lit16 v1, v1, 1
    105     goto Label3
    106 
    107 ; !(SubClass[] instanceof SuperInterface)
    108 Label3:
    109     new-array v10, v11, [Ldot/junit/opcodes/check_cast/d/T_check_cast_2/SubClass;
    110 Label30:
    111     check-cast v10, dot/junit/opcodes/check_cast/d/T_check_cast_2/SuperInterface
    112 Label31:
    113     goto Label4
    114 Label32:
    115     add-int/lit16 v1, v1, 1
    116     goto Label4
    117 
    118 ; !(SubClass[] instanceof SubClass)
    119 Label4:
    120     new-array v10, v11, [Ldot/junit/opcodes/check_cast/d/T_check_cast_2/SubClass;
    121 Label40:
    122     check-cast v10, dot/junit/opcodes/check_cast/d/T_check_cast_2/SubClass
    123 Label41:
    124     goto Label5
    125 Label42:
    126     add-int/lit16 v1, v1, 1
    127     goto Label5
    128 
    129 ; !(SuperClass[] instanceof SubClass[])
    130 Label5:
    131     new-array v10, v11, [Ldot/junit/opcodes/check_cast/d/T_check_cast_2/SuperClass;
    132 Label50:
    133     check-cast v10, [Ldot/junit/opcodes/check_cast/d/T_check_cast_2/SubClass;
    134 Label51:
    135     goto Label6
    136 Label52:
    137     add-int/lit16 v1, v1, 1
    138 
    139 Label6:
    140     return v1
    141 
    142 .catch java/lang/ClassCastException from Label10 to Label11 using Label12
    143 .catch java/lang/ClassCastException from Label20 to Label21 using Label22
    144 .catch java/lang/ClassCastException from Label30 to Label31 using Label32
    145 .catch java/lang/ClassCastException from Label40 to Label41 using Label42
    146 .catch java/lang/ClassCastException from Label50 to Label51 using Label52
    147 .end method
    148 
    149 
    150