diff --git a/src/hotspot/share/c1/c1_Compiler.cpp b/src/hotspot/share/c1/c1_Compiler.cpp
index 22299b4051b66..ec06cbb1b41e7 100644
--- a/src/hotspot/share/c1/c1_Compiler.cpp
+++ b/src/hotspot/share/c1/c1_Compiler.cpp
@@ -32,6 +32,7 @@
 #include "c1/c1_Runtime1.hpp"
 #include "c1/c1_ValueType.hpp"
 #include "compiler/compileBroker.hpp"
+#include "compiler/compilerDirectives.hpp"
 #include "interpreter/linkResolver.hpp"
 #include "jfr/support/jfrIntrinsics.hpp"
 #include "memory/allocation.hpp"
diff --git a/src/hotspot/share/c1/c1_Compiler.hpp b/src/hotspot/share/c1/c1_Compiler.hpp
index 9ff313f68acd1..8f2afa85dbaab 100644
--- a/src/hotspot/share/c1/c1_Compiler.hpp
+++ b/src/hotspot/share/c1/c1_Compiler.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2023, 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
@@ -26,7 +26,8 @@
 #define SHARE_C1_C1_COMPILER_HPP
 
 #include "compiler/abstractCompiler.hpp"
-#include "compiler/compilerDirectives.hpp"
+
+class DirectiveSet;
 
 // There is one instance of the Compiler per CompilerThread.
 
diff --git a/src/hotspot/share/classfile/vmIntrinsics.cpp b/src/hotspot/share/classfile/vmIntrinsics.cpp
index 578b171a5528b..9735edcdcd086 100644
--- a/src/hotspot/share/classfile/vmIntrinsics.cpp
+++ b/src/hotspot/share/classfile/vmIntrinsics.cpp
@@ -29,6 +29,7 @@
 #include "jvm_constants.h"
 #include "jvm_io.h"
 #include "runtime/vm_version.hpp"
+#include "utilities/tribool.hpp"
 #include "utilities/xmlstream.hpp"
 
 // These are flag-matching functions:
diff --git a/src/hotspot/share/classfile/vmSymbols.cpp b/src/hotspot/share/classfile/vmSymbols.cpp
index 955302fa38e57..de9f6229f54e9 100644
--- a/src/hotspot/share/classfile/vmSymbols.cpp
+++ b/src/hotspot/share/classfile/vmSymbols.cpp
@@ -34,7 +34,6 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/signature.hpp"
-#include "utilities/tribool.hpp"
 #include "utilities/xmlstream.hpp"
 
 
diff --git a/src/hotspot/share/utilities/tribool.hpp b/src/hotspot/share/utilities/tribool.hpp
index 7d5c19d18f54c..c61ab1d4d4441 100644
--- a/src/hotspot/share/utilities/tribool.hpp
+++ b/src/hotspot/share/utilities/tribool.hpp
@@ -40,11 +40,15 @@ class TriBool{
 
  public:
   TriBool() : _value(0) {}
-  TriBool(bool value) : _value(((u1)value) | 2) {}
+  TriBool(bool value) : _value(value) {
+    // set to not-default in separate step to avoid conversion warnings
+    _value |= 2;
+  }
   TriBool(const TriBool& o): _value(o._value) {}
 
   TriBool& operator=(bool value) {
-    _value = ((u1)value) | 2;
+    _value = value;
+    _value |= 2; // set to not-default
     return *this;
   }
 
@@ -73,7 +77,8 @@ class TriBoolArray {
 
     TriBoolAssigner& operator=(bool newval) {
       _slot ^= ((u1)_value) << _offset;  // reset the tribool
-      _value = (u1)newval| 2;
+      _value = newval;
+      _value |= 2; // set to not-default
       _slot |= ((u1)_value) << _offset;
       return *this;
     };