src/share/vm/code/oopRecorder.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6951083 Sdiff src/share/vm/code

src/share/vm/code/oopRecorder.hpp

Print this page


   1 /*
   2  * Copyright 1998-2005 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *


  53       index = add_handle(h, true);
  54     }
  55     return index;
  56   }
  57 
  58   // variant of find_index which does not allocate if not found (yields -1)
  59   int maybe_find_index(jobject h);
  60 
  61   // returns the size of the generated oop table, for sizing the CodeBlob.
  62   // must be called after all oops are allocated!
  63   int oop_size();
  64 
  65   // Retrieve the oop handle at a given index.
  66   jobject handle_at(int index);
  67 
  68   int element_count() {
  69     // there is always a NULL virtually present as first object
  70     return _handles->length() + first_index;
  71   }
  72 
  73   // copy the generated oop table to CodeBlob
  74   void copy_to(CodeBlob* code);  // => code->copy_oops(_handles)
  75 
  76   bool is_unused() { return _handles == NULL && !_complete; }
  77 #ifdef ASSERT
  78   bool is_complete() { return _complete; }
  79 #endif
  80 
  81  private:
  82   // leaky hash table of handle => index, to help detect duplicate insertion
  83   class IndexCache: public ResourceObj {
  84     // This class is only used by the OopRecorder class.
  85     friend class OopRecorder;
  86     enum {
  87       _log_cache_size = 9,
  88       _cache_size = (1<<_log_cache_size),
  89       // Index entries are ints.  The LSBit is a collision indicator.
  90       _collision_bit_shift = 0,
  91       _collision_bit = 1,
  92       _index_shift = _collision_bit_shift+1
  93     };
  94     int _cache[_cache_size];


   1 /*
   2  * Copyright 1998-2010 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *


  53       index = add_handle(h, true);
  54     }
  55     return index;
  56   }
  57 
  58   // variant of find_index which does not allocate if not found (yields -1)
  59   int maybe_find_index(jobject h);
  60 
  61   // returns the size of the generated oop table, for sizing the CodeBlob.
  62   // must be called after all oops are allocated!
  63   int oop_size();
  64 
  65   // Retrieve the oop handle at a given index.
  66   jobject handle_at(int index);
  67 
  68   int element_count() {
  69     // there is always a NULL virtually present as first object
  70     return _handles->length() + first_index;
  71   }
  72 
  73   // copy the generated oop table to nmethod
  74   void copy_to(nmethod* nm);  // => code->copy_oops(_handles)
  75 
  76   bool is_unused() { return _handles == NULL && !_complete; }
  77 #ifdef ASSERT
  78   bool is_complete() { return _complete; }
  79 #endif
  80 
  81  private:
  82   // leaky hash table of handle => index, to help detect duplicate insertion
  83   class IndexCache: public ResourceObj {
  84     // This class is only used by the OopRecorder class.
  85     friend class OopRecorder;
  86     enum {
  87       _log_cache_size = 9,
  88       _cache_size = (1<<_log_cache_size),
  89       // Index entries are ints.  The LSBit is a collision indicator.
  90       _collision_bit_shift = 0,
  91       _collision_bit = 1,
  92       _index_shift = _collision_bit_shift+1
  93     };
  94     int _cache[_cache_size];


src/share/vm/code/oopRecorder.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File