From ee3eb39039b5d7d00bf3f1f16d1c2442ce1d6d0a Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 28 May 2016 17:13:51 +0200 Subject: [PATCH 1/2] Prevent overflows by increasing ring buffer size Via trial and error, I could verify that all google-api-rs crates actually build if the ring-buffer is about 3 times larger than before. As the code is generated, some types are massive, and there is more complexity than in hand-written code. Increasing the buffer size should have no disadvantage, neither to performance, nor on memory requirements. --- syntex_syntax/src/print/pp.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntex_syntax/src/print/pp.rs b/syntex_syntax/src/print/pp.rs index e45e97af..ac3711a2 100644 --- a/syntex_syntax/src/print/pp.rs +++ b/syntex_syntax/src/print/pp.rs @@ -163,9 +163,9 @@ pub struct PrintStackElem { const SIZE_INFINITY: isize = 0xffff; pub fn mk_printer<'a>(out: Box, linewidth: usize) -> Printer<'a> { - // Yes 3, it makes the ring buffers big enough to never + // Yes 10, it makes the ring buffers big enough to never // fall behind. - let n: usize = 3 * linewidth; + let n: usize = 10 * linewidth; debug!("mk_printer {}", linewidth); let token = vec![Token::Eof; n]; let size = vec![0; n]; From 70dadef35f0c7f8f62ca410e6f9448593d6fda43 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 28 May 2016 18:30:09 +0200 Subject: [PATCH 2/2] Increase ring-buffer size even more It seems, the most complex API, dfa-reporting, requires an even higher value. Reproduce this with ``` make dfareporting2d1-cli-cargo ARGS="build --no-default-features --features=with-syntex" ``` --- syntex_syntax/src/print/pp.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntex_syntax/src/print/pp.rs b/syntex_syntax/src/print/pp.rs index ac3711a2..c3f2cfb7 100644 --- a/syntex_syntax/src/print/pp.rs +++ b/syntex_syntax/src/print/pp.rs @@ -163,9 +163,9 @@ pub struct PrintStackElem { const SIZE_INFINITY: isize = 0xffff; pub fn mk_printer<'a>(out: Box, linewidth: usize) -> Printer<'a> { - // Yes 10, it makes the ring buffers big enough to never + // Yes 55, it makes the ring buffers big enough to never // fall behind. - let n: usize = 10 * linewidth; + let n: usize = 55 * linewidth; debug!("mk_printer {}", linewidth); let token = vec![Token::Eof; n]; let size = vec![0; n];