提交 5ff05585 编写于 作者: T twisti

8005820: Shark: enable JSR292 support

Reviewed-by: twisti
Contributed-by: NRoman Kennke <rkennke@redhat.com>
上级 77ac5c1b
...@@ -50,6 +50,7 @@ class AbstractCompiler : public CHeapObj<mtCompiler> { ...@@ -50,6 +50,7 @@ class AbstractCompiler : public CHeapObj<mtCompiler> {
// Missing feature tests // Missing feature tests
virtual bool supports_native() { return true; } virtual bool supports_native() { return true; }
virtual bool supports_osr () { return true; } virtual bool supports_osr () { return true; }
virtual bool can_compile_method(methodHandle method) { return true; }
#if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK)) #if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK))
virtual bool is_c1 () { return false; } virtual bool is_c1 () { return false; }
virtual bool is_c2 () { return false; } virtual bool is_c2 () { return false; }
......
...@@ -1218,7 +1218,7 @@ nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci, ...@@ -1218,7 +1218,7 @@ nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci,
// lock, make sure that the compilation // lock, make sure that the compilation
// isn't prohibited in a straightforward way. // isn't prohibited in a straightforward way.
if (compiler(comp_level) == NULL || compilation_is_prohibited(method, osr_bci, comp_level)) { if (compiler(comp_level) == NULL || !compiler(comp_level)->can_compile_method(method) || compilation_is_prohibited(method, osr_bci, comp_level)) {
return NULL; return NULL;
} }
......
...@@ -1032,7 +1032,7 @@ void SharkBlock::do_field_access(bool is_get, bool is_field) { ...@@ -1032,7 +1032,7 @@ void SharkBlock::do_field_access(bool is_get, bool is_field) {
check_null(value); check_null(value);
object = value->generic_value(); object = value->generic_value();
} }
if (is_get && field->is_constant()) { if (is_get && field->is_constant() && field->is_static()) {
SharkConstant *constant = SharkConstant::for_field(iter()); SharkConstant *constant = SharkConstant::for_field(iter());
if (constant->is_loaded()) if (constant->is_loaded())
value = constant->value(builder()); value = constant->value(builder());
......
...@@ -46,6 +46,9 @@ class SharkCompiler : public AbstractCompiler { ...@@ -46,6 +46,9 @@ class SharkCompiler : public AbstractCompiler {
// Missing feature tests // Missing feature tests
bool supports_native() { return true; } bool supports_native() { return true; }
bool supports_osr() { return true; } bool supports_osr() { return true; }
bool can_compile_method(methodHandle method) {
return ! (method->is_method_handle_intrinsic() || method->is_compiled_lambda_form());
}
// Customization // Customization
bool needs_adapters() { return false; } bool needs_adapters() { return false; }
......
...@@ -37,7 +37,12 @@ SharkConstant* SharkConstant::for_ldc(ciBytecodeStream *iter) { ...@@ -37,7 +37,12 @@ SharkConstant* SharkConstant::for_ldc(ciBytecodeStream *iter) {
ciType *type = NULL; ciType *type = NULL;
if (constant.basic_type() == T_OBJECT) { if (constant.basic_type() == T_OBJECT) {
ciEnv *env = ciEnv::current(); ciEnv *env = ciEnv::current();
assert(constant.as_object()->klass() == env->String_klass() || constant.as_object()->klass() == env->Class_klass(), "should be");
assert(constant.as_object()->klass() == env->String_klass()
|| constant.as_object()->klass() == env->Class_klass()
|| constant.as_object()->klass()->is_subtype_of(env->MethodType_klass())
|| constant.as_object()->klass()->is_subtype_of(env->MethodHandle_klass()), "should be");
type = constant.as_object()->klass(); type = constant.as_object()->klass();
} }
return new SharkConstant(constant, type); return new SharkConstant(constant, type);
......
...@@ -725,7 +725,7 @@ bool SharkInlinerHelper::do_field_access(bool is_get, bool is_field) { ...@@ -725,7 +725,7 @@ bool SharkInlinerHelper::do_field_access(bool is_get, bool is_field) {
// Push the result if necessary // Push the result if necessary
if (is_get) { if (is_get) {
bool result_pushed = false; bool result_pushed = false;
if (field->is_constant()) { if (field->is_constant() && field->is_static()) {
SharkConstant *sc = SharkConstant::for_field(iter()); SharkConstant *sc = SharkConstant::for_field(iter());
if (sc->is_loaded()) { if (sc->is_loaded()) {
push(sc->is_nonzero()); push(sc->is_nonzero());
......
...@@ -113,7 +113,19 @@ void SharkTopLevelBlock::scan_for_traps() { ...@@ -113,7 +113,19 @@ void SharkTopLevelBlock::scan_for_traps() {
ciSignature* sig; ciSignature* sig;
method = iter()->get_method(will_link, &sig); method = iter()->get_method(will_link, &sig);
assert(will_link, "typeflow responsibility"); assert(will_link, "typeflow responsibility");
// We can't compile calls to method handle intrinsics, because we use
// the interpreter entry points and they expect the top frame to be an
// interpreter frame. We need to implement the intrinsics for Shark.
if (method->is_method_handle_intrinsic() || method->is_compiled_lambda_form()) {
if (SharkPerformanceWarnings) {
warning("JSR292 optimization not yet implemented in Shark");
}
set_trap(
Deoptimization::make_trap_request(
Deoptimization::Reason_unhandled,
Deoptimization::Action_make_not_compilable), bci());
return;
}
if (!method->holder()->is_linked()) { if (!method->holder()->is_linked()) {
set_trap( set_trap(
Deoptimization::make_trap_request( Deoptimization::make_trap_request(
...@@ -158,6 +170,16 @@ void SharkTopLevelBlock::scan_for_traps() { ...@@ -158,6 +170,16 @@ void SharkTopLevelBlock::scan_for_traps() {
return; return;
} }
break; break;
case Bytecodes::_invokedynamic:
case Bytecodes::_invokehandle:
if (SharkPerformanceWarnings) {
warning("JSR292 optimization not yet implemented in Shark");
}
set_trap(
Deoptimization::make_trap_request(
Deoptimization::Reason_unhandled,
Deoptimization::Action_make_not_compilable), bci());
return;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册