本文整理汇总了C++中dvmThreadSelf函数的典型用法代码示例。如果您正苦于以下问题:C++ dvmThreadSelf函数的具体用法?C++ dvmThreadSelf怎么用?C++ dvmThreadSelf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dvmThreadSelf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Dalvik_dalvik_system_VMRuntime_preloadClasses
/*
* public native int preloadClasses()
*/
static void Dalvik_dalvik_system_VMRuntime_preloadClasses(const u4* args,
JValue* pResult)
{
ClassObject* caller = dvmGetCallerClass(dvmThreadSelf()->curFrame);
Object* loader;
int count = 0;
unsigned int index;
UNUSED_PARAMETER(args);
if (caller == NULL)
RETURN_INT(0);
loader = (Object*)caller->classLoader;
for (index = 0; index < sizeof(preloadClassesTable)/sizeof(char*); index ++)
{
ClassObject* clazz = dvmFindClassByCstrName(preloadClassesTable[index], loader);
if (clazz == NULL)
{
dvmLogExceptionStackTrace();
dvmClearException(dvmThreadSelf());
continue;
}
count ++;
}
RETURN_INT(count);
}
开发者ID:onyx-intl,项目名称:p400_dalvik,代码行数:32,代码来源:dalvik_system_VMRuntime.c
示例2: 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
示例3: de_robv_android_xposed_XposedBridge_setObjectClassNative
static void de_robv_android_xposed_XposedBridge_setObjectClassNative(JNIEnv* env, jclass clazz, jobject objIndirect, jclass clzIndirect) {
Object* obj = (Object*) dvmDecodeIndirectRef(dvmThreadSelf(), objIndirect);
ClassObject* clz = (ClassObject*) dvmDecodeIndirectRef(dvmThreadSelf(), clzIndirect);
if (clz->status < CLASS_INITIALIZED && !dvmInitClass(clz)) {
ALOGE("Could not initialize class %s", clz->descriptor);
return;
}
obj->clazz = clz;
}
开发者ID:BillKalin,项目名称:Xposed,代码行数:9,代码来源:xposed.cpp
示例4: de_robv_android_xposed_XposedBridge_hookMethodNative
static void de_robv_android_xposed_XposedBridge_hookMethodNative(JNIEnv* env,
jclass clazz, jobject reflectedMethodIndirect,
jobject declaredClassIndirect, jint slot,
jobject additionalInfoIndirect) {
// Usage errors?
if (declaredClassIndirect == NULL || reflectedMethodIndirect == NULL) {
dvmThrowIllegalArgumentException(
"method and declaredClass must not be null");
return;
}
// Find the internal representation of the method
ClassObject* declaredClass = (ClassObject*) dvmDecodeIndirectRef(
dvmThreadSelf(), declaredClassIndirect);
Method* method = dvmSlotToMethod(declaredClass, slot);
if (method == NULL) {
dvmThrowNoSuchMethodError(
"could not get internal representation for method");
return;
}
if (xposedIsHooked(method)) {
ALOGD("Hook: Ignored! [%s] [%s]\n", declaredClass->descriptor, method->name);
// already hooked
return;
}
else {
ALOGD("Hook: [%s] [%s]\n", declaredClass->descriptor, method->name);
}
// Save a copy of the original method and other hook info
XposedHookInfo* hookInfo = (XposedHookInfo*) calloc(1,
sizeof(XposedHookInfo));
memcpy(hookInfo, method, sizeof(hookInfo->originalMethodStruct));
hookInfo->reflectedMethod = dvmDecodeIndirectRef(dvmThreadSelf(),
env->NewGlobalRef(reflectedMethodIndirect));
hookInfo->additionalInfo = dvmDecodeIndirectRef(dvmThreadSelf(),
env->NewGlobalRef(additionalInfoIndirect));
// Replace method with our own code
SET_METHOD_FLAG(method, ACC_NATIVE);
method->nativeFunc = &xposedCallHandler;
method->insns = (const u2*) hookInfo;
method->registersSize = method->insSize;
method->outsSize = 0;
if (PTR_gDvmJit != NULL) {
// reset JIT cache
MEMBER_VAL(PTR_gDvmJit, DvmJitGlobals, codeCacheFull) = true;
}
}
开发者ID:BurgerZ,项目名称:Xposed,代码行数:52,代码来源:xposed.cpp
示例5: dvmResolveString
/*
* Resolve a string reference.
*
* Finding the string is easy. We need to return a reference to a
* java/lang/String object, not a bunch of characters, which means the
* first time we get here we need to create an interned string.
*/
StringObject* dvmResolveString(const ClassObject* referrer, u4 stringIdx)
{
DvmDex* pDvmDex = referrer->pDvmDex;
StringObject* strObj;
StringObject* internStrObj;
const char* utf8;
u4 utf16Size;
LOGVV("+++ resolving string, referrer is %s\n", referrer->descriptor);
/*
* Create a UTF-16 version so we can trivially compare it to what's
* already interned.
*/
utf8 = dexStringAndSizeById(pDvmDex->pDexFile, stringIdx, &utf16Size);
strObj = dvmCreateStringFromCstrAndLength(utf8, utf16Size,
ALLOC_DEFAULT);
if (strObj == NULL) {
/* ran out of space in GC heap? */
assert(dvmCheckException(dvmThreadSelf()));
goto bail;
}
/*
* Add it to the intern list. The return value is the one in the
* intern list, which (due to race conditions) may or may not be
* the one we just created. The intern list is synchronized, so
* there will be only one "live" version.
*
* By requesting an immortal interned string, we guarantee that
* the returned object will never be collected by the GC.
*
* A NULL return here indicates some sort of hashing failure.
*/
internStrObj = dvmLookupImmortalInternedString(strObj);
dvmReleaseTrackedAlloc((Object*) strObj, NULL);
strObj = internStrObj;
if (strObj == NULL) {
assert(dvmCheckException(dvmThreadSelf()));
goto bail;
}
/* save a reference so we can go straight to the object next time */
dvmDexSetResolvedString(pDvmDex, stringIdx, strObj);
bail:
return strObj;
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:55,代码来源:Resolve.c
示例6: waitSetRemove
/*
* Unlinks a thread from a monitor's wait set. The monitor lock must
* be held by the caller of this routine.
*/
static void waitSetRemove(Monitor *mon, Thread *thread)
{
Thread *elt;
assert(mon != NULL);
assert(mon->owner == dvmThreadSelf());
assert(thread != NULL);
assert(waitSetCheck(mon) == 0);
if (mon->waitSet == NULL) {
return;
}
if (mon->waitSet == thread) {
mon->waitSet = thread->waitNext;
thread->waitNext = NULL;
return;
}
elt = mon->waitSet;
while (elt->waitNext != NULL) {
if (elt->waitNext == thread) {
elt->waitNext = thread->waitNext;
thread->waitNext = NULL;
return;
}
elt = elt->waitNext;
}
}
开发者ID:1mobilesuper,项目名称:platform_dalvik,代码行数:30,代码来源:Sync.cpp
示例7: dvmPrintExceptionStackTrace
/*
* Print the stack trace of the current exception on stderr. This is called
* from the JNI ExceptionDescribe call.
*
* For consistency we just invoke the Throwable printStackTrace method,
* which might be overridden in the exception object.
*
* Exceptions thrown during the course of printing the stack trace are
* ignored.
*/
void dvmPrintExceptionStackTrace(void)
{
Thread* self = dvmThreadSelf();
Object* exception;
Method* printMethod;
exception = self->exception;
if (exception == NULL)
return;
self->exception = NULL;
printMethod = dvmFindVirtualMethodHierByDescriptor(exception->clazz,
"printStackTrace", "()V");
if (printMethod != NULL) {
JValue unused;
dvmCallMethod(self, printMethod, exception, &unused);
} else {
LOGW("WARNING: could not find printStackTrace in %s\n",
exception->clazz->descriptor);
}
if (self->exception != NULL) {
LOGW("NOTE: exception thrown while printing stack trace: %s\n",
self->exception->clazz->descriptor);
}
self->exception = exception;
}
开发者ID:AndDiSa,项目名称:GB-platform_dalvik,代码行数:38,代码来源:Exception.c
示例8: dvmWaitForConcurrentGcToComplete
/*
* If the concurrent GC is running, wait for it to finish. The caller
* must hold the heap lock.
*
* Note: the second dvmChangeStatus() could stall if we were in RUNNING
* on entry, and some other thread has asked us to suspend. In that
* case we will be suspended with the heap lock held, which can lead to
* deadlock if the other thread tries to do something with the managed heap.
* For example, the debugger might suspend us and then execute a method that
* allocates memory. We can avoid this situation by releasing the lock
* before self-suspending. (The developer can work around this specific
* situation by single-stepping the VM. Alternatively, we could disable
* concurrent GC when the debugger is attached, but that might change
* behavior more than is desirable.)
*
* This should not be a problem in production, because any GC-related
* activity will grab the lock before issuing a suspend-all. (We may briefly
* suspend when the GC thread calls dvmUnlockHeap before dvmResumeAllThreads,
* but there's no risk of deadlock.)
*/
bool dvmWaitForConcurrentGcToComplete()
{
ATRACE_BEGIN("GC: Wait For Concurrent");
bool waited = gDvm.gcHeap->gcRunning;
Thread *self = dvmThreadSelf();
assert(self != NULL);
u4 start = dvmGetRelativeTimeMsec();
#ifdef FASTIVA
// Ensure no Java-object reference is used in local-stack.
// and save Java-object reference maybe in registers.
FASTIVA_SUSPEND_STACK_unsafe(self);
ThreadStatus oldStatus = dvmChangeStatus(self, THREAD_VMWAIT);
while (gDvm.gcHeap->gcRunning) {
dvmWaitCond(&gDvm.gcHeapCond, &gDvm.gcHeapLock);
}
dvmChangeStatus(self, oldStatus);
FASTIVA_RESUME_STACK_unsafe(self);
#else
while (gDvm.gcHeap->gcRunning) {
ThreadStatus oldStatus = dvmChangeStatus(self, THREAD_VMWAIT);
dvmWaitCond(&gDvm.gcHeapCond, &gDvm.gcHeapLock);
dvmChangeStatus(self, oldStatus);
}
#endif
u4 end = dvmGetRelativeTimeMsec();
if (end - start > 0) {
ALOGD("WAIT_FOR_CONCURRENT_GC blocked %ums", end - start);
}
ATRACE_END();
return waited;
}
开发者ID:XClouded,项目名称:fastiva,代码行数:51,代码来源:Heap.cpp
示例9: dvmMterpDumpArmRegs
/*
* Dump the fixed-purpose ARM registers, along with some other info.
*
* This function MUST be compiled in ARM mode -- THUMB will yield bogus
* results.
*
* This will NOT preserve r0-r3/ip.
*/
void dvmMterpDumpArmRegs(uint32_t r0, uint32_t r1, uint32_t r2, uint32_t r3)
{
register uint32_t rPC asm("r4");
register uint32_t rFP asm("r5");
register uint32_t rSELF asm("r6");
register uint32_t rINST asm("r7");
register uint32_t rIBASE asm("r8");
register uint32_t r9 asm("r9");
register uint32_t r10 asm("r10");
//extern char dvmAsmInstructionStart[];
printf("REGS: r0=%08x r1=%08x r2=%08x r3=%08x\n", r0, r1, r2, r3);
printf(" : rPC=%08x rFP=%08x rSELF=%08x rINST=%08x\n",
rPC, rFP, rSELF, rINST);
printf(" : rIBASE=%08x r9=%08x r10=%08x\n", rIBASE, r9, r10);
//Thread* self = (Thread*) rSELF;
//const Method* method = self->method;
printf(" + self is %p\n", dvmThreadSelf());
//printf(" + currently in %s.%s %s\n",
// method->clazz->descriptor, method->name, method->shorty);
//printf(" + dvmAsmInstructionStart = %p\n", dvmAsmInstructionStart);
//printf(" + next handler for 0x%02x = %p\n",
// rINST & 0xff, dvmAsmInstructionStart + (rINST & 0xff) * 64);
}
开发者ID:0x4d4e,项目名称:platform_dalvik,代码行数:34,代码来源:debug.cpp
示例10: miui_dexspy_DexspyInstaller_hookMethodNative
static void miui_dexspy_DexspyInstaller_hookMethodNative(JNIEnv* env, jclass clazz, jobject declaredClassIndirect, jint slot) {
// Usage errors?
if (declaredClassIndirect == NULL) {
dvmThrowIllegalArgumentException("declaredClass must not be null");
return;
}
// Find the internal representation of the method
ClassObject* declaredClass = (ClassObject*) dvmDecodeIndirectRef(dvmThreadSelf(), declaredClassIndirect);
Method* method = dvmSlotToMethod(declaredClass, slot);
if (method == NULL) {
dvmThrowNoSuchMethodError("could not get internal representation for method");
return;
}
if (findOriginalMethod(method) != dexspyOriginalMethods.end()) {
ALOGD("why this method already hooked: %s:%s(%s)", method->clazz->descriptor, method->name, method->shorty);
// already hooked
return;
}
// Save a copy of the original method
dexspyOriginalMethods.push_front(*method);
// Replace method with our own code
SET_METHOD_FLAG(method, ACC_NATIVE);
method->nativeFunc = &dexspyCallHandler;
method->registersSize = method->insSize;
method->outsSize = 0;
#ifdef WITH_JIT
// reset JIT cache
gDvmJit.codeCacheFull = true;
#endif
}
开发者ID:MiCode,项目名称:Xposed,代码行数:34,代码来源:dexspy.cpp
示例11: Dalvik_java_lang_VMThread_currentThread
/*
* static Thread currentThread()
*/
static void Dalvik_java_lang_VMThread_currentThread(const u4* args,
JValue* pResult)
{
UNUSED_PARAMETER(args);
RETURN_PTR(dvmThreadSelf()->threadObj);
}
开发者ID:handgod,项目名称:soma,代码行数:10,代码来源:java_lang_VMThread.cpp
示例12: Dalvik_dalvik_system_VMRuntime_properties
static void Dalvik_dalvik_system_VMRuntime_properties(const u4* args,
JValue* pResult)
{
ArrayObject* result = dvmCreateStringArray(*gDvm.properties);
dvmReleaseTrackedAlloc((Object*) result, dvmThreadSelf());
RETURN_PTR(result);
}
开发者ID:TeamDevious,项目名称:android_dalvik,代码行数:7,代码来源:dalvik_system_VMRuntime.cpp
示例13: fastiva_Dalvik_dalvik_system_VMRuntime_newNonMovableArray
java_lang_Object_p fastiva_Dalvik_dalvik_system_VMRuntime_newNonMovableArray(dalvik_system_VMRuntime_p self, java_lang_Class_p elementClass, jint length) {
#endif
if (elementClass == NULL) {
dvmThrowNullPointerException("elementClass == null");
THROW_V();
}
if (length < 0) {
dvmThrowNegativeArraySizeException(length);
THROW_V();
}
// TODO: right now, we don't have a copying collector, so there's no need
// to do anything special here, but we ought to pass the non-movability
// through to the allocator.
ClassObject* arrayClass = dvmFindArrayClassForElement(elementClass);
ArrayObject* newArray = dvmAllocArrayByClass(arrayClass,
length,
ALLOC_NON_MOVING);
if (newArray == NULL) {
assert(dvmCheckException(dvmThreadSelf()));
THROW_V();
}
dvmReleaseTrackedAlloc((Object*) newArray, NULL);
RETURN_PTR(newArray);
}
开发者ID:XClouded,项目名称:fastiva,代码行数:27,代码来源:dalvik_system_VMRuntime.cpp
示例14: de_robv_android_xposed_XposedBridge_hookMethodNative
static void de_robv_android_xposed_XposedBridge_hookMethodNative(JNIEnv* env, jclass clazz, jobject declaredClassIndirect, jint slot) {
// Usage errors?
if (declaredClassIndirect == NULL) {
dvmThrowIllegalArgumentException("declaredClass must not be null");
return;
}
// Find the internal representation of the method
ClassObject* declaredClass = (ClassObject*) dvmDecodeIndirectRef(dvmThreadSelf(), declaredClassIndirect);
Method* method = dvmSlotToMethod(declaredClass, slot);
if (method == NULL) {
dvmThrowNoSuchMethodError("could not get internal representation for method");
return;
}
if (findXposedOriginalMethod(method) != xposedOriginalMethods.end()) {
// already hooked
return;
}
// Save a copy of the original method
xposedOriginalMethods.push_front(*((MethodXposedExt*)method));
// Replace method with our own code
SET_METHOD_FLAG(method, ACC_NATIVE);
method->nativeFunc = &xposedCallHandler;
method->registersSize = method->insSize;
method->outsSize = 0;
if (PTR_gDvmJit != NULL) {
// reset JIT cache
MEMBER_VAL(PTR_gDvmJit, DvmJitGlobals, codeCacheFull) = true;
}
}
开发者ID:ShiningDrops,项目名称:Xposed,代码行数:34,代码来源:xposed.cpp
示例15: fastiva_Dalvik_dalvik_system_VMRuntime_properties
java_lang_String_ap fastiva_Dalvik_dalvik_system_VMRuntime_properties(dalvik_system_VMRuntime_p self) {
#endif
ArrayObject* result = dvmCreateStringArray(*gDvm.properties);
dvmReleaseTrackedAlloc((Object*) result, dvmThreadSelf());
RETURN_PTR((java_lang_String_ap)result);
}
开发者ID:XClouded,项目名称:fastiva,代码行数:7,代码来源:dalvik_system_VMRuntime.cpp
示例16: 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
示例17: fastiva_Dalvik_java_lang_Object_notify
void fastiva_Dalvik_java_lang_Object_notify(java_lang_Object_p thisPtr) {
Thread* self = dvmThreadSelf();
#endif
dvmObjectNotify(self, thisPtr);
MAY_THROW_VOID();
}
开发者ID:zeedh,项目名称:fastiva,代码行数:7,代码来源:java_lang_Object.cpp
示例18: 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
示例19: 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
示例20: Dalvik_dalvik_system_VMRuntime_newNonMovableArray
static void Dalvik_dalvik_system_VMRuntime_newNonMovableArray(const u4* args,
JValue* pResult)
{
ClassObject* elementClass = (ClassObject*) args[1];
int length = args[2];
if (elementClass == NULL) {
dvmThrowNullPointerException("elementClass == null");
RETURN_VOID();
}
if (length < 0) {
dvmThrowNegativeArraySizeException(length);
RETURN_VOID();
}
// TODO: right now, we don't have a copying collector, so there's no need
// to do anything special here, but we ought to pass the non-movability
// through to the allocator.
ClassObject* arrayClass = dvmFindArrayClassForElement(elementClass);
ArrayObject* newArray = dvmAllocArrayByClass(arrayClass,
length,
ALLOC_NON_MOVING);
if (newArray == NULL) {
assert(dvmCheckException(dvmThreadSelf()));
RETURN_VOID();
}
dvmReleaseTrackedAlloc((Object*) newArray, NULL);
RETURN_PTR(newArray);
}
开发者ID:TeamDevious,项目名称:android_dalvik,代码行数:30,代码来源:dalvik_system_VMRuntime.cpp
注:本文中的dvmThreadSelf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论