anonymous on Tue Jul 28 18:01:16 2009, syntax: C++
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
class Item
{
public:

protected:
  union {
      struct {
         union {
            int32 val32;
            int64 val64;
            numeric number;
            Garbageable *content;

            struct {
               void *voidp;
               void *extra;
            } ptr;

            struct {
               GarbagePointer *gcptr;
               int32 signature;
            } gptr;

         } data;

         CallPoint *method;

         union {
            struct {
               byte type;         // <<<< Move this as third field
               byte flags;
               byte oldType;
               byte methodId;
            } bits;
            uint16 half;
            uint32 whole;
         } base;
      } ctx;

      struct {
         uint64 low;
         uint64 high;
      } parts;
   } all;

// ....
public:

//....

   inline void copy( const Item &other )
   {
      #ifdef _SPARC32_ITEM_HACK   // <<<<< do NOT define this
      register int32 *pthis, *pother;
      pthis = (int32*) this;
      pother = (int32*) &other;
      pthis[0]= pother[0];
      pthis[1]= pother[1];
      pthis[2]= pother[2];
      pthis[3]= pother[3];

      #else
         all = other.all;
      #endif
   }

   inline    byte type() const { return all.ctx.base.bits.type; }
   inline    void type( byte nt ) { all.ctx.base.bits.flags = 0; all.ctx.base.bits.type = nt; }
//...
};