Created
July 17, 2009 22:31
-
-
Save rose00/149316 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/share/vm/c1/c1_GraphBuilder.cpp b/src/share/vm/c1/c1_GraphBuilder.cpp | |
--- a/src/share/vm/c1/c1_GraphBuilder.cpp | |
+++ b/src/share/vm/c1/c1_GraphBuilder.cpp | |
@@ -1442,7 +1442,7 @@ | |
switch (field_type) { | |
case T_ARRAY: | |
case T_OBJECT: | |
- if (field_val.as_object()->has_encoding()) { | |
+ if (field_val.as_object()->should_be_constant()) { | |
constant = new Constant(as_ValueType(field_val)); | |
} | |
break; | |
diff --git a/src/share/vm/ci/ciObject.cpp b/src/share/vm/ci/ciObject.cpp | |
--- a/src/share/vm/ci/ciObject.cpp | |
+++ b/src/share/vm/ci/ciObject.cpp | |
@@ -181,7 +181,14 @@ | |
// ------------------------------------------------------------------ | |
// ciObject::has_encoding | |
bool ciObject::has_encoding() { | |
- if (NonPermCodeRefs) return true; // everybody codes now | |
+ if (NonPermCodeRefs >= 1) return true; // everybody codes now | |
+ return handle() == NULL || is_perm(); | |
+} | |
+ | |
+// ------------------------------------------------------------------ | |
+// ciObject::should_be_constant() | |
+bool ciObject::should_be_constant() { | |
+ if (NonPermCodeRefs >= 2) return true; // force everybody to code | |
return handle() == NULL || is_perm(); | |
} | |
diff --git a/src/share/vm/ci/ciObject.hpp b/src/share/vm/ci/ciObject.hpp | |
--- a/src/share/vm/ci/ciObject.hpp | |
+++ b/src/share/vm/ci/ciObject.hpp | |
@@ -92,12 +92,17 @@ | |
int hash(); | |
// Tells if this oop has an encoding. (I.e., is it null or perm?) | |
- // If NonPermCodeRefs is true, all oops have encodings. | |
+ // If NonPermCodeRefs is non-zero, all oops have encodings. | |
// If it does not have an encoding, the compiler is responsible for | |
// making other arrangements for dealing with the oop. | |
// See ciEnv::make_perm_array | |
bool has_encoding(); | |
+ // Tells if this oop should be made a constant. | |
+ // The property has_encoding must be true for this object to be a constant. | |
+ // If NonPermCodeRefs<=1, is_null_object or is_perm must also be true. | |
+ bool should_be_constant(); | |
+ | |
// Is this object guaranteed to be in the permanent part of the heap? | |
// If so, CollectedHeap::can_elide_permanent_oop_store_barriers is relevant. | |
// If the answer is false, no guarantees are made. | |
diff --git a/src/share/vm/opto/parse3.cpp b/src/share/vm/opto/parse3.cpp | |
--- a/src/share/vm/opto/parse3.cpp | |
+++ b/src/share/vm/opto/parse3.cpp | |
@@ -279,13 +279,18 @@ | |
case T_LONG: push_pair( longcon(constant.as_long()) ); break; | |
case T_ARRAY: | |
case T_OBJECT: { | |
- // the oop is in perm space if the ciObject "has_encoding" | |
- // or else NonPermCodeRefs must be true | |
+ // cases: | |
+ // oop == null || oop in perm space | |
+ // => has_encoding && should_be_constant | |
+ // oop in non-perm space && NonPermCodeRefs<2 | |
+ // => has_encoding==NonPermCodeRefs && !should_be_constant | |
+ // oop in non-perm space && NonPermCodeRefs=2 | |
+ // => has_encoding && should_be_constant | |
ciObject* oop_constant = constant.as_object(); | |
if (oop_constant->is_null_object()) { | |
push( zerocon(T_OBJECT) ); | |
break; | |
- } else if (oop_constant->has_encoding()) { | |
+ } else if (oop_constant->should_be_constant()) { | |
push( makecon(TypeOopPtr::make_from_constant(oop_constant)) ); | |
break; | |
} else { | |
diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp | |
--- a/src/share/vm/runtime/globals.hpp | |
+++ b/src/share/vm/runtime/globals.hpp | |
@@ -714,8 +714,8 @@ | |
diagnostic(bool, TraceNMethodInstalls, false, \ | |
"Trace nmethod intallation") \ | |
\ | |
- diagnostic(bool, NonPermCodeRefs, true, \ | |
- "allow non-perm references in the code cache") \ | |
+ diagnostic(int, NonPermCodeRefs, 1, \ | |
+ "0: disallow non-perm oops in the code cache; 2: emit many") \ | |
\ | |
diagnostic(bool, TraceOSRBreakpoint, false, \ | |
"Trace OSR Breakpoint ") \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment