1 /*
2 * Copyright (c) 1997, 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 *
525 }
526
527 void Universe::set_reference_pending_list(oop list) {
528 assert_pll_ownership();
529 _reference_pending_list = list;
530 }
531
532 bool Universe::has_reference_pending_list() {
533 assert_pll_ownership();
534 return _reference_pending_list != NULL;
535 }
536
537 oop Universe::swap_reference_pending_list(oop list) {
538 assert_pll_locked(is_locked);
539 return Atomic::xchg(list, &_reference_pending_list);
540 }
541
542 #undef assert_pll_locked
543 #undef assert_pll_ownership
544
545
546 static bool has_run_finalizers_on_exit = false;
547
548 void Universe::run_finalizers_on_exit() {
549 if (has_run_finalizers_on_exit) return;
550 has_run_finalizers_on_exit = true;
551
552 // Called on VM exit. This ought to be run in a separate thread.
553 log_trace(ref)("Callback to run finalizers on exit");
554 {
555 PRESERVE_EXCEPTION_MARK;
556 Klass* finalizer_klass = SystemDictionary::Finalizer_klass();
557 JavaValue result(T_VOID);
558 JavaCalls::call_static(
559 &result,
560 finalizer_klass,
561 vmSymbols::run_finalizers_on_exit_name(),
562 vmSymbols::void_method_signature(),
563 THREAD
564 );
565 // Ignore any pending exceptions
566 CLEAR_PENDING_EXCEPTION;
567 }
568 }
569
570
571 // initialize_vtable could cause gc if
572 // 1) we specified true to initialize_vtable and
573 // 2) this ran after gc was enabled
574 // In case those ever change we use handles for oops
575 void Universe::reinitialize_vtable_of(Klass* ko, TRAPS) {
576 // init vtable of k and all subclasses
577 ko->vtable().initialize_vtable(false, CHECK);
578 if (ko->is_instance_klass()) {
579 for (Klass* sk = ko->subklass();
580 sk != NULL;
581 sk = sk->next_sibling()) {
582 reinitialize_vtable_of(sk, CHECK);
583 }
584 }
585 }
586
587
588 void initialize_itable_for_klass(InstanceKlass* k, TRAPS) {
589 k->itable().initialize_itable(false, CHECK);
590 }
|
1 /*
2 * Copyright (c) 1997, 2018, 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 *
525 }
526
527 void Universe::set_reference_pending_list(oop list) {
528 assert_pll_ownership();
529 _reference_pending_list = list;
530 }
531
532 bool Universe::has_reference_pending_list() {
533 assert_pll_ownership();
534 return _reference_pending_list != NULL;
535 }
536
537 oop Universe::swap_reference_pending_list(oop list) {
538 assert_pll_locked(is_locked);
539 return Atomic::xchg(list, &_reference_pending_list);
540 }
541
542 #undef assert_pll_locked
543 #undef assert_pll_ownership
544
545 // initialize_vtable could cause gc if
546 // 1) we specified true to initialize_vtable and
547 // 2) this ran after gc was enabled
548 // In case those ever change we use handles for oops
549 void Universe::reinitialize_vtable_of(Klass* ko, TRAPS) {
550 // init vtable of k and all subclasses
551 ko->vtable().initialize_vtable(false, CHECK);
552 if (ko->is_instance_klass()) {
553 for (Klass* sk = ko->subklass();
554 sk != NULL;
555 sk = sk->next_sibling()) {
556 reinitialize_vtable_of(sk, CHECK);
557 }
558 }
559 }
560
561
562 void initialize_itable_for_klass(InstanceKlass* k, TRAPS) {
563 k->itable().initialize_itable(false, CHECK);
564 }
|