src/share/vm/code/codeBlob.cpp

Print this page




   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/_codeBlob.cpp.incl"



























  27 
  28 unsigned int align_code_offset(int offset) {
  29   // align the size to CodeEntryAlignment
  30   return
  31     ((offset + (int)CodeHeap::header_size() + (CodeEntryAlignment-1)) & ~(CodeEntryAlignment-1))
  32     - (int)CodeHeap::header_size();
  33 }
  34 
  35 
  36 // This must be consistent with the CodeBlob constructor's layout actions.
  37 unsigned int CodeBlob::allocation_size(CodeBuffer* cb, int header_size) {
  38   unsigned int size = header_size;
  39   size += round_to(cb->total_relocation_size(), oopSize);
  40   // align the size to CodeEntryAlignment
  41   size = align_code_offset(size);
  42   size += round_to(cb->total_content_size(), oopSize);
  43   size += round_to(cb->total_oop_size(), oopSize);
  44   return size;
  45 }
  46 




   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/codeBlob.hpp"
  27 #include "code/codeCache.hpp"
  28 #include "code/relocInfo.hpp"
  29 #include "compiler/disassembler.hpp"
  30 #include "interpreter/bytecode.hpp"
  31 #include "memory/allocation.inline.hpp"
  32 #include "memory/heap.hpp"
  33 #include "oops/oop.inline.hpp"
  34 #include "prims/forte.hpp"
  35 #include "runtime/handles.inline.hpp"
  36 #include "runtime/interfaceSupport.hpp"
  37 #include "runtime/mutexLocker.hpp"
  38 #include "runtime/safepoint.hpp"
  39 #include "runtime/sharedRuntime.hpp"
  40 #include "runtime/vframe.hpp"
  41 #include "services/memoryService.hpp"
  42 #ifdef TARGET_ARCH_x86
  43 # include "nativeInst_x86.hpp"
  44 #endif
  45 #ifdef TARGET_ARCH_sparc
  46 # include "nativeInst_sparc.hpp"
  47 #endif
  48 #ifdef TARGET_ARCH_zero
  49 # include "nativeInst_zero.hpp"
  50 #endif
  51 #ifdef COMPILER1
  52 #include "c1/c1_Runtime1.hpp"
  53 #endif
  54 
  55 unsigned int align_code_offset(int offset) {
  56   // align the size to CodeEntryAlignment
  57   return
  58     ((offset + (int)CodeHeap::header_size() + (CodeEntryAlignment-1)) & ~(CodeEntryAlignment-1))
  59     - (int)CodeHeap::header_size();
  60 }
  61 
  62 
  63 // This must be consistent with the CodeBlob constructor's layout actions.
  64 unsigned int CodeBlob::allocation_size(CodeBuffer* cb, int header_size) {
  65   unsigned int size = header_size;
  66   size += round_to(cb->total_relocation_size(), oopSize);
  67   // align the size to CodeEntryAlignment
  68   size = align_code_offset(size);
  69   size += round_to(cb->total_content_size(), oopSize);
  70   size += round_to(cb->total_oop_size(), oopSize);
  71   return size;
  72 }
  73