comparison src/share/vm/oops/compiledICHolder.hpp @ 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 src/share/vm/oops/compiledICHolderOop.hpp@f95d63e2154a
children
comparison
equal deleted inserted replaced
2:ae3325f24fa1 0:942976ef4d92
1 /* 1 /*
2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1998, 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 #ifndef SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP 25 #ifndef SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP
26 #define SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP 26 #define SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP
27 27
28 #include "oops/oop.hpp" 28 #include "oops/oop.hpp"
29 29
30 // A compiledICHolderOop is a helper object for the inline cache implementation. 30 // A CompiledICHolder* is a helper object for the inline cache implementation.
31 // It holds an intermediate value (method+klass pair) used when converting from 31 // It holds an intermediate value (method+klass pair) used when converting from
32 // compiled to an interpreted call. 32 // compiled to an interpreted call.
33 // 33 //
34 // compiledICHolderOops are always allocated permanent (to avoid traversing the 34 // These are always allocated in the C heap and are freed during a
35 // codeCache during scavenge). 35 // safepoint by the ICBuffer logic. It's unsafe to free them earlier
36 // since they might be in use.
37 //
36 38
37 39
38 class compiledICHolderOopDesc : public oopDesc { 40 class CompiledICHolder : public CHeapObj<mtCompiler> {
39 friend class VMStructs; 41 friend class VMStructs;
40 private: 42 private:
41 methodOop _holder_method; 43 static volatile int _live_count; // allocated
42 klassOop _holder_klass; // to avoid name conflict with oopDesc::_klass 44 static volatile int _live_not_claimed_count; // allocated but not yet in use so not
45 // reachable by iterating over nmethods
46
47 Method* _holder_method;
48 Klass* _holder_klass; // to avoid name conflict with oopDesc::_klass
49 CompiledICHolder* _next;
50
43 public: 51 public:
52 // Constructor
53 CompiledICHolder(Method* method, Klass* klass)
54 : _holder_method(method), _holder_klass(klass) {
55 #ifdef ASSERT
56 Atomic::inc(&_live_count);
57 Atomic::inc(&_live_not_claimed_count);
58 #endif
59 }
60
61 ~CompiledICHolder() {
62 #ifdef ASSERT
63 assert(_live_count > 0, "underflow");
64 Atomic::dec(&_live_count);
65 #endif
66 }
67
68 static int live_count() { return _live_count; }
69 static int live_not_claimed_count() { return _live_not_claimed_count; }
70
44 // accessors 71 // accessors
45 methodOop holder_method() const { return _holder_method; } 72 Method* holder_method() const { return _holder_method; }
46 klassOop holder_klass() const { return _holder_klass; } 73 Klass* holder_klass() const { return _holder_klass; }
47 74
48 void set_holder_method(methodOop m) { oop_store_without_check((oop*)&_holder_method, (oop)m); } 75 void set_holder_method(Method* m) { _holder_method = m; }
49 void set_holder_klass(klassOop k) { oop_store_without_check((oop*)&_holder_klass, (oop)k); } 76 void set_holder_klass(Klass* k) { _holder_klass = k; }
50
51 static int header_size() { return sizeof(compiledICHolderOopDesc)/HeapWordSize; }
52 static int object_size() { return align_object_size(header_size()); }
53 77
54 // interpreter support (offsets in bytes) 78 // interpreter support (offsets in bytes)
55 static int holder_method_offset() { return offset_of(compiledICHolderOopDesc, _holder_method); } 79 static int holder_method_offset() { return offset_of(CompiledICHolder, _holder_method); }
56 static int holder_klass_offset() { return offset_of(compiledICHolderOopDesc, _holder_klass); } 80 static int holder_klass_offset() { return offset_of(CompiledICHolder, _holder_klass); }
57 81
58 // GC support 82 CompiledICHolder* next() { return _next; }
59 oop* adr_holder_method() const { return (oop*)&_holder_method; } 83 void set_next(CompiledICHolder* n) { _next = n; }
60 oop* adr_holder_klass() const { return (oop*)&_holder_klass; } 84
85 // Verify
86 void verify_on(outputStream* st);
87
88 // Printing
89 void print_on(outputStream* st) const;
90 void print_value_on(outputStream* st) const;
91
92 const char* internal_name() const { return "{compiledICHolder}"; }
93
94 void claim() {
95 #ifdef ASSERT
96 Atomic::dec(&_live_not_claimed_count);
97 #endif
98 }
61 }; 99 };
62 100
63 #endif // SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP 101 #endif // SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP