Comments (4)
Sorry but I don't understand what you think the problem is. Please write the complete IL of the method, and what you think is wrong in which instruction.
from cecil.
Hi Evain,
Here goes the full IL
[0]: {IL_0000: nop}
[1]: {IL_0001: ldarg.1}
[2]: {IL_0002: stloc.1}
[3]: {IL_0003: ldloc.1}
[4]: {IL_0004: switch IL_0013,IL_0018}
[5]: {IL_0011: br.s IL_001d}
[6]: {IL_0013: nop}
[7]: {IL_0014: ldc.i4.2}
[8]: {IL_0015: stloc.0}
[9]: {IL_0016: br.s IL_0022}
[10]: {IL_0018: nop}
[11]: {IL_0019: ldc.i4.4}
[12]: {IL_001a: stloc.0}
[13]: {IL_001b: br.s IL_0022}
[14]: {IL_001d: nop}
[15]: {IL_001e: ldc.i4.0}
[16]: {IL_001f: stloc.0}
[17]: {IL_0020: br.s IL_0022}
[18]: {IL_0022: ldloc.0}
[19]: {IL_0023: ret}
Now, when i am at IL_0004 and I call instruction.Operand contains array of OpCodes.Nop, instead of the branch instructions br.s IL_001d and br.s IL_0022 needed to create control flow for switch. As IL_0013 points to nop , it is literally valid but invalid in case of processing branch. For switch statement with return , MSIL generates an extra nop instruction. I was thinking if instruction.Operand call can return instructions for IL_0011 and IL_0016 instead of IL_0013 and IL_0018 respectively.
from cecil.
Sorry but you're wrong here. The switch is properly constructed and contains the appropriate instructions. It doesn't make any sense for the operands to contain something else than the actual jump points in the jump table.
And it's invalid in no case at all, if you want to build a CFG for a switch statement, you have to create basic blocks starting at each jump points of the switch and starting at its next instruction. Closing.
from cecil.
Thanks for the clarification, much appreciated.
from cecil.
Related Issues (20)
- Embedded PDBs not readable by VisualStudio HOT 3
- Subsequent write operations create different outputs HOT 6
- Type resolution depends on the program that is running, not the assembly being processed. HOT 7
- Chat room HOT 3
- Constant type misidentified as primitive
- [Question] OpCodes.Conv_U
- System.IndexOutOfRangeException: Index was outside the bounds of the array HOT 1
- Constant serialization
- Update readme discussion info
- Reflection & System.Runtime [& self references?] HOT 3
- Release a new version supporting RVA field alignment HOT 1
- Unity 2022 Queue.Clear Resolve returns null.
- No way to sign a netstandard assembly from a .NET >=6 app? HOT 1
- Specified method is not supported. HOT 1
- .NET Framework 4.8.1 - Failed to resolve assembly: netstandard, Version=2.0.0.0 HOT 3
- Easiest way to map document paths in portable [embedded] PDBs?
- Stack overflow when running tests
- Failed to extract SQLite.SQLiteException
- Exception when writing assembly with a null call instruction HOT 1
- Link in README goes to betting site HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cecil.