1 /* |
1 /* |
2 * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2015, 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. |
30 #include "runtime/mutexLocker.hpp" |
30 #include "runtime/mutexLocker.hpp" |
31 #include "services/classLoadingService.hpp" |
31 #include "services/classLoadingService.hpp" |
32 #include "services/memoryService.hpp" |
32 #include "services/memoryService.hpp" |
33 #include "utilities/dtrace.hpp" |
33 #include "utilities/dtrace.hpp" |
34 #include "utilities/macros.hpp" |
34 #include "utilities/macros.hpp" |
|
35 #include "utilities/defaultStream.hpp" |
35 |
36 |
36 #ifdef DTRACE_ENABLED |
37 #ifdef DTRACE_ENABLED |
37 |
38 |
38 // Only bother with this argument setup if dtrace is available |
39 // Only bother with this argument setup if dtrace is available |
39 |
40 |
174 //class_size += k->fields()->size(); |
175 //class_size += k->fields()->size(); |
175 } |
176 } |
176 return class_size * oopSize; |
177 return class_size * oopSize; |
177 } |
178 } |
178 |
179 |
179 |
|
180 bool ClassLoadingService::set_verbose(bool verbose) { |
180 bool ClassLoadingService::set_verbose(bool verbose) { |
181 MutexLocker m(Management_lock); |
181 MutexLocker m(Management_lock); |
182 |
182 |
183 // verbose will be set to the previous value |
183 // verbose will be set to the previous value |
184 bool succeed = CommandLineFlags::boolAtPut((char*)"TraceClassLoading", &verbose, Flag::MANAGEMENT); |
184 Flag::Error error = CommandLineFlags::boolAtPut("TraceClassLoading", &verbose, Flag::MANAGEMENT); |
185 assert(succeed, "Setting TraceClassLoading flag fails"); |
185 assert(error==Flag::SUCCESS, err_msg("Setting TraceClassLoading flag failed with error %s", Flag::flag_error_str(error))); |
186 reset_trace_class_unloading(); |
186 reset_trace_class_unloading(); |
187 |
187 |
188 return verbose; |
188 return verbose; |
189 } |
189 } |
190 |
190 |
191 // Caller to this function must own Management_lock |
191 // Caller to this function must own Management_lock |
192 void ClassLoadingService::reset_trace_class_unloading() { |
192 void ClassLoadingService::reset_trace_class_unloading() { |
193 assert(Management_lock->owned_by_self(), "Must own the Management_lock"); |
193 assert(Management_lock->owned_by_self(), "Must own the Management_lock"); |
194 bool value = MemoryService::get_verbose() || ClassLoadingService::get_verbose(); |
194 bool value = MemoryService::get_verbose() || ClassLoadingService::get_verbose(); |
195 bool succeed = CommandLineFlags::boolAtPut((char*)"TraceClassUnloading", &value, Flag::MANAGEMENT); |
195 Flag::Error error = CommandLineFlags::boolAtPut("TraceClassUnloading", &value, Flag::MANAGEMENT); |
196 assert(succeed, "Setting TraceClassUnLoading flag fails"); |
196 assert(error==Flag::SUCCESS, err_msg("Setting TraceClassUnLoading flag failed with error %s", Flag::flag_error_str(error))); |
197 } |
197 } |
198 |
198 |
199 GrowableArray<KlassHandle>* LoadedClassesEnumerator::_loaded_classes = NULL; |
199 GrowableArray<KlassHandle>* LoadedClassesEnumerator::_loaded_classes = NULL; |
200 Thread* LoadedClassesEnumerator::_current_thread = NULL; |
200 Thread* LoadedClassesEnumerator::_current_thread = NULL; |
201 |
201 |