1 /* |
1 /* |
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 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. |
52 } |
52 } |
53 #else |
53 #else |
54 _ct_bs = new CardTableModRefBSForCTRS(whole_heap, max_covered_regions); |
54 _ct_bs = new CardTableModRefBSForCTRS(whole_heap, max_covered_regions); |
55 #endif |
55 #endif |
56 set_bs(_ct_bs); |
56 set_bs(_ct_bs); |
57 _last_cur_val_in_gen = new jbyte[GenCollectedHeap::max_gens + 1]; |
57 _last_cur_val_in_gen = NEW_C_HEAP_ARRAY3(jbyte, GenCollectedHeap::max_gens + 1, |
|
58 mtGC, 0, AllocFailStrategy::RETURN_NULL); |
58 if (_last_cur_val_in_gen == NULL) { |
59 if (_last_cur_val_in_gen == NULL) { |
59 vm_exit_during_initialization("Could not last_cur_val_in_gen array."); |
60 vm_exit_during_initialization("Could not create last_cur_val_in_gen array."); |
60 } |
61 } |
61 for (int i = 0; i < GenCollectedHeap::max_gens + 1; i++) { |
62 for (int i = 0; i < GenCollectedHeap::max_gens + 1; i++) { |
62 _last_cur_val_in_gen[i] = clean_card_val(); |
63 _last_cur_val_in_gen[i] = clean_card_val(); |
63 } |
64 } |
64 _ct_bs->set_CTRS(this); |
65 _ct_bs->set_CTRS(this); |
|
66 } |
|
67 |
|
68 CardTableRS::~CardTableRS() { |
|
69 if (_ct_bs) { |
|
70 delete _ct_bs; |
|
71 _ct_bs = NULL; |
|
72 } |
|
73 if (_last_cur_val_in_gen) { |
|
74 FREE_C_HEAP_ARRAY(jbyte, _last_cur_val_in_gen, mtInternal); |
|
75 } |
65 } |
76 } |
66 |
77 |
67 void CardTableRS::resize_covered_region(MemRegion new_region) { |
78 void CardTableRS::resize_covered_region(MemRegion new_region) { |
68 _ct_bs->resize_covered_region(new_region); |
79 _ct_bs->resize_covered_region(new_region); |
69 } |
80 } |