diff options
author | Ben Gruver <bgruv@google.com> | 2011-11-18 11:34:18 -0800 |
---|---|---|
committer | = <bgruv@google.com> | 2011-11-20 15:46:39 -0800 |
commit | b0ca7cb99b875bda3458eaa60fc351d561ad560e (patch) | |
tree | a312f3e0d1acab6b917b03bc2bedc189612afa53 /smali-integration-tests | |
parent | c4db7e2473a77b6dfa58207825efcdb4d51697b7 (diff) | |
download | smali-b0ca7cb99b875bda3458eaa60fc351d561ad560e.tar.gz |
Add support for auto-upgrading to /jumbo variants of instructions when needed/possible
Diffstat (limited to 'smali-integration-tests')
12 files changed, 988 insertions, 3 deletions
diff --git a/smali-integration-tests/src/test/smali/jumbo-field-tests/Format41c_autofix.smali b/smali-integration-tests/src/test/smali/jumbo-field-tests/Format41c_autofix.smali new file mode 100644 index 00000000..666d2f92 --- /dev/null +++ b/smali-integration-tests/src/test/smali/jumbo-field-tests/Format41c_autofix.smali @@ -0,0 +1,158 @@ +#Copyright 2011, Google Inc. +#All rights reserved. +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions are +#met: +# +# * Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +#copyright notice, this list of conditions and the following disclaimer +#in the documentation and/or other materials provided with the +#distribution. +# * Neither the name of Google Inc. nor the names of its +#contributors may be used to endorse or promote products derived from +#this software without specific prior written permission. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +#A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +#OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +#SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +#LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +#THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +.class public LFormat41c_autofix; +.super Ljava/lang/Object; +.source "Format41c_autofix.smali" + +.method public constructor <init>()V + .registers 1 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V + return-void +.end method + +.method public test-sput-sget-jumbo()V + .registers 2 + .annotation runtime Lorg/junit/Test; + .end annotation + + const v0, 23 + sput v0, LManyStaticFields;->field99999:I + + sget v1, LManyStaticFields;->field99999:I + + invoke-static/range {v0 .. v1}, LAssert;->assertEquals(II)V + return-void +.end method + +.method public test-sput-object-sget-object-jumbo()V + .registers 2 + .annotation runtime Lorg/junit/Test; + .end annotation + + new-instance v0, Ljava/lang/Object; + invoke-direct {v0}, Ljava/lang/Object;-><init>()V + + sput-object v0, LManyStaticFields;->field99999Object:Ljava/lang/Object; + + sget-object v1, LManyStaticFields;->field99999Object:Ljava/lang/Object; + + invoke-static/range {v0 .. v1}, Lorg/junit/Assert;->assertEquals(Ljava/lang/Object;Ljava/lang/Object;)V + return-void +.end method + +.method public test-sput-wide-sget-wide-jumbo()V + .registers 4 + .annotation runtime Lorg/junit/Test; + .end annotation + + const-wide v0, 0x200000000L + + sput-wide v0, LManyStaticFields;->field99999Wide:J + + sget-wide v2, LManyStaticFields;->field99999Wide:J + + invoke-static/range {v0 .. v3}, Lorg/junit/Assert;->assertEquals(JJ)V + return-void +.end method + +.method public test-sput-boolean-sget-boolean-true-jumbo()V + .registers 2 + .annotation runtime Lorg/junit/Test; + .end annotation + + const v0, 1 + + sput-boolean v0, LManyStaticFields;->field99999Boolean:Z + + sget-boolean v1, LManyStaticFields;->field99999Boolean:Z + + invoke-static/range {v1}, Lorg/junit/Assert;->assertTrue(Z)V + return-void +.end method + +.method public test-sput-boolean-sget-boolean-false-jumbo()V + .registers 2 + .annotation runtime Lorg/junit/Test; + .end annotation + + const v0, 0 + + sput-boolean v0, LManyStaticFields;->field99999Boolean:Z + + sget-boolean v1, LManyStaticFields;->field99999Boolean:Z + + invoke-static/range {v1}, Lorg/junit/Assert;->assertFalse(Z)V + return-void +.end method + +.method public test-sput-byte-sget-byte-jumbo()V + .registers 2 + .annotation runtime Lorg/junit/Test; + .end annotation + + const v0, 120T + + sput-byte v0, LManyStaticFields;->field99999Byte:B + + sget-byte v1, LManyStaticFields;->field99999Byte:B + + invoke-static/range {v0 .. v1}, LAssert;->assertEquals(II)V + return-void +.end method + +.method public test-sput-char-sget-char-jumbo()V + .registers 2 + .annotation runtime Lorg/junit/Test; + .end annotation + + const v0, 'a' + + sput-char v0, LManyStaticFields;->field99999Char:C + + sget-char v1, LManyStaticFields;->field99999Char:C + + invoke-static/range {v0 .. v1}, LAssert;->assertEquals(II)V + return-void +.end method + +.method public test-sput-short-sget-short-jumbo()V + .registers 2 + .annotation runtime Lorg/junit/Test; + .end annotation + + const v0, 1234S + + sput-short v0, LManyStaticFields;->field99999Short:S + + sget-short v1, LManyStaticFields;->field99999Short:S + + invoke-static/range {v0 .. v1}, LAssert;->assertEquals(II)V + return-void +.end method
\ No newline at end of file diff --git a/smali-integration-tests/src/test/smali/jumbo-field-tests/Format52c_autofix.smali b/smali-integration-tests/src/test/smali/jumbo-field-tests/Format52c_autofix.smali new file mode 100644 index 00000000..9bda9d8a --- /dev/null +++ b/smali-integration-tests/src/test/smali/jumbo-field-tests/Format52c_autofix.smali @@ -0,0 +1,182 @@ +#Copyright 2011, Google Inc. +#All rights reserved. +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions are +#met: +# +# * Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +#copyright notice, this list of conditions and the following disclaimer +#in the documentation and/or other materials provided with the +#distribution. +# * Neither the name of Google Inc. nor the names of its +#contributors may be used to endorse or promote products derived from +#this software without specific prior written permission. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +#A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +#OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +#SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +#LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +#THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +.class public LFormat52c_autofix; +.super Ljava/lang/Object; +.source "Format52c_autofix.smali" + +.method public constructor <init>()V + .registers 1 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V + return-void +.end method + +.method public test-iput-iget-jumbo()V + .registers 3 + .annotation runtime Lorg/junit/Test; + .end annotation + + new-instance v2, LzzzInstanceFields; + invoke-direct/range {v2}, LzzzInstanceFields;-><init>()V + + const v0, 23 + iput v0, v2, LzzzInstanceFields;->field99999:I + + iget v1, v2, LzzzInstanceFields;->field99999:I + + invoke-static/range {v0 .. v1}, LAssert;->assertEquals(II)V + return-void +.end method + +.method public test-iput-object-iget-object-jumbo()V + .registers 3 + .annotation runtime Lorg/junit/Test; + .end annotation + + new-instance v2, LzzzInstanceFields; + invoke-direct/range {v2}, LzzzInstanceFields;-><init>()V + + new-instance v0, Ljava/lang/Object; + invoke-direct {v0}, Ljava/lang/Object;-><init>()V + + iput-object v0, v2, LzzzInstanceFields;->field99999Object:Ljava/lang/Object; + + iget-object v1, v2, LzzzInstanceFields;->field99999Object:Ljava/lang/Object; + + invoke-static/range {v0 .. v1}, Lorg/junit/Assert;->assertEquals(Ljava/lang/Object;Ljava/lang/Object;)V + return-void +.end method + +.method public test-iput-wide-iget-wide-jumbo()V + .registers 5 + .annotation runtime Lorg/junit/Test; + .end annotation + + new-instance v4, LzzzInstanceFields; + invoke-direct/range {v4}, LzzzInstanceFields;-><init>()V + + const-wide v0, 0x200000000L + + iput-wide v0, v4, LzzzInstanceFields;->field99999Wide:J + + iget-wide v2, v4, LzzzInstanceFields;->field99999Wide:J + + invoke-static/range {v0 .. v3}, Lorg/junit/Assert;->assertEquals(JJ)V + return-void +.end method + +.method public test-iput-boolean-iget-boolean-true-jumbo()V + .registers 3 + .annotation runtime Lorg/junit/Test; + .end annotation + + new-instance v2, LzzzInstanceFields; + invoke-direct/range {v2}, LzzzInstanceFields;-><init>()V + + const v0, 1 + + iput-boolean v0, v2, LzzzInstanceFields;->field99999Boolean:Z + + iget-boolean v1, v2, LzzzInstanceFields;->field99999Boolean:Z + + invoke-static/range {v1}, Lorg/junit/Assert;->assertTrue(Z)V + return-void +.end method + +.method public test-iput-boolean-iget-boolean-false-jumbo()V + .registers 3 + .annotation runtime Lorg/junit/Test; + .end annotation + + new-instance v2, LzzzInstanceFields; + invoke-direct/range {v2}, LzzzInstanceFields;-><init>()V + + const v0, 0 + + iput-boolean v0, v2, LzzzInstanceFields;->field99999Boolean:Z + + iget-boolean v1, v2, LzzzInstanceFields;->field99999Boolean:Z + + invoke-static/range {v1}, Lorg/junit/Assert;->assertFalse(Z)V + return-void +.end method + +.method public test-iput-byte-iget-byte-jumbo()V + .registers 3 + .annotation runtime Lorg/junit/Test; + .end annotation + + new-instance v2, LzzzInstanceFields; + invoke-direct/range {v2}, LzzzInstanceFields;-><init>()V + + const v0, 120T + + iput-byte v0, v2, LzzzInstanceFields;->field99999Byte:B + + iget-byte v1, v2, LzzzInstanceFields;->field99999Byte:B + + invoke-static/range {v0 .. v1}, LAssert;->assertEquals(II)V + return-void +.end method + +.method public test-iput-char-iget-char-jumbo()V + .registers 3 + .annotation runtime Lorg/junit/Test; + .end annotation + + new-instance v2, LzzzInstanceFields; + invoke-direct/range {v2}, LzzzInstanceFields;-><init>()V + + const v0, 'a' + + iput-char v0, v2, LzzzInstanceFields;->field99999Char:C + + iget-char v1, v2, LzzzInstanceFields;->field99999Char:C + + invoke-static/range {v0 .. v1}, LAssert;->assertEquals(II)V + return-void +.end method + +.method public test-iput-short-iget-short-jumbo()V + .registers 3 + .annotation runtime Lorg/junit/Test; + .end annotation + + new-instance v2, LzzzInstanceFields; + invoke-direct/range {v2}, LzzzInstanceFields;-><init>()V + + const v0, 1234S + + iput-short v0, v2, LzzzInstanceFields;->field99999Short:S + + iget-short v1, v2, LzzzInstanceFields;->field99999Short:S + + invoke-static/range {v0 .. v1}, LAssert;->assertEquals(II)V + return-void +.end method
\ No newline at end of file diff --git a/smali-integration-tests/src/test/smali/jumbo-field-tests/TestSuite.smali b/smali-integration-tests/src/test/smali/jumbo-field-tests/TestSuite.smali index 001e18f6..61354a29 100644 --- a/smali-integration-tests/src/test/smali/jumbo-field-tests/TestSuite.smali +++ b/smali-integration-tests/src/test/smali/jumbo-field-tests/TestSuite.smali @@ -36,6 +36,8 @@ .annotation runtime Lorg/junit/runners/Suite$SuiteClasses; value = { LFormat41c;, - LFormat52c; + LFormat41c_autofix;, + LFormat52c;, + LFormat52c_autofix; } .end annotation
\ No newline at end of file diff --git a/smali-integration-tests/src/test/smali/jumbo-method-tests/Format5rc_autofix.smali b/smali-integration-tests/src/test/smali/jumbo-method-tests/Format5rc_autofix.smali new file mode 100644 index 00000000..2c2280aa --- /dev/null +++ b/smali-integration-tests/src/test/smali/jumbo-method-tests/Format5rc_autofix.smali @@ -0,0 +1,176 @@ +#Copyright 2011, Google Inc. +#All rights reserved. +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions are +#met: +# +# * Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +#copyright notice, this list of conditions and the following disclaimer +#in the documentation and/or other materials provided with the +#distribution. +# * Neither the name of Google Inc. nor the names of its +#contributors may be used to endorse or promote products derived from +#this software without specific prior written permission. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +#A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +#OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +#SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +#LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +#THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +.class public LFormat5rc_autofix; +.super LzzzRangeMethodsSuper_autofix; +.source "Format5rc_autofix.smali" + +.method public constructor <init>()V + .registers 1 + invoke-direct/range {p0}, LzzzRangeMethodsSuper_autofix;-><init>()V + return-void +.end method + +.method public superMethodTest(IIIIII)I + .registers 7 + + add-int v0, v1, v2 + add-int v0, v0, v3 + add-int v0, v0, v4 + add-int v0, v0, v5 + add-int v0, v0, v6 + + #add something extra, to make the test fail if this method is called instead of the super's method + const v1, 1 + add-int v0, v0, v1 + + return v0 +.end method + +.method private directMethodTest(IIIIII)I + .registers 7 + + add-int v0, v1, v2 + add-int v0, v0, v3 + add-int v0, v0, v4 + add-int v0, v0, v5 + add-int v0, v0, v6 + + return v0 +.end method + + +.method public test_invoke-virtual-range()V + .registers 7 + .annotation runtime Lorg/junit/Test; + .end annotation + + new-instance v0, LzzzRangeMethods_autofix; + invoke-direct/range {v0}, LzzzRangeMethods_autofix;-><init>()V + + const v1, 1 + const v2, 2 + const v3, 3 + const v4, 4 + const v5, 5 + const v6, 6 + + invoke-virtual/range {v0 .. v6}, LzzzRangeMethods_autofix;->virtualMethodTest(IIIIII)I + move-result v0 + + const v1, 21 + invoke-static {v0, v1}, LAssert;->assertEquals(II)V + return-void +.end method + +.method public test_invoke-super-range()V + .registers 7 + .annotation runtime Lorg/junit/Test; + .end annotation + + move-object v0, p0 + const v1, 1 + const v2, 2 + const v3, 3 + const v4, 4 + const v5, 5 + const v6, 6 + + invoke-super/range {v0 .. v6}, LFormat5rc_autofix;->superMethodTest(IIIIII)I + move-result v0 + + const v1, 21 + invoke-static {v0, v1}, LAssert;->assertEquals(II)V + return-void +.end method + +.method public test_invoke-direct-range()V + .registers 7 + .annotation runtime Lorg/junit/Test; + .end annotation + + move-object v0, p0 + const v1, 1 + const v2, 2 + const v3, 3 + const v4, 4 + const v5, 5 + const v6, 6 + + invoke-direct/range {v0 .. v6}, LFormat5rc_autofix;->directMethodTest(IIIIII)I + move-result v0 + + const v1, 21 + invoke-static {v0, v1}, LAssert;->assertEquals(II)V + return-void +.end method + +.method public test_invoke-static-range()V + .registers 7 + .annotation runtime Lorg/junit/Test; + .end annotation + + const v1, 1 + const v2, 2 + const v3, 3 + const v4, 4 + const v5, 5 + const v6, 6 + + invoke-static/range {v1 .. v6}, LzzzRangeMethods_autofix;->staticMethodTest(IIIIII)I + move-result v0 + + const v1, 21 + invoke-static {v0, v1}, LAssert;->assertEquals(II)V + return-void +.end method + +.method public test_invoke-interface-range()V + .registers 7 + .annotation runtime Lorg/junit/Test; + .end annotation + + move-object v0, p0 + const v1, 1 + const v2, 2 + const v3, 3 + const v4, 4 + const v5, 5 + const v6, 6 + + new-instance v0, LzzzRangeMethods_autofix; + invoke-direct/range {v0}, LzzzRangeMethods_autofix;-><init>()V + + invoke-interface/range {v0 .. v6}, LzzzRangeMethodsInterface_autofix;->interfaceMethodTest(IIIIII)I + move-result v0 + + const v1, 21 + invoke-static {v0, v1}, LAssert;->assertEquals(II)V + return-void +.end method diff --git a/smali-integration-tests/src/test/smali/jumbo-method-tests/TestSuite.smali b/smali-integration-tests/src/test/smali/jumbo-method-tests/TestSuite.smali index aeb9bc31..6e376748 100644 --- a/smali-integration-tests/src/test/smali/jumbo-method-tests/TestSuite.smali +++ b/smali-integration-tests/src/test/smali/jumbo-method-tests/TestSuite.smali @@ -35,5 +35,6 @@ .end annotation .annotation runtime Lorg/junit/runners/Suite$SuiteClasses; - value = { LFormat5rc; } + value = { LFormat5rc;, + LFormat5rc_autofix;} .end annotation
\ No newline at end of file diff --git a/smali-integration-tests/src/test/smali/jumbo-method-tests/zzzRangeMethodsInterface_autofix.smali b/smali-integration-tests/src/test/smali/jumbo-method-tests/zzzRangeMethodsInterface_autofix.smali new file mode 100644 index 00000000..f072b33d --- /dev/null +++ b/smali-integration-tests/src/test/smali/jumbo-method-tests/zzzRangeMethodsInterface_autofix.smali @@ -0,0 +1,34 @@ +#Copyright 2011, Google Inc. +#All rights reserved. +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions are +#met: +# +# * Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +#copyright notice, this list of conditions and the following disclaimer +#in the documentation and/or other materials provided with the +#distribution. +# * Neither the name of Google Inc. nor the names of its +#contributors may be used to endorse or promote products derived from +#this software without specific prior written permission. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +#A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +#OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +#SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +#LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +#THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +.class public abstract interface LzzzRangeMethodsInterface_autofix; +.super Ljava/lang/Object; + +.method public abstract interfaceMethodTest(IIIIII)I +.end method
\ No newline at end of file diff --git a/smali-integration-tests/src/test/smali/jumbo-method-tests/zzzRangeMethodsSuper_autofix.smali b/smali-integration-tests/src/test/smali/jumbo-method-tests/zzzRangeMethodsSuper_autofix.smali new file mode 100644 index 00000000..c820464c --- /dev/null +++ b/smali-integration-tests/src/test/smali/jumbo-method-tests/zzzRangeMethodsSuper_autofix.smali @@ -0,0 +1,65 @@ +#Copyright 2011, Google Inc. +#All rights reserved. +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions are +#met: +# +# * Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +#copyright notice, this list of conditions and the following disclaimer +#in the documentation and/or other materials provided with the +#distribution. +# * Neither the name of Google Inc. nor the names of its +#contributors may be used to endorse or promote products derived from +#this software without specific prior written permission. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +#A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +#OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +#SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +#LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +#THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +.class public LzzzRangeMethodsSuper_autofix; +.super Ljava/lang/Object; + +.method public constructor <init>()V + .registers 1 + invoke-direct/range {p0}, Ljava/lang/Object;-><init>()V + return-void +.end method + +.method public superMethodTest(IIIIII)I + .registers 7 + + add-int v0, v1, v2 + add-int v0, v0, v3 + add-int v0, v0, v4 + add-int v0, v0, v5 + add-int v0, v0, v6 + + return v0 +.end method + +.method public virtualMethodTest(IIIIII)I + .registers 7 + + add-int v0, v1, v2 + add-int v0, v0, v3 + add-int v0, v0, v4 + add-int v0, v0, v5 + add-int v0, v0, v6 + + #add something extra, to make the test fail if this method is called instead of the subclasses's method + const v1, 1 + add-int v0, v0, v1 + + return v0 +.end method
\ No newline at end of file diff --git a/smali-integration-tests/src/test/smali/jumbo-method-tests/zzzRangeMethods_autofix.smali b/smali-integration-tests/src/test/smali/jumbo-method-tests/zzzRangeMethods_autofix.smali new file mode 100644 index 00000000..7ee469ab --- /dev/null +++ b/smali-integration-tests/src/test/smali/jumbo-method-tests/zzzRangeMethods_autofix.smali @@ -0,0 +1,74 @@ +#Copyright 2011, Google Inc. +#All rights reserved. +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions are +#met: +# +# * Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +#copyright notice, this list of conditions and the following disclaimer +#in the documentation and/or other materials provided with the +#distribution. +# * Neither the name of Google Inc. nor the names of its +#contributors may be used to endorse or promote products derived from +#this software without specific prior written permission. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +#A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +#OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +#SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +#LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +#THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +.class public LzzzRangeMethods_autofix; +.super LzzzRangeMethodsSuper_autofix; +.implements LzzzRangeMethodsInterface_autofix; + +.method public constructor <init>()V + .registers 1 + invoke-direct/range {p0}, LzzzRangeMethodsSuper_autofix;-><init>()V + return-void +.end method + +.method public virtualMethodTest(IIIIII)I + .registers 7 + + add-int v0, v1, v2 + add-int v0, v0, v3 + add-int v0, v0, v4 + add-int v0, v0, v5 + add-int v0, v0, v6 + + return v0 +.end method + +.method public static staticMethodTest(IIIIII)I + .registers 7 + + add-int v0, v1, v2 + add-int v0, v0, v3 + add-int v0, v0, v4 + add-int v0, v0, v5 + add-int v0, v0, v6 + + return v0 +.end method + +.method public interfaceMethodTest(IIIIII)I + .registers 7 + + add-int v0, v1, v2 + add-int v0, v0, v3 + add-int v0, v0, v4 + add-int v0, v0, v5 + add-int v0, v0, v6 + + return v0 +.end method
\ No newline at end of file diff --git a/smali-integration-tests/src/test/smali/jumbo-type-tests/Format41c_autofix.smali b/smali-integration-tests/src/test/smali/jumbo-type-tests/Format41c_autofix.smali new file mode 100644 index 00000000..59c45e33 --- /dev/null +++ b/smali-integration-tests/src/test/smali/jumbo-type-tests/Format41c_autofix.smali @@ -0,0 +1,115 @@ +#Copyright 2011, Google Inc. +#All rights reserved. +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions are +#met: +# +# * Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +#copyright notice, this list of conditions and the following disclaimer +#in the documentation and/or other materials provided with the +#distribution. +# * Neither the name of Google Inc. nor the names of its +#contributors may be used to endorse or promote products derived from +#this software without specific prior written permission. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +#A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +#OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +#SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +#LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +#THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +.class public LFormat41c_autofix; +.super Ljava/lang/Object; +.source "Format41c_autofix.smali" + +.method public constructor <init>()V + .registers 1 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V + return-void +.end method + +.method public test_const-class-jumbo()V + .registers 9 + .annotation runtime Lorg/junit/Test; + .end annotation + + const-class v0, Lzzz99999; + invoke-virtual {v0}, Ljava/lang/Class;->getName()Ljava/lang/String; + move-result-object v0 + + #check for the initial 3 z's + const v1, 3 + const v2, 0 + const-wide v3, 'z' + + :loop + invoke-virtual {v0, v2}, Ljava/lang/String;->charAt(I)C + move-result v5 + + int-to-long v6, v5 + + invoke-static {v3, v4, v6, v7}, Lorg/junit/Assert;->assertEquals(JJ)V + + add-int/lit8 v2, v2, 1 + if-ne v1, v2, :loop + + #and now for the final 9's + invoke-virtual {v0}, Ljava/lang/String;->length()I + move-result v1 + const-wide v3, '9' + + :loop2 + invoke-virtual {v0, v2}, Ljava/lang/String;->charAt(I)C + move-result v5 + + int-to-long v6, v5 + + invoke-static {v3, v4, v6, v7}, Lorg/junit/Assert;->assertEquals(JJ)V + + add-int/lit8 v2, v2, 1 + if-ne v1, v2, :loop2 + + return-void +.end method + +.method public test_new-instance-jumbo-index()V + .registers 3 + .annotation runtime Lorg/junit/Test; + .end annotation + + new-instance v1, Lzzz99999; + + #there's no way to initialize the new object, due to type index constraints on a method_id_item + #so just attempt to create the new object and call it good + + return-void +.end method + +.method public test_check-cast-jumbo-fail()V + .registers 2 + .annotation runtime Lorg/junit/Test; + .end annotation + + :tryStart + const-string v0, "test" + + check-cast v0, Lzzz99999; + :tryEnd + .catch Ljava/lang/ClassCastException; {:tryStart .. :tryEnd} :handler + + #the check-cast didn't throw an exception as expected + invoke-static {}, Lorg/junit/Assert;->fail()V + + :handler + + return-void +.end method diff --git a/smali-integration-tests/src/test/smali/jumbo-type-tests/Format52c_autofix.smali b/smali-integration-tests/src/test/smali/jumbo-type-tests/Format52c_autofix.smali new file mode 100644 index 00000000..9cc6d2bc --- /dev/null +++ b/smali-integration-tests/src/test/smali/jumbo-type-tests/Format52c_autofix.smali @@ -0,0 +1,89 @@ +#Copyright 2011, Google Inc. +#All rights reserved. +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions are +#met: +# +# * Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +#copyright notice, this list of conditions and the following disclaimer +#in the documentation and/or other materials provided with the +#distribution. +# * Neither the name of Google Inc. nor the names of its +#contributors may be used to endorse or promote products derived from +#this software without specific prior written permission. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +#A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +#OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +#SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +#LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +#THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE + +.class public LFormat52c_autofix; +.super Ljava/lang/Object; +.source "Format52c_autofix.smali" + +.method public constructor <init>()V + .registers 1 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V + return-void +.end method + +.method public test-instance-of-jumbo-success()V + .registers 2 + .annotation runtime Lorg/junit/Test; + .end annotation + + const-string v0, "test" + + new-instance v1, LStringWrapper; + invoke-direct {v1, v0}, LStringWrapper;-><init>(Ljava/lang/String;)V + + instance-of v0, v1, Ljava/lang/Object; + + const v1, 1 + + invoke-static/range {v0 .. v1}, LAssert;->assertEquals(II)V + return-void +.end method + +.method public test-instance-of-jumbo-failure()V + .registers 2 + .annotation runtime Lorg/junit/Test; + .end annotation + + const-string v0, "test" + + new-instance v1, LStringWrapper; + invoke-direct {v1, v0}, LStringWrapper;-><init>(Ljava/lang/String;)V + + instance-of v0, v1, Lzzz99999; + + const v1, 0 + + invoke-static/range {v0 .. v1}, LAssert;->assertEquals(II)V + return-void +.end method + +.method public test-new-array-jumbo()V + .registers 3 + .annotation runtime Lorg/junit/Test; + .end annotation + + const v0, 1 + + new-array v1, v0, [Lzzz99999; + + array-length v2, v1 + + invoke-static {v0, v2}, LAssert;->assertEquals(II)V + return-void +.end method
\ No newline at end of file diff --git a/smali-integration-tests/src/test/smali/jumbo-type-tests/Format5rc_autofix.smali b/smali-integration-tests/src/test/smali/jumbo-type-tests/Format5rc_autofix.smali new file mode 100644 index 00000000..e674a9bf --- /dev/null +++ b/smali-integration-tests/src/test/smali/jumbo-type-tests/Format5rc_autofix.smali @@ -0,0 +1,86 @@ +#Copyright 2011, Google Inc. +#All rights reserved. +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions are +#met: +# +# * Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +#copyright notice, this list of conditions and the following disclaimer +#in the documentation and/or other materials provided with the +#distribution. +# * Neither the name of Google Inc. nor the names of its +#contributors may be used to endorse or promote products derived from +#this software without specific prior written permission. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +#A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +#OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +#SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +#LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +#THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +.class public LFormat5rc_autofix; +.super Ljava/lang/Object; +.source "Format5rc_autofix.smali" + +.method public constructor <init>()V + .registers 1 + invoke-direct/range {p0}, Ljava/lang/Object;-><init>()V + return-void +.end method + +.method public test_filled-new-array-range()V + .registers 6 + .annotation runtime Lorg/junit/Test; + .end annotation + + const v0, 1 + const v1, 2 + const v2, 3 + const v3, 4 + const v4, 5 + const v5, 6 + + filled-new-array/range {v0 .. v5}, [I + move-result-object v0 + + const v1, 0 + aget v2, v0, v1 + const v1, 1 + invoke-static {v1, v2}, LAssert;->assertEquals(II)V + + const v1, 1 + aget v2, v0, v1 + const v1, 2 + invoke-static {v1, v2}, LAssert;->assertEquals(II)V + + const v1, 2 + aget v2, v0, v1 + const v1, 3 + invoke-static {v1, v2}, LAssert;->assertEquals(II)V + + const v1, 3 + aget v2, v0, v1 + const v1, 4 + invoke-static {v1, v2}, LAssert;->assertEquals(II)V + + const v1, 4 + aget v2, v0, v1 + const v1, 5 + invoke-static {v1, v2}, LAssert;->assertEquals(II)V + + const v1, 5 + aget v2, v0, v1 + const v1, 6 + invoke-static {v1, v2}, LAssert;->assertEquals(II)V + + return-void +.end method
\ No newline at end of file diff --git a/smali-integration-tests/src/test/smali/jumbo-type-tests/TestSuite.smali b/smali-integration-tests/src/test/smali/jumbo-type-tests/TestSuite.smali index 647d6267..6cdca29e 100644 --- a/smali-integration-tests/src/test/smali/jumbo-type-tests/TestSuite.smali +++ b/smali-integration-tests/src/test/smali/jumbo-type-tests/TestSuite.smali @@ -36,7 +36,10 @@ .annotation runtime Lorg/junit/runners/Suite$SuiteClasses; value = { LFormat41c;, + LFormat41c_autofix;, LFormat52c;, - LFormat5rc; + LFormat52c_autofix;, + LFormat5rc;, + LFormat5rc_autofix; } .end annotation
\ No newline at end of file |