equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2019, 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. |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "jni.h" |
26 #include "jni.h" |
27 #include "classfile/javaClasses.hpp" |
27 #include "classfile/javaClasses.hpp" |
28 #include "classfile/symbolTable.hpp" |
28 #include "classfile/symbolTable.hpp" |
29 #include "classfile/systemDictionary.hpp" |
29 #include "classfile/systemDictionary.hpp" |
|
30 #include "jfr/jfr.hpp" |
30 #include "jfr/jni/jfrJavaSupport.hpp" |
31 #include "jfr/jni/jfrJavaSupport.hpp" |
31 #include "jfr/recorder/jfrRecorder.hpp" |
32 #include "jfr/recorder/jfrRecorder.hpp" |
32 #include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp" |
33 #include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp" |
33 #include "jfr/recorder/service/jfrRecorderThread.hpp" |
34 #include "jfr/recorder/service/jfrRecorderThread.hpp" |
34 #include "memory/resourceArea.hpp" |
35 #include "memory/resourceArea.hpp" |
62 } |
63 } |
63 } |
64 } |
64 if (allocation_failed) { |
65 if (allocation_failed) { |
65 JfrJavaSupport::throw_out_of_memory_error("Unable to create native recording thread for JFR", CHECK_NULL); |
66 JfrJavaSupport::throw_out_of_memory_error("Unable to create native recording thread for JFR", CHECK_NULL); |
66 } |
67 } |
67 |
|
68 Thread::start(new_thread); |
68 Thread::start(new_thread); |
69 return new_thread; |
69 return new_thread; |
70 } |
70 } |
71 |
71 |
72 JfrPostBox* JfrRecorderThread::_post_box = NULL; |
72 JfrPostBox* JfrRecorderThread::_post_box = NULL; |
96 |
96 |
97 JfrJavaSupport::call_static(&create_thread_args, CHECK_false); |
97 JfrJavaSupport::call_static(&create_thread_args, CHECK_false); |
98 instanceHandle h_thread_oop(THREAD, (instanceOop)result.get_jobject()); |
98 instanceHandle h_thread_oop(THREAD, (instanceOop)result.get_jobject()); |
99 assert(h_thread_oop.not_null(), "invariant"); |
99 assert(h_thread_oop.not_null(), "invariant"); |
100 // attempt thread start |
100 // attempt thread start |
101 const Thread* const t = start_thread(h_thread_oop, recorderthread_entry,THREAD); |
101 Thread* const t = start_thread(h_thread_oop, recorderthread_entry,THREAD); |
102 if (!HAS_PENDING_EXCEPTION) { |
102 if (!HAS_PENDING_EXCEPTION) { |
|
103 Jfr::exclude_thread(t); |
103 cp_manager->register_service_thread(t); |
104 cp_manager->register_service_thread(t); |
104 return true; |
105 return true; |
105 } |
106 } |
106 assert(HAS_PENDING_EXCEPTION, "invariant"); |
107 assert(HAS_PENDING_EXCEPTION, "invariant"); |
107 // Start failed, remove the thread from the system thread group |
108 // Start failed, remove the thread from the system thread group |