Reduce namespace pollution.
This leaves us with just the mspace stuff and three libdex functions to clean
up. We deliberately expose the JII API, and I don't think there's anything we
can really do about the art_..._from_code stuff (and at least that starts with
"art_").
Change-Id: I77e58e8330cd2afeb496642302dfe3311e68091a
diff --git a/src/compiler.cc b/src/compiler.cc
index 51a5caa..137f242 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -16,14 +16,13 @@
#include "runtime.h"
#include "stl_util.h"
-art::CompiledMethod* oatCompileMethod(const 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, art::InstructionSet);
-
namespace art {
+CompiledMethod* oatCompileMethod(const Compiler& compiler, const DexFile::CodeItem* code_item,
+ uint32_t access_flags, uint32_t method_idx,
+ const ClassLoader* class_loader,
+ const DexFile& dex_file, InstructionSet);
+
namespace arm {
ByteArray* CreateAbstractMethodErrorStub();
CompiledInvokeStub* ArmCreateInvokeStub(bool is_static, const char* shorty);
@@ -428,11 +427,11 @@
const CompiledInvokeStub* compiled_invoke_stub = FindInvokeStub(is_static, shorty);
if (compiled_invoke_stub == NULL) {
if (instruction_set_ == kX86) {
- compiled_invoke_stub = art::x86::X86CreateInvokeStub(is_static, shorty);
+ compiled_invoke_stub = ::art::x86::X86CreateInvokeStub(is_static, shorty);
} else {
CHECK(instruction_set_ == kArm || instruction_set_ == kThumb2);
// Generates invocation stub using ARM instruction set
- compiled_invoke_stub = art::arm::ArmCreateInvokeStub(is_static, shorty);
+ compiled_invoke_stub = ::art::arm::ArmCreateInvokeStub(is_static, shorty);
}
CHECK(compiled_invoke_stub != NULL);
InsertInvokeStub(is_static, shorty, compiled_invoke_stub);
diff --git a/src/compiler/Compiler.h b/src/compiler/Compiler.h
index 224ea6e..ac5e0c9 100644
--- a/src/compiler/Compiler.h
+++ b/src/compiler/Compiler.h
@@ -19,6 +19,8 @@
#include "dex_file.h"
+namespace art {
+
#define COMPILER_TRACED(X)
#define COMPILER_TRACEE(X)
@@ -103,8 +105,8 @@
bool oatStartup(void);
void oatShutdown(void);
CompiledMethod* oatCompileMethod(const Compiler& compiler, bool is_direct,
- uint32_t method_idx, const art::ClassLoader* class_loader,
- const art::DexFile& dex_file, OatInstructionSetType);
+ uint32_t method_idx, const ClassLoader* class_loader,
+ const DexFile& dex_file, OatInstructionSetType);
void oatDumpStats(void);
void oatScanAllClassPointers(void (*callback)(void* ptr));
void oatInitializeSSAConversion(struct CompilationUnit* cUnit);
@@ -135,4 +137,6 @@
void oatDumpCFG(struct CompilationUnit* cUnit, const char* dirPrefix);
void oatProcessSwitchTables(CompilationUnit* cUnit);
+} // namespace art
+
#endif // ART_SRC_COMPILER_COMPILER_H_
diff --git a/src/compiler/CompilerIR.h b/src/compiler/CompilerIR.h
index 2e89ab5..f981ccd 100644
--- a/src/compiler/CompilerIR.h
+++ b/src/compiler/CompilerIR.h
@@ -20,6 +20,8 @@
#include "codegen/Optimizer.h"
#include <vector>
+namespace art {
+
typedef enum RegisterClass {
kCoreReg,
kFPReg,
@@ -194,12 +196,12 @@
int numBlocks;
GrowableList blockList;
const Compiler* compiler; // Compiler driving this compiler
- art::ClassLinker* class_linker; // Linker to resolve fields and methods
- const art::DexFile* dex_file; // DexFile containing the method being compiled
- art::DexCache* dex_cache; // DexFile's corresponding cache
- const art::ClassLoader* class_loader; // compiling method's class loader
+ ClassLinker* class_linker; // Linker to resolve fields and methods
+ const DexFile* dex_file; // DexFile containing the method being compiled
+ DexCache* dex_cache; // DexFile's corresponding cache
+ const ClassLoader* class_loader; // compiling method's class loader
uint32_t method_idx; // compiling method's index into method_ids of DexFile
- const art::DexFile::CodeItem* code_item; // compiling method's DexFile code_item
+ const DexFile::CodeItem* code_item; // compiling method's DexFile code_item
uint32_t access_flags; // compiling method's access flags
const char* shorty; // compiling method's shorty
LIR* firstLIRInsn;
@@ -327,4 +329,6 @@
/* Debug Utilities */
void oatDumpCompilationUnit(CompilationUnit* cUnit);
+} // namespace art
+
#endif // ART_SRC_COMPILER_COMPILER_IR_H_
diff --git a/src/compiler/CompilerUtility.h b/src/compiler/CompilerUtility.h
index 0a7d079..d7612ff 100644
--- a/src/compiler/CompilerUtility.h
+++ b/src/compiler/CompilerUtility.h
@@ -19,6 +19,8 @@
#include "Dalvik.h"
+namespace art {
+
/* Each arena page has some overhead, so take a few bytes off */
#define ARENA_DEFAULT_SIZE ((256 * 1024) - 256)
@@ -112,4 +114,6 @@
const char* oatGetShortyFromTargetIdx(CompilationUnit*, int);
void oatDumpRegLocTable(struct RegLocation*, int);
+} // namespace art
+
#endif // ART_SRC_COMPILER_COMPILER_UTILITY_H_
diff --git a/src/compiler/Dalvik.h b/src/compiler/Dalvik.h
index 73a9d7a..4753910 100644
--- a/src/compiler/Dalvik.h
+++ b/src/compiler/Dalvik.h
@@ -55,17 +55,6 @@
#include "DexOpcodes.h"
#include "InstrUtils.h"
-typedef art::Array Array;
-typedef art::Class Class;
-typedef art::Compiler Compiler;
-typedef art::Field Field;
-typedef art::JValue JValue;
-typedef art::Method Method;
-typedef art::CompiledMethod CompiledMethod;
-typedef art::Object Object;
-typedef art::String String;
-typedef art::Thread Thread;
-
// use to switch visibility on DCHECK tracebacks
#if 1
#define STATIC
diff --git a/src/compiler/Dataflow.cc b/src/compiler/Dataflow.cc
index 54a1e15..211cffb 100644
--- a/src/compiler/Dataflow.cc
+++ b/src/compiler/Dataflow.cc
@@ -18,6 +18,8 @@
#include "Dataflow.h"
//#include "libdex/DexOpcodes.h"
+namespace art {
+
/*
* Main table containing data flow attributes for each bytecode. The
* first kNumPackedOpcodes entries are for Dalvik bytecode
@@ -1612,7 +1614,7 @@
if ((bb->blockType == kEntryBlock) | bb->catchEntry) {
oatClearAllBits(cUnit->tempSSARegisterV);
- if ((cUnit->access_flags & art::kAccStatic) == 0) {
+ if ((cUnit->access_flags & kAccStatic) == 0) {
// If non-static method, mark "this" as non-null
int thisReg = cUnit->numDalvikRegisters - cUnit->numIns;
oatSetBit(cUnit->tempSSARegisterV, thisReg);
@@ -1745,3 +1747,5 @@
true /* isIterative */);
}
}
+
+} // namespace art
diff --git a/src/compiler/Dataflow.h b/src/compiler/Dataflow.h
index 1696e44..e810e52 100644
--- a/src/compiler/Dataflow.h
+++ b/src/compiler/Dataflow.h
@@ -20,6 +20,8 @@
#include "Dalvik.h"
#include "CompilerInternals.h"
+namespace art {
+
typedef enum DataFlowAttributePos {
kUA = 0,
kUB,
@@ -151,4 +153,6 @@
void oatMethodNullCheckElimination(CompilationUnit*);
+} // namespace art
+
#endif // ART_SRC_COMPILER_DATAFLOW_H_
diff --git a/src/compiler/Frontend.cc b/src/compiler/Frontend.cc
index 5be51f4..8070e6f 100644
--- a/src/compiler/Frontend.cc
+++ b/src/compiler/Frontend.cc
@@ -22,6 +22,8 @@
#include "object.h"
#include "runtime.h"
+namespace art {
+
/* Default optimizer/debug setting for the compiler. */
uint32_t compilerOptimizerDisableFlags = 0 | // Disable specific optimizations
//(1 << kLoadStoreElimination) |
@@ -231,7 +233,7 @@
void oatDumpCFG(CompilationUnit* cUnit, const char* dirPrefix)
{
FILE* file;
- std::string name(art::PrettyMethod(cUnit->method_idx, *cUnit->dex_file));
+ std::string name(PrettyMethod(cUnit->method_idx, *cUnit->dex_file));
char startOffset[80];
sprintf(startOffset, "_%x", cUnit->entryBlock->fallThrough->startOffset);
char* fileName = (char*) oatNew(
@@ -432,7 +434,7 @@
/* Identify code range in try blocks and set up the empty catch blocks */
STATIC void processTryCatchBlocks(CompilationUnit* cUnit)
{
- const art::DexFile::CodeItem* code_item = cUnit->code_item;
+ const DexFile::CodeItem* code_item = cUnit->code_item;
int triesSize = code_item->tries_size_;
int offset;
@@ -443,8 +445,8 @@
ArenaBitVector* tryBlockAddr = cUnit->tryBlockAddr;
for (int i = 0; i < triesSize; i++) {
- const art::DexFile::TryItem* pTry =
- art::DexFile::GetTryItems(*code_item, i);
+ const DexFile::TryItem* pTry =
+ DexFile::GetTryItems(*code_item, i);
int startOffset = pTry->start_addr_;
int endOffset = startOffset + pTry->insn_count_;
for (offset = startOffset; offset < endOffset; offset++) {
@@ -453,11 +455,11 @@
}
// Iterate over each of the handlers to enqueue the empty Catch blocks
- const art::byte* handlers_ptr =
- art::DexFile::GetCatchHandlerData(*code_item, 0);
- uint32_t handlers_size = art::DecodeUnsignedLeb128(&handlers_ptr);
+ const byte* handlers_ptr =
+ DexFile::GetCatchHandlerData(*code_item, 0);
+ uint32_t handlers_size = DecodeUnsignedLeb128(&handlers_ptr);
for (uint32_t idx = 0; idx < handlers_size; idx++) {
- art::CatchHandlerIterator iterator(handlers_ptr);
+ CatchHandlerIterator iterator(handlers_ptr);
for (; iterator.HasNext(); iterator.Next()) {
uint32_t address = iterator.GetHandlerAddress();
findBlock(cUnit, address, false /* split */, true /*create*/,
@@ -639,11 +641,11 @@
ArenaBitVector* tryBlockAddr, const u2* codePtr,
const u2* codeEnd)
{
- const art::DexFile::CodeItem* code_item = cUnit->code_item;
+ const DexFile::CodeItem* code_item = cUnit->code_item;
/* In try block */
if (oatIsBitSet(tryBlockAddr, curOffset)) {
- art::CatchHandlerIterator iterator(*code_item, curOffset);
+ CatchHandlerIterator iterator(*code_item, curOffset);
if (curBlock->successorBlockList.blockListType != kNotUsed) {
LOG(FATAL) << "Successor block list already in use: " <<
@@ -712,10 +714,10 @@
/*
* Compile a method.
*/
-CompiledMethod* oatCompileMethod(const Compiler& compiler, const art::DexFile::CodeItem* code_item,
+CompiledMethod* oatCompileMethod(const Compiler& compiler, const DexFile::CodeItem* code_item,
uint32_t access_flags, uint32_t method_idx,
- const art::ClassLoader* class_loader,
- const art::DexFile& dex_file, art::InstructionSet insnSet)
+ const ClassLoader* class_loader,
+ const DexFile& dex_file, InstructionSet insnSet)
{
VLOG(compiler) << "Compiling " << PrettyMethod(method_idx, dex_file) << "...";
oatArenaReset();
@@ -727,7 +729,7 @@
oatInit(compiler);
- art::ClassLinker* class_linker = art::Runtime::Current()->GetClassLinker();
+ ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
UniquePtr<CompilationUnit> cUnit(new CompilationUnit);
memset(cUnit.get(), 0, sizeof(*cUnit));
cUnit->compiler = &compiler;
@@ -935,7 +937,7 @@
+ __builtin_popcount(cUnit->fpSpillMask)));
DCHECK_GE(vmapTable.size(), 1U); // should always at least one INVALID_VREG for lr
- CompiledMethod* result = new CompiledMethod(art::kThumb2, cUnit->codeBuffer,
+ CompiledMethod* result = new CompiledMethod(kThumb2, cUnit->codeBuffer,
cUnit->frameSize, cUnit->coreSpillMask,
cUnit->fpSpillMask, cUnit->mappingTable,
vmapTable);
@@ -960,3 +962,5 @@
LOG(FATAL) << "Failed to initialize oat heap";
}
}
+
+} // namespace art
diff --git a/src/compiler/IntermediateRep.cc b/src/compiler/IntermediateRep.cc
index a7da037..c39aed3 100644
--- a/src/compiler/IntermediateRep.cc
+++ b/src/compiler/IntermediateRep.cc
@@ -17,6 +17,8 @@
#include "Dalvik.h"
#include "CompilerInternals.h"
+namespace art {
+
/* Allocate a new basic block */
BasicBlock* oatNewBB(BBType blockType, int blockId)
{
@@ -122,3 +124,5 @@
currentLIR->next = newLIR;
newLIR->next->prev = newLIR;
}
+
+} // namespace art
diff --git a/src/compiler/Ralloc.cc b/src/compiler/Ralloc.cc
index 4e90382..c6375ee 100644
--- a/src/compiler/Ralloc.cc
+++ b/src/compiler/Ralloc.cc
@@ -19,6 +19,8 @@
#include "Dataflow.h"
#include "codegen/Ralloc.h"
+namespace art {
+
STATIC bool setFp(CompilationUnit* cUnit, int index, bool isFP) {
bool change = false;
if (cUnit->regLocation[index].highWord) {
@@ -264,7 +266,7 @@
*/
if ((definedFP && definedCore) &&
((cUnit->disableOpt & (1 << kPromoteRegs)) == 0)) {
- LOG(WARNING) << art::PrettyMethod(cUnit->method_idx, *cUnit->dex_file)
+ LOG(WARNING) << PrettyMethod(cUnit->method_idx, *cUnit->dex_file)
<< " op at block " << bb->id
<< " has both fp and core uses for same def.";
cUnit->disableOpt |= (1 << kPromoteRegs);
@@ -329,7 +331,7 @@
int numIns = cUnit->numIns;
if (numIns > 0) {
int sReg = numRegs - numIns;
- if ((cUnit->access_flags & art::kAccStatic) == 0) {
+ if ((cUnit->access_flags & kAccStatic) == 0) {
// For non-static, skip past "this"
cUnit->regLocation[sReg].defined = true;
cUnit->regLocation[sReg].core = true;
@@ -411,3 +413,5 @@
cUnit->insOffset = cUnit->frameSize + 4;
cUnit->regsOffset = (cUnit->numOuts + cUnit->numPadding + 1) * 4;
}
+
+} // namespace art
diff --git a/src/compiler/SSATransformation.cc b/src/compiler/SSATransformation.cc
index 235521d..1f6a3b5 100644
--- a/src/compiler/SSATransformation.cc
+++ b/src/compiler/SSATransformation.cc
@@ -17,6 +17,8 @@
#include "Dalvik.h"
#include "Dataflow.h"
+namespace art {
+
/* Enter the node to the dfsOrder list then visit its successors */
STATIC void recordDFSPreOrder(CompilationUnit* cUnit, BasicBlock* block)
{
@@ -632,3 +634,5 @@
kReachableNodes,
false /* isIterative */);
}
+
+} // namespace art
diff --git a/src/compiler/Utility.cc b/src/compiler/Utility.cc
index d292494..8d70136 100644
--- a/src/compiler/Utility.cc
+++ b/src/compiler/Utility.cc
@@ -17,6 +17,8 @@
#include "Dalvik.h"
#include "CompilerInternals.h"
+namespace art {
+
static ArenaMemBlock *arenaHead, *currentArena;
static int numArenaBlocks;
@@ -163,7 +165,7 @@
"Catch Block"
};
- LOG(INFO) << "Compiling " << art::PrettyMethod(cUnit->method_idx, *cUnit->dex_file);
+ LOG(INFO) << "Compiling " << PrettyMethod(cUnit->method_idx, *cUnit->dex_file);
LOG(INFO) << cUnit->insns << " insns";
LOG(INFO) << cUnit->numBlocks << " blocks in total";
GrowableListIterator iterator;
@@ -530,6 +532,8 @@
const char* oatGetShortyFromTargetIdx(CompilationUnit *cUnit, int targetIdx)
{
- const art::DexFile::MethodId& methodId = cUnit->dex_file->GetMethodId(targetIdx);
+ const DexFile::MethodId& methodId = cUnit->dex_file->GetMethodId(targetIdx);
return cUnit->dex_file->GetShorty(methodId.proto_idx_);
}
+
+} // namespace art
diff --git a/src/compiler/codegen/CodegenFactory.cc b/src/compiler/codegen/CodegenFactory.cc
index 5dbcd97..4b2fd4a 100644
--- a/src/compiler/codegen/CodegenFactory.cc
+++ b/src/compiler/codegen/CodegenFactory.cc
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+namespace art {
+
/*
* This file contains target-independent codegen and support, and is
* included by:
@@ -235,3 +237,5 @@
oatMarkDefWide(cUnit, rlDest, defStart, defEnd);
}
}
+
+} // namespace art
diff --git a/src/compiler/codegen/CompilerCodegen.h b/src/compiler/codegen/CompilerCodegen.h
index d2e5f0a..f1ca07a 100644
--- a/src/compiler/codegen/CompilerCodegen.h
+++ b/src/compiler/codegen/CompilerCodegen.h
@@ -19,6 +19,8 @@
#include "../CompilerIR.h"
+namespace art {
+
/* Lower middle-level IR to low-level IR for the whole method */
void oatMethodMIR2LIR(CompilationUnit* cUnit);
@@ -51,4 +53,6 @@
/* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */
void oatGenMemBarrier(CompilationUnit* cUnit, int barrierKind);
+} // namespace art
+
#endif // ART_SRC_COMPILER_COMPILERCODEGEN_H_
diff --git a/src/compiler/codegen/Optimizer.h b/src/compiler/codegen/Optimizer.h
index 307d401..74a5b75 100644
--- a/src/compiler/codegen/Optimizer.h
+++ b/src/compiler/codegen/Optimizer.h
@@ -19,6 +19,8 @@
#include "../Dalvik.h"
+namespace art {
+
#define STACK_ALIGN_WORDS 4
#define STACK_ALIGNMENT (STACK_ALIGN_WORDS * 4)
@@ -29,4 +31,6 @@
void oatApplyLocalOptimizations(struct CompilationUnit* cUnit,
struct LIR* head, struct LIR* tail);
+} // namespace art
+
#endif // ART_SRC_COMPILER_COMPILER_OPTIMIZATION_H_
diff --git a/src/compiler/codegen/Ralloc.h b/src/compiler/codegen/Ralloc.h
index fee0e9a..e72cdcb 100644
--- a/src/compiler/codegen/Ralloc.h
+++ b/src/compiler/codegen/Ralloc.h
@@ -16,6 +16,7 @@
#ifndef ART_SRC_COMPILER_RALLOC_H_
#define ART_SRC_COMPILER_RALLOC_H_
+
/*
* This file contains target independent register alloction support.
*/
@@ -25,6 +26,8 @@
#include "../Dataflow.h"
#include "arm/ArmLIR.h"
+namespace art {
+
/*
* Return most flexible allowed register class based on size.
* Bug: 2813841
@@ -237,4 +240,7 @@
extern void oatDumpFPRegPool(CompilationUnit* cUint);
extern bool oatCheckCorePoolSanity(CompilationUnit* cUnit);
extern RegisterInfo* oatGetRegInfo(CompilationUnit* cUnit, int reg);
+
+} // namespace art
+
#endif // ART_SRC_COMPILER_RALLOC_H_
diff --git a/src/compiler/codegen/RallocUtil.cc b/src/compiler/codegen/RallocUtil.cc
index 3fe3b3a..7dcb95b 100644
--- a/src/compiler/codegen/RallocUtil.cc
+++ b/src/compiler/codegen/RallocUtil.cc
@@ -27,6 +27,8 @@
#include "../Dataflow.h"
#include "Ralloc.h"
+namespace art {
+
#define SREG(c, s) ((c)->regLocation[(s)].sRegLow)
/*
* Get the "real" sreg number associated with an sReg slot. In general,
@@ -1080,3 +1082,5 @@
DCHECK(res.wide);
return res;
}
+
+} // namespace art
diff --git a/src/compiler/codegen/arm/ArchFactory.cc b/src/compiler/codegen/arm/ArchFactory.cc
index a68727f..14758b8 100644
--- a/src/compiler/codegen/arm/ArchFactory.cc
+++ b/src/compiler/codegen/arm/ArchFactory.cc
@@ -22,6 +22,8 @@
*
*/
+namespace art {
+
STATIC ArmLIR* genUnconditionalBranch(CompilationUnit*, ArmLIR*);
STATIC ArmLIR* genConditionalBranch(CompilationUnit*, ArmConditionCode,
ArmLIR*);
@@ -110,3 +112,5 @@
oatInsertGrowableList(&cUnit->throwLaunchpads, (intptr_t)tgt);
return branch;
}
+
+} // namespace art
diff --git a/src/compiler/codegen/arm/ArchUtility.cc b/src/compiler/codegen/arm/ArchUtility.cc
index 5e8fa20..c9a30fd 100644
--- a/src/compiler/codegen/arm/ArchUtility.cc
+++ b/src/compiler/codegen/arm/ArchUtility.cc
@@ -20,6 +20,8 @@
#include <string>
+namespace art {
+
static const char* coreRegNames[16] = {
"r0",
"r1",
@@ -309,7 +311,7 @@
switch(lir->opcode) {
case kArmPseudoMethodEntry:
LOG(INFO) << "-------- method entry " <<
- art::PrettyMethod(cUnit->method_idx, *cUnit->dex_file);
+ PrettyMethod(cUnit->method_idx, *cUnit->dex_file);
break;
case kArmPseudoMethodExit:
LOG(INFO) << "-------- Method_Exit";
@@ -413,7 +415,7 @@
{
LOG(INFO) << "/*";
LOG(INFO) << "Dumping LIR insns for "
- << art::PrettyMethod(cUnit->method_idx, *cUnit->dex_file);
+ << PrettyMethod(cUnit->method_idx, *cUnit->dex_file);
LIR* lirInsn;
ArmLIR* armLIR;
int insnsSize = cUnit->insnsSize;
@@ -447,7 +449,7 @@
armLIR->generic.offset, armLIR->generic.offset, armLIR->operands[0]);
}
- const art::DexFile::MethodId& method_id =
+ const DexFile::MethodId& method_id =
cUnit->dex_file->GetMethodId(cUnit->method_idx);
std::string signature(cUnit->dex_file->GetMethodSignature(method_id));
std::string name(cUnit->dex_file->GetMethodName(method_id));
@@ -467,3 +469,5 @@
LOG(INFO) <<" };\n\n";
}
}
+
+} // namespace art
diff --git a/src/compiler/codegen/arm/ArmLIR.h b/src/compiler/codegen/arm/ArmLIR.h
index 729e708..e77bed3 100644
--- a/src/compiler/codegen/arm/ArmLIR.h
+++ b/src/compiler/codegen/arm/ArmLIR.h
@@ -20,6 +20,8 @@
#include "../../Dalvik.h"
#include "../../CompilerInternals.h"
+namespace art {
+
// Set to 1 to measure cost of suspend check
#define NO_SUSPEND 0
@@ -882,4 +884,6 @@
#define CHAIN_CELL_NORMAL_SIZE 12
#define CHAIN_CELL_PREDICTED_SIZE 16
+} // namespace art
+
#endif // ART_SRC_COMPILER_CODEGEN_ARM_ARMLIR_H_
diff --git a/src/compiler/codegen/arm/ArmRallocUtil.cc b/src/compiler/codegen/arm/ArmRallocUtil.cc
index 60a5f38..a193a7c 100644
--- a/src/compiler/codegen/arm/ArmRallocUtil.cc
+++ b/src/compiler/codegen/arm/ArmRallocUtil.cc
@@ -15,7 +15,7 @@
*/
/*
- * This file contains Arm-specific register alloction support.
+ * This file contains Arm-specific register allocation support.
*/
#include "../../CompilerUtility.h"
@@ -25,6 +25,8 @@
#include "Codegen.h"
#include "../Ralloc.h"
+namespace art {
+
/*
* Placeholder routine until we do proper register allocation.
*/
@@ -263,7 +265,7 @@
/* Return sp-relative offset in bytes using Method* */
-extern int oatVRegOffset(const art::DexFile::CodeItem* code_item,
+extern int oatVRegOffset(const DexFile::CodeItem* code_item,
uint32_t core_spills, uint32_t fp_spills,
size_t frame_size, int reg)
{
@@ -337,3 +339,5 @@
return FPREG(reg) ? &cUnit->regPool->FPRegs[reg & FP_REG_MASK]
: &cUnit->regPool->coreRegs[reg];
}
+
+} // namespace art
diff --git a/src/compiler/codegen/arm/Assemble.cc b/src/compiler/codegen/arm/Assemble.cc
index a73a27a..83c7a6c 100644
--- a/src/compiler/codegen/arm/Assemble.cc
+++ b/src/compiler/codegen/arm/Assemble.cc
@@ -20,6 +20,8 @@
#include "Codegen.h"
#include <sys/mman.h> /* for protection change */
+namespace art {
+
#define MAX_ASSEMBLER_RETRIES 50
/*
@@ -1594,3 +1596,5 @@
*/
createMappingTable(cUnit);
}
+
+} // namespace art
diff --git a/src/compiler/codegen/arm/Codegen.h b/src/compiler/codegen/arm/Codegen.h
index 24e2b3e..8d3c425 100644
--- a/src/compiler/codegen/arm/Codegen.h
+++ b/src/compiler/codegen/arm/Codegen.h
@@ -24,6 +24,8 @@
#include "../../CompilerIR.h"
+namespace art {
+
#if defined(_CODEGEN_C)
/*
* loadConstant() sometimes needs to add a small imm to a pre-existing constant
@@ -50,3 +52,5 @@
extern ArmLIR* oatRegCopyNoInsert(CompilationUnit* cUnit, int rDest,
int rSrc);
+
+} // namespace art
diff --git a/src/compiler/codegen/arm/CodegenCommon.cc b/src/compiler/codegen/arm/CodegenCommon.cc
index 9b71b14..26c17ef 100644
--- a/src/compiler/codegen/arm/CodegenCommon.cc
+++ b/src/compiler/codegen/arm/CodegenCommon.cc
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+namespace art {
+
/*
* This file contains codegen and support common to all supported
* ARM variants. It is included by:
@@ -399,3 +401,5 @@
/* Mark all resources as being clobbered */
barrier->defMask = -1;
}
+
+} // namespace art
diff --git a/src/compiler/codegen/arm/FP/Thumb2VFP.cc b/src/compiler/codegen/arm/FP/Thumb2VFP.cc
index 60cb476..494e09f 100644
--- a/src/compiler/codegen/arm/FP/Thumb2VFP.cc
+++ b/src/compiler/codegen/arm/FP/Thumb2VFP.cc
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+namespace art {
+
STATIC bool genArithOpFloat(CompilationUnit* cUnit, MIR* mir,
RegLocation rlDest, RegLocation rlSrc1,
RegLocation rlSrc2)
@@ -240,3 +242,5 @@
storeValue(cUnit, rlDest, rlResult);
return false;
}
+
+} // namespace art
diff --git a/src/compiler/codegen/arm/LocalOptimizations.cc b/src/compiler/codegen/arm/LocalOptimizations.cc
index b2bc333..eba701b 100644
--- a/src/compiler/codegen/arm/LocalOptimizations.cc
+++ b/src/compiler/codegen/arm/LocalOptimizations.cc
@@ -19,6 +19,8 @@
#include "ArmLIR.h"
#include "Codegen.h"
+namespace art {
+
#define DEBUG_OPT(X)
/* Check RAW, WAR, and WAR dependency on the register operands */
@@ -446,3 +448,5 @@
applyLoadHoisting(cUnit, (ArmLIR* ) headLIR, (ArmLIR* ) tailLIR);
}
}
+
+} // namespace art
diff --git a/src/compiler/codegen/arm/MethodCodegenDriver.cc b/src/compiler/codegen/arm/MethodCodegenDriver.cc
index 7ad974c..77b58ff 100644
--- a/src/compiler/codegen/arm/MethodCodegenDriver.cc
+++ b/src/compiler/codegen/arm/MethodCodegenDriver.cc
@@ -16,6 +16,8 @@
#include "object_utils.h"
+namespace art {
+
#define DISPLAY_MISSING_TARGETS (cUnit->enableDebug & \
(1 << kDebugDisplayMissingTargets))
@@ -182,7 +184,7 @@
}
return NULL;
}
- const art::DexFile::FieldId& field_id = cUnit->dex_file->GetFieldId(fieldIdx);
+ const DexFile::FieldId& field_id = cUnit->dex_file->GetFieldId(fieldIdx);
int type_idx = field_id.class_idx_;
Class* klass = cUnit->dex_cache->GetResolvedTypes()->Get(type_idx);
// Check if storage class is the same as class referred to by type idx.
@@ -194,13 +196,13 @@
// See if we can find a dex reference for the storage class.
// we may not if the dex file never references the super class,
// but usually it will.
- std::string descriptor(art::FieldHelper(field).GetDeclaringClassDescriptor());
- const art::DexFile::StringId* string_id =
+ std::string descriptor(FieldHelper(field).GetDeclaringClassDescriptor());
+ const DexFile::StringId* string_id =
cUnit->dex_file->FindStringId(descriptor);
if (string_id == NULL) {
return NULL; // descriptor not found, resort to slow path
}
- const art::DexFile::TypeId* type_id =
+ const DexFile::TypeId* type_id =
cUnit->dex_file->FindTypeId(cUnit->dex_file->GetIndexForStringId(*string_id));
if (type_id == NULL) {
return NULL; // type id not found, resort to slow path
@@ -239,7 +241,7 @@
loadWordDisp(cUnit, rMethod,
Method::DexCacheInitializedStaticStorageOffset().Int32Value(),
rBase);
- loadWordDisp(cUnit, rBase, art::Array::DataOffset().Int32Value() +
+ loadWordDisp(cUnit, rBase, Array::DataOffset().Int32Value() +
sizeof(int32_t*)* typeIdx, rBase);
// TUNING: fast path should fall through
// TUNING: Try a conditional skip here, might be faster
@@ -301,7 +303,7 @@
loadWordDisp(cUnit, rMethod,
Method::DexCacheInitializedStaticStorageOffset().Int32Value(),
rBase);
- loadWordDisp(cUnit, rBase, art::Array::DataOffset().Int32Value() +
+ loadWordDisp(cUnit, rBase, Array::DataOffset().Int32Value() +
sizeof(int32_t*)* typeIdx, rBase);
// TUNING: fast path should fall through
ArmLIR* branchOver = genCmpImmBranch(cUnit, kArmCondNe, rBase, 0);
@@ -353,7 +355,7 @@
loadWordDisp(cUnit, rMethod,
Method::DexCacheInitializedStaticStorageOffset().Int32Value(),
rBase);
- loadWordDisp(cUnit, rBase, art::Array::DataOffset().Int32Value() +
+ loadWordDisp(cUnit, rBase, Array::DataOffset().Int32Value() +
sizeof(int32_t*)* typeIdx, rBase);
// TUNING: fast path should fall through
ArmLIR* branchOver = genCmpImmBranch(cUnit, kArmCondNe, rBase, 0);
@@ -405,7 +407,7 @@
loadWordDisp(cUnit, rMethod,
Method::DexCacheInitializedStaticStorageOffset().Int32Value(),
rBase);
- loadWordDisp(cUnit, rBase, art::Array::DataOffset().Int32Value() +
+ loadWordDisp(cUnit, rBase, Array::DataOffset().Int32Value() +
sizeof(int32_t*)* typeIdx, rBase);
// TUNING: fast path should fall through
ArmLIR* branchOver = genCmpImmBranch(cUnit, kArmCondNe, rBase, 0);
@@ -453,9 +455,9 @@
break;
case 2: // Grab target method* and target code_
loadWordDisp(cUnit, r0,
- art::CodeAndDirectMethods::CodeOffsetInBytes(idx), rLR);
+ CodeAndDirectMethods::CodeOffsetInBytes(idx), rLR);
loadWordDisp(cUnit, r0,
- art::CodeAndDirectMethods::MethodOffsetInBytes(idx), r0);
+ CodeAndDirectMethods::MethodOffsetInBytes(idx), r0);
break;
default:
return -1;
@@ -502,7 +504,7 @@
break;
case 3: // Get target method [use rLR, set r0]
loadWordDisp(cUnit, rLR, (target_idx * 4) +
- art::Array::DataOffset().Int32Value(), r0);
+ Array::DataOffset().Int32Value(), r0);
break;
case 4: // Get the target compiled code address [uses r0, sets rLR]
loadWordDisp(cUnit, r0, Method::GetCodeOffset().Int32Value(), rLR);
@@ -537,7 +539,7 @@
break;
case 2: // method->dex_cache_resolved_methods_->Get(method_idx)
loadWordDisp(cUnit, rLR, (dInsn->vB * 4) +
- art::Array::DataOffset().Int32Value(), rLR);
+ Array::DataOffset().Int32Value(), rLR);
break;
case 3: // Resolved?
skipBranch = genCmpImmBranch(cUnit, kArmCondNe, rLR, 0);
@@ -569,10 +571,10 @@
case 5:
// get this->klass_->vtable_ [usr rLR, set rLR]
loadWordDisp(cUnit, rLR, Class::VTableOffset().Int32Value(), rLR);
- DCHECK_EQ((art::Array::DataOffset().Int32Value() & 0x3), 0);
+ DCHECK_EQ((Array::DataOffset().Int32Value() & 0x3), 0);
// In load shadow fold vtable_ object header size into method_index_
opRegImm(cUnit, kOpAdd, r0,
- art::Array::DataOffset().Int32Value() / 4);
+ Array::DataOffset().Int32Value() / 4);
// Get target Method*
loadBaseIndexed(cUnit, rLR, r0, r0, 2, kWord);
break;
@@ -648,7 +650,7 @@
* that the check to verify that the target method index falls
* within the size of the super's vtable has been done at compile-time.
*/
- art::ClassLinker* class_linker = art::Runtime::Current()->GetClassLinker();
+ ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
Method* baseMethod = class_linker->ResolveMethod(*cUnit->dex_file,
dInsn->vB,
cUnit->dex_cache,
@@ -685,7 +687,7 @@
break;
case 3: // Get target method [use rLR, set r0]
loadWordDisp(cUnit, rLR, (target_idx * 4) +
- art::Array::DataOffset().Int32Value(), r0);
+ Array::DataOffset().Int32Value(), r0);
break;
case 4: // Get the target compiled code address [uses r0, sets rLR]
loadWordDisp(cUnit, r0, Method::GetCodeOffset().Int32Value(), rLR);
@@ -722,7 +724,7 @@
break;
case 2: // method->dex_cache_resolved_methods_->Get(meth_idx) [u/s rLR]
loadWordDisp(cUnit, rLR, (dInsn->vB * 4) +
- art::Array::DataOffset().Int32Value(), rLR);
+ Array::DataOffset().Int32Value(), rLR);
break;
case 3: // Resolved?
skipBranch = genCmpImmBranch(cUnit, kArmCondNe, rLR, 0);
@@ -757,14 +759,14 @@
if (!(mir->optimizationFlags & MIR_IGNORE_RANGE_CHECK)) {
// Range check, throw NSM on failure
tReg = oatAllocTemp(cUnit);
- loadWordDisp(cUnit, r0, art::Array::LengthOffset().Int32Value(),
+ loadWordDisp(cUnit, r0, Array::LengthOffset().Int32Value(),
tReg);
genRegRegCheck(cUnit, kArmCondCs, rLR, tReg, mir,
kArmThrowNoSuchMethod);
oatFreeTemp(cUnit, tReg);
}
// Adjust vtable_ base past object header
- opRegImm(cUnit, kOpAdd, r0, art::Array::DataOffset().Int32Value());
+ opRegImm(cUnit, kOpAdd, r0, Array::DataOffset().Int32Value());
// Get target Method*
loadBaseIndexed(cUnit, r0, rLR, r0, 2, kWord);
break;
@@ -1068,7 +1070,7 @@
DecodedInstruction* dInsn = &mir->dalvikInsn;
int callState = 0;
ArmLIR* rollback;
- art::ClassLinker* class_linker = art::Runtime::Current()->GetClassLinker();
+ ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
Method* baseMethod = class_linker->ResolveMethod(*cUnit->dex_file,
dInsn->vB,
cUnit->dex_cache,
@@ -1143,7 +1145,7 @@
DecodedInstruction* dInsn = &mir->dalvikInsn;
int callState = 0;
ArmLIR* rollback;
- art::ClassLinker* class_linker = art::Runtime::Current()->GetClassLinker();
+ ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
Method* method = class_linker->ResolveMethod(*cUnit->dex_file,
dInsn->vB,
cUnit->dex_cache,
@@ -1966,12 +1968,12 @@
*/
bool skipOverflowCheck = ((cUnit->attrs & METHOD_IS_LEAF) &&
((size_t)cUnit->frameSize <
- art::Thread::kStackOverflowReservedBytes));
+ Thread::kStackOverflowReservedBytes));
newLIR0(cUnit, kArmPseudoMethodEntry);
if (!skipOverflowCheck) {
/* Load stack limit */
loadWordDisp(cUnit, rSELF,
- art::Thread::StackEndOffset().Int32Value(), r12);
+ Thread::StackEndOffset().Int32Value(), r12);
}
/* Spill core callee saves */
newLIR1(cUnit, kThumb2Push, cUnit->coreSpillMask);
@@ -2148,7 +2150,7 @@
loadWordDisp(cUnit, rSELF,
OFFSETOF_MEMBER(Thread, pTestSuspendFromCode), rLR);
loadWordDisp(cUnit, rSELF,
- art::Thread::SuspendCountOffset().Int32Value(), rSUSPEND);
+ Thread::SuspendCountOffset().Int32Value(), rSUSPEND);
opReg(cUnit, kOpBlx, rLR);
genUnconditionalBranch(cUnit, resumeLab);
}
@@ -2289,3 +2291,5 @@
{
storeBaseDispWide(cUnit, rBase, displacement, rSrcLo, rSrcHi);
}
+
+} // namespace art
diff --git a/src/compiler/codegen/arm/Thumb2/Factory.cc b/src/compiler/codegen/arm/Thumb2/Factory.cc
index 1ea565a..ebc30f8 100644
--- a/src/compiler/codegen/arm/Thumb2/Factory.cc
+++ b/src/compiler/codegen/arm/Thumb2/Factory.cc
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+namespace art {
+
/*
* This file contains codegen for the Thumb ISA and is intended to be
* includes by:
@@ -1156,3 +1158,5 @@
}
}
}
+
+} // namespace art
diff --git a/src/compiler/codegen/arm/Thumb2/Gen.cc b/src/compiler/codegen/arm/Thumb2/Gen.cc
index 0afbe41..9c4ef1e 100644
--- a/src/compiler/codegen/arm/Thumb2/Gen.cc
+++ b/src/compiler/codegen/arm/Thumb2/Gen.cc
@@ -33,14 +33,16 @@
#define EXERCISE_RESOLVE_METHOD (cUnit->enableDebug & \
(1 << kDebugExerciseResolveMethod))
+namespace art {
+
STATIC RegLocation getRetLoc(CompilationUnit* cUnit);
void warnIfUnresolved(CompilationUnit* cUnit, int fieldIdx, Field* field) {
if (field == NULL) {
- const art::DexFile::FieldId& field_id = cUnit->dex_file->GetFieldId(fieldIdx);
+ const DexFile::FieldId& field_id = cUnit->dex_file->GetFieldId(fieldIdx);
std::string class_name(cUnit->dex_file->GetFieldDeclaringClassDescriptor(field_id));
std::string field_name(cUnit->dex_file->GetFieldName(field_id));
- LOG(INFO) << "Field " << art::PrettyDescriptor(class_name) << "." << field_name
+ LOG(INFO) << "Field " << PrettyDescriptor(class_name) << "." << field_name
<< " unresolved at compile time";
} else {
// We also use the slow path for wide volatile fields.
@@ -419,7 +421,7 @@
loadCurrMethodDirect(cUnit, r1); // arg1 <= Method*
loadWordDisp(cUnit, r1,
Method::DexCacheResolvedFieldsOffset().Int32Value(), r0);
- loadWordDisp(cUnit, r0, art::Array::DataOffset().Int32Value() +
+ loadWordDisp(cUnit, r0, Array::DataOffset().Int32Value() +
sizeof(int32_t*)* fieldIdx, r0);
/*
* For testing, omit the test for run-time resolution. This will
@@ -443,7 +445,7 @@
oatFreeTemp(cUnit, r1);
oatFreeTemp(cUnit, r2);
oatFreeTemp(cUnit, r3);
- loadWordDisp(cUnit, r0, art::Field::OffsetOffset().Int32Value(), r0);
+ loadWordDisp(cUnit, r0, Field::OffsetOffset().Int32Value(), r0);
}
STATIC void genIGet(CompilationUnit* cUnit, MIR* mir, OpSize size,
@@ -2108,3 +2110,5 @@
LOG(INFO) << "dalvik.vm.oat.op = " << buf;
}
}
+
+} // namespace art
diff --git a/src/compiler/codegen/arm/Thumb2/Ralloc.cc b/src/compiler/codegen/arm/Thumb2/Ralloc.cc
index 63d2430..59c1aa6 100644
--- a/src/compiler/codegen/arm/Thumb2/Ralloc.cc
+++ b/src/compiler/codegen/arm/Thumb2/Ralloc.cc
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+namespace art {
+
/*
* This file contains codegen for the Thumb ISA and is intended to be
* includes by:
@@ -49,3 +51,5 @@
return oatAllocTempFloat(cUnit);
return oatAllocTemp(cUnit);
}
+
+} // namespace art
diff --git a/src/compiler/codegen/arm/armv7-a-neon/ArchVariant.cc b/src/compiler/codegen/arm/armv7-a-neon/ArchVariant.cc
index ee56369..eafe5ed 100644
--- a/src/compiler/codegen/arm/armv7-a-neon/ArchVariant.cc
+++ b/src/compiler/codegen/arm/armv7-a-neon/ArchVariant.cc
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+namespace art {
+
/*
* Determine the initial instruction set to be used for this trace.
* Later components may decide to change this.
@@ -49,3 +51,5 @@
dmb->defMask = ENCODE_ALL;
#endif
}
+
+} // namespace art
diff --git a/src/compiler/codegen/arm/armv7-a/ArchVariant.cc b/src/compiler/codegen/arm/armv7-a/ArchVariant.cc
index 609d73b..eafe5ed 100644
--- a/src/compiler/codegen/arm/armv7-a/ArchVariant.cc
+++ b/src/compiler/codegen/arm/armv7-a/ArchVariant.cc
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+namespace art {
/*
* Determine the initial instruction set to be used for this trace.
@@ -50,3 +51,5 @@
dmb->defMask = ENCODE_ALL;
#endif
}
+
+} // namespace art
diff --git a/src/dex_file.cc b/src/dex_file.cc
index 381f7e0..8147834 100644
--- a/src/dex_file.cc
+++ b/src/dex_file.cc
@@ -544,7 +544,7 @@
}
-int32_t DexFile::GetLineNumFromPC(const art::Method* method, uint32_t rel_pc) const {
+int32_t DexFile::GetLineNumFromPC(const Method* method, uint32_t rel_pc) const {
// For native method, lineno should be -2 to indicate it is native. Note that
// "line number == -2" is how libcore tells from StackTraceElement.
if (method->GetCodeItemOffset() == 0) {
diff --git a/src/logging.cc b/src/logging.cc
index 4f1ae55..a4fa45b 100644
--- a/src/logging.cc
+++ b/src/logging.cc
@@ -24,8 +24,8 @@
LogVerbosity gLogVerbosity;
-art::Mutex& GetLoggingLock() {
- static art::Mutex lock("LogMessage lock");
+Mutex& GetLoggingLock() {
+ static Mutex lock("LogMessage lock");
return lock;
}
@@ -38,7 +38,7 @@
// Do the actual logging with the lock held.
{
- art::MutexLock mu(GetLoggingLock());
+ MutexLock mu(GetLoggingLock());
if (msg.find('\n') == std::string::npos) {
LogLine(msg.c_str());
} else {
@@ -55,7 +55,7 @@
// Abort if necessary.
if (data_->severity == FATAL) {
- art::Runtime::Abort(data_->file, data_->line_number);
+ Runtime::Abort(data_->file, data_->line_number);
}
delete data_;
diff --git a/src/mutex.cc b/src/mutex.cc
index 666c368..d41c6cb 100644
--- a/src/mutex.cc
+++ b/src/mutex.cc
@@ -99,7 +99,7 @@
}
pid_t Mutex::GetTid() {
- return art::GetTid();
+ return ::art::GetTid();
}
ConditionVariable::ConditionVariable(const std::string& name) : name_(name) {
diff --git a/src/oat_writer.cc b/src/oat_writer.cc
index 8b19727..f99bb03 100644
--- a/src/oat_writer.cc
+++ b/src/oat_writer.cc
@@ -97,7 +97,7 @@
}
CompiledClass* compiled_class =
- compiler_->GetCompiledClass(art::Compiler::MethodReference(dex_file, class_def_index));
+ compiler_->GetCompiledClass(Compiler::MethodReference(dex_file, class_def_index));
Class::Status status =
(compiled_class != NULL) ? compiled_class->GetStatus() : Class::kStatusNotReady;
@@ -199,7 +199,7 @@
uint32_t invoke_stub_offset = 0;
CompiledMethod* compiled_method =
- compiler_->GetCompiledMethod(art::Compiler::MethodReference(dex_file, method_idx));
+ compiler_->GetCompiledMethod(Compiler::MethodReference(dex_file, method_idx));
if (compiled_method != NULL) {
offset = compiled_method->AlignCode(offset);
DCHECK_ALIGNED(offset, kArmAlignment);
@@ -268,7 +268,7 @@
#ifndef NDEBUG
// We expect GC maps except when the class hasn't been verified or the method is native
CompiledClass* compiled_class =
- compiler_->GetCompiledClass(art::Compiler::MethodReference(dex_file, class_def_index));
+ compiler_->GetCompiledClass(Compiler::MethodReference(dex_file, class_def_index));
Class::Status status =
(compiled_class != NULL) ? compiled_class->GetStatus() : Class::kStatusNotReady;
CHECK(gc_map_size != 0 || is_native || status < Class::kStatusVerified)
@@ -483,7 +483,7 @@
size_t class_def_method_index, bool is_static,
uint32_t method_idx, const DexFile& dex_file) {
const CompiledMethod* compiled_method =
- compiler_->GetCompiledMethod(art::Compiler::MethodReference(&dex_file, method_idx));
+ compiler_->GetCompiledMethod(Compiler::MethodReference(&dex_file, method_idx));
uint32_t frame_size_in_bytes = 0;
uint32_t core_spill_mask = 0;
diff --git a/src/oatexec.cc b/src/oatexec.cc
index ad5b6d9..347cdf7 100644
--- a/src/oatexec.cc
+++ b/src/oatexec.cc
@@ -14,6 +14,8 @@
#include "toStringArray.h"
#include "object.h"
+namespace art {
+
// Determine whether or not the specified method is public.
static bool IsMethodPublic(JNIEnv* env, jclass clazz, jmethodID method_id) {
ScopedLocalRef<jobject> reflected(env, env->ToReflectedMethod(clazz, method_id, JNI_FALSE));
@@ -34,7 +36,7 @@
return false;
}
int modifiers = env->CallIntMethod(reflected.get(), get_modifiers);
- if ((modifiers & art::kAccPublic) == 0) {
+ if ((modifiers & kAccPublic) == 0) {
return false;
}
return true;
@@ -89,7 +91,7 @@
// Parse arguments. Most of it just gets passed through to the VM.
// The JNI spec defines a handful of standard arguments.
-int main(int argc, char** argv) {
+int oatexec(int argc, char** argv) {
setvbuf(stdout, NULL, _IONBF, 0);
// Skip over argv[0].
@@ -169,3 +171,9 @@
return rc;
}
+
+} // namespace art
+
+int main(int argc, char** argv) {
+ return art::oatexec(argc, argv);
+}
diff --git a/src/object.h b/src/object.h
index 7730974..24adce1 100644
--- a/src/object.h
+++ b/src/object.h
@@ -365,7 +365,7 @@
};
struct ObjectIdentityHash {
- size_t operator()(const art::Object* const& obj) const {
+ size_t operator()(const Object* const& obj) const {
#ifdef MOVING_GARBAGE_COLLECTOR
// TODO: we'll need to use the Object's internal concept of identity
UNIMPLEMENTED(FATAL);
@@ -2211,7 +2211,7 @@
};
struct StringHashCode {
- int32_t operator()(art::String* string) const {
+ int32_t operator()(String* string) const {
return string->GetHashCode();
}
};
diff --git a/src/stack.cc b/src/stack.cc
index 0232572..7da20b0 100644
--- a/src/stack.cc
+++ b/src/stack.cc
@@ -21,12 +21,12 @@
#include "object_utils.h"
#include "thread_list.h"
-int oatVRegOffset(const art::DexFile::CodeItem* code_item,
+namespace art {
+
+int oatVRegOffset(const DexFile::CodeItem* code_item,
uint32_t core_spills, uint32_t fp_spills,
size_t frame_size, int reg);
-namespace art {
-
bool Frame::HasMethod() const {
return GetMethod() != NULL && (!GetMethod()->IsCalleeSaveMethod());
}
@@ -62,7 +62,7 @@
uint32_t Frame::GetVReg(Method* m, int vreg) const {
DCHECK(m == GetMethod());
- const art::DexFile::CodeItem* code_item = MethodHelper(m).GetCodeItem();
+ const DexFile::CodeItem* code_item = MethodHelper(m).GetCodeItem();
DCHECK(code_item != NULL); // can't be NULL or how would we compile its instructions?
uint32_t core_spills = m->GetCoreSpillMask();
uint32_t fp_spills = m->GetFpSpillMask();
@@ -72,7 +72,7 @@
void Frame::SetVReg(Method* m, int vreg, uint32_t new_value) {
DCHECK(m == GetMethod());
- const art::DexFile::CodeItem* code_item = MethodHelper(m).GetCodeItem();
+ const DexFile::CodeItem* code_item = MethodHelper(m).GetCodeItem();
DCHECK(code_item != NULL); // can't be NULL or how would we compile its instructions?
uint32_t core_spills = m->GetCoreSpillMask();
uint32_t fp_spills = m->GetFpSpillMask();
diff --git a/src/stringpiece.cc b/src/stringpiece.cc
index 3779550..51f3980 100644
--- a/src/stringpiece.cc
+++ b/src/stringpiece.cc
@@ -18,7 +18,7 @@
namespace art {
-bool operator<(const art::StringPiece& x, const art::StringPiece& y) {
+bool operator<(const StringPiece& x, const StringPiece& y) {
const int r = memcmp(x.data(), y.data(),
std::min(x.size(), y.size()));
return ((r < 0) || ((r == 0) && (x.size() < y.size())));
@@ -90,7 +90,7 @@
const StringPiece::size_type StringPiece::npos = size_type(-1);
-std::ostream& operator<<(std::ostream& o, const art::StringPiece& piece) {
+std::ostream& operator<<(std::ostream& o, const StringPiece& piece) {
o.write(piece.data(), piece.size());
return o;
}
diff --git a/src/stringpiece.h b/src/stringpiece.h
index f61219f..e0f5ef6 100644
--- a/src/stringpiece.h
+++ b/src/stringpiece.h
@@ -154,7 +154,7 @@
// This large function is defined inline so that in a fairly common case where
// one of the arguments is a literal, the compiler can elide a lot of the
// following comparisons.
-inline bool operator==(const art::StringPiece& x, const art::StringPiece& y) {
+inline bool operator==(const StringPiece& x, const StringPiece& y) {
int len = x.size();
if (len != y.size()) {
return false;
@@ -180,29 +180,28 @@
return memcmp(p1, p2, len) == 0;
}
-inline bool operator!=(const art::StringPiece& x, const art::StringPiece& y) {
+inline bool operator!=(const StringPiece& x, const StringPiece& y) {
return !(x == y);
}
-bool operator<(const art::StringPiece& x, const art::StringPiece& y);
+bool operator<(const StringPiece& x, const StringPiece& y);
-inline bool operator>(const art::StringPiece& x, const art::StringPiece& y) {
+inline bool operator>(const StringPiece& x, const StringPiece& y) {
return y < x;
}
-inline bool operator<=(const art::StringPiece& x, const art::StringPiece& y) {
+inline bool operator<=(const StringPiece& x, const StringPiece& y) {
return !(x > y);
}
-inline bool operator>=(const art::StringPiece& x, const art::StringPiece& y) {
+inline bool operator>=(const StringPiece& x, const StringPiece& y) {
return !(x < y);
}
-extern std::ostream& operator<<(std::ostream& o, const art::StringPiece& piece);
+extern std::ostream& operator<<(std::ostream& o, const StringPiece& piece);
-// BEGIN android-added
struct StringPieceHash {
- size_t operator()(const art::StringPiece& string_piece) const {
+ size_t operator()(const StringPiece& string_piece) const {
size_t string_size = string_piece.size();
const char* string_data = string_piece.data();
// This is the java.lang.String hashcode for convenience, not interoperability.
@@ -213,7 +212,6 @@
return hash;
}
};
-// END android-added
} // namespace art
diff --git a/src/stringprintf.cc b/src/stringprintf.cc
index 8643c57..2a11437 100644
--- a/src/stringprintf.cc
+++ b/src/stringprintf.cc
@@ -4,6 +4,8 @@
#include <stdio.h>
+namespace art {
+
void StringAppendV(std::string* dst, const char* format, va_list ap) {
// First try with a small fixed size buffer
char space[1024];
@@ -61,3 +63,5 @@
StringAppendV(dst, format, ap);
va_end(ap);
}
+
+} // namespace art
diff --git a/src/stringprintf.h b/src/stringprintf.h
index 413fef5..19b006b 100644
--- a/src/stringprintf.h
+++ b/src/stringprintf.h
@@ -6,6 +6,8 @@
#include <stdarg.h>
#include <string>
+namespace art {
+
// Returns a string corresponding to printf-like formatting of the arguments.
std::string StringPrintf(const char* fmt, ...)
__attribute__((__format__(__printf__, 1, 2)));
@@ -17,4 +19,6 @@
// Appends a printf-like formatting of the arguments to 'dst'.
void StringAppendV(std::string* dst, const char* format, va_list ap);
+} // namespace art
+
#endif // STRINGPRINTF_H_
diff --git a/src/thread.cc b/src/thread.cc
index 8ffac18..189e1b9 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -1506,7 +1506,7 @@
const uint8_t* reg_bitmap = map.FindBitMap(m->ToDexPC(pc));
CHECK(reg_bitmap != NULL);
const VmapTable vmap_table(m->GetVmapTableRaw());
- const art::DexFile::CodeItem* code_item = MethodHelper(m).GetCodeItem();
+ const DexFile::CodeItem* code_item = MethodHelper(m).GetCodeItem();
DCHECK(code_item != NULL); // can't be NULL or how would we compile its instructions?
uint32_t core_spills = m->GetCoreSpillMask();
uint32_t fp_spills = m->GetFpSpillMask();
diff --git a/src/utils.cc b/src/utils.cc
index cc0a702..d4d2e3a 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -24,23 +24,22 @@
#include <sys/prctl.h>
#endif
-#if defined(__APPLE__)
-// Mac OS doesn't have gettid(2).
-pid_t gettid() { return getpid(); }
-#else
-// Neither bionic nor glibc exposes gettid(2).
-#define __KERNEL__
+#if defined(__linux__)
#include <linux/unistd.h>
-#ifdef _syscall0
-_syscall0(pid_t, gettid)
-#else
-pid_t gettid() { return syscall(__NR_gettid); }
-#endif
-#undef __KERNEL__
#endif
namespace art {
+pid_t GetTid() {
+#if defined(__APPLE__)
+ // Mac OS doesn't have gettid(2).
+ return getpid();
+#else
+ // Neither bionic nor glibc exposes gettid(2).
+ return syscall(__NR_gettid);
+#endif
+}
+
bool ReadFileToString(const std::string& file_name, std::string* result) {
UniquePtr<File> file(OS::OpenFile(file_name.c_str(), false));
if (file.get() == NULL) {
@@ -665,8 +664,4 @@
return (suffix == ".dex");
}
-pid_t GetTid() {
- return gettid();
-}
-
} // namespace art