< prev index next >

src/share/vm/code/codeBlob.cpp

Print this page
rev 8910 : full patch for jfr
   1 /*
   2  * Copyright (c) 1998, 2018, 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  *


  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 TARGET_ARCH_arm
  52 # include "nativeInst_arm.hpp"
  53 #endif
  54 #ifdef TARGET_ARCH_ppc
  55 # include "nativeInst_ppc.hpp"
  56 #endif
  57 #ifdef COMPILER1
  58 #include "c1/c1_Runtime1.hpp"
  59 #endif
  60 
  61 unsigned int align_code_offset(int offset) {
  62   // align the size to CodeEntryAlignment
  63   return
  64     ((offset + (int)CodeHeap::header_size() + (CodeEntryAlignment-1)) & ~(CodeEntryAlignment-1))
  65     - (int)CodeHeap::header_size();
  66 }
  67 
  68 
  69 // This must be consistent with the CodeBlob constructor's layout actions.
  70 unsigned int CodeBlob::allocation_size(CodeBuffer* cb, int header_size) {
  71   unsigned int size = header_size;
  72   size += round_to(cb->total_relocation_size(), oopSize);
  73   // align the size to CodeEntryAlignment
  74   size = align_code_offset(size);
  75   size += round_to(cb->total_content_size(), oopSize);
  76   size += round_to(cb->total_oop_size(), oopSize);
  77   size += round_to(cb->total_metadata_size(), oopSize);
  78   return size;
  79 }
  80 
  81 


   1 /*
   2  * Copyright (c) 1998, 2019, 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  *


  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 TARGET_ARCH_arm
  52 # include "nativeInst_arm.hpp"
  53 #endif
  54 #ifdef TARGET_ARCH_ppc
  55 # include "nativeInst_ppc.hpp"
  56 #endif
  57 #ifdef COMPILER1
  58 #include "c1/c1_Runtime1.hpp"
  59 #endif
  60 
  61 unsigned int CodeBlob::align_code_offset(int offset) {
  62   // align the size to CodeEntryAlignment
  63   return
  64     ((offset + (int)CodeHeap::header_size() + (CodeEntryAlignment-1)) & ~(CodeEntryAlignment-1))
  65     - (int)CodeHeap::header_size();
  66 }
  67 
  68 
  69 // This must be consistent with the CodeBlob constructor's layout actions.
  70 unsigned int CodeBlob::allocation_size(CodeBuffer* cb, int header_size) {
  71   unsigned int size = header_size;
  72   size += round_to(cb->total_relocation_size(), oopSize);
  73   // align the size to CodeEntryAlignment
  74   size = align_code_offset(size);
  75   size += round_to(cb->total_content_size(), oopSize);
  76   size += round_to(cb->total_oop_size(), oopSize);
  77   size += round_to(cb->total_metadata_size(), oopSize);
  78   return size;
  79 }
  80 
  81 


< prev index next >