aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm
diff options
context:
space:
mode:
authorkvn <none@none>2013-06-27 11:12:19 -0700
committerkvn <none@none>2013-06-27 11:12:19 -0700
commit6454c3b2ff78ea26b74c6470bf34881a0ce669f5 (patch)
treeaf2b9d4bbdd7eb0bd1f2fc3253bd118a9876b49e /src/share/vm
parentaa045c8df0abe7e154d1a641d3ec156790aa5ddf (diff)
parente44f8f2ad1a78a68643a9cfca7198e5ad3f62894 (diff)
Merge
Diffstat (limited to 'src/share/vm')
-rw-r--r--src/share/vm/code/nmethod.cpp5
-rw-r--r--src/share/vm/code/relocInfo.cpp145
-rw-r--r--src/share/vm/code/relocInfo.hpp126
-rw-r--r--src/share/vm/interpreter/bytecodeInterpreter.cpp9
-rw-r--r--src/share/vm/opto/memnode.cpp18
5 files changed, 20 insertions, 283 deletions
diff --git a/src/share/vm/code/nmethod.cpp b/src/share/vm/code/nmethod.cpp
index 41eb628fb..1dfc3ba8f 100644
--- a/src/share/vm/code/nmethod.cpp
+++ b/src/share/vm/code/nmethod.cpp
@@ -1081,11 +1081,6 @@ void nmethod::fix_oop_relocations(address begin, address end, bool initialize_im
metadata_Relocation* reloc = iter.metadata_reloc();
reloc->fix_metadata_relocation();
}
-
- // There must not be any interfering patches or breakpoints.
- assert(!(iter.type() == relocInfo::breakpoint_type
- && iter.breakpoint_reloc()->active()),
- "no active breakpoint");
}
}
diff --git a/src/share/vm/code/relocInfo.cpp b/src/share/vm/code/relocInfo.cpp
index 679bc290a..4fe6a2e49 100644
--- a/src/share/vm/code/relocInfo.cpp
+++ b/src/share/vm/code/relocInfo.cpp
@@ -338,31 +338,6 @@ void RelocIterator::set_limit(address limit) {
_limit = limit;
}
-
-void PatchingRelocIterator:: prepass() {
- // turn breakpoints off during patching
- _init_state = (*this); // save cursor
- while (next()) {
- if (type() == relocInfo::breakpoint_type) {
- breakpoint_reloc()->set_active(false);
- }
- }
- (RelocIterator&)(*this) = _init_state; // reset cursor for client
-}
-
-
-void PatchingRelocIterator:: postpass() {
- // turn breakpoints back on after patching
- (RelocIterator&)(*this) = _init_state; // reset cursor again
- while (next()) {
- if (type() == relocInfo::breakpoint_type) {
- breakpoint_Relocation* bpt = breakpoint_reloc();
- bpt->set_active(bpt->enabled());
- }
- }
-}
-
-
// All the strange bit-encodings are in here.
// The idea is to encode relocation data which are small integers
// very efficiently (a single extra halfword). Larger chunks of
@@ -704,51 +679,6 @@ void section_word_Relocation::unpack_data() {
_target = address_from_scaled_offset(offset, base);
}
-
-void breakpoint_Relocation::pack_data_to(CodeSection* dest) {
- short* p = (short*) dest->locs_end();
- address point = dest->locs_point();
-
- *p++ = _bits;
-
- assert(_target != NULL, "sanity");
-
- if (internal()) normalize_address(_target, dest);
-
- jint target_bits =
- (jint)( internal() ? scaled_offset (_target, point)
- : runtime_address_to_index(_target) );
- if (settable()) {
- // save space for set_target later
- p = add_jint(p, target_bits);
- } else {
- p = add_var_int(p, target_bits);
- }
-
- for (int i = 0; i < instrlen(); i++) {
- // put placeholder words until bytes can be saved
- p = add_short(p, (short)0x7777);
- }
-
- dest->set_locs_end((relocInfo*) p);
-}
-
-
-void breakpoint_Relocation::unpack_data() {
- _bits = live_bits();
-
- int targetlen = datalen() - 1 - instrlen();
- jint target_bits = 0;
- if (targetlen == 0) target_bits = 0;
- else if (targetlen == 1) target_bits = *(data()+1);
- else if (targetlen == 2) target_bits = relocInfo::jint_from_data(data()+1);
- else { ShouldNotReachHere(); }
-
- _target = internal() ? address_from_scaled_offset(target_bits, addr())
- : index_to_runtime_address (target_bits);
-}
-
-
//// miscellaneous methods
oop* oop_Relocation::oop_addr() {
int n = _oop_index;
@@ -933,81 +863,6 @@ address internal_word_Relocation::target() {
return target;
}
-
-breakpoint_Relocation::breakpoint_Relocation(int kind, address target, bool internal) {
- bool active = false;
- bool enabled = (kind == initialization);
- bool removable = (kind != safepoint);
- bool settable = (target == NULL);
-
- int bits = kind;
- if (enabled) bits |= enabled_state;
- if (internal) bits |= internal_attr;
- if (removable) bits |= removable_attr;
- if (settable) bits |= settable_attr;
-
- _bits = bits | high_bit;
- _target = target;
-
- assert(this->kind() == kind, "kind encoded");
- assert(this->enabled() == enabled, "enabled encoded");
- assert(this->active() == active, "active encoded");
- assert(this->internal() == internal, "internal encoded");
- assert(this->removable() == removable, "removable encoded");
- assert(this->settable() == settable, "settable encoded");
-}
-
-
-address breakpoint_Relocation::target() const {
- return _target;
-}
-
-
-void breakpoint_Relocation::set_target(address x) {
- assert(settable(), "must be settable");
- jint target_bits =
- (jint)(internal() ? scaled_offset (x, addr())
- : runtime_address_to_index(x));
- short* p = &live_bits() + 1;
- p = add_jint(p, target_bits);
- assert(p == instrs(), "new target must fit");
- _target = x;
-}
-
-
-void breakpoint_Relocation::set_enabled(bool b) {
- if (enabled() == b) return;
-
- if (b) {
- set_bits(bits() | enabled_state);
- } else {
- set_active(false); // remove the actual breakpoint insn, if any
- set_bits(bits() & ~enabled_state);
- }
-}
-
-
-void breakpoint_Relocation::set_active(bool b) {
- assert(!b || enabled(), "cannot activate a disabled breakpoint");
-
- if (active() == b) return;
-
- // %%% should probably seize a lock here (might not be the right lock)
- //MutexLockerEx ml_patch(Patching_lock, true);
- //if (active() == b) return; // recheck state after locking
-
- if (b) {
- set_bits(bits() | active_state);
- if (instrlen() == 0)
- fatal("breakpoints in original code must be undoable");
- pd_swap_in_breakpoint (addr(), instrs(), instrlen());
- } else {
- set_bits(bits() & ~active_state);
- pd_swap_out_breakpoint(addr(), instrs(), instrlen());
- }
-}
-
-
//---------------------------------------------------------------------------------
// Non-product code
diff --git a/src/share/vm/code/relocInfo.hpp b/src/share/vm/code/relocInfo.hpp
index 5585b5df7..68a7f3a58 100644
--- a/src/share/vm/code/relocInfo.hpp
+++ b/src/share/vm/code/relocInfo.hpp
@@ -49,9 +49,6 @@ class NativeMovConstReg;
// 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
@@ -204,15 +201,6 @@ class NativeMovConstReg;
// 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; }
@@ -271,8 +259,8 @@ class relocInfo VALUE_OBJ_CLASS_SPEC {
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
+ metadata_type = 12, // metadata that used to be oops
+ yet_unused_type_1 = 13, // Still unused
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
@@ -312,7 +300,6 @@ class relocInfo VALUE_OBJ_CLASS_SPEC {
visitor(internal_word) \
visitor(poll) \
visitor(poll_return) \
- visitor(breakpoint) \
visitor(section_word) \
@@ -454,7 +441,7 @@ class relocInfo VALUE_OBJ_CLASS_SPEC {
public:
enum {
// Conservatively large estimate of maximum length (in shorts)
- // of any relocation record (probably breakpoints are largest).
+ // 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
@@ -571,8 +558,6 @@ class RelocIterator : public StackObj {
void initialize(nmethod* nm, address begin, address limit);
- friend class PatchingRelocIterator;
- // make an uninitialized one, for PatchingRelocIterator:
RelocIterator() { initialize_misc(); }
public:
@@ -779,9 +764,6 @@ class Relocation VALUE_OBJ_CLASS_SPEC {
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 ();
@@ -1302,87 +1284,6 @@ class poll_return_Relocation : public Relocation {
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() { \
@@ -1401,25 +1302,4 @@ 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
diff --git a/src/share/vm/interpreter/bytecodeInterpreter.cpp b/src/share/vm/interpreter/bytecodeInterpreter.cpp
index 8f0ec849c..b51ba8705 100644
--- a/src/share/vm/interpreter/bytecodeInterpreter.cpp
+++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp
@@ -481,9 +481,9 @@ BytecodeInterpreter::run(interpreterState istate) {
// So we have a second version of the assertion which handles the case where EnableInvokeDynamic was
// switched off because of the wrong classes.
if (EnableInvokeDynamic || FLAG_IS_CMDLINE(EnableInvokeDynamic)) {
- assert(abs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + 1), "bad stack limit");
+ assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + 1), "bad stack limit");
} else {
- const int extra_stack_entries = Method::extra_stack_entries_for_indy;
+ const int extra_stack_entries = Method::extra_stack_entries_for_jsr292;
assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + extra_stack_entries
+ 1), "bad stack limit");
}
@@ -2233,7 +2233,7 @@ run:
}
Method* method = cache->f1_as_method();
- VERIFY_OOP(method);
+ if (VerifyOops) method->verify();
if (cache->has_appendix()) {
ConstantPool* constants = METHOD->constants();
@@ -2265,8 +2265,7 @@ run:
}
Method* method = cache->f1_as_method();
-
- VERIFY_OOP(method);
+ if (VerifyOops) method->verify();
if (cache->has_appendix()) {
ConstantPool* constants = METHOD->constants();
diff --git a/src/share/vm/opto/memnode.cpp b/src/share/vm/opto/memnode.cpp
index 30acf3513..aa03b5ff6 100644
--- a/src/share/vm/opto/memnode.cpp
+++ b/src/share/vm/opto/memnode.cpp
@@ -2943,11 +2943,19 @@ Node *MemBarNode::Ideal(PhaseGVN *phase, bool can_reshape) {
Node* my_mem = in(MemBarNode::Precedent);
// The MembarAquire may keep an unused LoadNode alive through the Precedent edge
if ((my_mem != NULL) && (opc == Op_MemBarAcquire) && (my_mem->outcnt() == 1)) {
- assert(my_mem->unique_out() == this, "sanity");
- phase->hash_delete(this);
- del_req(Precedent);
- phase->is_IterGVN()->_worklist.push(my_mem); // remove dead node later
- my_mem = NULL;
+ // if the Precedent is a decodeN and its input (a Load) is used at more than one place,
+ // replace this Precedent (decodeN) with the Load instead.
+ if ((my_mem->Opcode() == Op_DecodeN) && (my_mem->in(1)->outcnt() > 1)) {
+ Node* load_node = my_mem->in(1);
+ set_req(MemBarNode::Precedent, load_node);
+ phase->is_IterGVN()->_worklist.push(my_mem);
+ my_mem = load_node;
+ } else {
+ assert(my_mem->unique_out() == this, "sanity");
+ del_req(Precedent);
+ phase->is_IterGVN()->_worklist.push(my_mem); // remove dead node later
+ my_mem = NULL;
+ }
}
if (my_mem != NULL && my_mem->is_Mem()) {
const TypeOopPtr* t_oop = my_mem->in(MemNode::Address)->bottom_type()->isa_oopptr();