comparison src/share/vm/runtime/jfieldIDWorkaround.hpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents f95d63e2154a
children
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
89 if (VerifyJNIFields && is_checked_jfieldID(id)) { 89 if (VerifyJNIFields && is_checked_jfieldID(id)) {
90 result &= small_offset_mask; // cut off the hash bits 90 result &= small_offset_mask; // cut off the hash bits
91 } 91 }
92 return (intptr_t)result; 92 return (intptr_t)result;
93 } 93 }
94 static intptr_t encode_klass_hash(klassOop k, intptr_t offset); 94 static intptr_t encode_klass_hash(Klass* k, intptr_t offset);
95 static bool klass_hash_ok(klassOop k, jfieldID id); 95 static bool klass_hash_ok(Klass* k, jfieldID id);
96 static void verify_instance_jfieldID(klassOop k, jfieldID id); 96 static void verify_instance_jfieldID(Klass* k, jfieldID id);
97 97
98 public: 98 public:
99 static bool is_valid_jfieldID(klassOop k, jfieldID id); 99 static bool is_valid_jfieldID(Klass* k, jfieldID id);
100 100
101 static bool is_instance_jfieldID(klassOop k, jfieldID id) { 101 static bool is_instance_jfieldID(Klass* k, jfieldID id) {
102 uintptr_t as_uint = (uintptr_t) id; 102 uintptr_t as_uint = (uintptr_t) id;
103 return ((as_uint & instance_mask_in_place) != 0); 103 return ((as_uint & instance_mask_in_place) != 0);
104 } 104 }
105 static bool is_static_jfieldID(jfieldID id) { 105 static bool is_static_jfieldID(jfieldID id) {
106 uintptr_t as_uint = (uintptr_t) id; 106 uintptr_t as_uint = (uintptr_t) id;
107 return ((as_uint & instance_mask_in_place) == 0); 107 return ((as_uint & instance_mask_in_place) == 0);
108 } 108 }
109 109
110 static jfieldID to_instance_jfieldID(klassOop k, int offset) { 110 static jfieldID to_instance_jfieldID(Klass* k, int offset) {
111 intptr_t as_uint = ((offset & large_offset_mask) << offset_shift) | instance_mask_in_place; 111 intptr_t as_uint = ((offset & large_offset_mask) << offset_shift) | instance_mask_in_place;
112 if (VerifyJNIFields) { 112 if (VerifyJNIFields) {
113 as_uint |= encode_klass_hash(k, offset); 113 as_uint |= encode_klass_hash(k, offset);
114 } 114 }
115 jfieldID result = (jfieldID) as_uint; 115 jfieldID result = (jfieldID) as_uint;
122 } 122 }
123 assert(raw_instance_offset(result) == (offset & large_offset_mask), "extract right offset"); 123 assert(raw_instance_offset(result) == (offset & large_offset_mask), "extract right offset");
124 return result; 124 return result;
125 } 125 }
126 126
127 static intptr_t from_instance_jfieldID(klassOop k, jfieldID id) { 127 static intptr_t from_instance_jfieldID(Klass* k, jfieldID id) {
128 #ifndef ASSERT 128 #ifndef ASSERT
129 // always verify in debug mode; switchable in anything else 129 // always verify in debug mode; switchable in anything else
130 if (VerifyJNIFields) 130 if (VerifyJNIFields)
131 #endif // ASSERT 131 #endif // ASSERT
132 { 132 {