Example #1
0
        public void LoadReferenceInArrayTyped(ClosureEntities closureEntities)
        {
            var index    = _evaluator.Pop();
            var instance = (LocalVariable)_evaluator.Pop();

            var result        = SetNewVReg();
            var arrayVariable = GetArrayElement.Create(result, instance, index, closureEntities);

            AddOperation(arrayVariable);
        }
Example #2
0
        public void LoadReferenceInArray()
        {
            var secondVar = _evaluator.Pop();
            var firstVar  = (LocalVariable)_evaluator.Pop();

            var result        = SetNewVReg();
            var arrayVariable = new GetArrayElement
            {
                AssignedTo = result,
                Instance   = firstVar,
                Index      = secondVar,
            };

            result.FixedType = new TypeDescription(arrayVariable.GetElementType());
            AddOperation(arrayVariable);
        }
Example #3
0
        /// <summary>
        /// Lowers get element values.
        /// </summary>
        private static void Lower(
            RewriterContext context,
            TypeLowering <ArrayType> _,
            GetArrayElement value)
        {
            var linearAddress = GetLinearAddress(
                context,
                value.ObjectValue,
                value.Index,
                out var ptr);

            var builder = context.Builder;
            var address = builder.CreateLoadElementAddress(
                value.Location,
                ptr,
                linearAddress);
            var newLoad = builder.CreateLoad(
                value.Location,
                address);

            context.ReplaceAndRemove(value, newLoad);
        }
Example #4
0
 /// <summary cref="IValueVisitor.Visit(GetArrayElement)"/>
 public void Visit(GetArrayElement value) =>
 throw new InvalidCodeGenerationException();