8005820: Shark: enable JSR292 support

Fri, 11 Jan 2013 16:47:23 -0800

author
twisti
date
Fri, 11 Jan 2013 16:47:23 -0800
changeset 4444
606eada1bf86
parent 4443
c095a7f289aa
child 4445
6d1f5516534e

8005820: Shark: enable JSR292 support
Reviewed-by: twisti
Contributed-by: Roman Kennke <rkennke@redhat.com>

src/share/vm/compiler/abstractCompiler.hpp file | annotate | diff | comparison | revisions
src/share/vm/compiler/compileBroker.cpp file | annotate | diff | comparison | revisions
src/share/vm/shark/sharkBlock.cpp file | annotate | diff | comparison | revisions
src/share/vm/shark/sharkCompiler.hpp file | annotate | diff | comparison | revisions
src/share/vm/shark/sharkConstant.cpp file | annotate | diff | comparison | revisions
src/share/vm/shark/sharkInliner.cpp file | annotate | diff | comparison | revisions
src/share/vm/shark/sharkTopLevelBlock.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/compiler/abstractCompiler.hpp	Fri Jan 11 16:47:23 2013 -0800
     1.2 +++ b/src/share/vm/compiler/abstractCompiler.hpp	Fri Jan 11 16:47:23 2013 -0800
     1.3 @@ -50,6 +50,7 @@
     1.4    // Missing feature tests
     1.5    virtual bool supports_native()                 { return true; }
     1.6    virtual bool supports_osr   ()                 { return true; }
     1.7 +  virtual bool can_compile_method(methodHandle method)  { return true; }
     1.8  #if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK))
     1.9    virtual bool is_c1   ()                        { return false; }
    1.10    virtual bool is_c2   ()                        { return false; }
     2.1 --- a/src/share/vm/compiler/compileBroker.cpp	Fri Jan 11 16:47:23 2013 -0800
     2.2 +++ b/src/share/vm/compiler/compileBroker.cpp	Fri Jan 11 16:47:23 2013 -0800
     2.3 @@ -1218,7 +1218,7 @@
     2.4    // lock, make sure that the compilation
     2.5    // isn't prohibited in a straightforward way.
     2.6  
     2.7 -  if (compiler(comp_level) == NULL || compilation_is_prohibited(method, osr_bci, comp_level)) {
     2.8 +  if (compiler(comp_level) == NULL || !compiler(comp_level)->can_compile_method(method) || compilation_is_prohibited(method, osr_bci, comp_level)) {
     2.9      return NULL;
    2.10    }
    2.11  
     3.1 --- a/src/share/vm/shark/sharkBlock.cpp	Fri Jan 11 16:47:23 2013 -0800
     3.2 +++ b/src/share/vm/shark/sharkBlock.cpp	Fri Jan 11 16:47:23 2013 -0800
     3.3 @@ -1032,7 +1032,7 @@
     3.4      check_null(value);
     3.5      object = value->generic_value();
     3.6    }
     3.7 -  if (is_get && field->is_constant()) {
     3.8 +  if (is_get && field->is_constant() && field->is_static()) {
     3.9      SharkConstant *constant = SharkConstant::for_field(iter());
    3.10      if (constant->is_loaded())
    3.11        value = constant->value(builder());
     4.1 --- a/src/share/vm/shark/sharkCompiler.hpp	Fri Jan 11 16:47:23 2013 -0800
     4.2 +++ b/src/share/vm/shark/sharkCompiler.hpp	Fri Jan 11 16:47:23 2013 -0800
     4.3 @@ -46,6 +46,9 @@
     4.4    // Missing feature tests
     4.5    bool supports_native() { return true; }
     4.6    bool supports_osr()    { return true; }
     4.7 +  bool can_compile_method(methodHandle method)  {
     4.8 +    return ! (method->is_method_handle_intrinsic() || method->is_compiled_lambda_form());
     4.9 +  }
    4.10  
    4.11    // Customization
    4.12    bool needs_adapters()  { return false; }
     5.1 --- a/src/share/vm/shark/sharkConstant.cpp	Fri Jan 11 16:47:23 2013 -0800
     5.2 +++ b/src/share/vm/shark/sharkConstant.cpp	Fri Jan 11 16:47:23 2013 -0800
     5.3 @@ -37,7 +37,12 @@
     5.4    ciType *type = NULL;
     5.5    if (constant.basic_type() == T_OBJECT) {
     5.6      ciEnv *env = ciEnv::current();
     5.7 -    assert(constant.as_object()->klass() == env->String_klass() || constant.as_object()->klass() == env->Class_klass(), "should be");
     5.8 +
     5.9 +    assert(constant.as_object()->klass() == env->String_klass()
    5.10 +           || constant.as_object()->klass() == env->Class_klass()
    5.11 +           || constant.as_object()->klass()->is_subtype_of(env->MethodType_klass())
    5.12 +           || constant.as_object()->klass()->is_subtype_of(env->MethodHandle_klass()), "should be");
    5.13 +
    5.14      type = constant.as_object()->klass();
    5.15    }
    5.16    return new SharkConstant(constant, type);
     6.1 --- a/src/share/vm/shark/sharkInliner.cpp	Fri Jan 11 16:47:23 2013 -0800
     6.2 +++ b/src/share/vm/shark/sharkInliner.cpp	Fri Jan 11 16:47:23 2013 -0800
     6.3 @@ -725,7 +725,7 @@
     6.4    // Push the result if necessary
     6.5    if (is_get) {
     6.6      bool result_pushed = false;
     6.7 -    if (field->is_constant()) {
     6.8 +    if (field->is_constant() && field->is_static()) {
     6.9        SharkConstant *sc = SharkConstant::for_field(iter());
    6.10        if (sc->is_loaded()) {
    6.11          push(sc->is_nonzero());
     7.1 --- a/src/share/vm/shark/sharkTopLevelBlock.cpp	Fri Jan 11 16:47:23 2013 -0800
     7.2 +++ b/src/share/vm/shark/sharkTopLevelBlock.cpp	Fri Jan 11 16:47:23 2013 -0800
     7.3 @@ -113,7 +113,19 @@
     7.4        ciSignature* sig;
     7.5        method = iter()->get_method(will_link, &sig);
     7.6        assert(will_link, "typeflow responsibility");
     7.7 -
     7.8 +      // We can't compile calls to method handle intrinsics, because we use
     7.9 +      // the interpreter entry points and they expect the top frame to be an
    7.10 +      // interpreter frame. We need to implement the intrinsics for Shark.
    7.11 +      if (method->is_method_handle_intrinsic() || method->is_compiled_lambda_form()) {
    7.12 +        if (SharkPerformanceWarnings) {
    7.13 +          warning("JSR292 optimization not yet implemented in Shark");
    7.14 +        }
    7.15 +        set_trap(
    7.16 +          Deoptimization::make_trap_request(
    7.17 +            Deoptimization::Reason_unhandled,
    7.18 +            Deoptimization::Action_make_not_compilable), bci());
    7.19 +          return;
    7.20 +      }
    7.21        if (!method->holder()->is_linked()) {
    7.22          set_trap(
    7.23            Deoptimization::make_trap_request(
    7.24 @@ -158,6 +170,16 @@
    7.25          return;
    7.26        }
    7.27        break;
    7.28 +    case Bytecodes::_invokedynamic:
    7.29 +    case Bytecodes::_invokehandle:
    7.30 +      if (SharkPerformanceWarnings) {
    7.31 +        warning("JSR292 optimization not yet implemented in Shark");
    7.32 +      }
    7.33 +      set_trap(
    7.34 +        Deoptimization::make_trap_request(
    7.35 +          Deoptimization::Reason_unhandled,
    7.36 +          Deoptimization::Action_make_not_compilable), bci());
    7.37 +      return;
    7.38      }
    7.39    }
    7.40  

mercurial