diff src/share/vm/oops/generateOopMap.cpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents 1d7922586cf6
children f16e75e0cf11
line wrap: on
line diff
--- a/src/share/vm/oops/generateOopMap.cpp	Fri Aug 31 16:39:35 2012 -0700
+++ b/src/share/vm/oops/generateOopMap.cpp	Sat Sep 01 13:25:18 2012 -0400
@@ -1272,7 +1272,7 @@
       case Bytecodes::_invokedynamic:
       case Bytecodes::_invokeinterface:
         int idx = currentBC->has_index_u4() ? currentBC->get_index_u4() : currentBC->get_index_u2_cpcache();
-        constantPoolOop cp    = method()->constants();
+        ConstantPool* cp      = method()->constants();
         int nameAndTypeIdx    = cp->name_and_type_ref_index_at(idx);
         int signatureIdx      = cp->signature_ref_index_at(nameAndTypeIdx);
         Symbol* signature     = cp->symbol_at(signatureIdx);
@@ -1304,7 +1304,7 @@
       case Bytecodes::_invokedynamic:
       case Bytecodes::_invokeinterface:
         int idx = currentBC->has_index_u4() ? currentBC->get_index_u4() : currentBC->get_index_u2_cpcache();
-        constantPoolOop cp    = method()->constants();
+        ConstantPool* cp      = method()->constants();
         int nameAndTypeIdx    = cp->name_and_type_ref_index_at(idx);
         int signatureIdx      = cp->signature_ref_index_at(nameAndTypeIdx);
         Symbol* signature     = cp->symbol_at(signatureIdx);
@@ -1846,14 +1846,22 @@
 
 void GenerateOopMap::do_ldc(int bci) {
   Bytecode_loadconstant ldc(method(), bci);
-  constantPoolOop cp  = method()->constants();
+  ConstantPool* cp  = method()->constants();
+  constantTag tag = cp->tag_at(ldc.pool_index()); // idx is index in resolved_references
   BasicType       bt  = ldc.result_type();
-  CellTypeState   cts = (bt == T_OBJECT) ? CellTypeState::make_line_ref(bci) : valCTS;
-  // Make sure bt==T_OBJECT is the same as old code (is_pointer_entry).
-  // Note that CONSTANT_MethodHandle entries are u2 index pairs, not pointer-entries,
-  // and they are processed by _fast_aldc and the CP cache.
-  assert((ldc.has_cache_index() || cp->is_object_entry(ldc.pool_index()))
-         ? (bt == T_OBJECT) : true, "expected object type");
+  CellTypeState   cts;
+  if (tag.is_klass() ||
+      tag.is_unresolved_klass() ||
+      tag.is_string() ||
+      tag.is_object() ||
+      tag.is_method_handle() ||
+      tag.is_method_type()) {
+    assert(bt == T_OBJECT, "Guard is incorrect");
+    cts = CellTypeState::make_line_ref(bci);
+  } else {
+    assert(bt != T_OBJECT, "Guard is incorrect");
+    cts = valCTS;
+  }
   ppush1(cts);
 }
 
@@ -1889,7 +1897,7 @@
 
 void GenerateOopMap::do_field(int is_get, int is_static, int idx, int bci) {
   // Dig up signature for field in constant pool
-  constantPoolOop cp     = method()->constants();
+  ConstantPool* cp     = method()->constants();
   int nameAndTypeIdx     = cp->name_and_type_ref_index_at(idx);
   int signatureIdx       = cp->signature_ref_index_at(nameAndTypeIdx);
   Symbol* signature      = cp->symbol_at(signatureIdx);
@@ -1919,7 +1927,7 @@
 
 void GenerateOopMap::do_method(int is_static, int is_interface, int idx, int bci) {
  // Dig up signature for field in constant pool
-  constantPoolOop cp  = _method->constants();
+  ConstantPool* cp  = _method->constants();
   Symbol* signature   = cp->signature_ref_at(idx);
 
   // Parse method signature
@@ -2302,7 +2310,9 @@
     BytecodeStream bcs(_method);
     startOver = false;
 
-    while( bcs.next() >=0 && !startOver && !_got_error) {
+    while( !startOver && !_got_error &&
+           // test bcs in case method changed and it became invalid
+           bcs.next() >=0) {
       startOver = rewrite_refval_conflict_inst(&bcs, from, to);
     }
   } while (startOver && !_got_error);
@@ -2383,7 +2393,7 @@
     bcp = _method->bcp_from(bcs->bci());
   }
 
-  // Patch either directly in methodOop or in temp. buffer
+  // Patch either directly in Method* or in temp. buffer
   if (newIlen == 1) {
     assert(varNo < 4, "varNo too large");
     *bcp = bc0 + varNo;