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 "ci/ciCallProfile.hpp"
27 #include "ci/ciExceptionHandler.hpp"
28 #include "ci/ciInstanceKlass.hpp"
29 #include "ci/ciMethod.hpp"
30 #include "ci/ciMethodBlocks.hpp"
31 #include "ci/ciMethodData.hpp"
32 #include "ci/ciStreams.hpp"
33 #include "ci/ciSymbol.hpp"
34 #include "ci/ciReplay.hpp"
35 #include "ci/ciUtilities.hpp"
36 #include "classfile/systemDictionary.hpp"
37 #include "compiler/abstractCompiler.hpp"
38 #include "compiler/compilerOracle.hpp"
39 #include "compiler/methodLiveness.hpp"
40 #include "interpreter/interpreter.hpp"
41 #include "interpreter/linkResolver.hpp"
42 #include "interpreter/oopMapCache.hpp"
43 #include "memory/allocation.inline.hpp"
44 #include "memory/resourceArea.hpp"
45 #include "oops/generateOopMap.hpp"
46 #include "oops/oop.inline.hpp"
47 #include "prims/nativeLookup.hpp"
48 #include "runtime/deoptimization.hpp"
49 #include "utilities/bitMap.inline.hpp"
50 #include "utilities/xmlstream.hpp"
51 #include "trace/tracing.hpp"
52 #ifdef COMPILER2
53 #include "ci/bcEscapeAnalyzer.hpp"
54 #include "ci/ciTypeFlow.hpp"
55 #include "oops/method.hpp"
56 #endif
57 #ifdef SHARK
58 #include "ci/ciTypeFlow.hpp"
1027 ciMethodData* ciMethod::method_data_or_null() {
1028 ciMethodData *md = method_data();
1029 if (md->is_empty()) {
1030 return NULL;
1031 }
1032 return md;
1033 }
1034
1035 // ------------------------------------------------------------------
1036 // ciMethod::ensure_method_counters
1037 //
1038 MethodCounters* ciMethod::ensure_method_counters() {
1039 check_is_loaded();
1040 VM_ENTRY_MARK;
1041 methodHandle mh(THREAD, get_Method());
1042 MethodCounters* method_counters = mh->get_method_counters(CHECK_NULL);
1043 return method_counters;
1044 }
1045
1046 // ------------------------------------------------------------------
1047 // ciMethod::should_inline
1048 //
1049 // Should this method be inlined during compilation?
1050 bool ciMethod::should_inline() {
1051 check_is_loaded();
1052 VM_ENTRY_MARK;
1053 methodHandle mh(THREAD, get_Method());
1054 return CompilerOracle::should_inline(mh);
1055 }
1056
1057 // ------------------------------------------------------------------
1058 // ciMethod::should_not_inline
1059 //
1060 // Should this method be disallowed from inlining during compilation?
1061 bool ciMethod::should_not_inline() {
1062 check_is_loaded();
1063 VM_ENTRY_MARK;
1064 methodHandle mh(THREAD, get_Method());
1065 return CompilerOracle::should_not_inline(mh);
1066 }
1067
1068 // ------------------------------------------------------------------
1069 // ciMethod::should_print_assembly
1070 //
1071 // Should the compiler print the generated code for this method?
1072 bool ciMethod::should_print_assembly() {
1073 check_is_loaded();
1074 VM_ENTRY_MARK;
1075 methodHandle mh(THREAD, get_Method());
1076 return CompilerOracle::should_print(mh);
1077 }
1078
1079 // ------------------------------------------------------------------
1080 // ciMethod::break_at_execute
1081 //
1082 // Should the compiler insert a breakpoint into the generated code
1083 // method?
1084 bool ciMethod::break_at_execute() {
1085 check_is_loaded();
1086 VM_ENTRY_MARK;
1087 methodHandle mh(THREAD, get_Method());
1088 return CompilerOracle::should_break_at(mh);
1089 }
1090
1091 // ------------------------------------------------------------------
1092 // ciMethod::has_option
1093 //
1094 bool ciMethod::has_option(const char* option) {
1095 check_is_loaded();
1096 VM_ENTRY_MARK;
1097 methodHandle mh(THREAD, get_Method());
1098 return CompilerOracle::has_option_string(mh, option);
1099 }
1100
1101 // ------------------------------------------------------------------
1102 // ciMethod::has_option_value
1103 //
1104 template<typename T>
1105 bool ciMethod::has_option_value(const char* option, T& value) {
1106 check_is_loaded();
1107 VM_ENTRY_MARK;
1108 methodHandle mh(THREAD, get_Method());
1109 return CompilerOracle::has_option_value(mh, option, value);
1110 }
1111 // Explicit instantiation for all OptionTypes supported.
1112 template bool ciMethod::has_option_value<intx>(const char* option, intx& value);
1113 template bool ciMethod::has_option_value<uintx>(const char* option, uintx& value);
1114 template bool ciMethod::has_option_value<bool>(const char* option, bool& value);
1115 template bool ciMethod::has_option_value<ccstr>(const char* option, ccstr& value);
1116 template bool ciMethod::has_option_value<double>(const char* option, double& value);
1117
1118 // ------------------------------------------------------------------
1119 // ciMethod::can_be_compiled
1120 //
1121 // Have previous compilations of this method succeeded?
1122 bool ciMethod::can_be_compiled() {
1123 check_is_loaded();
1124 ciEnv* env = CURRENT_ENV;
1125 if (is_c1_compile(env->comp_level())) {
1126 return _is_c1_compilable;
1127 }
1128 return _is_c2_compilable;
1129 }
1130
1131 // ------------------------------------------------------------------
1132 // ciMethod::set_not_compilable
1133 //
1134 // Tell the VM that this method cannot be compiled at all.
1135 void ciMethod::set_not_compilable(const char* reason) {
1136 check_is_loaded();
1137 VM_ENTRY_MARK;
|
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 "ci/ciCallProfile.hpp"
27 #include "ci/ciExceptionHandler.hpp"
28 #include "ci/ciInstanceKlass.hpp"
29 #include "ci/ciMethod.hpp"
30 #include "ci/ciMethodBlocks.hpp"
31 #include "ci/ciMethodData.hpp"
32 #include "ci/ciStreams.hpp"
33 #include "ci/ciSymbol.hpp"
34 #include "ci/ciReplay.hpp"
35 #include "ci/ciUtilities.hpp"
36 #include "classfile/systemDictionary.hpp"
37 #include "compiler/abstractCompiler.hpp"
38 #include "compiler/methodLiveness.hpp"
39 #include "interpreter/interpreter.hpp"
40 #include "interpreter/linkResolver.hpp"
41 #include "interpreter/oopMapCache.hpp"
42 #include "memory/allocation.inline.hpp"
43 #include "memory/resourceArea.hpp"
44 #include "oops/generateOopMap.hpp"
45 #include "oops/oop.inline.hpp"
46 #include "prims/nativeLookup.hpp"
47 #include "runtime/deoptimization.hpp"
48 #include "utilities/bitMap.inline.hpp"
49 #include "utilities/xmlstream.hpp"
50 #include "trace/tracing.hpp"
51 #ifdef COMPILER2
52 #include "ci/bcEscapeAnalyzer.hpp"
53 #include "ci/ciTypeFlow.hpp"
54 #include "oops/method.hpp"
55 #endif
56 #ifdef SHARK
57 #include "ci/ciTypeFlow.hpp"
1026 ciMethodData* ciMethod::method_data_or_null() {
1027 ciMethodData *md = method_data();
1028 if (md->is_empty()) {
1029 return NULL;
1030 }
1031 return md;
1032 }
1033
1034 // ------------------------------------------------------------------
1035 // ciMethod::ensure_method_counters
1036 //
1037 MethodCounters* ciMethod::ensure_method_counters() {
1038 check_is_loaded();
1039 VM_ENTRY_MARK;
1040 methodHandle mh(THREAD, get_Method());
1041 MethodCounters* method_counters = mh->get_method_counters(CHECK_NULL);
1042 return method_counters;
1043 }
1044
1045 // ------------------------------------------------------------------
1046 // ciMethod::has_option
1047 //
1048 bool ciMethod::has_option(const char* option) {
1049 check_is_loaded();
1050 VM_ENTRY_MARK;
1051 methodHandle mh(THREAD, get_Method());
1052 return CompilerOracle::has_option_string(mh, option);
1053 }
1054
1055 // ------------------------------------------------------------------
1056 // ciMethod::has_option_value
1057 //
1058 bool ciMethod::has_option_value(const char* option, double& value) {
1059 check_is_loaded();
1060 VM_ENTRY_MARK;
1061 methodHandle mh(THREAD, get_Method());
1062 return CompilerOracle::has_option_value(mh, option, value);
1063 }
1064 // ------------------------------------------------------------------
1065 // ciMethod::can_be_compiled
1066 //
1067 // Have previous compilations of this method succeeded?
1068 bool ciMethod::can_be_compiled() {
1069 check_is_loaded();
1070 ciEnv* env = CURRENT_ENV;
1071 if (is_c1_compile(env->comp_level())) {
1072 return _is_c1_compilable;
1073 }
1074 return _is_c2_compilable;
1075 }
1076
1077 // ------------------------------------------------------------------
1078 // ciMethod::set_not_compilable
1079 //
1080 // Tell the VM that this method cannot be compiled at all.
1081 void ciMethod::set_not_compilable(const char* reason) {
1082 check_is_loaded();
1083 VM_ENTRY_MARK;
|