提交 d699ae08 编写于 作者: H hseigel

Merge

...@@ -373,7 +373,7 @@ public class ObjectHeap { ...@@ -373,7 +373,7 @@ public class ObjectHeap {
visitor.epilogue(); visitor.epilogue();
} }
private void addLiveRegions(List input, List output) { private void addLiveRegions(String name, List input, List output) {
for (Iterator itr = input.iterator(); itr.hasNext();) { for (Iterator itr = input.iterator(); itr.hasNext();) {
MemRegion reg = (MemRegion) itr.next(); MemRegion reg = (MemRegion) itr.next();
Address top = reg.end(); Address top = reg.end();
...@@ -386,6 +386,9 @@ public class ObjectHeap { ...@@ -386,6 +386,9 @@ public class ObjectHeap {
} }
output.add(top); output.add(top);
output.add(bottom); output.add(bottom);
if (DEBUG) {
System.err.println("Live region: " + name + ": " + bottom + ", " + top);
}
} }
} }
...@@ -395,7 +398,7 @@ public class ObjectHeap { ...@@ -395,7 +398,7 @@ public class ObjectHeap {
} }
public void doSpace(Space s) { public void doSpace(Space s) {
addLiveRegions(s.getLiveRegions(), liveRegions); addLiveRegions(s.toString(), s.getLiveRegions(), liveRegions);
} }
private List liveRegions; private List liveRegions;
} }
...@@ -426,11 +429,11 @@ public class ObjectHeap { ...@@ -426,11 +429,11 @@ public class ObjectHeap {
ParallelScavengeHeap psh = (ParallelScavengeHeap) heap; ParallelScavengeHeap psh = (ParallelScavengeHeap) heap;
PSYoungGen youngGen = psh.youngGen(); PSYoungGen youngGen = psh.youngGen();
// Add eden space // Add eden space
addLiveRegions(youngGen.edenSpace().getLiveRegions(), liveRegions); addLiveRegions("eden", youngGen.edenSpace().getLiveRegions(), liveRegions);
// Add from-space but not to-space // Add from-space but not to-space
addLiveRegions(youngGen.fromSpace().getLiveRegions(), liveRegions); addLiveRegions("from", youngGen.fromSpace().getLiveRegions(), liveRegions);
PSOldGen oldGen = psh.oldGen(); PSOldGen oldGen = psh.oldGen();
addLiveRegions(oldGen.objectSpace().getLiveRegions(), liveRegions); addLiveRegions("old ", oldGen.objectSpace().getLiveRegions(), liveRegions);
} else if (heap instanceof G1CollectedHeap) { } else if (heap instanceof G1CollectedHeap) {
G1CollectedHeap g1h = (G1CollectedHeap) heap; G1CollectedHeap g1h = (G1CollectedHeap) heap;
g1h.heapRegionIterate(lrc); g1h.heapRegionIterate(lrc);
...@@ -451,7 +454,6 @@ public class ObjectHeap { ...@@ -451,7 +454,6 @@ public class ObjectHeap {
if (VM.getVM().getUseTLAB()) { if (VM.getVM().getUseTLAB()) {
for (JavaThread thread = VM.getVM().getThreads().first(); thread != null; thread = thread.next()) { for (JavaThread thread = VM.getVM().getThreads().first(); thread != null; thread = thread.next()) {
if (thread.isJavaThread()) {
ThreadLocalAllocBuffer tlab = thread.tlab(); ThreadLocalAllocBuffer tlab = thread.tlab();
if (tlab.start() != null) { if (tlab.start() != null) {
if ((tlab.top() == null) || (tlab.end() == null)) { if ((tlab.top() == null) || (tlab.end() == null)) {
...@@ -459,6 +461,12 @@ public class ObjectHeap { ...@@ -459,6 +461,12 @@ public class ObjectHeap {
thread.printThreadIDOn(System.err); thread.printThreadIDOn(System.err);
System.err.println(); System.err.println();
} else { } else {
if (DEBUG) {
System.err.print("TLAB for " + thread.getThreadName() + ", #");
thread.printThreadIDOn(System.err);
System.err.print(": ");
tlab.printOn(System.err);
}
// Go from: // Go from:
// - below start() to start() // - below start() to start()
// - start() to top() // - start() to top()
...@@ -471,7 +479,6 @@ public class ObjectHeap { ...@@ -471,7 +479,6 @@ public class ObjectHeap {
} }
} }
} }
}
// Now sort live regions // Now sort live regions
sortLiveRegions(liveRegions); sortLiveRegions(liveRegions);
...@@ -480,6 +487,15 @@ public class ObjectHeap { ...@@ -480,6 +487,15 @@ public class ObjectHeap {
Assert.that(liveRegions.size() % 2 == 0, "Must have even number of region boundaries"); Assert.that(liveRegions.size() % 2 == 0, "Must have even number of region boundaries");
} }
if (DEBUG) {
System.err.println("liveRegions:");
for (int i = 0; i < liveRegions.size(); i += 2) {
Address bottom = (Address) liveRegions.get(i);
Address top = (Address) liveRegions.get(i+1);
System.err.println(" " + bottom + " - " + top);
}
}
return liveRegions; return liveRegions;
} }
......
...@@ -109,6 +109,6 @@ public class ThreadLocalAllocBuffer extends VMObject { ...@@ -109,6 +109,6 @@ public class ThreadLocalAllocBuffer extends VMObject {
public void printOn(PrintStream tty) { public void printOn(PrintStream tty) {
tty.println(" [" + start() + "," + tty.println(" [" + start() + "," +
top() + "," + end() + ")"); top() + "," + end() + ",{" + hardEnd() + "})");
} }
} }
...@@ -94,13 +94,6 @@ bool frame::safe_for_sender(JavaThread *thread) { ...@@ -94,13 +94,6 @@ bool frame::safe_for_sender(JavaThread *thread) {
// other generic buffer blobs are more problematic so we just assume they are // other generic buffer blobs are more problematic so we just assume they are
// ok. adapter blobs never have a frame complete and are never ok. // ok. adapter blobs never have a frame complete and are never ok.
// check for a valid frame_size, otherwise we are unlikely to get a valid sender_pc
if (!Interpreter::contains(_pc) && _cb->frame_size() <= 0) {
//assert(0, "Invalid frame_size");
return false;
}
if (!_cb->is_frame_complete_at(_pc)) { if (!_cb->is_frame_complete_at(_pc)) {
if (_cb->is_nmethod() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) { if (_cb->is_nmethod() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) {
return false; return false;
...@@ -144,6 +137,11 @@ bool frame::safe_for_sender(JavaThread *thread) { ...@@ -144,6 +137,11 @@ bool frame::safe_for_sender(JavaThread *thread) {
// must be some sort of compiled/runtime frame // must be some sort of compiled/runtime frame
// fp does not have to be safe (although it could be check for c1?) // fp does not have to be safe (although it could be check for c1?)
// check for a valid frame_size, otherwise we are unlikely to get a valid sender_pc
if (_cb->frame_size() <= 0) {
return false;
}
sender_sp = _unextended_sp + _cb->frame_size(); sender_sp = _unextended_sp + _cb->frame_size();
// On Intel the return_address is always the word on the stack // On Intel the return_address is always the word on the stack
sender_pc = (address) *(sender_sp-1); sender_pc = (address) *(sender_sp-1);
......
...@@ -537,15 +537,26 @@ bool Reflection::verify_field_access(Klass* current_class, ...@@ -537,15 +537,26 @@ bool Reflection::verify_field_access(Klass* current_class,
return true; return true;
} }
Klass* host_class = current_class;
while (host_class->oop_is_instance() &&
InstanceKlass::cast(host_class)->is_anonymous()) {
Klass* next_host_class = InstanceKlass::cast(host_class)->host_klass();
if (next_host_class == NULL) break;
host_class = next_host_class;
}
if (host_class == field_class) {
return true;
}
if (access.is_protected()) { if (access.is_protected()) {
if (!protected_restriction) { if (!protected_restriction) {
// See if current_class is a subclass of field_class // See if current_class (or outermost host class) is a subclass of field_class
if (current_class->is_subclass_of(field_class)) { if (host_class->is_subclass_of(field_class)) {
if (access.is_static() || // static fields are ok, see 6622385 if (access.is_static() || // static fields are ok, see 6622385
current_class == resolved_class || current_class == resolved_class ||
field_class == resolved_class || field_class == resolved_class ||
current_class->is_subclass_of(resolved_class) || host_class->is_subclass_of(resolved_class) ||
resolved_class->is_subclass_of(current_class)) { resolved_class->is_subclass_of(host_class)) {
return true; return true;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册