public static void Initialize(IJitMemoryAllocator allocator) { if (_initialized) { return; } lock (_lock) { if (_initialized) { return; } _jitRegion = new ReservedRegion(allocator, CacheSize); _cacheAllocator = new CacheMemoryAllocator(CacheSize); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { JitUnwindWindows.InstallFunctionTableHandler(_jitRegion.Pointer, CacheSize, _jitRegion.Pointer + Allocate(PageSize)); } _initialized = true; } }
public static void Initialize(IJitMemoryAllocator allocator) { if (_initialized) { return; } lock (_lock) { if (_initialized) { return; } _jitRegion = new ReservedRegion(allocator, CacheSize); _cacheAllocator = new CacheMemoryAllocator(CacheSize); if (OperatingSystem.IsWindows()) { JitUnwindWindows.InstallFunctionTableHandler(_jitRegion.Pointer, CacheSize, _jitRegion.Pointer + Allocate(PageSize)); } _initialized = true; } }
public ExecutionContext(IJitMemoryAllocator allocator) { _nativeContext = new NativeContext(allocator); Running = true; _nativeContext.SetCounter(MinCountForCheck); }
public JumpTable(IJitMemoryAllocator allocator) { _jumpRegion = new ReservedRegion(allocator, JumpTableByteSize); _dynamicRegion = new ReservedRegion(allocator, DynamicTableByteSize); _targets = new ConcurrentDictionary <ulong, TranslatedFunction>(); _dependants = new ConcurrentDictionary <ulong, LinkedList <int> >(); Symbols.Add((ulong)_jumpRegion.Pointer.ToInt64(), JumpTableByteSize, JumpTableStride, "JMP_TABLE"); Symbols.Add((ulong)_dynamicRegion.Pointer.ToInt64(), DynamicTableByteSize, DynamicTableStride, "DYN_TABLE"); }
public ReservedRegion(IJitMemoryAllocator allocator, ulong maxSize, ulong granularity = 0) { if (granularity == 0) { granularity = DefaultGranularity; } Block = allocator.Reserve(maxSize); _maxSize = maxSize; _sizeGranularity = granularity; _currentSize = 0; }
public Translator(IJitMemoryAllocator allocator, IMemoryManager memory) { _memory = memory; _funcs = new ConcurrentDictionary <ulong, TranslatedFunction>(); _jumpTable = new JumpTable(allocator); _backgroundQueue = new PriorityQueue <RejitRequest>(2); _backgroundTranslatorEvent = new AutoResetEvent(false); JitCache.Initialize(allocator); DirectCallStubs.InitializeStubs(); }
public Translator(IJitMemoryAllocator allocator, IMemoryManager memory) { _allocator = allocator; _memory = memory; _funcs = new ConcurrentDictionary <ulong, TranslatedFunction>(); _oldFuncs = new ConcurrentQueue <KeyValuePair <ulong, IntPtr> >(); _backgroundStack = new ConcurrentStack <RejitRequest>(); _backgroundTranslatorEvent = new AutoResetEvent(false); _backgroundTranslatorLock = new ReaderWriterLock(); JitCache.Initialize(allocator); DirectCallStubs.InitializeStubs(); }
public static void Initialize(IJitMemoryAllocator allocator) { if (_initialized) return; lock (_lock) { if (_initialized) return; _jitRegion = new ReservedRegion(allocator, CacheSize); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { _jitRegion.ExpandIfNeeded(PageSize); JitUnwindWindows.InstallFunctionTableHandler(_jitRegion.Pointer, CacheSize); // The first page is used for the table based SEH structs. _offset = PageSize; } _initialized = true; } }
public Translator(IJitMemoryAllocator allocator, IMemoryManager memory) { _memory = memory; _funcs = new ConcurrentDictionary <ulong, TranslatedFunction>(); _backgroundStack = new ConcurrentStack <RejitRequest>(); _backgroundTranslatorEvent = new AutoResetEvent(false); _jumpTable = new JumpTable(allocator); JitCache.Initialize(allocator); DirectCallStubs.InitializeStubs(); if (Ptc.State == PtcState.Enabled) { Ptc.LoadTranslations(_funcs, memory.PageTablePointer, _jumpTable); } }
public NativeContext(IJitMemoryAllocator allocator) { _block = allocator.Allocate((ulong)Unsafe.SizeOf <NativeCtxStorage>()); GetStorage().ExclusiveAddress = ulong.MaxValue; }
public NativeContext(IJitMemoryAllocator allocator) { _block = allocator.Allocate(TotalSize); }
public NativeContext(IJitMemoryAllocator allocator) { _block = allocator.Allocate((ulong)Unsafe.SizeOf <NativeCtxStorage>()); }