src/share/vm/oops/constMethodOop.cpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2006, 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/_constMethodOop.cpp.incl"

  27 
  28 // Static initialization
  29 const u2 constMethodOopDesc::MAX_IDNUM   = 0xFFFE;
  30 const u2 constMethodOopDesc::UNSET_IDNUM = 0xFFFF;
  31 
  32 // How big must this constMethodObject be?
  33 
  34 int constMethodOopDesc::object_size(int code_size,
  35                                     int compressed_line_number_size,
  36                                     int local_variable_table_length,
  37                                     int checked_exceptions_length) {
  38   int extra_bytes = code_size;
  39   if (compressed_line_number_size > 0) {
  40     extra_bytes += compressed_line_number_size;
  41   }
  42   if (checked_exceptions_length > 0) {
  43     extra_bytes += sizeof(u2);
  44     extra_bytes += checked_exceptions_length * sizeof(CheckedExceptionElement);
  45   }
  46   if (local_variable_table_length > 0) {


   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "oops/constMethodOop.hpp"
  27 #include "oops/methodOop.hpp"
  28 
  29 // Static initialization
  30 const u2 constMethodOopDesc::MAX_IDNUM   = 0xFFFE;
  31 const u2 constMethodOopDesc::UNSET_IDNUM = 0xFFFF;
  32 
  33 // How big must this constMethodObject be?
  34 
  35 int constMethodOopDesc::object_size(int code_size,
  36                                     int compressed_line_number_size,
  37                                     int local_variable_table_length,
  38                                     int checked_exceptions_length) {
  39   int extra_bytes = code_size;
  40   if (compressed_line_number_size > 0) {
  41     extra_bytes += compressed_line_number_size;
  42   }
  43   if (checked_exceptions_length > 0) {
  44     extra_bytes += sizeof(u2);
  45     extra_bytes += checked_exceptions_length * sizeof(CheckedExceptionElement);
  46   }
  47   if (local_variable_table_length > 0) {