1 /*
2 * Copyright (c) 1997, 2013, 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 *
109 public: // N must be public (some compilers need this for _table)
110 enum {
111 N = 256, // size of stub table; must be power of two
112 mask = N - 1
113 };
114
115 private:
116 static VtableStub* _table[N]; // table of existing stubs
117 static int _number_of_vtable_stubs; // number of stubs created so far (for statistics)
118
119 static VtableStub* create_vtable_stub(int vtable_index);
120 static VtableStub* create_itable_stub(int vtable_index);
121 static VtableStub* lookup (bool is_vtable_stub, int vtable_index);
122 static void enter (bool is_vtable_stub, int vtable_index, VtableStub* s);
123 static inline uint hash (bool is_vtable_stub, int vtable_index);
124 static address find_stub (bool is_vtable_stub, int vtable_index);
125
126 public:
127 static address find_vtable_stub(int vtable_index) { return find_stub(true, vtable_index); }
128 static address find_itable_stub(int itable_index) { return find_stub(false, itable_index); }
129 static bool is_entry_point(address pc); // is pc a vtable stub entry point?
130 static bool contains(address pc); // is pc within any stub?
131 static VtableStub* stub_containing(address pc); // stub containing pc or NULL
132 static int number_of_vtable_stubs() { return _number_of_vtable_stubs; }
133 static void initialize();
134 static void vtable_stub_do(void f(VtableStub*)); // iterates over all vtable stubs
135 };
136
137 #endif // SHARE_VM_CODE_VTABLESTUBS_HPP
|
1 /*
2 * Copyright (c) 1997, 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 *
109 public: // N must be public (some compilers need this for _table)
110 enum {
111 N = 256, // size of stub table; must be power of two
112 mask = N - 1
113 };
114
115 private:
116 static VtableStub* _table[N]; // table of existing stubs
117 static int _number_of_vtable_stubs; // number of stubs created so far (for statistics)
118
119 static VtableStub* create_vtable_stub(int vtable_index);
120 static VtableStub* create_itable_stub(int vtable_index);
121 static VtableStub* lookup (bool is_vtable_stub, int vtable_index);
122 static void enter (bool is_vtable_stub, int vtable_index, VtableStub* s);
123 static inline uint hash (bool is_vtable_stub, int vtable_index);
124 static address find_stub (bool is_vtable_stub, int vtable_index);
125
126 public:
127 static address find_vtable_stub(int vtable_index) { return find_stub(true, vtable_index); }
128 static address find_itable_stub(int itable_index) { return find_stub(false, itable_index); }
129 static VtableStub* entry_point(address pc); // vtable stub entry point for a pc
130 static bool contains(address pc); // is pc within any stub?
131 static VtableStub* stub_containing(address pc); // stub containing pc or NULL
132 static int number_of_vtable_stubs() { return _number_of_vtable_stubs; }
133 static void initialize();
134 static void vtable_stub_do(void f(VtableStub*)); // iterates over all vtable stubs
135 };
136
137 #endif // SHARE_VM_CODE_VTABLESTUBS_HPP
|