1 /*
2 * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
385 //
386 // Which local variables are live at a specific bci?
387 MethodLivenessResult ciMethod::raw_liveness_at_bci(int bci) {
388 check_is_loaded();
389 if (_liveness == NULL) {
390 // Create the liveness analyzer.
391 Arena* arena = CURRENT_ENV->arena();
392 _liveness = new (arena) MethodLiveness(arena, this);
393 _liveness->compute_liveness();
394 }
395 return _liveness->get_liveness_at(bci);
396 }
397
398 // ------------------------------------------------------------------
399 // ciMethod::liveness_at_bci
400 //
401 // Which local variables are live at a specific bci? When debugging
402 // will return true for all locals in some cases to improve debug
403 // information.
404 MethodLivenessResult ciMethod::liveness_at_bci(int bci) {
405 MethodLivenessResult result = raw_liveness_at_bci(bci);
406 if (CURRENT_ENV->should_retain_local_variables() || DeoptimizeALot || CompileTheWorld) {
407 // Keep all locals live for the user's edification and amusement.
408 result.at_put_range(0, result.size(), true);
409 }
410 return result;
411 }
412
413 // ciMethod::live_local_oops_at_bci
414 //
415 // find all the live oops in the locals array for a particular bci
416 // Compute what the interpreter believes by using the interpreter
417 // oopmap generator. This is used as a double check during osr to
418 // guard against conservative result from MethodLiveness making us
419 // think a dead oop is live. MethodLiveness is conservative in the
420 // sense that it may consider locals to be live which cannot be live,
421 // like in the case where a local could contain an oop or a primitive
422 // along different paths. In that case the local must be dead when
423 // those paths merge. Since the interpreter's viewpoint is used when
424 // gc'ing an interpreter frame we need to use its viewpoint during
425 // OSR when loading the locals.
426
427 ResourceBitMap ciMethod::live_local_oops_at_bci(int bci) {
428 VM_ENTRY_MARK;
429 InterpreterOopMap mask;
430 OopMapCache::compute_one_oop_map(get_Method(), bci, &mask);
|
1 /*
2 * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
385 //
386 // Which local variables are live at a specific bci?
387 MethodLivenessResult ciMethod::raw_liveness_at_bci(int bci) {
388 check_is_loaded();
389 if (_liveness == NULL) {
390 // Create the liveness analyzer.
391 Arena* arena = CURRENT_ENV->arena();
392 _liveness = new (arena) MethodLiveness(arena, this);
393 _liveness->compute_liveness();
394 }
395 return _liveness->get_liveness_at(bci);
396 }
397
398 // ------------------------------------------------------------------
399 // ciMethod::liveness_at_bci
400 //
401 // Which local variables are live at a specific bci? When debugging
402 // will return true for all locals in some cases to improve debug
403 // information.
404 MethodLivenessResult ciMethod::liveness_at_bci(int bci) {
405 if (CURRENT_ENV->should_retain_local_variables() || DeoptimizeALot || CompileTheWorld) {
406 // Keep all locals live for the user's edification and amusement.
407 MethodLivenessResult result(_max_locals);
408 result.set_range(0, _max_locals);
409 result.set_is_valid();
410 return result;
411 }
412 return raw_liveness_at_bci(bci);
413 }
414
415 // ciMethod::live_local_oops_at_bci
416 //
417 // find all the live oops in the locals array for a particular bci
418 // Compute what the interpreter believes by using the interpreter
419 // oopmap generator. This is used as a double check during osr to
420 // guard against conservative result from MethodLiveness making us
421 // think a dead oop is live. MethodLiveness is conservative in the
422 // sense that it may consider locals to be live which cannot be live,
423 // like in the case where a local could contain an oop or a primitive
424 // along different paths. In that case the local must be dead when
425 // those paths merge. Since the interpreter's viewpoint is used when
426 // gc'ing an interpreter frame we need to use its viewpoint during
427 // OSR when loading the locals.
428
429 ResourceBitMap ciMethod::live_local_oops_at_bci(int bci) {
430 VM_ENTRY_MARK;
431 InterpreterOopMap mask;
432 OopMapCache::compute_one_oop_map(get_Method(), bci, &mask);
|