Home | History | Annotate | Download | only in smali
      1 # Copyright (C) 2015 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 .class public LTestCase;
     16 .super Ljava/lang/Object;
     17 
     18 .method public static $noinline$throw()V
     19   .registers 1
     20   new-instance v0, Ljava/lang/Exception;
     21   invoke-direct {v0}, Ljava/lang/Exception;-><init>()V
     22   throw v0
     23 .end method
     24 
     25 # Test storing into the high vreg of a wide pair. This scenario has runtime
     26 # behaviour implications so we run it from Main.main.
     27 
     28 ## CHECK-START: int TestCase.invalidateLow(long) builder (after)
     29 ## CHECK-DAG: <<Cst0:i\d+>> IntConstant 0
     30 ## CHECK-DAG: <<Arg:j\d+>>  ParameterValue
     31 ## CHECK-DAG: <<Cast:i\d+>> TypeConversion [<<Arg>>]
     32 ## CHECK-DAG: InvokeStaticOrDirect method_name:java.lang.System.nanoTime env:[[_,<<Cst0>>,<<Arg>>,_]]
     33 ## CHECK-DAG: InvokeStaticOrDirect method_name:TestCase.$noinline$throw  env:[[_,<<Cast>>,<<Arg>>,_]]
     34 
     35 .method public static invalidateLow(J)I
     36   .registers 4
     37 
     38   const/4 v1, 0x0
     39 
     40   :try_start
     41   invoke-static {}, Ljava/lang/System;->nanoTime()J
     42   move-wide v0, p0
     43   long-to-int v1, v0
     44   invoke-static {}, LTestCase;->$noinline$throw()V
     45   :try_end
     46   .catchall {:try_start .. :try_end} :catchall
     47 
     48   :catchall
     49   return v1
     50 
     51 .end method
     52 
     53 # Test that storing a wide invalidates the value in the high vreg. This
     54 # cannot be detected from runtime so we only test the environment with Checker.
     55 
     56 ## CHECK-START: void TestCase.invalidateHigh1(long) builder (after)
     57 ## CHECK-DAG: <<Arg:j\d+>>  ParameterValue
     58 ## CHECK-DAG: InvokeStaticOrDirect method_name:java.lang.System.nanoTime env:[[<<Arg>>,_,<<Arg>>,_]]
     59 
     60 .method public static invalidateHigh1(J)V
     61   .registers 4
     62 
     63   const/4 v1, 0x0
     64   move-wide v0, p0
     65   invoke-static {}, Ljava/lang/System;->nanoTime()J
     66   return-void
     67 
     68 .end method
     69 
     70 ## CHECK-START: void TestCase.invalidateHigh2(long) builder (after)
     71 ## CHECK-DAG: <<Arg:j\d+>>  ParameterValue
     72 ## CHECK-DAG: InvokeStaticOrDirect method_name:java.lang.System.nanoTime env:[[<<Arg>>,_,_,<<Arg>>,_]]
     73 
     74 .method public static invalidateHigh2(J)V
     75   .registers 5
     76 
     77   move-wide v1, p0
     78   move-wide v0, p0
     79   invoke-static {}, Ljava/lang/System;->nanoTime()J
     80   return-void
     81 
     82 .end method
     83