summaryrefslogtreecommitdiffstats
path: root/runtime/well_known_classes.h
blob: 66b9abece7946c27f1edb239fd43800620cbf583 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ART_RUNTIME_WELL_KNOWN_CLASSES_H_
#define ART_RUNTIME_WELL_KNOWN_CLASSES_H_

#include "base/mutex.h"
#include "jni.h"

namespace art {
namespace mirror {
class Class;
}  // namespace mirror

// Various classes used in JNI. We cache them so we don't have to keep looking
// them up. Similar to libcore's JniConstants (except there's no overlap, so
// we keep them separate).

jmethodID CacheMethod(JNIEnv* env, jclass c, bool is_static, const char* name, const char* signature);

struct WellKnownClasses {
 public:
  static void Init(JNIEnv* env);  // Run before native methods are registered.
  static void LateInit(JNIEnv* env);  // Run after native methods are registered.
  static jmethodID StringInitToStringFactoryMethodID(jmethodID string_init);

  static mirror::Class* ToClass(jclass global_jclass)
      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);

  static jclass com_android_dex_Dex;
  static jclass dalvik_system_DexFile;
  static jclass dalvik_system_DexPathList;
  static jclass dalvik_system_DexPathList__Element;
  static jclass dalvik_system_PathClassLoader;
  static jclass dalvik_system_VMRuntime;
  static jclass java_lang_BootClassLoader;
  static jclass java_lang_ClassLoader;
  static jclass java_lang_ClassNotFoundException;
  static jclass java_lang_Daemons;
  static jclass java_lang_Error;
  static jclass java_lang_Object;
  static jclass java_lang_OutOfMemoryError;
  static jclass java_lang_reflect_AbstractMethod;
  static jclass java_lang_reflect_Constructor;
  static jclass java_lang_reflect_Field;
  static jclass java_lang_reflect_Method;
  static jclass java_lang_reflect_Proxy;
  static jclass java_lang_RuntimeException;
  static jclass java_lang_StackOverflowError;
  static jclass java_lang_String;
  static jclass java_lang_StringFactory;
  static jclass java_lang_System;
  static jclass java_lang_Thread;
  static jclass java_lang_ThreadGroup;
  static jclass java_lang_Thread__UncaughtExceptionHandler;
  static jclass java_lang_Throwable;
  static jclass java_util_ArrayList;
  static jclass java_util_Collections;
  static jclass java_nio_DirectByteBuffer;
  static jclass libcore_util_EmptyArray;
  static jclass org_apache_harmony_dalvik_ddmc_Chunk;
  static jclass org_apache_harmony_dalvik_ddmc_DdmServer;

