Microsoft MVP성태의 닷넷 이야기
The JIT does dead-code elimination in Debuggable code [링크 복사], [링크+제목 복사],
조회: 10904
글쓴 사람
정성태 (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)
625정성태2/2/200712328TFS : 73. Team System 관련 유틸리티 목록
624정성태2/1/200713609개발 환경 구성: 72. Fiddler - IE 7 + Cassini 에서 동작되지 않는 문제 [2]
623정성태2/1/200712708TFS : 72. TFS 언어 변경
622정성태1/30/200712196.NET : 53. ASP.NET 2.0 AJAX Extension 1.0 - 소스 코드
621정성태1/30/200712779TFS : 71. Code Analysis 정책을 유형에 따라 적용하는 방법
620정성태1/29/200713558VS.NET IDE : 17. C#, VB.NET, VC++ 단축키 모음
619정성태1/28/200712977IIS : 12. 비스타 버전별 IIS 기능 차이
618정성태1/28/200712225Debug : 8. RuntimeWrappedException 사용 이해
617정성태1/27/200712739TFS : 70. 웹 서비스 구현 없이 TFS 통지 받기파일 다운로드1
616정성태1/27/200713417IIS : 11. Visual SourceSafe 웹 서비스가 비스타 IIS 7에서 지원되지 않는 문제
615정성태1/25/200712613TFS : 69. Workgroup 으로 설치된 TFS 를 Domain 으로 승격하는 방법
614정성태1/25/200713219개발 환경 구성: 71. 현재 프로세스에 로딩된 모듈 중에서 NGen 되지 않은 모듈 검색
613정성태1/25/200713178IIS : 10. IE에 최적화된 성능을 내는 JScript 코드 작성
612정성태1/25/200712172Debug : 7. WinLogon.exe 프로세스 디버깅하는 방법
611정성태1/25/200712586.NET : 52. Team System 단위 테스트에 관한 PDF 문서파일 다운로드1
610정성태1/25/200712594.NET : 51. FxCop 관련 PDF 문서파일 다운로드1
609정성태1/24/200712414.NET : 50. 공급자 독립적인 코드 작성 [2]
608정성태1/23/200712577TFS : 68. TFS Proxy 서버 설치하는 방법
607정성태1/23/200712113이미 제공되는 예외 클래스들에 대한 적절한 사용법 설명
606정성태1/23/200714982TFS : 67. TFS 명령행 인자
605정성태1/23/200711451TFS : 66. 차기 TFS 파워툴 - TFSServerManager / TFSServerMonitor
603정성태1/22/200712611Vista : 30. Property Handler가 필요한 때.
602정성태1/22/200712839IIS : 9. 디렉터리 열람을 위한 HttpModule파일 다운로드1
601정성태1/22/200711936개발 환경 구성: 70. Web Client Software Factory 설치 가이드(비스타)
600정성태1/21/200712520개발 환경 구성: 69. Virtual PC/Server에서의 가상 네트워크 어댑터 추가 방법
599정성태1/21/200712787Vista : 29. UAC 와 보안 데스크탑
... 16  17  18  19  20  21  22  [23]  24  25  26  27  28  29  30  ...