1 /* |
1 /* |
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2013, 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. |
75 size_t ptr_2_card_num(const jbyte* card_ptr) { |
75 size_t ptr_2_card_num(const jbyte* card_ptr) { |
76 assert(card_ptr >= _ct_bot, |
76 assert(card_ptr >= _ct_bot, |
77 err_msg("Invalid card pointer: " |
77 err_msg("Invalid card pointer: " |
78 "card_ptr: " PTR_FORMAT ", " |
78 "card_ptr: " PTR_FORMAT ", " |
79 "_ct_bot: " PTR_FORMAT, |
79 "_ct_bot: " PTR_FORMAT, |
80 card_ptr, _ct_bot)); |
80 p2i(card_ptr), p2i(_ct_bot))); |
81 size_t card_num = pointer_delta(card_ptr, _ct_bot, sizeof(jbyte)); |
81 size_t card_num = pointer_delta(card_ptr, _ct_bot, sizeof(jbyte)); |
82 assert(card_num >= 0 && card_num < _committed_max_card_num, |
82 assert(card_num >= 0 && card_num < _committed_max_card_num, |
83 err_msg("card pointer out of range: " PTR_FORMAT, card_ptr)); |
83 err_msg("card pointer out of range: " PTR_FORMAT, p2i(card_ptr))); |
84 return card_num; |
84 return card_num; |
85 } |
85 } |
86 |
86 |
87 jbyte* card_num_2_ptr(size_t card_num) { |
87 jbyte* card_num_2_ptr(size_t card_num) { |
88 assert(card_num >= 0 && card_num < _committed_max_card_num, |
88 assert(card_num >= 0 && card_num < _committed_max_card_num, |