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: 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 
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 
I put that code snippet of yours into a tiny test program. Here is the disassembly window in VS2022 for x86 code:
ASM
class c {
    char current;
    public void setA(char c) {
      this.current = c;
00EF0DF0  push        ebp  
00EF0DF1  mov         ebp,esp  
00EF0DF3  mov         word ptr [ecx+4],dx  
      if ((this.current >= 'A' && this.current <= 'Z') ||
        (this.current >= 'a' && this.current <= 'z')) {
00EF0DF7  movzx       eax,word ptr [ecx+4]  
00EF0DFB  cmp         eax,41h  
00EF0DFE  jl          Test.c.setA(Char)+015h (0EF0E05h)  
00EF0E00  cmp         eax,5Ah  
00EF0E03  jle         Test.c.setA(Char)+01Fh (0EF0E0Fh)  
00EF0E05  cmp         eax,61h  
00EF0E08  jl          Test.c.setA(Char)+02Ah (0EF0E1Ah)  
00EF0E0A  cmp         eax,7Ah  
00EF0E0D  jg          Test.c.setA(Char)+02Ah (0EF0E1Ah)  
        Console.WriteLine("Argument is an alphabetic character");
00EF0E0F  mov         ecx,dword ptr ds:[3BB24A0h]  
00EF0E15  call        System.Console.WriteLine(System.String) (65A637B8h)  
00EF0E1A  pop         ebp  
00EF0E1B  ret
And for x64 code:
ASM
class c {
    char current;
    public void setA(char c) {
      this.current = c;
00007FFE45A90EE0  sub         rsp,28h  
00007FFE45A90EE4  mov         word ptr [rcx+8],dx  
      if ((this.current >= 'A' && this.current <= 'Z') ||
        (this.current >= 'a' && this.current <= 'z')) {
00007FFE45A90EE8  movzx       ecx,word ptr [rcx+8]  
00007FFE45A90EEC  cmp         ecx,41h  
00007FFE45A90EEF  jl          Test.c.setA(Char)+016h (07FFE45A90EF6h)  
00007FFE45A90EF1  cmp         ecx,5Ah  
00007FFE45A90EF4  jle         Test.c.setA(Char)+020h (07FFE45A90F00h)  
00007FFE45A90EF6  cmp         ecx,61h  
00007FFE45A90EF9  jl          Test.c.setA(Char)+032h (07FFE45A90F12h)  
00007FFE45A90EFB  cmp         ecx,7Ah  
00007FFE45A90EFE  jg          Test.c.setA(Char)+032h (07FFE45A90F12h)  
        Console.WriteLine("Argument is an alphabetic character");
00007FFE45A90F00  mov         rcx,1FE90003938h  
00007FFE45A90F0A  mov         rcx,qword ptr [rcx]  
00007FFE45A90F0D  call        System.Console.WriteLine(System.String) (07FFEA3F80DB0h)  
00007FFE45A90F12  nop  
00007FFE45A90F13  add         rsp,28h  
00007FFE45A90F17  ret
On both architectures, the code is identical in default settings for Debug and Release configurations. I'd be surprised if it wasn't, and I'd be surprised if - as you seemed to fear - the base register was reloaded for each of the four tests.

I do not have any ARM Windows PC available (but I'd sure like to...), so I can't tell which code is generated. I'd be similarly surprised if ARM code loads the same base address four times.

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: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 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
Simbosan21-Jan-24 20:02
Simbosan21-Jan-24 20:02 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
honey the codewitch21-Jan-24 23:03
mvahoney the codewitch21-Jan-24 23:03 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
trønderen22-Jan-24 10:18
trønderen22-Jan-24 10:18 
GeneralRe: Does anyone know of a good guide to the MSIL JIT compiler? Pin
honey the codewitch22-Jan-24 10:20
mvahoney the codewitch22-Jan-24 10:20 

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.