Minor IL optimizations, fixed variables loading

このコミットが含まれているのは:
Sergio Pedri committed 2019-09-19 00:14:33 +02:00
1 親 e049c79aac
コミット c66a68afeb
2ファイル変更
+4 -2

検索条件に一致するファイルはありません

+3 -2
ファイルの表示
@@ -99,8 +99,7 @@ namespace System.Reflection.Emit
public static void EmitAddOffset(this ILGenerator il, int offset)
{
// Push the offset to the stack
if (offset > 8) il.Emit(OpCodes.Ldc_I4, offset);
else
if (offset <= 8)
{
il.Emit(offset switch
{
@@ -111,6 +110,8 @@ namespace System.Reflection.Emit
_ => throw new InvalidOperationException("Huh?")
});
}
else if (offset <= 127) il.Emit(OpCodes.Ldc_I4_S, (byte)offset);
else il.Emit(OpCodes.Ldc_I4, offset);
// Converts the offset to native int and adds to the address
il.Emit(OpCodes.Conv_I);
+1
ファイルの表示
@@ -123,6 +123,7 @@ namespace ComputeSharp.Shaders.Translation
// Load the target address into the variables buffer
il.Emit(OpCodes.Ldarg_2);
il.EmitAddOffset(_VariablesByteSize);
_VariablesByteSize += size;
// Load the variable and store it in the loaded address
LoadMember(member);