Mercurial > hg > truffle
annotate src/share/vm/oops/metadata.hpp @ 17716:cdb71841f4bc
6498581: ThreadInterruptTest3 produces wrong output on Windows
Summary: There is race condition between os::interrupt and os::is_interrupted on Windows. In JVM_Sleep(Thread.sleep), check if thread gets interrupted, it may see interrupted but not really interrupted so cause spurious waking up (early return from sleep). Fix by checking if interrupt event really gets set thus prevent false return. For intrinsic of _isInterrupted, on Windows, go fastpath only on bit not set.
Reviewed-by: acorn, kvn
Contributed-by: david.holmes@oracle.com, yumin.qi@oracle.com
author | minqi |
---|---|
date | Wed, 26 Feb 2014 15:20:41 -0800 |
parents | f9e35a9dc8c7 |
children | 7380034e5b31 4ca6dc0799b6 |
rev | line source |
---|---|
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
1 /* |
17709
f9e35a9dc8c7
8033792: AltHashing used jint for imprecise bit shifting
minqi
parents:
6725
diff
changeset
|
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
4 * |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
8 * |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
13 * accompanied this code). |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
14 * |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
18 * |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
21 * questions. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
22 * |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
23 */ |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
24 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
25 #ifndef SHARE_VM_OOPS_METADATA_HPP |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
26 #define SHARE_VM_OOPS_METADATA_HPP |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
27 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
28 #include "utilities/exceptions.hpp" |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
29 #include "utilities/globalDefinitions.hpp" |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
30 #include "utilities/ostream.hpp" |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
31 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
32 // This is the base class for an internal Class related metadata |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
33 class Metadata : public MetaspaceObj { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
34 // Debugging hook to check that the metadata has not been deleted. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
35 NOT_PRODUCT(int _valid;) |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
36 public: |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
37 NOT_PRODUCT(Metadata() { _valid = 0; }) |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
38 NOT_PRODUCT(bool is_valid() const volatile { return _valid == 0; }) |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
39 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
40 int identity_hash() { return (int)(uintptr_t)this; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
41 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
42 // Rehashing support for tables containing pointers to this |
17709
f9e35a9dc8c7
8033792: AltHashing used jint for imprecise bit shifting
minqi
parents:
6725
diff
changeset
|
43 unsigned int new_hash(juint seed) { ShouldNotReachHere(); return 0; } |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
44 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
45 virtual bool is_klass() const volatile { return false; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
46 virtual bool is_method() const volatile { return false; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
47 virtual bool is_methodData() const volatile { return false; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
48 virtual bool is_constantPool() const volatile { return false; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
49 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
50 virtual const char* internal_name() const = 0; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
51 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
52 void print() const { print_on(tty); } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
53 void print_value() const { print_value_on(tty); } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
54 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
55 void print_maybe_null() const { print_on_maybe_null(tty); } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
56 void print_on_maybe_null(outputStream* st) const { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
57 if (this == NULL) |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
58 st->print("NULL"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
59 else |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
60 print_on(tty); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
61 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
62 void print_value_on_maybe_null(outputStream* st) const { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
63 if (this == NULL) |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
64 st->print("NULL"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
65 else |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
66 print_value_on(tty); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
67 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
68 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
69 virtual void print_on(outputStream* st) const; // First level print |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
70 virtual void print_value_on(outputStream* st) const = 0; // Second level print |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
71 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
72 char* print_value_string() const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
73 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
74 // Used to keep metadata alive during class redefinition |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
75 // Can't assert because is called for delete functions (as an assert) |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
76 virtual bool on_stack() const { return false; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
77 virtual void set_on_stack(const bool value); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
78 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
79 // Set on_stack bit, so that the metadata is not cleared |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
80 // during class redefinition. This is a virtual call because only methods |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
81 // and constant pools need to be set, but someday instanceKlasses might also. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
82 static void mark_on_stack(Metadata* m) { m->set_on_stack(true); } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
83 }; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
84 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
85 #endif // SHARE_VM_OOPS_METADATA_HPP |