本文整理汇总了C++中UserClass::doNew方法的典型用法代码示例。如果您正苦于以下问题:C++ UserClass::doNew方法的具体用法?C++ UserClass::doNew怎么用?C++ UserClass::doNew使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserClass
的用法示例。
在下文中一共展示了UserClass::doNew方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createFromInternalMethod
JavaObjectMethod* JavaObjectMethod::createFromInternalMethod(JavaMethod* meth, int i) {
JavaObjectMethod* ret = 0;
JavaString* str = 0;
JavaObject* pArr = 0;
JavaObject* eArr = 0;
JavaObject* retTy = 0;
ArraySInt8* ann = 0;
ArraySInt8* pmAnn = 0;
ArraySInt8* defAnn = 0;
llvm_gcroot(ret, 0);
llvm_gcroot(str, 0);
llvm_gcroot(pArr, 0);
llvm_gcroot(eArr, 0);
llvm_gcroot(retTy, 0);
llvm_gcroot(ann, 0);
llvm_gcroot(pmAnn, 0);
llvm_gcroot(defAnn, 0);
// TODO: check parameter types
Jnjvm* vm = JavaThread::get()->getJVM();
JnjvmClassLoader * classLoader = meth->classDef->classLoader;
UserClass* Meth = vm->upcalls->newMethod;
ret = (JavaObjectMethod*)Meth->doNew(vm);
str = vm->internalUTF8ToStr(meth->name);
pArr = meth->getParameterTypes(classLoader);
eArr = meth->getExceptionTypes(classLoader);
retTy = meth->getReturnType(classLoader);
JavaString ** sig = getSignature(meth);
ann = getAnnotations(meth);
pmAnn = getParamAnnotations(meth);
defAnn = getAnnotationDefault(meth);
JavaObject* const* Cl = meth->classDef->getClassDelegateePtr(vm);
vm->upcalls->initMethod->invokeIntSpecial(vm, Meth, ret,
Cl, /* declaring class */
&str, /* name */
&pArr, /* parameter types */
&retTy, /* return type */
&eArr, /* exceptions */
meth->access, /* modifiers */
i, /* slot */
sig, /* signature */
&ann, /* annotations */
&pmAnn, /* parameter annotations */
&defAnn); /* default annotations */
return ret;
}
示例2: createFromInternalField
JavaObjectField* JavaObjectField::createFromInternalField(JavaField* field, int i) {
JavaObjectField* ret = 0;
JavaString* name = 0;
ArraySInt8* ann = 0;
llvm_gcroot(ret, 0);
llvm_gcroot(name, 0);
llvm_gcroot(ann, 0);
// TODO: check parameter types
Jnjvm* vm = JavaThread::get()->getJVM();
UserClass* Field = vm->upcalls->newField;
ret = (JavaObjectField*)Field->doNew(vm);
name = vm->internalUTF8ToStr(field->name);
//type->Class
JnjvmClassLoader* loader = field->classDef->classLoader;
UserCommonClass * fieldCl = field->getSignature()->assocClass(loader);
assert(fieldCl);
JavaObject* const* type = fieldCl->getClassDelegateePtr(vm);
JavaObject* const* Cl = field->classDef->getClassDelegateePtr(vm);
JavaString** sig = getSignature(field);
ann = getAnnotations(field);
/* java.reflect.Field(
* Class declaringClass,
* String name,
* Class type,
* int modifiers,
* int slot,
* String signature,
* byte[] annotations)
*/
vm->upcalls->initField->invokeIntSpecial(vm, Field, ret,
Cl,
&name,
type,
field->access,
i,
sig,
&ann);
return ret;
}
示例3: createFromInternalConstructor
JavaObjectConstructor* JavaObjectConstructor::createFromInternalConstructor(JavaMethod * cons, int i) {
JavaObjectConstructor* ret = 0;
JavaObject* pArr = 0;
JavaObject* eArr = 0;
ArraySInt8* ann = 0;
ArraySInt8* pmAnn = 0;
llvm_gcroot(ret, 0);
llvm_gcroot(pArr, 0);
llvm_gcroot(eArr, 0);
llvm_gcroot(ann, 0);
llvm_gcroot(pmAnn, 0);
Jnjvm* vm = JavaThread::get()->getJVM();
JnjvmClassLoader * classLoader = cons->classDef->classLoader;
UserClass* Cons = vm->upcalls->newConstructor;
pArr = cons->getParameterTypes(classLoader);
eArr = cons->getExceptionTypes(classLoader);
ret = (JavaObjectConstructor*)Cons->doNew(vm);
JavaObject* const* Cl = cons->classDef->getDelegateePtr();
JavaString ** sig = getSignature(cons);
ann = getAnnotations(cons);
pmAnn = getParamAnnotations(cons);
vm->upcalls->initConstructor->invokeIntSpecial(vm, Cons, ret,
Cl, /* declaringClass */
&pArr, /* parameterTypes */
&eArr, /* checkedExceptions */
cons->access, /* modifiers */
i, /* slot */
sig, /* String signature */
&ann, /* annotations */
&pmAnn /* parameterAnnotations */
);
return ret;
}
示例4: stringDup
JavaString* JavaString::stringDup(const ArrayUInt16*& _array, Jnjvm* vm) {
JavaString* res = 0;
const ArrayUInt16* array = _array;
llvm_gcroot(array, 0);
llvm_gcroot(res, 0);
UserClass* cl = vm->upcalls->newString;
res = (JavaString*)cl->doNew(vm);
// It's a hashed string, set the destructor so that the string
// removes itself from the vm string map. Do this only if
// internStringVT exists (in case of AOT).
if (internStringVT) res->setVirtualTable(internStringVT);
// No need to call the Java function: both the Java function and
// this function do the same thing.
JavaString::setValue(res, array);
res->count = ArrayUInt16::getSize(array);
res->offset = 0;
res->cachedHashCode = 0;
return res;
}