Mercurial > hg > graal-compiler
comparison src/share/vm/oops/oop.inline.hpp @ 7982:10d5f25a7c67
8000968: NPG: UseCompressedKlassPointers asserts with ObjectAlignmentInBytes for > 32G CompressedOops
Summary: Pick a base that works for both CompressedOpps alignment and CompressedKlassPtrs alignment.
Reviewed-by: kvn, roland
author | hseigel |
---|---|
date | Mon, 04 Feb 2013 08:26:02 -0500 |
parents | 8e47bac5643a |
children | 3c9bc17b9403 |
comparison
equal
deleted
inserted
replaced
7981:ce5467120c84 | 7982:10d5f25a7c67 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2013, 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. |
225 | 225 |
226 // Encoding and decoding for klass field. It is copied code, but someday | 226 // Encoding and decoding for klass field. It is copied code, but someday |
227 // might not be the same as oop. | 227 // might not be the same as oop. |
228 | 228 |
229 inline narrowOop oopDesc::encode_klass_not_null(Klass* v) { | 229 inline narrowOop oopDesc::encode_klass_not_null(Klass* v) { |
230 assert(!is_null(v), "oop value can never be zero"); | 230 assert(!is_null(v), "klass value can never be zero"); |
231 assert(check_klass_alignment(v), "Address not aligned"); | 231 assert(check_klass_alignment(v), "Address not aligned"); |
232 address base = Universe::narrow_klass_base(); | 232 address base = Universe::narrow_klass_base(); |
233 int shift = Universe::narrow_klass_shift(); | 233 int shift = Universe::narrow_klass_shift(); |
234 uint64_t pd = (uint64_t)(pointer_delta((void*)v, (void*)base, 1)); | 234 uint64_t pd = (uint64_t)(pointer_delta((void*)v, (void*)base, 1)); |
235 assert(OopEncodingHeapMax > pd, "change encoding max if new encoding"); | 235 assert(KlassEncodingMetaspaceMax > pd, "change encoding max if new encoding"); |
236 uint64_t result = pd >> shift; | 236 uint64_t result = pd >> shift; |
237 assert((result & CONST64(0xffffffff00000000)) == 0, "narrow klass pointer overflow"); | 237 assert((result & CONST64(0xffffffff00000000)) == 0, "narrow klass pointer overflow"); |
238 assert(decode_klass(result) == v, "reversibility"); | 238 assert(decode_klass(result) == v, "reversibility"); |
239 return (narrowOop)result; | 239 return (narrowOop)result; |
240 } | 240 } |