9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 package sun.jvm.hotspot.gc.z;
26
27 import sun.jvm.hotspot.debugger.Address;
28 import sun.jvm.hotspot.debugger.OopHandle;
29 import sun.jvm.hotspot.runtime.VM;
30
31 class ZOop {
32 private static final long MSB = ~0L ^ (~0L >>> 1);
33
34 private static Address msbAddress() {
35 return VM.getVM().getUniverse().heap().start().orWithMask(MSB).andWithMask(MSB);
36 }
37
38 static Address to_address(long value) {
39 // If the value of an Address becomes 0, null is returned instead of an Address.
40 // Start with a one-bit address and as a last step, remove that bit.
41 Address oneAddress = msbAddress();
42 return oneAddress.orWithMask(value).xorWithMask(ZAddress.as_long(oneAddress));
43 }
44
45 static Address to_address(OopHandle oop) {
46 return to_address(ZAddress.as_long(oop));
47 }
48 }
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 package sun.jvm.hotspot.gc.z;
26
27 import sun.jvm.hotspot.debugger.Address;
28 import sun.jvm.hotspot.debugger.OopHandle;
29
30 class ZOop {
31 static Address to_address(OopHandle oop) {
32 return ZUtils.longToAddress(ZAddress.as_long(oop));
33 }
34 }
|