/* * Copyright (c) 1997, 2022, 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. *
*/
class VM_Operation : public StackObj { public: enum VMOp_Type {
VM_OPS_DO(VM_OP_ENUM)
VMOp_Terminating
};
private:
Thread* _calling_thread;
// The VM operation name array staticconstchar* _names[];
public:
VM_Operation() : _calling_thread(NULL) {}
// VM operation support (used by VM thread)
Thread* calling_thread() const { return _calling_thread; } void set_calling_thread(Thread* thread);
// Called by VM thread - does in turn invoke doit(). Do not override this void evaluate();
// evaluate() is called by the VMThread and in turn calls doit(). // If the thread invoking VMThread::execute((VM_Operation*) is a JavaThread, // doit_prologue() is called in that thread before transferring control to // the VMThread. // If doit_prologue() returns true the VM operation will proceed, and // doit_epilogue() will be called by the JavaThread once the VM operation // completes. If doit_prologue() returns false the VM operation is cancelled. virtualvoid doit() = 0; virtualbool doit_prologue() { returntrue; }; virtualvoid doit_epilogue() {};
// Configuration. Override these appropriately in subclasses. virtual VMOp_Type type() const = 0; virtualbool allow_nested_vm_operations() const { returnfalse; }
// You may override skip_thread_oop_barriers to return true if the operation // does not access thread-private oops (including frames). virtualbool skip_thread_oop_barriers() const { returnfalse; }
// An operation can either be done inside a safepoint // or concurrently with Java threads running. virtualbool evaluate_at_safepoint() const { returntrue; }
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.