本文整理汇总了C++中LOGVV函数的典型用法代码示例。如果您正苦于以下问题:C++ LOGVV函数的具体用法?C++ LOGVV怎么用?C++ LOGVV使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOGVV函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dvmMterpStdRun
/*
* C mterp entry point. This just calls the various C fallbacks, making
* this a slow but portable interpeter.
*
* This is only used for the "allstubs" variant.
*/
void dvmMterpStdRun(Thread* self)
{
jmp_buf jmpBuf;
self->interpSave.bailPtr = &jmpBuf;
/* We exit via a longjmp */
if (setjmp(jmpBuf)) {
LOGVV("mterp threadid=%d returning", dvmThreadSelf()->threadId);
return;
}
/* run until somebody longjmp()s out */
while (true) {
typedef void (*Handler)(Thread* self);
u2 inst = /*self->interpSave.*/pc[0];
/*
* In mterp, dvmCheckBefore is handled via the altHandlerTable,
* while in the portable interpreter it is part of the handler
* FINISH code. For allstubs, we must do an explicit check
* in the interpretation loop.
*/
if (self->interpBreak.ctl.subMode) {
dvmCheckBefore(pc, fp, self);
}
Handler handler = (Handler) gDvmMterpHandlers[inst & 0xff];
(void) gDvmMterpHandlerNames; /* avoid gcc "defined but not used" */
LOGVV("handler %p %s",
handler, (const char*) gDvmMterpHandlerNames[inst & 0xff]);
(*handler)(self);
}
}
开发者ID:hhhaiai,项目名称:JNI,代码行数:39,代码来源:entry.cpp
示例2: check_nic_compatibility
/* Certain VI functionalities are only supported on certain NIC types.
* This function validates that the requested functionality is present
* on the selected NIC. */
static int check_nic_compatibility(unsigned vi_flags, unsigned ef_vi_arch)
{
switch (ef_vi_arch) {
case EFHW_ARCH_FALCON:
if (vi_flags & EF_VI_TX_PUSH_ALWAYS) {
LOGVV(ef_log("%s: ERROR: TX PUSH ALWAYS flag not supported"
" on FALCON architecture", __FUNCTION__));
return -EOPNOTSUPP;
}
if (vi_flags & EF_VI_RX_TIMESTAMPS) {
LOGVV(ef_log("%s: ERROR: RX TIMESTAMPS flag not supported"
" on FALCON architecture", __FUNCTION__));
return -EOPNOTSUPP;
}
if (vi_flags & EF_VI_TX_TIMESTAMPS) {
LOGVV(ef_log("%s: ERROR: TX TIMESTAMPS flag not supported"
" on FALCON architecture", __FUNCTION__));
return -EOPNOTSUPP;
}
return 0;
case EFHW_ARCH_EF10:
return 0;
default:
return -EINVAL;
}
}
开发者ID:davenso,项目名称:openonload,代码行数:31,代码来源:pt_endpoint.c
示例3: dvmConvertArgument
/*
* Convert types and widen primitives. Puts the value of "arg" into
* "destPtr".
*
* Returns the width of the argument in 32-bit words (1 or 2), or -1 on error.
*/
int dvmConvertArgument(DataObject* arg, ClassObject* type, s4* destPtr)
{
int retVal;
if (dvmIsPrimitiveClass(type)) {
/* e.g.: "arg" is java/lang/Float instance, "type" is VM float class */
PrimitiveType srcType;
s4* valuePtr;
srcType = getBoxedType(arg);
if (srcType == PRIM_NOT) { // didn't pass a boxed primitive in
LOGVV("conv arg: type '%s' not boxed primitive",
arg->clazz->descriptor);
return -1;
}
/* assumes value is stored in first instance field */
valuePtr = (s4*) arg->instanceData;
retVal = dvmConvertPrimitiveValue(srcType, type->primitiveType,
valuePtr, destPtr);
} else {
/* verify object is compatible */
if ((arg == NULL) || dvmInstanceof(arg->clazz, type)) {
*destPtr = (s4) arg;
retVal = 1;
} else {
LOGVV("Arg %p (%s) not compatible with %s",
arg, arg->clazz->descriptor, type->descriptor);
retVal = -1;
}
}
return retVal;
}
开发者ID:1mobilesuper,项目名称:platform_dalvik,代码行数:41,代码来源:Reflect.cpp
示例4: dvmMterpStd
/*
* "Standard" mterp entry point. This sets up a "glue" structure and then
* calls into the assembly interpreter implementation.
*
* (There is presently no "debug" entry point.)
*/
bool dvmMterpStd(Thread* self, InterpState* glue)
{
int changeInterp;
/* configure mterp items */
glue->self = self;
glue->methodClassDex = glue->method->clazz->pDvmDex;
glue->interpStackEnd = self->interpStackEnd;
glue->pSelfSuspendCount = &self->suspendCount;
glue->cardTable = gDvm.biasedCardTableBase;
#if defined(WITH_JIT)
glue->pJitProfTable = gDvmJit.pProfTable;
glue->ppJitProfTable = &gDvmJit.pProfTable;
glue->jitThreshold = gDvmJit.threshold;
#endif
if (gDvm.jdwpConfigured) {
glue->pDebuggerActive = &gDvm.debuggerActive;
} else {
glue->pDebuggerActive = NULL;
}
glue->pActiveProfilers = &gDvm.activeProfilers;
IF_LOGVV() {
char* desc = dexProtoCopyMethodDescriptor(&glue->method->prototype);
LOGVV("mterp threadid=%d entry %d: %s.%s %s\n",
dvmThreadSelf()->threadId,
glue->entryPoint,
glue->method->clazz->descriptor,
glue->method->name,
desc);
free(desc);
}
//LOGI("glue is %p, pc=%p, fp=%p\n", glue, glue->pc, glue->fp);
//LOGI("first instruction is 0x%04x\n", glue->pc[0]);
changeInterp = dvmMterpStdRun(glue);
#if defined(WITH_JIT)
if (glue->jitState != kJitSingleStep) {
glue->self->inJitCodeCache = NULL;
}
#endif
if (!changeInterp) {
/* this is a "normal" exit; we're not coming back */
#ifdef LOG_INSTR
LOGD("|-- Leaving interpreter loop");
#endif
return false;
} else {
/* we're "standard", so switch to "debug" */
LOGVV(" mterp returned, changeInterp=%d\n", changeInterp);
glue->nextMode = INTERP_DBG;
return true;
}
}
开发者ID:AndDiSa,项目名称:GB-platform_dalvik,代码行数:63,代码来源:Mterp.c
示例5: dvmResolveInstField
/*
* Resolve an instance field reference.
*
* Returns NULL and throws an exception on error (no such field, illegal
* access).
*/
InstField* dvmResolveInstField(const ClassObject* referrer, u4 ifieldIdx)
{
DvmDex* pDvmDex = referrer->pDvmDex;
ClassObject* resClass;
const DexFieldId* pFieldId;
InstField* resField;
LOGVV("--- resolving field %u (referrer=%s cl=%p)",
ifieldIdx, referrer->descriptor, referrer->classLoader);
pFieldId = dexGetFieldId(pDvmDex->pDexFile, ifieldIdx);
/*
* Find the field's class.
*/
resClass = dvmResolveClass(referrer, pFieldId->classIdx, false);
if (resClass == NULL) {
assert(dvmCheckException(dvmThreadSelf()));
return NULL;
}
resField = dvmFindInstanceFieldHier(resClass,
dexStringById(pDvmDex->pDexFile, pFieldId->nameIdx),
dexStringByTypeIdx(pDvmDex->pDexFile, pFieldId->typeIdx));
if (resField == NULL) {
dvmThrowNoSuchFieldError(
dexStringById(pDvmDex->pDexFile, pFieldId->nameIdx));
return NULL;
}
/*
* Class must be initialized by now (unless verifier is buggy). We
* could still be in the process of initializing it if the field
* access is from a static initializer.
*/
assert(dvmIsClassInitialized(resField->clazz) ||
dvmIsClassInitializing(resField->clazz));
/*
* The class is initialized (or initializing), the field has been
* found. Add a pointer to our data structure so we don't have to
* jump through the hoops again.
*
* Anything that uses the resolved table entry must have an instance
* of the class, so any class init activity has already happened (or
* been deliberately bypassed when <clinit> created an instance).
* So it's always okay to update the table.
*/
dvmDexSetResolvedField(pDvmDex, ifieldIdx, (Field*)resField);
LOGVV(" field %u is %s.%s",
ifieldIdx, resField->clazz->descriptor, resField->name);
return resField;
}
开发者ID:handgod,项目名称:soma,代码行数:60,代码来源:Resolve.cpp
示例6: dvmFindClassByName
/*
* Find a class by name, initializing it if requested.
*/
ClassObject* dvmFindClassByName(StringObject* nameObj, Object* loader,
bool doInit)
{
ClassObject* clazz = NULL;
char* name = NULL;
char* descriptor = NULL;
if (nameObj == NULL) {
dvmThrowException("Ljava/lang/NullPointerException;", NULL);
goto bail;
}
name = dvmCreateCstrFromString(nameObj);
/*
* We need to validate and convert the name (from x.y.z to x/y/z). This
* is especially handy for array types, since we want to avoid
* auto-generating bogus array classes.
*/
if (!validateClassName(name)) {
LOGW("dvmFindClassByName rejecting '%s'\n", name);
dvmThrowException("Ljava/lang/ClassNotFoundException;", name);
goto bail;
}
descriptor = dvmDotToDescriptor(name);
if (descriptor == NULL) {
goto bail;
}
if (doInit)
clazz = dvmFindClass(descriptor, loader);
else
clazz = dvmFindClassNoInit(descriptor, loader);
if (clazz == NULL) {
LOGVV("FAIL: load %s (%d)\n", descriptor, doInit);
Thread* self = dvmThreadSelf();
Object* oldExcep = dvmGetException(self);
dvmAddTrackedAlloc(oldExcep, self); /* don't let this be GCed */
dvmClearException(self);
dvmThrowChainedException("Ljava/lang/ClassNotFoundException;",
name, oldExcep);
dvmReleaseTrackedAlloc(oldExcep, self);
} else {
LOGVV("GOOD: load %s (%d) --> %p ldr=%p\n",
descriptor, doInit, clazz, clazz->classLoader);
}
bail:
free(name);
free(descriptor);
return clazz;
}
开发者ID:AndDiSa,项目名称:GB-platform_dalvik,代码行数:56,代码来源:InternalNative.c
示例7: dvmJitHandlePackedSwitch
/* return the number of bytes to increase the bytecode pointer by */
s4 dvmJitHandlePackedSwitch(const s4* entries, s4 firstKey, u2 size, s4 testVal)
{
if (testVal < firstKey || testVal >= firstKey + size) {
LOGVV("Value %d not found in switch (%d-%d)",
testVal, firstKey, firstKey+size-1);
return 2*3;//bytecode packed_switch is 6(2*3) bytes long
}
LOGVV("Value %d found in slot %d (goto 0x%02x)",
testVal, testVal - firstKey,
s4FromSwitchData(&entries[testVal - firstKey]));
return 2*s4FromSwitchData(&entries[testVal - firstKey]); //convert from u2 to byte
}
开发者ID:1mobilesuper,项目名称:platform_dalvik,代码行数:15,代码来源:NcgHelper.cpp
示例8: dvmIterativeSleep
/*
* Call this repeatedly, with successively higher values for "iteration",
* to sleep for a period of time not to exceed "maxTotalSleep".
*
* For example, when called with iteration==0 we will sleep for a very
* brief time. On the next call we will sleep for a longer time. When
* the sum total of all sleeps reaches "maxTotalSleep", this returns false.
*
* The initial start time value for "relStartTime" MUST come from the
* dvmGetRelativeTimeUsec call. On the device this must come from the
* monotonic clock source, not the wall clock.
*
* This should be used wherever you might be tempted to call sched_yield()
* in a loop. The problem with sched_yield is that, for a high-priority
* thread, the kernel might not actually transfer control elsewhere.
*
* Returns "false" if we were unable to sleep because our time was up.
*/
bool dvmIterativeSleep(int iteration, int maxTotalSleep, u8 relStartTime)
{
/*
* Minimum sleep is one millisecond, it is important to keep this value
* low to ensure short GC pauses since dvmSuspendAllThreads() uses this
* function.
*/
const int minSleep = 1000;
u8 curTime;
int curDelay;
/*
* Get current time, and see if we've already exceeded the limit.
*/
curTime = dvmGetRelativeTimeUsec();
if (curTime >= relStartTime + maxTotalSleep) {
LOGVV("exsl: sleep exceeded (start=%llu max=%d now=%llu)",
relStartTime, maxTotalSleep, curTime);
return false;
}
/*
* Compute current delay. We're bounded by "maxTotalSleep", so no
* real risk of overflow assuming "usleep" isn't returning early.
* (Besides, 2^30 usec is about 18 minutes by itself.)
*
* For iteration==0 we just call sched_yield(), so the first sleep
* at iteration==1 is actually (minSleep * 2).
*/
curDelay = minSleep;
while (iteration-- > 0)
curDelay *= 2;
assert(curDelay > 0);
if (curTime + curDelay >= relStartTime + maxTotalSleep) {
LOGVV("exsl: reduced delay from %d to %d",
curDelay, (int) ((relStartTime + maxTotalSleep) - curTime));
curDelay = (int) ((relStartTime + maxTotalSleep) - curTime);
}
if (iteration == 0) {
LOGVV("exsl: yield");
sched_yield();
} else {
LOGVV("exsl: sleep for %d", curDelay);
usleep(curDelay);
}
return true;
}
开发者ID:acpaluri,项目名称:591_Comet,代码行数:67,代码来源:Misc.cpp
示例9: convertSignatureToClassArray
/*
* Convert the method signature to an array of classes.
*
* The tokenization process may mangle "*pSignature". On return, it will
* be pointing at the closing ')'.
*
* "defClass" is the method's class, which is needed to make class loaders
* happy.
*/
static ArrayObject* convertSignatureToClassArray(char** pSignature,
ClassObject* defClass)
{
char* signature = *pSignature;
assert(*signature == '(');
signature++;
/* count up the number of parameters */
size_t count = 0;
char* cp = signature;
while (*cp != ')') {
count++;
if (*cp == '[') {
while (*++cp == '[')
;
}
if (*cp == 'L') {
while (*++cp != ';')
;
}
cp++;
}
LOGVV("REFLECT found %d parameters in '%s'", count, *pSignature);
/* create an array to hold them */
ArrayObject* classArray = dvmAllocArrayByClass(gDvm.classJavaLangClassArray,
count, ALLOC_DEFAULT);
if (classArray == NULL)
return NULL;
/* fill it in */
cp = signature;
for (size_t i = 0; i < count; i++) {
ClassObject* clazz = convertSignaturePartToClass(&cp, defClass);
if (clazz == NULL) {
assert(dvmCheckException(dvmThreadSelf()));
return NULL;
}
LOGVV("REFLECT %d: '%s'", i, clazz->descriptor);
dvmSetObjectArrayElement(classArray, i, (Object *)clazz);
}
*pSignature = cp;
/* caller must call dvmReleaseTrackedAlloc */
return classArray;
}
开发者ID:1mobilesuper,项目名称:platform_dalvik,代码行数:58,代码来源:Reflect.cpp
示例10: dvmResolveInstField
/*
* Resolve an instance field reference.
*
* Returns NULL and throws an exception on error (no such field, illegal
* access).
*/
InstField* dvmResolveInstField(const ClassObject* referrer, u4 ifieldIdx)
{
DvmDex* pDvmDex = referrer->pDvmDex;
ClassObject* resClass;
const DexFieldId* pFieldId;
InstField* resField;
LOGVV("--- resolving field %u (referrer=%s cl=%p)\n",
ifieldIdx, referrer->descriptor, referrer->classLoader);
pFieldId = dexGetFieldId(pDvmDex->pDexFile, ifieldIdx);
/*
* Find the field's class.
*/
resClass = dvmResolveClass(referrer, pFieldId->classIdx, false);
if (resClass == NULL) {
assert(dvmCheckException(dvmThreadSelf()));
return NULL;
}
resField = dvmFindInstanceFieldHier(resClass,
dexStringById(pDvmDex->pDexFile, pFieldId->nameIdx),
dexStringByTypeIdx(pDvmDex->pDexFile, pFieldId->typeIdx));
if (resField == NULL) {
dvmThrowException("Ljava/lang/NoSuchFieldError;",
dexStringById(pDvmDex->pDexFile, pFieldId->nameIdx));
return NULL;
}
/*
* Class must be initialized by now (unless verifier is buggy). We
* could still be in the process of initializing it if the field
* access is from a static initializer.
*/
assert(dvmIsClassInitialized(resField->field.clazz) ||
dvmIsClassInitializing(resField->field.clazz));
/*
* The class is initialized, the method has been found. Add a pointer
* to our data structure so we don't have to jump through the hoops again.
*/
dvmDexSetResolvedField(pDvmDex, ifieldIdx, (Field*)resField);
LOGVV(" field %u is %s.%s\n",
ifieldIdx, resField->field.clazz->descriptor, resField->field.name);
return resField;
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:54,代码来源:Resolve.c
示例11: Dalvik_java_lang_VMClassLoader_findLoadedClass
/*
* static Class findLoadedClass(ClassLoader cl, String name)
*/
static void Dalvik_java_lang_VMClassLoader_findLoadedClass(const u4* args,
JValue* pResult)
{
Object* loader = (Object*) args[0];
StringObject* nameObj = (StringObject*) args[1];
ClassObject* clazz = NULL;
char* name = NULL;
char* descriptor = NULL;
if (nameObj == NULL) {
dvmThrowException("Ljava/lang/NullPointerException;", NULL);
goto bail;
}
/*
* Get a UTF-8 copy of the string, and convert dots to slashes.
*/
name = dvmCreateCstrFromString(nameObj);
if (name == NULL)
goto bail;
descriptor = dvmDotToDescriptor(name);
if (descriptor == NULL)
goto bail;
clazz = dvmLookupClass(descriptor, loader, false);
LOGVV("look: %s ldr=%p --> %p\n", descriptor, loader, clazz);
bail:
free(name);
free(descriptor);
RETURN_PTR(clazz);
}
开发者ID:AndDiSa,项目名称:GB-platform_dalvik,代码行数:36,代码来源:java_lang_VMClassLoader.c
示例12: dvmMterpStd
/*
* "Mterp entry point.
*/
void dvmMterpStd(Thread* self)
{
/* configure mterp items */
self->interpSave.methodClassDex = self->interpSave.method->clazz->pDvmDex;
IF_LOGVV() {
char* desc = dexProtoCopyMethodDescriptor(
&self->interpSave.method->prototype);
LOGVV("mterp threadid=%d : %s.%s %s",
dvmThreadSelf()->threadId,
self->interpSave.method->clazz->descriptor,
self->interpSave.method->name,
desc);
free(desc);
}
//ALOGI("self is %p, pc=%p, fp=%p", self, self->interpSave.pc,
// self->interpSave.curFrame);
//ALOGI("first instruction is 0x%04x", self->interpSave.pc[0]);
/*
* Handle any ongoing profiling and prep for debugging
*/
if (self->interpBreak.ctl.subMode != 0) {
TRACE_METHOD_ENTER(self, self->interpSave.method);
self->debugIsMethodEntry = true; // Always true on startup
}
dvmMterpStdRun(self);
#ifdef LOG_INSTR
ALOGD("|-- Leaving interpreter loop");
#endif
}
开发者ID:nicoleljc1227,项目名称:RetroScope,代码行数:36,代码来源:Mterp.cpp
示例13: dvmAllocObject
/*
* Create an instance of the specified class.
*
* Returns NULL and throws an exception on failure.
*/
Object* dvmAllocObject(ClassObject* clazz, int flags)
{
Object* newObj;
assert(dvmIsClassInitialized(clazz) || dvmIsClassInitializing(clazz));
if (IS_CLASS_FLAG_SET(clazz, CLASS_ISFINALIZABLE)) {
flags |= ALLOC_FINALIZABLE;
}
/* allocate on GC heap; memory is zeroed out */
newObj = dvmMalloc(clazz->objectSize, flags);
if (newObj != NULL) {
DVM_OBJECT_INIT(newObj, clazz);
Monitor* mon = NULL;//dvmCreateMonitor(newObj);
newObj->lock = (u4)mon | LW_SHAPE_FAT;
LOGVV("AllocObject: %s (%d)\n", clazz->descriptor,
(int) clazz->objectSize);
#if WITH_HPROF && WITH_HPROF_STACK
hprofFillInStackTrace(newObj);
#endif
dvmTrackAllocation(clazz, clazz->objectSize);
}
return newObj;
}
开发者ID:dslab-epfl,项目名称:dimmunix,代码行数:33,代码来源:Alloc.c
示例14: dvmPopLocalFrame
/*
* Pop one frame pushed on by JNI PushLocalFrame.
*
* If we've gone too far, the previous frame is either a break frame or
* an interpreted frame. Either way, the method pointer won't match.
*/
bool dvmPopLocalFrame(Thread* self)
{
StackSaveArea* saveBlock = SAVEAREA_FROM_FP(self->interpSave.curFrame);
assert(!dvmIsBreakFrame((u4*)self->interpSave.curFrame));
if (saveBlock->method != SAVEAREA_FROM_FP(saveBlock->prevFrame)->method) {
/*
* The previous frame doesn't have the same method pointer -- we've
* been asked to pop too much.
*/
assert(dvmIsBreakFrame((u4*)saveBlock->prevFrame) ||
!dvmIsNativeMethod(
SAVEAREA_FROM_FP(saveBlock->prevFrame)->method));
return false;
}
LOGVV("POP JNI local frame: removing %s, now %s",
saveBlock->method->name,
SAVEAREA_FROM_FP(saveBlock->prevFrame)->method->name);
dvmPopJniLocals(self, saveBlock);
self->interpSave.curFrame = saveBlock->prevFrame;
#ifdef WITH_OFFLOAD
offStackFramePopped(self);
#endif
return true;
}
开发者ID:acpaluri,项目名称:591_Comet,代码行数:33,代码来源:Stack.cpp
示例15: ef_vi_free
int ef_vi_free(ef_vi* ep, ef_driver_handle fd)
{
int rc;
if( ep->vi_io_mmap_ptr != NULL ) {
rc = ci_resource_munmap(fd, ep->vi_io_mmap_ptr, ep->vi_io_mmap_bytes);
if( rc < 0 ) {
LOGV(ef_log("%s: ci_resource_munmap %d", __FUNCTION__, rc));
return rc;
}
}
if( ep->vi_mem_mmap_ptr != NULL ) {
/* TODO: support variable sized DMAQ and evq */
rc = ci_resource_munmap(fd, ep->vi_mem_mmap_ptr, ep->vi_mem_mmap_bytes);
if( rc < 0 ) {
LOGVV(ef_log("%s: ci_resource_munmap iobuffer %d", __FUNCTION__, rc));
return rc;
}
}
free(ep->ep_state);
EF_VI_DEBUG(memset(ep, 0, sizeof(*ep)));
LOGVVV(ef_log("%s: DONE", __FUNCTION__));
return 0;
}
开发者ID:davenso,项目名称:openonload,代码行数:28,代码来源:pt_endpoint.c
示例16: dvmResolveNativeMethod
/*
* Resolve a native method and invoke it.
*
* This is executed as if it were a native bridge or function. If the
* resolution succeeds, method->insns is replaced, and we don't go through
* here again.
*
* Initializes method's class if necessary.
*
* An exception is thrown on resolution failure.
*/
void dvmResolveNativeMethod(const u4* args, JValue* pResult,
const Method* method, Thread* self)
{
ClassObject* clazz = method->clazz;
void* func;
/*
* If this is a static method, it could be called before the class
* has been initialized.
*/
if (dvmIsStaticMethod(method)) {
if (!dvmIsClassInitialized(clazz) && !dvmInitClass(clazz)) {
assert(dvmCheckException(dvmThreadSelf()));
return;
}
} else {
assert(dvmIsClassInitialized(clazz) ||
dvmIsClassInitializing(clazz));
}
/* start with our internal-native methods */
func = dvmLookupInternalNativeMethod(method);
if (func != NULL) {
/* resolution always gets the same answer, so no race here */
IF_LOGVV() {
char* desc = dexProtoCopyMethodDescriptor(&method->prototype);
LOGVV("+++ resolved native %s.%s %s, invoking\n",
clazz->descriptor, method->name, desc);
free(desc);
}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:41,代码来源:Native.c
示例17: netStartup
/*
* Initialize JDWP stuff.
*
* Allocates a new state structure. If "port" is non-negative, this also
* tries to bind to a listen port. If "port" is less than zero, we assume
* we're preparing for an outbound connection, and return without binding
* to anything.
*
* This may be called several times if we're probing for a port.
*
* Returns 0 on success.
*/
static JdwpNetState* netStartup(short port)
{
JdwpNetState* netState;
int one = 1;
netState = (JdwpNetState*) malloc(sizeof(*netState));
memset(netState, 0, sizeof(*netState));
netState->listenSock = -1;
netState->clientSock = -1;
netState->wakePipe[0] = -1;
netState->wakePipe[1] = -1;
if (port < 0)
return netState;
assert(port != 0);
netState->listenSock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (netState->listenSock < 0) {
LOGE("Socket create failed: %s\n", strerror(errno));
goto fail;
}
/* allow immediate re-use */
if (setsockopt(netState->listenSock, SOL_SOCKET, SO_REUSEADDR, &one,
sizeof(one)) < 0)
{
LOGE("setsockopt(SO_REUSEADDR) failed: %s\n", strerror(errno));
goto fail;
}
union {
struct sockaddr_in addrInet;
struct sockaddr addrPlain;
} addr;
addr.addrInet.sin_family = AF_INET;
addr.addrInet.sin_port = htons(port);
inet_aton("127.0.0.1", &addr.addrInet.sin_addr);
if (bind(netState->listenSock, &addr.addrPlain, sizeof(addr)) != 0) {
LOGV("attempt to bind to port %u failed: %s\n", port, strerror(errno));
goto fail;
}
netState->listenPort = port;
LOGVV("+++ bound to port %d\n", netState->listenPort);
if (listen(netState->listenSock, 5) != 0) {
LOGE("Listen failed: %s\n", strerror(errno));
goto fail;
}
return netState;
fail:
netShutdown(netState);
netFree(netState);
return NULL;
}
开发者ID:Andproject,项目名称:platform_dalvik,代码行数:71,代码来源:JdwpSocket.c
示例18: dvmPopFrame
/*
* Pop a frame we added. There should be one method frame and one break
* frame.
*
* If JNI Push/PopLocalFrame calls were mismatched, we might end up
* popping multiple method frames before we find the break.
*
* Returns "false" if there was no frame to pop.
*/
static bool dvmPopFrame(Thread* self)
{
StackSaveArea* saveBlock;
if (self->interpSave.curFrame == NULL)
return false;
saveBlock = SAVEAREA_FROM_FP(self->interpSave.curFrame);
assert(!dvmIsBreakFrame((u4*)self->interpSave.curFrame));
/*
* Remove everything up to the break frame. If this was a call into
* native code, pop the JNI local references table.
*/
while (saveBlock->prevFrame != NULL && saveBlock->method != NULL) {
/* probably a native->native JNI call */
if (dvmIsNativeMethod(saveBlock->method)) {
LOGVV("Popping JNI stack frame for %s.%s%s",
saveBlock->method->clazz->descriptor,
saveBlock->method->name,
(SAVEAREA_FROM_FP(saveBlock->prevFrame)->method == NULL) ?
"" : " (JNI local)");
dvmPopJniLocals(self, saveBlock);
}
saveBlock = SAVEAREA_FROM_FP(saveBlock->prevFrame);
}
if (saveBlock->method != NULL) {
ALOGE("PopFrame missed the break");
assert(false);
dvmAbort(); // stack trashed -- nowhere to go in this thread
}
LOGVV("POP frame: cur=%p new=%p",
self->interpSave.curFrame, saveBlock->prevFrame);
self->interpSave.curFrame = saveBlock->prevFrame;
#ifdef WITH_OFFLOAD
offStackFramePopped(self);
self->breakFrames--;
CHECK_BREAK_FRAMES();
#endif
return true;
}
开发者ID:acpaluri,项目名称:591_Comet,代码行数:55,代码来源:Stack.cpp
示例19: dvmNcgHandlePackedSwitch
/*
* Find the matching case. Returns the offset to the handler instructions.
*
* Returns 3 if we don't find a match (it's the size of the packed-switch
* instruction).
*/
s4 dvmNcgHandlePackedSwitch(const s4* entries, s4 firstKey, u2 size, s4 testVal)
{
//skip add_reg_reg (ADD_REG_REG_SIZE) and jump_reg (JUMP_REG_SIZE)
const int kInstrLen = 4; //default to next bytecode
if (testVal < firstKey || testVal >= firstKey + size) {
LOGVV("Value %d not found in switch (%d-%d)",
testVal, firstKey, firstKey+size-1);
return kInstrLen;
}
assert(testVal - firstKey >= 0 && testVal - firstKey < size);
LOGVV("Value %d found in slot %d (goto 0x%02x)",
testVal, testVal - firstKey,
s4FromSwitchData(&entries[testVal - firstKey]));
return s4FromSwitchData(&entries[testVal - firstKey]);
}
开发者ID:1mobilesuper,项目名称:platform_dalvik,代码行数:23,代码来源:NcgHelper.cpp
示例20: dvmResolveStaticField
/*
* Resolve a static field reference. The DexFile format doesn't distinguish
* between static and instance field references, so the "resolved" pointer
* in the Dex struct will have the wrong type. We trivially cast it here.
*
* Causes the field's class to be initialized.
*/
StaticField* dvmResolveStaticField(const ClassObject* referrer, u4 sfieldIdx)
{
DvmDex* pDvmDex = referrer->pDvmDex;
ClassObject* resClass;
const DexFieldId* pFieldId;
StaticField* resField;
pFieldId = dexGetFieldId(pDvmDex->pDexFile, sfieldIdx);
/*
* Find the field's class.
*/
resClass = dvmResolveClass(referrer, pFieldId->classIdx, false);
if (resClass == NULL) {
assert(dvmCheckException(dvmThreadSelf()));
return NULL;
}
resField = dvmFindStaticFieldHier(resClass,
dexStringById(pDvmDex->pDexFile, pFieldId->nameIdx),
dexStringByTypeIdx(pDvmDex->pDexFile, pFieldId->typeIdx));
if (resField == NULL) {
dvmThrowNoSuchFieldError(
dexStringById(pDvmDex->pDexFile, pFieldId->nameIdx));
return NULL;
}
/*
* If we're the first to resolve the field in which this class resides,
* we need to do it now. Note that, if the field was inherited from
* a superclass, it is not necessarily the same as "resClass".
*/
if (!dvmIsClassInitialized(resField->clazz) &&
!dvmInitClass(resField->clazz))
{
assert(dvmCheckException(dvmThreadSelf()));
return NULL;
}
/*
* If the class has been initialized, add a pointer to our data structure
* so we don't have to jump through the hoops again. If it's still
* initializing (i.e. this thread is executing <clinit>), don't do
* the store, otherwise other threads could use the field without waiting
* for class init to finish.
*/
if (dvmIsClassInitialized(resField->clazz)) {
dvmDexSetResolvedField(pDvmDex, sfieldIdx, (Field*) resField);
} else {
LOGVV("--- not caching resolved field %s.%s (class init=%d/%d)",
resField->clazz->descriptor, resField->name,
dvmIsClassInitializing(resField->clazz),
dvmIsClassInitialized(resField->clazz));
}
return resField;
}
开发者ID:handgod,项目名称:soma,代码行数:64,代码来源:Resolve.cpp
注:本文中的LOGVV函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论