hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.cpp
changeset 29081 c61eb4914428
parent 27251 7d667f91ec8d
child 29680 e5203ed6d805
equal deleted inserted replaced
29080:a16b0d9a08f5 29081:c61eb4914428
     1 /*
     1 /*
     2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2014, 2015, 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.
    21  * questions.
    21  * questions.
    22  *
    22  *
    23  */
    23  */
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "classfile/javaClasses.hpp"
    26 #include "classfile/javaClasses.inline.hpp"
    27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
    27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
    28 #include "gc_implementation/g1/g1GCPhaseTimes.hpp"
    28 #include "gc_implementation/g1/g1GCPhaseTimes.hpp"
    29 #include "gc_implementation/g1/g1StringDedup.hpp"
    29 #include "gc_implementation/g1/g1StringDedup.hpp"
    30 #include "gc_implementation/g1/g1StringDedupQueue.hpp"
    30 #include "gc_implementation/g1/g1StringDedupQueue.hpp"
    31 #include "gc_implementation/g1/g1StringDedupStat.hpp"
    31 #include "gc_implementation/g1/g1StringDedupStat.hpp"
    49   assert(is_enabled(), "String deduplication not enabled");
    49   assert(is_enabled(), "String deduplication not enabled");
    50   G1StringDedupThread::stop();
    50   G1StringDedupThread::stop();
    51 }
    51 }
    52 
    52 
    53 bool G1StringDedup::is_candidate_from_mark(oop obj) {
    53 bool G1StringDedup::is_candidate_from_mark(oop obj) {
    54   if (java_lang_String::is_instance(obj)) {
    54   if (java_lang_String::is_instance_inlined(obj)) {
    55     bool from_young = G1CollectedHeap::heap()->heap_region_containing_raw(obj)->is_young();
    55     bool from_young = G1CollectedHeap::heap()->heap_region_containing_raw(obj)->is_young();
    56     if (from_young && obj->age() < StringDeduplicationAgeThreshold) {
    56     if (from_young && obj->age() < StringDeduplicationAgeThreshold) {
    57       // Candidate found. String is being evacuated from young to old but has not
    57       // Candidate found. String is being evacuated from young to old but has not
    58       // reached the deduplication age threshold, i.e. has not previously been a
    58       // reached the deduplication age threshold, i.e. has not previously been a
    59       // candidate during its life in the young generation.
    59       // candidate during its life in the young generation.
    71     G1StringDedupQueue::push(0 /* worker_id */, java_string);
    71     G1StringDedupQueue::push(0 /* worker_id */, java_string);
    72   }
    72   }
    73 }
    73 }
    74 
    74 
    75 bool G1StringDedup::is_candidate_from_evacuation(bool from_young, bool to_young, oop obj) {
    75 bool G1StringDedup::is_candidate_from_evacuation(bool from_young, bool to_young, oop obj) {
    76   if (from_young && java_lang_String::is_instance(obj)) {
    76   if (from_young && java_lang_String::is_instance_inlined(obj)) {
    77     if (to_young && obj->age() == StringDeduplicationAgeThreshold) {
    77     if (to_young && obj->age() == StringDeduplicationAgeThreshold) {
    78       // Candidate found. String is being evacuated from young to young and just
    78       // Candidate found. String is being evacuated from young to young and just
    79       // reached the deduplication age threshold.
    79       // reached the deduplication age threshold.
    80       return true;
    80       return true;
    81     }
    81     }