src/share/vm/code/relocInfo.hpp

Print this page
rev 4739 : Remove breakpoint_Relocation.

*** 47,59 **** // A ValueObj type which acts as a union holding a Relocation object. // Represents a relocation spec passed into a CodeBuffer during assembly. // RelocIterator // A StackObj which iterates over the relocations associated with // a range of code addresses. Can be used to operate a copy of code. - // PatchingRelocIterator - // Specialized subtype of RelocIterator which removes breakpoints - // temporarily during iteration, then restores them. // BoundRelocation // An _internal_ type shared by packers and unpackers of relocations. // It pastes together a RelocationHolder with some pointers into // code and relocInfo streams. --- 47,56 ----
*** 202,220 **** // upon entry to the VEP of the compiled method. In the case of a // machine (Intel) with a single set-oop instruction, the 32-bit // immediate field must not straddle a unit of memory coherence. // //%note reloc_3 // - // relocInfo::breakpoint_type -- a conditional breakpoint in the code - // Value: none - // Instruction types: any whatsoever - // Data: [b [T]t i...] - // The b is a bit-packed word representing the breakpoint's attributes. - // The t is a target address which the breakpoint calls (when it is enabled). - // The i... is a place to store one or two instruction words overwritten - // by a trap, so that the breakpoint may be subsequently removed. - // // relocInfo::static_stub_type -- an extra stub for each static_call_type // Value: none // Instruction types: a virtual call: { set_oop; jump; } // Data: [[N]n] the offset of the associated static_call reloc // This stub becomes the target of a static call which must be upgraded --- 199,208 ----
*** 269,281 **** external_word_type = 7, // reference to fixed external address internal_word_type = 8, // reference within the current code blob section_word_type = 9, // internal, but a cross-section reference poll_type = 10, // polling instruction for safepoints poll_return_type = 11, // polling instruction for safepoints at return ! breakpoint_type = 12, // an initialization barrier or safepoint ! metadata_type = 13, // metadata that used to be oops ! yet_unused_type_2 = 14, // Still unused data_prefix_tag = 15, // tag for a prefix (carries data arguments) type_mask = 15 // A mask which selects only the above values }; protected: --- 257,269 ---- external_word_type = 7, // reference to fixed external address internal_word_type = 8, // reference within the current code blob section_word_type = 9, // internal, but a cross-section reference poll_type = 10, // polling instruction for safepoints poll_return_type = 11, // polling instruction for safepoints at return ! metadata_type = 12, // metadata that used to be oops ! yet_unused_type_2 = 13, // Still unused ! yet_unused_type_1 = 14, // Still unused data_prefix_tag = 15, // tag for a prefix (carries data arguments) type_mask = 15 // A mask which selects only the above values }; protected:
*** 310,320 **** visitor(runtime_call) \ visitor(external_word) \ visitor(internal_word) \ visitor(poll) \ visitor(poll_return) \ - visitor(breakpoint) \ visitor(section_word) \ public: enum { --- 298,307 ----
*** 452,462 **** format_mask = (1<<format_width) - 1 }; public: enum { // Conservatively large estimate of maximum length (in shorts) ! // of any relocation record (probably breakpoints are largest). // Extended format is length prefix, data words, and tag/offset suffix. length_limit = 1 + 1 + (3*BytesPerWord/BytesPerShort) + 1, have_format = format_width > 0 }; }; --- 439,449 ---- format_mask = (1<<format_width) - 1 }; public: enum { // Conservatively large estimate of maximum length (in shorts) ! // of any relocation record. // Extended format is length prefix, data words, and tag/offset suffix. length_limit = 1 + 1 + (3*BytesPerWord/BytesPerShort) + 1, have_format = format_width > 0 }; };
*** 569,580 **** void initialize_misc(); void initialize(nmethod* nm, address begin, address limit); - friend class PatchingRelocIterator; - // make an uninitialized one, for PatchingRelocIterator: RelocIterator() { initialize_misc(); } public: // constructor RelocIterator(nmethod* nm, address begin = NULL, address limit = NULL); --- 556,565 ----
*** 777,789 **** // platform-dependent utilities for decoding and patching instructions void pd_set_data_value (address x, intptr_t off, bool verify_only = false); // a set or mem-ref void pd_verify_data_value (address x, intptr_t off) { pd_set_data_value(x, off, true); } address pd_call_destination (address orig_addr = NULL); void pd_set_call_destination (address x); - void pd_swap_in_breakpoint (address x, short* instrs, int instrlen); - void pd_swap_out_breakpoint (address x, short* instrs, int instrlen); - static int pd_breakpoint_size (); // this extracts the address of an address in the code stream instead of the reloc data address* pd_address_in_code (); // this extracts an address from the code stream instead of the reloc data --- 762,771 ----
*** 1300,1390 **** bool is_data() { return true; } relocInfo::relocType type() { return relocInfo::poll_return_type; } void fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest); }; - - class breakpoint_Relocation : public Relocation { - relocInfo::relocType type() { return relocInfo::breakpoint_type; } - - enum { - // attributes which affect the interpretation of the data: - removable_attr = 0x0010, // buffer [i...] allows for undoing the trap - internal_attr = 0x0020, // the target is an internal addr (local stub) - settable_attr = 0x0040, // the target is settable - - // states which can change over time: - enabled_state = 0x0100, // breakpoint must be active in running code - active_state = 0x0200, // breakpoint instruction actually in code - - kind_mask = 0x000F, // mask for extracting kind - high_bit = 0x4000 // extra bit which is always set - }; - - public: - enum { - // kinds: - initialization = 1, - safepoint = 2 - }; - - // If target is NULL, 32 bits are reserved for a later set_target(). - static RelocationHolder spec(int kind, address target = NULL, bool internal_target = false) { - RelocationHolder rh = newHolder(); - new(rh) breakpoint_Relocation(kind, target, internal_target); - return rh; - } - - private: - // We require every bits value to NOT to fit into relocInfo::datalen_width, - // because we are going to actually store state in the reloc, and so - // cannot allow it to be compressed (and hence copied by the iterator). - - short _bits; // bit-encoded kind, attrs, & state - address _target; - - breakpoint_Relocation(int kind, address target, bool internal_target); - - friend class RelocIterator; - breakpoint_Relocation() { } - - short bits() const { return _bits; } - short& live_bits() const { return data()[0]; } - short* instrs() const { return data() + datalen() - instrlen(); } - int instrlen() const { return removable() ? pd_breakpoint_size() : 0; } - - void set_bits(short x) { - assert(live_bits() == _bits, "must be the only mutator of reloc info"); - live_bits() = _bits = x; - } - - public: - address target() const; - void set_target(address x); - - int kind() const { return bits() & kind_mask; } - bool enabled() const { return (bits() & enabled_state) != 0; } - bool active() const { return (bits() & active_state) != 0; } - bool internal() const { return (bits() & internal_attr) != 0; } - bool removable() const { return (bits() & removable_attr) != 0; } - bool settable() const { return (bits() & settable_attr) != 0; } - - void set_enabled(bool b); // to activate, you must also say set_active - void set_active(bool b); // actually inserts bpt (must be enabled 1st) - - // data is packed as 16 bits, followed by the target (1 or 2 words), followed - // if necessary by empty storage for saving away original instruction bytes. - void pack_data_to(CodeSection* dest); - void unpack_data(); - - // during certain operations, breakpoints must be out of the way: - void fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { - assert(!active(), "cannot perform relocation on enabled breakpoints"); - } - }; - - // We know all the xxx_Relocation classes, so now we can define these: #define EACH_CASE(name) \ inline name##_Relocation* RelocIterator::name##_reloc() { \ assert(type() == relocInfo::name##_type, "type must agree"); \ /* The purpose of the placed "new" is to re-use the same */ \ --- 1282,1291 ----
*** 1399,1425 **** inline RelocIterator::RelocIterator(nmethod* nm, address begin, address limit) { initialize(nm, begin, limit); } - // if you are going to patch code, you should use this subclass of - // RelocIterator - class PatchingRelocIterator : public RelocIterator { - private: - RelocIterator _init_state; - - void prepass(); // deactivates all breakpoints - void postpass(); // reactivates all enabled breakpoints - - // do not copy these puppies; it would have unpredictable side effects - // these are private and have no bodies defined because they should not be called - PatchingRelocIterator(const RelocIterator&); - void operator=(const RelocIterator&); - - public: - PatchingRelocIterator(nmethod* nm, address begin = NULL, address limit = NULL) - : RelocIterator(nm, begin, limit) { prepass(); } - - ~PatchingRelocIterator() { postpass(); } - }; - #endif // SHARE_VM_CODE_RELOCINFO_HPP --- 1300,1305 ----