src/hotspot/share/gc/shared/space.inline.hpp
changeset 49722 a47d1e21b3f1
parent 47216 71c04702a3d5
child 49982 9042ffe5b7fe
equal deleted inserted replaced
49721:ea0cc7c74e75 49722:a47d1e21b3f1
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2018, 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.
    30 #include "gc/shared/generation.hpp"
    30 #include "gc/shared/generation.hpp"
    31 #include "gc/shared/space.hpp"
    31 #include "gc/shared/space.hpp"
    32 #include "gc/shared/spaceDecorator.hpp"
    32 #include "gc/shared/spaceDecorator.hpp"
    33 #include "memory/universe.hpp"
    33 #include "memory/universe.hpp"
    34 #include "oops/oopsHierarchy.hpp"
    34 #include "oops/oopsHierarchy.hpp"
       
    35 #include "oops/oop.inline.hpp"
    35 #include "runtime/prefetch.inline.hpp"
    36 #include "runtime/prefetch.inline.hpp"
    36 #include "runtime/safepoint.hpp"
    37 #include "runtime/safepoint.hpp"
    37 
    38 
    38 inline HeapWord* Space::block_start(const void* p) {
    39 inline HeapWord* Space::block_start(const void* p) {
    39   return block_start_const(p);
    40   return block_start_const(p);
   110     size_t dead_length = pointer_delta(dead_end, dead_start);
   111     size_t dead_length = pointer_delta(dead_end, dead_start);
   111     if (_allowed_deadspace_words >= dead_length) {
   112     if (_allowed_deadspace_words >= dead_length) {
   112       _allowed_deadspace_words -= dead_length;
   113       _allowed_deadspace_words -= dead_length;
   113       CollectedHeap::fill_with_object(dead_start, dead_length);
   114       CollectedHeap::fill_with_object(dead_start, dead_length);
   114       oop obj = oop(dead_start);
   115       oop obj = oop(dead_start);
   115       obj->set_mark(obj->mark()->set_marked());
   116       obj->set_mark_raw(obj->mark_raw()->set_marked());
   116 
   117 
   117       assert(dead_length == (size_t)obj->size(), "bad filler object size");
   118       assert(dead_length == (size_t)obj->size(), "bad filler object size");
   118       log_develop_trace(gc, compaction)("Inserting object to dead space: " PTR_FORMAT ", " PTR_FORMAT ", " SIZE_FORMAT "b",
   119       log_develop_trace(gc, compaction)("Inserting object to dead space: " PTR_FORMAT ", " PTR_FORMAT ", " SIZE_FORMAT "b",
   119           p2i(dead_start), p2i(dead_end), dead_length * HeapWordSize);
   120           p2i(dead_start), p2i(dead_end), dead_length * HeapWordSize);
   120 
   121 
   157   HeapWord* cur_obj = space->bottom();
   158   HeapWord* cur_obj = space->bottom();
   158   HeapWord* scan_limit = space->scan_limit();
   159   HeapWord* scan_limit = space->scan_limit();
   159 
   160 
   160   while (cur_obj < scan_limit) {
   161   while (cur_obj < scan_limit) {
   161     assert(!space->scanned_block_is_obj(cur_obj) ||
   162     assert(!space->scanned_block_is_obj(cur_obj) ||
   162            oop(cur_obj)->mark()->is_marked() || oop(cur_obj)->mark()->is_unlocked() ||
   163            oop(cur_obj)->mark_raw()->is_marked() || oop(cur_obj)->mark_raw()->is_unlocked() ||
   163            oop(cur_obj)->mark()->has_bias_pattern(),
   164            oop(cur_obj)->mark_raw()->has_bias_pattern(),
   164            "these are the only valid states during a mark sweep");
   165            "these are the only valid states during a mark sweep");
   165     if (space->scanned_block_is_obj(cur_obj) && oop(cur_obj)->is_gc_marked()) {
   166     if (space->scanned_block_is_obj(cur_obj) && oop(cur_obj)->is_gc_marked()) {
   166       // prefetch beyond cur_obj
   167       // prefetch beyond cur_obj
   167       Prefetch::write(cur_obj, interval);
   168       Prefetch::write(cur_obj, interval);
   168       size_t size = space->scanned_block_size(cur_obj);
   169       size_t size = space->scanned_block_size(cur_obj);
   333       Prefetch::write(compaction_top, copy_interval);
   334       Prefetch::write(compaction_top, copy_interval);
   334 
   335 
   335       // copy object and reinit its mark
   336       // copy object and reinit its mark
   336       assert(cur_obj != compaction_top, "everything in this pass should be moving");
   337       assert(cur_obj != compaction_top, "everything in this pass should be moving");
   337       Copy::aligned_conjoint_words(cur_obj, compaction_top, size);
   338       Copy::aligned_conjoint_words(cur_obj, compaction_top, size);
   338       oop(compaction_top)->init_mark();
   339       oop(compaction_top)->init_mark_raw();
   339       assert(oop(compaction_top)->klass() != NULL, "should have a class");
   340       assert(oop(compaction_top)->klass() != NULL, "should have a class");
   340 
   341 
   341       debug_only(prev_obj = cur_obj);
   342       debug_only(prev_obj = cur_obj);
   342       cur_obj += size;
   343       cur_obj += size;
   343     }
   344     }