Skip to content

Commit

Permalink
Used static_cast instead of raw C-style cast
Browse files Browse the repository at this point in the history
Moved inline functions to thread.inline.hpp
Updated #includes to deal with the move to thread.inline.hpp
Updated copyright year where needed.
  • Loading branch information
dholmes-ora committed Sep 8, 2020
1 parent b18faad commit da70f80
Show file tree
Hide file tree
Showing 33 changed files with 74 additions and 63 deletions.
Expand Up @@ -29,7 +29,7 @@
#include "logging/log.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"
#include "utilities/align.hpp"
#include "utilities/debug.hpp"

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
Expand Up @@ -46,7 +46,7 @@
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/jniHandles.inline.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"
#include "utilities/powerOfTwo.hpp"
#ifdef COMPILER1
#include "c1/c1_LIRAssembler.hpp"
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/x86/gc/shared/barrierSetNMethod_x86.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -29,7 +29,7 @@
#include "logging/log.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"
#include "utilities/align.hpp"
#include "utilities/debug.hpp"

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/macroAssembler_x86.cpp
Expand Up @@ -46,7 +46,7 @@
#include "runtime/safepointMechanism.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"
#include "utilities/macros.hpp"
#include "crc32c.h"

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2019 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand All @@ -25,7 +25,7 @@

#include "precompiled.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"

