src/share/vm/code/debugInfoRec.cpp

Print this page


   1 /*
   2  * Copyright (c) 1998, 2009, 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  *
  23  */
  24 
  25 # include "incls/_precompiled.incl"
  26 # include "incls/_debugInfoRec.cpp.incl"


  27 
  28 // Private definition.
  29 // There is one DIR_Chunk for each scope and values array.
  30 // A chunk can potentially be used more than once.
  31 // We keep track of these chunks in order to detect
  32 // repetition and enable sharing.
  33 class DIR_Chunk {
  34   friend class DebugInformationRecorder;
  35   int  _offset; // location in the stream of this scope
  36   int  _length; // number of bytes in the stream
  37   int  _hash;   // hash of stream bytes (for quicker reuse)
  38 
  39   void* operator new(size_t ignore, DebugInformationRecorder* dir) {
  40     assert(ignore == sizeof(DIR_Chunk), "");
  41     if (dir->_next_chunk >= dir->_next_chunk_limit) {
  42       const int CHUNK = 100;
  43       dir->_next_chunk = NEW_RESOURCE_ARRAY(DIR_Chunk, CHUNK);
  44       dir->_next_chunk_limit = dir->_next_chunk + CHUNK;
  45     }
  46     return dir->_next_chunk++;


   1 /*
   2  * Copyright (c) 1998, 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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/debugInfoRec.hpp"
  27 #include "code/scopeDesc.hpp"
  28 #include "prims/jvmtiExport.hpp"
  29 
  30 // Private definition.
  31 // There is one DIR_Chunk for each scope and values array.
  32 // A chunk can potentially be used more than once.
  33 // We keep track of these chunks in order to detect
  34 // repetition and enable sharing.
  35 class DIR_Chunk {
  36   friend class DebugInformationRecorder;
  37   int  _offset; // location in the stream of this scope
  38   int  _length; // number of bytes in the stream
  39   int  _hash;   // hash of stream bytes (for quicker reuse)
  40 
  41   void* operator new(size_t ignore, DebugInformationRecorder* dir) {
  42     assert(ignore == sizeof(DIR_Chunk), "");
  43     if (dir->_next_chunk >= dir->_next_chunk_limit) {
  44       const int CHUNK = 100;
  45       dir->_next_chunk = NEW_RESOURCE_ARRAY(DIR_Chunk, CHUNK);
  46       dir->_next_chunk_limit = dir->_next_chunk + CHUNK;
  47     }
  48     return dir->_next_chunk++;