comparison src/share/vm/classfile/resolutionErrors.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 d2a62e0f25eb
children
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2005, 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.
23 */ 23 */
24 24
25 #ifndef SHARE_VM_CLASSFILE_RESOLUTIONERRORS_HPP 25 #ifndef SHARE_VM_CLASSFILE_RESOLUTIONERRORS_HPP
26 #define SHARE_VM_CLASSFILE_RESOLUTIONERRORS_HPP 26 #define SHARE_VM_CLASSFILE_RESOLUTIONERRORS_HPP
27 27
28 #include "oops/constantPoolOop.hpp" 28 #include "oops/constantPool.hpp"
29 #include "utilities/hashtable.hpp" 29 #include "utilities/hashtable.hpp"
30 30
31 class ResolutionErrorEntry; 31 class ResolutionErrorEntry;
32 32
33 // ResolutionError objects are used to record errors encountered during 33 // ResolutionError objects are used to record errors encountered during
34 // constant pool resolution (JVMS 5.4.3). 34 // constant pool resolution (JVMS 5.4.3).
35 35
36 class ResolutionErrorTable : public Hashtable<constantPoolOop, mtClass> { 36 class ResolutionErrorTable : public Hashtable<ConstantPool*, mtClass> {
37 37
38 public: 38 public:
39 ResolutionErrorTable(int table_size); 39 ResolutionErrorTable(int table_size);
40 40
41 ResolutionErrorEntry* new_entry(int hash, constantPoolOop pool, int cp_index, Symbol* error); 41 ResolutionErrorEntry* new_entry(int hash, ConstantPool* pool, int cp_index, Symbol* error);
42 void free_entry(ResolutionErrorEntry *entry); 42 void free_entry(ResolutionErrorEntry *entry);
43 43
44 ResolutionErrorEntry* bucket(int i) { 44 ResolutionErrorEntry* bucket(int i) {
45 return (ResolutionErrorEntry*)Hashtable<constantPoolOop, mtClass>::bucket(i); 45 return (ResolutionErrorEntry*)Hashtable<ConstantPool*, mtClass>::bucket(i);
46 } 46 }
47 47
48 ResolutionErrorEntry** bucket_addr(int i) { 48 ResolutionErrorEntry** bucket_addr(int i) {
49 return (ResolutionErrorEntry**)Hashtable<constantPoolOop, mtClass>::bucket_addr(i); 49 return (ResolutionErrorEntry**)Hashtable<ConstantPool*, mtClass>::bucket_addr(i);
50 } 50 }
51 51
52 void add_entry(int index, ResolutionErrorEntry* new_entry) { 52 void add_entry(int index, ResolutionErrorEntry* new_entry) {
53 Hashtable<constantPoolOop, mtClass>::add_entry(index, 53 Hashtable<ConstantPool*, mtClass>::add_entry(index,
54 (HashtableEntry<constantPoolOop, mtClass>*)new_entry); 54 (HashtableEntry<ConstantPool*, mtClass>*)new_entry);
55 } 55 }
56 56
57 void add_entry(int index, unsigned int hash, 57 void add_entry(int index, unsigned int hash,
58 constantPoolHandle pool, int which, Symbol* error); 58 constantPoolHandle pool, int which, Symbol* error);
59 59
66 unsigned int compute_hash(constantPoolHandle pool, int cp_index) { 66 unsigned int compute_hash(constantPoolHandle pool, int cp_index) {
67 return (unsigned int) pool->identity_hash() + cp_index; 67 return (unsigned int) pool->identity_hash() + cp_index;
68 } 68 }
69 69
70 // purges unloaded entries from the table 70 // purges unloaded entries from the table
71 void purge_resolution_errors(BoolObjectClosure* is_alive); 71 void purge_resolution_errors();
72 72
73 // GC support. 73 // RedefineClasses support - remove obsolete constant pool entry
74 void oops_do(OopClosure* f); 74 void delete_entry(ConstantPool* c);
75 }; 75 };
76 76
77 77
78 class ResolutionErrorEntry : public HashtableEntry<constantPoolOop, mtClass> { 78 class ResolutionErrorEntry : public HashtableEntry<ConstantPool*, mtClass> {
79 private: 79 private:
80 int _cp_index; 80 int _cp_index;
81 Symbol* _error; 81 Symbol* _error;
82 82
83 public: 83 public:
84 constantPoolOop pool() const { return (constantPoolOop)literal(); } 84 ConstantPool* pool() const { return (ConstantPool*)literal(); }
85 constantPoolOop* pool_addr() { return (constantPoolOop*)literal_addr(); } 85 ConstantPool** pool_addr() { return (ConstantPool**)literal_addr(); }
86 86
87 int cp_index() const { return _cp_index; } 87 int cp_index() const { return _cp_index; }
88 void set_cp_index(int cp_index) { _cp_index = cp_index; } 88 void set_cp_index(int cp_index) { _cp_index = cp_index; }
89 89
90 Symbol* error() const { return _error; } 90 Symbol* error() const { return _error; }
91 void set_error(Symbol* e); 91 void set_error(Symbol* e);
92 92
93 ResolutionErrorEntry* next() const { 93 ResolutionErrorEntry* next() const {
94 return (ResolutionErrorEntry*)HashtableEntry<constantPoolOop, mtClass>::next(); 94 return (ResolutionErrorEntry*)HashtableEntry<ConstantPool*, mtClass>::next();
95 } 95 }
96 96
97 ResolutionErrorEntry** next_addr() { 97 ResolutionErrorEntry** next_addr() {
98 return (ResolutionErrorEntry**)HashtableEntry<constantPoolOop, mtClass>::next_addr(); 98 return (ResolutionErrorEntry**)HashtableEntry<ConstantPool*, mtClass>::next_addr();
99 } 99 }
100
101 // GC support
102 void oops_do(OopClosure* blk);
103 }; 100 };
104 101
105 #endif // SHARE_VM_CLASSFILE_RESOLUTIONERRORS_HPP 102 #endif // SHARE_VM_CLASSFILE_RESOLUTIONERRORS_HPP