CACAO
field.hpp
Go to the documentation of this file.
1 /* src/vm/field.hpp - field functions header
2 
3  Copyright (C) 1996-2013
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_HPP
27 #define _FIELD_HPP
28 
29 #include "config.h"
30 
31 #include <stdint.h> // for int32_t
32 
33 #include "vm/global.hpp" // for imm_union, etc
34 #include "vm/types.hpp" // for s4
35 #include "vm/utf8.hpp" // for Utf8String
36 
37 struct classbuffer;
38 struct classinfo;
39 struct constant_FMIref;
40 struct typedesc;
41 
42 namespace cacao {
43  struct ClassBuffer;
44  struct DescriptorPool;
45 }
46 
47 /* fieldinfo ******************************************************************/
48 
49 struct fieldinfo { /* field of a class */
50 
51  /* CAUTION: The first field must be a pointer that is never the same */
52  /* value as CLASSREF_PSEUDO_VFTBL! This is used to check whether */
53  /* a constant_FMIref has been resolved. */
54 
55  classinfo *clazz; /* needed by typechecker. Could be optimized */
56  /* away by using constant_FMIref instead of */
57  /* fieldinfo throughout the compiler. */
58 
59  s4 flags; /* ACC flags */
60  s4 type; /* basic data type */
61  Utf8String name; /* name of field */
62  Utf8String descriptor;/* JavaVM descriptor string of field */
63  Utf8String signature; /* Signature attribute string */
64  typedesc *parseddesc;/* parsed descriptor */
65 
66  int32_t offset; /* offset from start of object (instance variables) */
67  imm_union *value; /* storage for static values (class variables) */
68 };
69 
70 
71 /* function prototypes ********************************************************/
72 
75 void field_free(fieldinfo *f);
76 
78 
79 #if !defined(NDEBUG)
81 void field_print(fieldinfo *f);
82 void field_println(fieldinfo *f);
85 #endif
86 
87 #endif /* _FIELD_HPP */
88 
89 
90 /*
91  * These are local overrides for various environment variables in Emacs.
92  * Please do not remove this and leave it at the end of the file, where
93  * Emacs will automagically detect them.
94  * ---------------------------------------------------------------------
95  * Local variables:
96  * mode: c++
97  * indent-tabs-mode: t
98  * c-basic-offset: 4
99  * tab-width: 4
100  * End:
101  * vim:noexpandtab:sw=4:ts=4:
102  */
Utf8String name
Definition: field.hpp:61
classinfo * field_get_type(fieldinfo *f)
Definition: field.cpp:358
void field_println(fieldinfo *f)
Definition: field.cpp:508
void field_fieldref_print(constant_FMIref *fr)
Definition: field.cpp:522
Utf8String descriptor
Definition: field.hpp:62
int32_t offset
Definition: field.hpp:66
void field_free(fieldinfo *f)
Definition: field.cpp:390
void field_print(fieldinfo *f)
Definition: field.cpp:479
s4 flags
Definition: field.hpp:59
imm_union * value
Definition: field.hpp:67
typedesc * parseddesc
Definition: field.hpp:64
Fieldref, Methodref and InterfaceMethodref.
Definition: references.hpp:86
int32_t s4
Definition: types.hpp:45
classinfo * clazz
Definition: field.hpp:55
java_handle_bytearray_t * field_get_annotations(fieldinfo *f)
Definition: field.cpp:414
s4 type
Definition: field.hpp:60
bool field_load(ClassBuffer &cb, fieldinfo *f, DescriptorPool &descpool)
Definition: field.cpp:66
void field_printflags(fieldinfo *f)
Definition: field.cpp:450
void field_fieldref_println(constant_FMIref *fr)
Definition: field.cpp:551
Utf8String signature
Definition: field.hpp:63