本文整理汇总了C++中VMMethod::execute方法的典型用法代码示例。如果您正苦于以下问题:C++ VMMethod::execute方法的具体用法?C++ VMMethod::execute怎么用?C++ VMMethod::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VMMethod
的用法示例。
在下文中一共展示了VMMethod::execute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: find
VMClass* BootstrapLoader::find(VMContext* ctx, const std::string& name, bool initClass){
TR_USE(Java_Loader);
std::map<std::string,VMClass*>::iterator iter = mUninitializedClasses.find(name);
if (iter != mUninitializedClasses.end()){
VMClass* cls = iter->second;
mUninitializedClasses.erase(iter);
mClasses[name] = cls;
//delayed class init
unsigned idx = cls->findMethodIndex("<clinit>", "()V");
VMMethod* mthd = cls->getMethod(idx);
if (mthd){
TR_INFO("Delayed execution of class init method");
mthd->execute(ctx, -1);
}
return cls;
}
VMClass* entry = mClasses[name];
if (entry == 0){
//array functions
if (name[0] == '['){
entry = new VMArrayClass(this, name);
mClasses[name] = entry;
return entry;
}
else if (name.size() == 1){
//primitive types
return getPrimitiveClass(ctx, name);
}
//Java::ClassFile* clfile = new Java::ClassFile();
CGE::Reader* rdr = filenameToReader(name);
if (!rdr)
return NULL;
entry = new VMClass(ctx, this, *rdr);
delete rdr;
if (ctx->getException() != NULL){
delete entry;
return NULL;
}
if (!initClass)
mUninitializedClasses[name] = entry;
else
mClasses[name] = entry;
entry->initClass(ctx, initClass);
}
return entry;
}
示例2: getPrimitiveClass
VMClass* BootstrapLoader::getPrimitiveClass(VMContext* ctx, std::string name){
VMClass* entry = mClasses[name];
if (entry == 0){
entry = new VMClass(this);
entry->setName(name);
mClasses[name] = entry;
//entry->print(std::cout);
//entry->initFields(ctx);
VMClass* cls = find(ctx, "java/lang/Class");
VMMethod* clsmthd = cls->getMethod(cls->findMethodIndex("<init>", "()V"));
entry->init(ctx, cls);
ctx->push((VMObject*)cls);
clsmthd->execute(ctx, -1);
}
return entry;
}