58 // shutdown of the corresponding compiler runtime. 59 bool should_perform_shutdown(); 60 61 // Name of this compiler 62 virtual const char* name() = 0; 63 64 // Missing feature tests 65 virtual bool supports_native() { return true; } 66 virtual bool supports_osr () { return true; } 67 virtual bool can_compile_method(methodHandle method) { return true; } 68 69 // Determine if the current compiler provides an intrinsic 70 // for method 'method'. An intrinsic is available if: 71 // - the intrinsic is enabled (by using the appropriate command-line flag) and 72 // - the platform on which the VM is running supports the intrinsic 73 // (i.e., the platform provides the instructions necessary for the compiler 74 // to generate the intrinsic code). 75 // 76 // The second parameter, 'compilation_context', is needed to implement functionality 77 // related to the DisableIntrinsic command-line flag. The DisableIntrinsic flag can 78 // be used to prohibit the C2 compiler (but not the C1 compiler) to use an intrinsic. 79 // There are three ways to disable an intrinsic using the DisableIntrinsic flag: 80 // 81 // (1) -XX:DisableIntrinsic=_hashCode,_getClass 82 // Disables intrinsification of _hashCode and _getClass globally 83 // (i.e., the intrinsified version the methods will not be used at all). 84 // (2) -XX:CompileCommand=option,aClass::aMethod,ccstr,DisableIntrinsic,_hashCode 85 // Disables intrinsification of _hashCode if it is called from 86 // aClass::aMethod (but not for any other call site of _hashCode) 87 // (3) -XX:CompileCommand=option,java.lang.ref.Reference::get,ccstr,DisableIntrinsic,_Reference_get 88 // Some methods are not compiled by C2. Instead, the C2 compiler 89 // returns directly the intrinsified version of these methods. 90 // The command above forces C2 to compile _Reference_get, but 91 // allows using the intrinsified version of _Reference_get at all 92 // other call sites. 93 // 94 // From the modes above, (1) disable intrinsics globally, (2) and (3) 95 // disable intrinsics on a per-method basis. In cases (2) and (3) the 96 // compilation context is aClass::aMethod and java.lang.ref.Reference::get, 97 // respectively. 98 virtual bool is_intrinsic_available(methodHandle method, methodHandle compilation_context) { 99 return false; 100 } 101 102 // Determines if an intrinsic is supported by the compiler, that is, 103 // the compiler provides the instructions necessary to generate 104 // the intrinsic code for method 'method'. 105 // 106 // The 'is_intrinsic_supported' method is a white list, that is, 107 // by default no intrinsics are supported by a compiler except 108 // the ones listed in the method. Overriding methods should conform 109 // to this behavior. 110 virtual bool is_intrinsic_supported(methodHandle method) { 111 return false; 112 } 113 114 // Implements compiler-specific processing of command-line flags. 115 // Processing of command-line flags common to all compilers is implemented 116 // in vmIntrinsicss::is_disabled_by_flag. 117 virtual bool is_intrinsic_disabled_by_flag(methodHandle method) { 118 return false; 119 } 120 121 // Compiler type queries. 122 bool is_c1() { return _type == c1; } 123 bool is_c2() { return _type == c2; } 124 bool is_shark() { return _type == shark; } 125 126 // Customization 127 virtual void initialize () = 0; 128 129 void set_num_compiler_threads(int num) { _num_compiler_threads = num; } 130 int num_compiler_threads() { return _num_compiler_threads; } 131 132 // Get/set state of compiler objects 133 bool is_initialized() { return _compiler_state == initialized; } 134 bool is_failed () { return _compiler_state == failed;} 135 void set_state (int state); 136 void set_shut_down () { set_state(shut_down); } 137 // Compilation entry point for methods | 58 // shutdown of the corresponding compiler runtime. 59 bool should_perform_shutdown(); 60 61 // Name of this compiler 62 virtual const char* name() = 0; 63 64 // Missing feature tests 65 virtual bool supports_native() { return true; } 66 virtual bool supports_osr () { return true; } 67 virtual bool can_compile_method(methodHandle method) { return true; } 68 69 // Determine if the current compiler provides an intrinsic 70 // for method 'method'. An intrinsic is available if: 71 // - the intrinsic is enabled (by using the appropriate command-line flag) and 72 // - the platform on which the VM is running supports the intrinsic 73 // (i.e., the platform provides the instructions necessary for the compiler 74 // to generate the intrinsic code). 75 // 76 // The second parameter, 'compilation_context', is needed to implement functionality 77 // related to the DisableIntrinsic command-line flag. The DisableIntrinsic flag can 78 // be used to prohibit the compilers to use an intrinsic. There are three ways to 79 // disable an intrinsic using the DisableIntrinsic flag: 80 // 81 // (1) -XX:DisableIntrinsic=_hashCode,_getClass 82 // Disables intrinsification of _hashCode and _getClass globally 83 // (i.e., the intrinsified version the methods will not be used at all). 84 // (2) -XX:CompileCommand=option,aClass::aMethod,ccstr,DisableIntrinsic,_hashCode 85 // Disables intrinsification of _hashCode if it is called from 86 // aClass::aMethod (but not for any other call site of _hashCode) 87 // (3) -XX:CompileCommand=option,java.lang.ref.Reference::get,ccstr,DisableIntrinsic,_Reference_get 88 // Some methods are not compiled by C2. Instead, the C2 compiler 89 // returns directly the intrinsified version of these methods. 90 // The command above forces C2 to compile _Reference_get, but 91 // allows using the intrinsified version of _Reference_get at all 92 // other call sites. 93 // 94 // From the modes above, (1) disable intrinsics globally, (2) and (3) 95 // disable intrinsics on a per-method basis. In cases (2) and (3) the 96 // compilation context is aClass::aMethod and java.lang.ref.Reference::get, 97 // respectively. 98 virtual bool is_intrinsic_available(methodHandle method, methodHandle compilation_context) { 99 return is_intrinsic_supported(method) && 100 !vmIntrinsics::is_disabled_by_flags(method, compilation_context); 101 } 102 103 // Determines if an intrinsic is supported by the compiler, that is, 104 // the compiler provides the instructions necessary to generate 105 // the intrinsic code for method 'method'. 106 // 107 // The 'is_intrinsic_supported' method is a white list, that is, 108 // by default no intrinsics are supported by a compiler except 109 // the ones listed in the method. Overriding methods should conform 110 // to this behavior. 111 virtual bool is_intrinsic_supported(methodHandle method) { 112 return false; 113 } 114 115 // Compiler type queries. 116 bool is_c1() { return _type == c1; } 117 bool is_c2() { return _type == c2; } 118 bool is_shark() { return _type == shark; } 119 120 // Customization 121 virtual void initialize () = 0; 122 123 void set_num_compiler_threads(int num) { _num_compiler_threads = num; } 124 int num_compiler_threads() { return _num_compiler_threads; } 125 126 // Get/set state of compiler objects 127 bool is_initialized() { return _compiler_state == initialized; } 128 bool is_failed () { return _compiler_state == failed;} 129 void set_state (int state); 130 void set_shut_down () { set_state(shut_down); } 131 // Compilation entry point for methods |