Пример #1
0
        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;
            }
        }
Пример #2
0
        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;
            }
        }
Пример #3
0
        public JumpTable()
        {
            _jumpRegion    = new ReservedRegion(JumpTableByteSize);
            _dynamicRegion = new ReservedRegion(DynamicTableByteSize);

            _targets    = new ConcurrentDictionary <ulong, TranslatedFunction>();
            _dependants = new ConcurrentDictionary <ulong, LinkedList <int> >();
        }
Пример #4
0
        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");
        }
Пример #5
0
        static JitCache()
        {
            _jitRegion = new ReservedRegion(CacheSize);

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                _jitRegion.ExpandIfNeeded(PageSize);
                JitUnwindWindows.InstallFunctionTableHandler(_basePointer, CacheSize);

                // The first page is used for the table based SEH structs.
                _offset = PageSize;
            }

            _cacheEntries = new List <JitCacheEntry>();

            _lock = new object();
        }
Пример #6
0
        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;
            }
        }