hotspot/src/share/vm/oops/cpCacheKlass.cpp

Print this page
rev 611 : Merge

@@ -1,10 +1,10 @@
 #ifdef USE_PRAGMA_IDENT_SRC
 #pragma ident "@(#)cpCacheKlass.cpp     1.46 07/05/29 09:44:18 JVM"
 #endif
 /*
- * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -38,22 +38,23 @@
 constantPoolCacheOop constantPoolCacheKlass::allocate(int length, TRAPS) {
   // allocate memory
   int size = constantPoolCacheOopDesc::object_size(length);
   KlassHandle klass (THREAD, as_klassOop());
   constantPoolCacheOop cache = (constantPoolCacheOop)
-    CollectedHeap::permanent_array_allocate(klass, size, length, CHECK_NULL);
+    CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
+  cache->set_length(length);
   cache->set_constant_pool(NULL);
   return cache;
 }
 
-
 klassOop constantPoolCacheKlass::create_klass(TRAPS) {
   constantPoolCacheKlass o;
-  KlassHandle klassklass(THREAD, Universe::arrayKlassKlassObj());  
-  arrayKlassHandle k = base_create_array_klass(o.vtbl_value(), header_size(), klassklass, CHECK_NULL);
-  KlassHandle super (THREAD, k->super());
-  complete_create_array_klass(k, super, CHECK_NULL);
+  KlassHandle h_this_klass(THREAD, Universe::klassKlassObj());
+  KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
+  // Make sure size calculation is right
+  assert(k()->size() == align_object_size(header_size()), "wrong size for object");
+  java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
   return k();
 }
 
 
 void constantPoolCacheKlass::oop_follow_contents(oop obj) {

@@ -184,22 +185,22 @@
 
 void constantPoolCacheKlass::oop_print_on(oop obj, outputStream* st) {
   assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
   constantPoolCacheOop cache = (constantPoolCacheOop)obj;
   // super print
-  arrayKlass::oop_print_on(obj, st);
+  Klass::oop_print_on(obj, st);
   // print constant pool cache entries
   for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->print(st, i);
 }
 
 #endif
 
 void constantPoolCacheKlass::oop_verify_on(oop obj, outputStream* st) {
   guarantee(obj->is_constantPoolCache(), "obj must be constant pool cache");
   constantPoolCacheOop cache = (constantPoolCacheOop)obj;
   // super verify
-  arrayKlass::oop_verify_on(obj, st);
+  Klass::oop_verify_on(obj, st);
   // print constant pool cache entries
   for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->verify(st);
 }