-
Notifications
You must be signed in to change notification settings - Fork 36
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
Implement IL codes for #91, #93, fix #105 #104
Open
cyborgyn
wants to merge
46
commits into
kekyo:devel
Choose a base branch
from
cyborgyn:feature/implement-ilcodes
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
7ac3be8
Merge branch 'kekyo:devel' into devel
cyborgyn a2c5f30
Merge branch 'devel' of git://github.com/kekyo/IL2C into kekyo-devel
cyborgyn 69cf5f0
Merge branch 'kekyo-devel' into devel
cyborgyn e29d09e
Merge pull request #3 from kekyo/devel
cyborgyn e7fef2b
Merge pull request #4 from cyborgyn/devel
cyborgyn 69e814f
Fix double addition of the same DLL reference, in case the transpiled…
cyborgyn 663563c
Fix discovery of implemented method in case of explicit interface imp…
cyborgyn 4234755
Add bitwise NOT arithmetic operator
cyborgyn 19c92d9
Implement shr, shl IL codes
cyborgyn f6bb406
Add starg and star.s IL codes
cyborgyn 9091c5b
Fix for #105, stop endless loop, fix static constructor handling #97,…
cyborgyn bab32a0
Implement Shr.un and Neg IL codes
cyborgyn 80e54b5
Implement Bgt.un and Bgt.un.s IL codes
cyborgyn c5ac124
Extend ConditionalConverters to handle float type parameters
cyborgyn e01dc9a
Fix typo
cyborgyn 4833ba2
Implement Stind.i1-i8, Stind.r4-r8 IL codes
cyborgyn 90bd0a3
Fix StargConverter
cyborgyn 05ececc
Add Enum to int conversion handling to GetRightExpression()
cyborgyn f98e142
Fix NullReferenceException occurring in MethodSignatureTypeComparerIm…
cyborgyn df35a87
Fix InternalWriteVTableTypePreDefinitions() to correctly handle empty…
cyborgyn 1a9cfe8
Enable IL2C_RUNTIME_TYPE_BEGIN writer, to handle compilation of Syste…
cyborgyn 2a73440
Enable handling without error such cases, where BaseType == null
cyborgyn e8029c1
Implement Switch IL code, for #93 and #91 v0.1
cyborgyn e1b6cc4
Implement Ldobj and Stobj IL codes
cyborgyn 30c0889
Updated supported-opcodes.md by Unit tests, no regression so far
cyborgyn 08ea06a
Add switch IL code tests
cyborgyn ff75c55
Fix switch test + generator
cyborgyn 5453d39
Ldobj IL code test + related fixes in converters
cyborgyn 8e3bac8
Fix ldobj unit test
cyborgyn e0d75e0
More ldobj tests
cyborgyn 1153f48
More Ldobj tests
cyborgyn b549284
Merge branch 'devel' into feature/implement-ilcodes
cyborgyn e43b30c
Merge pull request #5 from kekyo/devel
cyborgyn 3c3a734
Merge pull request #6 from cyborgyn/devel
cyborgyn 796f113
Add Stobj IL Code unit tests
cyborgyn dd83236
Add more TypeInitializer unit tests
cyborgyn 73afbfb
Add Shr and Shr.un IL Code unit tests + fix for it's converter to mak…
cyborgyn a28587a
Updated supported-opcodes.md & supported-runtime-system-features.md
cyborgyn 92ed390
Merge branch 'devel' into feature/implement-ilcodes
cyborgyn 76eeee7
Add NOT ILCode unit tests
cyborgyn 2b7b595
Remove breaking unit tests
cyborgyn 3cf87a5
Merge branch 'feature/implement-ilcodes' of github.com:cyborgyn/IL2C …
cyborgyn bc1476f
Refactor ArithmeticalConverters/ NotConverter according to guidelines
cyborgyn 9753e44
Tried to add more Shr unit tests, but discovery fails then for all ot…
cyborgyn 4790411
Remove method filter comment also for AssemblyPreparer
cyborgyn ca5706c
StargConverter simplification
cyborgyn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cyborgyn Is this operator valid negative? (Equals method is same as?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since String implements IComparable, it's not a ReferenceEquals compare anymore defined on Object. It has 3 possible return values of -1, 0, 1, where 0 indicates match. In case the two strings xname and yname don't match, we do a second try, with explicit interface naming match. There were cases observed, where the Equals specifically was used, and even though it should have been match, it didn't get to the point to validate a parameter list, and returned false. The same logic was adapted to the sorting aid, Compare() method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I look to seem this expression makes short circuit evaluation:
At (a) xname value and yname value is different (not 0), and contains string of last part at (b-1) and (b-2), so final result at (c) is always different...? (always not 0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think about the following scenario:
The trouble was, for the class MethodInformation.Name was "NS.Ib.Method()", but in the interface definition it was just "Method()". So when searching for interface implementation on the class, it didn't find it. One of them's DeclaringType is the class, the other's is the interface. So, the Equals() always returned false, and in the CallConverters.cs, at line 100 it throw Exception at this place:
So, what this thing does, is just give an other chance, putting the full "namespace.interfaceTypeName." before the appropriate method name (x, or y), and does an other compare. A side effect in the case for ordering, is that all interface implementation would be packed together after each other, I guess, but it is not used for things like this, as I am aware. In the case of Equals() there is no side effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was insight it and finally understood what is problem for ;)
See branch
feature/implement-ilcodes-r1
/ 19bb2eaThere was nothing regression test for this code fragment, it's my badness....
The callvirt opcode devirtualization function try it a few conditions:
At (a), this expression will test arg0 (this) is
class
type (analysis by IL2C), but this case couldn't be realize when using C# compiler. (Maybe) C# compiler never generate these conditions.So I added some test written IL (b159b49, 65ebbbe). These test will cause making (a) condition with true and false. And I understood your explain.
Then I thought of a way to make your method better. In this case, we can only check for method matches by symbolic name, only methods on class/value type.
For example, if the F# compiler generate an explicit interface implementation method, the method names will not necessarily match. To make sure that the methods match exactly, check if they are included in
IMethodInformation.Overrides
property.So, I made the following changes to make sure the unit test passes.