本文整理汇总了C#中IPlace.EmitLoadAddress方法的典型用法代码示例。如果您正苦于以下问题:C# IPlace.EmitLoadAddress方法的具体用法?C# IPlace.EmitLoadAddress怎么用?C# IPlace.EmitLoadAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlace
的用法示例。
在下文中一共展示了IPlace.EmitLoadAddress方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryEmitVariableSpecialize
/// <summary>
/// If possible, based on type analysis, unwraps most specific type from give variable without a runtime type check.
/// </summary>
internal TypeSymbol TryEmitVariableSpecialize(IPlace place, TypeRefMask tmask)
{
if (place != null && tmask.IsSingleType && !tmask.IsRef)
{
if (place.HasAddress)
{
if (place.TypeOpt == CoreTypes.PhpNumber)
{
// access directly without type checking
if (IsDoubleOnly(tmask))
{
place.EmitLoadAddress(_il);
return EmitCall(ILOpCode.Call, CoreMethods.PhpNumber.get_Double)
.Expect(SpecialType.System_Double);
}
else if (IsLongOnly(tmask))
{
place.EmitLoadAddress(_il);
return EmitCall(ILOpCode.Call, CoreMethods.PhpNumber.get_Long)
.Expect(SpecialType.System_Int64);
}
}
else if (place.TypeOpt == CoreTypes.PhpValue)
{
// access directly without type checking
if (IsDoubleOnly(tmask))
{
place.EmitLoadAddress(_il);
return EmitCall(ILOpCode.Call, CoreMethods.PhpValue.get_Double)
.Expect(SpecialType.System_Double);
}
else if (IsLongOnly(tmask))
{
place.EmitLoadAddress(_il);
return EmitCall(ILOpCode.Call, CoreMethods.PhpValue.get_Long)
.Expect(SpecialType.System_Int64);
}
else if (IsBooleanOnly(tmask))
{
place.EmitLoadAddress(_il);
return EmitCall(ILOpCode.Call, CoreMethods.PhpValue.get_Boolean)
.Expect(SpecialType.System_Boolean);
}
else if (IsReadonlyStringOnly(tmask))
{
place.EmitLoadAddress(_il);
return EmitCall(ILOpCode.Call, CoreMethods.PhpValue.get_String)
.Expect(SpecialType.System_String);
}
//else if (IsArrayOnly(tmask))
//{
// place.EmitLoadAddress(_il);
// return EmitCall(ILOpCode.Call, CoreMethods.PhpValue.get_Array) NOTE!! PhpValue.Array is PhpArray
// .Expect(CoreTypes.IPhpArray);
//}
else if (IsClassOnly(tmask))
{
place.EmitLoadAddress(_il);
EmitCall(ILOpCode.Call, CoreMethods.PhpValue.get_Object)
.Expect(SpecialType.System_Object);
// DEBUG:
//if (tmask.IsSingleType)
//{
// var tref = this.TypeRefContext.GetTypes(tmask)[0];
// var clrtype = (TypeSymbol)this.DeclaringCompilation.GlobalSemantics.GetType(tref.QualifiedName);
// if (clrtype != null && !clrtype.IsErrorType())
// {
// this.EmitCastClass(clrtype);
// return clrtype;
// }
//}
return this.CoreTypes.Object;
}
}
}
}
return null;
}
示例2: EmitGetProperty
internal TypeSymbol EmitGetProperty(IPlace holder, PropertySymbol prop)
{
Debug.Assert(prop.IsStatic || holder != null);
Debug.Assert(prop.GetMethod != null);
Debug.Assert(prop.GetMethod.ParameterCount == 0);
var getter = prop.GetMethod;
if (holder != null && !getter.IsStatic)
{
Debug.Assert(holder.TypeOpt != null);
if (holder.TypeOpt.IsValueType)
{
holder.EmitLoadAddress(_il);
}
else
{
holder.EmitLoad(_il);
}
}
return EmitCall(getter.IsVirtual ? ILOpCode.Callvirt : ILOpCode.Call, getter);
}