e732a1482c45e88aa73d7bd0ea3126cd311b2983
[cacao.git] / src / vm / loader.h
1 /******************************* loader.h **************************************
2
3         Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
4
5         See file COPYRIGHT for information on usage and disclaimer of warranties
6
7         Contains the prototypes for the class loader.
8
9         Author:  Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
10
11         Last Change: 1997/11/14
12
13 *******************************************************************************/
14
15
16
17 /************************* program switches ***********************************/
18
19 extern bool loadverbose;         /* Print debug messages during loading */
20 extern bool linkverbose;
21 extern bool initverbose;         /* Log class initialization */ 
22 extern bool makeinitializations; /* Initialize classes automatically */
23
24 extern bool getloadingtime;
25 extern long int loadingtime;     /* CPU time for class loading */
26
27 extern list unlinkedclasses;     /* List containing all unlinked classes */
28 extern list linkedclasses;       /* List containing all linked classes */
29
30
31 /************************ prototypes ******************************************/
32
33 /* initialize laoder, load important systemclasses */
34 void loader_init ();
35
36 void suck_init(char *cpath);
37
38 /* free resources */
39 void loader_close ();
40
41 /* load a class and all referenced classes */
42 classinfo *loader_load (utf *topname);
43
44 /* initializes all loaded classes */
45 void loader_initclasses ();
46
47 void loader_compute_subclasses ();
48
49 /* retrieve constantpool element */
50 voidptr class_getconstant (classinfo *class, u4 pos, u4 ctype);
51
52 /* determine type of a constantpool element */
53 u4 class_constanttype (classinfo *class, u4 pos);
54
55 /* search class for a field */
56 fieldinfo *class_findfield (classinfo *c, utf *name, utf *desc);
57
58 /* search for a method with a specified name and descriptor */
59 methodinfo *class_findmethod (classinfo *c, utf *name, utf *desc);
60 methodinfo *class_resolvemethod (classinfo *c, utf *name, utf *dest);
61
62 /* search for a method with specified name and arguments (returntype ignored) */
63 methodinfo *class_findmethod_approx (classinfo *c, utf *name, utf *desc);
64 methodinfo *class_resolvemethod_approx (classinfo *c, utf *name, utf *dest);
65
66 bool class_issubclass (classinfo *sub, classinfo *super);
67
68 /* call initializer of class */
69 void class_init (classinfo *c);
70
71 /* debug purposes */
72 void class_showmethods (classinfo *c);
73 void class_showconstantpool (classinfo *c);
74
75 /* set buffer for reading classdata */
76 void classload_buffer(u1 *buf,int len);
77
78 /* create class representing specific arraytype */
79 classinfo *create_array_class(utf *u);
80
81 /* create the arraydescriptor for the arraytype specified by the utf-string */
82 constant_arraydescriptor * buildarraydescriptor(char *utf, u4 namelen);
83
84 extern void class_link (classinfo *c);
85
86 void field_display (fieldinfo *f);
87
88 void method_display(methodinfo *m);