comparison src/share/vm/ci/bcEscapeAnalyzer.cpp @ 2164:bb2c2878f134

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
author twisti
date Thu, 20 Jan 2011 08:25:22 -0800
parents f95d63e2154a
children a7367756024b
comparison
equal deleted inserted replaced
2141:b599a4c6c2df 2164:bb2c2878f134
1 /* 1 /*
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
231 code = Bytecodes::_invokespecial; 231 code = Bytecodes::_invokespecial;
232 } 232 }
233 233
234 // compute size of arguments 234 // compute size of arguments
235 int arg_size = target->arg_size(); 235 int arg_size = target->arg_size();
236 if (code == Bytecodes::_invokedynamic) {
237 assert(!target->is_static(), "receiver explicit in method");
238 arg_size--; // implicit, not really on stack
239 }
236 if (!target->is_loaded() && code == Bytecodes::_invokestatic) { 240 if (!target->is_loaded() && code == Bytecodes::_invokestatic) {
237 arg_size--; 241 arg_size--;
238 } 242 }
239 int arg_base = MAX2(state._stack_height - arg_size, 0); 243 int arg_base = MAX2(state._stack_height - arg_size, 0);
240 244
247 // check if analysis of callee can safely be skipped 251 // check if analysis of callee can safely be skipped
248 bool skip_callee = true; 252 bool skip_callee = true;
249 for (i = state._stack_height - 1; i >= arg_base && skip_callee; i--) { 253 for (i = state._stack_height - 1; i >= arg_base && skip_callee; i--) {
250 ArgumentMap arg = state._stack[i]; 254 ArgumentMap arg = state._stack[i];
251 skip_callee = !is_argument(arg) || !is_arg_stack(arg) || (directly_recursive && arg.is_singleton(i - arg_base)); 255 skip_callee = !is_argument(arg) || !is_arg_stack(arg) || (directly_recursive && arg.is_singleton(i - arg_base));
256 }
257 // For now we conservatively skip invokedynamic.
258 if (code == Bytecodes::_invokedynamic) {
259 skip_callee = true;
252 } 260 }
253 if (skip_callee) { 261 if (skip_callee) {
254 TRACE_BCEA(3, tty->print_cr("[EA] skipping method %s::%s", holder->name()->as_utf8(), target->name()->as_utf8())); 262 TRACE_BCEA(3, tty->print_cr("[EA] skipping method %s::%s", holder->name()->as_utf8(), target->name()->as_utf8()));
255 for (i = 0; i < arg_size; i++) { 263 for (i = 0; i < arg_size; i++) {
256 set_method_escape(state.raw_pop()); 264 set_method_escape(state.raw_pop());