frame JavaThread::pd_last_frame() {
assert(has_last_Java_frame(), "must have last_Java_sp() when suspended");
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os_cpu/linux_s390/thread_linux_s390.cpp
Expand Up @@ -25,7 +25,7 @@

#include "precompiled.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"

frame JavaThread::pd_last_frame() {
assert(has_last_Java_frame(), "must have last_Java_sp() when suspended");
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/classfile/classLoaderExt.cpp
Expand Up @@ -45,6 +45,7 @@
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/os.hpp"
#include "runtime/thread.inline.hpp"
#include "services/threadService.hpp"
#include "utilities/stringUtils.hpp"

Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/classfile/klassFactory.cpp
Expand Up @@ -37,6 +37,7 @@
#include "prims/jvmtiRedefineClasses.hpp"
#include "runtime/arguments.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/thread.inline.hpp"
#include "utilities/macros.hpp"
#if INCLUDE_JFR
#include "jfr/support/jfrKlassExtension.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/classfile/verifier.cpp
Expand Up @@ -53,7 +53,7 @@
#include "runtime/jniHandles.inline.hpp"
#include "runtime/os.hpp"
#include "runtime/safepointVerifiers.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"
#include "services/threadService.hpp"
#include "utilities/align.hpp"
#include "utilities/bytes.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/code/dependencies.cpp
Expand Up @@ -51,7 +51,7 @@ static bool must_be_in_vm() {
if (thread->is_Java_thread())
return thread->as_Java_thread()->thread_state() == _thread_in_vm;
else
return thread->is_VM_thread();
return true; //something like this: thread->is_VM_thread();
}
#endif //ASSERT

Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
Expand Up @@ -66,6 +66,7 @@
#include "runtime/java.hpp"
#include "runtime/orderAccess.hpp"
#include "runtime/prefetch.inline.hpp"
#include "runtime/thread.inline.hpp"
#include "services/memTracker.hpp"
#include "utilities/align.hpp"
#include "utilities/growableArray.hpp"
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shared/barrierSet.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -25,7 +25,7 @@
#include "precompiled.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"
#include "utilities/debug.hpp"
#include "utilities/macros.hpp"

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shared/cardTableBarrierSet.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -31,7 +31,7 @@
#include "logging/log.hpp"
#include "memory/virtualspace.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"
#include "services/memTracker.hpp"
#include "utilities/align.hpp"
#include "utilities/macros.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shared/concurrentGCBreakpoints.cpp
Expand Up @@ -29,7 +29,7 @@
#include "memory/universe.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"
#include "utilities/debug.hpp"

// States:
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shared/oopStorage.cpp
Expand Up @@ -38,7 +38,7 @@
#include "runtime/os.hpp"
#include "runtime/safepoint.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"
#include "services/memTracker.hpp"
#include "utilities/align.hpp"
#include "utilities/count_trailing_zeros.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/z/zFuture.inline.hpp
Expand Up @@ -26,7 +26,7 @@

#include "gc/z/zFuture.hpp"
#include "runtime/semaphore.inline.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"

template <typename T>
inline ZFuture<T>::ZFuture() :
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -29,7 +29,7 @@
#include "jfr/support/jfrThreadLocal.hpp"
#include "jvmtifiles/jvmti.h"
#include "runtime/osThread.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"

struct jvmti_thread_state {
u8 id;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/jfr/recorder/service/jfrPostBox.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/jfr/support/jfrAllocationTracer.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -26,7 +26,7 @@
#include "jfr/leakprofiler/leakProfiler.hpp"
#include "jfr/support/jfrAllocationTracer.hpp"
#include "jfr/support/jfrThreadLocal.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"

JfrAllocationTracer::JfrAllocationTracer(HeapWord* obj, size_t alloc_size, Thread* thread) : _tl(NULL) {
if (LeakProfiler::is_running()) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/jfr/support/jfrEpochSynchronization.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/jvmci/jvmciEnv.hpp
Expand Up @@ -27,7 +27,7 @@

#include "classfile/javaClasses.hpp"
#include "jvmci/jvmciJavaClasses.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"

class CompileTask;
class JVMCIObject;
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/oops/objArrayKlass.cpp
Expand Up @@ -43,6 +43,7 @@
#include "oops/symbol.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/thread.inline.hpp"
#include "utilities/macros.hpp"

ObjArrayKlass* ObjArrayKlass::allocate(ClassLoaderData* loader_data, int n, Klass* k, Symbol* name, TRAPS) {
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/oops/typeArrayKlass.cpp
Expand Up @@ -41,6 +41,7 @@
#include "oops/typeArrayKlass.inline.hpp"
#include "oops/typeArrayOop.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/thread.inline.hpp"
#include "utilities/macros.hpp"

TypeArrayKlass* TypeArrayKlass::create_klass(BasicType type,
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/prims/jvmtiRawMonitor.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/prims/jvmtiTrace.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -28,6 +28,7 @@
#include "logging/log.hpp"
#include "logging/logConfiguration.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/thread.inline.hpp"
#include "prims/jvmtiTrace.hpp"

//
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/prims/whitebox.cpp
Expand Up @@ -75,7 +75,7 @@
#include "runtime/os.hpp"
#include "runtime/sweeper.hpp"
#include "runtime/synchronizer.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"
#include "runtime/threadSMR.hpp"
#include "runtime/vm_version.hpp"
#include "services/memoryService.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/deoptimization.cpp
Expand Up @@ -62,7 +62,7 @@
#include "runtime/sharedRuntime.hpp"
#include "runtime/signature.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"
#include "runtime/threadSMR.hpp"
#include "runtime/vframe.hpp"
#include "runtime/vframeArray.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/handshake.cpp
Expand Up @@ -32,7 +32,7 @@
#include "runtime/osThread.hpp"
#include "runtime/semaphore.inline.hpp"
#include "runtime/task.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"
#include "runtime/vmThread.hpp"
#include "utilities/formatBuffer.hpp"
#include "utilities/preserveException.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/interfaceSupport.inline.hpp
Expand Up @@ -31,7 +31,7 @@
#include "runtime/os.hpp"
#include "runtime/safepointMechanism.inline.hpp"
#include "runtime/safepointVerifiers.hpp"
#include "runtime/thread.hpp"
#include "runtime/thread.inline.hpp"
#include "runtime/vmOperations.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/histogram.hpp"
Expand Down
15 changes: 15 additions & 0 deletions src/hotspot/share/runtime/thread.cpp
Expand Up @@ -3449,6 +3449,21 @@ Klass* JavaThread::security_get_caller_class(int depth) {
return NULL;
}

void JavaThread::check_and_wait_while_suspended() {
assert(JavaThread::current() == this, "sanity check");

bool do_self_suspend;
do {
// were we externally suspended while we were waiting?
do_self_suspend = handle_special_suspend_equivalent_condition();
if (do_self_suspend) {
// don't surprise the thread that suspended us by returning
java_suspend_self();
set_suspend_equivalent();
}
} while (do_self_suspend);
}

// java.lang.Thread.sleep support
// Returns true if sleep time elapsed as expected, and false
// if the thread was interrupted.
Expand Down
36 changes: 4 additions & 32 deletions src/hotspot/share/runtime/thread.hpp
Expand Up @@ -503,14 +503,8 @@ class Thread: public ThreadShadow {

// Casts
virtual WorkerThread* as_Worker_thread() const { return NULL; }
JavaThread* as_Java_thread() {
assert(is_Java_thread(), "incorrect cast to JavaThread");
return (JavaThread*)this;
}
JavaThread * as_const_Java_thread() const {
assert(is_Java_thread(), "incorrect cast to JavaThread");
return (JavaThread*)this;
}
JavaThread* as_Java_thread();
const JavaThread* as_const_Java_thread() const;

virtual char* name() const { return (char*)"Unknown thread"; }

Expand Down Expand Up @@ -1395,20 +1389,7 @@ class JavaThread: public Thread {
void java_suspend_self_with_safepoint_check();

public:
void check_and_wait_while_suspended() {
assert(JavaThread::current() == this, "sanity check");

bool do_self_suspend;
do {
// were we externally suspended while we were waiting?
do_self_suspend = handle_special_suspend_equivalent_condition();
if (do_self_suspend) {
// don't surprise the thread that suspended us by returning
java_suspend_self();
set_suspend_equivalent();
}
} while (do_self_suspend);
}
void check_and_wait_while_suspended();
static void check_safepoint_and_suspend_for_native_trans(JavaThread *thread);
// Check for async exception in addition to safepoint and suspend request.
static void check_special_condition_for_native_trans(JavaThread *thread);
Expand Down Expand Up @@ -1952,7 +1933,7 @@ class JavaThread: public Thread {

public:
// Returns the running thread as a JavaThread
static inline JavaThread* current();
static JavaThread* current();

// Returns the active Java thread. Do not use this if you know you are calling
// from a JavaThread, as it's slower than JavaThread::current. If called from
Expand Down Expand Up @@ -2118,11 +2099,6 @@ class JavaThread: public Thread {
static OopStorage* thread_oop_storage();
};

// Inline implementation of JavaThread::current
inline JavaThread* JavaThread::current() {
return Thread::current()->as_Java_thread();
}

inline CompilerThread* JavaThread::as_CompilerThread() {
assert(is_Compiler_thread(), "just checking");
return (CompilerThread*)this;
Expand Down Expand Up @@ -2217,10 +2193,6 @@ class CompilerThread : public JavaThread {
void set_task(CompileTask* task) { _task = task; }
};

inline CompilerThread* CompilerThread::current() {
return JavaThread::current()->as_CompilerThread();
}

// The active thread queue. It also keeps track of the current used
// thread priorities.
class Threads: AllStatic {
Expand Down

0 comments on commit da70f80

Please sign in to comment.