xref: /aosp_15_r20/art/test/531-regression-debugphi/smali/TestCase.smali (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1*795d594fSAndroid Build Coastguard Worker# Copyright (C) 2015 The Android Open Source Project
2*795d594fSAndroid Build Coastguard Worker#
3*795d594fSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
4*795d594fSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
5*795d594fSAndroid Build Coastguard Worker# You may obtain a copy of the License at
6*795d594fSAndroid Build Coastguard Worker#
7*795d594fSAndroid Build Coastguard Worker#      http://www.apache.org/licenses/LICENSE-2.0
8*795d594fSAndroid Build Coastguard Worker#
9*795d594fSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*795d594fSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
11*795d594fSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*795d594fSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
13*795d594fSAndroid Build Coastguard Worker# limitations under the License.
14*795d594fSAndroid Build Coastguard Worker
15*795d594fSAndroid Build Coastguard Worker.class public LTestCase;
16*795d594fSAndroid Build Coastguard Worker.super Ljava/lang/Object;
17*795d594fSAndroid Build Coastguard Worker
18*795d594fSAndroid Build Coastguard Worker# Situation:
19*795d594fSAndroid Build Coastguard Worker#  - PhiA: PrimVoid + PrimNot equivalents
20*795d594fSAndroid Build Coastguard Worker#  - PhiB: PrimVoid (PrimVoid PhiA as input)
21*795d594fSAndroid Build Coastguard Worker# DeadPhiHandling:
22*795d594fSAndroid Build Coastguard Worker#  - iterate over blocks in reverse post order
23*795d594fSAndroid Build Coastguard Worker#    - update PrimVoid PhiA to PrimNot
24*795d594fSAndroid Build Coastguard Worker#    - update inputs of PrimNot PhiA
25*795d594fSAndroid Build Coastguard Worker#    - set type of PhiB
26*795d594fSAndroid Build Coastguard Worker#  - left with two PrimNot equivalents of PhiA
27*795d594fSAndroid Build Coastguard Worker
28*795d594fSAndroid Build Coastguard Worker.method public static testCase_ReversePostOrder(IILjava/lang/Object;)V
29*795d594fSAndroid Build Coastguard Worker  .registers 5
30*795d594fSAndroid Build Coastguard Worker
31*795d594fSAndroid Build Coastguard Worker  # v0 - Phi A
32*795d594fSAndroid Build Coastguard Worker  # v1 - Phi B
33*795d594fSAndroid Build Coastguard Worker  # p0 - int arg1
34*795d594fSAndroid Build Coastguard Worker  # p1 - int arg2
35*795d594fSAndroid Build Coastguard Worker  # p2 - ref arg3
36*795d594fSAndroid Build Coastguard Worker
37*795d594fSAndroid Build Coastguard Worker  if-nez p0, :else1
38*795d594fSAndroid Build Coastguard Worker  :then1
39*795d594fSAndroid Build Coastguard Worker    if-nez p1, :else2
40*795d594fSAndroid Build Coastguard Worker    :then2
41*795d594fSAndroid Build Coastguard Worker      const/4 v1, 0x0
42*795d594fSAndroid Build Coastguard Worker      goto :merge2
43*795d594fSAndroid Build Coastguard Worker
44*795d594fSAndroid Build Coastguard Worker    :else2
45*795d594fSAndroid Build Coastguard Worker      move-object v1, p2
46*795d594fSAndroid Build Coastguard Worker      goto :merge2
47*795d594fSAndroid Build Coastguard Worker
48*795d594fSAndroid Build Coastguard Worker    :merge2
49*795d594fSAndroid Build Coastguard Worker      # PhiA [null, arg3]
50*795d594fSAndroid Build Coastguard Worker      move-object v0, v1                                 # create PrimNot PhiA equivalent
51*795d594fSAndroid Build Coastguard Worker      invoke-static {}, Ljava/lang/System;->nanoTime()J  # env use of both PhiA equivalents
52*795d594fSAndroid Build Coastguard Worker      goto :merge1
53*795d594fSAndroid Build Coastguard Worker
54*795d594fSAndroid Build Coastguard Worker  :else1
55*795d594fSAndroid Build Coastguard Worker    move-object v0, p2
56*795d594fSAndroid Build Coastguard Worker    goto :merge1
57*795d594fSAndroid Build Coastguard Worker
58*795d594fSAndroid Build Coastguard Worker  :merge1
59*795d594fSAndroid Build Coastguard Worker    # PhiB [PhiA, arg3]
60*795d594fSAndroid Build Coastguard Worker    invoke-static {}, Ljava/lang/System;->nanoTime()J    # env use of PhiB
61*795d594fSAndroid Build Coastguard Worker
62*795d594fSAndroid Build Coastguard Worker  return-void
63*795d594fSAndroid Build Coastguard Worker.end method
64*795d594fSAndroid Build Coastguard Worker
65*795d594fSAndroid Build Coastguard Worker# Situation:
66*795d594fSAndroid Build Coastguard Worker#  - PhiA: PrimVoid + PrimNot (PrimInt inputs)
67*795d594fSAndroid Build Coastguard Worker#  - PhiB: PrimVoid + PrimNot (PrimInt inputs)
68*795d594fSAndroid Build Coastguard Worker#  - PhiC: PrimVoid only
69*795d594fSAndroid Build Coastguard Worker# DeadPhiHandling:
70*795d594fSAndroid Build Coastguard Worker#  - iterate over blocks in reverse post order
71*795d594fSAndroid Build Coastguard Worker#    - add both PhiAs to worklist, set PrimVoid PhiA to PrimInt
72*795d594fSAndroid Build Coastguard Worker#    - update inputs of PrimNot PhiB ; add PrimNot PhiA to worklist
73*795d594fSAndroid Build Coastguard Worker#    - update PhiC to PrimNot
74*795d594fSAndroid Build Coastguard Worker#  - start processing worklist
75*795d594fSAndroid Build Coastguard Worker#    - PrimNot PhiA: update inputs, no equivalent created
76*795d594fSAndroid Build Coastguard Worker#    - PrimInt PhiA: update inputs, set to PrimNot, use instead of PrimNot PhiA
77*795d594fSAndroid Build Coastguard Worker#    - add PhiBs to worklist as users of PhiA
78*795d594fSAndroid Build Coastguard Worker#    - PrimInt PhiB: set type to PrimNot, equivalent live and in worklist
79*795d594fSAndroid Build Coastguard Worker
80*795d594fSAndroid Build Coastguard Worker.method public static testCase_FixPointIteration(IILjava/lang/Object;Ljava/lang/Object;)V
81*795d594fSAndroid Build Coastguard Worker  .registers 6
82*795d594fSAndroid Build Coastguard Worker
83*795d594fSAndroid Build Coastguard Worker  # v0 - Phi A, C
84*795d594fSAndroid Build Coastguard Worker  # v1 - Phi B
85*795d594fSAndroid Build Coastguard Worker  # p0 - int arg1
86*795d594fSAndroid Build Coastguard Worker  # p1 - int arg2
87*795d594fSAndroid Build Coastguard Worker  # p2 - ref arg3
88*795d594fSAndroid Build Coastguard Worker  # p3 - ref arg4
89*795d594fSAndroid Build Coastguard Worker
90*795d594fSAndroid Build Coastguard Worker  const/4 v0, 0x0
91*795d594fSAndroid Build Coastguard Worker
92*795d594fSAndroid Build Coastguard Worker  :loop_header
93*795d594fSAndroid Build Coastguard Worker  # PhiA [null, PhiC] for v0
94*795d594fSAndroid Build Coastguard Worker
95*795d594fSAndroid Build Coastguard Worker  if-eqz p0, :else1
96*795d594fSAndroid Build Coastguard Worker  :then1
97*795d594fSAndroid Build Coastguard Worker    const/4 v1, 0x0
98*795d594fSAndroid Build Coastguard Worker    goto :merge1
99*795d594fSAndroid Build Coastguard Worker  :else1
100*795d594fSAndroid Build Coastguard Worker    move-object v1, v0                                   # create PrimNot equivalent of PhiA
101*795d594fSAndroid Build Coastguard Worker    invoke-static {}, Ljava/lang/System;->nanoTime()J    # env use of both PhiA equivalents
102*795d594fSAndroid Build Coastguard Worker    goto :merge1
103*795d594fSAndroid Build Coastguard Worker  :merge1
104*795d594fSAndroid Build Coastguard Worker  # PhiB [null, PhiA] for v1
105*795d594fSAndroid Build Coastguard Worker
106*795d594fSAndroid Build Coastguard Worker  move-object v0, v1                                     # creates PrimNot equivalent of PhiB
107*795d594fSAndroid Build Coastguard Worker  invoke-static {}, Ljava/lang/System;->nanoTime()J      # env use of both PhiB equivalents
108*795d594fSAndroid Build Coastguard Worker
109*795d594fSAndroid Build Coastguard Worker  if-eqz p1, :else2
110*795d594fSAndroid Build Coastguard Worker  :then2
111*795d594fSAndroid Build Coastguard Worker    move-object v0, p2
112*795d594fSAndroid Build Coastguard Worker    goto :merge2
113*795d594fSAndroid Build Coastguard Worker  :else2
114*795d594fSAndroid Build Coastguard Worker    move-object v0, p3
115*795d594fSAndroid Build Coastguard Worker    goto :merge2
116*795d594fSAndroid Build Coastguard Worker  :merge2
117*795d594fSAndroid Build Coastguard Worker  # PhiC [arg3, arg4] for v0, second input of PhiA
118*795d594fSAndroid Build Coastguard Worker
119*795d594fSAndroid Build Coastguard Worker  if-eqz p1, :loop_header
120*795d594fSAndroid Build Coastguard Worker  return-void
121*795d594fSAndroid Build Coastguard Worker.end method
122