diff options
| author | iximeow <me@iximeow.net> | 2024-06-19 10:46:49 -0700 | 
|---|---|---|
| committer | iximeow <me@iximeow.net> | 2024-06-19 10:46:49 -0700 | 
| commit | 55548603b88ccf0babd081bd636c73ca164da919 (patch) | |
| tree | 7594d2be062105e62c3af284d5f052aaa57f78bb /src | |
| parent | 49e910b50066161fcf581c4aec775655f85cffe3 (diff) | |
hoist set_len calls to have fewer live values
Diffstat (limited to 'src')
| -rw-r--r-- | src/long_mode/display.rs | 36 | 
1 files changed, 24 insertions, 12 deletions
diff --git a/src/long_mode/display.rs b/src/long_mode/display.rs index a60b2fd..0188361 100644 --- a/src/long_mode/display.rs +++ b/src/long_mode/display.rs @@ -555,6 +555,10 @@ impl DisplaySink for alloc::string::String {              let mut rem = new_bytes.len() as isize; +            // set_len early because there is no way to avoid the following asm!() writing that +            // same number of bytes into buf +            buf.set_len(buf.len() + new_bytes.len()); +              core::arch::asm!(                  "6:",                  "cmp {rem:e}, 16", @@ -598,8 +602,6 @@ impl DisplaySink for alloc::string::String {                  buf = out(reg) _,                  options(nostack),              ); - -            buf.set_len(buf.len() + new_bytes.len());          }          /*          for i in 0..new_bytes.len() { @@ -633,6 +635,10 @@ impl DisplaySink for alloc::string::String {              let mut rem = new_bytes.len() as isize; +            // set_len early because there is no way to avoid the following asm!() writing that +            // same number of bytes into buf +            buf.set_len(buf.len() + new_bytes.len()); +              core::arch::asm!(                  "7:",                  "cmp {rem:e}, 8", @@ -667,8 +673,6 @@ impl DisplaySink for alloc::string::String {                  buf = out(reg) _,                  options(nostack),              ); - -            buf.set_len(buf.len() + new_bytes.len());          }          /*          for i in 0..new_bytes.len() { @@ -702,6 +706,10 @@ impl DisplaySink for alloc::string::String {              let mut rem = new_bytes.len() as isize; +            // set_len early because there is no way to avoid the following asm!() writing that +            // same number of bytes into buf +            buf.set_len(buf.len() + new_bytes.len()); +              core::arch::asm!(                  "8:",                  "cmp {rem:e}, 4", @@ -729,8 +737,6 @@ impl DisplaySink for alloc::string::String {                  buf = out(reg) _,                  options(nostack),              ); - -            buf.set_len(buf.len() + new_bytes.len());          }          /*          for i in 0..new_bytes.len() { @@ -926,6 +932,10 @@ impl DisplaySink for BigEnoughString {              let mut rem = new_bytes.len() as isize; +            // set_len early because there is no way to avoid the following asm!() writing that +            // same number of bytes into buf +            buf.set_len(buf.len() + new_bytes.len()); +              core::arch::asm!(                  "6:",                  "cmp {rem:e}, 16", @@ -969,8 +979,6 @@ impl DisplaySink for BigEnoughString {                  buf = out(reg) _,                  options(nostack),              ); - -            buf.set_len(buf.len() + new_bytes.len());          }          /*          for i in 0..new_bytes.len() { @@ -1002,6 +1010,10 @@ impl DisplaySink for BigEnoughString {              let mut rem = new_bytes.len() as isize; +            // set_len early because there is no way to avoid the following asm!() writing that +            // same number of bytes into buf +            buf.set_len(buf.len() + new_bytes.len()); +              core::arch::asm!(                  "7:",                  "cmp {rem:e}, 8", @@ -1036,8 +1048,6 @@ impl DisplaySink for BigEnoughString {                  buf = out(reg) _,                  options(nostack),              ); - -            buf.set_len(buf.len() + new_bytes.len());          }          /*          for i in 0..new_bytes.len() { @@ -1069,6 +1079,10 @@ impl DisplaySink for BigEnoughString {              let mut rem = new_bytes.len() as isize; +            // set_len early because there is no way to avoid the following asm!() writing that +            // same number of bytes into buf +            buf.set_len(buf.len() + new_bytes.len()); +              core::arch::asm!(                  "8:",                  "cmp {rem:e}, 4", @@ -1096,8 +1110,6 @@ impl DisplaySink for BigEnoughString {                  buf = out(reg) _,                  options(nostack),              ); - -            buf.set_len(buf.len() + new_bytes.len());          }          /*          for i in 0..new_bytes.len() {  | 
