Skip to content

Commit

Permalink
Bug 7520: Eliminate redundant type checks for keyword arguments.
Browse files Browse the repository at this point in the history
* sources/dfmc/harp-cg/harp-main.dylan
  (emit-check-type?): New method controlling when type checks are emitted.
  (emit-computation method on <keyword-check-type>): Remove.
  (emit-computation method on <check-type>): Use emit-check-type? to determine
   when to emit type checks.
  • Loading branch information
housel committed Apr 27, 2011
1 parent 68d828b commit 2de1aec
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions sources/dfmc/harp-cg/harp-main.dylan
Expand Up @@ -1286,18 +1286,23 @@ end method;

// types

define method emit-computation (back-end :: <harp-back-end>, c :: <keyword-check-type>) => ()
// MUST EMIT THESE CAUSE THEY CHECK FOR THINGS LIKE SIZE :: <INTEGER> 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 :: <harp-back-end>, c :: <check-type>)
=> (well? :: <boolean>)
// Don't emit type checks for the Dylan library
~compiling-dylan-library?()
end method;

define method emit-check-type?
(back-end :: <harp-back-end>, c :: <keyword-check-type>)
=> (well? :: <boolean>)
// We must emit these cause they check for things like size :: <integer>
// for vector()
#t
end method;

define method emit-computation (back-end :: <harp-back-end>, c :: <check-type>) => ()
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);
Expand Down

0 comments on commit 2de1aec

Please sign in to comment.