8312121: Fix -Wconversion warnings in tribool.hpp

Reviewed-by: dlong, dholmes
This commit is contained in:
Coleen Phillimore 2023-07-28 12:08:24 +00:00
parent a3d67231a7
commit 47c4b992b4
5 changed files with 13 additions and 6 deletions

View File

@ -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"

View File

@ -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.

View File

@ -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:

View File

@ -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"

View File

@ -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;
};