1 /*
2 * Copyright (c) 2003, 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 // An constMethodOop represents portions of a Java method which
26 // do not vary.
27 //
28 // Memory layout (each line represents a word). Note that most
29 // applications load thousands of methods, so keeping the size of this
30 // structure small has a big impact on footprint.
31 //
32 // |------------------------------------------------------|
33 // | header |
34 // | klass |
35 // |------------------------------------------------------|
36 // | fingerprint 1 |
37 // | fingerprint 2 |
38 // | method (oop) |
39 // | stackmap_data (oop) |
40 // | exception_table (oop) |
41 // | constMethod_size |
42 // | interp_kind | flags | code_size |
43 // | name index | signature index |
44 // | method_idnum | generic_signature_index |
284
285 // Unique id for the method
286 static const u2 MAX_IDNUM;
287 static const u2 UNSET_IDNUM;
288 u2 method_idnum() const { return _method_idnum; }
289 void set_method_idnum(u2 idnum) { _method_idnum = idnum; }
290
291 private:
292 // Since the size of the compressed line number table is unknown, the
293 // offsets of the other variable sized sections are computed backwards
294 // from the end of the constMethodOop.
295
296 // First byte after constMethodOop
297 address constMethod_end() const
298 { return (address)((oop*)this + _constMethod_size); }
299
300 // Last short in constMethodOop
301 u2* last_u2_element() const
302 { return (u2*)constMethod_end() - 1; }
303 };
|
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 #ifndef SHARE_VM_OOPS_CONSTMETHODOOP_HPP
26 #define SHARE_VM_OOPS_CONSTMETHODOOP_HPP
27
28 #include "oops/oop.hpp"
29 #include "oops/typeArrayOop.hpp"
30
31 // An constMethodOop represents portions of a Java method which
32 // do not vary.
33 //
34 // Memory layout (each line represents a word). Note that most
35 // applications load thousands of methods, so keeping the size of this
36 // structure small has a big impact on footprint.
37 //
38 // |------------------------------------------------------|
39 // | header |
40 // | klass |
41 // |------------------------------------------------------|
42 // | fingerprint 1 |
43 // | fingerprint 2 |
44 // | method (oop) |
45 // | stackmap_data (oop) |
46 // | exception_table (oop) |
47 // | constMethod_size |
48 // | interp_kind | flags | code_size |
49 // | name index | signature index |
50 // | method_idnum | generic_signature_index |
290
291 // Unique id for the method
292 static const u2 MAX_IDNUM;
293 static const u2 UNSET_IDNUM;
294 u2 method_idnum() const { return _method_idnum; }
295 void set_method_idnum(u2 idnum) { _method_idnum = idnum; }
296
297 private:
298 // Since the size of the compressed line number table is unknown, the
299 // offsets of the other variable sized sections are computed backwards
300 // from the end of the constMethodOop.
301
302 // First byte after constMethodOop
303 address constMethod_end() const
304 { return (address)((oop*)this + _constMethod_size); }
305
306 // Last short in constMethodOop
307 u2* last_u2_element() const
308 { return (u2*)constMethod_end() - 1; }
309 };
310
311 #endif // SHARE_VM_OOPS_CONSTMETHODOOP_HPP
|