Fix cpplint build/namespaces issues
Change-Id: I19c68703270c1482d6c6aad8cdf97d3d2924360a
diff --git a/Android.mk b/Android.mk
index 971eb2f..66eb095 100644
--- a/Android.mk
+++ b/Android.mk
@@ -334,7 +334,7 @@
.PHONY: cpplint-art
cpplint-art:
./art/tools/cpplint.py \
- --filter=-,+build/header_guard,+whitespace/braces,+whitespace/comma,+runtime/explicit,+whitespace/newline,+whitespace/parens \
+ --filter=-,+build/header_guard,+whitespace/braces,+whitespace/comma,+runtime/explicit,+whitespace/newline,+whitespace/parens,+build/namespaces \
$(shell find art -name *.h -o -name *$(ART_CPP_EXTENSION) | grep -v art/compiler/llvm/generated/)
# "mm cpplint-art-aspirational" to see warnings we would like to fix
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index 7fd1a7c..f395428 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -52,7 +52,14 @@
#include "UniquePtr.h"
#include "utils.h"
-using namespace art::mirror;
+using ::art::mirror::AbstractMethod;
+using ::art::mirror::Class;
+using ::art::mirror::DexCache;
+using ::art::mirror::EntryPointFromInterpreter;
+using ::art::mirror::Field;
+using ::art::mirror::Object;
+using ::art::mirror::ObjectArray;
+using ::art::mirror::String;
namespace art {
diff --git a/compiler/jni/portable/jni_compiler.cc b/compiler/jni/portable/jni_compiler.cc
index 57b8a31..0e58378 100644
--- a/compiler/jni/portable/jni_compiler.cc
+++ b/compiler/jni/portable/jni_compiler.cc
@@ -41,7 +41,13 @@
namespace art {
namespace llvm {
-using namespace runtime_support;
+using ::art::llvm::runtime_support::JniMethodEnd;
+using ::art::llvm::runtime_support::JniMethodEndSynchronized;
+using ::art::llvm::runtime_support::JniMethodEndWithReference;
+using ::art::llvm::runtime_support::JniMethodEndWithReferenceSynchronized;
+using ::art::llvm::runtime_support::JniMethodStart;
+using ::art::llvm::runtime_support::JniMethodStartSynchronized;
+using ::art::llvm::runtime_support::RuntimeId;
JniCompiler::JniCompiler(LlvmCompilationUnit* cunit,
const CompilerDriver& driver,
diff --git a/compiler/llvm/gbc_expander.cc b/compiler/llvm/gbc_expander.cc
index 94cc973..a2c6998 100644
--- a/compiler/llvm/gbc_expander.cc
+++ b/compiler/llvm/gbc_expander.cc
@@ -30,8 +30,6 @@
#include "dex/compiler_ir.h"
#include "dex/mir_graph.h"
#include "dex/quick/mir_to_lir.h"
-using art::kMIRIgnoreNullCheck;
-using art::kMIRIgnoreRangeCheck;
#include <llvm/ADT/STLExtras.h>
#include <llvm/IR/Intrinsics.h>
@@ -44,13 +42,78 @@
#include <map>
#include <utility>
-using namespace art::llvm;
-
-using art::llvm::IntrinsicHelper;
+using ::art::kMIRIgnoreNullCheck;
+using ::art::kMIRIgnoreRangeCheck;
+using ::art::llvm::IRBuilder;
+using ::art::llvm::IntrinsicHelper;
+using ::art::llvm::JType;
+using ::art::llvm::RuntimeSupportBuilder;
+using ::art::llvm::kBoolean;
+using ::art::llvm::kByte;
+using ::art::llvm::kChar;
+using ::art::llvm::kDouble;
+using ::art::llvm::kFloat;
+using ::art::llvm::kInt;
+using ::art::llvm::kLikely;
+using ::art::llvm::kLong;
+using ::art::llvm::kObject;
+using ::art::llvm::kShort;
+using ::art::llvm::kTBAAConstJObject;
+using ::art::llvm::kTBAAHeapArray;
+using ::art::llvm::kTBAAHeapInstance;
+using ::art::llvm::kTBAAHeapStatic;
+using ::art::llvm::kTBAARegister;
+using ::art::llvm::kTBAARuntimeInfo;
+using ::art::llvm::kTBAAShadowFrame;
+using ::art::llvm::kUnlikely;
+using ::art::llvm::kVoid;
+using ::art::llvm::runtime_support::AllocArray;
+using ::art::llvm::runtime_support::AllocArrayWithAccessCheck;
+using ::art::llvm::runtime_support::AllocObject;
+using ::art::llvm::runtime_support::AllocObjectWithAccessCheck;
+using ::art::llvm::runtime_support::CheckAndAllocArray;
+using ::art::llvm::runtime_support::CheckAndAllocArrayWithAccessCheck;
+using ::art::llvm::runtime_support::CheckCast;
+using ::art::llvm::runtime_support::CheckPutArrayElement;
+using ::art::llvm::runtime_support::FillArrayData;
+using ::art::llvm::runtime_support::FindCatchBlock;
+using ::art::llvm::runtime_support::FindDirectMethodWithAccessCheck;
+using ::art::llvm::runtime_support::FindInterfaceMethod;
+using ::art::llvm::runtime_support::FindInterfaceMethodWithAccessCheck;
+using ::art::llvm::runtime_support::FindStaticMethodWithAccessCheck;
+using ::art::llvm::runtime_support::FindSuperMethodWithAccessCheck;
+using ::art::llvm::runtime_support::FindVirtualMethodWithAccessCheck;
+using ::art::llvm::runtime_support::Get32Instance;
+using ::art::llvm::runtime_support::Get32Static;
+using ::art::llvm::runtime_support::Get64Instance;
+using ::art::llvm::runtime_support::Get64Static;
+using ::art::llvm::runtime_support::GetObjectInstance;
+using ::art::llvm::runtime_support::GetObjectStatic;
+using ::art::llvm::runtime_support::InitializeStaticStorage;
+using ::art::llvm::runtime_support::InitializeType;
+using ::art::llvm::runtime_support::InitializeTypeAndVerifyAccess;
+using ::art::llvm::runtime_support::IsAssignable;
+using ::art::llvm::runtime_support::ResolveString;
+using ::art::llvm::runtime_support::RuntimeId;
+using ::art::llvm::runtime_support::Set32Instance;
+using ::art::llvm::runtime_support::Set32Static;
+using ::art::llvm::runtime_support::Set64Instance;
+using ::art::llvm::runtime_support::Set64Static;
+using ::art::llvm::runtime_support::SetObjectInstance;
+using ::art::llvm::runtime_support::SetObjectStatic;
+using ::art::llvm::runtime_support::ThrowDivZeroException;
+using ::art::llvm::runtime_support::ThrowException;
+using ::art::llvm::runtime_support::ThrowIndexOutOfBounds;
+using ::art::llvm::runtime_support::ThrowNullPointerException;
+using ::art::llvm::runtime_support::ThrowStackOverflowException;
+using ::art::llvm::runtime_support::art_d2i;
+using ::art::llvm::runtime_support::art_d2l;
+using ::art::llvm::runtime_support::art_f2i;
+using ::art::llvm::runtime_support::art_f2l;
namespace art {
extern char RemapShorty(char shortyType);
-};
+} // namespace art
namespace {
@@ -101,8 +164,7 @@
// Helper function for GBC expansion
//----------------------------------------------------------------------------
- llvm::Value* ExpandToRuntime(runtime_support::RuntimeId rt,
- llvm::CallInst& inst);
+ llvm::Value* ExpandToRuntime(RuntimeId rt, llvm::CallInst& inst);
uint64_t LV2UInt(llvm::Value* lv) {
return llvm::cast<llvm::ConstantInt>(lv)->getZExtValue();
@@ -580,8 +642,7 @@
}
}
-llvm::Value* GBCExpanderPass::ExpandToRuntime(runtime_support::RuntimeId rt,
- llvm::CallInst& inst) {
+llvm::Value* GBCExpanderPass::ExpandToRuntime(RuntimeId rt, llvm::CallInst& inst) {
// Some GBC intrinsic can directly replace with IBC runtime. "Directly" means
// the arguments passed to the GBC intrinsic are as the same as IBC runtime
// function, therefore only called function is needed to change.
@@ -633,7 +694,7 @@
// If stack overflow, throw exception.
irb_.SetInsertPoint(block_exception);
- irb_.CreateCall(irb_.GetRuntime(runtime_support::ThrowStackOverflowException));
+ irb_.CreateCall(irb_.GetRuntime(ThrowStackOverflowException));
// Unwind.
llvm::Type* ret_type = func->getReturnType();
@@ -1541,7 +1602,7 @@
llvm::Value* array_elem_addr = EmitArrayGEP(array_addr, index_value, elem_jty);
if (elem_jty == kObject) { // If put an object, check the type, and mark GC card table.
- llvm::Function* runtime_func = irb_.GetRuntime(runtime_support::CheckPutArrayElement);
+ llvm::Function* runtime_func = irb_.GetRuntime(CheckPutArrayElement);
irb_.CreateCall2(runtime_func, new_value, array_addr);
@@ -1575,11 +1636,11 @@
llvm::Function* runtime_func;
if (field_jty == kObject) {
- runtime_func = irb_.GetRuntime(runtime_support::GetObjectInstance);
+ runtime_func = irb_.GetRuntime(GetObjectInstance);
} else if (field_jty == kLong || field_jty == kDouble) {
- runtime_func = irb_.GetRuntime(runtime_support::Get64Instance);
+ runtime_func = irb_.GetRuntime(Get64Instance);
} else {
- runtime_func = irb_.GetRuntime(runtime_support::Get32Instance);
+ runtime_func = irb_.GetRuntime(Get32Instance);
}
llvm::ConstantInt* field_idx_value = irb_.getInt32(field_idx);
@@ -1643,11 +1704,11 @@
}
if (field_jty == kObject) {
- runtime_func = irb_.GetRuntime(runtime_support::SetObjectInstance);
+ runtime_func = irb_.GetRuntime(SetObjectInstance);
} else if (field_jty == kLong || field_jty == kDouble) {
- runtime_func = irb_.GetRuntime(runtime_support::Set64Instance);
+ runtime_func = irb_.GetRuntime(Set64Instance);
} else {
- runtime_func = irb_.GetRuntime(runtime_support::Set32Instance);
+ runtime_func = irb_.GetRuntime(Set32Instance);
}
llvm::Value* field_idx_value = irb_.getInt32(field_idx);
@@ -1701,8 +1762,7 @@
llvm::Value* thread_object_addr = irb_.Runtime().EmitGetCurrentThread();
- llvm::Function* runtime_func =
- irb_.GetRuntime(runtime_support::InitializeTypeAndVerifyAccess);
+ llvm::Function* runtime_func = irb_.GetRuntime(InitializeTypeAndVerifyAccess);
EmitUpdateDexPC(dex_pc);
@@ -1741,7 +1801,7 @@
// Failback routine to load the class object
irb_.SetInsertPoint(block_load_class);
- llvm::Function* runtime_func = irb_.GetRuntime(runtime_support::InitializeType);
+ llvm::Function* runtime_func = irb_.GetRuntime(InitializeType);
llvm::Constant* type_idx_value = irb_.getInt32(type_idx);
@@ -1796,7 +1856,7 @@
// Failback routine to load the class object
irb_.SetInsertPoint(block_load_static);
- llvm::Function* runtime_func = irb_.GetRuntime(runtime_support::InitializeStaticStorage);
+ llvm::Function* runtime_func = irb_.GetRuntime(InitializeStaticStorage);
llvm::Constant* type_idx_value = irb_.getInt32(type_idx);
@@ -1846,11 +1906,11 @@
llvm::Function* runtime_func;
if (field_jty == kObject) {
- runtime_func = irb_.GetRuntime(runtime_support::GetObjectStatic);
+ runtime_func = irb_.GetRuntime(GetObjectStatic);
} else if (field_jty == kLong || field_jty == kDouble) {
- runtime_func = irb_.GetRuntime(runtime_support::Get64Static);
+ runtime_func = irb_.GetRuntime(Get64Static);
} else {
- runtime_func = irb_.GetRuntime(runtime_support::Get32Static);
+ runtime_func = irb_.GetRuntime(Get32Static);
}
llvm::Constant* field_idx_value = irb_.getInt32(field_idx);
@@ -1928,11 +1988,11 @@
llvm::Function* runtime_func;
if (field_jty == kObject) {
- runtime_func = irb_.GetRuntime(runtime_support::SetObjectStatic);
+ runtime_func = irb_.GetRuntime(SetObjectStatic);
} else if (field_jty == kLong || field_jty == kDouble) {
- runtime_func = irb_.GetRuntime(runtime_support::Set64Static);
+ runtime_func = irb_.GetRuntime(Set64Static);
} else {
- runtime_func = irb_.GetRuntime(runtime_support::Set32Static);
+ runtime_func = irb_.GetRuntime(Set32Static);
}
if (field_jty == kFloat) {
@@ -2029,7 +2089,7 @@
// String is not resolved yet, resolve it now.
irb_.SetInsertPoint(block_str_resolve);
- llvm::Function* runtime_func = irb_.GetRuntime(runtime_support::ResolveString);
+ llvm::Function* runtime_func = irb_.GetRuntime(ResolveString);
llvm::Value* method_object_addr = EmitLoadMethodObjectAddr();
@@ -2141,7 +2201,7 @@
EmitUpdateDexPC(dex_pc);
- irb_.CreateCall2(irb_.GetRuntime(runtime_support::CheckCast),
+ irb_.CreateCall2(irb_.GetRuntime(CheckCast),
type_object_addr, object_type_object_addr);
EmitGuard_ExceptionLandingPad(dex_pc);
@@ -2209,7 +2269,7 @@
// Test: Is the object instantiated from the subclass of the given class?
irb_.SetInsertPoint(block_test_sub_class);
llvm::Value* result =
- irb_.CreateCall2(irb_.GetRuntime(runtime_support::IsAssignable),
+ irb_.CreateCall2(irb_.GetRuntime(IsAssignable),
type_object_addr, object_type_object_addr);
irb_.CreateBr(block_cont);
@@ -2232,9 +2292,9 @@
if (driver_->CanAccessInstantiableTypeWithoutChecks(dex_compilation_unit_->GetDexMethodIndex(),
*dex_compilation_unit_->GetDexFile(),
type_idx)) {
- runtime_func = irb_.GetRuntime(runtime_support::AllocObject);
+ runtime_func = irb_.GetRuntime(AllocObject);
} else {
- runtime_func = irb_.GetRuntime(runtime_support::AllocObjectWithAccessCheck);
+ runtime_func = irb_.GetRuntime(AllocObjectWithAccessCheck);
}
llvm::Constant* type_index_value = irb_.getInt32(type_idx);
@@ -2373,7 +2433,7 @@
// NOTE: We will check for the NullPointerException in the runtime.
- llvm::Function* runtime_func = irb_.GetRuntime(runtime_support::FillArrayData);
+ llvm::Function* runtime_func = irb_.GetRuntime(FillArrayData);
llvm::Value* method_object_addr = EmitLoadMethodObjectAddr();
@@ -2402,12 +2462,12 @@
if (is_filled_new_array) {
runtime_func = skip_access_check ?
- irb_.GetRuntime(runtime_support::CheckAndAllocArray) :
- irb_.GetRuntime(runtime_support::CheckAndAllocArrayWithAccessCheck);
+ irb_.GetRuntime(CheckAndAllocArray) :
+ irb_.GetRuntime(CheckAndAllocArrayWithAccessCheck);
} else {
runtime_func = skip_access_check ?
- irb_.GetRuntime(runtime_support::AllocArray) :
- irb_.GetRuntime(runtime_support::AllocArrayWithAccessCheck);
+ irb_.GetRuntime(AllocArray) :
+ irb_.GetRuntime(AllocArrayWithAccessCheck);
}
llvm::Constant* type_index_value = irb_.getInt32(type_idx);
@@ -2437,26 +2497,26 @@
switch (invoke_type) {
case art::kStatic:
- runtime_func = irb_.GetRuntime(runtime_support::FindStaticMethodWithAccessCheck);
+ runtime_func = irb_.GetRuntime(FindStaticMethodWithAccessCheck);
break;
case art::kDirect:
- runtime_func = irb_.GetRuntime(runtime_support::FindDirectMethodWithAccessCheck);
+ runtime_func = irb_.GetRuntime(FindDirectMethodWithAccessCheck);
break;
case art::kVirtual:
- runtime_func = irb_.GetRuntime(runtime_support::FindVirtualMethodWithAccessCheck);
+ runtime_func = irb_.GetRuntime(FindVirtualMethodWithAccessCheck);
break;
case art::kSuper:
- runtime_func = irb_.GetRuntime(runtime_support::FindSuperMethodWithAccessCheck);
+ runtime_func = irb_.GetRuntime(FindSuperMethodWithAccessCheck);
break;
case art::kInterface:
if (is_fast_path) {
- runtime_func = irb_.GetRuntime(runtime_support::FindInterfaceMethod);
+ runtime_func = irb_.GetRuntime(FindInterfaceMethod);
} else {
- runtime_func = irb_.GetRuntime(runtime_support::FindInterfaceMethodWithAccessCheck);
+ runtime_func = irb_.GetRuntime(FindInterfaceMethodWithAccessCheck);
}
break;
}
@@ -2518,7 +2578,7 @@
irb_.SetInsertPoint(block_exception);
EmitUpdateDexPC(dex_pc);
- irb_.CreateCall(irb_.GetRuntime(runtime_support::ThrowDivZeroException));
+ irb_.CreateCall(irb_.GetRuntime(ThrowDivZeroException));
EmitBranchExceptionLandingPad(dex_pc);
irb_.SetInsertPoint(block_continue);
@@ -2557,7 +2617,7 @@
irb_.SetInsertPoint(block_exception);
EmitUpdateDexPC(dex_pc);
- irb_.CreateCall(irb_.GetRuntime(runtime_support::ThrowNullPointerException),
+ irb_.CreateCall(irb_.GetRuntime(ThrowNullPointerException),
irb_.getInt32(dex_pc));
EmitBranchExceptionLandingPad(dex_pc);
@@ -2603,7 +2663,7 @@
irb_.SetInsertPoint(block_exception);
EmitUpdateDexPC(dex_pc);
- irb_.CreateCall2(irb_.GetRuntime(runtime_support::ThrowIndexOutOfBounds), index, array_len);
+ irb_.CreateCall2(irb_.GetRuntime(ThrowIndexOutOfBounds), index, array_len);
EmitBranchExceptionLandingPad(dex_pc);
irb_.SetInsertPoint(block_continue);
@@ -2720,7 +2780,7 @@
llvm::Value* ti_offset_value = irb_.getInt32(ti_offset);
llvm::Value* catch_handler_index_value =
- irb_.CreateCall2(irb_.GetRuntime(runtime_support::FindCatchBlock),
+ irb_.CreateCall2(irb_.GetRuntime(FindCatchBlock),
method_object_addr, ti_offset_value);
// Switch instruction (Go to unwind basic block by default)
@@ -2825,14 +2885,14 @@
//==- Exception --------------------------------------------------------==//
case IntrinsicHelper::ThrowException: {
- return ExpandToRuntime(runtime_support::ThrowException, call_inst);
+ return ExpandToRuntime(ThrowException, call_inst);
}
case IntrinsicHelper::HLThrowException: {
uint32_t dex_pc = LV2UInt(call_inst.getMetadata("DexOff")->getOperand(0));
EmitUpdateDexPC(dex_pc);
- irb_.CreateCall(irb_.GetRuntime(runtime_support::ThrowException),
+ irb_.CreateCall(irb_.GetRuntime(ThrowException),
call_inst.getArgOperand(0));
EmitGuard_ExceptionLandingPad(dex_pc);
@@ -2845,16 +2905,16 @@
return irb_.Runtime().EmitIsExceptionPending();
}
case IntrinsicHelper::FindCatchBlock: {
- return ExpandToRuntime(runtime_support::FindCatchBlock, call_inst);
+ return ExpandToRuntime(FindCatchBlock, call_inst);
}
case IntrinsicHelper::ThrowDivZeroException: {
- return ExpandToRuntime(runtime_support::ThrowDivZeroException, call_inst);
+ return ExpandToRuntime(ThrowDivZeroException, call_inst);
}
case IntrinsicHelper::ThrowNullPointerException: {
- return ExpandToRuntime(runtime_support::ThrowNullPointerException, call_inst);
+ return ExpandToRuntime(ThrowNullPointerException, call_inst);
}
case IntrinsicHelper::ThrowIndexOutOfBounds: {
- return ExpandToRuntime(runtime_support::ThrowIndexOutOfBounds, call_inst);
+ return ExpandToRuntime(ThrowIndexOutOfBounds, call_inst);
}
//==- Const String -----------------------------------------------------==//
@@ -2865,7 +2925,7 @@
return Expand_LoadStringFromDexCache(call_inst.getArgOperand(0));
}
case IntrinsicHelper::ResolveString: {
- return ExpandToRuntime(runtime_support::ResolveString, call_inst);
+ return ExpandToRuntime(ResolveString, call_inst);
}
//==- Const Class ------------------------------------------------------==//
@@ -2873,13 +2933,13 @@
return Expand_ConstClass(call_inst);
}
case IntrinsicHelper::InitializeTypeAndVerifyAccess: {
- return ExpandToRuntime(runtime_support::InitializeTypeAndVerifyAccess, call_inst);
+ return ExpandToRuntime(InitializeTypeAndVerifyAccess, call_inst);
}
case IntrinsicHelper::LoadTypeFromDexCache: {
return Expand_LoadTypeFromDexCache(call_inst.getArgOperand(0));
}
case IntrinsicHelper::InitializeType: {
- return ExpandToRuntime(runtime_support::InitializeType, call_inst);
+ return ExpandToRuntime(InitializeType, call_inst);
}
//==- Lock -------------------------------------------------------------==//
@@ -2894,22 +2954,22 @@
//==- Cast -------------------------------------------------------------==//
case IntrinsicHelper::CheckCast: {
- return ExpandToRuntime(runtime_support::CheckCast, call_inst);
+ return ExpandToRuntime(CheckCast, call_inst);
}
case IntrinsicHelper::HLCheckCast: {
Expand_HLCheckCast(call_inst);
return NULL;
}
case IntrinsicHelper::IsAssignable: {
- return ExpandToRuntime(runtime_support::IsAssignable, call_inst);
+ return ExpandToRuntime(IsAssignable, call_inst);
}
//==- Alloc ------------------------------------------------------------==//
case IntrinsicHelper::AllocObject: {
- return ExpandToRuntime(runtime_support::AllocObject, call_inst);
+ return ExpandToRuntime(AllocObject, call_inst);
}
case IntrinsicHelper::AllocObjectWithAccessCheck: {
- return ExpandToRuntime(runtime_support::AllocObjectWithAccessCheck, call_inst);
+ return ExpandToRuntime(AllocObjectWithAccessCheck, call_inst);
}
//==- Instance ---------------------------------------------------------==//
@@ -2931,17 +2991,17 @@
return EmitLoadArrayLength(call_inst.getArgOperand(0));
}
case IntrinsicHelper::AllocArray: {
- return ExpandToRuntime(runtime_support::AllocArray, call_inst);
+ return ExpandToRuntime(AllocArray, call_inst);
}
case IntrinsicHelper::AllocArrayWithAccessCheck: {
- return ExpandToRuntime(runtime_support::AllocArrayWithAccessCheck,
+ return ExpandToRuntime(AllocArrayWithAccessCheck,
call_inst);
}
case IntrinsicHelper::CheckAndAllocArray: {
- return ExpandToRuntime(runtime_support::CheckAndAllocArray, call_inst);
+ return ExpandToRuntime(CheckAndAllocArray, call_inst);
}
case IntrinsicHelper::CheckAndAllocArrayWithAccessCheck: {
- return ExpandToRuntime(runtime_support::CheckAndAllocArrayWithAccessCheck,
+ return ExpandToRuntime(CheckAndAllocArrayWithAccessCheck,
call_inst);
}
case IntrinsicHelper::ArrayGet: {
@@ -3029,14 +3089,14 @@
return NULL;
}
case IntrinsicHelper::CheckPutArrayElement: {
- return ExpandToRuntime(runtime_support::CheckPutArrayElement, call_inst);
+ return ExpandToRuntime(CheckPutArrayElement, call_inst);
}
case IntrinsicHelper::FilledNewArray: {
Expand_FilledNewArray(call_inst);
return NULL;
}
case IntrinsicHelper::FillArrayData: {
- return ExpandToRuntime(runtime_support::FillArrayData, call_inst);
+ return ExpandToRuntime(FillArrayData, call_inst);
}
case IntrinsicHelper::HLFillArrayData: {
Expand_HLFillArrayData(call_inst);
@@ -3052,13 +3112,13 @@
case IntrinsicHelper::InstanceFieldGetByte:
case IntrinsicHelper::InstanceFieldGetChar:
case IntrinsicHelper::InstanceFieldGetShort: {
- return ExpandToRuntime(runtime_support::Get32Instance, call_inst);
+ return ExpandToRuntime(Get32Instance, call_inst);
}
case IntrinsicHelper::InstanceFieldGetWide: {
- return ExpandToRuntime(runtime_support::Get64Instance, call_inst);
+ return ExpandToRuntime(Get64Instance, call_inst);
}
case IntrinsicHelper::InstanceFieldGetObject: {
- return ExpandToRuntime(runtime_support::GetObjectInstance, call_inst);
+ return ExpandToRuntime(GetObjectInstance, call_inst);
}
case IntrinsicHelper::InstanceFieldGetFast: {
return Expand_IGetFast(call_inst.getArgOperand(0),
@@ -3107,13 +3167,13 @@
case IntrinsicHelper::InstanceFieldPutByte:
case IntrinsicHelper::InstanceFieldPutChar:
case IntrinsicHelper::InstanceFieldPutShort: {
- return ExpandToRuntime(runtime_support::Set32Instance, call_inst);
+ return ExpandToRuntime(Set32Instance, call_inst);
}
case IntrinsicHelper::InstanceFieldPutWide: {
- return ExpandToRuntime(runtime_support::Set64Instance, call_inst);
+ return ExpandToRuntime(Set64Instance, call_inst);
}
case IntrinsicHelper::InstanceFieldPutObject: {
- return ExpandToRuntime(runtime_support::SetObjectInstance, call_inst);
+ return ExpandToRuntime(SetObjectInstance, call_inst);
}
case IntrinsicHelper::InstanceFieldPutFast: {
Expand_IPutFast(call_inst.getArgOperand(0),
@@ -3178,13 +3238,13 @@
case IntrinsicHelper::StaticFieldGetByte:
case IntrinsicHelper::StaticFieldGetChar:
case IntrinsicHelper::StaticFieldGetShort: {
- return ExpandToRuntime(runtime_support::Get32Static, call_inst);
+ return ExpandToRuntime(Get32Static, call_inst);
}
case IntrinsicHelper::StaticFieldGetWide: {
- return ExpandToRuntime(runtime_support::Get64Static, call_inst);
+ return ExpandToRuntime(Get64Static, call_inst);
}
case IntrinsicHelper::StaticFieldGetObject: {
- return ExpandToRuntime(runtime_support::GetObjectStatic, call_inst);
+ return ExpandToRuntime(GetObjectStatic, call_inst);
}
case IntrinsicHelper::StaticFieldGetFast: {
return Expand_SGetFast(call_inst.getArgOperand(0),
@@ -3233,13 +3293,13 @@
case IntrinsicHelper::StaticFieldPutByte:
case IntrinsicHelper::StaticFieldPutChar:
case IntrinsicHelper::StaticFieldPutShort: {
- return ExpandToRuntime(runtime_support::Set32Static, call_inst);
+ return ExpandToRuntime(Set32Static, call_inst);
}
case IntrinsicHelper::StaticFieldPutWide: {
- return ExpandToRuntime(runtime_support::Set64Static, call_inst);
+ return ExpandToRuntime(Set64Static, call_inst);
}
case IntrinsicHelper::StaticFieldPutObject: {
- return ExpandToRuntime(runtime_support::SetObjectStatic, call_inst);
+ return ExpandToRuntime(SetObjectStatic, call_inst);
}
case IntrinsicHelper::StaticFieldPutFast: {
Expand_SPutFast(call_inst.getArgOperand(0),
@@ -3304,7 +3364,7 @@
return Expand_LoadClassSSBFromDexCache(call_inst.getArgOperand(0));
}
case IntrinsicHelper::InitializeAndLoadClassSSB: {
- return ExpandToRuntime(runtime_support::InitializeStaticStorage, call_inst);
+ return ExpandToRuntime(InitializeStaticStorage, call_inst);
}
//==- High-level Array -------------------------------------------------==//
@@ -3449,19 +3509,19 @@
//==- Invoke -----------------------------------------------------------==//
case IntrinsicHelper::FindStaticMethodWithAccessCheck: {
- return ExpandToRuntime(runtime_support::FindStaticMethodWithAccessCheck, call_inst);
+ return ExpandToRuntime(FindStaticMethodWithAccessCheck, call_inst);
}
case IntrinsicHelper::FindDirectMethodWithAccessCheck: {
- return ExpandToRuntime(runtime_support::FindDirectMethodWithAccessCheck, call_inst);
+ return ExpandToRuntime(FindDirectMethodWithAccessCheck, call_inst);
}
case IntrinsicHelper::FindVirtualMethodWithAccessCheck: {
- return ExpandToRuntime(runtime_support::FindVirtualMethodWithAccessCheck, call_inst);
+ return ExpandToRuntime(FindVirtualMethodWithAccessCheck, call_inst);
}
case IntrinsicHelper::FindSuperMethodWithAccessCheck: {
- return ExpandToRuntime(runtime_support::FindSuperMethodWithAccessCheck, call_inst);
+ return ExpandToRuntime(FindSuperMethodWithAccessCheck, call_inst);
}
case IntrinsicHelper::FindInterfaceMethodWithAccessCheck: {
- return ExpandToRuntime(runtime_support::FindInterfaceMethodWithAccessCheck, call_inst);
+ return ExpandToRuntime(FindInterfaceMethodWithAccessCheck, call_inst);
}
case IntrinsicHelper::GetSDCalleeMethodObjAddrFast: {
return Expand_GetSDCalleeMethodObjAddrFast(call_inst.getArgOperand(0));
@@ -3471,7 +3531,7 @@
call_inst.getArgOperand(0), call_inst.getArgOperand(1));
}
case IntrinsicHelper::GetInterfaceCalleeMethodObjAddrFast: {
- return ExpandToRuntime(runtime_support::FindInterfaceMethod, call_inst);
+ return ExpandToRuntime(FindInterfaceMethod, call_inst);
}
case IntrinsicHelper::InvokeRetVoid:
case IntrinsicHelper::InvokeRetBoolean:
@@ -3500,16 +3560,16 @@
return Expand_DivRem(call_inst, /* is_div */false, kLong);
}
case IntrinsicHelper::D2L: {
- return ExpandToRuntime(runtime_support::art_d2l, call_inst);
+ return ExpandToRuntime(art_d2l, call_inst);
}
case IntrinsicHelper::D2I: {
- return ExpandToRuntime(runtime_support::art_d2i, call_inst);
+ return ExpandToRuntime(art_d2i, call_inst);
}
case IntrinsicHelper::F2L: {
- return ExpandToRuntime(runtime_support::art_f2l, call_inst);
+ return ExpandToRuntime(art_f2l, call_inst);
}
case IntrinsicHelper::F2I: {
- return ExpandToRuntime(runtime_support::art_f2i, call_inst);
+ return ExpandToRuntime(art_f2i, call_inst);
}
//==- High-level Static ------------------------------------------------==//
diff --git a/compiler/llvm/runtime_support_builder.cc b/compiler/llvm/runtime_support_builder.cc
index 976aa8f..19ccc36 100644
--- a/compiler/llvm/runtime_support_builder.cc
+++ b/compiler/llvm/runtime_support_builder.cc
@@ -27,14 +27,14 @@
#include <llvm/IR/Module.h>
#include <llvm/IR/Type.h>
-using namespace llvm;
+using ::llvm::BasicBlock;
+using ::llvm::CallInst;
+using ::llvm::Function;
+using ::llvm::Value;
namespace art {
namespace llvm {
-using namespace runtime_support;
-
-
RuntimeSupportBuilder::RuntimeSupportBuilder(::llvm::LLVMContext& context,
::llvm::Module& module,
IRBuilder& irb)
diff --git a/compiler/llvm/runtime_support_builder_arm.cc b/compiler/llvm/runtime_support_builder_arm.cc
index 57a9971..5a9d2b8 100644
--- a/compiler/llvm/runtime_support_builder_arm.cc
+++ b/compiler/llvm/runtime_support_builder_arm.cc
@@ -28,11 +28,17 @@
#include <vector>
-using namespace llvm;
+using ::llvm::CallInst;
+using ::llvm::Function;
+using ::llvm::FunctionType;
+using ::llvm::InlineAsm;
+using ::llvm::IntegerType;
+using ::llvm::Type;
+using ::llvm::Value;
namespace {
-char LDRSTRSuffixByType(art::llvm::IRBuilder& irb, ::llvm::Type* type) {
+char LDRSTRSuffixByType(art::llvm::IRBuilder& irb, Type* type) {
int width = type->isPointerTy() ?
irb.getSizeOfPtrEquivInt()*8 :
::llvm::cast<IntegerType>(type)->getBitWidth();
@@ -53,7 +59,7 @@
/* Thread */
-::llvm::Value* RuntimeSupportBuilderARM::EmitGetCurrentThread() {
+Value* RuntimeSupportBuilderARM::EmitGetCurrentThread() {
Function* ori_func = GetRuntimeSupportFunction(runtime_support::GetCurrentThread);
InlineAsm* func = InlineAsm::get(ori_func->getFunctionType(), "mov $0, r9", "=r", false);
CallInst* thread = irb_.CreateCall(func);
@@ -62,8 +68,8 @@
return thread;
}
-::llvm::Value* RuntimeSupportBuilderARM::EmitLoadFromThreadOffset(int64_t offset, ::llvm::Type* type,
- TBAASpecialType s_ty) {
+Value* RuntimeSupportBuilderARM::EmitLoadFromThreadOffset(int64_t offset, ::llvm::Type* type,
+ TBAASpecialType s_ty) {
FunctionType* func_ty = FunctionType::get(/*Result=*/type,
/*isVarArg=*/false);
std::string inline_asm(StringPrintf("ldr%c $0, [r9, #%d]",
@@ -76,7 +82,7 @@
return result;
}
-void RuntimeSupportBuilderARM::EmitStoreToThreadOffset(int64_t offset, ::llvm::Value* value,
+void RuntimeSupportBuilderARM::EmitStoreToThreadOffset(int64_t offset, Value* value,
TBAASpecialType s_ty) {
FunctionType* func_ty = FunctionType::get(/*Result=*/Type::getVoidTy(context_),
/*Params=*/value->getType(),
@@ -89,8 +95,7 @@
irb_.SetTBAA(call_inst, s_ty);
}
-::llvm::Value*
-RuntimeSupportBuilderARM::EmitSetCurrentThread(::llvm::Value* thread) {
+Value* RuntimeSupportBuilderARM::EmitSetCurrentThread(Value* thread) {
// Separate to two InlineAsm: The first one produces the return value, while the second,
// sets the current thread.
// LLVM can delete the first one if the caller in LLVM IR doesn't use the return value.
@@ -114,7 +119,7 @@
/* Monitor */
-void RuntimeSupportBuilderARM::EmitLockObject(::llvm::Value* object) {
+void RuntimeSupportBuilderARM::EmitLockObject(Value* object) {
RuntimeSupportBuilder::EmitLockObject(object);
FunctionType* func_ty = FunctionType::get(/*Result=*/Type::getVoidTy(context_),
/*isVarArg=*/false);
@@ -122,7 +127,7 @@
irb_.CreateCall(func);
}
-void RuntimeSupportBuilderARM::EmitUnlockObject(::llvm::Value* object) {
+void RuntimeSupportBuilderARM::EmitUnlockObject(Value* object) {
RuntimeSupportBuilder::EmitUnlockObject(object);
FunctionType* func_ty = FunctionType::get(/*Result=*/Type::getVoidTy(context_),
/*isVarArg=*/false);
diff --git a/compiler/llvm/runtime_support_builder_thumb2.cc b/compiler/llvm/runtime_support_builder_thumb2.cc
index 2b9170c..b8a5f05 100644
--- a/compiler/llvm/runtime_support_builder_thumb2.cc
+++ b/compiler/llvm/runtime_support_builder_thumb2.cc
@@ -31,13 +31,18 @@
#include <inttypes.h>
#include <vector>
-using namespace llvm;
+using ::llvm::BasicBlock;
+using ::llvm::Function;
+using ::llvm::FunctionType;
+using ::llvm::InlineAsm;
+using ::llvm::Type;
+using ::llvm::Value;
namespace art {
namespace llvm {
-void RuntimeSupportBuilderThumb2::EmitLockObject(::llvm::Value* object) {
+void RuntimeSupportBuilderThumb2::EmitLockObject(Value* object) {
FunctionType* func_ty = FunctionType::get(/*Result=*/irb_.getInt32Ty(),
/*Params=*/irb_.getJObjectTy(),
/*isVarArg=*/false);
@@ -58,10 +63,10 @@
InlineAsm* func = InlineAsm::get(func_ty, asms, "=&l,l,~l,~l", true);
- ::llvm::Value* retry_slow_path = irb_.CreateCall(func, object);
+ Value* retry_slow_path = irb_.CreateCall(func, object);
retry_slow_path = irb_.CreateICmpNE(retry_slow_path, irb_.getJInt(0));
- ::llvm::Function* parent_func = irb_.GetInsertBlock()->getParent();
+ Function* parent_func = irb_.GetInsertBlock()->getParent();
BasicBlock* basic_block_lock = BasicBlock::Create(context_, "lock", parent_func);
BasicBlock* basic_block_cont = BasicBlock::Create(context_, "lock_cont", parent_func);
irb_.CreateCondBr(retry_slow_path, basic_block_lock, basic_block_cont, kUnlikely);
diff --git a/compiler/llvm/runtime_support_builder_x86.cc b/compiler/llvm/runtime_support_builder_x86.cc
index eed0b63..c056e58 100644
--- a/compiler/llvm/runtime_support_builder_x86.cc
+++ b/compiler/llvm/runtime_support_builder_x86.cc
@@ -29,13 +29,19 @@
#include <vector>
-using namespace llvm;
+using ::llvm::CallInst;
+using ::llvm::Function;
+using ::llvm::FunctionType;
+using ::llvm::InlineAsm;
+using ::llvm::Type;
+using ::llvm::UndefValue;
+using ::llvm::Value;
namespace art {
namespace llvm {
-::llvm::Value* RuntimeSupportBuilderX86::EmitGetCurrentThread() {
+Value* RuntimeSupportBuilderX86::EmitGetCurrentThread() {
Function* ori_func = GetRuntimeSupportFunction(runtime_support::GetCurrentThread);
std::string inline_asm(StringPrintf("mov %%fs:%d, $0", Thread::SelfOffset().Int32Value()));
InlineAsm* func = InlineAsm::get(ori_func->getFunctionType(), inline_asm, "=r", false);
@@ -45,8 +51,8 @@
return thread;
}
-::llvm::Value* RuntimeSupportBuilderX86::EmitLoadFromThreadOffset(int64_t offset, ::llvm::Type* type,
- TBAASpecialType s_ty) {
+Value* RuntimeSupportBuilderX86::EmitLoadFromThreadOffset(int64_t offset, Type* type,
+ TBAASpecialType s_ty) {
FunctionType* func_ty = FunctionType::get(/*Result=*/type,
/*isVarArg=*/false);
std::string inline_asm(StringPrintf("mov %%fs:%d, $0", static_cast<int>(offset)));
@@ -57,7 +63,7 @@
return result;
}
-void RuntimeSupportBuilderX86::EmitStoreToThreadOffset(int64_t offset, ::llvm::Value* value,
+void RuntimeSupportBuilderX86::EmitStoreToThreadOffset(int64_t offset, Value* value,
TBAASpecialType s_ty) {
FunctionType* func_ty = FunctionType::get(/*Result=*/Type::getVoidTy(context_),
/*Params=*/value->getType(),
@@ -68,9 +74,9 @@
irb_.SetTBAA(call_inst, s_ty);
}
-::llvm::Value* RuntimeSupportBuilderX86::EmitSetCurrentThread(::llvm::Value*) {
+Value* RuntimeSupportBuilderX86::EmitSetCurrentThread(Value*) {
/* Nothing to be done. */
- return ::llvm::UndefValue::get(irb_.getJObjectTy());
+ return UndefValue::get(irb_.getJObjectTy());
}
diff --git a/runtime/base/histogram_test.cc b/runtime/base/histogram_test.cc
index ea3e35f..9f3587a 100644
--- a/runtime/base/histogram_test.cc
+++ b/runtime/base/histogram_test.cc
@@ -20,7 +20,7 @@
#include <sstream>
-using namespace art;
+namespace art {
//Simple usage:
// Histogram *hist = new Histogram("SimplePercentiles");
@@ -266,3 +266,5 @@
hist->PrintConfidenceIntervals(stream, 0.99);
EXPECT_EQ(expected, stream.str());
}
+
+} // namespace art
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc
index 3c1cd78..75886cf 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -35,7 +35,30 @@
#include "runtime_support.h"
#include "sirt_ref.h"
-using namespace art::mirror;
+using ::art::mirror::AbstractMethod;
+using ::art::mirror::AbstractMethodClass;
+using ::art::mirror::CharArray;
+using ::art::mirror::Class;
+using ::art::mirror::ClassClass;
+using ::art::mirror::ClassLoader;
+using ::art::mirror::Constructor;
+using ::art::mirror::DexCache;
+using ::art::mirror::DoubleArray;
+using ::art::mirror::Field;
+using ::art::mirror::FieldClass;
+using ::art::mirror::IfTable;
+using ::art::mirror::IntArray;
+using ::art::mirror::LongArray;
+using ::art::mirror::Method;
+using ::art::mirror::Object;
+using ::art::mirror::ObjectArray;
+using ::art::mirror::Proxy;
+using ::art::mirror::ShortArray;
+using ::art::mirror::StackTraceElement;
+using ::art::mirror::StaticStorageBase;
+using ::art::mirror::String;
+using ::art::mirror::StringClass;
+using ::art::mirror::Throwable;
namespace art {
diff --git a/runtime/gc/accounting/mod_union_table.cc b/runtime/gc/accounting/mod_union_table.cc
index 91c9253..940ed13 100644
--- a/runtime/gc/accounting/mod_union_table.cc
+++ b/runtime/gc/accounting/mod_union_table.cc
@@ -30,7 +30,7 @@
#include "thread.h"
#include "UniquePtr.h"
-using namespace art::mirror;
+using ::art::mirror::Object;
namespace art {
namespace gc {
@@ -141,7 +141,7 @@
class AddToReferenceArrayVisitor {
public:
explicit AddToReferenceArrayVisitor(ModUnionTableReferenceCache* mod_union_table,
- std::vector<const mirror::Object*>* references)
+ std::vector<const Object*>* references)
: mod_union_table_(mod_union_table),
references_(references) {
}
@@ -157,13 +157,13 @@
private:
ModUnionTableReferenceCache* const mod_union_table_;
- std::vector<const mirror::Object*>* const references_;
+ std::vector<const Object*>* const references_;
};
class ModUnionReferenceVisitor {
public:
explicit ModUnionReferenceVisitor(ModUnionTableReferenceCache* const mod_union_table,
- std::vector<const mirror::Object*>* references)
+ std::vector<const Object*>* references)
: mod_union_table_(mod_union_table),
references_(references) {
}
@@ -178,7 +178,7 @@
}
private:
ModUnionTableReferenceCache* const mod_union_table_;
- std::vector<const mirror::Object*>* const references_;
+ std::vector<const Object*>* const references_;
};
class CheckReferenceVisitor {
@@ -237,8 +237,8 @@
void ModUnionTableReferenceCache::Verify() {
// Start by checking that everything in the mod union table is marked.
Heap* heap = GetHeap();
- typedef SafeMap<const byte*, std::vector<const mirror::Object*> >::const_iterator It;
- typedef std::vector<const mirror::Object*>::const_iterator It2;
+ typedef SafeMap<const byte*, std::vector<const Object*> >::const_iterator It;
+ typedef std::vector<const Object*>::const_iterator It2;
for (It it = references_.begin(), end = references_.end(); it != end; ++it) {
for (It2 it_ref = it->second.begin(), end_ref = it->second.end(); it_ref != end_ref;
++it_ref ) {
@@ -277,13 +277,13 @@
os << reinterpret_cast<void*>(start) << "-" << reinterpret_cast<void*>(end) << ",";
}
os << "]\nModUnionTable references: [";
- typedef SafeMap<const byte*, std::vector<const mirror::Object*> >::const_iterator It2;
+ typedef SafeMap<const byte*, std::vector<const Object*> >::const_iterator It2;
for (It2 it = references_.begin(); it != references_.end(); ++it) {
const byte* card = &*it->first;
uintptr_t start = reinterpret_cast<uintptr_t>(card_table->AddrFromCard(card));
uintptr_t end = start + CardTable::kCardSize;
os << reinterpret_cast<void*>(start) << "-" << reinterpret_cast<void*>(end) << "->{";
- typedef std::vector<const mirror::Object*>::const_iterator It3;
+ typedef std::vector<const Object*>::const_iterator It3;
for (It3 itr = it->second.begin(); itr != it->second.end();++itr) {
os << reinterpret_cast<const void*>(*itr) << ",";
}
@@ -295,7 +295,7 @@
Heap* heap = GetHeap();
CardTable* card_table = heap->GetCardTable();
- std::vector<const mirror::Object*> cards_references;
+ std::vector<const Object*> cards_references;
ModUnionReferenceVisitor visitor(this, &cards_references);
typedef std::set<byte*>::iterator It;
@@ -311,7 +311,7 @@
// Update the corresponding references for the card.
// TODO: C++0x auto
- SafeMap<const byte*, std::vector<const mirror::Object*> >::iterator
+ SafeMap<const byte*, std::vector<const Object*> >::iterator
found = references_.find(card);
if (found == references_.end()) {
if (cards_references.empty()) {
@@ -330,9 +330,9 @@
// TODO: C++0x auto
size_t count = 0;
- typedef SafeMap<const byte*, std::vector<const mirror::Object*> >::const_iterator It;
+ typedef SafeMap<const byte*, std::vector<const Object*> >::const_iterator It;
for (It it = references_.begin(); it != references_.end(); ++it) {
- typedef std::vector<const mirror::Object*>::const_iterator It2;
+ typedef std::vector<const Object*>::const_iterator It2;
for (It2 it_ref = it->second.begin(); it_ref != it->second.end(); ++it_ref) {
mark_sweep->MarkRoot(*it_ref);
++count;
diff --git a/runtime/gc/allocator/dlmalloc.cc b/runtime/gc/allocator/dlmalloc.cc
index 7725215..3cc64e9 100644
--- a/runtime/gc/allocator/dlmalloc.cc
+++ b/runtime/gc/allocator/dlmalloc.cc
@@ -50,17 +50,16 @@
#include "utils.h"
#include <sys/mman.h>
-using namespace art;
extern "C" void DlmallocMadviseCallback(void* start, void* end, size_t used_bytes, void* arg) {
// Is this chunk in use?
if (used_bytes != 0) {
return;
}
// Do we have any whole pages to give back?
- start = reinterpret_cast<void*>(RoundUp(reinterpret_cast<uintptr_t>(start), kPageSize));
- end = reinterpret_cast<void*>(RoundDown(reinterpret_cast<uintptr_t>(end), kPageSize));
+ start = reinterpret_cast<void*>(art::RoundUp(reinterpret_cast<uintptr_t>(start), art::kPageSize));
+ end = reinterpret_cast<void*>(art::RoundDown(reinterpret_cast<uintptr_t>(end), art::kPageSize));
if (end > start) {
- size_t length = reinterpret_cast<byte*>(end) - reinterpret_cast<byte*>(start);
+ size_t length = reinterpret_cast<uint8_t*>(end) - reinterpret_cast<uint8_t*>(start);
int rc = madvise(start, length, MADV_DONTNEED);
if (UNLIKELY(rc != 0)) {
errno = rc;
diff --git a/runtime/gc/collector/mark_sweep.cc b/runtime/gc/collector/mark_sweep.cc
index 2ca5f2d..2d07f062 100644
--- a/runtime/gc/collector/mark_sweep.cc
+++ b/runtime/gc/collector/mark_sweep.cc
@@ -50,7 +50,10 @@
#include "thread_list.h"
#include "verifier/method_verifier.h"
-using namespace art::mirror;
+using ::art::mirror::Class;
+using ::art::mirror::Field;
+using ::art::mirror::Object;
+using ::art::mirror::ObjectArray;
namespace art {
namespace gc {
diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc
index 376d3be..f624aa4 100644
--- a/runtime/interpreter/interpreter.cc
+++ b/runtime/interpreter/interpreter.cc
@@ -40,7 +40,21 @@
#include "scoped_thread_state_change.h"
#include "thread.h"
-using namespace art::mirror;
+using ::art::mirror::AbstractMethod;
+using ::art::mirror::Array;
+using ::art::mirror::BooleanArray;
+using ::art::mirror::ByteArray;
+using ::art::mirror::CharArray;
+using ::art::mirror::Class;
+using ::art::mirror::ClassLoader;
+using ::art::mirror::Field;
+using ::art::mirror::IntArray;
+using ::art::mirror::LongArray;
+using ::art::mirror::Object;
+using ::art::mirror::ObjectArray;
+using ::art::mirror::ShortArray;
+using ::art::mirror::String;
+using ::art::mirror::Throwable;
namespace art {
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index c6047cd..72d9aea 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -49,7 +49,23 @@
#include "UniquePtr.h"
#include "well_known_classes.h"
-using namespace art::mirror;
+using ::art::mirror::AbstractMethod;
+using ::art::mirror::Array;
+using ::art::mirror::BooleanArray;
+using ::art::mirror::ByteArray;
+using ::art::mirror::CharArray;
+using ::art::mirror::Class;
+using ::art::mirror::ClassLoader;
+using ::art::mirror::DoubleArray;
+using ::art::mirror::Field;
+using ::art::mirror::FloatArray;
+using ::art::mirror::IntArray;
+using ::art::mirror::LongArray;
+using ::art::mirror::Object;
+using ::art::mirror::ObjectArray;
+using ::art::mirror::ShortArray;
+using ::art::mirror::String;
+using ::art::mirror::Throwable;
namespace art {
diff --git a/runtime/runtime_support_llvm.cc b/runtime/runtime_support_llvm.cc
index d703db2..7b4c3ca 100644
--- a/runtime/runtime_support_llvm.cc
+++ b/runtime/runtime_support_llvm.cc
@@ -47,9 +47,10 @@
#include <stdint.h>
#include <stdlib.h>
-using namespace art;
+namespace art {
-extern "C" {
+using ::art::mirror::AbstractMethod;
+
class ShadowFrameCopyVisitor : public StackVisitor {
public:
explicit ShadowFrameCopyVisitor(Thread* self) : StackVisitor(self, NULL), prev_frame_(NULL),
@@ -59,7 +60,7 @@
if (IsShadowFrame()) {
ShadowFrame* cur_frame = GetCurrentShadowFrame();
size_t num_regs = cur_frame->NumberOfVRegs();
- mirror::AbstractMethod* method = cur_frame->GetMethod();
+ AbstractMethod* method = cur_frame->GetMethod();
uint32_t dex_pc = cur_frame->GetDexPC();
ShadowFrame* new_frame = ShadowFrame::Create(num_regs, NULL, method, dex_pc);
@@ -101,6 +102,61 @@
ShadowFrame* top_frame_;
};
+} // namespace art
+
+extern "C" {
+
+using ::art::CatchHandlerIterator;
+using ::art::DexFile;
+using ::art::FindFieldFast;
+using ::art::FindMethodFast;
+using ::art::InstanceObjectRead;
+using ::art::InstanceObjectWrite;
+using ::art::InstancePrimitiveRead;
+using ::art::InstancePrimitiveWrite;
+using ::art::Instruction;
+using ::art::InvokeType;
+using ::art::JNIEnvExt;
+using ::art::JValue;
+using ::art::Locks;
+using ::art::MethodHelper;
+using ::art::PrettyClass;
+using ::art::PrettyMethod;
+using ::art::Primitive;
+using ::art::ResolveStringFromCode;
+using ::art::Runtime;
+using ::art::ScopedJniEnvLocalRefState;
+using ::art::ScopedObjectAccessUnchecked;
+using ::art::ShadowFrame;
+using ::art::ShadowFrameCopyVisitor;
+using ::art::StaticObjectRead;
+using ::art::StaticObjectWrite;
+using ::art::StaticPrimitiveRead;
+using ::art::StaticPrimitiveWrite;
+using ::art::Thread;
+using ::art::Thread;
+using ::art::ThrowArithmeticExceptionDivideByZero;
+using ::art::ThrowArrayIndexOutOfBoundsException;
+using ::art::ThrowArrayStoreException;
+using ::art::ThrowClassCastException;
+using ::art::ThrowLocation;
+using ::art::ThrowNoSuchMethodError;
+using ::art::ThrowNullPointerException;
+using ::art::ThrowNullPointerExceptionFromDexPC;
+using ::art::ThrowStackOverflowError;
+using ::art::kDirect;
+using ::art::kInterface;
+using ::art::kNative;
+using ::art::kStatic;
+using ::art::kSuper;
+using ::art::kVirtual;
+using ::art::mirror::AbstractMethod;
+using ::art::mirror::Array;
+using ::art::mirror::Class;
+using ::art::mirror::Field;
+using ::art::mirror::Object;
+using ::art::mirror::Throwable;
+
//----------------------------------------------------------------------------
// Thread
//----------------------------------------------------------------------------
@@ -118,7 +174,7 @@
return NULL;
}
-void art_portable_lock_object_from_code(mirror::Object* obj, Thread* thread)
+void art_portable_lock_object_from_code(Object* obj, Thread* thread)
EXCLUSIVE_LOCK_FUNCTION(monitor_lock_) {
DCHECK(obj != NULL); // Assumed to have been checked before entry
obj->MonitorEnter(thread); // May block
@@ -127,7 +183,7 @@
DCHECK(!thread->IsExceptionPending());
}
-void art_portable_unlock_object_from_code(mirror::Object* obj, Thread* thread)
+void art_portable_unlock_object_from_code(Object* obj, Thread* thread)
UNLOCK_FUNCTION(monitor_lock_) {
DCHECK(obj != NULL); // Assumed to have been checked before entry
// MonitorExit may throw exception
@@ -143,14 +199,14 @@
visitor.WalkStack(true);
self->SetDeoptimizationShadowFrame(visitor.GetShadowFrameCopy());
self->SetDeoptimizationReturnValue(JValue());
- self->SetException(ThrowLocation(), reinterpret_cast<mirror::Throwable*>(-1));
+ self->SetException(ThrowLocation(), reinterpret_cast<Throwable*>(-1));
}
}
ShadowFrame* art_portable_push_shadow_frame_from_code(Thread* thread,
- ShadowFrame* new_shadow_frame,
- mirror::AbstractMethod* method,
- uint32_t num_vregs) {
+ ShadowFrame* new_shadow_frame,
+ AbstractMethod* method,
+ uint32_t num_vregs) {
ShadowFrame* old_frame = thread->PushShadowFrame(new_shadow_frame);
new_shadow_frame->SetMethod(method);
new_shadow_frame->SetNumberOfVRegs(num_vregs);
@@ -201,7 +257,7 @@
ThrowStackOverflowError(Thread::Current());
}
-void art_portable_throw_exception_from_code(mirror::Throwable* exception)
+void art_portable_throw_exception_from_code(Throwable* exception)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Thread* self = Thread::Current();
ThrowLocation throw_location = self->GetCurrentLocationForThrow();
@@ -216,21 +272,22 @@
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(self->IsExceptionPending());
// TODO: make this inline.
- mirror::Throwable* exception = self->GetException(NULL);
+ Throwable* exception = self->GetException(NULL);
self->ClearException();
return exception;
}
-int32_t art_portable_find_catch_block_from_code(mirror::AbstractMethod* current_method, uint32_t ti_offset)
+int32_t art_portable_find_catch_block_from_code(AbstractMethod* current_method,
+ uint32_t ti_offset)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Thread* self = Thread::Current(); // TODO: make an argument.
ThrowLocation throw_location;
- mirror::Throwable* exception = self->GetException(&throw_location);
+ Throwable* exception = self->GetException(&throw_location);
// Check for special deoptimization exception.
if (UNLIKELY(reinterpret_cast<int32_t>(exception) == -1)) {
return -1;
}
- mirror::Class* exception_type = exception->GetClass();
+ Class* exception_type = exception->GetClass();
MethodHelper mh(current_method);
const DexFile::CodeItem* code_item = mh.GetCodeItem();
DCHECK_LT(ti_offset, code_item->tries_size_);
@@ -249,7 +306,7 @@
break;
}
// Does this catch exception type apply?
- mirror::Class* iter_exception_type = mh.GetDexCacheResolvedType(iter_type_idx);
+ Class* iter_exception_type = mh.GetDexCacheResolvedType(iter_type_idx);
if (UNLIKELY(iter_exception_type == NULL)) {
// TODO: check, the verifier (class linker?) should take care of resolving all exception
// classes early.
@@ -278,57 +335,62 @@
// Object Space
//----------------------------------------------------------------------------
-mirror::Object* art_portable_alloc_object_from_code(uint32_t type_idx,
- mirror::AbstractMethod* referrer,
- Thread* thread)
+Object* art_portable_alloc_object_from_code(uint32_t type_idx, AbstractMethod* referrer, Thread* thread)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return AllocObjectFromCode(type_idx, referrer, thread, false);
}
-mirror::Object* art_portable_alloc_object_from_code_with_access_check(uint32_t type_idx,
- mirror::AbstractMethod* referrer,
+Object* art_portable_alloc_object_from_code_with_access_check(uint32_t type_idx,
+ AbstractMethod* referrer,
Thread* thread)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return AllocObjectFromCode(type_idx, referrer, thread, true);
}
-mirror::Object* art_portable_alloc_array_from_code(uint32_t type_idx,
- mirror::AbstractMethod* referrer,
+Object* art_portable_alloc_array_from_code(uint32_t type_idx,
+ AbstractMethod* referrer,
uint32_t length,
Thread* self)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return AllocArrayFromCode(type_idx, referrer, length, self, false);
}
-mirror::Object* art_portable_alloc_array_from_code_with_access_check(uint32_t type_idx,
- mirror::AbstractMethod* referrer,
+Object* art_portable_alloc_array_from_code_with_access_check(uint32_t type_idx,
+ AbstractMethod* referrer,
uint32_t length,
Thread* self)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return AllocArrayFromCode(type_idx, referrer, length, self, true);
}
-mirror::Object* art_portable_check_and_alloc_array_from_code(uint32_t type_idx,
- mirror::AbstractMethod* referrer,
+Object* art_portable_check_and_alloc_array_from_code(uint32_t type_idx,
+ AbstractMethod* referrer,
uint32_t length,
Thread* thread)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return CheckAndAllocArrayFromCode(type_idx, referrer, length, thread, false);
}
-mirror::Object* art_portable_check_and_alloc_array_from_code_with_access_check(uint32_t type_idx,
- mirror::AbstractMethod* referrer,
+Object* art_portable_check_and_alloc_array_from_code_with_access_check(uint32_t type_idx,
+ AbstractMethod* referrer,
uint32_t length,
Thread* thread)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return CheckAndAllocArrayFromCode(type_idx, referrer, length, thread, true);
}
-static mirror::AbstractMethod* FindMethodHelper(uint32_t method_idx, mirror::Object* this_object,
- mirror::AbstractMethod* caller_method, bool access_check,
- InvokeType type, Thread* thread)
+static AbstractMethod* FindMethodHelper(uint32_t method_idx,
+ Object* this_object,
+ AbstractMethod* caller_method,
+ bool access_check,
+ InvokeType type,
+ Thread* thread)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- mirror::AbstractMethod* method = FindMethodFast(method_idx, this_object, caller_method, access_check, type);
+ AbstractMethod* method = FindMethodFast(method_idx,
+ this_object,
+ caller_method,
+ access_check,
+ type);
if (UNLIKELY(method == NULL)) {
method = FindMethodFromCode(method_idx, this_object, caller_method,
thread, access_check, type);
@@ -349,71 +411,70 @@
return method;
}
-mirror::Object* art_portable_find_static_method_from_code_with_access_check(uint32_t method_idx,
- mirror::Object* this_object,
- mirror::AbstractMethod* referrer,
+Object* art_portable_find_static_method_from_code_with_access_check(uint32_t method_idx,
+ Object* this_object,
+ AbstractMethod* referrer,
Thread* thread)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return FindMethodHelper(method_idx, this_object, referrer, true, kStatic, thread);
}
-mirror::Object* art_portable_find_direct_method_from_code_with_access_check(uint32_t method_idx,
- mirror::Object* this_object,
- mirror::AbstractMethod* referrer,
+Object* art_portable_find_direct_method_from_code_with_access_check(uint32_t method_idx,
+ Object* this_object,
+ AbstractMethod* referrer,
Thread* thread)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return FindMethodHelper(method_idx, this_object, referrer, true, kDirect, thread);
}
-mirror::Object* art_portable_find_virtual_method_from_code_with_access_check(uint32_t method_idx,
- mirror::Object* this_object,
- mirror::AbstractMethod* referrer,
+Object* art_portable_find_virtual_method_from_code_with_access_check(uint32_t method_idx,
+ Object* this_object,
+ AbstractMethod* referrer,
Thread* thread)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return FindMethodHelper(method_idx, this_object, referrer, true, kVirtual, thread);
}
-mirror::Object* art_portable_find_super_method_from_code_with_access_check(uint32_t method_idx,
- mirror::Object* this_object,
- mirror::AbstractMethod* referrer,
+Object* art_portable_find_super_method_from_code_with_access_check(uint32_t method_idx,
+ Object* this_object,
+ AbstractMethod* referrer,
Thread* thread)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return FindMethodHelper(method_idx, this_object, referrer, true, kSuper, thread);
}
-mirror::Object*
-art_portable_find_interface_method_from_code_with_access_check(uint32_t method_idx,
- mirror::Object* this_object,
- mirror::AbstractMethod* referrer,
- Thread* thread)
+Object* art_portable_find_interface_method_from_code_with_access_check(uint32_t method_idx,
+ Object* this_object,
+ AbstractMethod* referrer,
+ Thread* thread)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return FindMethodHelper(method_idx, this_object, referrer, true, kInterface, thread);
}
-mirror::Object* art_portable_find_interface_method_from_code(uint32_t method_idx,
- mirror::Object* this_object,
- mirror::AbstractMethod* referrer,
+Object* art_portable_find_interface_method_from_code(uint32_t method_idx,
+ Object* this_object,
+ AbstractMethod* referrer,
Thread* thread)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return FindMethodHelper(method_idx, this_object, referrer, false, kInterface, thread);
}
-mirror::Object* art_portable_initialize_static_storage_from_code(uint32_t type_idx,
- mirror::AbstractMethod* referrer,
+Object* art_portable_initialize_static_storage_from_code(uint32_t type_idx,
+ AbstractMethod* referrer,
Thread* thread)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return ResolveVerifyAndClinit(type_idx, referrer, thread, true, false);
}
-mirror::Object* art_portable_initialize_type_from_code(uint32_t type_idx,
- mirror::AbstractMethod* referrer,
+Object* art_portable_initialize_type_from_code(uint32_t type_idx,
+ AbstractMethod* referrer,
Thread* thread)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return ResolveVerifyAndClinit(type_idx, referrer, thread, false, false);
}
-mirror::Object* art_portable_initialize_type_and_verify_access_from_code(uint32_t type_idx,
- mirror::AbstractMethod* referrer,
+Object* art_portable_initialize_type_and_verify_access_from_code(uint32_t type_idx,
+ AbstractMethod* referrer,
Thread* thread)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
// Called when caller isn't guaranteed to have access to a type and the dex cache may be
@@ -421,20 +482,29 @@
return ResolveVerifyAndClinit(type_idx, referrer, thread, false, true);
}
-mirror::Object* art_portable_resolve_string_from_code(mirror::AbstractMethod* referrer, uint32_t string_idx)
+Object* art_portable_resolve_string_from_code(AbstractMethod* referrer, uint32_t string_idx)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return ResolveStringFromCode(referrer, string_idx);
}
-int32_t art_portable_set32_static_from_code(uint32_t field_idx, mirror::AbstractMethod* referrer, int32_t new_value)
+int32_t art_portable_set32_static_from_code(uint32_t field_idx,
+ AbstractMethod* referrer,
+ int32_t new_value)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- mirror::Field* field = FindFieldFast(field_idx, referrer, StaticPrimitiveWrite, sizeof(uint32_t));
+ Field* field = FindFieldFast(field_idx,
+ referrer,
+ StaticPrimitiveWrite,
+ sizeof(uint32_t));
if (LIKELY(field != NULL)) {
field->Set32(field->GetDeclaringClass(), new_value);
return 0;
}
- field = FindFieldFromCode(field_idx, referrer, Thread::Current(),
- StaticPrimitiveWrite, sizeof(uint32_t), true);
+ field = FindFieldFromCode(field_idx,
+ referrer,
+ Thread::Current(),
+ StaticPrimitiveWrite,
+ sizeof(uint32_t),
+ true);
if (LIKELY(field != NULL)) {
field->Set32(field->GetDeclaringClass(), new_value);
return 0;
@@ -442,15 +512,21 @@
return -1;
}
-int32_t art_portable_set64_static_from_code(uint32_t field_idx, mirror::AbstractMethod* referrer, int64_t new_value)
+int32_t art_portable_set64_static_from_code(uint32_t field_idx,
+ AbstractMethod* referrer,
+ int64_t new_value)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- mirror::Field* field = FindFieldFast(field_idx, referrer, StaticPrimitiveWrite, sizeof(uint64_t));
+ Field* field = FindFieldFast(field_idx, referrer, StaticPrimitiveWrite, sizeof(uint64_t));
if (LIKELY(field != NULL)) {
field->Set64(field->GetDeclaringClass(), new_value);
return 0;
}
- field = FindFieldFromCode(field_idx, referrer, Thread::Current(),
- StaticPrimitiveWrite, sizeof(uint64_t), true);
+ field = FindFieldFromCode(field_idx,
+ referrer,
+ Thread::Current(),
+ StaticPrimitiveWrite,
+ sizeof(uint64_t),
+ true);
if (LIKELY(field != NULL)) {
field->Set64(field->GetDeclaringClass(), new_value);
return 0;
@@ -458,15 +534,17 @@
return -1;
}
-int32_t art_portable_set_obj_static_from_code(uint32_t field_idx, mirror::AbstractMethod* referrer, mirror::Object* new_value)
+int32_t art_portable_set_obj_static_from_code(uint32_t field_idx,
+ AbstractMethod* referrer,
+ Object* new_value)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- mirror::Field* field = FindFieldFast(field_idx, referrer, StaticObjectWrite, sizeof(mirror::Object*));
+ Field* field = FindFieldFast(field_idx, referrer, StaticObjectWrite, sizeof(Object*));
if (LIKELY(field != NULL)) {
field->SetObj(field->GetDeclaringClass(), new_value);
return 0;
}
field = FindFieldFromCode(field_idx, referrer, Thread::Current(),
- StaticObjectWrite, sizeof(mirror::Object*), true);
+ StaticObjectWrite, sizeof(Object*), true);
if (LIKELY(field != NULL)) {
field->SetObj(field->GetDeclaringClass(), new_value);
return 0;
@@ -474,9 +552,9 @@
return -1;
}
-int32_t art_portable_get32_static_from_code(uint32_t field_idx, mirror::AbstractMethod* referrer)
+int32_t art_portable_get32_static_from_code(uint32_t field_idx, AbstractMethod* referrer)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- mirror::Field* field = FindFieldFast(field_idx, referrer, StaticPrimitiveRead, sizeof(uint32_t));
+ Field* field = FindFieldFast(field_idx, referrer, StaticPrimitiveRead, sizeof(uint32_t));
if (LIKELY(field != NULL)) {
return field->Get32(field->GetDeclaringClass());
}
@@ -488,9 +566,9 @@
return 0;
}
-int64_t art_portable_get64_static_from_code(uint32_t field_idx, mirror::AbstractMethod* referrer)
+int64_t art_portable_get64_static_from_code(uint32_t field_idx, AbstractMethod* referrer)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- mirror::Field* field = FindFieldFast(field_idx, referrer, StaticPrimitiveRead, sizeof(uint64_t));
+ Field* field = FindFieldFast(field_idx, referrer, StaticPrimitiveRead, sizeof(uint64_t));
if (LIKELY(field != NULL)) {
return field->Get64(field->GetDeclaringClass());
}
@@ -502,24 +580,24 @@
return 0;
}
-mirror::Object* art_portable_get_obj_static_from_code(uint32_t field_idx, mirror::AbstractMethod* referrer)
+Object* art_portable_get_obj_static_from_code(uint32_t field_idx, AbstractMethod* referrer)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- mirror::Field* field = FindFieldFast(field_idx, referrer, StaticObjectRead, sizeof(mirror::Object*));
+ Field* field = FindFieldFast(field_idx, referrer, StaticObjectRead, sizeof(Object*));
if (LIKELY(field != NULL)) {
return field->GetObj(field->GetDeclaringClass());
}
field = FindFieldFromCode(field_idx, referrer, Thread::Current(),
- StaticObjectRead, sizeof(mirror::Object*), true);
+ StaticObjectRead, sizeof(Object*), true);
if (LIKELY(field != NULL)) {
return field->GetObj(field->GetDeclaringClass());
}
return 0;
}
-int32_t art_portable_set32_instance_from_code(uint32_t field_idx, mirror::AbstractMethod* referrer,
- mirror::Object* obj, uint32_t new_value)
+int32_t art_portable_set32_instance_from_code(uint32_t field_idx, AbstractMethod* referrer,
+ Object* obj, uint32_t new_value)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- mirror::Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveWrite, sizeof(uint32_t));
+ Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveWrite, sizeof(uint32_t));
if (LIKELY(field != NULL)) {
field->Set32(obj, new_value);
return 0;
@@ -533,10 +611,10 @@
return -1;
}
-int32_t art_portable_set64_instance_from_code(uint32_t field_idx, mirror::AbstractMethod* referrer,
- mirror::Object* obj, int64_t new_value)
+int32_t art_portable_set64_instance_from_code(uint32_t field_idx, AbstractMethod* referrer,
+ Object* obj, int64_t new_value)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- mirror::Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveWrite, sizeof(uint64_t));
+ Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveWrite, sizeof(uint64_t));
if (LIKELY(field != NULL)) {
field->Set64(obj, new_value);
return 0;
@@ -550,16 +628,16 @@
return -1;
}
-int32_t art_portable_set_obj_instance_from_code(uint32_t field_idx, mirror::AbstractMethod* referrer,
- mirror::Object* obj, mirror::Object* new_value)
+int32_t art_portable_set_obj_instance_from_code(uint32_t field_idx, AbstractMethod* referrer,
+ Object* obj, Object* new_value)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- mirror::Field* field = FindFieldFast(field_idx, referrer, InstanceObjectWrite, sizeof(mirror::Object*));
+ Field* field = FindFieldFast(field_idx, referrer, InstanceObjectWrite, sizeof(Object*));
if (LIKELY(field != NULL)) {
field->SetObj(obj, new_value);
return 0;
}
field = FindFieldFromCode(field_idx, referrer, Thread::Current(),
- InstanceObjectWrite, sizeof(mirror::Object*), true);
+ InstanceObjectWrite, sizeof(Object*), true);
if (LIKELY(field != NULL)) {
field->SetObj(obj, new_value);
return 0;
@@ -567,9 +645,9 @@
return -1;
}
-int32_t art_portable_get32_instance_from_code(uint32_t field_idx, mirror::AbstractMethod* referrer, mirror::Object* obj)
+int32_t art_portable_get32_instance_from_code(uint32_t field_idx, AbstractMethod* referrer, Object* obj)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- mirror::Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveRead, sizeof(uint32_t));
+ Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveRead, sizeof(uint32_t));
if (LIKELY(field != NULL)) {
return field->Get32(obj);
}
@@ -581,9 +659,9 @@
return 0;
}
-int64_t art_portable_get64_instance_from_code(uint32_t field_idx, mirror::AbstractMethod* referrer, mirror::Object* obj)
+int64_t art_portable_get64_instance_from_code(uint32_t field_idx, AbstractMethod* referrer, Object* obj)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- mirror::Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveRead, sizeof(uint64_t));
+ Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveRead, sizeof(uint64_t));
if (LIKELY(field != NULL)) {
return field->Get64(obj);
}
@@ -595,22 +673,22 @@
return 0;
}
-mirror::Object* art_portable_get_obj_instance_from_code(uint32_t field_idx, mirror::AbstractMethod* referrer, mirror::Object* obj)
+Object* art_portable_get_obj_instance_from_code(uint32_t field_idx, AbstractMethod* referrer, Object* obj)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- mirror::Field* field = FindFieldFast(field_idx, referrer, InstanceObjectRead, sizeof(mirror::Object*));
+ Field* field = FindFieldFast(field_idx, referrer, InstanceObjectRead, sizeof(Object*));
if (LIKELY(field != NULL)) {
return field->GetObj(obj);
}
field = FindFieldFromCode(field_idx, referrer, Thread::Current(),
- InstanceObjectRead, sizeof(mirror::Object*), true);
+ InstanceObjectRead, sizeof(Object*), true);
if (LIKELY(field != NULL)) {
return field->GetObj(obj);
}
return 0;
}
-void art_portable_fill_array_data_from_code(mirror::AbstractMethod* method, uint32_t dex_pc,
- mirror::Array* array, uint32_t payload_offset)
+void art_portable_fill_array_data_from_code(AbstractMethod* method, uint32_t dex_pc,
+ Array* array, uint32_t payload_offset)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
// Test: Is array equal to null? (Guard NullPointerException)
if (UNLIKELY(array == NULL)) {
@@ -650,14 +728,14 @@
// Type checking, in the nature of casting
//----------------------------------------------------------------------------
-int32_t art_portable_is_assignable_from_code(const mirror::Class* dest_type, const mirror::Class* src_type)
+int32_t art_portable_is_assignable_from_code(const Class* dest_type, const Class* src_type)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(dest_type != NULL);
DCHECK(src_type != NULL);
return dest_type->IsAssignableFrom(src_type) ? 1 : 0;
}
-void art_portable_check_cast_from_code(const mirror::Class* dest_type, const mirror::Class* src_type)
+void art_portable_check_cast_from_code(const Class* dest_type, const Class* src_type)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(dest_type->IsClass()) << PrettyClass(dest_type);
DCHECK(src_type->IsClass()) << PrettyClass(src_type);
@@ -666,17 +744,17 @@
}
}
-void art_portable_check_put_array_element_from_code(const mirror::Object* element,
- const mirror::Object* array)
+void art_portable_check_put_array_element_from_code(const Object* element,
+ const Object* array)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
if (element == NULL) {
return;
}
DCHECK(array != NULL);
- mirror::Class* array_class = array->GetClass();
+ Class* array_class = array->GetClass();
DCHECK(array_class != NULL);
- mirror::Class* component_type = array_class->GetComponentType();
- mirror::Class* element_class = element->GetClass();
+ Class* component_type = array_class->GetComponentType();
+ Class* element_class = element->GetClass();
if (UNLIKELY(!component_type->IsAssignableFrom(element_class))) {
ThrowArrayStoreException(element_class, array_class);
}
@@ -717,19 +795,20 @@
void art_portable_jni_method_end_synchronized(uint32_t saved_local_ref_cookie,
- jobject locked,
- Thread* self)
+ jobject locked,
+ Thread* self)
SHARED_LOCK_FUNCTION(Locks::mutator_lock_) {
self->TransitionFromSuspendedToRunnable();
UnlockJniSynchronizedMethod(locked, self); // Must decode before pop.
PopLocalReferences(saved_local_ref_cookie, self);
}
-mirror::Object* art_portable_jni_method_end_with_reference(jobject result, uint32_t saved_local_ref_cookie,
+Object* art_portable_jni_method_end_with_reference(jobject result,
+ uint32_t saved_local_ref_cookie,
Thread* self)
SHARED_LOCK_FUNCTION(Locks::mutator_lock_) {
self->TransitionFromSuspendedToRunnable();
- mirror::Object* o = self->DecodeJObject(result); // Must decode before pop.
+ Object* o = self->DecodeJObject(result); // Must decode before pop.
PopLocalReferences(saved_local_ref_cookie, self);
// Process result.
if (UNLIKELY(self->GetJniEnv()->check_jni)) {
@@ -741,13 +820,14 @@
return o;
}
-mirror::Object* art_portable_jni_method_end_with_reference_synchronized(jobject result,
+Object* art_portable_jni_method_end_with_reference_synchronized(jobject result,
uint32_t saved_local_ref_cookie,
- jobject locked, Thread* self)
+ jobject locked,
+ Thread* self)
SHARED_LOCK_FUNCTION(Locks::mutator_lock_) {
self->TransitionFromSuspendedToRunnable();
UnlockJniSynchronizedMethod(locked, self); // Must decode before pop.
- mirror::Object* o = self->DecodeJObject(result);
+ Object* o = self->DecodeJObject(result);
PopLocalReferences(saved_local_ref_cookie, self);
// Process result.
if (UNLIKELY(self->GetJniEnv()->check_jni)) {
@@ -762,12 +842,12 @@
// Handler for invocation on proxy methods. Create a boxed argument array and invoke the invocation
// handler which is a field within the proxy object receiver. The var args encode the arguments
// with the last argument being a pointer to a JValue to store the result in.
-void art_portable_proxy_invoke_handler_from_code(mirror::AbstractMethod* proxy_method, ...)
+void art_portable_proxy_invoke_handler_from_code(AbstractMethod* proxy_method, ...)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
va_list ap;
va_start(ap, proxy_method);
- mirror::Object* receiver = va_arg(ap, mirror::Object*);
+ Object* receiver = va_arg(ap, Object*);
Thread* self = va_arg(ap, Thread*);
MethodHelper proxy_mh(proxy_method);
@@ -785,19 +865,19 @@
jobject rcvr_jobj = soa.AddLocalReference<jobject>(receiver);
// Convert proxy method into expected interface method.
- mirror::AbstractMethod* interface_method = proxy_method->FindOverriddenMethod();
+ AbstractMethod* interface_method = proxy_method->FindOverriddenMethod();
DCHECK(interface_method != NULL);
DCHECK(!interface_method->IsProxyMethod()) << PrettyMethod(interface_method);
jobject interface_method_jobj = soa.AddLocalReference<jobject>(interface_method);
- // Record arguments and turn mirror::Object* arguments into jobject to survive GC.
+ // Record arguments and turn Object* arguments into jobject to survive GC.
std::vector<jvalue> args;
const size_t num_params = proxy_mh.NumArgs();
for (size_t i = 1; i < num_params; ++i) {
jvalue val;
switch (proxy_mh.GetParamPrimitiveType(i)) {
case Primitive::kPrimNot:
- val.l = soa.AddLocalReference<jobject>(va_arg(ap, mirror::Object*));
+ val.l = soa.AddLocalReference<jobject>(va_arg(ap, Object*));
break;
case Primitive::kPrimBoolean: // Fall-through.
case Primitive::kPrimByte: // Fall-through.
@@ -843,4 +923,5 @@
void art_portable_constructor_barrier() {
LOG(FATAL) << "Implemented by IRBuilder.";
}
+
} // extern "C"