Tue, 18 Jun 2013 12:31:07 -0700
8015237: Parallelize string table scanning during strong root processing
Summary: Parallelize the scanning of the intern string table by having each GC worker claim a given number of buckets. Changes were also reviewed by Per Liden <per.liden@oracle.com>.
Reviewed-by: tschatzl, stefank, twisti
duke@435 | 1 | /* |
minqi@4267 | 2 | * Copyright (c) 1999, 2012, Oracle and/or its affiliates. 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 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #ifndef SHARE_VM_CI_CIUTILITIES_HPP |
stefank@2314 | 26 | #define SHARE_VM_CI_CIUTILITIES_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "ci/ciEnv.hpp" |
stefank@2314 | 29 | #include "runtime/interfaceSupport.hpp" |
stefank@2314 | 30 | |
duke@435 | 31 | // The following routines and definitions are used internally in the |
duke@435 | 32 | // compiler interface. |
duke@435 | 33 | |
duke@435 | 34 | |
duke@435 | 35 | // Add a ci native entry wrapper? |
duke@435 | 36 | |
duke@435 | 37 | // Bring the compilation thread into the VM state. |
duke@435 | 38 | #define VM_ENTRY_MARK \ |
duke@435 | 39 | CompilerThread* thread=CompilerThread::current(); \ |
duke@435 | 40 | ThreadInVMfromNative __tiv(thread); \ |
duke@435 | 41 | ResetNoHandleMark rnhm; \ |
duke@435 | 42 | HandleMarkCleaner __hm(thread); \ |
duke@435 | 43 | Thread* THREAD = thread; \ |
duke@435 | 44 | debug_only(VMNativeEntryWrapper __vew;) |
duke@435 | 45 | |
duke@435 | 46 | |
duke@435 | 47 | |
duke@435 | 48 | // Bring the compilation thread into the VM state. No handle mark. |
duke@435 | 49 | #define VM_QUICK_ENTRY_MARK \ |
duke@435 | 50 | CompilerThread* thread=CompilerThread::current(); \ |
duke@435 | 51 | ThreadInVMfromNative __tiv(thread); \ |
duke@435 | 52 | /* \ |
duke@435 | 53 | * [TODO] The NoHandleMark line does nothing but declare a function prototype \ |
duke@435 | 54 | * The NoHandkeMark constructor is NOT executed. If the ()'s are \ |
duke@435 | 55 | * removed, causes the NoHandleMark assert to trigger. \ |
duke@435 | 56 | * debug_only(NoHandleMark __hm();) \ |
duke@435 | 57 | */ \ |
duke@435 | 58 | Thread* THREAD = thread; \ |
duke@435 | 59 | debug_only(VMNativeEntryWrapper __vew;) |
duke@435 | 60 | |
duke@435 | 61 | |
duke@435 | 62 | #define EXCEPTION_CONTEXT \ |
duke@435 | 63 | CompilerThread* thread=CompilerThread::current(); \ |
duke@435 | 64 | Thread* THREAD = thread; |
duke@435 | 65 | |
duke@435 | 66 | |
duke@435 | 67 | #define CURRENT_ENV \ |
duke@435 | 68 | ciEnv::current() |
duke@435 | 69 | |
duke@435 | 70 | // where current thread is THREAD |
duke@435 | 71 | #define CURRENT_THREAD_ENV \ |
duke@435 | 72 | ciEnv::current(thread) |
duke@435 | 73 | |
duke@435 | 74 | #define IS_IN_VM \ |
duke@435 | 75 | ciEnv::is_in_vm() |
duke@435 | 76 | |
duke@435 | 77 | #define ASSERT_IN_VM \ |
duke@435 | 78 | assert(IS_IN_VM, "must be in vm state"); |
duke@435 | 79 | |
duke@435 | 80 | #define GUARDED_VM_ENTRY(action) \ |
duke@435 | 81 | {if (IS_IN_VM) { action } else { VM_ENTRY_MARK; { action }}} |
duke@435 | 82 | |
minqi@4267 | 83 | #define GUARDED_VM_QUICK_ENTRY(action) \ |
minqi@4267 | 84 | {if (IS_IN_VM) { action } else { VM_QUICK_ENTRY_MARK; { action }}} |
minqi@4267 | 85 | |
duke@435 | 86 | // Redefine this later. |
duke@435 | 87 | #define KILL_COMPILE_ON_FATAL_(result) \ |
duke@435 | 88 | THREAD); \ |
duke@435 | 89 | if (HAS_PENDING_EXCEPTION) { \ |
duke@435 | 90 | if (PENDING_EXCEPTION->klass() == \ |
never@1577 | 91 | SystemDictionary::ThreadDeath_klass()) { \ |
duke@435 | 92 | /* Kill the compilation. */ \ |
duke@435 | 93 | fatal("unhandled ci exception"); \ |
duke@435 | 94 | return (result); \ |
duke@435 | 95 | } \ |
duke@435 | 96 | CLEAR_PENDING_EXCEPTION; \ |
duke@435 | 97 | return (result); \ |
duke@435 | 98 | } \ |
duke@435 | 99 | (0 |
duke@435 | 100 | |
duke@435 | 101 | #define KILL_COMPILE_ON_ANY \ |
duke@435 | 102 | THREAD); \ |
duke@435 | 103 | if (HAS_PENDING_EXCEPTION) { \ |
duke@435 | 104 | fatal("unhandled ci exception"); \ |
duke@435 | 105 | CLEAR_PENDING_EXCEPTION; \ |
duke@435 | 106 | } \ |
duke@435 | 107 | (0 |
duke@435 | 108 | |
duke@435 | 109 | |
duke@435 | 110 | inline const char* bool_to_str(bool b) { |
duke@435 | 111 | return ((b) ? "true" : "false"); |
duke@435 | 112 | } |
duke@435 | 113 | |
duke@435 | 114 | const char* basictype_to_str(BasicType t); |
duke@435 | 115 | const char basictype_to_char(BasicType t); |
stefank@2314 | 116 | |
stefank@2314 | 117 | #endif // SHARE_VM_CI_CIUTILITIES_HPP |