Sat, 19 Jul 2008 17:38:22 -0400
6716785: implicit null checks not triggering with CompressedOops
Summary: allocate alignment-sized page(s) below java heap so that memory accesses at heap_base+1page give signal and cause an implicit null check
Reviewed-by: kvn, jmasa, phh, jcoomes
duke@435 | 1 | /* |
duke@435 | 2 | * Copyright 2001-2005 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | class PSAdaptiveSizePolicy; |
duke@435 | 26 | class PSYoungGen; |
duke@435 | 27 | class PSOldGen; |
duke@435 | 28 | |
duke@435 | 29 | class PSMarkSweep : public MarkSweep { |
duke@435 | 30 | private: |
duke@435 | 31 | static elapsedTimer _accumulated_time; |
duke@435 | 32 | static unsigned int _total_invocations; |
duke@435 | 33 | static jlong _time_of_last_gc; // ms |
duke@435 | 34 | static CollectorCounters* _counters; |
duke@435 | 35 | |
duke@435 | 36 | // Closure accessors |
duke@435 | 37 | static OopClosure* mark_and_push_closure() { return &MarkSweep::mark_and_push_closure; } |
duke@435 | 38 | static VoidClosure* follow_stack_closure() { return (VoidClosure*)&MarkSweep::follow_stack_closure; } |
duke@435 | 39 | static OopClosure* adjust_pointer_closure() { return (OopClosure*)&MarkSweep::adjust_pointer_closure; } |
duke@435 | 40 | static OopClosure* adjust_root_pointer_closure() { return (OopClosure*)&MarkSweep::adjust_root_pointer_closure; } |
duke@435 | 41 | static BoolObjectClosure* is_alive_closure() { return (BoolObjectClosure*)&MarkSweep::is_alive; } |
duke@435 | 42 | |
duke@435 | 43 | debug_only(public:) // Used for PSParallelCompact debugging |
duke@435 | 44 | // Mark live objects |
duke@435 | 45 | static void mark_sweep_phase1(bool clear_all_softrefs); |
duke@435 | 46 | // Calculate new addresses |
duke@435 | 47 | static void mark_sweep_phase2(); |
duke@435 | 48 | debug_only(private:) // End used for PSParallelCompact debugging |
duke@435 | 49 | // Update pointers |
duke@435 | 50 | static void mark_sweep_phase3(); |
duke@435 | 51 | // Move objects to new positions |
duke@435 | 52 | static void mark_sweep_phase4(); |
duke@435 | 53 | |
duke@435 | 54 | debug_only(public:) // Used for PSParallelCompact debugging |
duke@435 | 55 | // Temporary data structures for traversal and storing/restoring marks |
duke@435 | 56 | static void allocate_stacks(); |
duke@435 | 57 | static void deallocate_stacks(); |
duke@435 | 58 | static void set_ref_processor(ReferenceProcessor* rp) { // delete this method |
duke@435 | 59 | _ref_processor = rp; |
duke@435 | 60 | } |
duke@435 | 61 | debug_only(private:) // End used for PSParallelCompact debugging |
duke@435 | 62 | |
duke@435 | 63 | // If objects are left in eden after a collection, try to move the boundary |
duke@435 | 64 | // and absorb them into the old gen. Returns true if eden was emptied. |
duke@435 | 65 | static bool absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_policy, |
duke@435 | 66 | PSYoungGen* young_gen, |
duke@435 | 67 | PSOldGen* old_gen); |
duke@435 | 68 | |
duke@435 | 69 | // Reset time since last full gc |
duke@435 | 70 | static void reset_millis_since_last_gc(); |
duke@435 | 71 | |
duke@435 | 72 | public: |
duke@435 | 73 | static void invoke(bool clear_all_softrefs); |
duke@435 | 74 | static void invoke_no_policy(bool clear_all_softrefs); |
duke@435 | 75 | |
duke@435 | 76 | static void initialize(); |
duke@435 | 77 | |
duke@435 | 78 | // Public accessors |
duke@435 | 79 | static elapsedTimer* accumulated_time() { return &_accumulated_time; } |
duke@435 | 80 | static unsigned int total_invocations() { return _total_invocations; } |
duke@435 | 81 | static CollectorCounters* counters() { return _counters; } |
duke@435 | 82 | |
duke@435 | 83 | // Time since last full gc (in milliseconds) |
duke@435 | 84 | static jlong millis_since_last_gc(); |
duke@435 | 85 | }; |