Debian Codegraph @

rpython/translator/c/src/llgroup.h

raw symbols SCIP
1 #ifndef _PYPY_LL_GROUP_H_
2 #define _PYPY_LL_GROUP_H_
3
4 /* Support code for CombinedSymbolics */
5
6
7 #if PYPY_LONG_BIT == 32 /************************************/
8 /* On 32-bit platforms, a CombinedSymbolic is two USHORTs, and the
9 lower one stores the offset inside the group, divided by 4. The
10 limitation is to have at most 256KB of data in the whole group. */
11
12 typedef unsigned short pypy_halfword_t;
13
14 #define GROUP_MEMBER_OFFSET(grouptype, membername) \
15 ((unsigned short)(((long)&((grouptype*)NULL)->membername) / 4))
16
17 #define _OP_GET_GROUP_MEMBER(groupptr, compactoffset) \
18 (((char*)groupptr) + ((long)compactoffset)*4)
19
20 #define _OP_GET_NEXT_GROUP_MEMBER(groupptr, compactoffset, skipoffset) \
21 ((((char*)groupptr) + skipoffset) + ((long)compactoffset)*4)
22
23 /* A macro to crash at compile-time if sizeof(group) is too large.
24 Uses a hack that I've found on some random forum. Haaaaaaaaaackish. */
25 #define PYPY_GROUP_CHECK_SIZE(groupname) \
26 typedef char group_##groupname##_is_too_large[ \
27 2*(sizeof(groupname) <= 65536*4)-1];
28
29
30 #else /******************************************************/
31 /* On 64-bit platforms, a CombinedSymbolic is two UINTs, and the lower
32 one is an 32-bit offset from the start of the group. */
33
34 typedef unsigned int pypy_halfword_t;
35
36 #define GROUP_MEMBER_OFFSET(grouptype, membername) \
37 offsetof(grouptype, membername)
38
39 #define _OP_GET_GROUP_MEMBER(groupptr, compactoffset) \
40 (((char*)groupptr) + (long)compactoffset)
41
42 #define _OP_GET_NEXT_GROUP_MEMBER(groupptr, compactoffset, skipoffset) \
43 (((char*)groupptr) + skipoffset + (long)compactoffset)
44
45 /* A macro to crash at compile-time if sizeof(group) is too large.
46 Uses a hack that I've found on some random forum. Haaaaaaaaaackish. */
47 #define PYPY_GROUP_CHECK_SIZE(groupname) \
48 typedef char group_##groupname##_is_too_large[ \
49 2*(sizeof(groupname) <= 4294967296L)-1];
50
51
52 #endif /*****************************************************/
53
54
55 #define OP_IS_GROUP_MEMBER_NONZERO(compactoffset, r) \
56 r = (compactoffset != 0)
57
58 #define OP_EXTRACT_USHORT(value, r) r = (pypy_halfword_t)value
59 #define OP_COMBINE_USHORT(ushort, rest, r) r = ((long)ushort) | rest
60
61 #endif /* _PYPY_LL_GROUP_H_ */