2014-11-07 Hristian Kirtchev <kirtchev@adacore.com>
[official-gcc.git] / libjava / include / java-cpool.h
blob412250230dfbe0f3319e7ea26824e4f6ab8cf0d9
1 // java-cpool.h - Constant pool parsing header. -*- c++ -*-
3 /* Copyright (C) 1999, 2000 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 details. */
11 #ifndef __JAVA_CPOOL_H__
12 #define __JAVA_CPOOL_H__
14 #include <gcj/javaprims.h>
16 // we rename these, to avoid polluting the name space
17 #define JV_CONSTANT_Undefined (0L)
18 #define JV_CONSTANT_Utf8 (1L)
19 #define JV_CONSTANT_Unicode (2L)
20 #define JV_CONSTANT_Integer (3L)
21 #define JV_CONSTANT_Float (4L)
22 #define JV_CONSTANT_Long (5L)
23 #define JV_CONSTANT_Double (6L)
24 #define JV_CONSTANT_Class (7L)
25 #define JV_CONSTANT_String (8L)
26 #define JV_CONSTANT_Fieldref (9L)
27 #define JV_CONSTANT_Methodref (10L)
28 #define JV_CONSTANT_InterfaceMethodref (11L)
29 #define JV_CONSTANT_NameAndType (12L)
30 #define JV_CONSTANT_ResolvedFlag (16L)
31 #define JV_CONSTANT_LazyFlag (32L)
32 #define JV_CONSTANT_ResolvedString (16L | 8L)
33 #define JV_CONSTANT_ResolvedClass (16L | 7L)
35 extern inline void
36 _Jv_storeIndexes (_Jv_word *data,
37 _Jv_ushort index0,
38 _Jv_ushort index1)
40 data->i = (((jint)index0) << 16) | (jint) index1;
43 extern inline void
44 _Jv_loadIndexes (const _Jv_word *data,
45 _Jv_ushort& index0,
46 _Jv_ushort& index1)
48 jint udata = data->i;
50 _Jv_uint uindex0 = ((udata >> 16) & 0xffff);
51 _Jv_uint uindex1 = udata & 0xffff;
53 index0 = uindex0;
54 index1 = uindex1;
57 extern inline void
58 _Jv_storeFloat (_Jv_word *data, jfloat f)
60 data->f = f;
63 extern inline jfloat
64 _Jv_loadFloat (_Jv_word *data)
66 return data->f;
69 extern inline void
70 _Jv_storeInt (_Jv_word *data, jint i)
72 data->i = i;
75 extern inline jint
76 _Jv_loadInt (_Jv_word *data)
78 return data->i;
81 extern inline void
82 _Jv_storeLong (_Jv_word *data, jlong l)
84 #if SIZEOF_VOID_P == 8
85 data[0].l = l;
86 #else
87 _Jv_word2 tmp;
88 tmp.l = l;
89 data[0].ia[0] = tmp.ia[0];
90 data[1].ia[0] = tmp.ia[1];
91 #endif
94 extern inline jlong
95 _Jv_loadLong (_Jv_word *data)
97 #if SIZEOF_VOID_P == 8
98 return data -> l;
99 #else
100 _Jv_word2 tmp;
101 tmp.ia[0] = data[0].ia[0];
102 tmp.ia[1] = data[1].ia[0];
103 return tmp.l;
104 #endif
107 extern inline void
108 _Jv_storeDouble (_Jv_word *data, jdouble d)
110 #if SIZEOF_VOID_P == 8
111 data[0].d = d;
112 #else
113 _Jv_word2 tmp;
114 tmp.d = d;
115 data[0].ia[0] = tmp.ia[0];
116 data[1].ia[0] = tmp.ia[1];
117 #endif
120 extern inline jdouble
121 _Jv_loadDouble (_Jv_word *data)
123 #if SIZEOF_VOID_P == 8
124 return data -> d;
125 #else
126 _Jv_word2 tmp;
127 tmp.ia[0] = data[0].ia[0];
128 tmp.ia[1] = data[1].ia[0];
129 return tmp.d;
130 #endif
134 #endif /* __JAVA_CPOOL_H__ */