  static jmethodID com_android_dex_Dex_create;
  static jmethodID dalvik_system_VMRuntime_runFinalization;
  static jmethodID java_lang_Boolean_valueOf;
  static jmethodID java_lang_Byte_valueOf;
  static jmethodID java_lang_Character_valueOf;
  static jmethodID java_lang_ClassLoader_loadClass;
  static jmethodID java_lang_ClassNotFoundException_init;
  static jmethodID java_lang_Daemons_requestHeapTrim;
  static jmethodID java_lang_Daemons_start;
  static jmethodID java_lang_Daemons_stop;
  static jmethodID java_lang_Double_valueOf;
  static jmethodID java_lang_Float_valueOf;
  static jmethodID java_lang_Integer_valueOf;
  static jmethodID java_lang_Long_valueOf;
  static jmethodID java_lang_ref_FinalizerReference_add;
  static jmethodID java_lang_ref_ReferenceQueue_add;
  static jmethodID java_lang_reflect_Proxy_invoke;
  static jmethodID java_lang_Runtime_nativeLoad;
  static jmethodID java_lang_Short_valueOf;
  static jmethodID java_lang_String_init;
  static jmethodID java_lang_String_init_B;
  static jmethodID java_lang_String_init_BI;
  static jmethodID java_lang_String_init_BII;
  static jmethodID java_lang_String_init_BIII;
  static jmethodID java_lang_String_init_BIIString;
  static jmethodID java_lang_String_init_BString;
  static jmethodID java_lang_String_init_BIICharset;
  static jmethodID java_lang_String_init_BCharset;
  static jmethodID java_lang_String_init_C;
  static jmethodID java_lang_String_init_CII;
  static jmethodID java_lang_String_init_IIC;
  static jmethodID java_lang_String_init_String;
  static jmethodID java_lang_String_init_StringBuffer;
  static jmethodID java_lang_String_init_III;
  static jmethodID java_lang_String_init_StringBuilder;
  static jmethodID java_lang_StringFactory_newEmptyString;
  static jmethodID java_lang_StringFactory_newStringFromBytes_B;
  static jmethodID java_lang_StringFactory_newStringFromBytes_BI;
  static jmethodID java_lang_StringFactory_newStringFromBytes_BII;
  static jmethodID java_lang_StringFactory_newStringFromBytes_BIII;
  static jmethodID java_lang_StringFactory_newStringFromBytes_BIIString;
  static jmethodID java_lang_StringFactory_newStringFromBytes_BString;
  static jmethodID java_lang_StringFactory_newStringFromBytes_BIICharset;
  static jmethodID java_lang_StringFactory_newStringFromBytes_BCharset;
  static jmethodID java_lang_StringFactory_newStringFromChars_C;
  static jmethodID java_lang_StringFactory_newStringFromChars_CII;
  static jmethodID java_lang_StringFactory_newStringFromChars_IIC;
  static jmethodID java_lang_StringFactory_newStringFromString;
  static jmethodID java_lang_StringFactory_newStringFromStringBuffer;
  static jmethodID java_lang_StringFactory_newStringFromCodePoints;
  static jmethodID java_lang_StringFactory_newStringFromStringBuilder;
  static jmethodID java_lang_System_runFinalization;
  static jmethodID java_lang_Thread_init;
  static jmethodID java_lang_Thread_run;
  static jmethodID java_lang_Thread__UncaughtExceptionHandler_uncaughtException;
  static jmethodID java_lang_ThreadGroup_removeThread;
  static jmethodID java_nio_DirectByteBuffer_init;
  static jmethodID org_apache_harmony_dalvik_ddmc_DdmServer_broadcast;
  static jmethodID org_apache_harmony_dalvik_ddmc_DdmServer_dispatch;

  static jfieldID dalvik_system_DexFile_cookie;
  static jfieldID dalvik_system_DexPathList_dexElements;
  static jfieldID dalvik_system_DexPathList__Element_dexFile;
  static jfieldID dalvik_system_PathClassLoader_pathList;
  static jfieldID java_lang_reflect_AbstractMethod_artMethod;
  static jfieldID java_lang_reflect_Proxy_h;
  static jfieldID java_lang_Thread_daemon;
  static jfieldID java_lang_Thread_group;
  static jfieldID java_lang_Thread_lock;
  static jfieldID java_lang_Thread_name;
  static jfieldID java_lang_Thread_priority;
  static jfieldID java_lang_Thread_uncaughtHandler;
  static jfieldID java_lang_Thread_nativePeer;
  static jfieldID java_lang_ThreadGroup_groups;
  static jfieldID java_lang_ThreadGroup_mainThreadGroup;
  static jfieldID java_lang_ThreadGroup_name;
  static jfieldID java_lang_ThreadGroup_parent;
  static jfieldID java_lang_ThreadGroup_systemThreadGroup;
  static jfieldID java_lang_Throwable_cause;
  static jfieldID java_lang_Throwable_detailMessage;
  static jfieldID java_lang_Throwable_stackTrace;
  static jfieldID java_lang_Throwable_stackState;
  static jfieldID java_lang_Throwable_suppressedExceptions;
  static jfieldID java_nio_DirectByteBuffer_capacity;
  static jfieldID java_nio_DirectByteBuffer_effectiveDirectAddress;
  static jfieldID java_util_ArrayList_array;
  static jfieldID java_util_ArrayList_size;
  static jfieldID java_util_Collections_EMPTY_LIST;
  static jfieldID libcore_util_EmptyArray_STACK_TRACE_ELEMENT;
  static jfieldID org_apache_harmony_dalvik_ddmc_Chunk_data;
  static jfieldID org_apache_harmony_dalvik_ddmc_Chunk_length;
  static jfieldID org_apache_harmony_dalvik_ddmc_Chunk_offset;
  static jfieldID org_apache_harmony_dalvik_ddmc_Chunk_type;
};

}  // namespace art

#endif  // ART_RUNTIME_WELL_KNOWN_CLASSES_H_