src/share/vm/memory/dump.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7032129 Sdiff src/share/vm/memory

src/share/vm/memory/dump.cpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  63 // the hash can be shared.
  64 //
  65 // NOTE THAT the algorithm in StringTable::hash_string() MUST MATCH the
  66 // algorithm in java.lang.String.hashCode().
  67 
  68 class StringHashCodeClosure: public OopClosure {
  69 private:
  70   Thread* THREAD;
  71   int hash_offset;
  72 public:
  73   StringHashCodeClosure(Thread* t) {
  74     THREAD = t;
  75     hash_offset = java_lang_String::hash_offset_in_bytes();
  76   }
  77 
  78   void do_oop(oop* p) {
  79     if (p != NULL) {
  80       oop obj = *p;
  81       if (obj->klass() == SystemDictionary::String_klass()) {
  82 
  83         int hash;
  84         typeArrayOop value = java_lang_String::value(obj);
  85         int length = java_lang_String::length(obj);
  86         if (length == 0) {
  87           hash = 0;
  88         } else {
  89           int offset = java_lang_String::offset(obj);
  90           jchar* s = value->char_at_addr(offset);
  91           hash = StringTable::hash_string(s, length);
  92         }
  93         obj->int_field_put(hash_offset, hash);
  94       }
  95     }
  96   }
  97   void do_oop(narrowOop* p) { ShouldNotReachHere(); }
  98 };
  99 
 100 
 101 // Remove data from objects which should not appear in the shared file
 102 // (as it pertains only to the current JVM).
 103 
 104 class RemoveUnshareableInfoClosure : public ObjectClosure {
 105 public:
 106   void do_object(oop obj) {
 107     // Zap data from the objects which is pertains only to this JVM.  We
 108     // want that data recreated in new JVMs when the shared file is used.
 109     if (obj->is_method()) {
 110       ((methodOop)obj)->remove_unshareable_info();
 111     }
 112     else if (obj->is_klass()) {


   1 /*
   2  * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  63 // the hash can be shared.
  64 //
  65 // NOTE THAT the algorithm in StringTable::hash_string() MUST MATCH the
  66 // algorithm in java.lang.String.hashCode().
  67 
  68 class StringHashCodeClosure: public OopClosure {
  69 private:
  70   Thread* THREAD;
  71   int hash_offset;
  72 public:
  73   StringHashCodeClosure(Thread* t) {
  74     THREAD = t;
  75     hash_offset = java_lang_String::hash_offset_in_bytes();
  76   }
  77 
  78   void do_oop(oop* p) {
  79     if (p != NULL) {
  80       oop obj = *p;
  81       if (obj->klass() == SystemDictionary::String_klass()) {
  82 
  83         int hash = java_lang_String::hash_string(obj);









  84         obj->int_field_put(hash_offset, hash);
  85       }
  86     }
  87   }
  88   void do_oop(narrowOop* p) { ShouldNotReachHere(); }
  89 };
  90 
  91 
  92 // Remove data from objects which should not appear in the shared file
  93 // (as it pertains only to the current JVM).
  94 
  95 class RemoveUnshareableInfoClosure : public ObjectClosure {
  96 public:
  97   void do_object(oop obj) {
  98     // Zap data from the objects which is pertains only to this JVM.  We
  99     // want that data recreated in new JVMs when the shared file is used.
 100     if (obj->is_method()) {
 101       ((methodOop)obj)->remove_unshareable_info();
 102     }
 103     else if (obj->is_klass()) {


src/share/vm/memory/dump.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File