From 2de1aec7895eba7c197dfcc6da46810f22240ce9 Mon Sep 17 00:00:00 2001 From: "Peter S. Housel" Date: Tue, 26 Apr 2011 19:49:22 -0700 Subject: [PATCH] Bug 7520: Eliminate redundant type checks for keyword arguments. * sources/dfmc/harp-cg/harp-main.dylan (emit-check-type?): New method controlling when type checks are emitted. (emit-computation method on ): Remove. (emit-computation method on ): Use emit-check-type? to determine when to emit type checks. --- sources/dfmc/harp-cg/harp-main.dylan | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/sources/dfmc/harp-cg/harp-main.dylan b/sources/dfmc/harp-cg/harp-main.dylan index c2eecb0b8..069d58afe 100644 --- a/sources/dfmc/harp-cg/harp-main.dylan +++ b/sources/dfmc/harp-cg/harp-main.dylan @@ -1286,18 +1286,23 @@ end method; // types -define method emit-computation (back-end :: , c :: ) => () - // MUST EMIT THESE CAUSE THEY CHECK FOR THINGS LIKE SIZE :: FOR VECTOR - emit-type-check(back-end, - emit-reference(back-end, #f, c.computation-value), - c.type); - next-method(); -end method emit-computation; +define method emit-check-type? + (back-end :: , c :: ) + => (well? :: ) + // Don't emit type checks for the Dylan library + ~compiling-dylan-library?() +end method; + +define method emit-check-type? + (back-end :: , c :: ) + => (well? :: ) + // We must emit these cause they check for things like size :: + // for vector() + #t +end method; define method emit-computation (back-end :: , c :: ) => () - if (compiling-dylan-library?()) - // don't emit type checks for the Dylan library - else + if (emit-check-type?(back-end, c)) emit-type-check(back-end, emit-reference(back-end, #f, c.computation-value), c.type);