From dcf08cd6c049c47cb94d0a136668b2ef0f2004e2 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 8 Aug 2010 14:12:22 +0400 Subject: [PATCH] Warn about automatic boxing of SSE values in the compiler. Since the whole point of SSE is high performance, boxing defeats the purpose and should be immediately flagged. Also enable marking functions so that the compiler warns if they are not inlined. --- src/cmp/cmpc-inliner.lsp | 5 +++++ src/cmp/cmpffi.lsp | 6 ++++++ src/cmp/sysfun.lsp | 4 +++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/cmp/cmpc-inliner.lsp b/src/cmp/cmpc-inliner.lsp index d2a9be114..ed2457cbd 100644 --- a/src/cmp/cmpc-inliner.lsp +++ b/src/cmp/cmpc-inliner.lsp @@ -102,6 +102,11 @@ (let ((other (inline-type-matches x types return-type))) (when other (setf output (choose-inline-info output other return-type return-rep-type))))) + (when (and (null output) + (get-sysprop fname 'should-be-inlined) + (>= (cmp-env-optimization 'speed) 1)) + (cmpwarn-style "Could not inline call to ~S ~S - performance may be degraded." + fname types)) output)) (defun to-fixnum-float-type (type) diff --git a/src/cmp/cmpffi.lsp b/src/cmp/cmpffi.lsp index aeaca653a..3c27f8a0a 100644 --- a/src/cmp/cmpffi.lsp +++ b/src/cmp/cmpffi.lsp @@ -326,6 +326,12 @@ (otherwise (coercion-error)))) ((:object) + #+sse2 + (case loc-rep-type + ((:int-sse-pack :float-sse-pack :double-sse-pack) + (when (>= (cmp-env-optimization 'speed) 1) + (cmpwarn-style "Boxing a value of type ~S - performance degraded." + loc-rep-type)))) (wt-to-object-conversion loc-rep-type loc)) ((:pointer-void) (case loc-rep-type diff --git a/src/cmp/sysfun.lsp b/src/cmp/sysfun.lsp index 82c3f56b2..f68729ee9 100644 --- a/src/cmp/sysfun.lsp +++ b/src/cmp/sysfun.lsp @@ -23,7 +23,7 @@ (in-package "COMPILER") (defun def-inline (name safety arg-types return-rep-type expansion - &key (one-liner t) (exact-return-type nil) + &key (one-liner t) (exact-return-type nil) (inline-or-warn nil) &aux arg-rep-types) (setf safety (case safety @@ -36,6 +36,8 @@ arg-types)) (when (eq return-rep-type t) (setf return-rep-type :object)) + (when inline-or-warn + (put-sysprop name 'should-be-inlined t)) (let* ((return-type (if (and (consp return-rep-type) (eq (first return-rep-type) 'values)) t