コード例 #1
0
        /// <summary>
        /// The constructor of a DataStore for a memory.
        /// </summary>
        /// <param name="initialPageSize"></param>
        /// <param name="limits"></param>
        /// <param name="defaults"></param>
        /// <param name="globSrc"></param>
        public DataStore(uint initialPageSize, LimitsPaged limits, List <DefSegment> defaults, ExecutionContext globSrc)
        {
            this.storeAlignment = PageSize;

            this.ExpandPages_OrThrow(initialPageSize, limits);

            // Write the default values, or expand the store if (for some reason) we need
            // even more memory than the initial specific page size.
            uint defaultSet = this.WriteDefSegmentsData(defaults, globSrc);

            if (defaultSet != 0)
            {
                uint reqPgCt = defaultSet / PageSize;
                if (defaultSet % PageSize != 0)
                {
                    ++reqPgCt;
                }

                this.ExpandPages_OrThrow(reqPgCt, limits);
                if (this.WriteDefSegmentsData(defaults, globSrc) != 0)
                {
                    throw new System.Exception("Unknown issue setting default store values for Memory.");
                }
            }
        }
コード例 #2
0
        public ExpandRet ExpandPages_OrThrow(uint newPageSize, LimitsPaged limits, bool throwOnNoChange = false)
        {
            ExpandRet ret = this.ExpandPages(newPageSize, limits);

            this.ThrowErrorForExpandReturn(ret, throwOnNoChange);
            return(ret);
        }
コード例 #3
0
ファイル: DefMem.cs プロジェクト: Reavenk/PrecisionWASM_Core
        public DefMem(int index, uint initialPages, uint minPages, uint maxPages)
        {
            this.index = index;

            this.initialPages = initialPages;
            this.limits       = new LimitsPaged(minPages, maxPages);
            this.defSegments  = new List <DefSegment>();
        }
コード例 #4
0
        public ExpandRet ExpandPages(uint newPageSize, LimitsPaged limits)
        {
            uint maxSize = (uint)System.Math.Min(uint.MaxValue, (long)limits.maxPages * PageSize);

            return
                (this._ExpandSize(
                     newPageSize * PageSize,
                     limits.minPages * PageSize,
                     maxSize));
        }