diff options
-rw-r--r-- | jdwpspy/Net.cpp | 18 | ||||
-rw-r--r-- | src/check_jni.cc | 4 | ||||
-rw-r--r-- | src/class_linker.cc | 4 | ||||
-rw-r--r-- | src/common_test.h | 4 | ||||
-rw-r--r-- | src/compiler/Compiler.h | 38 | ||||
-rw-r--r-- | src/compiler/CompilerIR.h | 34 | ||||
-rw-r--r-- | src/compiler/CompilerUtility.h | 14 | ||||
-rw-r--r-- | src/compiler/codegen/GenInvoke.cc | 2 | ||||
-rw-r--r-- | src/compiler/codegen/Optimizer.h | 3 | ||||
-rw-r--r-- | src/compiler/codegen/Ralloc.h | 2 | ||||
-rw-r--r-- | src/compiler_llvm/compilation_unit.cc | 5 | ||||
-rw-r--r-- | src/debugger.h | 2 | ||||
-rw-r--r-- | src/exception_test.cc | 2 | ||||
-rw-r--r-- | src/hprof/hprof.cc | 13 | ||||
-rw-r--r-- | src/jdwp/jdwp_adb.cc | 10 | ||||
-rw-r--r-- | src/jdwp/jdwp_socket.cc | 24 | ||||
-rw-r--r-- | src/monitor.cc | 6 | ||||
-rw-r--r-- | src/native/dalvik_system_Zygote.cc | 8 | ||||
-rw-r--r-- | src/oat/runtime/oat_support_entrypoints.h | 2 | ||||
-rw-r--r-- | src/oatdump.cc | 1 | ||||
-rw-r--r-- | src/runtime.cc | 2 | ||||
-rw-r--r-- | src/thread.cc | 1 | ||||
-rw-r--r-- | src/trace.cc | 9 | ||||
-rw-r--r-- | src/utils.cc | 20 | ||||
-rw-r--r-- | src/zip_archive.cc | 4 |
25 files changed, 109 insertions, 123 deletions
diff --git a/jdwpspy/Net.cpp b/jdwpspy/Net.cpp index 55515f1..5c789d8 100644 --- a/jdwpspy/Net.cpp +++ b/jdwpspy/Net.cpp @@ -52,7 +52,7 @@ struct NetState { int listenSock; /* connect here to contact VM */ - struct in_addr vmAddr; + in_addr vmAddr; uint16_t vmPort; Peer dbg; @@ -258,12 +258,12 @@ NetState* jdwpNetStartup(uint16_t listenPort, const char* connectHost, uint16_t } } - struct sockaddr_in addr; + sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(listenPort); addr.sin_addr.s_addr = INADDR_ANY; - if (bind(netState->listenSock, (struct sockaddr*) &addr, sizeof(addr)) != 0) + if (bind(netState->listenSock, (sockaddr*) &addr, sizeof(addr)) != 0) { fprintf(stderr, "attempt to bind to port %u failed: %s\n", listenPort, strerror(errno)); @@ -280,7 +280,7 @@ NetState* jdwpNetStartup(uint16_t listenPort, const char* connectHost, uint16_t /* * Do the hostname lookup for the VM. */ - struct hostent* pHost; + hostent* pHost; pHost = gethostbyname(connectHost); if (pHost == NULL) { @@ -289,7 +289,7 @@ NetState* jdwpNetStartup(uint16_t listenPort, const char* connectHost, uint16_t goto fail; } - netState->vmAddr = *((struct in_addr*) pHost->h_addr_list[0]); + netState->vmAddr = *((in_addr*) pHost->h_addr_list[0]); netState->vmPort = connectPort; fprintf(stderr, "+++ connect host resolved to %s\n", @@ -362,7 +362,7 @@ static int setNoDelay(int fd) */ bool jdwpAcceptConnection(NetState* netState) { - struct sockaddr_in addr; + sockaddr_in addr; socklen_t addrlen; int sock; @@ -373,7 +373,7 @@ bool jdwpAcceptConnection(NetState* netState) addrlen = sizeof(addr); do { - sock = accept(netState->listenSock, (struct sockaddr*) &addr, &addrlen); + sock = accept(netState->listenSock, (sockaddr*) &addr, &addrlen); if (sock < 0 && errno != EINTR) { fprintf(stderr, "accept failed: %s\n", strerror(errno)); return false; @@ -455,7 +455,7 @@ static void consumeBytes(Peer* pPeer, int count) static void getCurrentTime(int* pMin, int* pSec) { time_t now; - struct tm* ptm; + tm* ptm; now = time(NULL); ptm = localtime(&now); @@ -683,7 +683,7 @@ fail: */ bool jdwpConnectToVm(NetState* netState) { - struct sockaddr_in addr; + sockaddr_in addr; int sock = -1; sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); diff --git a/src/check_jni.cc b/src/check_jni.cc index 9ae3d47..fb7fa02 100644 --- a/src/check_jni.cc +++ b/src/check_jni.cc @@ -599,7 +599,7 @@ class ScopedCheck { what = "jthrowable"; break; default: - CHECK(false) << static_cast<int>(kind); + LOG(FATAL) << "Unknown kind " << static_cast<int>(kind); } if (java_object == NULL) { @@ -1074,7 +1074,7 @@ struct GuardedCopy { // TODO: we could mprotect instead, and keep the allocation around for a while. // This would be even more expensive, but it might catch more errors. // if (mprotect(fullBuf, totalByteCount, PROT_NONE) != 0) { - // LOGW("mprotect(PROT_NONE) failed: %s", strerror(errno)); + // PLOG(WARNING) << "mprotect(PROT_NONE) failed"; // } if (munmap(fullBuf, totalByteCount) != 0) { PLOG(FATAL) << "munmap(" << reinterpret_cast<void*>(fullBuf) << ", " << totalByteCount << ") failed"; diff --git a/src/class_linker.cc b/src/class_linker.cc index 656032b..1edfe1a 100644 --- a/src/class_linker.cc +++ b/src/class_linker.cc @@ -1686,7 +1686,7 @@ const DexFile& ClassLinker::FindDexFile(const DexCache* dex_cache) const { return *dex_files_[i]; } } - CHECK(false) << "Failed to find DexFile for DexCache " << dex_cache->GetLocation()->ToModifiedUtf8(); + LOG(FATAL) << "Failed to find DexFile for DexCache " << dex_cache->GetLocation()->ToModifiedUtf8(); return *dex_files_[-1]; } @@ -1697,7 +1697,7 @@ DexCache* ClassLinker::FindDexCache(const DexFile& dex_file) const { return dex_caches_[i]; } } - CHECK(false) << "Failed to find DexCache for DexFile " << dex_file.GetLocation(); + LOG(FATAL) << "Failed to find DexCache for DexFile " << dex_file.GetLocation(); return NULL; } diff --git a/src/common_test.h b/src/common_test.h index 9f17e1d..3b31bd4 100644 --- a/src/common_test.h +++ b/src/common_test.h @@ -390,8 +390,8 @@ class CommonTest : public testing::Test { DIR* dir = opendir(art_cache_.c_str()); ASSERT_TRUE(dir != NULL); while (true) { - struct dirent entry; - struct dirent* entry_ptr; + dirent entry; + dirent* entry_ptr; int readdir_result = readdir_r(dir, &entry, &entry_ptr); ASSERT_EQ(0, readdir_result); if (entry_ptr == NULL) { diff --git a/src/compiler/Compiler.h b/src/compiler/Compiler.h index 6d62f29..db7f2ba 100644 --- a/src/compiler/Compiler.h +++ b/src/compiler/Compiler.h @@ -170,34 +170,26 @@ bool oatArchInit(void); bool oatStartup(void); void oatShutdown(void); void oatScanAllClassPointers(void (*callback)(void* ptr)); -void oatInitializeSSAConversion(struct CompilationUnit* cUnit); -int SRegToVReg(const struct CompilationUnit* cUnit, int ssaReg); -int SRegToSubscript(const struct CompilationUnit* cUnit, int ssaReg); -bool oatFindLocalLiveIn(struct CompilationUnit* cUnit, - struct BasicBlock* bb); -bool oatDoSSAConversion(struct CompilationUnit* cUnit, - struct BasicBlock* bb); -bool oatDoConstantPropagation(struct CompilationUnit* cUnit, - struct BasicBlock* bb); -bool oatFindInductionVariables(struct CompilationUnit* cUnit, - struct BasicBlock* bb); +void oatInitializeSSAConversion(CompilationUnit* cUnit); +int SRegToVReg(const CompilationUnit* cUnit, int ssaReg); +int SRegToSubscript(const CompilationUnit* cUnit, int ssaReg); +bool oatFindLocalLiveIn(CompilationUnit* cUnit, BasicBlock* bb); +bool oatDoSSAConversion(CompilationUnit* cUnit, BasicBlock* bb); +bool oatDoConstantPropagation(CompilationUnit* cUnit, BasicBlock* bb); +bool oatFindInductionVariables(CompilationUnit* cUnit, BasicBlock* bb); /* Clear the visited flag for each BB */ -bool oatClearVisitedFlag(struct CompilationUnit* cUnit, - struct BasicBlock* bb); -char* oatGetDalvikDisassembly(CompilationUnit* cUnit, - const DecodedInstruction& insn, +bool oatClearVisitedFlag(CompilationUnit* cUnit, BasicBlock* bb); +char* oatGetDalvikDisassembly(CompilationUnit* cUnit, const DecodedInstruction& insn, const char* note); -char* oatFullDisassembler(struct CompilationUnit* cUnit, - const struct MIR* mir); -char* oatGetSSAString(struct CompilationUnit* cUnit, - struct SSARepresentation* ssaRep); -void oatDataFlowAnalysisDispatcher(struct CompilationUnit* cUnit, - bool (*func)(struct CompilationUnit* , struct BasicBlock*), +char* oatFullDisassembler(CompilationUnit* cUnit, const MIR* mir); +char* oatGetSSAString(CompilationUnit* cUnit, SSARepresentation* ssaRep); +void oatDataFlowAnalysisDispatcher(CompilationUnit* cUnit, + bool (*func)(CompilationUnit* , BasicBlock*), DataFlowAnalysisMode dfaMode, bool isIterative); -void oatMethodSSATransformation(struct CompilationUnit* cUnit); +void oatMethodSSATransformation(CompilationUnit* cUnit); u8 oatGetRegResourceMask(int reg); -void oatDumpCFG(struct CompilationUnit* cUnit, const char* dirPrefix); +void oatDumpCFG(CompilationUnit* cUnit, const char* dirPrefix); void oatProcessSwitchTables(CompilationUnit* cUnit); bool oatIsFpReg(int reg); uint32_t oatFpRegMask(void); diff --git a/src/compiler/CompilerIR.h b/src/compiler/CompilerIR.h index 88593bd..67d741a 100644 --- a/src/compiler/CompilerIR.h +++ b/src/compiler/CompilerIR.h @@ -91,8 +91,8 @@ struct RegisterInfo { bool live; // Is there an associated SSA name? bool dirty; // If live, is it dirty? int sReg; // Name of live value - struct LIR *defStart; // Starting inst in last def sequence - struct LIR *defEnd; // Ending inst in last def sequence + LIR *defStart; // Starting inst in last def sequence + LIR *defEnd; // Ending inst in last def sequence }; struct RegisterPool { @@ -143,9 +143,9 @@ enum BBType { struct LIR { int offset; // Offset of this instruction int dalvikOffset; // Offset of Dalvik opcode - struct LIR* next; - struct LIR* prev; - struct LIR* target; + LIR* next; + LIR* prev; + LIR* target; int opcode; int operands[5]; // [0..4] = [dest, src1, src2, extra, extra2] struct { @@ -213,9 +213,9 @@ struct MIR { DecodedInstruction dalvikInsn; unsigned int width; unsigned int offset; - struct MIR* prev; - struct MIR* next; - struct SSARepresentation* ssaRep; + MIR* prev; + MIR* next; + SSARepresentation* ssaRep; int optimizationFlags; int seqNum; union { @@ -224,7 +224,7 @@ struct MIR { // Used by the inlined invoke to find the class and method pointers CallsiteInfo* callsiteInfo; // Used to quickly locate all Phi opcodes - struct MIR* phiNext; + MIR* phiNext; } meta; }; @@ -253,10 +253,10 @@ struct BasicBlock { bool isFallThroughFromInvoke; // True means the block needs alignment MIR* firstMIRInsn; MIR* lastMIRInsn; - struct BasicBlock* fallThrough; - struct BasicBlock* taken; - struct BasicBlock* iDom; // Immediate dominator - struct BasicBlockDataFlow* dataFlowInfo; + BasicBlock* fallThrough; + BasicBlock* taken; + BasicBlock* iDom; // Immediate dominator + BasicBlockDataFlow* dataFlowInfo; GrowableList* predecessors; ArenaBitVector* dominators; ArenaBitVector* iDominated; // Set nodes being immediately dominated @@ -425,7 +425,7 @@ struct CompilationUnit { bool qdMode; // Compile for code size/compile time bool usesLinkRegister; // For self-verification only bool methodTraceSupport; // For TraceView profiling - struct RegisterPool* regPool; + RegisterPool* regPool; int optRound; // round number to tell an LIR's age InstructionSet instructionSet; /* Number of total regs used in the whole cUnit after SSA transformation */ @@ -529,10 +529,10 @@ struct CompilationUnit { std::string compilerMethodMatch; // Flips sense of compilerMethodMatch - apply flags if doesn't match. bool compilerFlipMatch; - struct ArenaMemBlock* arenaHead; - struct ArenaMemBlock* currentArena; + ArenaMemBlock* arenaHead; + ArenaMemBlock* currentArena; int numArenaBlocks; - struct Memstats* mstats; + Memstats* mstats; int* opcodeCount; // Count Dalvik opcodes for tuning #ifndef NDEBUG /* diff --git a/src/compiler/CompilerUtility.h b/src/compiler/CompilerUtility.h index f7b9b0e..4a15f26 100644 --- a/src/compiler/CompilerUtility.h +++ b/src/compiler/CompilerUtility.h @@ -33,7 +33,7 @@ bool oatHeapInit(CompilationUnit* cUnit); struct ArenaMemBlock { size_t blockSize; size_t bytesAllocated; - struct ArenaMemBlock *next; + ArenaMemBlock *next; char ptr[0]; }; @@ -87,9 +87,10 @@ struct ArenaBitVectorIterator { #define BLOCK_NAME_LEN 80 /* Forward declarations */ -struct LIR; struct BasicBlock; struct CompilationUnit; +struct LIR; +struct RegLocation; void oatInitGrowableList(CompilationUnit* cUnit,GrowableList* gList, size_t initLength, oatListKind kind = kListMisc); @@ -124,14 +125,13 @@ bool oatCompareBitVectors(const ArenaBitVector* src1, bool oatTestBitVectors(const ArenaBitVector* src1, const ArenaBitVector* src2); int oatCountSetBits(const ArenaBitVector* pBits); -void oatDumpLIRInsn(CompilationUnit* cUnit, struct LIR* lir, - unsigned char* baseAddr); -void oatDumpResourceMask(struct LIR* lir, u8 mask, const char* prefix); +void oatDumpLIRInsn(CompilationUnit* cUnit, LIR* lir, unsigned char* baseAddr); +void oatDumpResourceMask(LIR* lir, u8 mask, const char* prefix); void oatDumpBlockBitVector(const GrowableList* blocks, char* msg, const ArenaBitVector* bv, int length); -void oatGetBlockName(struct BasicBlock* bb, char* name); +void oatGetBlockName(BasicBlock* bb, char* name); const char* oatGetShortyFromTargetIdx(CompilationUnit*, int); -void oatDumpRegLocTable(struct RegLocation*, int); +void oatDumpRegLocTable(RegLocation*, int); void oatDumpMemStats(CompilationUnit* cUnit); } // namespace art diff --git a/src/compiler/codegen/GenInvoke.cc b/src/compiler/codegen/GenInvoke.cc index a904419..b986e78 100644 --- a/src/compiler/codegen/GenInvoke.cc +++ b/src/compiler/codegen/GenInvoke.cc @@ -884,7 +884,7 @@ bool genIntrinsic(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir, * method. By doing this during basic block construction, we can also * take advantage of/generate new useful dataflow info. */ - std::string tgtMethod = PrettyMethod(mir->dalvikInsn.vB, *cUnit->dex_file); + std::string tgtMethod(PrettyMethod(mir->dalvikInsn.vB, *cUnit->dex_file)); if (tgtMethod.compare("char java.lang.String.charAt(int)") == 0) { return genInlinedCharAt(cUnit, bb, mir, type, isRange); } diff --git a/src/compiler/codegen/Optimizer.h b/src/compiler/codegen/Optimizer.h index 06c7732..94b1907 100644 --- a/src/compiler/codegen/Optimizer.h +++ b/src/compiler/codegen/Optimizer.h @@ -25,8 +25,7 @@ namespace art { struct CompilationUnit; struct LIR; -void oatApplyLocalOptimizations(struct CompilationUnit* cUnit, - struct LIR* head, struct LIR* tail); +void oatApplyLocalOptimizations(CompilationUnit* cUnit, LIR* head, LIR* tail); } // namespace art diff --git a/src/compiler/codegen/Ralloc.h b/src/compiler/codegen/Ralloc.h index 2169082..671dffe 100644 --- a/src/compiler/codegen/Ralloc.h +++ b/src/compiler/codegen/Ralloc.h @@ -95,7 +95,7 @@ extern void oatResetDef(CompilationUnit* cUnit, int reg); extern void oatResetDefLoc(CompilationUnit* cUnit, RegLocation rl); /* Set up temp & preserved register pools specialized by target */ -extern void oatInitPool(struct RegisterInfo* regs, int* regNums, int num); +extern void oatInitPool(RegisterInfo* regs, int* regNums, int num); /* * Mark the beginning and end LIR of a def sequence. Note that diff --git a/src/compiler_llvm/compilation_unit.cc b/src/compiler_llvm/compilation_unit.cc index 9c1f8d0..166d2f6 100644 --- a/src/compiler_llvm/compilation_unit.cc +++ b/src/compiler_llvm/compilation_unit.cc @@ -205,7 +205,7 @@ class ScopedTempFile { }; bool CompilationUnit::Materialize() { - const std::string tmp_file = "/tmp/art-llvm-XXXXXX"; + const std::string tmp_file("/tmp/art-llvm-XXXXXX"); // Prepare the input ScopedTempFile input(tmp_file); @@ -238,8 +238,7 @@ bool CompilationUnit::Materialize() { insn_set_))); } else { if (pid < 0) { - LOG(FATAL) << "Failed to fork a process to do the compilation: " - << strerror(errno); + PLOG(FATAL) << "Failed to fork a process to do the compilation"; } // Free the resources diff --git a/src/debugger.h b/src/debugger.h index 6c50e9e..89aac8e 100644 --- a/src/debugger.h +++ b/src/debugger.h @@ -242,7 +242,7 @@ class Dbg { static void DdmDisconnected(); static void DdmSendChunk(uint32_t type, const std::vector<uint8_t>& bytes); static void DdmSendChunk(uint32_t type, size_t len, const uint8_t* buf); - static void DdmSendChunkV(uint32_t type, const struct iovec* iov, int iov_count); + static void DdmSendChunkV(uint32_t type, const iovec* iov, int iov_count); /* * Recent allocation tracking support. diff --git a/src/exception_test.cc b/src/exception_test.cc index c83557d..4d4ffd4 100644 --- a/src/exception_test.cc +++ b/src/exception_test.cc @@ -83,7 +83,7 @@ TEST_F(ExceptionTest, FindCatchHandler) { ASSERT_EQ(2u, code_item->tries_size_); ASSERT_NE(0u, code_item->insns_size_in_code_units_); - const struct DexFile::TryItem *t0, *t1; + const DexFile::TryItem *t0, *t1; t0 = dex_->GetTryItems(*code_item, 0); t1 = dex_->GetTryItems(*code_item, 1); EXPECT_LE(t0->start_addr_, t1->start_addr_); diff --git a/src/hprof/hprof.cc b/src/hprof/hprof.cc index d6771d0..ccebca5 100644 --- a/src/hprof/hprof.cc +++ b/src/hprof/hprof.cc @@ -70,8 +70,7 @@ Hprof::Hprof(const char* outputFileName, int fd, bool writeHeader, bool directTo FILE *fp = open_memstream(&file_data_ptr_, &file_data_size_); if (fp == NULL) { // not expected - LOG(ERROR) << StringPrintf("hprof: open_memstream failed: %s", strerror(errno)); - CHECK(false); + PLOG(FATAL) << "open_memstream failed"; } direct_to_ddms_ = directToDdms; @@ -95,7 +94,7 @@ Hprof::Hprof(const char* outputFileName, int fd, bool writeHeader, bool directTo fwrite(buf, 1, sizeof(uint32_t), fp); // The current time, in milliseconds since 0:00 GMT, 1/1/70. - struct timeval now; + timeval now; uint64_t nowMs; if (gettimeofday(&now, NULL) < 0) { nowMs = 0; @@ -512,7 +511,7 @@ int sysWriteFully(int fd, const void* buf, size_t count, const char* logMsg) { ssize_t actual = TEMP_FAILURE_RETRY(write(fd, buf, count)); if (actual < 0) { int err = errno; - LOG(ERROR) << StringPrintf("%s: write failed: %s", logMsg, strerror(err)); + PLOG(ERROR) << StringPrintf("%s: write failed", logMsg); return err; } else if (actual != (ssize_t) count) { LOG(DEBUG) << StringPrintf("%s: partial write (will retry): (%d of %zd)", @@ -555,7 +554,7 @@ bool Hprof::Finish() { if (direct_to_ddms_) { // send the data off to DDMS - struct iovec iov[2]; + iovec iov[2]; iov[0].iov_base = headCtx.file_data_ptr_; iov[0].iov_len = headCtx.file_data_size_; iov[1].iov_base = file_data_ptr_; @@ -569,13 +568,13 @@ bool Hprof::Finish() { if (headCtx.fd_ >= 0) { outFd = dup(headCtx.fd_); if (outFd < 0) { - LOG(ERROR) << StringPrintf("dup(%d) failed: %s", headCtx.fd_, strerror(errno)); + PLOG(ERROR) << StringPrintf("dup(%d) failed", headCtx.fd_); // continue to fail-handler below } } else { outFd = open(file_name_.c_str(), O_WRONLY|O_CREAT|O_TRUNC, 0644); if (outFd < 0) { - LOG(ERROR) << StringPrintf("can't open %s: %s", headCtx.file_name_.c_str(), strerror(errno)); + PLOG(ERROR) << StringPrintf("can't open \"%s\"", headCtx.file_name_.c_str()); // continue to fail-handler below } } diff --git a/src/jdwp/jdwp_adb.cc b/src/jdwp/jdwp_adb.cc index ae45f18..096ebc7 100644 --- a/src/jdwp/jdwp_adb.cc +++ b/src/jdwp/jdwp_adb.cc @@ -69,8 +69,8 @@ struct JdwpNetState : public JdwpNetStateBase { socklen_t controlAddrLen; union { - struct sockaddr_un controlAddrUn; - struct sockaddr controlAddrPlain; + sockaddr_un controlAddrUn; + sockaddr controlAddrPlain; } controlAddr; JdwpNetState() { @@ -138,12 +138,12 @@ static bool startup(JdwpState* state, const JdwpOptions*) { * closes netState->controlSock. */ static int receiveClientFd(JdwpNetState* netState) { - struct msghdr msg; - struct cmsghdr* cmsg; + msghdr msg; + cmsghdr* cmsg; iovec iov; char dummy = '!'; union { - struct cmsghdr cm; + cmsghdr cm; char buffer[CMSG_SPACE(sizeof(int))]; } cm_un; int ret; diff --git a/src/jdwp/jdwp_socket.cc b/src/jdwp/jdwp_socket.cc index 88af4ac..9ff50f5 100644 --- a/src/jdwp/jdwp_socket.cc +++ b/src/jdwp/jdwp_socket.cc @@ -59,7 +59,7 @@ struct JdwpNetState : public JdwpNetStateBase { int listenSock; /* listen for connection from debugger */ int wakePipe[2]; /* break out of select */ - struct in_addr remoteAddr; + in_addr remoteAddr; uint16_t remotePort; bool awaitingHandshake; /* waiting for "JDWP-Handshake" */ @@ -159,8 +159,8 @@ static JdwpNetState* netStartup(uint16_t port, bool probe) { } union { - struct sockaddr_in addrInet; - struct sockaddr addrPlain; + sockaddr_in addrInet; + sockaddr addrPlain; } addr; addr.addrInet.sin_family = AF_INET; addr.addrInet.sin_port = htons(port); @@ -271,7 +271,7 @@ static bool isConnected(JdwpState* state) { static bool isFdReadable(int sock) { fd_set readfds; - struct timeval tv; + timeval tv; int count; FD_ZERO(&readfds); @@ -332,8 +332,8 @@ static bool acceptConnection(JdwpState* state) { JdwpNetState* netState = state->netState; union { - struct sockaddr_in addrInet; - struct sockaddr addrPlain; + sockaddr_in addrInet; + sockaddr addrPlain; } addr; socklen_t addrlen; int sock; @@ -385,10 +385,10 @@ static bool acceptConnection(JdwpState* state) */ static bool establishConnection(JdwpState* state) { union { - struct sockaddr_in addrInet; - struct sockaddr addrPlain; + sockaddr_in addrInet; + sockaddr addrPlain; } addr; - struct hostent* pEntry; + hostent* pEntry; CHECK(state != NULL && state->netState != NULL); CHECK(!state->options_->server); @@ -401,7 +401,7 @@ static bool establishConnection(JdwpState* state) { //#undef HAVE_GETHOSTBYNAME_R //#warning "forcing non-R" #ifdef HAVE_GETHOSTBYNAME_R - struct hostent he; + hostent he; char auxBuf[128]; int error; int cc = gethostbyname_r(state->options_->host.c_str(), &he, auxBuf, sizeof(auxBuf), &pEntry, &error); @@ -705,8 +705,8 @@ static bool processIncoming(JdwpState* state) { if (netState->listenSock >= 0 && FD_ISSET(netState->listenSock, &readfds)) { LOG(INFO) << "Ignoring second debugger -- accepting and dropping"; union { - struct sockaddr_in addrInet; - struct sockaddr addrPlain; + sockaddr_in addrInet; + sockaddr addrPlain; } addr; socklen_t addrlen; int tmpSock; diff --git a/src/monitor.cc b/src/monitor.cc index a42770e..e18d854 100644 --- a/src/monitor.cc +++ b/src/monitor.cc @@ -348,7 +348,7 @@ static void ToAbsoluteTime(int64_t ms, int32_t ns, struct timespec *ts) { clock_gettime(CLOCK_MONOTONIC, ts); #else { - struct timeval tv; + timeval tv; gettimeofday(&tv, NULL); ts->tv_sec = tv.tv_sec; ts->tv_nsec = tv.tv_usec * 1000; @@ -409,7 +409,7 @@ void Monitor::Wait(Thread* self, int64_t ms, int32_t ns, bool interruptShouldThr } // Compute absolute wakeup time, if necessary. - struct timespec ts; + timespec ts; bool timed = false; if (ms != 0 || ns != 0) { ToAbsoluteTime(ms, ns, &ts); @@ -588,7 +588,7 @@ void Monitor::Inflate(Thread* self, Object* obj) { void Monitor::MonitorEnter(Thread* self, Object* obj) { volatile int32_t* thinp = obj->GetRawLockWordAddress(); - struct timespec tm; + timespec tm; uint32_t sleepDelayNs; uint32_t minSleepDelayNs = 1000000; /* 1 millisecond */ uint32_t maxSleepDelayNs = 1000000000; /* 1 second */ diff --git a/src/native/dalvik_system_Zygote.cc b/src/native/dalvik_system_Zygote.cc index c46f949..ac4c3c8 100644 --- a/src/native/dalvik_system_Zygote.cc +++ b/src/native/dalvik_system_Zygote.cc @@ -153,7 +153,7 @@ static int SetRLimits(JNIEnv* env, jobjectArray javaRlimits) { return 0; } - struct rlimit rlim; + rlimit rlim; memset(&rlim, 0, sizeof(rlim)); for (int i = 0; i < env->GetArrayLength(javaRlimits); i++) { @@ -177,8 +177,8 @@ static int SetRLimits(JNIEnv* env, jobjectArray javaRlimits) { #if defined(HAVE_ANDROID_OS) static void SetCapabilities(int64_t permitted, int64_t effective) { - struct __user_cap_header_struct capheader; - struct __user_cap_data_struct capdata; + __user_cap_header_struct capheader; + __user_cap_data_struct capdata; memset(&capheader, 0, sizeof(capheader)); memset(&capdata, 0, sizeof(capdata)); @@ -238,7 +238,7 @@ static void EnableDebugFeatures(uint32_t debug_flags) { if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) < 0) { PLOG(ERROR) << "could not set dumpable bit flag for pid " << getpid(); } else { - struct rlimit rl; + rlimit rl; rl.rlim_cur = 0; rl.rlim_max = RLIM_INFINITY; if (setrlimit(RLIMIT_CORE, &rl) < 0) { diff --git a/src/oat/runtime/oat_support_entrypoints.h b/src/oat/runtime/oat_support_entrypoints.h index b585255..edf5575 100644 --- a/src/oat/runtime/oat_support_entrypoints.h +++ b/src/oat/runtime/oat_support_entrypoints.h @@ -26,6 +26,7 @@ namespace art { class Class; +class DvmDex; class Method; class Thread; @@ -118,7 +119,6 @@ struct PACKED EntryPoints { void* (*pMemcpy)(void*, const void*, size_t); // Invocation - Method* (*pFindInterfaceMethodInCache)(Class*, uint32_t, const Method*, struct DvmDex*); const void* (*pUnresolvedDirectMethodTrampolineFromCode)(Method*, Method**, Thread*, Runtime::TrampolineType); void (*pInvokeDirectTrampolineWithAccessCheck)(uint32_t, void*); diff --git a/src/oatdump.cc b/src/oatdump.cc index 94941c4..ea2e711 100644 --- a/src/oatdump.cc +++ b/src/oatdump.cc @@ -214,7 +214,6 @@ class OatDumper { DUMP_ENTRY_POINT(pMemcmp16); DUMP_ENTRY_POINT(pStringCompareTo); DUMP_ENTRY_POINT(pMemcpy); - DUMP_ENTRY_POINT(pFindInterfaceMethodInCache); DUMP_ENTRY_POINT(pUnresolvedDirectMethodTrampolineFromCode); DUMP_ENTRY_POINT(pInvokeDirectTrampolineWithAccessCheck); DUMP_ENTRY_POINT(pInvokeInterfaceTrampoline); diff --git a/src/runtime.cc b/src/runtime.cc index 25789ab..37887e2 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -818,7 +818,7 @@ int32_t Runtime::GetStat(int kind) { case KIND_EXT_FREED_BYTES: return 0; // backward compatibility default: - CHECK(false); + LOG(FATAL) << "Unknown statistic " << kind; return -1; // unreachable } } diff --git a/src/thread.cc b/src/thread.cc index 5eeb730..e839d36 100644 --- a/src/thread.cc +++ b/src/thread.cc @@ -1633,7 +1633,6 @@ void Thread::DumpThreadOffset(std::ostream& os, uint32_t offset, size_t size_of_ DO_THREAD_ENTRY_POINT_OFFSET(pMemcmp16) DO_THREAD_ENTRY_POINT_OFFSET(pStringCompareTo) DO_THREAD_ENTRY_POINT_OFFSET(pMemcpy) - DO_THREAD_ENTRY_POINT_OFFSET(pFindInterfaceMethodInCache) DO_THREAD_ENTRY_POINT_OFFSET(pUnresolvedDirectMethodTrampolineFromCode) DO_THREAD_ENTRY_POINT_OFFSET(pInvokeDirectTrampolineWithAccessCheck) DO_THREAD_ENTRY_POINT_OFFSET(pInvokeInterfaceTrampoline) diff --git a/src/trace.cc b/src/trace.cc index e84e7c3..7b7a767 100644 --- a/src/trace.cc +++ b/src/trace.cc @@ -345,7 +345,7 @@ void Trace::FinishTracing() { std::string header(os.str()); if (trace_file_.get() == NULL) { - struct iovec iov[2]; + iovec iov[2]; iov[0].iov_base = reinterpret_cast<void*>(const_cast<char*>(header.c_str())); iov[0].iov_len = header.length(); iov[1].iov_base = buf_.get(); @@ -354,10 +354,9 @@ void Trace::FinishTracing() { } else { if (!trace_file_->WriteFully(header.c_str(), header.length()) || !trace_file_->WriteFully(buf_.get(), final_offset)) { - int err = errno; - LOG(ERROR) << "Trace data write failed: " << strerror(err); - Thread::Current()->ThrowNewException("Ljava/lang/RuntimeException;", - StringPrintf("Trace data write failed: %s", strerror(err)).c_str()); + std::string detail(StringPrintf("Trace data write failed: %s", strerror(errno))); + PLOG(ERROR) << detail; + Thread::Current()->ThrowNewException("Ljava/lang/RuntimeException;", detail.c_str()); } } } diff --git a/src/utils.cc b/src/utils.cc index ea50073..dc1ebff 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -87,8 +87,8 @@ bool ReadFileToString(const std::string& file_name, std::string* result) { std::string GetIsoDate() { time_t now = time(NULL); - struct tm tmbuf; - struct tm* ptm = localtime_r(&now, &tmbuf); + tm tmbuf; + tm* ptm = localtime_r(&now, &tmbuf); return StringPrintf("%04d-%02d-%02d %02d:%02d:%02d", ptm->tm_year + 1900, ptm->tm_mon+1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec); @@ -96,11 +96,11 @@ std::string GetIsoDate() { uint64_t MilliTime() { #if defined(HAVE_POSIX_CLOCKS) - struct timespec now; + timespec now; clock_gettime(CLOCK_MONOTONIC, &now); return static_cast<uint64_t>(now.tv_sec) * 1000LL + now.tv_nsec / 1000000LL; #else - struct timeval now; + timeval now; gettimeofday(&now, NULL); return static_cast<uint64_t>(now.tv_sec) * 1000LL + now.tv_usec / 1000LL; #endif @@ -108,11 +108,11 @@ uint64_t MilliTime() { uint64_t MicroTime() { #if defined(HAVE_POSIX_CLOCKS) - struct timespec now; + timespec now; clock_gettime(CLOCK_MONOTONIC, &now); return static_cast<uint64_t>(now.tv_sec) * 1000000LL + now.tv_nsec / 1000LL; #else - struct timeval now; + timeval now; gettimeofday(&now, NULL); return static_cast<uint64_t>(now.tv_sec) * 1000000LL + now.tv_usec; #endif @@ -120,11 +120,11 @@ uint64_t MicroTime() { uint64_t NanoTime() { #if defined(HAVE_POSIX_CLOCKS) - struct timespec now; + timespec now; clock_gettime(CLOCK_MONOTONIC, &now); return static_cast<uint64_t>(now.tv_sec) * 1000000000LL + now.tv_nsec; #else - struct timeval now; + timeval now; gettimeofday(&now, NULL); return static_cast<uint64_t>(now.tv_sec) * 1000000000LL + now.tv_usec * 1000LL; #endif @@ -132,7 +132,7 @@ uint64_t NanoTime() { uint64_t ThreadCpuMicroTime() { #if defined(HAVE_POSIX_CLOCKS) - struct timespec now; + timespec now; clock_gettime(CLOCK_THREAD_CPUTIME_ID, &now); return static_cast<uint64_t>(now.tv_sec) * 1000000LL + now.tv_nsec / 1000LL; #else @@ -143,7 +143,7 @@ uint64_t ThreadCpuMicroTime() { uint64_t ThreadCpuNanoTime() { #if defined(HAVE_POSIX_CLOCKS) - struct timespec now; + timespec now; clock_gettime(CLOCK_THREAD_CPUTIME_ID, &now); return static_cast<uint64_t>(now.tv_sec) * 1000000000LL + now.tv_nsec; #else diff --git a/src/zip_archive.cc b/src/zip_archive.cc index 5e6b4eb..70a6261 100644 --- a/src/zip_archive.cc +++ b/src/zip_archive.cc @@ -378,12 +378,12 @@ bool ZipArchive::MapCentralDirectory() { off_t search_start = file_length - read_amount; if (lseek(fd_, search_start, SEEK_SET) != search_start) { - LOG(WARNING) << "Zip: seek " << search_start << " failed: " << strerror(errno); + PLOG(WARNING) << "Zip: seek " << search_start << " failed"; return false; } ssize_t actual = TEMP_FAILURE_RETRY(read(fd_, scan_buf.get(), read_amount)); if (actual == -1) { - LOG(WARNING) << "Zip: read " << read_amount << " failed: " << strerror(errno); + PLOG(WARNING) << "Zip: read " << read_amount << " failed"; return false; } |