Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/ci/ciBaseObject.hpp
32285 views
/*1* Copyright (c) 2011, 2012, 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*22*/2324#ifndef SHARE_VM_CI_CIBASEOBJECT_HPP25#define SHARE_VM_CI_CIBASEOBJECT_HPP2627#include "ci/ciClassList.hpp"28#include "memory/allocation.hpp"29#include "runtime/handles.hpp"30#include "runtime/jniHandles.hpp"3132// ciBaseObject33//34// This class represents an oop in the HotSpot virtual machine.35// Its subclasses are structured in a hierarchy which mirrors36// an aggregate of the VM's oop and klass hierarchies (see37// oopHierarchy.hpp). Each instance of ciBaseObject holds a handle38// to a corresponding oop on the VM side and provides routines39// for accessing the information in its oop. By using the ciBaseObject40// hierarchy for accessing oops in the VM, the compiler ensures41// that it is safe with respect to garbage collection; that is,42// GC and compilation can proceed independently without43// interference.44//45// Within the VM, the oop and klass hierarchies are separate.46// The compiler interface does not preserve this separation --47// the distinction between `Klass*' and `Klass' are not48// reflected in the interface and instead the Klass hierarchy49// is directly modeled as the subclasses of ciKlass.50class ciBaseObject : public ResourceObj {51CI_PACKAGE_ACCESS52friend class ciEnv;5354protected:55uint _ident;5657enum { FLAG_BITS = 1 };58enum {59SCAVENGABLE_FLAG = 160};61protected:62ciBaseObject(): _ident(0) {}6364virtual const char* type_string() { return "ciBaseObject"; }6566void set_ident(uint id);6768public:69// A number unique to this object.70uint ident();7172// What kind of ciBaseObject is this?73virtual bool is_symbol() const { return false; }74virtual bool is_object() const { return false; }75virtual bool is_metadata() const { return false; }7677ciSymbol* as_symbol() {78assert(is_symbol(), "must be");79return (ciSymbol*)this;80}81ciObject* as_object() {82assert(is_object(), "must be");83return (ciObject*)this;84}85ciMetadata* as_metadata() {86assert(is_metadata(), "must be");87return (ciMetadata*)this;88}89};90#endif // SHARE_VM_CI_CIBASEOBJECT_HPP919293