本文整理汇总了C++中dvmUnlockMutex函数的典型用法代码示例。如果您正苦于以下问题:C++ dvmUnlockMutex函数的具体用法?C++ dvmUnlockMutex怎么用?C++ dvmUnlockMutex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dvmUnlockMutex函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dvmVisitRoots
/*
* Visits roots. TODO: visit cached global references.
*/
void dvmVisitRoots(RootVisitor *visitor, void *arg)
{
assert(visitor != NULL);
//u4 t0 = dvmGetRelativeTimeMsec();
#ifndef FASTIVA_PRELOAD_STATIC_INSTANCE
visitHashTable(visitor, gDvm.loadedClasses, ROOT_STICKY_CLASS, arg);
visitPrimitiveTypes(visitor, arg);
#endif
if (gDvm.dbgRegistry != NULL) {
visitHashTable(visitor, gDvm.dbgRegistry, ROOT_DEBUGGER, arg);
}
if (gDvm.literalStrings != NULL) {
visitHashTable(visitor, gDvm.literalStrings, ROOT_INTERNED_STRING, arg);
}
dvmLockMutex(&gDvm.jniGlobalRefLock);
visitIndirectRefTable(visitor, &gDvm.jniGlobalRefTable, 0, ROOT_JNI_GLOBAL, arg);
dvmUnlockMutex(&gDvm.jniGlobalRefLock);
dvmLockMutex(&gDvm.jniPinRefLock);
visitReferenceTable(visitor, &gDvm.jniPinRefTable, 0, ROOT_VM_INTERNAL, arg);
dvmUnlockMutex(&gDvm.jniPinRefLock);
visitThreads(visitor, arg);
(*visitor)(&gDvm.outOfMemoryObj, 0, ROOT_VM_INTERNAL, arg);
(*visitor)(&gDvm.internalErrorObj, 0, ROOT_VM_INTERNAL, arg);
(*visitor)(&gDvm.noClassDefFoundErrorObj, 0, ROOT_VM_INTERNAL, arg);
#ifdef FASTIVA
(*visitor)(&kernelData.g_pAnnotationsList, 0, ROOT_VM_INTERNAL, arg);
#endif
}
开发者ID:zeedh,项目名称:fastiva,代码行数:32,代码来源:Visit.cpp
示例2: dvmHeapWorkerStartup
/*
* Crank up the heap worker thread.
*
* Does not return until the thread is ready for business.
*/
bool dvmHeapWorkerStartup(void)
{
assert(!gDvm.haltHeapWorker);
assert(!gDvm.heapWorkerReady);
assert(gDvm.heapWorkerHandle == 0);
assert(gDvm.heapWorkerInitialized);
/* use heapWorkerLock/heapWorkerCond to communicate readiness */
dvmLockMutex(&gDvm.heapWorkerLock);
//BUG: If a GC happens in here or in the new thread while we hold the lock,
// the GC will deadlock when trying to acquire heapWorkerLock.
if (!dvmCreateInternalThread(&gDvm.heapWorkerHandle,
"HeapWorker", heapWorkerThreadStart, NULL))
{
dvmUnlockMutex(&gDvm.heapWorkerLock);
return false;
}
/*
* Wait for the heap worker to come up. We know the thread was created,
* so this should not get stuck.
*/
while (!gDvm.heapWorkerReady) {
dvmWaitCond(&gDvm.heapWorkerCond, &gDvm.heapWorkerLock);
}
dvmUnlockMutex(&gDvm.heapWorkerLock);
return true;
}
开发者ID:AndDiSa,项目名称:GB-platform_dalvik,代码行数:35,代码来源:HeapWorker.c
示例3: dvmThreadInterrupt
/*
* Implement java.lang.Thread.interrupt().
*/
void dvmThreadInterrupt(Thread* thread)
{
assert(thread != NULL);
dvmLockMutex(&thread->waitMutex);
/*
* If the interrupted flag is already set no additional action is
* required.
*/
if (thread->interrupted == true) {
dvmUnlockMutex(&thread->waitMutex);
return;
}
/*
* Raise the "interrupted" flag. This will cause it to bail early out
* of the next wait() attempt, if it's not currently waiting on
* something.
*/
thread->interrupted = true;
/*
* Is the thread waiting?
*
* Note that fat vs. thin doesn't matter here; waitMonitor
* is only set when a thread actually waits on a monitor,
* which implies that the monitor has already been fattened.
*/
if (thread->waitMonitor != NULL) {
pthread_cond_signal(&thread->waitCond);
}
dvmUnlockMutex(&thread->waitMutex);
}
开发者ID:1mobilesuper,项目名称:platform_dalvik,代码行数:38,代码来源:Sync.cpp
示例4: notifyMonitor
/*
* Notify one thread waiting on this monitor.
*/
static void notifyMonitor(Thread* self, Monitor* mon)
{
Thread* thread;
assert(self != NULL);
assert(mon != NULL);
/* Make sure that we hold the lock. */
if (mon->owner != self) {
dvmThrowIllegalMonitorStateException(
"object not locked by thread before notify()");
return;
}
/* Signal the first waiting thread in the wait set. */
while (mon->waitSet != NULL) {
thread = mon->waitSet;
mon->waitSet = thread->waitNext;
thread->waitNext = NULL;
dvmLockMutex(&thread->waitMutex);
/* Check to see if the thread is still waiting. */
if (thread->waitMonitor != NULL) {
pthread_cond_signal(&thread->waitCond);
dvmUnlockMutex(&thread->waitMutex);
return;
}
dvmUnlockMutex(&thread->waitMutex);
}
}
开发者ID:1mobilesuper,项目名称:platform_dalvik,代码行数:31,代码来源:Sync.cpp
示例5: dvmCompilerUpdateGlobalState
void dvmCompilerUpdateGlobalState()
{
bool jitActive;
bool jitActivate;
bool needUnchain = false;
/*
* The tableLock might not be initialized yet by the compiler thread if
* debugger is attached from the very beginning of the VM launch. If
* pProfTableCopy is NULL, the lock is not initialized yet and we don't
* need to refresh anything either.
*/
if (gDvmJit.pProfTableCopy == NULL) {
return;
}
/*
* On the first enabling of method tracing, switch the compiler
* into a mode that includes trace support for invokes and returns.
* If there are any existing translations, flush them. NOTE: we
* can't blindly flush the translation cache because this code
* may be executed before the compiler thread has finished
* initialization.
*/
if ((gDvm.activeProfilers != 0) &&
!gDvmJit.methodTraceSupport) {
bool resetRequired;
/*
* compilerLock will prevent new compilations from being
* installed while we are working.
*/
dvmLockMutex(&gDvmJit.compilerLock);
gDvmJit.cacheVersion++; // invalidate compilations in flight
gDvmJit.methodTraceSupport = true;
resetRequired = (gDvmJit.numCompilations != 0);
dvmUnlockMutex(&gDvmJit.compilerLock);
if (resetRequired) {
dvmSuspendAllThreads(SUSPEND_FOR_CC_RESET);
resetCodeCache();
dvmResumeAllThreads(SUSPEND_FOR_CC_RESET);
}
}
dvmLockMutex(&gDvmJit.tableLock);
jitActive = gDvmJit.pProfTable != NULL;
jitActivate = !dvmDebuggerOrProfilerActive();
if (jitActivate && !jitActive) {
gDvmJit.pProfTable = gDvmJit.pProfTableCopy;
} else if (!jitActivate && jitActive) {
gDvmJit.pProfTable = NULL;
needUnchain = true;
}
dvmUnlockMutex(&gDvmJit.tableLock);
if (needUnchain)
dvmJitUnchainAll();
// Make sure all threads have current values
dvmJitUpdateThreadStateAll();
}
开发者ID:ElijahLuk,项目名称:platform_dalvik,代码行数:59,代码来源:Compiler.cpp
示例6: dvmCompilerWorkEnqueue
/*
* Attempt to enqueue a work order, returning true if successful.
*
* NOTE: Make sure that the caller frees the info pointer if the return value
* is false.
*/
bool dvmCompilerWorkEnqueue(const u2 *pc, WorkOrderKind kind, void* info)
{
int cc;
int i;
int numWork;
bool result = true;
dvmLockMutex(&gDvmJit.compilerLock);
/*
* Return if queue or code cache is full.
*/
if (gDvmJit.compilerQueueLength == COMPILER_WORK_QUEUE_SIZE ||
gDvmJit.codeCacheFull == true) {
dvmUnlockMutex(&gDvmJit.compilerLock);
return false;
}
for (numWork = gDvmJit.compilerQueueLength,
i = gDvmJit.compilerWorkDequeueIndex;
numWork > 0;
numWork--) {
/* Already enqueued */
if (gDvmJit.compilerWorkQueue[i++].pc == pc) {
dvmUnlockMutex(&gDvmJit.compilerLock);
return true;
}
/* Wrap around */
if (i == COMPILER_WORK_QUEUE_SIZE)
i = 0;
}
CompilerWorkOrder *newOrder =
&gDvmJit.compilerWorkQueue[gDvmJit.compilerWorkEnqueueIndex];
newOrder->pc = pc;
newOrder->kind = kind;
newOrder->info = info;
newOrder->result.methodCompilationAborted = false;
newOrder->result.codeAddress = NULL;
newOrder->result.discardResult =
(kind == kWorkOrderTraceDebug) ? true : false;
newOrder->result.cacheVersion = gDvmJit.cacheVersion;
newOrder->result.requestingThread = dvmThreadSelf();
gDvmJit.compilerWorkEnqueueIndex++;
if (gDvmJit.compilerWorkEnqueueIndex == COMPILER_WORK_QUEUE_SIZE)
gDvmJit.compilerWorkEnqueueIndex = 0;
gDvmJit.compilerQueueLength++;
cc = pthread_cond_signal(&gDvmJit.compilerQueueActivity);
assert(cc == 0);
dvmUnlockMutex(&gDvmJit.compilerLock);
return result;
}
开发者ID:ElijahLuk,项目名称:platform_dalvik,代码行数:60,代码来源:Compiler.cpp
示例7: dvmCompilerStartup
/**
* Jit编译器入口点函数
* @retval 0 表示失败
* @retval 1 表示成功
*/
bool dvmCompilerStartup(void)
{
/* 初始化一些线程同步方面的变量 */
dvmInitMutex(&gDvmJit.compilerLock);
dvmInitMutex(&gDvmJit.compilerICPatchLock);
dvmInitMutex(&gDvmJit.codeCacheProtectionLock);
dvmLockMutex(&gDvmJit.compilerLock);
pthread_cond_init(&gDvmJit.compilerQueueActivity, NULL);
pthread_cond_init(&gDvmJit.compilerQueueEmpty, NULL);
/* Reset the work queue */
/* 设置工作队列 */
gDvmJit.compilerWorkEnqueueIndex = gDvmJit.compilerWorkDequeueIndex = 0;
gDvmJit.compilerQueueLength = 0;
dvmUnlockMutex(&gDvmJit.compilerLock);
/*
* Defer rest of initialization until we're sure JIT'ng makes sense. Launch
* the compiler thread, which will do the real initialization if and
* when it is signalled to do so.
*/
/*
* 以下这个函数创建compilerThreadStart编译线程,当这条线程会执行真正的初始化工作
*/
return dvmCreateInternalThread(&gDvmJit.compilerHandle, "Compiler",
compilerThreadStart, NULL);
}
开发者ID:4dogs,项目名称:aprotector,代码行数:32,代码来源:Compiler.cpp
示例8: dvmLinearAllocDump
/*
* For debugging, dump the contents of a linear alloc area.
*
* We grab the lock so that the header contents and list output are
* consistent.
*/
void dvmLinearAllocDump(Object* classLoader)
{
#ifdef DISABLE_LINEAR_ALLOC
return;
#endif
LinearAllocHdr* pHdr = getHeader(classLoader);
dvmLockMutex(&pHdr->lock);
LOGI("LinearAlloc classLoader=%p\n", classLoader);
LOGI(" mapAddr=%p mapLength=%d firstOffset=%d\n",
pHdr->mapAddr, pHdr->mapLength, pHdr->firstOffset);
LOGI(" curOffset=%d\n", pHdr->curOffset);
int off = pHdr->firstOffset;
u4 rawLen, fullLen;
while (off < pHdr->curOffset) {
rawLen = *(u4*) (pHdr->mapAddr + off);
fullLen = ((HEADER_EXTRA*2 + (rawLen & LENGTHFLAG_MASK))
& ~(BLOCK_ALIGN-1));
LOGI(" %p (%3d): %clen=%d%s\n", pHdr->mapAddr + off + HEADER_EXTRA,
(int) ((off + HEADER_EXTRA) / PAGESIZE),
(rawLen & LENGTHFLAG_FREE) != 0 ? '*' : ' ',
rawLen & LENGTHFLAG_MASK,
(rawLen & LENGTHFLAG_RW) != 0 ? " [RW]" : "");
off += fullLen;
}
if (ENFORCE_READ_ONLY) {
LOGI("writeRefCount map:\n");
int numPages = (pHdr->mapLength+PAGESIZE-1) / PAGESIZE;
int zstart = 0;
int i;
for (i = 0; i < numPages; i++) {
int count = pHdr->writeRefCount[i];
if (count != 0) {
if (zstart < i-1)
printf(" %d-%d: zero\n", zstart, i-1);
else if (zstart == i-1)
printf(" %d: zero\n", zstart);
zstart = i+1;
printf(" %d: %d\n", i, count);
}
}
if (zstart < i)
printf(" %d-%d: zero\n", zstart, i-1);
}
LOGD("LinearAlloc %p using %d of %d (%d%%)\n",
classLoader, pHdr->curOffset, pHdr->mapLength,
(pHdr->curOffset * 100) / pHdr->mapLength);
dvmUnlockMutex(&pHdr->lock);
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:66,代码来源:LinearAlloc.c
示例9: unlockMonitor
/*
* Unlock a monitor.
*
* Returns true if the unlock succeeded.
* If the unlock failed, an exception will be pending.
*/
static bool unlockMonitor(Thread* self, Monitor* mon)
{
assert(self != NULL);
assert(mon != NULL);
if (mon->owner == self) {
/*
* We own the monitor, so nobody else can be in here.
*/
if (mon->lockCount == 0) {
mon->owner = NULL;
mon->ownerMethod = NULL;
mon->ownerPc = 0;
dvmUnlockMutex(&mon->lock);
} else {
mon->lockCount--;
}
} else {
/*
* We don't own this, so we're not allowed to unlock it.
* The JNI spec says that we should throw IllegalMonitorStateException
* in this case.
*/
dvmThrowIllegalMonitorStateException("unlock of unowned monitor");
return false;
}
return true;
}
开发者ID:1mobilesuper,项目名称:platform_dalvik,代码行数:33,代码来源:Sync.cpp
示例10: checkAllFree
/*
* Verify that all blocks are freed.
*
* This should only be done as we're shutting down, but there could be a
* daemon thread that's still trying to do something, so we grab the locks.
*/
static void checkAllFree(Object* classLoader)
{
#ifdef DISABLE_LINEAR_ALLOC
return;
#endif
LinearAllocHdr* pHdr = getHeader(classLoader);
dvmLockMutex(&pHdr->lock);
int off = pHdr->firstOffset;
u4 rawLen, fullLen;
while (off < pHdr->curOffset) {
rawLen = *(u4*) (pHdr->mapAddr + off);
fullLen = ((HEADER_EXTRA*2 + (rawLen & LENGTHFLAG_MASK))
& ~(BLOCK_ALIGN-1));
if ((rawLen & LENGTHFLAG_FREE) == 0) {
LOGW("LinearAlloc %p not freed: %p len=%d\n", classLoader,
pHdr->mapAddr + off + HEADER_EXTRA, rawLen & LENGTHFLAG_MASK);
}
off += fullLen;
}
dvmUnlockMutex(&pHdr->lock);
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:33,代码来源:LinearAlloc.c
示例11: dvmDexChangeDex2
/*
Change the 2-byte value at the specified address to a new value. If the
location already has the new value, do nothing.
Otherwise works like dvmDexChangeDex1.
在指定位置改变一个双字节值为新值。如果该位置已经有新值,不作任何事情。
否则处理类似dvmDexChangeDex1。
*/
bool dvmDexChangeDex2(DvmDex* pDvmDex, u2* addr, u2 newVal)
{
if (*addr == newVal) {
ALOGV("+++ value at %p is already 0x%04x", addr, newVal);
return true;
}
/*
* We're not holding this for long, so we don't bother with switching
* to VMWAIT.
*/
dvmLockMutex(&pDvmDex->modLock);
ALOGV("+++ change 2byte at %p from 0x%04x to 0x%04x", addr, *addr, newVal);
if (sysChangeMapAccess(addr, 2, true, &pDvmDex->memMap) != 0) {
ALOGD("NOTE: DEX page access change (->RW) failed");
/* expected on files mounted from FAT; keep going (may crash) */
}
*addr = newVal;
if (sysChangeMapAccess(addr, 2, false, &pDvmDex->memMap) != 0) {
ALOGD("NOTE: DEX page access change (->RO) failed");
/* expected on files mounted from FAT; keep going */
}
dvmUnlockMutex(&pDvmDex->modLock);
return true;
}
开发者ID:4dogs,项目名称:aprotector,代码行数:40,代码来源:DvmDex.cpp
示例12: lookupInternedString
static StringObject* lookupInternedString(StringObject* strObj, bool isLiteral)
{
StringObject* found;
assert(strObj != NULL);
u4 key = dvmComputeStringHash(strObj);
dvmLockMutex(&gDvm.internLock);
if (isLiteral) {
/*
* Check the literal table for a match.
*/
StringObject* literal = lookupString(gDvm.literalStrings, key, strObj);
if (literal != NULL) {
/*
* A match was found in the literal table, the easy case.
*/
found = literal;
} else {
/*
* There is no match in the literal table, check the
* interned string table.
*/
StringObject* interned = lookupString(gDvm.internedStrings, key, strObj);
if (interned != NULL) {
/*
* A match was found in the interned table. Move the
* matching string to the literal table.
*/
dvmHashTableRemove(gDvm.internedStrings, key, interned);
found = insertString(gDvm.literalStrings, key, interned);
assert(found == interned);
} else {
/*
* No match in the literal table or the interned
* table. Insert into the literal table.
*/
found = insertString(gDvm.literalStrings, key, strObj);
assert(found == strObj);
}
}
} else {
/*
* Check the literal table for a match.
*/
found = lookupString(gDvm.literalStrings, key, strObj);
if (found == NULL) {
/*
* No match was found in the literal table. Insert into
* the intern table if it does not already exist.
*/
found = insertString(gDvm.internedStrings, key, strObj);
}
}
assert(found != NULL);
dvmUnlockMutex(&gDvm.internLock);
return found;
}
开发者ID:0omega,项目名称:platform_dalvik,代码行数:57,代码来源:Intern.cpp
示例13: gcDaemonShutdown
static void gcDaemonShutdown()
{
if (gHs->hasGcThread) {
dvmLockMutex(&gHs->gcThreadMutex);
gHs->gcThreadShutdown = true;
dvmSignalCond(&gHs->gcThreadCond);
dvmUnlockMutex(&gHs->gcThreadMutex);
pthread_join(gHs->gcThread, NULL);
}
}
开发者ID:sawrus,项目名称:dalvik,代码行数:10,代码来源:HeapSource.cpp
示例14: dvmGcDetachDeadInternedStrings
/*
* Clear white references from the intern table.
*/
void dvmGcDetachDeadInternedStrings(int (*isUnmarkedObject)(void *))
{
/* It's possible for a GC to happen before dvmStringInternStartup()
* is called.
*/
if (gDvm.internedStrings != NULL) {
dvmLockMutex(&gDvm.internLock);
dvmHashForeachRemove(gDvm.internedStrings, isUnmarkedObject);
dvmUnlockMutex(&gDvm.internLock);
}
}
开发者ID:0omega,项目名称:platform_dalvik,代码行数:14,代码来源:Intern.cpp
示例15: dvmIsWeakInternedString
/*
* Returns true if the object is a weak interned string. Any string
* interned by the user is weak.
*/
bool dvmIsWeakInternedString(StringObject* strObj)
{
assert(strObj != NULL);
if (gDvm.internedStrings == NULL) {
return false;
}
dvmLockMutex(&gDvm.internLock);
u4 key = dvmComputeStringHash(strObj);
StringObject* found = lookupString(gDvm.internedStrings, key, strObj);
dvmUnlockMutex(&gDvm.internLock);
return found == strObj;
}
开发者ID:0omega,项目名称:platform_dalvik,代码行数:16,代码来源:Intern.cpp
示例16: dvmStdioConverterStartup
/*
* Crank up the stdout/stderr converter thread.
*
* Returns immediately.
*/
bool dvmStdioConverterStartup()
{
gDvm.haltStdioConverter = false;
dvmInitMutex(&gDvm.stdioConverterLock);
pthread_cond_init(&gDvm.stdioConverterCond, NULL);
if (pipe(gDvm.stdoutPipe) != 0) {
ALOGW("pipe failed: %s", strerror(errno));
return false;
}
if (pipe(gDvm.stderrPipe) != 0) {
ALOGW("pipe failed: %s", strerror(errno));
return false;
}
if (dup2(gDvm.stdoutPipe[1], kFilenoStdout) != kFilenoStdout) {
ALOGW("dup2(1) failed: %s", strerror(errno));
return false;
}
close(gDvm.stdoutPipe[1]);
gDvm.stdoutPipe[1] = -1;
#ifdef HAVE_ANDROID_OS
/* don't redirect stderr on sim -- logs get written there! */
/* (don't need this on the sim anyway) */
if (dup2(gDvm.stderrPipe[1], kFilenoStderr) != kFilenoStderr) {
ALOGW("dup2(2) failed: %d %s", errno, strerror(errno));
return false;
}
close(gDvm.stderrPipe[1]);
gDvm.stderrPipe[1] = -1;
#endif
/*
* Create the thread.
*/
dvmLockMutex(&gDvm.stdioConverterLock);
if (!dvmCreateInternalThread(&gDvm.stdioConverterHandle,
"Stdio Converter",
stdioConverterThreadStart,
NULL)) {
return false;
}
while (!gDvm.stdioConverterReady) {
dvmWaitCond(&gDvm.stdioConverterCond, &gDvm.stdioConverterLock);
}
dvmUnlockMutex(&gDvm.stdioConverterLock);
return true;
}
开发者ID:XClouded,项目名称:fastiva,代码行数:58,代码来源:StdioConverter.cpp
示例17: dvmSignalHeapWorker
/*
* Wake up the heap worker to let it know that there's work to be done.
*/
void dvmSignalHeapWorker(bool shouldLock)
{
if (shouldLock) {
dvmLockMutex(&gDvm.heapWorkerLock);
}
dvmSignalCond(&gDvm.heapWorkerCond);
if (shouldLock) {
dvmUnlockMutex(&gDvm.heapWorkerLock);
}
}
开发者ID:AndDiSa,项目名称:GB-platform_dalvik,代码行数:15,代码来源:HeapWorker.c
示例18: dvmCompilerShutdown
/**
* 关闭Jit编译器
*/
void dvmCompilerShutdown(void)
{
void *threadReturn;
/* Disable new translation requests */
/* 关闭新的编译请求 */
gDvmJit.pProfTable = NULL;
gDvmJit.pProfTableCopy = NULL;
dvmJitUpdateThreadStateAll(); /* 更新所有线程状态 */
/*
* 以下代码应该是检测在虚拟机关闭之前等待所有编译工作队列完成
* dvmCompilerDumpStats()函数应该会更新所有工作队列的当前状态
* gDvmJit.compilerQueueLength会随着这个函数进行更新,这个常数
* 即是当前工作队列的数量。
*/
if (gDvm.verboseShutdown ||
gDvmJit.profileMode == kTraceProfilingContinuous) {
dvmCompilerDumpStats();
while (gDvmJit.compilerQueueLength)
sleep(5);
}
/* 如果编译器工作线程存在 */
if (gDvmJit.compilerHandle) {
gDvmJit.haltCompilerThread = true; /* 设置关闭标志为true */
/* 发送关闭信号 */
dvmLockMutex(&gDvmJit.compilerLock);
pthread_cond_signal(&gDvmJit.compilerQueueActivity);
dvmUnlockMutex(&gDvmJit.compilerLock);
/* 关闭compilerThreadStart线程 */
if (pthread_join(gDvmJit.compilerHandle, &threadReturn) != 0)
ALOGW("Compiler thread join failed");
else if (gDvm.verboseShutdown)
ALOGD("Compiler thread has shut down");
}
/* Break loops within the translation cache */
dvmJitUnchainAll();
/*
* NOTE: our current implementatation doesn't allow for the compiler
* thread to be restarted after it exits here. We aren't freeing
* the JitTable or the ProfTable because threads which still may be
* running or in the process of shutting down may hold references to
*
* them.
*/
}
开发者ID:4dogs,项目名称:aprotector,代码行数:55,代码来源:Compiler.cpp
示例19: callMethod
static void callMethod(Thread *self, Object *obj, Method *method)
{
JValue unused;
/* Keep track of the method we're about to call and
* the current time so that other threads can detect
* when this thread wedges and provide useful information.
*/
gDvm.gcHeap->heapWorkerInterpStartTime = dvmGetRelativeTimeUsec();
gDvm.gcHeap->heapWorkerInterpCpuStartTime = dvmGetThreadCpuTimeUsec();
gDvm.gcHeap->heapWorkerCurrentMethod = method;
gDvm.gcHeap->heapWorkerCurrentObject = obj;
/* Call the method.
*
* Don't hold the lock when executing interpreted
* code. It may suspend, and the GC needs to grab
* heapWorkerLock.
*/
dvmUnlockMutex(&gDvm.heapWorkerLock);
if (false) {
/* Log entry/exit; this will likely flood the log enough to
* cause "logcat" to drop entries.
*/
char tmpTag[16];
sprintf(tmpTag, "HW%d", self->systemTid);
LOG(LOG_DEBUG, tmpTag, "Call %s\n", method->clazz->descriptor);
dvmCallMethod(self, method, obj, &unused);
LOG(LOG_DEBUG, tmpTag, " done\n");
} else {
dvmCallMethod(self, method, obj, &unused);
}
/*
* Reacquire the heap worker lock in a suspend-friendly way.
*/
lockMutex(&gDvm.heapWorkerLock);
gDvm.gcHeap->heapWorkerCurrentObject = NULL;
gDvm.gcHeap->heapWorkerCurrentMethod = NULL;
gDvm.gcHeap->heapWorkerInterpStartTime = 0LL;
/* Exceptions thrown during these calls interrupt
* the method, but are otherwise ignored.
*/
if (dvmCheckException(self)) {
#if DVM_SHOW_EXCEPTION >= 1
LOGI("Uncaught exception thrown by finalizer (will be discarded):\n");
dvmLogExceptionStackTrace();
#endif
dvmClearException(self);
}
}
开发者ID:AndDiSa,项目名称:GB-platform_dalvik,代码行数:52,代码来源:HeapWorker.c
示例20: Dalvik_dalvik_system_VMRuntime_startJitCompilation
/*
* public native void startJitCompilation()
*
* Callback function from the framework to indicate that an app has gone
* through the startup phase and it is time to enable the JIT compiler.
*/
static void Dalvik_dalvik_system_VMRuntime_startJitCompilation(const u4* args,
JValue* pResult)
{
#if defined(WITH_JIT)
if (gDvm.executionMode == kExecutionModeJit &&
gDvmJit.disableJit == false) {
dvmLockMutex(&gDvmJit.compilerLock);
gDvmJit.alreadyEnabledViaFramework = true;
pthread_cond_signal(&gDvmJit.compilerQueueActivity);
dvmUnlockMutex(&gDvmJit.compilerLock);
}
#endif
RETURN_VOID();
}
开发者ID:onyx-intl,项目名称:p400_dalvik,代码行数:20,代码来源:dalvik_system_VMRuntime.c
注:本文中的dvmUnlockMutex函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论