comparison src/share/vm/runtime/fieldDescriptor.cpp @ 3602: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 634b8615a6ba
children 18fb7da42534
comparison
equal deleted inserted replaced
6:72fcaa75efc3 7:90945a0530ba
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 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.
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "classfile/systemDictionary.hpp" 26 #include "classfile/systemDictionary.hpp"
27 #include "classfile/vmSymbols.hpp" 27 #include "classfile/vmSymbols.hpp"
28 #include "memory/resourceArea.hpp" 28 #include "memory/resourceArea.hpp"
29 #include "memory/universe.inline.hpp" 29 #include "memory/universe.inline.hpp"
30 #include "oops/annotations.hpp"
30 #include "oops/instanceKlass.hpp" 31 #include "oops/instanceKlass.hpp"
31 #include "oops/fieldStreams.hpp" 32 #include "oops/fieldStreams.hpp"
32 #include "runtime/fieldDescriptor.hpp" 33 #include "runtime/fieldDescriptor.hpp"
33 #include "runtime/handles.inline.hpp" 34 #include "runtime/handles.inline.hpp"
34 #include "runtime/signature.hpp" 35 #include "runtime/signature.hpp"
35 36
36 37
37 oop fieldDescriptor::loader() const { 38 oop fieldDescriptor::loader() const {
38 return instanceKlass::cast(_cp->pool_holder())->class_loader(); 39 return InstanceKlass::cast(_cp->pool_holder())->class_loader();
39 } 40 }
40 41
41 Symbol* fieldDescriptor::generic_signature() const { 42 Symbol* fieldDescriptor::generic_signature() const {
42 if (!has_generic_signature()) { 43 if (!has_generic_signature()) {
43 return NULL; 44 return NULL;
44 } 45 }
45 46
46 int idx = 0; 47 int idx = 0;
47 instanceKlass* ik = instanceKlass::cast(field_holder()); 48 InstanceKlass* ik = InstanceKlass::cast(field_holder());
48 for (AllFieldStream fs(ik); !fs.done(); fs.next()) { 49 for (AllFieldStream fs(ik); !fs.done(); fs.next()) {
49 if (idx == _index) { 50 if (idx == _index) {
50 return fs.generic_signature(); 51 return fs.generic_signature();
51 } else { 52 } else {
52 idx ++; 53 idx ++;
54 } 55 }
55 assert(false, "should never happen"); 56 assert(false, "should never happen");
56 return NULL; 57 return NULL;
57 } 58 }
58 59
59 typeArrayOop fieldDescriptor::annotations() const { 60 AnnotationArray* fieldDescriptor::annotations() const {
60 instanceKlass* ik = instanceKlass::cast(field_holder()); 61 InstanceKlass* ik = InstanceKlass::cast(field_holder());
61 objArrayOop md = ik->fields_annotations(); 62 Array<AnnotationArray*>* md = ik->fields_annotations();
62 if (md == NULL) 63 if (md == NULL)
63 return NULL; 64 return NULL;
64 return typeArrayOop(md->obj_at(index())); 65 return md->at(index());
65 } 66 }
66 67
67 constantTag fieldDescriptor::initial_value_tag() const { 68 constantTag fieldDescriptor::initial_value_tag() const {
68 return constants()->tag_at(initial_value_index()); 69 return constants()->tag_at(initial_value_index());
69 } 70 }
83 jdouble fieldDescriptor::double_initial_value() const { 84 jdouble fieldDescriptor::double_initial_value() const {
84 return constants()->double_at(initial_value_index()); 85 return constants()->double_at(initial_value_index());
85 } 86 }
86 87
87 oop fieldDescriptor::string_initial_value(TRAPS) const { 88 oop fieldDescriptor::string_initial_value(TRAPS) const {
88 return constants()->string_at(initial_value_index(), CHECK_0); 89 return constants()->uncached_string_at(initial_value_index(), CHECK_0);
89 } 90 }
90 91
91 void fieldDescriptor::initialize(klassOop k, int index) { 92 void fieldDescriptor::initialize(InstanceKlass* ik, int index) {
92 instanceKlass* ik = instanceKlass::cast(k);
93 _cp = ik->constants(); 93 _cp = ik->constants();
94 FieldInfo* f = ik->field(index); 94 FieldInfo* f = ik->field(index);
95 assert(!f->is_internal(), "regular Java fields only"); 95 assert(!f->is_internal(), "regular Java fields only");
96 96
97 _access_flags = accessFlags_from(f->access_flags()); 97 _access_flags = accessFlags_from(f->access_flags());