Пример #1
0
 /// <summary>
 /// Creates an indirect call instruction.
 /// </summary>
 /// <param name="returnType">
 /// The type of value returned by the callee.
 /// </param>
 /// <param name="parameterTypes">
 /// A list of parameter types.
 /// </param>
 /// <param name="callee">
 /// The delegate or function pointer to call.
 /// </param>
 /// <param name="arguments">
 /// The argument list for the call.
 /// </param>
 /// <returns>
 /// An indirect call instruction.
 /// </returns>
 public static Instruction CreateIndirectCall(
     IType returnType,
     IReadOnlyList <IType> parameterTypes,
     ValueTag callee,
     IReadOnlyList <ValueTag> arguments)
 {
     return(IndirectCallPrototype.Create(returnType, parameterTypes)
            .Instantiate(callee, arguments));
 }
Пример #2
0
        private static IReadOnlyList <LNode> EncodeIndirectCall(IndirectCallPrototype value, EncoderState state)
        {
            var paramTypeNodes = new List <LNode>();

            foreach (var paramType in value.ParameterTypes)
            {
                paramTypeNodes.Add(state.Encode(paramType));
            }

            return(new LNode[]
            {
                state.Encode(value.ResultType),
                state.Factory.List(paramTypeNodes)
            });
        }
Пример #3
0
 private static IndirectCallPrototype DecodeIndirectCall(IReadOnlyList <LNode> data, DecoderState state)
 {
     return(IndirectCallPrototype.Create(
                state.DecodeType(data[0]),
                data[1].Args.EagerSelect <LNode, IType>(state.DecodeType)));
 }