blob: 586151de454aa0b488e655f64c6c8f0dbed9bb90 [file] [log] [blame]
Ian Rogers2dd0e2c2013-01-24 12:42:14 -08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Brian Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_RUNTIME_MIRROR_CLASS_H_
18#define ART_RUNTIME_MIRROR_CLASS_H_
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080019
20#include "modifiers.h"
21#include "object.h"
22#include "primitive.h"
23
24/*
25 * A magic value for refOffsets. Ignore the bits and walk the super
26 * chain when this is the value.
27 * [This is an unlikely "natural" value, since it would be 30 non-ref instance
28 * fields followed by 2 ref instance fields.]
29 */
Brian Carlstromfb6996f2013-07-18 18:21:14 -070030#define CLASS_WALK_SUPER 3U
31#define CLASS_BITS_PER_WORD (sizeof(uint32_t) * 8)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080032#define CLASS_OFFSET_ALIGNMENT 4
Brian Carlstromfb6996f2013-07-18 18:21:14 -070033#define CLASS_HIGH_BIT (1U << (CLASS_BITS_PER_WORD - 1))
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080034/*
35 * Given an offset, return the bit number which would encode that offset.
36 * Local use only.
37 */
38#define _CLASS_BIT_NUMBER_FROM_OFFSET(byteOffset) \
39 ((unsigned int)(byteOffset) / \
40 CLASS_OFFSET_ALIGNMENT)
41/*
42 * Is the given offset too large to be encoded?
43 */
44#define CLASS_CAN_ENCODE_OFFSET(byteOffset) \
45 (_CLASS_BIT_NUMBER_FROM_OFFSET(byteOffset) < CLASS_BITS_PER_WORD)
46/*
47 * Return a single bit, encoding the offset.
48 * Undefined if the offset is too large, as defined above.
49 */
50#define CLASS_BIT_FROM_OFFSET(byteOffset) \
51 (CLASS_HIGH_BIT >> _CLASS_BIT_NUMBER_FROM_OFFSET(byteOffset))
52/*
53 * Return an offset, given a bit number as returned from CLZ.
54 */
55#define CLASS_OFFSET_FROM_CLZ(rshift) \
56 MemberOffset((static_cast<int>(rshift) * CLASS_OFFSET_ALIGNMENT))
57
58namespace art {
59
60struct ClassClassOffsets;
61struct ClassOffsets;
Ian Rogersd91d6d62013-09-25 20:26:14 -070062class Signature;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080063class StringPiece;
64
65namespace mirror {
66
Brian Carlstromea46f952013-07-30 01:26:50 -070067class ArtField;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080068class ClassLoader;
69class DexCache;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080070class IfTable;
71
72// Type for the InitializedStaticStorage table. Currently the Class
73// provides the static storage. However, this might change to an Array
74// to improve image sharing, so we use this type to avoid assumptions
75// on the current storage.
76class MANAGED StaticStorageBase : public Object {
77};
78
79// C++ mirror of java.lang.Class
80class MANAGED Class : public StaticStorageBase {
81 public:
82 // Class Status
83 //
84 // kStatusNotReady: If a Class cannot be found in the class table by
85 // FindClass, it allocates an new one with AllocClass in the
86 // kStatusNotReady and calls LoadClass. Note if it does find a
87 // class, it may not be kStatusResolved and it will try to push it
88 // forward toward kStatusResolved.
89 //
90 // kStatusIdx: LoadClass populates with Class with information from
91 // the DexFile, moving the status to kStatusIdx, indicating that the
92 // Class value in super_class_ has not been populated. The new Class
93 // can then be inserted into the classes table.
94 //
95 // kStatusLoaded: After taking a lock on Class, the ClassLinker will
96 // attempt to move a kStatusIdx class forward to kStatusLoaded by
97 // using ResolveClass to initialize the super_class_ and ensuring the
98 // interfaces are resolved.
99 //
100 // kStatusResolved: Still holding the lock on Class, the ClassLinker
101 // shows linking is complete and fields of the Class populated by making
102 // it kStatusResolved. Java allows circularities of the form where a super
103 // class has a field that is of the type of the sub class. We need to be able
104 // to fully resolve super classes while resolving types for fields.
105 //
106 // kStatusRetryVerificationAtRuntime: The verifier sets a class to
107 // this state if it encounters a soft failure at compile time. This
108 // often happens when there are unresolved classes in other dex
109 // files, and this status marks a class as needing to be verified
110 // again at runtime.
111 //
112 // TODO: Explain the other states
113 enum Status {
114 kStatusError = -1,
115 kStatusNotReady = 0,
116 kStatusIdx = 1, // Loaded, DEX idx in super_class_type_idx_ and interfaces_type_idx_.
117 kStatusLoaded = 2, // DEX idx values resolved.
118 kStatusResolved = 3, // Part of linking.
119 kStatusVerifying = 4, // In the process of being verified.
120 kStatusRetryVerificationAtRuntime = 5, // Compile time verification failed, retry at runtime.
121 kStatusVerifyingAtRuntime = 6, // Retrying verification at runtime.
122 kStatusVerified = 7, // Logically part of linking; done pre-init.
123 kStatusInitializing = 8, // Class init in progress.
124 kStatusInitialized = 9, // Ready to go.
125 };
126
127 Status GetStatus() const {
128 DCHECK_EQ(sizeof(Status), sizeof(uint32_t));
Ian Rogers7dfb28c2013-08-22 08:18:36 -0700129 return static_cast<Status>(GetField32(OFFSET_OF_OBJECT_MEMBER(Class, status_), true));
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800130 }
131
Ian Rogers7dfb28c2013-08-22 08:18:36 -0700132 void SetStatus(Status new_status, Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800133
134 // Returns true if the class has failed to link.
135 bool IsErroneous() const {
136 return GetStatus() == kStatusError;
137 }
138
139 // Returns true if the class has been loaded.
140 bool IsIdxLoaded() const {
141 return GetStatus() >= kStatusIdx;
142 }
143
144 // Returns true if the class has been loaded.
145 bool IsLoaded() const {
146 return GetStatus() >= kStatusLoaded;
147 }
148
149 // Returns true if the class has been linked.
150 bool IsResolved() const {
151 return GetStatus() >= kStatusResolved;
152 }
153
154 // Returns true if the class was compile-time verified.
155 bool IsCompileTimeVerified() const {
156 return GetStatus() >= kStatusRetryVerificationAtRuntime;
157 }
158
159 // Returns true if the class has been verified.
160 bool IsVerified() const {
161 return GetStatus() >= kStatusVerified;
162 }
163
164 // Returns true if the class is initializing.
165 bool IsInitializing() const {
166 return GetStatus() >= kStatusInitializing;
167 }
168
169 // Returns true if the class is initialized.
170 bool IsInitialized() const {
171 return GetStatus() == kStatusInitialized;
172 }
173
174 uint32_t GetAccessFlags() const;
175
176 void SetAccessFlags(uint32_t new_access_flags) {
177 SetField32(OFFSET_OF_OBJECT_MEMBER(Class, access_flags_), new_access_flags, false);
178 }
179
180 // Returns true if the class is an interface.
181 bool IsInterface() const {
182 return (GetAccessFlags() & kAccInterface) != 0;
183 }
184
185 // Returns true if the class is declared public.
186 bool IsPublic() const {
187 return (GetAccessFlags() & kAccPublic) != 0;
188 }
189
190 // Returns true if the class is declared final.
191 bool IsFinal() const {
192 return (GetAccessFlags() & kAccFinal) != 0;
193 }
194
195 bool IsFinalizable() const {
196 return (GetAccessFlags() & kAccClassIsFinalizable) != 0;
197 }
198
199 void SetFinalizable() {
200 uint32_t flags = GetField32(OFFSET_OF_OBJECT_MEMBER(Class, access_flags_), false);
201 SetAccessFlags(flags | kAccClassIsFinalizable);
202 }
203
204 // Returns true if the class is abstract.
205 bool IsAbstract() const {
206 return (GetAccessFlags() & kAccAbstract) != 0;
207 }
208
209 // Returns true if the class is an annotation.
210 bool IsAnnotation() const {
211 return (GetAccessFlags() & kAccAnnotation) != 0;
212 }
213
214 // Returns true if the class is synthetic.
215 bool IsSynthetic() const {
216 return (GetAccessFlags() & kAccSynthetic) != 0;
217 }
218
219 bool IsReferenceClass() const {
220 return (GetAccessFlags() & kAccClassIsReference) != 0;
221 }
222
223 bool IsWeakReferenceClass() const {
224 return (GetAccessFlags() & kAccClassIsWeakReference) != 0;
225 }
226
227 bool IsSoftReferenceClass() const {
228 return (GetAccessFlags() & kAccReferenceFlagsMask) == kAccClassIsReference;
229 }
230
231 bool IsFinalizerReferenceClass() const {
232 return (GetAccessFlags() & kAccClassIsFinalizerReference) != 0;
233 }
234
235 bool IsPhantomReferenceClass() const {
236 return (GetAccessFlags() & kAccClassIsPhantomReference) != 0;
237 }
238
Ian Rogers04f94f42013-06-10 15:09:26 -0700239 // Can references of this type be assigned to by things of another type? For non-array types
240 // this is a matter of whether sub-classes may exist - which they can't if the type is final.
241 // For array classes, where all the classes are final due to there being no sub-classes, an
242 // Object[] may be assigned to by a String[] but a String[] may not be assigned to by other
243 // types as the component is final.
244 bool CannotBeAssignedFromOtherTypes() const {
245 if (!IsArrayClass()) {
246 return IsFinal();
247 } else {
248 Class* component = GetComponentType();
249 if (component->IsPrimitive()) {
250 return false;
251 } else {
252 return component->CannotBeAssignedFromOtherTypes();
253 }
254 }
255 }
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800256
257 String* GetName() const; // Returns the cached name.
258 void SetName(String* name) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Sets the cached name.
259 // Computes the name, then sets the cached value.
260 String* ComputeName() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
261
262 bool IsProxyClass() const {
263 // Read access flags without using getter as whether something is a proxy can be check in
264 // any loaded state
265 // TODO: switch to a check if the super class is java.lang.reflect.Proxy?
266 uint32_t access_flags = GetField32(OFFSET_OF_OBJECT_MEMBER(Class, access_flags_), false);
267 return (access_flags & kAccClassIsProxy) != 0;
268 }
269
270 Primitive::Type GetPrimitiveType() const {
271 DCHECK_EQ(sizeof(Primitive::Type), sizeof(int32_t));
272 return static_cast<Primitive::Type>(
273 GetField32(OFFSET_OF_OBJECT_MEMBER(Class, primitive_type_), false));
274 }
275
276 void SetPrimitiveType(Primitive::Type new_type) {
277 DCHECK_EQ(sizeof(Primitive::Type), sizeof(int32_t));
278 SetField32(OFFSET_OF_OBJECT_MEMBER(Class, primitive_type_), new_type, false);
279 }
280
281 // Returns true if the class is a primitive type.
282 bool IsPrimitive() const {
283 return GetPrimitiveType() != Primitive::kPrimNot;
284 }
285
286 bool IsPrimitiveBoolean() const {
287 return GetPrimitiveType() == Primitive::kPrimBoolean;
288 }
289
290 bool IsPrimitiveByte() const {
291 return GetPrimitiveType() == Primitive::kPrimByte;
292 }
293
294 bool IsPrimitiveChar() const {
295 return GetPrimitiveType() == Primitive::kPrimChar;
296 }
297
298 bool IsPrimitiveShort() const {
299 return GetPrimitiveType() == Primitive::kPrimShort;
300 }
301
302 bool IsPrimitiveInt() const {
303 return GetPrimitiveType() == Primitive::kPrimInt;
304 }
305
306 bool IsPrimitiveLong() const {
307 return GetPrimitiveType() == Primitive::kPrimLong;
308 }
309
310 bool IsPrimitiveFloat() const {
311 return GetPrimitiveType() == Primitive::kPrimFloat;
312 }
313
314 bool IsPrimitiveDouble() const {
315 return GetPrimitiveType() == Primitive::kPrimDouble;
316 }
317
318 bool IsPrimitiveVoid() const {
319 return GetPrimitiveType() == Primitive::kPrimVoid;
320 }
321
322 bool IsPrimitiveArray() const {
323 return IsArrayClass() && GetComponentType()->IsPrimitive();
324 }
325
326 // Depth of class from java.lang.Object
327 size_t Depth() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
328 size_t depth = 0;
329 for (Class* klass = this; klass->GetSuperClass() != NULL; klass = klass->GetSuperClass()) {
330 depth++;
331 }
332 return depth;
333 }
334
335 bool IsArrayClass() const {
336 return GetComponentType() != NULL;
337 }
338
339 bool IsClassClass() const;
340
341 bool IsStringClass() const;
342
343 bool IsThrowableClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
344
Brian Carlstromea46f952013-07-30 01:26:50 -0700345 bool IsArtFieldClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800346
Brian Carlstromea46f952013-07-30 01:26:50 -0700347 bool IsArtMethodClass() const;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800348
349 Class* GetComponentType() const {
350 return GetFieldObject<Class*>(OFFSET_OF_OBJECT_MEMBER(Class, component_type_), false);
351 }
352
353 void SetComponentType(Class* new_component_type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
354 DCHECK(GetComponentType() == NULL);
355 DCHECK(new_component_type != NULL);
356 SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, component_type_), new_component_type, false);
357 }
358
359 size_t GetComponentSize() const {
360 return Primitive::ComponentSize(GetComponentType()->GetPrimitiveType());
361 }
362
363 bool IsObjectClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
364 return !IsPrimitive() && GetSuperClass() == NULL;
365 }
366 bool IsInstantiable() const {
Sameer Abu Asal02c42232013-04-30 12:09:45 -0700367 return (!IsPrimitive() && !IsInterface() && !IsAbstract()) || ((IsAbstract()) && IsArrayClass());
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800368 }
369
370 bool IsObjectArrayClass() const {
371 return GetComponentType() != NULL && !GetComponentType()->IsPrimitive();
372 }
373
374 // Creates a raw object instance but does not invoke the default constructor.
Hiroshi Yamauchi3b4c1892013-09-12 21:33:12 -0700375 Object* AllocObject(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
376 return AllocObjectInstrumented(self);
377 }
378
379 Object* AllocObjectUninstrumented(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
380 Object* AllocObjectInstrumented(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800381
382 bool IsVariableSize() const {
383 // Classes and arrays vary in size, and so the object_size_ field cannot
384 // be used to get their instance size
385 return IsClassClass() || IsArrayClass();
386 }
387
388 size_t SizeOf() const {
389 DCHECK_EQ(sizeof(size_t), sizeof(int32_t));
390 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, class_size_), false);
391 }
392
393 size_t GetClassSize() const {
394 DCHECK_EQ(sizeof(size_t), sizeof(uint32_t));
395 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, class_size_), false);
396 }
397
398 void SetClassSize(size_t new_class_size)
399 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
400
401 size_t GetObjectSize() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
402
403 void SetObjectSize(size_t new_object_size) {
404 DCHECK(!IsVariableSize());
405 DCHECK_EQ(sizeof(size_t), sizeof(int32_t));
406 return SetField32(OFFSET_OF_OBJECT_MEMBER(Class, object_size_), new_object_size, false);
407 }
408
409 // Returns true if this class is in the same packages as that class.
410 bool IsInSamePackage(const Class* that) const
411 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
412
413 static bool IsInSamePackage(const StringPiece& descriptor1, const StringPiece& descriptor2);
414
415 // Returns true if this class can access that class.
416 bool CanAccess(Class* that) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
417 return that->IsPublic() || this->IsInSamePackage(that);
418 }
419
420 // Can this class access a member in the provided class with the provided member access flags?
421 // Note that access to the class isn't checked in case the declaring class is protected and the
422 // method has been exposed by a public sub-class
423 bool CanAccessMember(Class* access_to, uint32_t member_flags) const
424 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
425 // Classes can access all of their own members
426 if (this == access_to) {
427 return true;
428 }
429 // Public members are trivially accessible
430 if (member_flags & kAccPublic) {
431 return true;
432 }
433 // Private members are trivially not accessible
434 if (member_flags & kAccPrivate) {
435 return false;
436 }
437 // Check for protected access from a sub-class, which may or may not be in the same package.
438 if (member_flags & kAccProtected) {
439 if (this->IsSubClass(access_to)) {
440 return true;
441 }
442 }
443 // Allow protected access from other classes in the same package.
444 return this->IsInSamePackage(access_to);
445 }
446
447 bool IsSubClass(const Class* klass) const
448 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
449
450 // Can src be assigned to this class? For example, String can be assigned to Object (by an
451 // upcast), however, an Object cannot be assigned to a String as a potentially exception throwing
452 // downcast would be necessary. Similarly for interfaces, a class that implements (or an interface
453 // that extends) another can be assigned to its parent, but not vice-versa. All Classes may assign
454 // to themselves. Classes for primitive types may not assign to each other.
Ian Rogersfa46d3e2013-05-15 00:16:04 -0700455 inline bool IsAssignableFrom(const Class* src) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800456 DCHECK(src != NULL);
457 if (this == src) {
458 // Can always assign to things of the same type.
459 return true;
460 } else if (IsObjectClass()) {
461 // Can assign any reference to java.lang.Object.
462 return !src->IsPrimitive();
463 } else if (IsInterface()) {
464 return src->Implements(this);
465 } else if (src->IsArrayClass()) {
466 return IsAssignableFromArray(src);
467 } else {
468 return !src->IsInterface() && src->IsSubClass(this);
469 }
470 }
471
472 Class* GetSuperClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
473
474 void SetSuperClass(Class *new_super_class) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
475 // super class is assigned once, except during class linker initialization
476 Class* old_super_class = GetFieldObject<Class*>(
477 OFFSET_OF_OBJECT_MEMBER(Class, super_class_), false);
478 DCHECK(old_super_class == NULL || old_super_class == new_super_class);
479 DCHECK(new_super_class != NULL);
480 SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, super_class_), new_super_class, false);
481 }
482
483 bool HasSuperClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
484 return GetSuperClass() != NULL;
485 }
486
487 static MemberOffset SuperClassOffset() {
488 return MemberOffset(OFFSETOF_MEMBER(Class, super_class_));
489 }
490
491 ClassLoader* GetClassLoader() const;
492
493 void SetClassLoader(ClassLoader* new_cl) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
494
495 static MemberOffset DexCacheOffset() {
496 return MemberOffset(OFFSETOF_MEMBER(Class, dex_cache_));
497 }
498
499 enum {
500 kDumpClassFullDetail = 1,
501 kDumpClassClassLoader = (1 << 1),
502 kDumpClassInitialized = (1 << 2),
503 };
504
505 void DumpClass(std::ostream& os, int flags) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
506
507 DexCache* GetDexCache() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
508
509 void SetDexCache(DexCache* new_dex_cache) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
510
Brian Carlstromea46f952013-07-30 01:26:50 -0700511 ObjectArray<ArtMethod>* GetDirectMethods() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800512
Brian Carlstromea46f952013-07-30 01:26:50 -0700513 void SetDirectMethods(ObjectArray<ArtMethod>* new_direct_methods)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800514 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
515
Brian Carlstromea46f952013-07-30 01:26:50 -0700516 ArtMethod* GetDirectMethod(int32_t i) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800517
Brian Carlstromea46f952013-07-30 01:26:50 -0700518 void SetDirectMethod(uint32_t i, ArtMethod* f) // TODO: uint16_t
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800519 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
520
521 // Returns the number of static, private, and constructor methods.
522 size_t NumDirectMethods() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
523
Brian Carlstromea46f952013-07-30 01:26:50 -0700524 ObjectArray<ArtMethod>* GetVirtualMethods() const
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800525 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
526
Brian Carlstromea46f952013-07-30 01:26:50 -0700527 void SetVirtualMethods(ObjectArray<ArtMethod>* new_virtual_methods)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800528 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
529
530 // Returns the number of non-inherited virtual methods.
531 size_t NumVirtualMethods() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
532
Brian Carlstromea46f952013-07-30 01:26:50 -0700533 ArtMethod* GetVirtualMethod(uint32_t i) const
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800534 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
535
Brian Carlstromea46f952013-07-30 01:26:50 -0700536 ArtMethod* GetVirtualMethodDuringLinking(uint32_t i) const
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800537 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
538
Brian Carlstromea46f952013-07-30 01:26:50 -0700539 void SetVirtualMethod(uint32_t i, ArtMethod* f) // TODO: uint16_t
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800540 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
541
Brian Carlstromea46f952013-07-30 01:26:50 -0700542 ObjectArray<ArtMethod>* GetVTable() const;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800543
Brian Carlstromea46f952013-07-30 01:26:50 -0700544 ObjectArray<ArtMethod>* GetVTableDuringLinking() const;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800545
Brian Carlstromea46f952013-07-30 01:26:50 -0700546 void SetVTable(ObjectArray<ArtMethod>* new_vtable)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800547 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
548
549 static MemberOffset VTableOffset() {
550 return OFFSET_OF_OBJECT_MEMBER(Class, vtable_);
551 }
552
553 // Given a method implemented by this class but potentially from a super class, return the
554 // specific implementation method for this class.
Brian Carlstromea46f952013-07-30 01:26:50 -0700555 ArtMethod* FindVirtualMethodForVirtual(ArtMethod* method) const
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800556 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
557
558 // Given a method implemented by this class' super class, return the specific implementation
559 // method for this class.
Brian Carlstromea46f952013-07-30 01:26:50 -0700560 ArtMethod* FindVirtualMethodForSuper(ArtMethod* method) const
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800561 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
562
563 // Given a method implemented by this class, but potentially from a
564 // super class or interface, return the specific implementation
565 // method for this class.
Brian Carlstromea46f952013-07-30 01:26:50 -0700566 ArtMethod* FindVirtualMethodForInterface(ArtMethod* method) const
Ian Rogers1ffa32f2013-02-05 18:29:08 -0800567 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) ALWAYS_INLINE;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800568
Ian Rogersd91d6d62013-09-25 20:26:14 -0700569 ArtMethod* FindVirtualMethodForVirtualOrInterface(ArtMethod* method) const
570 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
571
572 ArtMethod* FindInterfaceMethod(const StringPiece& name, const Signature& signature) const
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800573 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
574
Brian Carlstromea46f952013-07-30 01:26:50 -0700575 ArtMethod* FindInterfaceMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800576 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
577
Brian Carlstromea46f952013-07-30 01:26:50 -0700578 ArtMethod* FindDeclaredDirectMethod(const StringPiece& name, const StringPiece& signature) const
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800579 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
580
Ian Rogersd91d6d62013-09-25 20:26:14 -0700581 ArtMethod* FindDeclaredDirectMethod(const StringPiece& name, const Signature& signature) const
582 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
583
Brian Carlstromea46f952013-07-30 01:26:50 -0700584 ArtMethod* FindDeclaredDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800585 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
586
Brian Carlstromea46f952013-07-30 01:26:50 -0700587 ArtMethod* FindDirectMethod(const StringPiece& name, const StringPiece& signature) const
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800588 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
589
Ian Rogersd91d6d62013-09-25 20:26:14 -0700590 ArtMethod* FindDirectMethod(const StringPiece& name, const Signature& signature) const
591 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
592
Brian Carlstromea46f952013-07-30 01:26:50 -0700593 ArtMethod* FindDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800594 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
595
Ian Rogersd91d6d62013-09-25 20:26:14 -0700596 ArtMethod* FindDeclaredVirtualMethod(const StringPiece& name, const StringPiece& signature) const
597 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
598
599 ArtMethod* FindDeclaredVirtualMethod(const StringPiece& name, const Signature& signature) const
600 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
601
602 ArtMethod* FindDeclaredVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const
603 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
604
605 ArtMethod* FindVirtualMethod(const StringPiece& name, const StringPiece& signature) const
606 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
607
608 ArtMethod* FindVirtualMethod(const StringPiece& name, const Signature& signature) const
609 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
610
611 ArtMethod* FindVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const
612 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
613
614 ArtMethod* FindClassInitializer() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
615
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800616 int32_t GetIfTableCount() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
617
618 IfTable* GetIfTable() const;
619
620 void SetIfTable(IfTable* new_iftable) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
621
622 // Get instance fields of the class (See also GetSFields).
Brian Carlstromea46f952013-07-30 01:26:50 -0700623 ObjectArray<ArtField>* GetIFields() const;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800624
Brian Carlstromea46f952013-07-30 01:26:50 -0700625 void SetIFields(ObjectArray<ArtField>* new_ifields) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800626
627 size_t NumInstanceFields() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
628
Brian Carlstromea46f952013-07-30 01:26:50 -0700629 ArtField* GetInstanceField(uint32_t i) const // TODO: uint16_t
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800630 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
631
Brian Carlstromea46f952013-07-30 01:26:50 -0700632 void SetInstanceField(uint32_t i, ArtField* f) // TODO: uint16_t
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800633 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
634
635 // Returns the number of instance fields containing reference types.
636 size_t NumReferenceInstanceFields() const {
637 DCHECK(IsResolved() || IsErroneous());
638 DCHECK_EQ(sizeof(size_t), sizeof(int32_t));
639 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, num_reference_instance_fields_), false);
640 }
641
642 size_t NumReferenceInstanceFieldsDuringLinking() const {
643 DCHECK(IsLoaded() || IsErroneous());
644 DCHECK_EQ(sizeof(size_t), sizeof(int32_t));
645 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, num_reference_instance_fields_), false);
646 }
647
648 void SetNumReferenceInstanceFields(size_t new_num) {
649 DCHECK_EQ(sizeof(size_t), sizeof(int32_t));
650 SetField32(OFFSET_OF_OBJECT_MEMBER(Class, num_reference_instance_fields_), new_num, false);
651 }
652
653 uint32_t GetReferenceInstanceOffsets() const {
654 DCHECK(IsResolved() || IsErroneous());
655 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, reference_instance_offsets_), false);
656 }
657
658 void SetReferenceInstanceOffsets(uint32_t new_reference_offsets)
659 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
660
661 // Beginning of static field data
662 static MemberOffset FieldsOffset() {
663 return OFFSET_OF_OBJECT_MEMBER(Class, fields_);
664 }
665
666 // Returns the number of static fields containing reference types.
667 size_t NumReferenceStaticFields() const {
668 DCHECK(IsResolved() || IsErroneous());
669 DCHECK_EQ(sizeof(size_t), sizeof(int32_t));
670 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, num_reference_static_fields_), false);
671 }
672
673 size_t NumReferenceStaticFieldsDuringLinking() const {
674 DCHECK(IsLoaded() || IsErroneous());
675 DCHECK_EQ(sizeof(size_t), sizeof(int32_t));
676 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, num_reference_static_fields_), false);
677 }
678
679 void SetNumReferenceStaticFields(size_t new_num) {
680 DCHECK_EQ(sizeof(size_t), sizeof(int32_t));
681 SetField32(OFFSET_OF_OBJECT_MEMBER(Class, num_reference_static_fields_), new_num, false);
682 }
683
684 // Gets the static fields of the class.
Brian Carlstromea46f952013-07-30 01:26:50 -0700685 ObjectArray<ArtField>* GetSFields() const;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800686
Brian Carlstromea46f952013-07-30 01:26:50 -0700687 void SetSFields(ObjectArray<ArtField>* new_sfields) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800688
689 size_t NumStaticFields() const;
690
Brian Carlstromea46f952013-07-30 01:26:50 -0700691 ArtField* GetStaticField(uint32_t i) const; // TODO: uint16_t
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800692
Brian Carlstromea46f952013-07-30 01:26:50 -0700693 void SetStaticField(uint32_t i, ArtField* f); // TODO: uint16_t
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800694
695 uint32_t GetReferenceStaticOffsets() const {
696 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, reference_static_offsets_), false);
697 }
698
699 void SetReferenceStaticOffsets(uint32_t new_reference_offsets);
700
701 // Find a static or instance field using the JLS resolution order
Brian Carlstromea46f952013-07-30 01:26:50 -0700702 ArtField* FindField(const StringPiece& name, const StringPiece& type)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800703 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
704
705 // Finds the given instance field in this class or a superclass.
Brian Carlstromea46f952013-07-30 01:26:50 -0700706 ArtField* FindInstanceField(const StringPiece& name, const StringPiece& type)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800707 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
708
709 // Finds the given instance field in this class or a superclass, only searches classes that
710 // have the same dex cache.
Brian Carlstromea46f952013-07-30 01:26:50 -0700711 ArtField* FindInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800712 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
713
Brian Carlstromea46f952013-07-30 01:26:50 -0700714 ArtField* FindDeclaredInstanceField(const StringPiece& name, const StringPiece& type)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800715 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
716
Brian Carlstromea46f952013-07-30 01:26:50 -0700717 ArtField* FindDeclaredInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800718 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
719
720 // Finds the given static field in this class or a superclass.
Brian Carlstromea46f952013-07-30 01:26:50 -0700721 ArtField* FindStaticField(const StringPiece& name, const StringPiece& type)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800722 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
723
724 // Finds the given static field in this class or superclass, only searches classes that
725 // have the same dex cache.
Brian Carlstromea46f952013-07-30 01:26:50 -0700726 ArtField* FindStaticField(const DexCache* dex_cache, uint32_t dex_field_idx)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800727 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
728
Brian Carlstromea46f952013-07-30 01:26:50 -0700729 ArtField* FindDeclaredStaticField(const StringPiece& name, const StringPiece& type)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800730 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
731
Brian Carlstromea46f952013-07-30 01:26:50 -0700732 ArtField* FindDeclaredStaticField(const DexCache* dex_cache, uint32_t dex_field_idx)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800733 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
734
735 pid_t GetClinitThreadId() const {
736 DCHECK(IsIdxLoaded() || IsErroneous());
737 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, clinit_thread_id_), false);
738 }
739
740 void SetClinitThreadId(pid_t new_clinit_thread_id) {
741 SetField32(OFFSET_OF_OBJECT_MEMBER(Class, clinit_thread_id_), new_clinit_thread_id, false);
742 }
743
744 Class* GetVerifyErrorClass() const {
745 // DCHECK(IsErroneous());
746 return GetFieldObject<Class*>(OFFSET_OF_OBJECT_MEMBER(Class, verify_error_class_), false);
747 }
748
Ian Rogers8b2c0b92013-09-19 02:56:49 -0700749 uint16_t GetDexClassDefIndex() const {
750 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, dex_class_def_idx_), false);
751 }
752
753 void SetDexClassDefIndex(uint16_t class_def_idx) {
754 SetField32(OFFSET_OF_OBJECT_MEMBER(Class, dex_class_def_idx_), class_def_idx, false);
755 }
756
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800757 uint16_t GetDexTypeIndex() const {
758 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, dex_type_idx_), false);
759 }
760
761 void SetDexTypeIndex(uint16_t type_idx) {
762 SetField32(OFFSET_OF_OBJECT_MEMBER(Class, dex_type_idx_), type_idx, false);
763 }
764
765 static Class* GetJavaLangClass() {
766 DCHECK(java_lang_Class_ != NULL);
767 return java_lang_Class_;
768 }
769
770 // Can't call this SetClass or else gets called instead of Object::SetClass in places.
771 static void SetClassClass(Class* java_lang_Class);
772 static void ResetClass();
773
Sebastien Hertz233ea8e2013-06-06 11:57:09 +0200774 // When class is verified, set the kAccPreverified flag on each method.
775 void SetPreverifiedFlagOnAllMethods() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
776
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800777 private:
778 void SetVerifyErrorClass(Class* klass) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
779
780 bool Implements(const Class* klass) const
781 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
782 bool IsArrayAssignableFromArray(const Class* klass) const
783 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
784 bool IsAssignableFromArray(const Class* klass) const
785 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
786
Hiroshi Yamauchi3b4c1892013-09-12 21:33:12 -0700787 void CheckObjectAlloc() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
788
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800789 // defining class loader, or NULL for the "bootstrap" system loader
790 ClassLoader* class_loader_;
791
792 // For array classes, the component class object for instanceof/checkcast
793 // (for String[][][], this will be String[][]). NULL for non-array classes.
794 Class* component_type_;
795
796 // DexCache of resolved constant pool entries (will be NULL for classes generated by the
797 // runtime such as arrays and primitive classes).
798 DexCache* dex_cache_;
799
800 // static, private, and <init> methods
Brian Carlstromea46f952013-07-30 01:26:50 -0700801 ObjectArray<ArtMethod>* direct_methods_;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800802
803 // instance fields
804 //
805 // These describe the layout of the contents of an Object.
806 // Note that only the fields directly declared by this class are
807 // listed in ifields; fields declared by a superclass are listed in
808 // the superclass's Class.ifields.
809 //
810 // All instance fields that refer to objects are guaranteed to be at
811 // the beginning of the field list. num_reference_instance_fields_
812 // specifies the number of reference fields.
Brian Carlstromea46f952013-07-30 01:26:50 -0700813 ObjectArray<ArtField>* ifields_;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800814
815 // The interface table (iftable_) contains pairs of a interface class and an array of the
816 // interface methods. There is one pair per interface supported by this class. That means one
817 // pair for each interface we support directly, indirectly via superclass, or indirectly via a
818 // superinterface. This will be null if neither we nor our superclass implement any interfaces.
819 //
820 // Why we need this: given "class Foo implements Face", declare "Face faceObj = new Foo()".
821 // Invoke faceObj.blah(), where "blah" is part of the Face interface. We can't easily use a
822 // single vtable.
823 //
824 // For every interface a concrete class implements, we create an array of the concrete vtable_
825 // methods for the methods in the interface.
826 IfTable* iftable_;
827
828 // descriptor for the class such as "java.lang.Class" or "[C". Lazily initialized by ComputeName
829 String* name_;
830
831 // Static fields
Brian Carlstromea46f952013-07-30 01:26:50 -0700832 ObjectArray<ArtField>* sfields_;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800833
834 // The superclass, or NULL if this is java.lang.Object, an interface or primitive type.
835 Class* super_class_;
836
837 // If class verify fails, we must return same error on subsequent tries.
838 Class* verify_error_class_;
839
Ian Rogers8b2c0b92013-09-19 02:56:49 -0700840 // Virtual methods defined in this class; invoked through vtable.
Brian Carlstromea46f952013-07-30 01:26:50 -0700841 ObjectArray<ArtMethod>* virtual_methods_;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800842
843 // Virtual method table (vtable), for use by "invoke-virtual". The vtable from the superclass is
844 // copied in, and virtual methods from our class either replace those from the super or are
845 // appended. For abstract classes, methods may be created in the vtable that aren't in
846 // virtual_ methods_ for miranda methods.
Brian Carlstromea46f952013-07-30 01:26:50 -0700847 ObjectArray<ArtMethod>* vtable_;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800848
Ian Rogers8b2c0b92013-09-19 02:56:49 -0700849 // Access flags; low 16 bits are defined by VM spec.
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800850 uint32_t access_flags_;
851
852 // Total size of the Class instance; used when allocating storage on gc heap.
853 // See also object_size_.
854 size_t class_size_;
855
Ian Rogers8b2c0b92013-09-19 02:56:49 -0700856 // Tid used to check for recursive <clinit> invocation.
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800857 pid_t clinit_thread_id_;
858
Ian Rogers8b2c0b92013-09-19 02:56:49 -0700859 // ClassDef index in dex file, -1 if no class definition such as an array.
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800860 // TODO: really 16bits
Ian Rogers8b2c0b92013-09-19 02:56:49 -0700861 int32_t dex_class_def_idx_;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800862
Ian Rogers8b2c0b92013-09-19 02:56:49 -0700863 // Type index in dex file.
864 // TODO: really 16bits
865 int32_t dex_type_idx_;
866
867 // Number of instance fields that are object refs.
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800868 size_t num_reference_instance_fields_;
869
Ian Rogers8b2c0b92013-09-19 02:56:49 -0700870 // Number of static fields that are object refs,
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800871 size_t num_reference_static_fields_;
872
873 // Total object size; used when allocating storage on gc heap.
874 // (For interfaces and abstract classes this will be zero.)
875 // See also class_size_.
876 size_t object_size_;
877
Ian Rogers8b2c0b92013-09-19 02:56:49 -0700878 // Primitive type value, or Primitive::kPrimNot (0); set for generated primitive classes.
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800879 Primitive::Type primitive_type_;
880
881 // Bitmap of offsets of ifields.
882 uint32_t reference_instance_offsets_;
883
884 // Bitmap of offsets of sfields.
885 uint32_t reference_static_offsets_;
886
Ian Rogers8b2c0b92013-09-19 02:56:49 -0700887 // State of class initialization.
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800888 Status status_;
889
890 // TODO: ?
891 // initiating class loader list
892 // NOTE: for classes with low serialNumber, these are unused, and the
893 // values are kept in a table in gDvm.
894 // InitiatingLoaderList initiating_loader_list_;
895
896 // Location of first static field.
897 uint32_t fields_[0];
898
899 // java.lang.Class
900 static Class* java_lang_Class_;
901
902 friend struct art::ClassOffsets; // for verifying offset information
903 DISALLOW_IMPLICIT_CONSTRUCTORS(Class);
904};
905
906std::ostream& operator<<(std::ostream& os, const Class::Status& rhs);
907
908class MANAGED ClassClass : public Class {
909 private:
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800910 int64_t serialVersionUID_;
911 friend struct art::ClassClassOffsets; // for verifying offset information
912 DISALLOW_IMPLICIT_CONSTRUCTORS(ClassClass);
913};
914
915} // namespace mirror
916} // namespace art
917
Brian Carlstromfc0e3212013-07-17 14:40:12 -0700918#endif // ART_RUNTIME_MIRROR_CLASS_H_