From 5bee1193503d85f418c300240825885c4e14337a Mon Sep 17 00:00:00 2001 From: twisti Date: Thu, 20 Jan 2011 08:25:22 -0800 Subject: [PATCH] 7011839: JSR 292 turn on escape analysis when using invokedynamic Summary: Currently escape analysis is turned off when EnableInvokeDynamic is true. Reviewed-by: jrose, kvn --- src/share/vm/ci/bcEscapeAnalyzer.cpp | 10 +++++++++- src/share/vm/runtime/arguments.cpp | 9 --------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/share/vm/ci/bcEscapeAnalyzer.cpp b/src/share/vm/ci/bcEscapeAnalyzer.cpp index acf3bfaad..b74262744 100644 --- a/src/share/vm/ci/bcEscapeAnalyzer.cpp +++ b/src/share/vm/ci/bcEscapeAnalyzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -233,6 +233,10 @@ void BCEscapeAnalyzer::invoke(StateInfo &state, Bytecodes::Code code, ciMethod* // compute size of arguments int arg_size = target->arg_size(); + if (code == Bytecodes::_invokedynamic) { + assert(!target->is_static(), "receiver explicit in method"); + arg_size--; // implicit, not really on stack + } if (!target->is_loaded() && code == Bytecodes::_invokestatic) { arg_size--; } @@ -250,6 +254,10 @@ void BCEscapeAnalyzer::invoke(StateInfo &state, Bytecodes::Code code, ciMethod* ArgumentMap arg = state._stack[i]; skip_callee = !is_argument(arg) || !is_arg_stack(arg) || (directly_recursive && arg.is_singleton(i - arg_base)); } + // For now we conservatively skip invokedynamic. + if (code == Bytecodes::_invokedynamic) { + skip_callee = true; + } if (skip_callee) { TRACE_BCEA(3, tty->print_cr("[EA] skipping method %s::%s", holder->name()->as_utf8(), target->name()->as_utf8())); for (i = 0; i < arg_size; i++) { diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp index b106d08fc..436f45576 100644 --- a/src/share/vm/runtime/arguments.cpp +++ b/src/share/vm/runtime/arguments.cpp @@ -3029,15 +3029,6 @@ jint Arguments::parse(const JavaVMInitArgs* args) { } ScavengeRootsInCode = 1; } -#ifdef COMPILER2 - if (EnableInvokeDynamic && DoEscapeAnalysis) { - // TODO: We need to find rules for invokedynamic and EA. For now, - // simply disable EA by default. - if (FLAG_IS_DEFAULT(DoEscapeAnalysis)) { - DoEscapeAnalysis = false; - } - } -#endif if (PrintGCDetails) { // Turn on -verbose:gc options as well -- GitLab