当前位置: 首页>>代码示例>>C++>>正文


C++ Assembly::resolve方法代码示例

本文整理汇总了C++中Assembly::resolve方法的典型用法代码示例。如果您正苦于以下问题:C++ Assembly::resolve方法的具体用法?C++ Assembly::resolve怎么用?C++ Assembly::resolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Assembly的用法示例。


在下文中一共展示了Assembly::resolve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initialiseStatics

static void initialiseStatics() {
  CLIJit::initialise();

  VMObject::globalLock = new mvm::LockNormal();

  N3* vm = N3::bootstrapVM = N3::allocateBootstrap();
  VMThread::TheThread = new VMThread(0, vm);
  
  vm->assemblyPath.push_back("");
  vm->assemblyPath.push_back(MSCorlib::libsPath);
  
  Assembly* ass = vm->constructAssembly(vm->asciizToUTF8("mscorlib"));

  if(!ass->resolve(1, "dll"))
    VMThread::get()->getVM()->error("can not load mscorlib.dll. Abort");

  vm->coreAssembly = ass;

#define INIT(var, nameSpace, name, type, prim) {\
  var = (VMClass*)vm->coreAssembly->loadTypeFromName( \
                                           vm->asciizToUTF8(name),     \
                                           vm->asciizToUTF8(nameSpace),\
                                           false, false, false, true); \
  var->isPrimitive = prim; \
  if (type) { \
    var->naturalType = type;  \
    var->virtualType = type;  \
  }}

	assert(VMObject::llvmType);
 
  INIT(MSCorlib::pObject,   "System", "Object",    VMObject::llvmType, false);
  INIT(MSCorlib::pValue,    "System", "ValueType", 0, false);
  INIT(MSCorlib::pVoid,     "System", "Void",      llvm::Type::getVoidTy(getGlobalContext()), true);
  INIT(MSCorlib::pBoolean,  "System", "Boolean",   llvm::Type::getInt1Ty(getGlobalContext()), true);
  INIT(MSCorlib::pUInt8,    "System", "Byte",      llvm::Type::getInt8Ty(getGlobalContext()), true);
  INIT(MSCorlib::pSInt8,    "System", "SByte",     llvm::Type::getInt8Ty(getGlobalContext()), true);
  INIT(MSCorlib::pChar,     "System", "Char",      llvm::Type::getInt16Ty(getGlobalContext()), true);
  INIT(MSCorlib::pSInt16,   "System", "Int16",     llvm::Type::getInt16Ty(getGlobalContext()), true);
  INIT(MSCorlib::pUInt16,   "System", "UInt16",    llvm::Type::getInt16Ty(getGlobalContext()), true);
  INIT(MSCorlib::pSInt32,   "System", "Int32",     llvm::Type::getInt32Ty(getGlobalContext()), true);
  INIT(MSCorlib::pUInt32,   "System", "UInt32",    llvm::Type::getInt32Ty(getGlobalContext()), true);
  INIT(MSCorlib::pSInt64,   "System", "Int64",     llvm::Type::getInt64Ty(getGlobalContext()), true);
  INIT(MSCorlib::pUInt64,   "System", "UInt64",    llvm::Type::getInt64Ty(getGlobalContext()), true);
  INIT(MSCorlib::pIntPtr,   "System", "IntPtr",    llvm::PointerType::getUnqual(llvm::Type::getInt8Ty(getGlobalContext())), true);
  INIT(MSCorlib::pUIntPtr,  "System", "UIntPtr",   llvm::PointerType::getUnqual(llvm::Type::getInt8Ty(getGlobalContext())), true);
  INIT(MSCorlib::pDouble,   "System", "Double",    llvm::Type::getDoubleTy(getGlobalContext()), true);
  INIT(MSCorlib::pFloat,    "System", "Single",    llvm::Type::getFloatTy(getGlobalContext()), true);
  INIT(MSCorlib::pEnum,     "System", "Enum",      llvm::Type::getInt32Ty(getGlobalContext()), true);
  INIT(MSCorlib::pArray,    "System", "Array",     0, true);
  INIT(MSCorlib::pException,"System", "Exception", 0, false);
  INIT(MSCorlib::pDelegate, "System", "Delegate",  0, false);

#undef INIT

  VMClassArray::SuperArray       = MSCorlib::pArray;

  MSCorlib::loadStringClass(vm);

#define BUILD_ARRAY(name, type)																				\
	MSCorlib::array##name = ass->constructArray(MSCorlib::p##name, 1);

	ON_TYPES(BUILD_ARRAY, _F_NT);
	ON_STRING(BUILD_ARRAY, _F_NT);

  N3::clinitName        = vm->asciizToUTF8(".cctor");
  N3::ctorName          = vm->asciizToUTF8(".ctor");
  N3::invokeName        = vm->asciizToUTF8("Invoke");
  N3::math              = vm->asciizToUTF8("Math");
  N3::system            = vm->asciizToUTF8("System");
  N3::sqrt              = vm->asciizToUTF8("Sqrt");
  N3::sin               = vm->asciizToUTF8("Sin");
  N3::cos               = vm->asciizToUTF8("Cos");
  N3::exp               = vm->asciizToUTF8("Exp");
  N3::log               = vm->asciizToUTF8("Log");
  N3::floor             = vm->asciizToUTF8("Floor");
  N3::log10             = vm->asciizToUTF8("Log10");
  N3::isNan             = vm->asciizToUTF8("IsNaN");
  N3::pow               = vm->asciizToUTF8("Pow");
  N3::floatName         = vm->asciizToUTF8("Float");
  N3::doubleName        = vm->asciizToUTF8("Double");
  N3::testInfinity      = vm->asciizToUTF8("TestInfinity");

	MSCorlib::pArray->resolveType(1, 0, 0);
	MSCorlib::pArray->resolveVT();

  MSCorlib::initialise(vm);
}
开发者ID:chanwit,项目名称:vmkit,代码行数:88,代码来源:N3Initialise.cpp


注:本文中的Assembly::resolve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。