* src/vm/builtin.c: Moved to .cpp.
[cacao.git] / src / vm / field.h
1 /* src/vm/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/descriptor.h"
38 #include "vm/class.h"
39 #include "vm/global.h"
40 #include "vm/loader.h"
41 #include "vm/references.h"
42 #include "vm/utf8.h"
43
44
45 /* fieldinfo ******************************************************************/
46
47 struct fieldinfo {            /* field of a class                                 */
48
49         /* CAUTION: The first field must be a pointer that is never the same      */
50         /*          value as CLASSREF_PSEUDO_VFTBL! This is used to check whether */
51         /*          a constant_FMIref has been resolved.                          */
52
53         classinfo *clazz;     /* needed by typechecker. Could be optimized        */
54                               /* away by using constant_FMIref instead of         */
55                               /* fieldinfo throughout the compiler.               */
56
57         s4         flags;     /* ACC flags                                        */
58         s4         type;      /* basic data type                                  */
59         utf       *name;      /* name of field                                    */
60         utf       *descriptor;/* JavaVM descriptor string of field                */
61         utf       *signature; /* Signature attribute string                       */
62         typedesc  *parseddesc;/* parsed descriptor                                */
63
64         int32_t    offset;    /* offset from start of object (instance variables) */
65         imm_union *value;     /* storage for static values (class variables)      */
66 };
67
68
69 /* function prototypes ********************************************************/
70
71 bool       field_load(classbuffer *cb, fieldinfo *f, descriptor_pool *descpool);
72 classinfo *field_get_type(fieldinfo *f);
73 void       field_free(fieldinfo *f);
74
75 java_handle_bytearray_t *field_get_annotations(fieldinfo *f);
76
77 #if !defined(NDEBUG)
78 void field_printflags(fieldinfo *f);
79 void field_print(fieldinfo *f);
80 void field_println(fieldinfo *f);
81 void field_fieldref_print(constant_FMIref *fr);
82 void field_fieldref_println(constant_FMIref *fr);
83 #endif
84
85 #endif /* _FIELD_H */
86
87
88 /*
89  * These are local overrides for various environment variables in Emacs.
90  * Please do not remove this and leave it at the end of the file, where
91  * Emacs will automagically detect them.
92  * ---------------------------------------------------------------------
93  * Local variables:
94  * mode: c
95  * indent-tabs-mode: t
96  * c-basic-offset: 4
97  * tab-width: 4
98  * End:
99  */