Unify the invoke stubs and replace "oat" with "Art" in the API.
Change-Id: Ic1529d7568bd5297fdce4da69ede67c2f48487a4
diff --git a/src/compiled_method.cc b/src/compiled_method.cc
index e122816..f718991 100644
--- a/src/compiled_method.cc
+++ b/src/compiled_method.cc
@@ -73,7 +73,7 @@
CHECK_NE(gc_map.size(), 0U);
#if !defined(ART_USE_LLVM_COMPILER)
- // Should only be used with CompiledMethods created with oatCompileMethod
+ // Should only be used with CompiledMethods created with the non-LLVM compilers.
CHECK_NE(mapping_table_.size(), 0U);
CHECK_NE(vmap_table_.size(), 0U);
#endif
diff --git a/src/compiled_method.h b/src/compiled_method.h
index e6fdbaa..6dc5128 100644
--- a/src/compiled_method.h
+++ b/src/compiled_method.h
@@ -31,11 +31,11 @@
class CompiledMethod {
public:
#if defined(ART_USE_LLVM_COMPILER)
- // Create a CompiledMethod from the oatCompileMethod
- CompiledMethod(InstructionSet instruction_set,
- llvm::Function* func);
+ // Constructs a CompiledMethod for the LLVM compiler.
+ CompiledMethod(InstructionSet instruction_set, llvm::Function* func);
#endif
- // Create a CompiledMethod from the oatCompileMethod
+
+ // Constructs a CompiledMethod for the non-LLVM compilers.
CompiledMethod(InstructionSet instruction_set,
const std::vector<uint8_t>& code,
const size_t frame_size_in_bytes,
@@ -44,10 +44,10 @@
const std::vector<uint32_t>& mapping_table,
const std::vector<uint16_t>& vmap_table);
- // Add a GC map to a CompiledMethod created by oatCompileMethod
+ // Sets the GC map for a CompiledMethod.
void SetGcMap(const std::vector<uint8_t>& gc_map);
- // Create a CompiledMethod from the JniCompiler
+ // Constructs a CompiledMethod for the JniCompiler.
CompiledMethod(InstructionSet instruction_set,
const std::vector<uint8_t>& code,
const size_t frame_size_in_bytes,
diff --git a/src/compiler.cc b/src/compiler.cc
index 447d6f5..917c61e 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -297,7 +297,7 @@
}
VLOG(compiler) << "dlopen(\"" << compiler_so_name << "\", RTLD_LAZY) returned " << compiler_library_;
- compiler_ = FindFunction<CompilerFn>(compiler_so_name, compiler_library_, "oatCompileMethod");
+ compiler_ = FindFunction<CompilerFn>(compiler_so_name, compiler_library_, "ArtCompileMethod");
jni_compiler_ = FindFunction<JniCompilerFn>(compiler_so_name, compiler_library_, "ArtJniCompileMethod");
create_invoke_stub_ = FindFunction<CreateInvokeStubFn>(compiler_so_name, compiler_library_, "ArtCreateInvokeStub");
@@ -1160,12 +1160,7 @@
bool is_static = (access_flags & kAccStatic) != 0;
const CompiledInvokeStub* compiled_invoke_stub = FindInvokeStub(is_static, shorty);
if (compiled_invoke_stub == NULL) {
-#if defined(ART_USE_LLVM_COMPILER)
compiled_invoke_stub = (*create_invoke_stub_)(*this, is_static, shorty, shorty_len);
-#else
- compiled_invoke_stub = (*create_invoke_stub_)(is_static, shorty, shorty_len);
-#endif
-
CHECK(compiled_invoke_stub != NULL);
InsertInvokeStub(is_static, shorty, compiled_invoke_stub);
}
diff --git a/src/compiler.h b/src/compiler.h
index 134e71b..55273b7 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -222,13 +222,8 @@
const ClassLoader* class_loader,
const DexFile& dex_file);
JniCompilerFn jni_compiler_;
-#if !defined(ART_USE_LLVM_COMPILER)
- typedef CompiledInvokeStub* (*CreateInvokeStubFn)(bool is_static,
- const char* shorty, uint32_t shorty_len);
-#else
typedef CompiledInvokeStub* (*CreateInvokeStubFn)(Compiler& compiler, bool is_static,
const char* shorty, uint32_t shorty_len);
-#endif
CreateInvokeStubFn create_invoke_stub_;
DISALLOW_COPY_AND_ASSIGN(Compiler);
diff --git a/src/compiler/Compiler.h b/src/compiler/Compiler.h
index a457fa6..9516f25 100644
--- a/src/compiler/Compiler.h
+++ b/src/compiler/Compiler.h
@@ -209,7 +209,7 @@
} // namespace art
-extern "C" art::CompiledMethod* oatCompileMethod(art::Compiler& compiler,
+extern "C" art::CompiledMethod* ArtCompileMethod(art::Compiler& compiler,
const art::DexFile::CodeItem* code_item,
uint32_t access_flags, uint32_t method_idx,
const art::ClassLoader* class_loader,
diff --git a/src/compiler/Frontend.cc b/src/compiler/Frontend.cc
index 1b8bcc1..e1b2c60 100644
--- a/src/compiler/Frontend.cc
+++ b/src/compiler/Frontend.cc
@@ -733,11 +733,11 @@
}
}
-CompiledMethod* oatCompileMethodInternal(Compiler& compiler,
- const DexFile::CodeItem* code_item,
- uint32_t access_flags, uint32_t method_idx,
- const ClassLoader* class_loader,
- const DexFile& dex_file)
+CompiledMethod* oatCompileMethod(Compiler& compiler,
+ const DexFile::CodeItem* code_item,
+ uint32_t access_flags, uint32_t method_idx,
+ const ClassLoader* class_loader,
+ const DexFile& dex_file)
{
VLOG(compiler) << "Compiling " << PrettyMethod(method_idx, dex_file) << "...";
@@ -1032,12 +1032,12 @@
} // namespace art
-extern "C" art::CompiledMethod* oatCompileMethod(art::Compiler& compiler,
+extern "C" art::CompiledMethod* ArtCompileMethod(art::Compiler& compiler,
const art::DexFile::CodeItem* code_item,
uint32_t access_flags, uint32_t method_idx,
const art::ClassLoader* class_loader,
const art::DexFile& dex_file)
{
CHECK_EQ(compiler.GetInstructionSet(), art::oatInstructionSet());
- return art::oatCompileMethodInternal(compiler, code_item, access_flags, method_idx, class_loader, dex_file);
+ return art::oatCompileMethod(compiler, code_item, access_flags, method_idx, class_loader, dex_file);
}
diff --git a/src/compiler_llvm/compiler_llvm.cc b/src/compiler_llvm/compiler_llvm.cc
index 5a3725e..c5e620b 100644
--- a/src/compiler_llvm/compiler_llvm.cc
+++ b/src/compiler_llvm/compiler_llvm.cc
@@ -224,7 +224,7 @@
} // anonymous namespace
-extern "C" art::CompiledMethod* oatCompileMethod(art::Compiler& compiler,
+extern "C" art::CompiledMethod* ArtCompileMethod(art::Compiler& compiler,
const art::DexFile::CodeItem* code_item,
uint32_t access_flags, uint32_t method_idx,
const art::ClassLoader* class_loader,
diff --git a/src/jni_internal_arm.cc b/src/jni_internal_arm.cc
index 49c9d7a..6197f15 100644
--- a/src/jni_internal_arm.cc
+++ b/src/jni_internal_arm.cc
@@ -21,6 +21,7 @@
#include "asm_support.h"
#include "assembler.h"
#include "compiled_method.h"
+#include "compiler.h"
#include "object.h"
namespace art {
@@ -144,6 +145,6 @@
} // namespace arm
} // namespace art
-extern "C" art::CompiledInvokeStub* ArtCreateInvokeStub(bool is_static, const char* shorty, uint32_t shorty_len) {
+extern "C" art::CompiledInvokeStub* ArtCreateInvokeStub(art::Compiler& compiler, bool is_static, const char* shorty, uint32_t shorty_len) {
return art::arm::CreateInvokeStub(is_static, shorty, shorty_len);
}
diff --git a/src/jni_internal_x86.cc b/src/jni_internal_x86.cc
index bd6643e..e23c87b 100644
--- a/src/jni_internal_x86.cc
+++ b/src/jni_internal_x86.cc
@@ -18,6 +18,7 @@
#include "assembler.h"
#include "compiled_method.h"
+#include "compiler.h"
#include "object.h"
namespace art {
@@ -130,6 +131,6 @@
} // namespace x86
} // namespace art
-extern "C" art::CompiledInvokeStub* ArtCreateInvokeStub(bool is_static, const char* shorty, uint32_t shorty_len) {
+extern "C" art::CompiledInvokeStub* ArtCreateInvokeStub(art::Compiler& compiler, bool is_static, const char* shorty, uint32_t shorty_len) {
return art::x86::CreateInvokeStub(is_static, shorty, shorty_len);
}