New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XamlC] fix loading ulongs, optimize bytecode for longs #611

Merged
merged 1 commit into from Dec 12, 2016

Conversation

Projects
None yet
3 participants
@StephaneDelcroix
Member

StephaneDelcroix commented Dec 5, 2016

Description of Change

[XamlC] fix loading ulongs, optimize bytecode for longs

The code had a casting issue while generating IL for ulongs.

This patches, in addition to fix the issue, also optimize ldc.i8 calls by 3 to 7B (from an original 9B) when the [u]long being loaded fits an int.

This optimization has been send to upstream as well jbevain/cecil#307

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Consolidate commits as makes sense
@StephaneDelcroix

@hartez left some comments here as well. will rebase when it's approved

else if (targetTypeRef.FullName == "System.UInt32")
yield return Instruction.Create(OpCodes.Ldc_I4, UInt32.Parse(str, CultureInfo.InvariantCulture));
else if (targetTypeRef.FullName == "System.UInt64")
yield return Instruction.Create(OpCodes.Ldc_I8, UInt64.Parse(str, CultureInfo.InvariantCulture));
yield return Instruction.Create(OpCodes.Ldc_I8, unchecked((long)UInt64.Parse(str, CultureInfo.InvariantCulture)));

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Dec 9, 2016

Member

ldc_i8 takes longs only as Operand. This is the "fix" part of the PR

@StephaneDelcroix

StephaneDelcroix Dec 9, 2016

Member

ldc_i8 takes longs only as Operand. This is the "fix" part of the PR

continue;
ExpandMacro(instruction, OpCodes.Ldc_I4, unchecked((int)l));
self.Instructions.Insert(++i, Instruction.Create(OpCodes.Conv_I8));
}

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Dec 9, 2016

Member

the best way to understand this, is to read the description of jbevain/cecil#307

@StephaneDelcroix

StephaneDelcroix Dec 9, 2016

Member

the best way to understand this, is to read the description of jbevain/cecil#307

@StephaneDelcroix StephaneDelcroix merged commit 22bdca3 into master Dec 12, 2016

1 of 2 checks passed

OSX-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: OSX Debug : Snapshot dependency failed to start: ... Windows Debug
Details
Windows-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: Windows Debug : Tests passed: 3683, ignored: 10
Details

@StephaneDelcroix StephaneDelcroix deleted the i8 branch Dec 12, 2016

@samhouts samhouts added this to the 2.3.4 milestone Jun 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment