class CodeBuffer; class Metadata; class MachConstantNode; class MachOper;
class ConstantTable { public: // Constant entry of the constant table. class Constant { private:
BasicType _type; bool _is_array; int _alignment; union {
jvalue _value;
Metadata* _metadata;
GrowableArray<jvalue>* _array;
} _v; int _offset; // offset of this constant (in bytes) relative to the constant table base. float _freq; bool _can_be_reused; // true (default) if the value can be shared with other users.
private:
GrowableArray<Constant> _constants; // Constants of this table. int _size; // Size in bytes the emitted constant table takes (including padding). int _table_base_offset; // Offset of the table base that gets added to the constant offsets. int _nof_jump_tables; // Number of jump-tables in this constant table.
staticint qsort_comparator(Constant* a, Constant* b);
// We use negative frequencies to keep the order of the // jump-tables in which they were added. Otherwise we get into // trouble with relocation. float next_jump_table_freq() { return -1.0f * (++_nof_jump_tables); }
public:
ConstantTable() :
_size(-1),
_table_base_offset(-1), // We can use -1 here since the constant table is always bigger than 2 bytes (-(size / 2), see MachConstantBaseNode::emit).
_nof_jump_tables(0)
{}
int calculate_table_base_offset() const; // AD specific void set_table_base_offset(int x) { assert(_table_base_offset == -1 || x == _table_base_offset, "can't change"); _table_base_offset = x; } int table_base_offset() const { assert(_table_base_offset != -1, "not set yet"); return _table_base_offset; }
bool emit(CodeBuffer& cb) const;
// Returns the offset of the last entry (the top) of the constant table. int top_offset() const { assert(_constants.top().offset() != -1, "not bound yet"); return _constants.top().offset(); }
void calculate_offsets_and_size(); int find_offset(Constant& con) const;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.