Path: blob/master/src/hotspot/share/gc/z/zAllocationFlags.hpp
40957 views
/*1* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223#ifndef SHARE_GC_Z_ZALLOCATIONFLAGS_HPP24#define SHARE_GC_Z_ZALLOCATIONFLAGS_HPP2526#include "gc/z/zBitField.hpp"27#include "memory/allocation.hpp"2829//30// Allocation flags layout31// -----------------------32//33// 7 2 1 034// +-----+-+-+-+35// |00000|1|1|1|36// +-----+-+-+-+37// | | | |38// | | | * 0-0 Non-Blocking Flag (1-bit)39// | | |40// | | * 1-1 Worker Relocation Flag (1-bit)41// | |42// | * 2-2 Low Address Flag (1-bit)43// |44// * 7-3 Unused (5-bits)45//4647class ZAllocationFlags {48private:49typedef ZBitField<uint8_t, bool, 0, 1> field_non_blocking;50typedef ZBitField<uint8_t, bool, 1, 1> field_worker_relocation;51typedef ZBitField<uint8_t, bool, 2, 1> field_low_address;5253uint8_t _flags;5455public:56ZAllocationFlags() :57_flags(0) {}5859void set_non_blocking() {60_flags |= field_non_blocking::encode(true);61}6263void set_worker_relocation() {64_flags |= field_worker_relocation::encode(true);65}6667void set_low_address() {68_flags |= field_low_address::encode(true);69}7071bool non_blocking() const {72return field_non_blocking::decode(_flags);73}7475bool worker_relocation() const {76return field_worker_relocation::decode(_flags);77}7879bool low_address() const {80return field_low_address::decode(_flags);81}82};8384#endif // SHARE_GC_Z_ZALLOCATIONFLAGS_HPP858687