Microsoft MVP성태의 닷넷 이야기
The JIT does dead-code elimination in Debuggable code [링크 복사], [링크+제목 복사],
조회: 10899
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

출처: http://blogs.msdn.com/jmstall/archive/2006/03/13/dead_code_elimination.aspx

The JIT does dead-code elimination in Debuggable code

The desktop CLR JIT (at least x86) does dead-code elimination, even in debuggable code. This is obviously perfectly safe, transparent, (and good), from a program-execution perspective. But it can be a little surprising under the debugger because you can't set-next-statement (setip) to eliminated code.

In other words, if you have this C# code:
    Console.WriteLine("Hi!");
    if (false) {
        Console.WriteLine("Boo!"); // <-- can't setip here
    }
    Console.WriteLine("Bye");

You couldn't Set-next-statement to the "Boo!" line.  Normally this is fine, but every now and then it gets me. I think code-generators are more likely to produce code like that than a real person.

However, the JIT will not remove side-effect free expressions in debuggable code. For example,
    void Foo() {
        int x = 5;
        x ++;
    }

The JIT will not remove either of those lines, even though 'x' is unused and so they don't actually do anything for program behavior. This means you can still set and hit breakpoints on those lines, which is what you'd expect from debuggable (non-optimized) code.

In optimized-code, anything's fair game and a function like Foo() would very likely be optimized out of existence.

Published Monday, March 13, 2006 5:44 PM by jmstall

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

You can also stay up to date using your favorite aggregator by subscribing to the CommentRss Feed








[최초 등록일: ]
[최종 수정일: 4/14/2006]


비밀번호

댓글 작성자
 




... 16  17  18  19  20  21  22  23  24  25  26  [27]  28  29  30  ...
NoWriterDateCnt.TitleFile(s)
525정성태11/14/200613237Vista : 14. .NET 개발자들을 위한 Vista 기능 소개
524정성태11/13/200612663TFS : 55. Annotate 소개
523정성태11/13/200614191.NET 3.0 : 7. WPF - EXE 유형의 프로젝트를 XBAP 유형으로 변경
522정성태11/12/200613679.NET : 33. SynchronizationContext 에 대해서.
521정성태11/12/200612257SDK : 7. Sessions, Window Stations, Desktops
520정성태11/12/200613878Vista : 13. LLTD(Link Layer Topology Discovery)가 뭘까요?
519정성태11/12/200612151Vista : 12. Network Location Type - Public, Private, Domain - 에 대한 설명.
518정성태11/12/200612103개발 환경 구성: 53. Sandcastle - 일반적인 HTML 파일 이름 생성
517정성태11/11/200612863.NET : 32. Enterprise Library - 예외 처리 가이드 (PPT 및 소스 코드) [2]파일 다운로드1
516정성태11/10/200611546개발 환경 구성: 52. Vista - 원격 터미널 클라이언트에서 다중 모니터 지원
515정성태11/8/200612773SDK : 6. 패치 툴 소개 ( mspatcha, mspatchc )파일 다운로드1
514정성태11/8/200612501.NET : 31. MSN Messenger 연동 라이브러리
513정성태11/8/200613955Visual C++ : 5. Browser Helper Object 제작 방법
512정성태11/8/200614155SDK : 5. Tiny PE - 가장 작은 PE 파일 제작파일 다운로드1
511정성태11/8/200613229개발 환경 구성: 51. Extended Validation (EV) SSL 인증서 소식 [1]
510정성태11/7/200613076VS.NET IDE : 13. Guidance Automation Toolkit and Domain-Specific Language Tools for Visual Studio 2005: Integration Scenarios
509정성태11/7/200612499.NET 3.0 : 6. ADO.NET Samples for Visual Studio Code Name “Orcas” - October CTP
508정성태11/6/200612355TFS : 54. 새로운 TFS 리포트 생성
507정성태11/5/200612104.NET : 30. LINQ 관련 자료
506정성태11/5/200612482.NET : 29. .NET Fusion API
505정성태11/4/200612159.NET : 28. The .NET Developer's Guide to Identity
504정성태11/4/200612384.NET : 27. ASP.NET 2.0 Resource-Provider 모델 확장
503정성태11/4/200612457TFS : 53. VSTS 관련 자료 링크 모음
502정성태11/4/200612193TFS : 52. Data-Tier Server 미러링
501정성태11/3/200612340TFS : 51. TFS 증분 빌드 환경 설정
500정성태11/2/200612210TFS : 50. TfsAlert 0.3.0.0 릴리스
... 16  17  18  19  20  21  22  23  24  25  26  [27]  28  29  30  ...