compiler_driver_test.cc revision 7540ff4b6ad0ff5d8c5f60658b66155caf3a7cbc
1c143c55718342519db5398e41dda31422cf16c79buzbee// Copyright 2011 Google Inc. All Rights Reserved.
2c143c55718342519db5398e41dda31422cf16c79buzbee
390a3369d3b6238f1a4c9b19ca68978dab1c39bc4Elliott Hughes#include "compiler.h"
490a3369d3b6238f1a4c9b19ca68978dab1c39bc4Elliott Hughes
590a3369d3b6238f1a4c9b19ca68978dab1c39bc4Elliott Hughes#include <stdint.h>
690a3369d3b6238f1a4c9b19ca68978dab1c39bc4Elliott Hughes#include <stdio.h>
790a3369d3b6238f1a4c9b19ca68978dab1c39bc4Elliott Hughes
890a3369d3b6238f1a4c9b19ca68978dab1c39bc4Elliott Hughes#include "UniquePtr.h"
9c143c55718342519db5398e41dda31422cf16c79buzbee#include "class_linker.h"
10c143c55718342519db5398e41dda31422cf16c79buzbee#include "common_test.h"
119ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom#include "dex_cache.h"
12c143c55718342519db5398e41dda31422cf16c79buzbee#include "dex_file.h"
13c143c55718342519db5398e41dda31422cf16c79buzbee#include "heap.h"
14c143c55718342519db5398e41dda31422cf16c79buzbee#include "object.h"
15c143c55718342519db5398e41dda31422cf16c79buzbee
16c143c55718342519db5398e41dda31422cf16c79buzbeenamespace art {
17c143c55718342519db5398e41dda31422cf16c79buzbee
18c143c55718342519db5398e41dda31422cf16c79buzbeeclass CompilerTest : public CommonTest {
19bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom protected:
208a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom
218a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  void AssertStaticIntMethod(const ClassLoader* class_loader,
228a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom                             const char* klass, const char* method, const char* signature,
23bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom                             jint expected, ...) {
248a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom    CompileDirectMethod(class_loader, klass, method, signature);
25d3a729707671111ddd6a1aebbf8f986ce477642eElliott Hughes#if defined(__arm__)
26bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom    JNIEnv* env = Thread::Current()->GetJniEnv();
27bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom    jclass c = env->FindClass(klass);
288a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom    CHECK(c != NULL) << "Class not found " << klass;
29bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom    jmethodID m = env->GetStaticMethodID(c, method, signature);
300f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes    CHECK(m != NULL) << "Method not found: " << klass << "." << method << signature;
31bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom    va_list args;
32bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom    va_start(args, expected);
33bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom    jint result = env->CallStaticIntMethodV(c, m, args);
34bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom    va_end(args);
35bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom    LOG(INFO) << klass << "." << method << "(...) result is " << result;
36bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom    EXPECT_EQ(expected, result);
37bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom#endif // __arm__
38bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom  }
398a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  void AssertStaticLongMethod(const ClassLoader* class_loader,
408a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom                              const char* klass, const char* method, const char* signature,
418a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom                              jlong expected, ...) {
428a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom    CompileDirectMethod(class_loader, klass, method, signature);
43d3a729707671111ddd6a1aebbf8f986ce477642eElliott Hughes#if defined(__arm__)
44bafc342a37e423a19ac05f14800006ea9d67a941buzbee    JNIEnv* env = Thread::Current()->GetJniEnv();
45bafc342a37e423a19ac05f14800006ea9d67a941buzbee    jclass c = env->FindClass(klass);
468a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom    CHECK(c != NULL) << "Class not found " << klass;
47bafc342a37e423a19ac05f14800006ea9d67a941buzbee    jmethodID m = env->GetStaticMethodID(c, method, signature);
480f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes    CHECK(m != NULL) << "Method not found: " << klass << "." << method << signature;
49bafc342a37e423a19ac05f14800006ea9d67a941buzbee    va_list args;
50bafc342a37e423a19ac05f14800006ea9d67a941buzbee    va_start(args, expected);
51c5ef046ba4a484b08d0286393574396669a57c03buzbee    jlong result = env->CallStaticLongMethodV(c, m, args);
52bafc342a37e423a19ac05f14800006ea9d67a941buzbee    va_end(args);
53bafc342a37e423a19ac05f14800006ea9d67a941buzbee    LOG(INFO) << klass << "." << method << "(...) result is " << result;
54bafc342a37e423a19ac05f14800006ea9d67a941buzbee    EXPECT_EQ(expected, result);
55bafc342a37e423a19ac05f14800006ea9d67a941buzbee#endif // __arm__
56bafc342a37e423a19ac05f14800006ea9d67a941buzbee  }
57c143c55718342519db5398e41dda31422cf16c79buzbee};
58c143c55718342519db5398e41dda31422cf16c79buzbee
597540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom// Disabled due to 10 second runtime on host
608a48741b96ca9cc5835cac72ac133c4ca480930fBrian CarlstromTEST_F(CompilerTest, DISABLED_CompileDexLibCore) {
619ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom  Compiler compiler;
628a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  compiler.CompileAll(NULL);
639ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom
649ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom  // All libcore references should resolve
659ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom  const DexFile* dex = java_lang_dex_file_.get();
669ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom  DexCache* dex_cache = class_linker_->FindDexCache(*dex);
679ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom  EXPECT_EQ(dex->NumStringIds(), dex_cache->NumStrings());
689ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom  for (size_t i = 0; i < dex_cache->NumStrings(); i++) {
69cf4c6c41b0084dc4567ff709fb8ce9ebd72b26acElliott Hughes    const String* string = dex_cache->GetResolvedString(i);
707540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom    EXPECT_TRUE(string != NULL) << "string_idx=" << i;
719ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom  }
721caa2c205e51dda670207828f25451fb7623cea6Brian Carlstrom  EXPECT_EQ(dex->NumTypeIds(), dex_cache->NumResolvedTypes());
731caa2c205e51dda670207828f25451fb7623cea6Brian Carlstrom  for (size_t i = 0; i < dex_cache->NumResolvedTypes(); i++) {
749ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom    Class* type = dex_cache->GetResolvedType(i);
757540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom    EXPECT_TRUE(type != NULL) << "type_idx=" << i
767540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom                              << " " << dex->GetTypeDescriptor(dex->GetTypeId(i));
779ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom  }
781caa2c205e51dda670207828f25451fb7623cea6Brian Carlstrom  EXPECT_EQ(dex->NumMethodIds(), dex_cache->NumResolvedMethods());
791caa2c205e51dda670207828f25451fb7623cea6Brian Carlstrom  for (size_t i = 0; i < dex_cache->NumResolvedMethods(); i++) {
8020cfffabdc9e02b2df798bc4e6b6035d14bf4e36Brian Carlstrom    Method* method = dex_cache->GetResolvedMethod(i);
817540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom    EXPECT_TRUE(method != NULL) << "method_idx=" << i
827540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom                                << " " << dex->GetMethodClassDescriptor(dex->GetMethodId(i))
837540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom                                << " " << dex->GetMethodName(dex->GetMethodId(i));
849ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom  }
851caa2c205e51dda670207828f25451fb7623cea6Brian Carlstrom  EXPECT_EQ(dex->NumFieldIds(), dex_cache->NumResolvedFields());
861caa2c205e51dda670207828f25451fb7623cea6Brian Carlstrom  for (size_t i = 0; i < dex_cache->NumResolvedFields(); i++) {
8720cfffabdc9e02b2df798bc4e6b6035d14bf4e36Brian Carlstrom    Field* field = dex_cache->GetResolvedField(i);
887540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom    EXPECT_TRUE(field != NULL) << "field_idx=" << i
897540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom                               << " " << dex->GetFieldClassDescriptor(dex->GetFieldId(i))
907540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom                               << " " << dex->GetFieldName(dex->GetFieldId(i));
919ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom  }
929ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom
9383db7721aef15df6919c0ec072e087bef6041e2dBrian Carlstrom  // TODO check Class::IsVerified for all classes
9483db7721aef15df6919c0ec072e087bef6041e2dBrian Carlstrom
9583db7721aef15df6919c0ec072e087bef6041e2dBrian Carlstrom  // TODO: check that all Method::GetCode() values are non-null
9683db7721aef15df6919c0ec072e087bef6041e2dBrian Carlstrom
979cc262e2ad5cb507c21cc83b8dc954e9354a469cBrian Carlstrom  EXPECT_EQ(dex->NumMethodIds(), dex_cache->NumCodeAndDirectMethods());
989cc262e2ad5cb507c21cc83b8dc954e9354a469cBrian Carlstrom  CodeAndDirectMethods* code_and_direct_methods = dex_cache->GetCodeAndDirectMethods();
999cc262e2ad5cb507c21cc83b8dc954e9354a469cBrian Carlstrom  for (size_t i = 0; i < dex_cache->NumCodeAndDirectMethods(); i++) {
10083db7721aef15df6919c0ec072e087bef6041e2dBrian Carlstrom    Method* method = dex_cache->GetResolvedMethod(i);
1017540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom    if (method->IsDirect()) {
1027540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom      EXPECT_EQ(method->GetCode(), code_and_direct_methods->GetResolvedCode(i));
1037540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom      EXPECT_EQ(method,            code_and_direct_methods->GetResolvedMethod(i));
1047540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom    } else {
1057540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom      EXPECT_EQ(0U, code_and_direct_methods->GetResolvedCode(i));
1067540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom      EXPECT_TRUE(code_and_direct_methods->GetResolvedMethod(i) == NULL);
1077540ff4b6ad0ff5d8c5f60658b66155caf3a7cbcBrian Carlstrom    }
10883db7721aef15df6919c0ec072e087bef6041e2dBrian Carlstrom  }
1099ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom}
1109ea1cb1a22be5b85dc2622e3836c46a1c48e3f25Brian Carlstrom
111c143c55718342519db5398e41dda31422cf16c79buzbeeTEST_F(CompilerTest, BasicCodegen) {
1128a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("Fibonacci"), "Fibonacci", "fibonacci", "(I)I", 55,
113bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom                        10);
114c143c55718342519db5398e41dda31422cf16c79buzbee}
1153ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee
1162a475e7b93d754e0a7525bb5c7059386307ea63abuzbee// TODO: need stub for InstanceofNonTrivialFromCode
1172a475e7b93d754e0a7525bb5c7059386307ea63abuzbeeTEST_F(CompilerTest, InstanceTest) {
1182a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileDirectMethod(NULL, "java.lang.Object", "<init>", "()V");
1192a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  const ClassLoader* class_loader = LoadDex("IntMath");
1202a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileDirectMethod(class_loader, "IntMath", "<init>", "()V");
1212a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileDirectMethod(class_loader, "IntMathBase", "<init>", "()V");
1222a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  AssertStaticIntMethod(class_loader, "IntMath", "instanceTest", "(I)I", 1352, 10);
1232a475e7b93d754e0a7525bb5c7059386307ea63abuzbee}
1242a475e7b93d754e0a7525bb5c7059386307ea63abuzbee
1252a475e7b93d754e0a7525bb5c7059386307ea63abuzbee// TODO: need check-cast test (when stub complete & we can throw/catch
1262a475e7b93d754e0a7525bb5c7059386307ea63abuzbee
1274a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee// TODO: Need invoke-interface test
1284a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee
1294a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbeeTEST_F(CompilerTest, SuperTest) {
1304a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee  CompileDirectMethod(NULL, "java.lang.Object", "<init>", "()V");
1314a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee  const ClassLoader* class_loader = LoadDex("IntMath");
1324a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee  CompileDirectMethod(class_loader, "IntMathBase", "<init>", "()V");
1334a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee  CompileVirtualMethod(class_loader, "IntMathBase", "tryThing", "()I");
1344a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee  CompileDirectMethod(class_loader, "IntMath", "<init>", "()V");
1354a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee  CompileVirtualMethod(class_loader, "IntMath", "tryThing", "()I");
1364a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee  AssertStaticIntMethod(class_loader, "IntMath", "superTest", "(I)I", 4175,
1374a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee                        4141);
1384a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee}
1394a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee
1401b4c85959b3d9a4a33bc2160c46c1bbde67350c7buzbeeTEST_F(CompilerTest, ConstStringTest) {
1412a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileDirectMethod(NULL, "java.lang.String", "<clinit>", "()V");
1422a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileDirectMethod(NULL, "java.lang.String", "<init>", "(II[C)V");
1432a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileDirectMethod(NULL, "java.lang.String", "<init>", "([CII)V");
1442a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileVirtualMethod(NULL, "java.lang.String", "_getChars", "(II[CI)V");
1452a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileVirtualMethod(NULL, "java.lang.String", "charAt", "(I)C");
1462a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileVirtualMethod(NULL, "java.lang.String", "length", "()I");
1471b4c85959b3d9a4a33bc2160c46c1bbde67350c7buzbee  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "constStringTest",
1482a475e7b93d754e0a7525bb5c7059386307ea63abuzbee                                "(I)I", 1246, 1234);
1491b4c85959b3d9a4a33bc2160c46c1bbde67350c7buzbee}
1501b4c85959b3d9a4a33bc2160c46c1bbde67350c7buzbee
151561227c80077bbb4147f778043f1a836af6b9248buzbeeTEST_F(CompilerTest, ConstClassTest) {
152561227c80077bbb4147f778043f1a836af6b9248buzbee  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "constClassTest",
153561227c80077bbb4147f778043f1a836af6b9248buzbee                                "(I)I", 2222, 1111);
154561227c80077bbb4147f778043f1a836af6b9248buzbee}
155561227c80077bbb4147f778043f1a836af6b9248buzbee
1562a475e7b93d754e0a7525bb5c7059386307ea63abuzbee// TODO: Need native nativeFillInStackTrace()
1571b4c85959b3d9a4a33bc2160c46c1bbde67350c7buzbeeTEST_F(CompilerTest, DISABLED_CatchTest) {
1581b4c85959b3d9a4a33bc2160c46c1bbde67350c7buzbee  CompileDirectMethod(NULL, "java.lang.Object", "<init>", "()V");
1591b4c85959b3d9a4a33bc2160c46c1bbde67350c7buzbee  CompileDirectMethod(NULL, "java.lang.NullPointerException", "<init>", "()V");
1602a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileDirectMethod(NULL, "java.lang.RuntimeException", "<init>", "()V");
1612a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileDirectMethod(NULL, "java.lang.Exception", "<init>", "()V");
1622a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileDirectMethod(NULL, "java.lang.Throwable","<init>", "()V");
1632a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileDirectMethod(NULL, "java.util.ArrayList","<init>","()V");
1642a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileDirectMethod(NULL, "java.util.AbstractList","<init>","()V");
1652a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileDirectMethod(NULL, "java.util.AbstractCollection","<init>","()V");
1662a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileVirtualMethod(NULL, "java.lang.Throwable","fillInStackTrace","()Ljava/lang/Throwable;");
1672a475e7b93d754e0a7525bb5c7059386307ea63abuzbee  CompileDirectMethod(NULL, "java.lang.Throwable","nativeFillInStackTrace","()Ljava/lang/Object;");
1681b4c85959b3d9a4a33bc2160c46c1bbde67350c7buzbee  const ClassLoader* class_loader = LoadDex("IntMath");
1691b4c85959b3d9a4a33bc2160c46c1bbde67350c7buzbee  CompileDirectMethod(class_loader, "IntMath", "throwNullPointerException", "()V");
1701b4c85959b3d9a4a33bc2160c46c1bbde67350c7buzbee  AssertStaticIntMethod(class_loader, "IntMath", "catchBlock", "(I)I", 1579,
1711b4c85959b3d9a4a33bc2160c46c1bbde67350c7buzbee                        1000);
1721b4c85959b3d9a4a33bc2160c46c1bbde67350c7buzbee}
1731b4c85959b3d9a4a33bc2160c46c1bbde67350c7buzbee
174e9a72f6a1a84f4d9af0b07dd289b89e45ffb32d5buzbeeTEST_F(CompilerTest, CatchTestNoThrow) {
175e9a72f6a1a84f4d9af0b07dd289b89e45ffb32d5buzbee  CompileDirectMethod(NULL, "java.lang.Object", "<init>", "()V");
176e9a72f6a1a84f4d9af0b07dd289b89e45ffb32d5buzbee  const ClassLoader* class_loader = LoadDex("IntMath");
177e9a72f6a1a84f4d9af0b07dd289b89e45ffb32d5buzbee  AssertStaticIntMethod(class_loader, "IntMath", "catchBlockNoThrow", "(I)I",
178e9a72f6a1a84f4d9af0b07dd289b89e45ffb32d5buzbee                        1123, 1000);
179e9a72f6a1a84f4d9af0b07dd289b89e45ffb32d5buzbee}
180e9a72f6a1a84f4d9af0b07dd289b89e45ffb32d5buzbee
181e1931749814dbb80c5a756f9842e9c261bb2e8f6buzbeeTEST_F(CompilerTest, StaticFieldTest) {
1828a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "staticFieldTest", "(I)I", 1404,
183e1931749814dbb80c5a756f9842e9c261bb2e8f6buzbee                        404);
184e1931749814dbb80c5a756f9842e9c261bb2e8f6buzbee}
185e1931749814dbb80c5a756f9842e9c261bb2e8f6buzbee
1863ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbeeTEST_F(CompilerTest, UnopTest) {
1878a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "unopTest", "(I)I", 37,
188bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom                        38);
1893ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee}
1903ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee
1913ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbeeTEST_F(CompilerTest, ShiftTest1) {
1928a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "shiftTest1", "()I", 0);
1933ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee}
1943ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee
1953ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbeeTEST_F(CompilerTest, ShiftTest2) {
1968a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "shiftTest2", "()I", 0);
1973ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee}
1983ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee
1993ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbeeTEST_F(CompilerTest, UnsignedShiftTest) {
2008a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "unsignedShiftTest", "()I", 0);
2013ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee}
2023ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee
2033ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbeeTEST_F(CompilerTest, ConvTest) {
2048a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "convTest", "()I", 0);
2053ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee}
2063ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee
2073ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbeeTEST_F(CompilerTest, CharSubTest) {
2088a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "charSubTest", "()I", 0);
2093ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee}
2103ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee
2113ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbeeTEST_F(CompilerTest, IntOperTest) {
2128a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "intOperTest", "(II)I", 0,
213bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom                        70000, -3);
2143ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee}
2153ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee
2163ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbeeTEST_F(CompilerTest, Lit16Test) {
2178a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "lit16Test", "(I)I", 0,
218bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom                        77777);
2193ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee}
2203ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee
2213ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbeeTEST_F(CompilerTest, Lit8Test) {
2228a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "lit8Test", "(I)I", 0,
223bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom                        -55555);
2243ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee}
2253ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee
2263ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbeeTEST_F(CompilerTest, IntShiftTest) {
2278a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "intShiftTest", "(II)I", 0,
228bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom                        0xff00aa01, 8);
2293ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee}
2303ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee
2313ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbeeTEST_F(CompilerTest, LongOperTest) {
2328a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "longOperTest", "(JJ)I", 0,
233439c4fa0db980fb19e4a585723a64a3461e4c278buzbee                        70000000000LL, -3LL);
2343ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee}
2353ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee
2363ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbeeTEST_F(CompilerTest, LongShiftTest) {
2378a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticLongMethod(LoadDex("IntMath"), "IntMath", "longShiftTest", "(JI)J",
2387b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbee                         0x96deff00aa010000LL, 0xd5aa96deff00aa01LL, 16);
2393ea4ec5629613013ad9b0d7a69abdb94491ac46fbuzbee}
240c143c55718342519db5398e41dda31422cf16c79buzbee
2419e0f9b0d3e2cd78092e5c4b66ce1edcd79c951eabuzbeeTEST_F(CompilerTest, SwitchTest1) {
2428a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "switchTest", "(I)I", 1234,
243bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom                        1);
2449e0f9b0d3e2cd78092e5c4b66ce1edcd79c951eabuzbee}
2459e0f9b0d3e2cd78092e5c4b66ce1edcd79c951eabuzbee
2469e0f9b0d3e2cd78092e5c4b66ce1edcd79c951eabuzbeeTEST_F(CompilerTest, IntCompare) {
2478a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "testIntCompare", "(IIII)I", 1111,
248bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom                        -5, 4, 4, 0);
2499e0f9b0d3e2cd78092e5c4b66ce1edcd79c951eabuzbee}
2509e0f9b0d3e2cd78092e5c4b66ce1edcd79c951eabuzbee
2519e0f9b0d3e2cd78092e5c4b66ce1edcd79c951eabuzbeeTEST_F(CompilerTest, LongCompare) {
2528a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "testLongCompare", "(JJJJ)I", 2222,
253bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom                        -5LL, -4294967287LL, 4LL, 8LL);
2549e0f9b0d3e2cd78092e5c4b66ce1edcd79c951eabuzbee}
2559e0f9b0d3e2cd78092e5c4b66ce1edcd79c951eabuzbee
2569e0f9b0d3e2cd78092e5c4b66ce1edcd79c951eabuzbeeTEST_F(CompilerTest, FloatCompare) {
2578a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "testFloatCompare", "(FFFF)I", 3333,
258bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom                        -5.0f, 4.0f, 4.0f,
259bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom                        (1.0f/0.0f) / (1.0f/0.0f));
2609e0f9b0d3e2cd78092e5c4b66ce1edcd79c951eabuzbee}
2619e0f9b0d3e2cd78092e5c4b66ce1edcd79c951eabuzbee
2629e0f9b0d3e2cd78092e5c4b66ce1edcd79c951eabuzbeeTEST_F(CompilerTest, DoubleCompare) {
2638a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "testDoubleCompare", "(DDDD)I", 4444,
264bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom                                    -5.0, 4.0, 4.0,
265bffb15585b8fd43d3ca534ddbb85e7f591595951Brian Carlstrom                                    (1.0/0.0) / (1.0/0.0));
2669e0f9b0d3e2cd78092e5c4b66ce1edcd79c951eabuzbee}
2679e0f9b0d3e2cd78092e5c4b66ce1edcd79c951eabuzbee
268c5ef046ba4a484b08d0286393574396669a57c03buzbeeTEST_F(CompilerTest, RecursiveFibonacci) {
2698a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "fibonacci", "(I)I", 55,
270c5ef046ba4a484b08d0286393574396669a57c03buzbee                        10);
271c5ef046ba4a484b08d0286393574396669a57c03buzbee}
272c5ef046ba4a484b08d0286393574396669a57c03buzbee
2737b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbee#if 0 // Need to complete try/catch block handling
2747b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbeeTEST_F(CompilerTest, ThrowAndCatch) {
2758a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "throwAndCatch", "()I", 4);
2767b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbee}
2777b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbee#endif
2787b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbee
2797b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbeeTEST_F(CompilerTest, ManyArgs) {
2808a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(LoadDex("IntMath"), "IntMath", "manyArgs",
2817b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbee                        "(IJIJIJIIDFDSICIIBZIIJJIIIII)I", -1,
2827b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbee                        0, 1LL, 2, 3LL, 4, 5LL, 6, 7, 8.0, 9.0f, 10.0,
2837b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbee                        (short)11, 12, (char)13, 14, 15, (int8_t)-16, true, 18,
2847b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbee                        19, 20LL, 21LL, 22, 23, 24, 25, 26);
2857b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbee}
2867b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbee
2877b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbeeTEST_F(CompilerTest, VirtualCall) {
2888a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  CompileDirectMethod(NULL, "java.lang.Object", "<init>", "()V");
2898a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  const ClassLoader* class_loader = LoadDex("IntMath");
2904a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee  CompileDirectMethod(class_loader, "IntMathBase", "<init>", "()V");
2918a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  CompileDirectMethod(class_loader, "IntMath", "<init>", "()V");
2928a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  CompileVirtualMethod(class_loader, "IntMath", "virtualCall", "(I)I");
2938a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(class_loader, "IntMath", "staticCall", "(I)I", 6,
2947b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbee                        3);
2957b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbee}
2967b1b86d68244b0bb4ea3f43505eb45fdd46814d6buzbee
297dd3efae34ee77935cbd275d09c0ad35e5b79daeebuzbeeTEST_F(CompilerTest, TestIGetPut) {
2988a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  CompileDirectMethod(NULL, "java.lang.Object", "<init>", "()V");
2998a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  const ClassLoader* class_loader = LoadDex("IntMath");
3004a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee  CompileDirectMethod(class_loader, "IntMathBase", "<init>", "()V");
3018a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  CompileDirectMethod(class_loader, "IntMath", "<init>", "(I)V");
3028a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  CompileDirectMethod(class_loader, "IntMath", "<init>", "()V");
3038a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  CompileVirtualMethod(class_loader, "IntMath", "getFoo", "()I");
3048a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  CompileVirtualMethod(class_loader, "IntMath", "setFoo", "(I)V");
3058a48741b96ca9cc5835cac72ac133c4ca480930fBrian Carlstrom  AssertStaticIntMethod(class_loader, "IntMath", "testIGetPut", "(I)I", 333,
306dd3efae34ee77935cbd275d09c0ad35e5b79daeebuzbee                        111);
307dd3efae34ee77935cbd275d09c0ad35e5b79daeebuzbee}
308dd3efae34ee77935cbd275d09c0ad35e5b79daeebuzbee
309109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbeeTEST_F(CompilerTest, InvokeTest) {
310109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  CompileDirectMethod(NULL, "java.lang.Object", "<init>", "()V");
311109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  const ClassLoader* class_loader = LoadDex("Invoke");
312109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  CompileDirectMethod(class_loader, "Invoke", "<init>", "()V");
313109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  CompileVirtualMethod(class_loader, "Invoke", "virI_I", "(I)I");
314109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  CompileVirtualMethod(class_loader, "Invoke", "virI_II", "(II)I");
315109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  CompileVirtualMethod(class_loader, "Invoke", "virI_III", "(III)I");
316109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  CompileVirtualMethod(class_loader, "Invoke", "virI_IIII", "(IIII)I");
317109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  CompileVirtualMethod(class_loader, "Invoke", "virI_IIIII", "(IIIII)I");
318109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  CompileVirtualMethod(class_loader, "Invoke", "virI_IIIIII", "(IIIIII)I");
319109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  CompileDirectMethod(class_loader, "Invoke", "statI_I", "(I)I");
320109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  CompileDirectMethod(class_loader, "Invoke", "statI_II", "(II)I");
321109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  CompileDirectMethod(class_loader, "Invoke", "statI_III", "(III)I");
322109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  CompileDirectMethod(class_loader, "Invoke", "statI_IIII", "(IIII)I");
323109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  CompileDirectMethod(class_loader, "Invoke", "statI_IIIII", "(IIIII)I");
324109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  CompileDirectMethod(class_loader, "Invoke", "statI_IIIIII", "(IIIIII)I");
325109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee  AssertStaticIntMethod(class_loader, "Invoke", "test0", "(I)I", 20664,
326109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee                        912);
327109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee}
328109bd6a38d0cd7c4b7797a9f2db8324c797d1368buzbee
3290f4c41d75c821162184501cd4b510a93f6eb580fElliott HughesTEST_F(CompilerTest, SystemMethodsTest) {
3300f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileDirectMethod(NULL, "java.lang.Object", "<init>", "()V");
3310f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes
3320f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileDirectMethod(NULL, "java.lang.String", "<clinit>", "()V");
3330f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileDirectMethod(NULL, "java.lang.String", "<init>", "(II[C)V");
3340f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileDirectMethod(NULL, "java.lang.String", "<init>", "([CII)V");
335f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileVirtualMethod(NULL, "java.lang.String", "_getChars", "(II[CI)V");
3360f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileVirtualMethod(NULL, "java.lang.String", "charAt", "(I)C");
3370f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileVirtualMethod(NULL, "java.lang.String", "length", "()I");
3380f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes
339f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.AbstractStringBuilder", "<init>", "()V");
3400f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileDirectMethod(NULL, "java.lang.AbstractStringBuilder", "<init>", "(I)V");
341f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.AbstractStringBuilder", "enlargeBuffer", "(I)V");
3420f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileVirtualMethod(NULL, "java.lang.AbstractStringBuilder", "append0", "(C)V");
343f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileVirtualMethod(NULL, "java.lang.AbstractStringBuilder", "append0", "(Ljava/lang/String;)V");
344f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileVirtualMethod(NULL, "java.lang.AbstractStringBuilder", "append0", "([CII)V");
3450f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileVirtualMethod(NULL, "java.lang.AbstractStringBuilder", "appendNull", "()V");
3460f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileVirtualMethod(NULL, "java.lang.AbstractStringBuilder", "toString", "()Ljava/lang/String;");
3470f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes
348f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.StringBuilder", "<init>", "()V");
3490f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileDirectMethod(NULL, "java.lang.StringBuilder", "<init>", "(I)V");
3500f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileVirtualMethod(NULL, "java.lang.StringBuilder", "append", "(C)Ljava/lang/StringBuilder;");
351f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileVirtualMethod(NULL, "java.lang.StringBuilder", "append", "(I)Ljava/lang/StringBuilder;");
352f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileVirtualMethod(NULL, "java.lang.StringBuilder", "append", "(J)Ljava/lang/StringBuilder;");
353f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileVirtualMethod(NULL, "java.lang.StringBuilder", "append", "(Ljava/lang/String;)Ljava/lang/StringBuilder;");
3540f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileVirtualMethod(NULL, "java.lang.StringBuilder", "toString", "()Ljava/lang/String;");
3550f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes
356f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.ThreadLocal", "<init>", "()V");
357f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileVirtualMethod(NULL, "java.lang.ThreadLocal", "get", "()Ljava/lang/Object;");
358f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes
359f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.Long", "toHexString", "(J)Ljava/lang/String;");
360f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.Long", "toString", "(J)Ljava/lang/String;");
3616a0f7f50223087006a2845b784b12923abbdd8f1buzbee  CompileDirectMethod(NULL, "java.lang.Long", "toString", "(JI)Ljava/lang/String;");
362f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes
363f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.IntegralToString", "<clinit>", "()V");
364f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.IntegralToString", "appendInt", "(Ljava/lang/AbstractStringBuilder;I)V");
365f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.IntegralToString", "appendLong", "(Ljava/lang/AbstractStringBuilder;J)V");
366f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.IntegralToString", "convertInt", "(Ljava/lang/AbstractStringBuilder;I)Ljava/lang/String;");
367f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.IntegralToString", "convertLong", "(Ljava/lang/AbstractStringBuilder;J)Ljava/lang/String;");
368f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.IntegralToString", "intIntoCharArray", "([CII)I");
369f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.IntegralToString", "intToHexString", "(IZI)Ljava/lang/String;");
370f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.IntegralToString", "longToHexString", "(J)Ljava/lang/String;");
371f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.IntegralToString", "longToString", "(J)Ljava/lang/String;");
3726a0f7f50223087006a2845b784b12923abbdd8f1buzbee  CompileDirectMethod(NULL, "java.lang.IntegralToString", "longToString", "(JI)Ljava/lang/String;");
373f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.IntegralToString", "stringOf", "([C)Ljava/lang/String;");
3740f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes
3750f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileDirectMethod(NULL, "java.lang.System", "arraycopy", "(Ljava/lang/Object;ILjava/lang/Object;II)V");
376f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.System", "currentTimeMillis", "()J");
3770f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileDirectMethod(NULL, "java.lang.System", "log", "(CLjava/lang/String;Ljava/lang/Throwable;)V");
3780f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  CompileDirectMethod(NULL, "java.lang.System", "logI", "(Ljava/lang/String;)V");
379f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.lang.System", "logI", "(Ljava/lang/String;Ljava/lang/Throwable;)V");
380f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes
381f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(NULL, "java.util.Arrays", "checkOffsetAndCount", "(III)V");
3820f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes
3830f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  const ClassLoader* class_loader = LoadDex("SystemMethods");
384f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes
385f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  CompileDirectMethod(class_loader, "SystemMethods", "<clinit>", "()V");
386f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes
3876a0f7f50223087006a2845b784b12923abbdd8f1buzbee  AssertStaticIntMethod(class_loader, "SystemMethods", "test0", "()I", 123);
3886a0f7f50223087006a2845b784b12923abbdd8f1buzbee  AssertStaticIntMethod(class_loader, "SystemMethods", "test1", "()I", 123);
3890f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes  AssertStaticIntMethod(class_loader, "SystemMethods", "test2", "()I", 123);
390f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  AssertStaticIntMethod(class_loader, "SystemMethods", "test3", "()I", 123);
391f5ecf06388960bc1424ed0a8652c78e345d82106Elliott Hughes  AssertStaticIntMethod(class_loader, "SystemMethods", "test4", "()I", 123);
3920f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes}
3930f4c41d75c821162184501cd4b510a93f6eb580fElliott Hughes
3944a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee
395c143c55718342519db5398e41dda31422cf16c79buzbee}  // namespace art
396