Click here to Skip to main content
15,886,919 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Wordle 946 Pin
David O'Neil21-Jan-24 10:57
professionalDavid O'Neil21-Jan-24 10:57 
GeneralRe: Wordle 946 Pin
StarNamer@work22-Jan-24 12:47
professionalStarNamer@work22-Jan-24 12:47 
GeneralDoes anyone know of a good guide to the MSIL JIT compiler? Pin
honey the codewitch20-Jan-24 6:13
mvahoney the codewitch20-Jan-24 6:13 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
0x01AA20-Jan-24 6:17
mve0x01AA20-Jan-24 6:17 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
honey the codewitch20-Jan-24 6:20
mvahoney the codewitch20-Jan-24 6:20 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
trønderen20-Jan-24 7:47
trønderen20-Jan-24 7:47 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
honey the codewitch20-Jan-24 8:04
mvahoney the codewitch20-Jan-24 8:04 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
trønderen20-Jan-24 9:30
trønderen20-Jan-24 9:30 
Your first step is to see the disassembly in VS in the debug version. If a loophole optimization is applied in the debug version, you can be sure that it is applied in the release version as well!

Debugging does not by definition imply that the generated code is different from the release version. Sometimes you 'voluntarily' turn off some optimizations while debugging, because e.g. single stepping can be somewhat messy if code has been moved around. (Then we are talking about more advanced, not peephole, optimization.)

The 'Debug' and 'Release' configuration names are arbitrary names. You can create configurations of any other name, and set configuration options for your project for any of your configurations: Project|<name> Properties|Build|Advanced sets the amount of debug generated. In principle you could set Debug information: None for the Debug configuration, and Debug information: Full for the Release configuration, but most developers would find that rather non-intuitive Smile | :)

In any case, debug information is external to the executable code. E.g. to insert a breakpoint into release code, the debugger finds (from the debug info) the address where you want the BP, stuffs away the original instruction at that address and inserts a BP instruction, which it catches at run time. When the user commands 'go on', it re-inserts the original, stuffed away instruction, pulls the program counter one instruction back and restarts the target process. If the BP is meant to be persistent (not one of the volatile kind like 'run to cursor'), when continuing, the debugger will first execute a single target instruction (the one inserted), re-insert the BP instruction for the next round, and then set the target process running.

Well, this is one way of doing it. It requires write access to code memory. Many CPUs, typically embedded ones, must handle debugging of read only code (for the sake of this discussion, consider code in flash to be read only). They may have a few registers where the debugger can load code addresses that are continuously compared to the instruction pointer. If equal, a debug interrupt is generated. The CPU may have e.g. 4 such registers, so you can only have 4 BPs active at any one time, but they can be set in any release code.

For both (and other) alternatives: If you do not have debug information for the code, then you will have to know the binary address yourself. Nothing keeps you from generating debug information for release code. If you have debug info available and open the disassembly window (Ctrl-Alt-D or Debug|Windows|Disassembly in VS2022) after starting the program, you see the generated code.

An alternative is to generate a plain .exe file and use an external debugger. Note, however, that this file can be moved to any PC of the same CPU family, but that CPU may be lacking some instruction set extensions. The code generator cannot assume that any extension is available, so the code may be less optimized than JITted code, which is tailor made for the local CPU.

In the pre-JITting days, at least some compilers generated startup code for checking extension availability at run time. Before user code was run, it might be patched by the startup routine to use whatever extension was available. This of course required code and a table of all locations requiring patch-up, and startup was slower (but it made the program faster, once it was running). I do not know if dotNet compilers still do this when generating binary stand-alone executables.

Religious freedom is the freedom to say that two plus two make five.

GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
honey the codewitch20-Jan-24 10:00
mvahoney the codewitch20-Jan-24 10:00 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
trønderen20-Jan-24 10:12
trønderen20-Jan-24 10:12 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
honey the codewitch20-Jan-24 19:04
mvahoney the codewitch20-Jan-24 19:04 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
trønderen20-Jan-24 10:01
trønderen20-Jan-24 10:01 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
honey the codewitch20-Jan-24 10:03
mvahoney the codewitch20-Jan-24 10:03 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
Amarnath S20-Jan-24 13:45
professionalAmarnath S20-Jan-24 13:45 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
honey the codewitch20-Jan-24 15:04
mvahoney the codewitch20-Jan-24 15:04 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
11917640 Member 20-Jan-24 18:53
11917640 Member 20-Jan-24 18:53 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
honey the codewitch20-Jan-24 18:58
mvahoney the codewitch20-Jan-24 18:58 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
11917640 Member 20-Jan-24 22:07
11917640 Member 20-Jan-24 22:07 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
honey the codewitch20-Jan-24 23:28
mvahoney the codewitch20-Jan-24 23:28 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
11917640 Member 21-Jan-24 0:01
11917640 Member 21-Jan-24 0:01 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
honey the codewitch21-Jan-24 0:17
mvahoney the codewitch21-Jan-24 0:17 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
Jacquers21-Jan-24 17:37
Jacquers21-Jan-24 17:37 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
honey the codewitch21-Jan-24 23:04
mvahoney the codewitch21-Jan-24 23:04 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
Stuart Dootson22-Jan-24 1:24
professionalStuart Dootson22-Jan-24 1:24 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
honey the codewitch22-Jan-24 4:37
mvahoney the codewitch22-Jan-24 4:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.