/* * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
// This file outlines the last 2 steps of the template pipeline of accesses going through // the Access API. // * Step 5.a: Barrier resolution. This step is invoked the first time a runtime-dispatch // happens for an access. The appropriate BarrierSet::AccessBarrier accessor // is resolved, then the function pointer is updated to that accessor for // future invocations. // * Step 5.b: Post-runtime dispatch. This step now casts previously unknown types such // as the address type of an oop on the heap (is it oop* or narrowOop*) to // the appropriate type. It also splits sufficiently orthogonal accesses into // different functions, such as whether the access involves oops or primitives // and whether the access is performed on the heap or outside. Then the // appropriate BarrierSet::AccessBarrier is called to perform the access.
namespace AccessInternal { // Step 5.b: Post-runtime dispatch. // This class is the last step before calling the BarrierSet::AccessBarrier. // Here we make sure to figure out types that were not known prior to the // runtime dispatch, such as whether an oop on the heap is oop or narrowOop. // We also split orthogonal barriers such as handling primitives vs oops // and on-heap vs off-heap into different calls to the barrier set. template <class GCBarrierType, BarrierType type, DecoratorSet decorators> struct PostRuntimeDispatch: public AllStatic { };
// Resolving accessors with barriers from the barrier set happens in two steps. // 1. Expand paths with runtime-decorators, e.g. is UseCompressedOops on or off. // 2. Expand paths for each BarrierSet available in the system. template <DecoratorSet decorators, typename FunctionPointerT, BarrierType barrier_type> struct BarrierResolver: public AllStatic { template <DecoratorSet ds> statictypename EnableIf<
HasDecorator<ds, INTERNAL_VALUE_IS_OOP>::value,
FunctionPointerT>::type
resolve_barrier_gc() {
BarrierSet* bs = BarrierSet::barrier_set();
assert(bs != NULL, "GC barriers invoked before BarrierSet is set"); switch (bs->kind()) { #define BARRIER_SET_RESOLVE_BARRIER_CLOSURE(bs_name) \ case BarrierSet::bs_name: { \ return PostRuntimeDispatch<typename BarrierSet::GetType<BarrierSet::bs_name>::type:: \
AccessBarrier<ds>, barrier_type, ds>::oop_access_barrier; \
} \ break;
FOR_EACH_CONCRETE_BARRIER_SET_DO(BARRIER_SET_RESOLVE_BARRIER_CLOSURE) #undef BARRIER_SET_RESOLVE_BARRIER_CLOSURE
default:
fatal("BarrierSet AccessBarrier resolving not implemented"); return NULL;
};
}
// Step 5.a: Barrier resolution // The RuntimeDispatch class is responsible for performing a runtime dispatch of the // accessor. This is required when the access either depends on whether compressed oops // is being used, or it depends on which GC implementation was chosen (e.g. requires GC // barriers). The way it works is that a function pointer initially pointing to an // accessor resolution function gets called for each access. Upon first invocation, // it resolves which accessor to be used in future invocations and patches the // function pointer to this new accessor.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.