Example #1
0
        public ExecutionContext(IRebarTargetRuntimeServices runtimeServices)
        {
            _runtimeServices = runtimeServices;
            _globalModule    = new Module("global");
            _globalModule.LinkInModule(CommonModules.StringModule.Clone());
            _globalModule.LinkInModule(CommonModules.RangeModule.Clone());
            _globalModule.LinkInModule(CommonModules.FileModule.Clone());

            string   error;
            LLVMBool Success = new LLVMBool(0);

            if (LLVMSharp.LLVM.CreateMCJITCompilerForModule(
                    out _engine,
                    _globalModule.GetModuleRef(),
                    _options,
                    out error) != Success)
            {
                throw new InvalidOperationException($"Error creating JIT: {error}");
            }
            _targetData = LLVMSharp.LLVM.GetExecutionEngineTargetData(_engine);
        }
Example #2
0
        public ExecutionContext(IRebarTargetRuntimeServices runtimeServices)
        {
            _contextWrapper  = new ContextWrapper();
            _runtimeServices = runtimeServices;
            _globalModule    = _contextWrapper.CreateModule("global");
            foreach (ContextFreeModule module in new[]
            {
                CommonModules.FakeDropModule,
                CommonModules.SchedulerModule,
                CommonModules.StringModule,
                CommonModules.OutputModule,
                CommonModules.RangeModule,
                CommonModules.FileModule
            })
            {
                _globalModule.LinkInModule(_contextWrapper.LoadContextFreeModule(module));
            }

            _engine     = _globalModule.CreateMCJITCompilerForModule();
            _targetData = LLVMSharp.LLVM.GetExecutionEngineTargetData(_engine);
        }
Example #3
0
 public ExecutionContext(IRebarTargetRuntimeServices runtimeServices)
 {
     _runtimeServices = runtimeServices;
 }