55 // 56 // Short (<32-bit) counters are designed to overflow to a known "saturated" 57 // state. Also, certain recorded per-BCI events are given one-bit counters 58 // which overflow to a saturated state which applied to all counters at 59 // that BCI. In other words, there is a small lattice which approximates 60 // the ideal of an infinite-precision counter for each event at each BCI, 61 // and the lattice quickly "bottoms out" in a state where all counters 62 // are taken to be indefinitely large. 63 // 64 // The reader will find many data races in profile gathering code, starting 65 // with invocation counter incrementation. None of these races harm correct 66 // execution of the compiled code. 67 68 // forward decl 69 class ProfileData; 70 71 // DataLayout 72 // 73 // Overlay for generic profiling data. 74 class DataLayout VALUE_OBJ_CLASS_SPEC { 75 private: 76 // Every data layout begins with a header. This header 77 // contains a tag, which is used to indicate the size/layout 78 // of the data, 4 bits of flags, which can be used in any way, 79 // 4 bits of trap history (none/one reason/many reasons), 80 // and a bci, which is used to tie this piece of data to a 81 // specific bci in the bytecodes. 82 union { 83 intptr_t _bits; 84 struct { 85 u1 _tag; 86 u1 _flags; 87 u2 _bci; 88 } _struct; 89 } _header; 90 91 // The data layout has an arbitrary number of cells, each sized 92 // to accomodate a pointer or an integer. 93 intptr_t _cells[1]; 94 | 55 // 56 // Short (<32-bit) counters are designed to overflow to a known "saturated" 57 // state. Also, certain recorded per-BCI events are given one-bit counters 58 // which overflow to a saturated state which applied to all counters at 59 // that BCI. In other words, there is a small lattice which approximates 60 // the ideal of an infinite-precision counter for each event at each BCI, 61 // and the lattice quickly "bottoms out" in a state where all counters 62 // are taken to be indefinitely large. 63 // 64 // The reader will find many data races in profile gathering code, starting 65 // with invocation counter incrementation. None of these races harm correct 66 // execution of the compiled code. 67 68 // forward decl 69 class ProfileData; 70 71 // DataLayout 72 // 73 // Overlay for generic profiling data. 74 class DataLayout VALUE_OBJ_CLASS_SPEC { 75 friend class VMStructs; 76 77 private: 78 // Every data layout begins with a header. This header 79 // contains a tag, which is used to indicate the size/layout 80 // of the data, 4 bits of flags, which can be used in any way, 81 // 4 bits of trap history (none/one reason/many reasons), 82 // and a bci, which is used to tie this piece of data to a 83 // specific bci in the bytecodes. 84 union { 85 intptr_t _bits; 86 struct { 87 u1 _tag; 88 u1 _flags; 89 u2 _bci; 90 } _struct; 91 } _header; 92 93 // The data layout has an arbitrary number of cells, each sized 94 // to accomodate a pointer or an integer. 95 intptr_t _cells[1]; 96 |