equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 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. |
101 return null; |
101 return null; |
102 } |
102 } |
103 |
103 |
104 /** Debugging routine only. Returns non-null JNIHandleBlock |
104 /** Debugging routine only. Returns non-null JNIHandleBlock |
105 containing the JNI handle or null if this handle block and its |
105 containing the JNI handle or null if this handle block and its |
106 successors did not contain it (or if the handle was deleted). */ |
106 successors did not contain it. */ |
107 public JNIHandleBlock blockContainingHandle(Address jniHandle) { |
107 public JNIHandleBlock blockContainingHandle(Address jniHandle) { |
108 JNIHandleBlock cur = this; |
108 JNIHandleBlock cur = this; |
109 while (cur != null) { |
109 while (cur != null) { |
110 if (indexOfHandle(jniHandle) >= 0) { |
110 if (indexOfHandle(jniHandle) >= 0) { |
111 return cur; |
111 return cur; |
142 Assert.that(x < top(), "out of bounds"); |
142 Assert.that(x < top(), "out of bounds"); |
143 } |
143 } |
144 |
144 |
145 Address oopAddr = addr.addOffsetTo(handlesField.getOffset() + x * VM.getVM().getOopSize()); |
145 Address oopAddr = addr.addOffsetTo(handlesField.getOffset() + x * VM.getVM().getOopSize()); |
146 OopHandle handle = oopAddr.getOopHandleAt(0); |
146 OopHandle handle = oopAddr.getOopHandleAt(0); |
147 if (VM.getVM().getUniverse().isInReserved(handle) && !VM.getVM().getJNIHandles().isDeletedHandle(handle)) { |
147 if (VM.getVM().getUniverse().isInReserved(handle)) { |
148 /* the oop handle is valid only if it is not freed (i.e. reserved in heap) and is not a deleted oop */ |
148 /* the oop handle is valid only if it is not freed (i.e. reserved in heap) */ |
149 return oopAddr; |
149 return oopAddr; |
150 } else { |
150 } else { |
151 return null; |
151 return null; |
152 } |
152 } |
153 } |
153 } |