Example #1
0
        public int ReserveDynamicEntry(bool isJump)
        {
            int entry = Interlocked.Increment(ref _dynTableEnd);

            ExpandIfNeededDynamicTable(entry);

            // Initialize all host function pointers to the indirect call stub.
            IntPtr addr    = GetEntryAddressDynamicTable(entry);
            long   stubPtr = DirectCallStubs.IndirectCallStub(isJump).ToInt64();

            for (int i = 0; i < DynamicTableElems; i++)
            {
                Marshal.WriteInt64(addr, i * JumpTableStride + 8, stubPtr);
            }

            return(entry);
        }
Example #2
0
        public int ReserveDynamicEntry(bool isJump)
        {
            int entry = Interlocked.Increment(ref _dynTableEnd);

            if (entry >= DynamicTableSize)
            {
                throw new OutOfMemoryException("JIT Dynamic Jump Table exhausted.");
            }

            _dynamicRegion.ExpandIfNeeded((ulong)((entry + 1) * DynamicTableStride));

            // Initialize all host function pointers to the indirect call stub.

            IntPtr addr    = _dynamicRegion.Pointer + entry * DynamicTableStride;
            long   stubPtr = (long)DirectCallStubs.IndirectCallStub(isJump);

            for (int i = 0; i < DynamicTableElems; i++)
            {
                Marshal.WriteInt64(addr, i * JumpTableStride + 8, stubPtr);
            }

            return(entry);
        }