hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/SymbolTable.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2016, 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. |
83 anyway. Searches the regular symbol table and the shared symbol |
83 anyway. Searches the regular symbol table and the shared symbol |
84 table. Null is returned if the given name is not found in both |
84 table. Null is returned if the given name is not found in both |
85 tables. */ |
85 tables. */ |
86 public Symbol probe(byte[] name) { |
86 public Symbol probe(byte[] name) { |
87 long hashValue = hashSymbol(name); |
87 long hashValue = hashSymbol(name); |
|
88 |
|
89 Symbol s = sharedTable.probe(name, hashValue); |
|
90 if (s != null) { |
|
91 return s; |
|
92 } |
|
93 |
88 for (HashtableEntry e = (HashtableEntry) bucket(hashToIndex(hashValue)); e != null; e = (HashtableEntry) e.next()) { |
94 for (HashtableEntry e = (HashtableEntry) bucket(hashToIndex(hashValue)); e != null; e = (HashtableEntry) e.next()) { |
89 if (e.hash() == hashValue) { |
95 if (e.hash() == hashValue) { |
90 Symbol sym = Symbol.create(e.literalValue()); |
96 Symbol sym = Symbol.create(e.literalValue()); |
91 if (sym.equals(name)) { |
97 if (sym.equals(name)) { |
92 return sym; |
98 return sym; |
93 } |
99 } |
94 } |
100 } |
95 } |
101 } |
96 |
102 |
97 return sharedTable.probe(name, hashValue); |
103 return null; |
98 } |
104 } |
99 |
105 |
100 public interface SymbolVisitor { |
106 public interface SymbolVisitor { |
101 public void visit(Symbol sym); |
107 public void visit(Symbol sym); |
102 } |
108 } |