comparison src/share/vm/classfile/symbolTable.cpp @ 17764:595c0f60d50d

8029075: String deduplication in G1 Summary: Implementation of JEP 192, http://openjdk.java.net/jeps/192 Reviewed-by: brutisso, tschatzl, coleenp
author pliden
date Tue, 18 Mar 2014 19:07:22 +0100
parents 5a32d2a3cc1e
children 78bbf4d43a14
comparison
equal deleted inserted replaced
17763:6e7e363c5a8f 17764:595c0f60d50d
1 /* 1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 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.
33 #include "memory/gcLocker.inline.hpp" 33 #include "memory/gcLocker.inline.hpp"
34 #include "oops/oop.inline.hpp" 34 #include "oops/oop.inline.hpp"
35 #include "oops/oop.inline2.hpp" 35 #include "oops/oop.inline2.hpp"
36 #include "runtime/mutexLocker.hpp" 36 #include "runtime/mutexLocker.hpp"
37 #include "utilities/hashtable.inline.hpp" 37 #include "utilities/hashtable.inline.hpp"
38 #if INCLUDE_ALL_GCS
39 #include "gc_implementation/g1/g1StringDedup.hpp"
40 #endif
38 41
39 // -------------------------------------------------------------------------- 42 // --------------------------------------------------------------------------
40 43
41 // the number of buckets a thread claims 44 // the number of buckets a thread claims
42 const int ClaimChunkSize = 32; 45 const int ClaimChunkSize = 32;
726 string = string_or_null; 729 string = string_or_null;
727 } else { 730 } else {
728 string = java_lang_String::create_from_unicode(name, len, CHECK_NULL); 731 string = java_lang_String::create_from_unicode(name, len, CHECK_NULL);
729 } 732 }
730 733
734 #if INCLUDE_ALL_GCS
735 if (G1StringDedup::is_enabled()) {
736 // Deduplicate the string before it is interned. Note that we should never
737 // deduplicate a string after it has been interned. Doing so will counteract
738 // compiler optimizations done on e.g. interned string literals.
739 G1StringDedup::deduplicate(string());
740 }
741 #endif
742
731 // Grab the StringTable_lock before getting the_table() because it could 743 // Grab the StringTable_lock before getting the_table() because it could
732 // change at safepoint. 744 // change at safepoint.
733 MutexLocker ml(StringTable_lock, THREAD); 745 MutexLocker ml(StringTable_lock, THREAD);
734 746
735 // Otherwise, add to symbol to table 747 // Otherwise, add to symbol to table