Last active
December 23, 2015 04:19
-
-
Save pnkfelix/6579174 to your computer and use it in GitHub Desktop.
Issue 9129: LLVM and Machine code comparisons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Function Attrs: inlinehint uwtable | |
define internal i64 @_ZN13on_break_expr4anon7expr_fn2aTE({ i64, %tydesc*, i8*, i8*, i8 }*, i64) #6 { | |
"function top level": | |
%__arg = alloca i64 | |
%i2 = alloca %"struct.syntax::ast::Ident[#2]" | |
%__trait_callee = alloca { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* } | |
%2 = alloca %"struct.syntax::ast::Ident[#2]" | |
%3 = alloca { i8*, i32 } ;*** delta L2: only right | |
store i64 %1, i64* %__arg | |
%4 = bitcast { i64, %tydesc*, i8*, i8*, i8 }* %0 to { i64, %tydesc*, i8*, i8*, { { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* } }* | |
%5 = getelementptr inbounds { i64, %tydesc*, i8*, i8*, { { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* } }* %4, i32 0, i32 4 | |
%6 = getelementptr inbounds { { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* }* %5, i32 0, i32 0 | |
%7 = load { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }** %6 | |
%8 = bitcast { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* %7 to i8* | |
%9 = bitcast { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* %__trait_callee to i8* | |
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %9, i8* %8, i64 16, i32 8, i1 false) | |
call void @"_ZN38_$SP$syntax..fold..ast_fold.$x27static9glue_take19hf24896cd362d20b3aXE"({}* null, { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* %__trait_callee) | |
%10 = getelementptr inbounds { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* %__trait_callee, i32 0, i32 1 | |
%11 = load { i64, %tydesc*, i8*, i8*, i8 }** %10 | |
%12 = getelementptr inbounds { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* %__trait_callee, i32 0, i32 0 | |
%13 = bitcast %tydesc** %12 to [1 x i8*]** | |
%14 = load [1 x i8*]** %13 | |
%15 = getelementptr inbounds [1 x i8*]* %14, i32 0, i32 19 | |
%16 = load i8** %15 | |
%17 = bitcast i8* %16 to void (%"struct.syntax::ast::Ident[#2]"*, { i64, %tydesc*, i8*, i8*, i8 }*, %"struct.syntax::ast::Ident[#2]"*)* | |
%18 = load i64* %__arg | |
invoke void @"_ZN3ast5Ident3new20h8637863cb6fa5eelAaN11v0.8$x2dpreE"(%"struct.syntax::ast::Ident[#2]"* %2, { i64, %tydesc*, i8*, i8*, i8 }* undef, i64 %18) ;*** delta R3: only right | |
to label %"normal return" unwind label %unwind ;*** delta R3: only right | |
"normal return": ; preds = %"function top level" | |
call void %17(%"struct.syntax::ast::Ident[#2]"* %i2, { i64, %tydesc*, i8*, i8*, i8 }* %11, %"struct.syntax::ast::Ident[#2]"* %2) | |
%19 = getelementptr inbounds %"struct.syntax::ast::Ident[#2]"* %i2, i32 0, i32 0 | |
%20 = load i64* %19 | |
ret i64 %20 | |
unwind: ; preds = %"function top level" ;*** delta R5: only right start | |
%21 = landingpad { i8*, i32 } personality i32 ()* @upcall_rust_personality | |
cleanup | |
call void @upcall_reset_stack_limit() | |
store { i8*, i32 } %21, { i8*, i32 }* %3 | |
br label %cleanup | |
cleanup: ; preds = %unwind | |
call void @"_ZN38_$SP$syntax..fold..ast_fold.$x27static9glue_drop19hf24896cd362d20b3aYE"({}* null, { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* %__trait_callee) | |
%22 = load { i8*, i32 }* %3 | |
resume { i8*, i32 } %22 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Function Attrs: inlinehint uwtable | |
define internal i64 @_ZN13on_break_expr4anon7expr_fn2aVE({ i64, %tydesc*, i8*, i8*, i8 }*, i64) #6 { | |
"function top level": | |
%__arg = alloca i64 | |
%i1 = alloca %"struct.syntax::ast::Ident[#2]" ;*** delta L1: only left | |
%i2 = alloca %"struct.syntax::ast::Ident[#2]" | |
%__trait_callee = alloca { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* } | |
%__self = alloca %"struct.syntax::ast::Ident[#2]" | |
store i64 %1, i64* %__arg | |
%2 = bitcast { i64, %tydesc*, i8*, i8*, i8 }* %0 to { i64, %tydesc*, i8*, i8*, { { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* } }* | |
%3 = getelementptr inbounds { i64, %tydesc*, i8*, i8*, { { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* } }* %2, i32 0, i32 4 | |
%4 = getelementptr inbounds { { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* }* %3, i32 0, i32 0 | |
%5 = load { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }** %4 | |
%6 = load i64* %__arg ;*** delta L1: only left here and below | |
call void @"_ZN3ast5Ident3new20h8637863cb6fa5eelAaN11v0.8$x2dpreE"(%"struct.syntax::ast::Ident[#2]"* %i1, { i64, %tydesc*, i8*, i8*, i8 }* undef, i64 %6) | |
%7 = bitcast { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* %5 to i8* | |
%8 = bitcast { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* %__trait_callee to i8* | |
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %8, i8* %7, i64 16, i32 8, i1 false) | |
call void @"_ZN38_$SP$syntax..fold..ast_fold.$x27static9glue_take19hf24896cd362d20b3aZE"({}* null, { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* %__trait_callee) | |
%9 = getelementptr inbounds { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* %__trait_callee, i32 0, i32 1 | |
%10 = load { i64, %tydesc*, i8*, i8*, i8 }** %9 | |
%11 = getelementptr inbounds { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }* %__trait_callee, i32 0, i32 0 | |
%12 = bitcast %tydesc** %11 to [1 x i8*]** | |
%13 = load [1 x i8*]** %12 | |
%14 = getelementptr inbounds [1 x i8*]* %13, i32 0, i32 19 | |
%15 = load i8** %14 | |
%16 = bitcast i8* %15 to void (%"struct.syntax::ast::Ident[#2]"*, { i64, %tydesc*, i8*, i8*, i8 }*, %"struct.syntax::ast::Ident[#2]"*)* | |
%17 = bitcast %"struct.syntax::ast::Ident[#2]"* %i1 to i8* ;*** delta L3: only left | |
%18 = bitcast %"struct.syntax::ast::Ident[#2]"* %__self to i8* ;*** delta L3: only left | |
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %18, i8* %17, i64 16, i32 8, i1 false) ;*** delta L3: only left | |
call void %16(%"struct.syntax::ast::Ident[#2]"* %i2, { i64, %tydesc*, i8*, i8*, i8 }* %10, %"struct.syntax::ast::Ident[#2]"* %__self) | |
%19 = getelementptr inbounds %"struct.syntax::ast::Ident[#2]"* %i2, i32 0, i32 0 | |
%20 = load i64* %19 | |
ret i64 %20 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(gdb) disassem | |
Dump of assembler code for function _ZN13on_break_expr4anon7expr_fn2a4E: | |
0x0000000100001ac0 <_ZN13on_break_expr4anon7expr_fn2a4E+0>: cmp %gs:0x330,%rsp | |
0x0000000100001ac9 <_ZN13on_break_expr4anon7expr_fn2a4E+9>: ja 0x100001ae5 <_ZN13on_break_expr4anon7expr_fn2a4E+37> | |
0x0000000100001acb <_ZN13on_break_expr4anon7expr_fn2a4E+11>: mov $0x78,%r10 | |
0x0000000100001ad5 <_ZN13on_break_expr4anon7expr_fn2a4E+21>: mov $0x0,%r11 | |
0x0000000100001adf <_ZN13on_break_expr4anon7expr_fn2a4E+31>: callq 0x10004704a <__morestack> | |
0x0000000100001ae4 <_ZN13on_break_expr4anon7expr_fn2a4E+36>: retq | |
0x0000000100001ae5 <_ZN13on_break_expr4anon7expr_fn2a4E+37>: push %rbp | |
0x0000000100001ae6 <_ZN13on_break_expr4anon7expr_fn2a4E+38>: mov %rsp,%rbp | |
0x0000000100001ae9 <_ZN13on_break_expr4anon7expr_fn2a4E+41>: sub $0x70,%rsp | |
0x0000000100001aed <_ZN13on_break_expr4anon7expr_fn2a4E+45>: mov %rsi,-0x8(%rbp) | |
0x0000000100001af1 <_ZN13on_break_expr4anon7expr_fn2a4E+49>: mov 0x20(%rdi),%rsi | |
0x0000000100001af5 <_ZN13on_break_expr4anon7expr_fn2a4E+53>: mov (%rsi),%rdi | |
0x0000000100001af8 <_ZN13on_break_expr4anon7expr_fn2a4E+56>: mov 0x8(%rsi),%rsi | |
0x0000000100001afc <_ZN13on_break_expr4anon7expr_fn2a4E+60>: mov %rsi,-0x20(%rbp) | |
0x0000000100001b00 <_ZN13on_break_expr4anon7expr_fn2a4E+64>: mov %rdi,-0x28(%rbp) | |
0x0000000100001b04 <_ZN13on_break_expr4anon7expr_fn2a4E+68>: xor %eax,%eax | |
0x0000000100001b06 <_ZN13on_break_expr4anon7expr_fn2a4E+70>: mov %eax,%edi | |
0x0000000100001b08 <_ZN13on_break_expr4anon7expr_fn2a4E+72>: lea -0x28(%rbp),%rsi | |
0x0000000100001b0c <_ZN13on_break_expr4anon7expr_fn2a4E+76>: callq 0x100001b91 <_ZN38_$SP$syntax..fold..ast_fold.$x27static9glue_take19hf24896cd362d20b3a8E> | |
0x0000000100001b11 <_ZN13on_break_expr4anon7expr_fn2a4E+81>: mov -0x28(%rbp),%rsi | |
0x0000000100001b15 <_ZN13on_break_expr4anon7expr_fn2a4E+85>: mov -0x20(%rbp),%rdi | |
0x0000000100001b19 <_ZN13on_break_expr4anon7expr_fn2a4E+89>: mov 0x98(%rsi),%rsi | |
0x0000000100001b20 <_ZN13on_break_expr4anon7expr_fn2a4E+96>: mov -0x8(%rbp),%rdx | |
0x0000000100001b24 <_ZN13on_break_expr4anon7expr_fn2a4E+100>: lea -0x38(%rbp),%rcx | |
0x0000000100001b28 <_ZN13on_break_expr4anon7expr_fn2a4E+104>: mov %rdi,-0x50(%rbp) | |
0x0000000100001b2c <_ZN13on_break_expr4anon7expr_fn2a4E+108>: mov %rcx,%rdi | |
0x0000000100001b2f <_ZN13on_break_expr4anon7expr_fn2a4E+111>: mov %rsi,-0x58(%rbp) | |
0x0000000100001b33 <_ZN13on_break_expr4anon7expr_fn2a4E+115>: mov %rcx,%rsi | |
0x0000000100001b36 <_ZN13on_break_expr4anon7expr_fn2a4E+118>: callq 0x100000a90 <_ZN9Ident_new17hfd4a5c181a2251a44v0.0E> | |
0x0000000100001b3b <_ZN13on_break_expr4anon7expr_fn2a4E+123>: jmp 0x100001b3d <_ZN13on_break_expr4anon7expr_fn2a4E+125> | |
0x0000000100001b3d <_ZN13on_break_expr4anon7expr_fn2a4E+125>: lea -0x18(%rbp),%rdi | |
0x0000000100001b41 <_ZN13on_break_expr4anon7expr_fn2a4E+129>: lea -0x38(%rbp),%rdx | |
0x0000000100001b45 <_ZN13on_break_expr4anon7expr_fn2a4E+133>: mov -0x50(%rbp),%rsi | |
0x0000000100001b49 <_ZN13on_break_expr4anon7expr_fn2a4E+137>: mov -0x60(%rbp),%rax | |
0x0000000100001b4d <_ZN13on_break_expr4anon7expr_fn2a4E+141>: callq *%rax ;;; Invalid RAX here! | |
0x0000000100001b4f <_ZN13on_break_expr4anon7expr_fn2a4E+143>: mov -0x18(%rbp),%rax | |
0x0000000100001b53 <_ZN13on_break_expr4anon7expr_fn2a4E+147>: add $0x70,%rsp | |
0x0000000100001b57 <_ZN13on_break_expr4anon7expr_fn2a4E+151>: pop %rbp | |
0x0000000100001b58 <_ZN13on_break_expr4anon7expr_fn2a4E+152>: retq | |
0x0000000100001b59 <_ZN13on_break_expr4anon7expr_fn2a4E+153>: mov %edx,%ecx | |
0x0000000100001b5b <_ZN13on_break_expr4anon7expr_fn2a4E+155>: mov %rax,-0x68(%rbp) | |
0x0000000100001b5f <_ZN13on_break_expr4anon7expr_fn2a4E+159>: mov %ecx,-0x6c(%rbp) | |
0x0000000100001b62 <_ZN13on_break_expr4anon7expr_fn2a4E+162>: callq 0x10004713c <dyld_stub_upcall_reset_stack_limit> | |
0x0000000100001b67 <_ZN13on_break_expr4anon7expr_fn2a4E+167>: mov -0x6c(%rbp),%ecx | |
0x0000000100001b6a <_ZN13on_break_expr4anon7expr_fn2a4E+170>: mov %ecx,-0x40(%rbp) | |
0x0000000100001b6d <_ZN13on_break_expr4anon7expr_fn2a4E+173>: mov -0x68(%rbp),%rax | |
0x0000000100001b71 <_ZN13on_break_expr4anon7expr_fn2a4E+177>: mov %rax,-0x48(%rbp) | |
0x0000000100001b75 <_ZN13on_break_expr4anon7expr_fn2a4E+181>: xor %eax,%eax | |
0x0000000100001b77 <_ZN13on_break_expr4anon7expr_fn2a4E+183>: mov %eax,%edi | |
0x0000000100001b79 <_ZN13on_break_expr4anon7expr_fn2a4E+185>: lea -0x28(%rbp),%rsi | |
0x0000000100001b7d <_ZN13on_break_expr4anon7expr_fn2a4E+189>: callq 0x100001bd5 <_ZN38_$SP$syntax..fold..ast_fold.$x27static9glue_drop19hf24896cd362d20b3a9E> | |
0x0000000100001b82 <_ZN13on_break_expr4anon7expr_fn2a4E+194>: mov -0x40(%rbp),%eax | |
0x0000000100001b85 <_ZN13on_break_expr4anon7expr_fn2a4E+197>: mov -0x48(%rbp),%rdi | |
0x0000000100001b89 <_ZN13on_break_expr4anon7expr_fn2a4E+201>: mov %eax,-0x70(%rbp) | |
0x0000000100001b8c <_ZN13on_break_expr4anon7expr_fn2a4E+204>: callq 0x100047142 <dyld_stub__Unwind_Resume> | |
End of assembler dump. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(gdb) disassem | |
Dump of assembler code for function _ZN13on_break_expr4anon7expr_fn2a6E: | |
0x0000000100001b20 <_ZN13on_break_expr4anon7expr_fn2a6E+0>: cmp %gs:0x330,%rsp | |
0x0000000100001b29 <_ZN13on_break_expr4anon7expr_fn2a6E+9>: ja 0x100001b45 <_ZN13on_break_expr4anon7expr_fn2a6E+37> | |
0x0000000100001b2b <_ZN13on_break_expr4anon7expr_fn2a6E+11>: mov $0x58,%r10 | |
0x0000000100001b35 <_ZN13on_break_expr4anon7expr_fn2a6E+21>: mov $0x0,%r11 | |
0x0000000100001b3f <_ZN13on_break_expr4anon7expr_fn2a6E+31>: callq 0x10004708a <__morestack> | |
0x0000000100001b44 <_ZN13on_break_expr4anon7expr_fn2a6E+36>: retq | |
0x0000000100001b45 <_ZN13on_break_expr4anon7expr_fn2a6E+37>: push %rbp | |
0x0000000100001b46 <_ZN13on_break_expr4anon7expr_fn2a6E+38>: mov %rsp,%rbp | |
0x0000000100001b49 <_ZN13on_break_expr4anon7expr_fn2a6E+41>: sub $0x50,%rsp | |
0x0000000100001b4d <_ZN13on_break_expr4anon7expr_fn2a6E+45>: lea -0x18(%rbp),%rax | |
0x0000000100001b51 <_ZN13on_break_expr4anon7expr_fn2a6E+49>: mov %rsi,-0x8(%rbp) | |
0x0000000100001b55 <_ZN13on_break_expr4anon7expr_fn2a6E+53>: mov 0x20(%rdi),%rsi | |
0x0000000100001b59 <_ZN13on_break_expr4anon7expr_fn2a6E+57>: int3 | |
0x0000000100001b5a <_ZN13on_break_expr4anon7expr_fn2a6E+58>: mov -0x8(%rbp),%rdx | |
0x0000000100001b5e <_ZN13on_break_expr4anon7expr_fn2a6E+62>: mov %rax,%rdi | |
0x0000000100001b61 <_ZN13on_break_expr4anon7expr_fn2a6E+65>: mov %rsi,-0x50(%rbp) | |
0x0000000100001b65 <_ZN13on_break_expr4anon7expr_fn2a6E+69>: mov %rcx,%rsi | |
0x0000000100001b68 <_ZN13on_break_expr4anon7expr_fn2a6E+72>: callq 0x100000af0 <_ZN9Ident_new17hfd4a5c181a2251a44v0.0E> | |
0x0000000100001b6d <_ZN13on_break_expr4anon7expr_fn2a6E+77>: mov $0x0,%rdi | |
0x0000000100001b77 <_ZN13on_break_expr4anon7expr_fn2a6E+87>: lea -0x38(%rbp),%rsi | |
0x0000000100001b7b <_ZN13on_break_expr4anon7expr_fn2a6E+91>: mov -0x50(%rbp),%rax | |
0x0000000100001b7f <_ZN13on_break_expr4anon7expr_fn2a6E+95>: mov (%rax),%rcx | |
0x0000000100001b82 <_ZN13on_break_expr4anon7expr_fn2a6E+98>: mov %rcx,-0x38(%rbp) | |
0x0000000100001b86 <_ZN13on_break_expr4anon7expr_fn2a6E+102>: mov 0x8(%rax),%rcx | |
0x0000000100001b8a <_ZN13on_break_expr4anon7expr_fn2a6E+106>: mov %rcx,-0x30(%rbp) | |
0x0000000100001b8e <_ZN13on_break_expr4anon7expr_fn2a6E+110>: callq 0x100001bc6 <_ZN38_$SP$syntax..fold..ast_fold.$x27static9glue_take19hf24896cd362d20b3aaE> | |
0x0000000100001b93 <_ZN13on_break_expr4anon7expr_fn2a6E+115>: lea -0x28(%rbp),%rdi | |
0x0000000100001b97 <_ZN13on_break_expr4anon7expr_fn2a6E+119>: lea -0x48(%rbp),%rdx | |
0x0000000100001b9b <_ZN13on_break_expr4anon7expr_fn2a6E+123>: mov -0x30(%rbp),%rsi | |
0x0000000100001b9f <_ZN13on_break_expr4anon7expr_fn2a6E+127>: mov -0x38(%rbp),%rax | |
0x0000000100001ba3 <_ZN13on_break_expr4anon7expr_fn2a6E+131>: mov 0x98(%rax),%rax | |
0x0000000100001baa <_ZN13on_break_expr4anon7expr_fn2a6E+138>: mov -0x18(%rbp),%rcx | |
0x0000000100001bae <_ZN13on_break_expr4anon7expr_fn2a6E+142>: mov %rcx,-0x48(%rbp) | |
0x0000000100001bb2 <_ZN13on_break_expr4anon7expr_fn2a6E+146>: mov -0x10(%rbp),%rcx | |
0x0000000100001bb6 <_ZN13on_break_expr4anon7expr_fn2a6E+150>: mov %rcx,-0x40(%rbp) | |
0x0000000100001bba <_ZN13on_break_expr4anon7expr_fn2a6E+154>: callq *%rax ;;; Correct RAX here! | |
0x0000000100001bbc <_ZN13on_break_expr4anon7expr_fn2a6E+156>: mov -0x28(%rbp),%rax | |
0x0000000100001bc0 <_ZN13on_break_expr4anon7expr_fn2a6E+160>: add $0x50,%rsp | |
0x0000000100001bc4 <_ZN13on_break_expr4anon7expr_fn2a6E+164>: pop %rbp | |
0x0000000100001bc5 <_ZN13on_break_expr4anon7expr_fn2a6E+165>: retq | |
End of assembler dump. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern mod syntax; | |
use syntax::ast::{Expr_, ExprBreak, Name}; | |
use syntax::ast::Ident; | |
use syntax::fold; | |
macro_rules! int3( () => ( unsafe { asm!( "int3" ); } ) ) | |
// macro_rules! int3( () => ( { } ) ) | |
pub fn Ident_new(x:Name) -> Ident { | |
int3!(); | |
Ident::new(x) | |
} | |
pub fn on_break_expr(e: &Expr_, fld: @fold::ast_fold) -> Expr_ { | |
match *e { | |
ExprBreak(ref opt_ident) => { | |
int3!(); | |
debug!("fold ExprBreak input: %?", opt_ident); | |
let ret = ExprBreak(opt_ident.map_move(|x| { | |
int3!(); | |
// let i1 = Ident::new(x); | |
let i2 = fld.fold_ident(Ident_new(x)); // *** 1 | |
i2.name | |
})); | |
debug!("fold ExprBreak output: %?", ret); | |
ret | |
}, | |
_ => { loop { } } | |
} | |
} | |
fn main() { | |
let eb = ExprBreak(Some(0)); | |
let af = fold::default_ast_fold() as @fold::ast_fold; | |
on_break_expr(&eb, af); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern mod syntax; | |
use syntax::ast::{Expr_, ExprBreak, Name}; | |
use syntax::ast::Ident; | |
use syntax::fold; | |
macro_rules! int3( () => ( unsafe { asm!( "int3" ); } ) ) | |
// macro_rules! int3( () => ( { } ) ) | |
pub fn Ident_new(x:Name) -> Ident { | |
int3!(); | |
Ident::new(x) | |
} | |
pub fn on_break_expr(e: &Expr_, fld: @fold::ast_fold) -> Expr_ { | |
match *e { | |
ExprBreak(ref opt_ident) => { | |
int3!(); | |
debug!("fold ExprBreak input: %?", opt_ident); | |
let ret = ExprBreak(opt_ident.map_move(|x| { | |
int3!(); | |
let i1 = Ident_new(x); // These are the differences | |
let i2 = fld.fold_ident(i1); // that seem to matter. | |
i2.name | |
})); | |
debug!("fold ExprBreak output: %?", ret); | |
ret | |
}, | |
_ => { loop { } } | |
} | |
} | |
fn main() { | |
let eb = ExprBreak(Some(0)); | |
let af = fold::default_ast_fold() as @fold::ast_fold; | |
on_break_expr(&eb, af); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment