Merged with tip.
[cacao.git] / src / vmcore / field.h
1 /* src/vmcore/field.h - field functions header
2
3    Copyright (C) 1996-2005, 2006, 2007, 2008
4    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5
6    This file is part of CACAO.
7
8    This program is free software; you can redistribute it and/or
9    modify it under the terms of the GNU General Public License as
10    published by the Free Software Foundation; either version 2, or (at
11    your option) any later version.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23 */
24
25
26 #ifndef _FIELD_H
27 #define _FIELD_H
28
29 /* forward typedefs ***********************************************************/
30
31 typedef struct fieldinfo fieldinfo; 
32
33
34 #include "config.h"
35 #include "vm/types.h"
36
37 #include "vm/global.h"
38
39 #include "vmcore/descriptor.h"
40 #include "vmcore/class.h"
41 #include "vmcore/loader.h"
42 #include "vmcore/references.h"
43 #include "vmcore/utf8.h"
44
45
46 /* fieldinfo ******************************************************************/
47
48 struct fieldinfo {            /* field of a class                                 */
49
50         /* CAUTION: The first field must be a pointer that is never the same      */
51         /*          value as CLASSREF_PSEUDO_VFTBL! This is used to check whether */
52         /*          a constant_FMIref has been resolved.                          */
53
54         classinfo *clazz;     /* needed by typechecker. Could be optimized        */
55                               /* away by using constant_FMIref instead of         */
56                               /* fieldinfo throughout the compiler.               */
57
58         s4         flags;     /* ACC flags                                        */
59         s4         type;      /* basic data type                                  */
60         utf       *name;      /* name of field                                    */
61         utf       *descriptor;/* JavaVM descriptor string of field                */
62         utf       *signature; /* Signature attribute string                       */
63         typedesc  *parseddesc;/* parsed descriptor                                */
64
65         int32_t    offset;    /* offset from start of object (instance variables) */
66         imm_union *value;     /* storage for static values (class variables)      */
67 };
68
69
70 /* function prototypes ********************************************************/
71
72 bool       field_load(classbuffer *cb, fieldinfo *f, descriptor_pool *descpool);
73 classinfo *field_get_type(fieldinfo *f);
74 void       field_free(fieldinfo *f);
75
76 java_handle_bytearray_t *field_get_annotations(fieldinfo *f);
77
78 #if !defined(NDEBUG)
79 void field_printflags(fieldinfo *f);
80 void field_print(fieldinfo *f);
81 void field_println(fieldinfo *f);
82 void field_fieldref_print(constant_FMIref *fr);
83 void field_fieldref_println(constant_FMIref *fr);
84 #endif
85
86 #endif /* _FIELD_H */
87
88
89 /*
90  * These are local overrides for various environment variables in Emacs.
91  * Please do not remove this and leave it at the end of the file, where
92  * Emacs will automagically detect them.
93  * ---------------------------------------------------------------------
94  * Local variables:
95  * mode: c
96  * indent-tabs-mode: t
97  * c-basic-offset: 4
98  * tab-width: 4
99  * End:
100  */