equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2017, 2018 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. |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 #include "precompiled.hpp" |
24 #include "precompiled.hpp" |
25 #include "gc/shared/preservedMarks.inline.hpp" |
25 #include "gc/shared/preservedMarks.inline.hpp" |
|
26 #include "oops/oop.inline.hpp" |
26 #include "unittest.hpp" |
27 #include "unittest.hpp" |
27 |
28 |
28 class ScopedDisabledBiasedLocking { |
29 class ScopedDisabledBiasedLocking { |
29 bool _orig; |
30 bool _orig; |
30 public: |
31 public: |
36 // return true for calls to must_be_preserved(). |
37 // return true for calls to must_be_preserved(). |
37 class FakeOop { |
38 class FakeOop { |
38 oopDesc _oop; |
39 oopDesc _oop; |
39 |
40 |
40 public: |
41 public: |
41 FakeOop() : _oop() { _oop.set_mark(originalMark()); } |
42 FakeOop() : _oop() { _oop.set_mark_raw(originalMark()); } |
42 |
43 |
43 oop get_oop() { return &_oop; } |
44 oop get_oop() { return &_oop; } |
44 markOop mark() { return _oop.mark(); } |
45 markOop mark() { return _oop.mark_raw(); } |
45 void set_mark(markOop m) { _oop.set_mark(m); } |
46 void set_mark(markOop m) { _oop.set_mark_raw(m); } |
46 void forward_to(oop obj) { |
47 void forward_to(oop obj) { |
47 markOop m = markOopDesc::encode_pointer_as_mark(obj); |
48 markOop m = markOopDesc::encode_pointer_as_mark(obj); |
48 _oop.set_mark(m); |
49 _oop.set_mark_raw(m); |
49 } |
50 } |
50 |
51 |
51 static markOop originalMark() { return markOop(markOopDesc::lock_mask_in_place); } |
52 static markOop originalMark() { return markOop(markOopDesc::lock_mask_in_place); } |
52 static markOop changedMark() { return markOop(0x4711); } |
53 static markOop changedMark() { return markOop(0x4711); } |
53 }; |
54 }; |