8009829: CDS: JDK JPRT test fails crash in Symbol::equals()
authorcoleenp
Wed, 13 Mar 2013 15:15:56 -0400
changeset 15934 104ff83451f1
parent 15933 744fdf2aae80
child 15935 50da9e5eb858
8009829: CDS: JDK JPRT test fails crash in Symbol::equals() Summary: -Xshare:dump was creating a Symbol in C_heap. There's an assert there that jdk jprt wasn't hitting because it was only done in product Reviewed-by: dholmes, hseigel, iklam
hotspot/src/share/vm/classfile/symbolTable.cpp
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp	Wed Mar 13 13:47:35 2013 -0400
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp	Wed Mar 13 15:15:56 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,18 +49,17 @@
 
   Symbol* sym;
 
-  if (c_heap) {
+  if (DumpSharedSpaces) {
+    // Allocate all symbols to CLD shared metaspace
+    sym = new (len, ClassLoaderData::the_null_class_loader_data(), THREAD) Symbol(name, len, -1);
+  } else if (c_heap) {
     // refcount starts as 1
-    assert(!DumpSharedSpaces, "never allocate to C heap");
     sym = new (len, THREAD) Symbol(name, len, 1);
     assert(sym != NULL, "new should call vm_exit_out_of_memory if C_HEAP is exhausted");
   } else {
-    if (DumpSharedSpaces) {
-      sym = new (len, ClassLoaderData::the_null_class_loader_data(), THREAD) Symbol(name, len, -1);
-  } else {
+    // Allocate to global arena
     sym = new (len, arena(), THREAD) Symbol(name, len, -1);
   }
-  }
   return sym;
 }