| Index: runtime/vm/raw_object.h
|
| ===================================================================
|
| --- runtime/vm/raw_object.h (revision 37878)
|
| +++ runtime/vm/raw_object.h (working copy)
|
| @@ -852,16 +852,17 @@
|
|
|
| // Compilation timestamp.
|
| int64_t compile_timestamp_;
|
| - intptr_t pointer_offsets_length_;
|
| +
|
| + // state_bits_ is a bitfield with three fields:
|
| + // The optimized bit, the alive bit, and a count of the number of pointer
|
| + // offsets.
|
| // Alive: If true, the embedded object pointers will be visited during GC.
|
| - // This field cannot be shorter because of alignment issues on x64
|
| - // architectures.
|
| - intptr_t state_bits_; // state, is_optimized, is_alive.
|
| + int32_t state_bits_;
|
|
|
| // PC offsets for code patching.
|
| - intptr_t entry_patch_pc_offset_;
|
| - intptr_t patch_code_pc_offset_;
|
| - intptr_t lazy_deopt_pc_offset_;
|
| + int32_t entry_patch_pc_offset_;
|
| + int32_t patch_code_pc_offset_;
|
| + int32_t lazy_deopt_pc_offset_;
|
|
|
| // Variable length data follows here.
|
| int32_t* data() { OPEN_ARRAY_START(int32_t, int32_t); }
|
| @@ -883,7 +884,7 @@
|
| RawObject** to() {
|
| return reinterpret_cast<RawObject**>(&ptr()->object_pool_);
|
| }
|
| - intptr_t size_;
|
| + int32_t size_;
|
|
|
| // Variable length data follows here.
|
| uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
|
| @@ -904,7 +905,7 @@
|
| class RawPcDescriptors : public RawObject {
|
| RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors);
|
|
|
| - intptr_t length_; // Number of descriptors.
|
| + int32_t length_; // Number of descriptors.
|
|
|
| struct PcDescriptorRec {
|
| uword pc;
|
| @@ -933,10 +934,12 @@
|
|
|
| // TODO(kmillikin): We need a small number of bits to encode the register
|
| // count. Consider packing them in with the length.
|
| - intptr_t length_; // Length of payload, in bits.
|
| - intptr_t register_bit_count_; // Live register bits, included in length_.
|
| + int32_t length_; // Length of payload, in bits.
|
| + int32_t register_bit_count_; // Live register bits, included in length_.
|
|
|
| - uword pc_; // PC corresponding to this stack map representation.
|
| + // Offset from code entry point corresponding to this stack map
|
| + // representation.
|
| + uint32_t pc_offset_;
|
|
|
| // Variable length data follows here (bitmap of the stack layout).
|
| uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
|
| @@ -953,21 +956,52 @@
|
| kSavedCurrentContext
|
| };
|
|
|
| + enum {
|
| + kKindPos = 0,
|
| + kKindSize = 8,
|
| + kIndexPos = 9,
|
| + // Since there are 24 bits for the stack slot index, Functions can have
|
| + // only ~16.7 million stack slots.
|
| + kIndexSize = 24,
|
| + kMaxIndex = (1 << (kIndexSize - 1)) - 1,
|
| + };
|
| +
|
| + // The index can be < 0.
|
| + class IndexBits {
|
| + public:
|
| + static bool is_valid(int32_t val) {
|
| + return Utils::IsInt(24, val);
|
| + }
|
| + static int32_t update(int32_t val, int32_t orig) {
|
| + ASSERT(is_valid(val));
|
| + const int32_t v = val & ((1 << kIndexSize) - 1);
|
| + return Bits::update(v, orig);
|
| + }
|
| + static int32_t decode(int32_t val) {
|
| + const int32_t v = Bits::decode(val);
|
| + return (v << kIndexPos) >> kIndexPos; // Sign-extend.
|
| + }
|
| + private:
|
| + class Bits : public BitField<int32_t, kIndexPos, kIndexSize> {};
|
| + };
|
| +
|
| + class KindBits : public BitField<int8_t, kKindPos, kKindSize>{};
|
| +
|
| struct VarInfo {
|
| - intptr_t index; // Slot index on stack or in context.
|
| - intptr_t begin_pos; // Token position of scope start.
|
| - intptr_t end_pos; // Token position of scope end.
|
| + int32_t index_kind; // Bitfield for slot index on stack or in context,
|
| + // and Entry kind of type VarInfoKind.
|
| + int32_t begin_pos; // Token position of scope start.
|
| + int32_t end_pos; // Token position of scope end.
|
| int16_t scope_id; // Scope to which the variable belongs.
|
| - int8_t kind; // Entry kind of type VarInfoKind.
|
| };
|
|
|
| private:
|
| RAW_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors);
|
| - intptr_t length_; // Number of descriptors.
|
| RawArray* names_; // Array of [length_] variable names.
|
| + int32_t length_; // Number of descriptors.
|
|
|
| // Variable info with [length_] entries.
|
| - VarInfo* data() { OPEN_ARRAY_START(VarInfo, intptr_t); }
|
| + VarInfo* data() { OPEN_ARRAY_START(VarInfo, int32_t); }
|
| };
|
|
|
|
|
| @@ -986,7 +1020,7 @@
|
| RAW_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers);
|
|
|
| // Number of exception handler entries.
|
| - intptr_t length_;
|
| + int32_t length_;
|
|
|
| // Array with [length_] entries. Each entry is an array of all handled
|
| // exception types.
|
| @@ -1012,7 +1046,7 @@
|
| class RawContext : public RawObject {
|
| RAW_HEAP_OBJECT_IMPLEMENTATION(Context);
|
|
|
| - intptr_t num_variables_;
|
| + int32_t num_variables_;
|
| Isolate* isolate_;
|
|
|
| RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->parent_); }
|
| @@ -1031,7 +1065,7 @@
|
| class RawContextScope : public RawObject {
|
| RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope);
|
|
|
| - // TODO(iposva): Switch to convential enum offset based structure to avoid
|
| + // TODO(iposva): Switch to conventional enum offset based structure to avoid
|
| // alignment mishaps.
|
| struct VariableDesc {
|
| RawSmi* token_pos;
|
| @@ -1046,7 +1080,7 @@
|
| RawSmi* context_level;
|
| };
|
|
|
| - intptr_t num_variables_;
|
| + int32_t num_variables_;
|
|
|
| RawObject** from() {
|
| return reinterpret_cast<RawObject**>(&ptr()->data()[0]);
|
| @@ -1315,12 +1349,12 @@
|
| // Actual length in chunks at the time of allocation (later we may
|
| // clamp the operational length but we need to maintain a consistent
|
| // object length so that the object can be traversed during GC).
|
| - intptr_t allocated_length_;
|
| + int32_t allocated_length_;
|
|
|
| // Operational length in chunks of the bigint object, clamping can
|
| // cause this length to be reduced. If the signed_length_ is
|
| // negative then the number is negative.
|
| - intptr_t signed_length_;
|
| + int32_t signed_length_;
|
|
|
| // A sequence of Chunks (typedef in Bignum) representing bignum digits.
|
| // Bignum::Chunk chunks_[Utils::Abs(signed_length_)];
|
| @@ -1614,8 +1648,10 @@
|
| return reinterpret_cast<RawObject**>(&ptr()->pattern_);
|
| }
|
|
|
| - intptr_t type_; // Uninitialized, simple or complex.
|
| - intptr_t flags_; // Represents global/local, case insensitive, multiline.
|
| + // A bitfield with two fields:
|
| + // type: Uninitialized, simple or complex.
|
| + // flags: Represents global/local, case insensitive, multiline.
|
| + int8_t type_flags_;
|
|
|
| // Variable length data follows here.
|
| uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
|
|
|