equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2014, 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. |
48 inline size_t G1BlockOffsetSharedArray::index_for(const void* p) const { |
48 inline size_t G1BlockOffsetSharedArray::index_for(const void* p) const { |
49 char* pc = (char*)p; |
49 char* pc = (char*)p; |
50 assert(pc >= (char*)_reserved.start() && |
50 assert(pc >= (char*)_reserved.start() && |
51 pc < (char*)_reserved.end(), |
51 pc < (char*)_reserved.end(), |
52 err_msg("p (" PTR_FORMAT ") not in reserved [" PTR_FORMAT ", " PTR_FORMAT ")", |
52 err_msg("p (" PTR_FORMAT ") not in reserved [" PTR_FORMAT ", " PTR_FORMAT ")", |
53 p, (char*)_reserved.start(), (char*)_reserved.end())); |
53 p2i(p), p2i(_reserved.start()), p2i(_reserved.end()))); |
54 size_t delta = pointer_delta(pc, _reserved.start(), sizeof(char)); |
54 size_t delta = pointer_delta(pc, _reserved.start(), sizeof(char)); |
55 size_t result = delta >> LogN; |
55 size_t result = delta >> LogN; |
56 check_index(result, "bad index from address"); |
56 check_index(result, "bad index from address"); |
57 return result; |
57 return result; |
58 } |
58 } |
63 HeapWord* result = _reserved.start() + (index << LogN_words); |
63 HeapWord* result = _reserved.start() + (index << LogN_words); |
64 assert(result >= _reserved.start() && result < _reserved.end(), |
64 assert(result >= _reserved.start() && result < _reserved.end(), |
65 err_msg("bad address from index result " PTR_FORMAT |
65 err_msg("bad address from index result " PTR_FORMAT |
66 " _reserved.start() " PTR_FORMAT " _reserved.end() " |
66 " _reserved.start() " PTR_FORMAT " _reserved.end() " |
67 PTR_FORMAT, |
67 PTR_FORMAT, |
68 result, _reserved.start(), _reserved.end())); |
68 p2i(result), p2i(_reserved.start()), p2i(_reserved.end()))); |
69 return result; |
69 return result; |
70 } |
70 } |
71 |
71 |
72 inline HeapWord* |
72 inline HeapWord* |
73 G1BlockOffsetArray::block_at_or_preceding(const void* addr, |
73 G1BlockOffsetArray::block_at_or_preceding(const void* addr, |