/*
* Copyright 2008, 2009, 2010, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*
*/
#include "precompiled.hpp"
#include "ci/ciMethod.hpp"
#include "code/debugInfoRec.hpp"
#include "code/dependencies.hpp"
#include "code/exceptionHandlerTable.hpp"
#include "code/oopRecorder.hpp"
#include "compiler/abstractCompiler.hpp"
#include "compiler/oopMap.hpp"
#include "shark/llvmHeaders.hpp"
#include "shark/sharkBuilder.hpp"
#include "shark/sharkCodeBuffer.hpp"
#include "shark/sharkCompiler.hpp"
#include "shark/sharkContext.hpp"
#include "shark/sharkEntry.hpp"
#include "shark/sharkFunction.hpp"
#include "shark/sharkMemoryManager.hpp"
#include "shark/sharkNativeWrapper.hpp"
#include "shark/shark_globals.hpp"
#include <fnmatch.h>
using namespace llvm;
#if SHARK_LLVM_VERSION >= 27
namespace {
MCPU("mcpu");
MAttrs("mattr",
cl::CommaSeparated);
}
#endif
: AbstractCompiler() {
// Create the lock to protect the memory manager and execution engine
// Make LLVM safe for multithreading
if (!llvm_start_multithreaded())
fatal("llvm_start_multithreaded() failed");
// Initialize the native target
// Create the two contexts which we'll use
// Create the memory manager
_memory_manager = new SharkMemoryManager();
#if SHARK_LLVM_VERSION >= 27
// Finetune LLVM for the current host CPU.
if(gotCpuFeatures){
if(I->second){
}
}
}
// Create the JIT
if (!execution_engine()) {
else
printf("Unknown error while creating Shark JIT\n");
exit(1);
}
_native_context->module());
#else
#endif
// All done
}
}
int entry_bci) {
// Do the typeflow analysis
if (entry_bci == InvocationEntryBci)
else
return;
if (SharkPrintTypeflowOf != NULL) {
}
// Create the recorders
// Create the code buffer and builder
// Emit the entry point
// Build the LLVM IR for the method
// Generate native code. It's unpleasant that we have to drop into
// the VM to do this -- it blocks safepoints -- but I can't see any
// other way to handle the locking.
{
}
// Install the method into the VM
&offsets,
0,
&hscb,
0,
&oopmaps,
this,
env->comp_level(),
false,
false);
}
int compile_id,
// Create the code buffer and builder
// Emit the entry point
// Build the LLVM IR for the method
// Generate native code
// Return the nmethod for installation in the VM
0,
0,
wrapper->frame_size(),
wrapper->lock_offset(),
}
const char* name) {
// Print the LLVM bitcode, if requested
if (SharkPrintBitcodeOf != NULL) {
}
// Compile to native code
{
if (SharkPrintAsmOf != NULL) {
#if SHARK_LLVM_VERSION >= 27
#ifndef NDEBUG
}
else {
}
#endif // !NDEBUG
#else
// NB you need to patch LLVM with http://tinyurl.com/yf3baln for this
else
#endif // SHARK_LLVM_VERSION
}
}
// Register generated code for profiling, etc
// Print debug information, if requested
if (SharkTraceInstalls) {
" [%p-%p): %s (%d bytes code)",
}
}
// This method may only be called when the VM is at a safepoint.
// All _thread_in_vm threads will be waiting for the safepoint to
// finish with the exception of the VM thread, so we can consider
// ourself the owner of the execution engine lock even though we
// can't actually acquire it at this time.
}
// The free queue is protected by the execution engine lock
while (true) {
break;
}
}
for (const char *c = klass; *c; c++) {
if (*c == '/')
*(dst++) = '.';
else
*(dst++) = *c;
}
*(dst++) = ':';
*(dst++) = ':';
for (const char *c = method; *c; c++) {
*(dst++) = *c;
}
*(dst++) = '\0';
return buf;
}