duke@435: /* never@2658: * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. duke@435: * duke@435: */ duke@435: stefank@2314: #ifndef SHARE_VM_OOPS_KLASSOOP_HPP stefank@2314: #define SHARE_VM_OOPS_KLASSOOP_HPP stefank@2314: stefank@2314: #include "oops/oop.hpp" stefank@2314: duke@435: // A klassOop is the C++ equivalent of a Java class. duke@435: // Part of a klassOopDesc is a Klass which handle the duke@435: // dispatching for the C++ method calls. duke@435: duke@435: // klassOop object layout: duke@435: // [header ] duke@435: // [klass_field] duke@435: // [KLASS ] duke@435: duke@435: class klassOopDesc : public oopDesc { duke@435: public: duke@435: // size operation duke@435: static int header_size() { return sizeof(klassOopDesc)/HeapWordSize; } duke@435: duke@435: // support for code generation duke@435: static int klass_part_offset_in_bytes() { return sizeof(klassOopDesc); } duke@435: duke@435: // returns the Klass part containing dispatching behavior never@2658: Klass* klass_part() const { return (Klass*)((address)this + klass_part_offset_in_bytes()); } never@2658: never@2658: // Convenience wrapper never@2658: inline oop java_mirror() const; never@2658: never@2658: private: never@2658: // These have no implementation since klassOop should never be accessed in this fashion never@2658: oop obj_field(int offset) const; never@2658: void obj_field_put(int offset, oop value); never@2658: void obj_field_raw_put(int offset, oop value); never@2658: never@2658: jbyte byte_field(int offset) const; never@2658: void byte_field_put(int offset, jbyte contents); never@2658: never@2658: jchar char_field(int offset) const; never@2658: void char_field_put(int offset, jchar contents); never@2658: never@2658: jboolean bool_field(int offset) const; never@2658: void bool_field_put(int offset, jboolean contents); never@2658: never@2658: jint int_field(int offset) const; never@2658: void int_field_put(int offset, jint contents); never@2658: never@2658: jshort short_field(int offset) const; never@2658: void short_field_put(int offset, jshort contents); never@2658: never@2658: jlong long_field(int offset) const; never@2658: void long_field_put(int offset, jlong contents); never@2658: never@2658: jfloat float_field(int offset) const; never@2658: void float_field_put(int offset, jfloat contents); never@2658: never@2658: jdouble double_field(int offset) const; never@2658: void double_field_put(int offset, jdouble contents); never@2658: never@2658: address address_field(int offset) const; never@2658: void address_field_put(int offset, address contents); never@2658: never@2658: oop obj_field_acquire(int offset) const; never@2658: void release_obj_field_put(int offset, oop value); never@2658: never@2658: jbyte byte_field_acquire(int offset) const; never@2658: void release_byte_field_put(int offset, jbyte contents); never@2658: never@2658: jchar char_field_acquire(int offset) const; never@2658: void release_char_field_put(int offset, jchar contents); never@2658: never@2658: jboolean bool_field_acquire(int offset) const; never@2658: void release_bool_field_put(int offset, jboolean contents); never@2658: never@2658: jint int_field_acquire(int offset) const; never@2658: void release_int_field_put(int offset, jint contents); never@2658: never@2658: jshort short_field_acquire(int offset) const; never@2658: void release_short_field_put(int offset, jshort contents); never@2658: never@2658: jlong long_field_acquire(int offset) const; never@2658: void release_long_field_put(int offset, jlong contents); never@2658: never@2658: jfloat float_field_acquire(int offset) const; never@2658: void release_float_field_put(int offset, jfloat contents); never@2658: never@2658: jdouble double_field_acquire(int offset) const; never@2658: void release_double_field_put(int offset, jdouble contents); never@2658: never@2658: address address_field_acquire(int offset) const; never@2658: void release_address_field_put(int offset, address contents); duke@435: }; stefank@2314: stefank@2314: #endif // SHARE_VM_OOPS_KLASSOOP_HPP