src/share/vm/runtime/os.cpp

changeset 8661
27ae9bbef86a
parent 8329
d2dd79a4fd69
child 8856
ac27a9c85bea
child 9301
d47844b56aaf
equal deleted inserted replaced
8659:c70ebf41026a 8661:27ae9bbef86a
1 /* 1 /*
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2016, 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.
76 address os::_polling_page = NULL; 76 address os::_polling_page = NULL;
77 volatile int32_t* os::_mem_serialize_page = NULL; 77 volatile int32_t* os::_mem_serialize_page = NULL;
78 uintptr_t os::_serialize_page_mask = 0; 78 uintptr_t os::_serialize_page_mask = 0;
79 long os::_rand_seed = 1; 79 long os::_rand_seed = 1;
80 int os::_processor_count = 0; 80 int os::_processor_count = 0;
81 int os::_initial_active_processor_count = 0;
81 size_t os::_page_sizes[os::page_sizes_max]; 82 size_t os::_page_sizes[os::page_sizes_max];
82 83
83 #ifndef PRODUCT 84 #ifndef PRODUCT
84 julong os::num_mallocs = 0; // # of calls to malloc/realloc 85 julong os::num_mallocs = 0; // # of calls to malloc/realloc
85 julong os::alloc_bytes = 0; // # of bytes allocated 86 julong os::alloc_bytes = 0; // # of bytes allocated
320 } 321 }
321 } 322 }
322 } 323 }
323 324
324 void os::init_before_ergo() { 325 void os::init_before_ergo() {
326 initialize_initial_active_processor_count();
325 // We need to initialize large page support here because ergonomics takes some 327 // We need to initialize large page support here because ergonomics takes some
326 // decisions depending on large page support and the calculated large page size. 328 // decisions depending on large page support and the calculated large page size.
327 large_page_init(); 329 large_page_init();
328 330
329 // VM version initialization identifies some characteristics of the 331 // VM version initialization identifies some characteristics of the
833 void os::print_cpu_info(outputStream* st) { 835 void os::print_cpu_info(outputStream* st) {
834 // cpu 836 // cpu
835 st->print("CPU:"); 837 st->print("CPU:");
836 st->print("total %d", os::processor_count()); 838 st->print("total %d", os::processor_count());
837 // It's not safe to query number of active processors after crash 839 // It's not safe to query number of active processors after crash
838 // st->print("(active %d)", os::active_processor_count()); 840 // st->print("(active %d)", os::active_processor_count()); but we can
841 // print the initial number of active processors.
842 // We access the raw value here because the assert in the accessor will
843 // fail if the crash occurs before initialization of this value.
844 st->print(" (initial active %d)", _initial_active_processor_count);
839 st->print(" %s", VM_Version::cpu_features()); 845 st->print(" %s", VM_Version::cpu_features());
840 st->cr(); 846 st->cr();
841 pd_print_cpu_info(st); 847 pd_print_cpu_info(st);
842 } 848 }
843 849
1416 } 1422 }
1417 } 1423 }
1418 return result; 1424 return result;
1419 } 1425 }
1420 1426
1427 void os::initialize_initial_active_processor_count() {
1428 assert(_initial_active_processor_count == 0, "Initial active processor count already set.");
1429 _initial_active_processor_count = active_processor_count();
1430 }
1431
1421 void os::SuspendedThreadTask::run() { 1432 void os::SuspendedThreadTask::run() {
1422 assert(Threads_lock->owned_by_self() || (_thread == VMThread::vm_thread()), "must have threads lock to call this"); 1433 assert(Threads_lock->owned_by_self() || (_thread == VMThread::vm_thread()), "must have threads lock to call this");
1423 internal_do_task(); 1434 internal_do_task();
1424 _done = true; 1435 _done = true;
1425 } 1436 }

mercurial