From 2d8cefcabcd4ba34bb777291adaa42e68de3fc46 Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 30 Aug 2016 10:45:39 +0000 Subject: [PATCH] Do not simultaneously clobber registers passed into assembly. This is not actually legal (although the restriction is not documented anywhere), and is not caught by LLVM unless the codegen option -verify-machineinstrs is specified. This option is now used on Travis. While not legal, this does not seem to result in invalid output (although it creates an unnecessary spill); however, under extremely specific circumstances (e.g. when a register scavenger is run under severe pressure), this will result in a codegen crash, which is how I found it. --- .travis.yml | 4 ++-- src/arch/or1k.rs | 2 +- src/arch/x86.rs | 2 +- src/arch/x86_64.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index cecc79e..9e0985c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,8 @@ rust: nightly sudo: false install: - .travis/docs/install -script: - - cargo build --verbose +script: + - cargo rustc --verbose -- -C llvm-args=-verify-machineinstrs - cargo test --verbose - cargo bench --verbose - cargo doc diff --git a/src/arch/or1k.rs b/src/arch/or1k.rs index 863b373..5cfd629 100644 --- a/src/arch/or1k.rs +++ b/src/arch/or1k.rs @@ -156,7 +156,7 @@ pub unsafe fn swap(arg: usize, old_sp: &mut StackPointer, new_sp: &StackPointer, "{r4}" (old_sp) "{r5}" (new_sp) "{r6}" (new_cfa) - : "r3", "r4", "r5", "r6", "r7", + :/*"r0", "r1", "r2", "r3", "r4", "r5", "r6",*/"r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", diff --git a/src/arch/x86.rs b/src/arch/x86.rs index 4954ede..dbbdd67 100644 --- a/src/arch/x86.rs +++ b/src/arch/x86.rs @@ -151,7 +151,7 @@ pub unsafe fn swap(arg: usize, old_sp: &mut StackPointer, new_sp: &StackPointer, "{esi}" (old_sp) "{edx}" (new_sp) "{edi}" (new_cfa) - : "eax", "ebx", "ecx", "edx", "esi", "edi", //"ebp", "esp", + :/*"eax",*/"ebx", "ecx",/*"edx", "esi", "edi", "ebp", "esp",*/ "mmx0", "mmx1", "mmx2", "mmx3", "mmx4", "mmx5", "mmx6", "mmx7", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", "cc", "fpsr", "flags", "memory" diff --git a/src/arch/x86_64.rs b/src/arch/x86_64.rs index 5cd668a..7f3cb22 100644 --- a/src/arch/x86_64.rs +++ b/src/arch/x86_64.rs @@ -153,7 +153,7 @@ pub unsafe fn swap(arg: usize, old_sp: &mut StackPointer, new_sp: &StackPointer, "{rsi}" (old_sp) "{rdx}" (new_sp) "{rcx}" (new_cfa) - : "rax", "rbx", "rcx", "rdx", "rsi", "rdi", //"rbp", "rsp", + : "rax", "rbx", /*"rcx", "rdx", "rsi", "rdi", "rbp", "rsp",*/ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15",