예제 #1
0
bool N3ModuleProvider::Materialize(GlobalValue *GV, std::string *ErrInfo) {
    Function* F = dyn_cast<Function>(GV);
    assert(F && "Not a function.");
    if (F->getLinkage() == GlobalValue::ExternalLinkage) return false;
    if (!F->empty()) return false;
    VMMethod* meth = functions->lookup(F);

    if (!meth) {
        // VT methods
        return false;
    } else {
        meth->compileToNative();
        return false;
    }
}
예제 #2
0
static void mapInitialThread(N3* vm) {
  VMClass* cl = (VMClass*)vm->coreAssembly->loadTypeFromName(
                                        vm->asciizToUTF8("Thread"),
                                        vm->asciizToUTF8("System.Threading"),
                                        true, true, true, true);
	declare_gcroot(VMObject*, appThread) = cl->doNew();

  std::vector<VMCommonClass*> args;
  args.push_back(MSCorlib::pVoid);
  args.push_back(cl);
  args.push_back(MSCorlib::pIntPtr);
  VMMethod* ctor = cl->lookupMethod(vm->asciizToUTF8(".ctor"), args, 
                                    false, false);
  VMThread* myth = VMThread::get();
  ctor->compileToNative()->invokeVoid(appThread, myth);
  myth->ooo_appThread = appThread;
}