0N/A/*
1879N/A * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef SHARE_VM_CI_CIUTILITIES_HPP
1879N/A#define SHARE_VM_CI_CIUTILITIES_HPP
1879N/A
1879N/A#include "ci/ciEnv.hpp"
1879N/A#include "runtime/interfaceSupport.hpp"
1879N/A
0N/A// The following routines and definitions are used internally in the
0N/A// compiler interface.
0N/A
0N/A
0N/A// Add a ci native entry wrapper?
0N/A
0N/A// Bring the compilation thread into the VM state.
0N/A#define VM_ENTRY_MARK \
0N/A CompilerThread* thread=CompilerThread::current(); \
0N/A ThreadInVMfromNative __tiv(thread); \
0N/A ResetNoHandleMark rnhm; \
0N/A HandleMarkCleaner __hm(thread); \
0N/A Thread* THREAD = thread; \
0N/A debug_only(VMNativeEntryWrapper __vew;)
0N/A
0N/A
0N/A
0N/A// Bring the compilation thread into the VM state. No handle mark.
0N/A#define VM_QUICK_ENTRY_MARK \
0N/A CompilerThread* thread=CompilerThread::current(); \
0N/A ThreadInVMfromNative __tiv(thread); \
0N/A/* \
0N/A * [TODO] The NoHandleMark line does nothing but declare a function prototype \
0N/A * The NoHandkeMark constructor is NOT executed. If the ()'s are \
0N/A * removed, causes the NoHandleMark assert to trigger. \
0N/A * debug_only(NoHandleMark __hm();) \
0N/A */ \
0N/A Thread* THREAD = thread; \
0N/A debug_only(VMNativeEntryWrapper __vew;)
0N/A
0N/A
0N/A#define EXCEPTION_CONTEXT \
0N/A CompilerThread* thread=CompilerThread::current(); \
0N/A Thread* THREAD = thread;
0N/A
0N/A
0N/A#define CURRENT_ENV \
0N/A ciEnv::current()
0N/A
0N/A// where current thread is THREAD
0N/A#define CURRENT_THREAD_ENV \
0N/A ciEnv::current(thread)
0N/A
0N/A#define IS_IN_VM \
0N/A ciEnv::is_in_vm()
0N/A
0N/A#define ASSERT_IN_VM \
0N/A assert(IS_IN_VM, "must be in vm state");
0N/A
0N/A#define GUARDED_VM_ENTRY(action) \
0N/A {if (IS_IN_VM) { action } else { VM_ENTRY_MARK; { action }}}
0N/A
0N/A// Redefine this later.
0N/A#define KILL_COMPILE_ON_FATAL_(result) \
0N/A THREAD); \
0N/A if (HAS_PENDING_EXCEPTION) { \
0N/A if (PENDING_EXCEPTION->klass() == \
1142N/A SystemDictionary::ThreadDeath_klass()) { \
0N/A /* Kill the compilation. */ \
0N/A fatal("unhandled ci exception"); \
0N/A return (result); \
0N/A } \
0N/A CLEAR_PENDING_EXCEPTION; \
0N/A return (result); \
0N/A } \
0N/A (0
0N/A
0N/A#define KILL_COMPILE_ON_ANY \
0N/A THREAD); \
0N/A if (HAS_PENDING_EXCEPTION) { \
0N/A fatal("unhandled ci exception"); \
0N/A CLEAR_PENDING_EXCEPTION; \
0N/A } \
0N/A(0
0N/A
0N/A
0N/Ainline const char* bool_to_str(bool b) {
0N/A return ((b) ? "true" : "false");
0N/A}
0N/A
0N/Aconst char* basictype_to_str(BasicType t);
0N/Aconst char basictype_to_char(BasicType t);
1879N/A
1879N/A#endif // SHARE_VM_CI_CIUTILITIES_HPP