Skip to content

Commit

Permalink
8302907: [PPC64] Use more constexpr in class Register
Browse files Browse the repository at this point in the history
Reviewed-by: rrich
  • Loading branch information
TheRealMDoerr committed Feb 22, 2023
1 parent f319c92 commit 180b94c
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/hotspot/cpu/ppc/register_ppc.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022 SAP SE. All rights reserved.
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023 SAP SE. 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 @@ -92,14 +92,14 @@ class Register {
inline constexpr friend Register as_Register(int encoding);

// accessors
int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
constexpr int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
inline VMReg as_VMReg() const;
Register successor() const { return Register(encoding() + 1); }

// testers
bool is_valid() const { return ( 0 <= _encoding && _encoding < number_of_registers); }
bool is_volatile() const { return ( 0 <= _encoding && _encoding <= 13 ); }
bool is_nonvolatile() const { return (14 <= _encoding && _encoding <= 31 ); }
constexpr bool is_valid() const { return ( 0 <= _encoding && _encoding < number_of_registers); }
constexpr bool is_volatile() const { return ( 0 <= _encoding && _encoding <= 13 ); }
constexpr bool is_nonvolatile() const { return (14 <= _encoding && _encoding <= 31 ); }

const char* name() const;
};
Expand Down Expand Up @@ -163,12 +163,12 @@ class ConditionRegister {
inline constexpr friend ConditionRegister as_ConditionRegister(int encoding);

// accessors
int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
constexpr int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
inline VMReg as_VMReg() const;

// testers
bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }
bool is_nonvolatile() const { return (2 <= _encoding && _encoding <= 4 ); }
constexpr bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }
constexpr bool is_nonvolatile() const { return (2 <= _encoding && _encoding <= 4 ); }

const char* name() const;
};
Expand Down Expand Up @@ -207,12 +207,12 @@ class FloatRegister {
inline constexpr friend FloatRegister as_FloatRegister(int encoding);

// accessors
int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
constexpr int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
inline VMReg as_VMReg() const;
FloatRegister successor() const { return FloatRegister(encoding() + 1); }

// testers
bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }
constexpr bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }

const char* name() const;

Expand Down Expand Up @@ -279,11 +279,11 @@ class SpecialRegister {
inline constexpr friend SpecialRegister as_SpecialRegister(int encoding);

// accessors
int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
constexpr int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
inline VMReg as_VMReg() const;

// testers
bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }
constexpr bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }

const char* name() const;
};
Expand Down Expand Up @@ -318,10 +318,10 @@ class VectorRegister {
inline constexpr friend VectorRegister as_VectorRegister(int encoding);

// accessors
int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
constexpr int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }

// testers
bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }
constexpr bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }

const char* name() const;

Expand Down Expand Up @@ -387,11 +387,11 @@ class VectorSRegister {
inline constexpr friend VectorSRegister as_VectorSRegister(int encoding);

// accessors
int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
constexpr int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
inline VMReg as_VMReg() const;

// testers
bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }
constexpr bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }

const char* name() const;

Expand Down

3 comments on commit 180b94c

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheRealMDoerr
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 180b94c May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheRealMDoerr the backport was successfully created on the branch backport-TheRealMDoerr-180b94c7 in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 180b94c7 from the openjdk/jdk repository.

The commit being backported was authored by Martin Doerr on 22 Feb 2023 and was reviewed by Richard Reingruber.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev.git backport-TheRealMDoerr-180b94c7:backport-TheRealMDoerr-180b94c7
$ git checkout backport-TheRealMDoerr-180b94c7
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev.git backport-TheRealMDoerr-180b94c7

⚠️ @TheRealMDoerr You are not yet a collaborator in my fork openjdk-bots/jdk17u-dev. An invite will be sent out and you need to accept it before you can proceed.

Please sign in to comment.