prims.cc (_Jv_soleIndirectCompiledEngine): New.
[gcc.git] / libjava / java / lang / Class.h
1 // Class.h - Header file for java.lang.Class. -*- c++ -*-
2
3 /* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation
4
5 This file is part of libgcj.
6
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 details. */
10
11 // Written primary using compiler source and Class.java as guides.
12 #ifndef __JAVA_LANG_CLASS_H__
13 #define __JAVA_LANG_CLASS_H__
14
15 #pragma interface
16
17 #include <stddef.h>
18 #include <java/lang/Object.h>
19 #include <java/lang/String.h>
20 #include <java/net/URL.h>
21 #include <java/lang/reflect/Modifier.h>
22 #include <java/security/ProtectionDomain.h>
23 #include <java/lang/Package.h>
24
25 // Avoid including SystemClassLoader.h.
26 extern "Java"
27 {
28 namespace gnu
29 {
30 namespace gcj
31 {
32 namespace runtime
33 {
34 class SystemClassLoader;
35 }
36 }
37 }
38 }
39
40 // We declare these here to avoid including gcj/cni.h.
41 extern "C" void _Jv_InitClass (jclass klass);
42 extern "C" jclass _Jv_NewClassFromInitializer
43 (const jclass class_initializer);
44 extern "C" void _Jv_RegisterNewClasses (void **classes);
45 extern "C" void _Jv_RegisterClasses (const jclass *classes);
46 extern "C" void _Jv_RegisterClasses_Counted (const jclass *classes,
47 size_t count);
48
49 // This must be predefined with "C" linkage.
50 extern "C" void *_Jv_LookupInterfaceMethodIdx (jclass klass, jclass iface,
51 int meth_idx);
52 extern "C" void *_Jv_ResolvePoolEntry (jclass this_class, jint index);
53
54 // These are the possible values for the `state' field of the class
55 // structure. Note that ordering is important here. Whenever the
56 // state changes, one should notify all waiters of this class.
57 enum
58 {
59 JV_STATE_NOTHING = 0, // Set by compiler.
60
61 JV_STATE_PRELOADING = 1, // Can do _Jv_FindClass.
62
63 // There is an invariant through libgcj that a class will always be
64 // at a state greater than or equal to JV_STATE_LOADING when it is
65 // returned by a class loader to user code. Hence, defineclass.cc
66 // installs supers before returning a class, C++-ABI-compiled
67 // classes are created with supers installed, and BC-ABI-compiled
68 // classes are linked to this state before being returned by their
69 // class loader.
70 JV_STATE_LOADING = 3, // Has super installed.
71 JV_STATE_READ = 4, // Has been completely defined.
72 JV_STATE_LOADED = 5, // Has Miranda methods defined.
73
74 JV_STATE_COMPILED = 6, // This was a compiled class.
75
76 JV_STATE_PREPARED = 7, // Layout & static init done.
77 JV_STATE_LINKED = 9, // Strings interned.
78
79 JV_STATE_IN_PROGRESS = 10, // <clinit> running.
80
81 JV_STATE_ERROR = 12,
82
83 JV_STATE_PHANTOM = 13, // Bytecode is missing. In many cases we can
84 // work around that. If not, throw a
85 // NoClassDefFoundError.
86
87 JV_STATE_DONE = 14, // Must be last.
88
89
90 };
91
92 struct _Jv_Field;
93 struct _Jv_VTable;
94 union _Jv_word;
95 struct _Jv_ArrayVTable;
96 class _Jv_Linker;
97 class _Jv_ExecutionEngine;
98 class _Jv_CompiledEngine;
99 class _Jv_IndirectCompiledEngine;
100 class _Jv_InterpreterEngine;
101
102 #ifdef INTERPRETER
103 class _Jv_ClassReader;
104 class _Jv_InterpClass;
105 class _Jv_InterpMethod;
106 #endif
107
108 struct _Jv_Constants
109 {
110 jint size;
111 jbyte *tags;
112 _Jv_word *data;
113 };
114
115 struct _Jv_Method
116 {
117 // Method name.
118 _Jv_Utf8Const *name;
119 // Method signature.
120 _Jv_Utf8Const *signature;
121 // Access flags.
122 _Jv_ushort accflags;
123 // Method's index in the vtable.
124 _Jv_ushort index;
125 // Pointer to underlying function.
126 void *ncode;
127 // NULL-terminated list of exception class names; can be NULL if
128 // there are none such.
129 _Jv_Utf8Const **throws;
130
131 _Jv_Method *getNextMethod ()
132 { return this + 1; }
133 };
134
135 // The table used to resolve interface calls.
136 struct _Jv_IDispatchTable
137 {
138 // Index into interface's ioffsets.
139 jshort iindex;
140 jshort itable_length;
141 // Class Interface dispatch table.
142 void *itable[0];
143 };
144
145 // Used by _Jv_Linker::get_interfaces ()
146 struct _Jv_ifaces
147 {
148 jclass *list;
149 jshort len;
150 jshort count;
151 };
152
153 struct _Jv_MethodSymbol
154 {
155 _Jv_Utf8Const *class_name;
156 _Jv_Utf8Const *name;
157 _Jv_Utf8Const *signature;
158 };
159
160 struct _Jv_OffsetTable
161 {
162 jint state;
163 jint offsets[];
164 };
165
166 struct _Jv_AddressTable
167 {
168 jint state;
169 void *addresses[];
170 };
171
172 struct _Jv_CatchClass
173 {
174 java::lang::Class **address;
175 _Jv_Utf8Const *classname;
176 };
177
178 // Possible values for the assertion_code field in the type assertion table.
179 enum
180 {
181 JV_ASSERT_END_OF_TABLE = 0,
182 JV_ASSERT_TYPES_COMPATIBLE = 1,
183 JV_ASSERT_IS_INSTANTIABLE = 2
184 };
185
186 // Entry in the type assertion table, used to validate type constraints
187 // for binary compatibility.
188 struct _Jv_TypeAssertion
189 {
190 jint assertion_code;
191 _Jv_Utf8Const *op1;
192 _Jv_Utf8Const *op2;
193 };
194
195 #define JV_PRIMITIVE_VTABLE ((_Jv_VTable *) -1)
196
197 #define JV_CLASS(Obj) ((jclass) (*(_Jv_VTable **) Obj)->clas)
198
199 // Forward declarations for friends of java::lang::Class
200
201 // Friend functions implemented in natClass.cc.
202 _Jv_Method *_Jv_GetMethodLocal (jclass klass, _Jv_Utf8Const *name,
203 _Jv_Utf8Const *signature);
204 jboolean _Jv_IsAssignableFrom (jclass, jclass);
205 jboolean _Jv_IsAssignableFromSlow (jclass, jclass);
206 jboolean _Jv_InterfaceAssignableFrom (jclass, jclass);
207
208 _Jv_Method* _Jv_LookupDeclaredMethod (jclass, _Jv_Utf8Const *,
209 _Jv_Utf8Const*, jclass * = NULL);
210 jfieldID JvGetFirstInstanceField (jclass);
211 jint JvNumInstanceFields (jclass);
212 jfieldID JvGetFirstStaticField (jclass);
213 jint JvNumStaticFields (jclass);
214
215 jobject _Jv_AllocObject (jclass);
216 void *_Jv_AllocObj (jint, jclass);
217 void *_Jv_AllocPtrFreeObj (jint, jclass);
218 void *_Jv_AllocArray (jint, jclass);
219
220 bool _Jv_getInterfaceMethod(jclass, jclass&, int&,
221 const _Jv_Utf8Const*,
222 const _Jv_Utf8Const*);
223
224 jobject _Jv_JNI_ToReflectedField (_Jv_JNIEnv *, jclass, jfieldID,
225 jboolean);
226 jobject _Jv_JNI_ToReflectedMethod (_Jv_JNIEnv *, jclass, jmethodID,
227 jboolean);
228 jfieldID _Jv_FromReflectedField (java::lang::reflect::Field *);
229
230 jmethodID _Jv_FromReflectedMethod (java::lang::reflect::Method *);
231 jmethodID _Jv_FromReflectedConstructor (java::lang::reflect::Constructor *);
232 jint JvNumMethods (jclass);
233 jmethodID JvGetFirstMethod (jclass);
234
235 #ifdef INTERPRETER
236 // Finds a desired interpreter method in the given class or NULL if not found
237 _Jv_InterpMethod* _Jv_FindInterpreterMethod (jclass, jmethodID);
238 #endif
239
240 // Friend classes and functions to implement the ClassLoader
241 class java::lang::ClassLoader;
242 class java::lang::VMClassLoader;
243
244 class java::io::ObjectOutputStream;
245 class java::io::ObjectInputStream;
246 class java::io::ObjectStreamClass;
247
248 void _Jv_RegisterClassHookDefault (jclass klass);
249 void _Jv_RegisterInitiatingLoader (jclass,java::lang::ClassLoader*);
250 void _Jv_UnregisterInitiatingLoader (jclass,java::lang::ClassLoader*);
251 void _Jv_UnregisterClass (jclass);
252 jclass _Jv_FindClassNoException (_Jv_Utf8Const *name,
253 java::lang::ClassLoader *loader);
254 jclass _Jv_FindClass (_Jv_Utf8Const *name,
255 java::lang::ClassLoader *loader);
256 jclass _Jv_FindClassInCache (_Jv_Utf8Const *name);
257 jclass _Jv_PopClass (void);
258 void _Jv_PushClass (jclass k);
259 void _Jv_NewArrayClass (jclass element,
260 java::lang::ClassLoader *loader,
261 _Jv_VTable *array_vtable = 0);
262 jclass _Jv_NewClass (_Jv_Utf8Const *name, jclass superclass,
263 java::lang::ClassLoader *loader);
264 void _Jv_InitNewClassFields (jclass klass);
265
266 // Friend functions and classes in prims.cc
267 void _Jv_InitPrimClass (jclass, const char *, char, int);
268 jstring _Jv_GetMethodString (jclass, _Jv_Method *, jclass = NULL);
269
270 jboolean _Jv_CheckAccess (jclass self_klass, jclass other_klass,
271 jint flags);
272 jclass _Jv_GetArrayClass (jclass klass, java::lang::ClassLoader *loader);
273
274 jboolean _Jv_IsInterpretedClass (jclass);
275 jboolean _Jv_IsBinaryCompatibilityABI (jclass);
276
277 jboolean _Jv_IsPhantomClass (jclass);
278
279 void _Jv_CopyClassesToSystemLoader (gnu::gcj::runtime::SystemClassLoader *);
280
281 #ifdef INTERPRETER
282 void _Jv_InitField (jobject, jclass, int);
283 #endif
284
285 class _Jv_StackTrace;
286 class _Jv_BytecodeVerifier;
287 class java::io::VMObjectStreamClass;
288
289 void _Jv_sharedlib_register_hook (jclass klass);
290
291
292 class java::lang::Class : public java::lang::Object
293 {
294 public:
295 static jclass forName (jstring className, jboolean initialize,
296 java::lang::ClassLoader *loader);
297 static jclass forName (jstring className);
298 JArray<jclass> *getClasses (void);
299
300 java::lang::ClassLoader *getClassLoader (void);
301 private:
302 java::lang::ClassLoader *getClassLoader (jclass caller);
303 public:
304 // This is an internal method that circumvents the usual security
305 // checks when getting the class loader.
306 java::lang::ClassLoader *getClassLoaderInternal (void)
307 {
308 return loader;
309 }
310
311 java::lang::reflect::Constructor *getConstructor (JArray<jclass> *);
312 JArray<java::lang::reflect::Constructor *> *getConstructors (void);
313 java::lang::reflect::Constructor *getDeclaredConstructor (JArray<jclass> *);
314 JArray<java::lang::reflect::Constructor *> *getDeclaredConstructors (jboolean);
315 java::lang::reflect::Field *getDeclaredField (jstring);
316 JArray<java::lang::reflect::Field *> *getDeclaredFields ();
317 JArray<java::lang::reflect::Field *> *getDeclaredFields (jboolean);
318 java::lang::reflect::Method *getDeclaredMethod (jstring, JArray<jclass> *);
319 JArray<java::lang::reflect::Method *> *getDeclaredMethods (void);
320
321 JArray<jclass> *getDeclaredClasses (void);
322 JArray<jclass> *getDeclaredClasses (jboolean);
323 jclass getDeclaringClass (void);
324
325 java::lang::reflect::Field *getField (jstring);
326 private:
327 JArray<java::lang::reflect::Field *> internalGetFields ();
328 java::lang::reflect::Field *getField (jstring, jint);
329 jint _getMethods (JArray<java::lang::reflect::Method *> *result,
330 jint offset);
331 java::lang::reflect::Field *getPrivateField (jstring);
332 java::lang::reflect::Method *getPrivateMethod (jstring, JArray<jclass> *);
333 java::security::ProtectionDomain *getProtectionDomain0 ();
334
335 java::lang::reflect::Method *_getMethod (jstring, JArray<jclass> *);
336 java::lang::reflect::Method *_getDeclaredMethod (jstring, JArray<jclass> *);
337
338 public:
339 JArray<java::lang::reflect::Field *> *getFields (void);
340
341 JArray<jclass> *getInterfaces (void);
342
343 void getSignature (java::lang::StringBuffer *buffer);
344 static jstring getSignature (JArray<jclass> *, jboolean is_constructor);
345 JArray<java::lang::reflect::Method *> *getMethods (void);
346
347 inline jint getModifiers (void)
348 {
349 return accflags & java::lang::reflect::Modifier::ALL_FLAGS;
350 }
351
352 jstring getName (void);
353
354 java::net::URL *getResource (jstring resourceName);
355 java::io::InputStream *getResourceAsStream (jstring resourceName);
356 JArray<jobject> *getSigners (void);
357 void setSigners(JArray<jobject> *);
358
359 inline jclass getSuperclass (void)
360 {
361 return superclass;
362 }
363
364 inline jclass getInterface (jint n)
365 {
366 return interfaces[n];
367 }
368
369 inline jboolean isArray (void)
370 {
371 return name->first() == '[';
372 }
373
374 inline jclass getComponentType (void)
375 {
376 return isArray () ? element_type : 0;
377 }
378
379 jboolean isAssignableFrom (jclass cls);
380 jboolean isInstance (jobject obj);
381
382 inline jboolean isInterface (void)
383 {
384 return (accflags & java::lang::reflect::Modifier::INTERFACE) != 0;
385 }
386
387 inline jboolean isPrimitive (void)
388 {
389 return vtable == JV_PRIMITIVE_VTABLE;
390 }
391
392 jobject newInstance (void);
393 java::security::ProtectionDomain *getProtectionDomain (void);
394 java::lang::Package *getPackage (void);
395 jstring toString (void);
396 jboolean desiredAssertionStatus (void);
397
398 // FIXME: this probably shouldn't be public.
399 jint size (void)
400 {
401 return size_in_bytes;
402 }
403
404 // The index of the first method we declare ourself (as opposed to
405 // inheriting).
406 inline jint firstMethodIndex (void)
407 {
408 return vtable_method_count - method_count;
409 }
410
411 // finalization
412 void finalize ();
413
414 // This constructor is used to create Class object for the primitive
415 // types. See prims.cc.
416 Class ();
417
418 static java::lang::Class class$;
419
420 private:
421
422 void memberAccessCheck (jint flags);
423
424 void initializeClass (void);
425
426 static jstring getPackagePortion (jstring);
427
428 void set_state (jint nstate)
429 {
430 state = nstate;
431 notifyAll ();
432 }
433
434 // Friend functions implemented in natClass.cc.
435 friend _Jv_Method *::_Jv_GetMethodLocal (jclass klass, _Jv_Utf8Const *name,
436 _Jv_Utf8Const *signature);
437 friend jboolean (::_Jv_IsAssignableFrom) (jclass, jclass);
438 friend jboolean (::_Jv_IsAssignableFromSlow) (jclass, jclass);
439 friend jboolean (::_Jv_InterfaceAssignableFrom) (jclass, jclass);
440 friend void *::_Jv_LookupInterfaceMethodIdx (jclass klass, jclass iface,
441 int method_idx);
442
443 friend void ::_Jv_InitClass (jclass klass);
444 friend java::lang::Class* ::_Jv_NewClassFromInitializer (const jclass class_initializer);
445 friend void _Jv_RegisterNewClasses (void **classes);
446
447 friend _Jv_Method* ::_Jv_LookupDeclaredMethod (jclass, _Jv_Utf8Const *,
448 _Jv_Utf8Const*, jclass *);
449 friend jfieldID (::JvGetFirstInstanceField) (jclass);
450 friend jint (::JvNumInstanceFields) (jclass);
451 friend jfieldID (::JvGetFirstStaticField) (jclass);
452 friend jint (::JvNumStaticFields) (jclass);
453
454 friend jobject (::_Jv_AllocObject) (jclass);
455 friend void *::_Jv_AllocObj (jint, jclass);
456 friend void *::_Jv_AllocPtrFreeObj (jint, jclass);
457 friend void *::_Jv_AllocArray (jint, jclass);
458
459 friend jobject (::_Jv_JNI_ToReflectedField) (_Jv_JNIEnv *, jclass, jfieldID,
460 jboolean);
461 friend jobject (::_Jv_JNI_ToReflectedMethod) (_Jv_JNIEnv *, jclass, jmethodID,
462 jboolean);
463 friend jfieldID (::_Jv_FromReflectedField) (java::lang::reflect::Field *);
464
465 friend jmethodID (::_Jv_FromReflectedMethod) (java::lang::reflect::Method *);
466 friend jmethodID (::_Jv_FromReflectedConstructor) (java::lang::reflect::Constructor *);
467 friend jint (::JvNumMethods) (jclass);
468 friend jmethodID (::JvGetFirstMethod) (jclass);
469 #ifdef INTERPRETER
470 friend _Jv_InterpMethod* (::_Jv_FindInterpreterMethod) (jclass klass,
471 jmethodID desired_method);
472 #endif
473
474 // Friends classes and functions to implement the ClassLoader
475 friend class java::lang::ClassLoader;
476 friend class java::lang::VMClassLoader;
477
478 friend class java::io::ObjectOutputStream;
479 friend class java::io::ObjectInputStream;
480 friend class java::io::ObjectStreamClass;
481
482 friend void ::_Jv_RegisterClasses (const jclass *classes);
483 friend void ::_Jv_RegisterClasses_Counted (const jclass *classes,
484 size_t count);
485 friend void ::_Jv_RegisterClassHookDefault (jclass klass);
486 friend void ::_Jv_RegisterInitiatingLoader (jclass,java::lang::ClassLoader*);
487 friend void ::_Jv_UnregisterInitiatingLoader (jclass,java::lang::ClassLoader*);
488 friend void ::_Jv_UnregisterClass (jclass);
489 friend jclass (::_Jv_FindClassNoException) (_Jv_Utf8Const *name,
490 java::lang::ClassLoader *loader);
491 friend jclass (::_Jv_FindClass) (_Jv_Utf8Const *name,
492 java::lang::ClassLoader *loader);
493 friend jclass (::_Jv_FindClassInCache) (_Jv_Utf8Const *name);
494 friend jclass (::_Jv_PopClass) (void);
495 friend void ::_Jv_PushClass (jclass k);
496 friend void ::_Jv_NewArrayClass (jclass element,
497 java::lang::ClassLoader *loader,
498 _Jv_VTable *array_vtable);
499 friend jclass (::_Jv_NewClass) (_Jv_Utf8Const *name, jclass superclass,
500 java::lang::ClassLoader *loader);
501 friend void ::_Jv_InitNewClassFields (jclass klass);
502
503 // in prims.cc
504 friend void ::_Jv_InitPrimClass (jclass, const char *, char, int);
505
506 friend jstring (::_Jv_GetMethodString) (jclass, _Jv_Method *, jclass);
507
508 friend jboolean (::_Jv_CheckAccess) (jclass self_klass, jclass other_klass,
509 jint flags);
510
511 friend bool (::_Jv_getInterfaceMethod) (jclass, jclass&, int&,
512 const _Jv_Utf8Const*,
513 const _Jv_Utf8Const*);
514
515 friend jclass (::_Jv_GetArrayClass) (jclass klass,
516 java::lang::ClassLoader *loader);
517
518 friend jboolean (::_Jv_IsInterpretedClass) (jclass);
519 friend jboolean (::_Jv_IsBinaryCompatibilityABI) (jclass);
520
521 friend jboolean (::_Jv_IsPhantomClass) (jclass);
522
523 #ifdef INTERPRETER
524 friend void ::_Jv_InitField (jobject, jclass, int);
525
526 friend class ::_Jv_ClassReader;
527 friend class ::_Jv_InterpClass;
528 friend class ::_Jv_InterpMethod;
529 #endif
530 friend class ::_Jv_StackTrace;
531
532 #ifdef JV_MARKOBJ_DECL
533 friend JV_MARKOBJ_DECL;
534 #endif
535
536 friend class ::_Jv_BytecodeVerifier;
537 friend class java::io::VMObjectStreamClass;
538
539 friend class ::_Jv_Linker;
540 friend class ::_Jv_ExecutionEngine;
541 friend class ::_Jv_CompiledEngine;
542 friend class ::_Jv_IndirectCompiledEngine;
543 friend class ::_Jv_InterpreterEngine;
544
545 friend void ::_Jv_sharedlib_register_hook (jclass klass);
546
547 friend void *::_Jv_ResolvePoolEntry (jclass this_class, jint index);
548
549 friend void ::_Jv_CopyClassesToSystemLoader (gnu::gcj::runtime::SystemClassLoader *);
550
551 // Chain for class pool. This also doubles as the ABI version
552 // number. It is only used for this purpose at class registration
553 // time, and only for precompiled classes.
554 jclass next_or_version;
555 // Name of class.
556 _Jv_Utf8Const *name;
557 // Access flags for class.
558 _Jv_ushort accflags;
559 // The superclass, or null for Object.
560 jclass superclass;
561 // Class constants.
562 _Jv_Constants constants;
563 // Methods. If this is an array class, then this field holds a
564 // pointer to the element type.
565 union
566 {
567 _Jv_Method *methods;
568 jclass element_type;
569 };
570 // Number of methods. If this class is primitive, this holds the
571 // character used to represent this type in a signature.
572 jshort method_count;
573 // Number of methods in the vtable.
574 jshort vtable_method_count;
575 // The fields.
576 _Jv_Field *fields;
577 // Size of instance fields, in bytes.
578 jint size_in_bytes;
579 // Total number of fields (instance and static).
580 jshort field_count;
581 // Number of static fields.
582 jshort static_field_count;
583 // The vtbl for all objects of this class.
584 _Jv_VTable *vtable;
585 // Virtual method offset table.
586 _Jv_OffsetTable *otable;
587 // Offset table symbols.
588 _Jv_MethodSymbol *otable_syms;
589 // Address table
590 _Jv_AddressTable *atable;
591 _Jv_MethodSymbol *atable_syms;
592 // Interface table
593 _Jv_AddressTable *itable;
594 _Jv_MethodSymbol *itable_syms;
595 _Jv_CatchClass *catch_classes;
596 // Interfaces implemented by this class.
597 jclass *interfaces;
598 // The class loader for this class.
599 java::lang::ClassLoader *loader;
600 // Number of interfaces.
601 jshort interface_count;
602 // State of this class.
603 jbyte state;
604 // The thread which has locked this class. Used during class
605 // initialization.
606 java::lang::Thread *thread;
607 // How many levels of "extends" this class is removed from Object.
608 jshort depth;
609 // Vector of this class's superclasses, ordered by decreasing depth.
610 jclass *ancestors;
611 // In a regular class, this field points to the Class Interface Dispatch
612 // Table. In an interface, it points to the ioffsets table.
613 union
614 {
615 _Jv_IDispatchTable *idt;
616 jshort *ioffsets;
617 };
618 // Pointer to the class that represents an array of this class.
619 jclass arrayclass;
620 // Security Domain to which this class belongs (or null).
621 java::security::ProtectionDomain *protectionDomain;
622 // Pointer to the type assertion table for this class.
623 _Jv_TypeAssertion *assertion_table;
624 // Signers of this class (or null).
625 JArray<jobject> *hack_signers;
626 // Used by Jv_PopClass and _Jv_PushClass to communicate with StackTrace.
627 jclass chain;
628 // Additional data, specific to the generator (JIT, native,
629 // interpreter) of this class.
630 void *aux_info;
631 // Execution engine.
632 _Jv_ExecutionEngine *engine;
633 };
634
635 // Inline functions that are friends of java::lang::Class
636
637 inline void _Jv_InitClass (jclass klass)
638 {
639 if (__builtin_expect (klass->state == JV_STATE_DONE, true))
640 return;
641 klass->initializeClass ();
642 }
643
644 // Return array class corresponding to element type KLASS, creating it if
645 // necessary.
646 inline jclass
647 _Jv_GetArrayClass (jclass klass, java::lang::ClassLoader *loader)
648 {
649 extern void _Jv_NewArrayClass (jclass element,
650 java::lang::ClassLoader *loader,
651 _Jv_VTable *array_vtable = 0);
652 if (__builtin_expect (!klass->arrayclass, false))
653 _Jv_NewArrayClass (klass, loader);
654 return klass->arrayclass;
655 }
656
657 #endif /* __JAVA_LANG_CLASS_H__ */