1 /*
2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2012, 2013 SAP AG. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
69 #define BI_PROFILE_UPDATE_VIRTUALCALL(receiver)
70 #define BI_PROFILE_UPDATE_SWITCH(switch_index)
71
72
73 #else
74
75
76 // Non-dummy implementations ///////////////////////////////////////////////////
77
78 // Accessors for the current method data pointer 'mdx'.
79 #define MDX() (istate->mdx())
80 #define SET_MDX(mdx) \
81 if (TraceProfileInterpreter) { \
82 /* Let it look like TraceBytecodes' format. */ \
83 tty->print_cr("[%d] %4d " \
84 "mdx " PTR_FORMAT "(%d)" \
85 " " \
86 " \t-> " PTR_FORMAT "(%d)", \
87 (int) THREAD->osthread()->thread_id(), \
88 BCI(), \
89 MDX(), \
90 (MDX() == NULL \
91 ? 0 \
92 : istate->method()->method_data()->dp_to_di((address)MDX())), \
93 mdx, \
94 istate->method()->method_data()->dp_to_di((address)mdx) \
95 ); \
96 }; \
97 istate->set_mdx(mdx);
98
99
100 // Dumps the profiling method data for the current method.
101 #ifdef PRODUCT
102 #define BI_PROFILE_PRINT_METHOD_DATA()
103 #else // PRODUCT
104 #define BI_PROFILE_PRINT_METHOD_DATA() \
105 { \
106 ttyLocker ttyl; \
107 MethodData *md = istate->method()->method_data(); \
108 tty->cr(); \
109 tty->print("method data at mdx " PTR_FORMAT "(0) for", \
110 md->data_layout_at(md->bci_to_di(0))); \
111 istate->method()->print_short_name(tty); \
112 tty->cr(); \
113 if (md != NULL) { \
114 md->print_data_on(tty); \
115 address mdx = (address) MDX(); \
116 if (mdx != NULL) { \
117 tty->print_cr("current mdx " PTR_FORMAT "(%d)", \
118 mdx, \
119 istate->method()->method_data()->dp_to_di(mdx)); \
120 } \
121 } else { \
122 tty->print_cr("no method data"); \
123 } \
124 }
125 #endif // PRODUCT
126
127
128 // Gets or creates the profiling method data and initializes mdx.
129 #define BI_PROFILE_GET_OR_CREATE_METHOD_DATA(exception_handler) \
130 if (ProfileInterpreter && MDX() == NULL) { \
131 /* Mdx is not yet initialized for this activation. */ \
132 MethodData *md = istate->method()->method_data(); \
133 if (md == NULL) { \
134 MethodCounters* mcs; \
135 GET_METHOD_COUNTERS(mcs); \
136 /* The profiling method data doesn't exist for this method, */ \
137 /* create it if the counters have overflowed. */ \
138 if (mcs->invocation_counter() \
|
1 /*
2 * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2012, 2014 SAP AG. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
69 #define BI_PROFILE_UPDATE_VIRTUALCALL(receiver)
70 #define BI_PROFILE_UPDATE_SWITCH(switch_index)
71
72
73 #else
74
75
76 // Non-dummy implementations ///////////////////////////////////////////////////
77
78 // Accessors for the current method data pointer 'mdx'.
79 #define MDX() (istate->mdx())
80 #define SET_MDX(mdx) \
81 if (TraceProfileInterpreter) { \
82 /* Let it look like TraceBytecodes' format. */ \
83 tty->print_cr("[%d] %4d " \
84 "mdx " PTR_FORMAT "(%d)" \
85 " " \
86 " \t-> " PTR_FORMAT "(%d)", \
87 (int) THREAD->osthread()->thread_id(), \
88 BCI(), \
89 p2i(MDX()), \
90 (MDX() == NULL \
91 ? 0 \
92 : istate->method()->method_data()->dp_to_di((address)MDX())), \
93 p2i(mdx), \
94 istate->method()->method_data()->dp_to_di((address)mdx) \
95 ); \
96 }; \
97 istate->set_mdx(mdx);
98
99
100 // Dumps the profiling method data for the current method.
101 #ifdef PRODUCT
102 #define BI_PROFILE_PRINT_METHOD_DATA()
103 #else // PRODUCT
104 #define BI_PROFILE_PRINT_METHOD_DATA() \
105 { \
106 ttyLocker ttyl; \
107 MethodData *md = istate->method()->method_data(); \
108 tty->cr(); \
109 tty->print("method data at mdx " PTR_FORMAT "(0) for", \
110 p2i(md->data_layout_at(md->bci_to_di(0)))); \
111 istate->method()->print_short_name(tty); \
112 tty->cr(); \
113 if (md != NULL) { \
114 md->print_data_on(tty); \
115 address mdx = (address) MDX(); \
116 if (mdx != NULL) { \
117 tty->print_cr("current mdx " PTR_FORMAT "(%d)", \
118 p2i(mdx), \
119 istate->method()->method_data()->dp_to_di(mdx)); \
120 } \
121 } else { \
122 tty->print_cr("no method data"); \
123 } \
124 }
125 #endif // PRODUCT
126
127
128 // Gets or creates the profiling method data and initializes mdx.
129 #define BI_PROFILE_GET_OR_CREATE_METHOD_DATA(exception_handler) \
130 if (ProfileInterpreter && MDX() == NULL) { \
131 /* Mdx is not yet initialized for this activation. */ \
132 MethodData *md = istate->method()->method_data(); \
133 if (md == NULL) { \
134 MethodCounters* mcs; \
135 GET_METHOD_COUNTERS(mcs); \
136 /* The profiling method data doesn't exist for this method, */ \
137 /* create it if the counters have overflowed. */ \
138 if (mcs->invocation_counter() \
|