本文整理汇总了C#中IDecompiler.Push方法的典型用法代码示例。如果您正苦于以下问题:C# IDecompiler.Push方法的具体用法?C# IDecompiler.Push怎么用?C# IDecompiler.Push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDecompiler
的用法示例。
在下文中一共展示了IDecompiler.Push方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Rewrite
public override bool Rewrite(CodeDescriptor decompilee, MethodBase callee, StackElement[] args, IDecompiler stack, IFunctionBuilder builder)
{
var side = args[0].Sample as IXilinxBlockMemSide;
if (side == null)
return false;
var sample = StdLogicVector._0s(side.DataReadWidth);
var code = IntrinsicFunctions.XILOpCode(
DefaultInstructionSet.Instance.RdMem(side),
TypeDescriptor.GetTypeOf(sample),
args[1].Expr);
stack.Push(code, sample);
return true;
}
示例2: Rewrite
public override bool Rewrite(CodeDescriptor decompilee, MethodBase callee, StackElement[] args, IDecompiler stack, IFunctionBuilder builder)
{
Type returnType;
if (callee.ReturnsSomething(out returnType))
{
dynamic awaiter = args[0].Sample;
if ((object)awaiter != null)
{
if (!awaiter.IsCompleted)
throw new InvalidOperationException("Task not completed - what are you awaiting for?");
object resultSample = awaiter.GetResult();
var resultType = resultSample.GetType();
var fspec = new FunctionSpec(resultType)
{
IntrinsicRep = IntrinsicFunctions.GetAsyncResult(awaiter)
};
var fcall = new FunctionCall()
{
Callee = fspec,
Arguments = new Expression[0],
ResultType = resultType
};
stack.Push(fcall, resultSample);
}
}
return true;
}
示例3: Rewrite
public override bool Rewrite(CodeDescriptor decompilee, MethodBase callee, StackElement[] args, IDecompiler stack, IFunctionBuilder builder)
{
var ufixSample = (UFix)args[0].Sample;
var ufixType = args[0].Expr.ResultType;
var slvuType = TypeDescriptor.GetTypeOf(ufixSample.SLVValue);
object[] outArgs;
object rsample;
stack.TryGetReturnValueSample((MethodInfo)callee, args, out outArgs, out rsample);
if (rsample == null)
throw new ArgumentException("Unable to infer result sample");
var sfixSample = (SFix)rsample;
var sfixType = TypeDescriptor.GetTypeOf(sfixSample);
var slvsType = TypeDescriptor.GetTypeOf(sfixSample.SLVValue);
var zlit = LiteralReference.CreateConstant(StdLogic._0);
var eargs = args.Select(arg => arg.Expr).ToArray();
var cast1 = IntrinsicFunctions.Cast(eargs, ufixType.CILType, slvuType, true);
var cast2 = Expression.Concat(zlit, cast1);
var cast3 = IntrinsicFunctions.Cast(new Expression[] { cast2 }, slvsType.CILType, sfixType, true);
stack.Push(cast3, rsample);
return true;
}
示例4: Rewrite
public override bool Rewrite(CodeDescriptor decompilee, MethodBase callee, StackElement[] args, IDecompiler stack, IFunctionBuilder builder)
{
var amd = stack.QueryAttribute<AsyncMethodDecompiler>();
if (amd != null && amd.ImplStyle == EAsyncImplStyle.FSM)
{
return false;
}
object[] outArgs;
object result;
stack.TryGetReturnValueSample((MethodInfo)callee, args, out outArgs, out result);
var fspec = new FunctionSpec(typeof(Task))
{
CILRep = callee
};
var fcall = new FunctionCall()
{
Callee = fspec,
Arguments = args.Select(a => a.Expr).ToArray(),
ResultType = TypeDescriptor.GetTypeOf(result)
};
stack.Push(fcall, result);
return true;
}
示例5: Rewrite
public override bool Rewrite(CodeDescriptor decompilee, MethodBase callee, StackElement[] args, IDecompiler stack, IFunctionBuilder builder)
{
object[] vargs = args.Select(arg => arg.Sample).ToArray();
Expression[] eargs = args.Select(arg => arg.Expr).ToArray();
object sample = null;
try
{
sample = callee.Invoke(vargs);
}
catch (Exception)
{
}
Expression result = new BinOp()
{
Operation = Kind
};
Array.Copy(eargs, result.Children, 2);
if (sample != null)
result.ResultType = TypeDescriptor.GetTypeOf(sample);
else
{
Type rtype;
callee.IsFunction(out rtype);
result.ResultType = (TypeDescriptor)rtype;
}
stack.Push(result, sample);
return true;
}
示例6: RewriteRead
public override void RewriteRead(CodeDescriptor decompilee, FieldInfo field, object instance, IDecompiler stack, IFunctionBuilder builder)
{
var me = stack.QueryAttribute<AsyncMethodDecompiler>();
var v = me._argFields[field.Name];
if (!me._declared.Contains(v))
{
builder.DeclareLocal(v);
me._declared.Add(v);
}
var lr = (LiteralReference)v;
stack.Push(lr, v.Type.GetSampleInstance(ETypeCreationOptions.ForceCreation));
}
示例7: RewriteRead
public override void RewriteRead(CodeDescriptor decompilee, FieldInfo field, object instance, IDecompiler stack, IFunctionBuilder builder)
{
SignalBase sigInst = (SignalBase)field.GetValue(instance);
SignalRef sigRef = new SignalRef(sigInst.Descriptor, SignalRef.EReferencedProperty.Instance);
stack.Push(sigRef, sigInst);
}
示例8: Rewrite
public override bool Rewrite(CodeDescriptor decompilee, MethodBase callee, StackElement[] args, IDecompiler stack, IFunctionBuilder builder)
{
if (args[0].Sample == null)
return false;
ISized one, rsample;
if (IsSigned)
{
Signed sample = (Signed)args[0].Sample;
Signed sone = Signed.FromLong(1, (int)sample.Size);
one = sone;
rsample = sample + sone;
}
else
{
Unsigned sample = (Unsigned)args[0].Sample;
Unsigned uone = Unsigned.FromULong(1, (int)sample.Size);
one = uone;
rsample = sample + uone;
}
LiteralReference oneLit = LiteralReference.CreateConstant(one);
Expression inc;
if (IsDecrement)
inc = args[0].Expr - oneLit;
else
inc = args[0].Expr + oneLit;
inc.ResultType = TypeDescriptor.GetTypeOf(rsample);
inc = IntrinsicFunctions.Resize(inc, (int)one.Size, TypeDescriptor.GetTypeOf(one));
stack.Push(new StackElement(inc, one, Analysis.Msil.EVariability.ExternVariable));
return true;
}
示例9: Rewrite
public override bool Rewrite(Meta.CodeDescriptor decompilee, System.Reflection.MethodBase callee, StackElement[] args, IDecompiler stack, SysDOM.IFunctionBuilder builder)
{
stack.Push(LiteralReference.CreateConstant(false), false);
System.Diagnostics.Debugger.Break();
return true;
}