7010913: JSR 292 ciMethodHandle does not handle MethodHandleCompiler exceptions properly

Mon, 10 Jan 2011 03:58:07 -0800

author
twisti
date
Mon, 10 Jan 2011 03:58:07 -0800
changeset 2437
70427f06ea47
parent 2436
d810e9a3fc33
child 2438
dd031b2226de

7010913: JSR 292 ciMethodHandle does not handle MethodHandleCompiler exceptions properly
Reviewed-by: kvn, never

src/share/vm/ci/ciMethodHandle.cpp file | annotate | diff | comparison | revisions
src/share/vm/prims/methodHandleWalk.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/ci/ciMethodHandle.cpp	Mon Jan 10 00:56:39 2011 -0800
     1.2 +++ b/src/share/vm/ci/ciMethodHandle.cpp	Mon Jan 10 03:58:07 2011 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -38,11 +38,12 @@
    1.11  // Return an adapter for this MethodHandle.
    1.12  ciMethod* ciMethodHandle::get_adapter(bool is_invokedynamic) const {
    1.13    VM_ENTRY_MARK;
    1.14 -
    1.15    Handle h(get_oop());
    1.16    methodHandle callee(_callee->get_methodOop());
    1.17 -  MethodHandleCompiler mhc(h, callee, is_invokedynamic, THREAD);
    1.18 -  methodHandle m = mhc.compile(CHECK_NULL);
    1.19 +  // We catch all exceptions here that could happen in the method
    1.20 +  // handle compiler and stop the VM.
    1.21 +  MethodHandleCompiler mhc(h, callee, is_invokedynamic, CATCH);
    1.22 +  methodHandle m = mhc.compile(CATCH);
    1.23    return CURRENT_ENV->get_object(m())->as_method();
    1.24  }
    1.25  
     2.1 --- a/src/share/vm/prims/methodHandleWalk.cpp	Mon Jan 10 00:56:39 2011 -0800
     2.2 +++ b/src/share/vm/prims/methodHandleWalk.cpp	Mon Jan 10 03:58:07 2011 -0800
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -137,7 +137,6 @@
    2.11  
    2.12  
    2.13  void MethodHandleChain::lose(const char* msg, TRAPS) {
    2.14 -  assert(false, "lose");
    2.15    _lose_message = msg;
    2.16    if (!THREAD->is_Java_thread() || ((JavaThread*)THREAD)->thread_state() != _thread_in_vm) {
    2.17      // throw a preallocated exception

mercurial