From 1cdc827b3ae2b9a9952f0d497d630c15054015cd Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Sun, 2 Jun 2013 21:25:21 +0400 Subject: [PATCH] Better calls to static functions on x86-64. Encode the calls to static functions as an immediate argument to the CALL instruction when possible. --- NEWS | 1 + src/compiler/srctran.lisp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/NEWS b/NEWS index d84fd52..b42f0ec 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ changes relative to sbcl-1.1.8: * enchancement: disassemble now annotates some previously missing static functions, like LENGTH. * optimization: calls to static functions on x86-64 use less instructions. + * optimization: compute encode-universal-time at compile time when possible. changes in sbcl-1.1.8 relative to sbcl-1.1.7: * notice: The implementation of MAP-ALLOCATED-OBJECTS (the heart of diff --git a/src/compiler/srctran.lisp b/src/compiler/srctran.lisp index 80338ea..c90ca44 100644 --- a/src/compiler/srctran.lisp +++ b/src/compiler/srctran.lisp @@ -4658,3 +4658,22 @@ (policy-quality-name-p (lvar-value quality-name))) (give-up-ir1-transform)) '(%policy-quality policy quality-name)) + +(deftransform encode-universal-time + ((second minute hour date month year &optional time-zone) + ((constant-arg (mod 60)) (constant-arg (mod 60)) + (constant-arg (mod 24)) + (constant-arg (integer 1 31)) + (constant-arg (integer 1 12)) + (constant-arg (integer 1899)) + (constant-arg (rational -24 24)))) + (let ((second (lvar-value second)) + (minute (lvar-value minute)) + (hour (lvar-value hour)) + (date (lvar-value date)) + (month (lvar-value month)) + (year (lvar-value year)) + (time-zone (lvar-value time-zone))) + (if (zerop (rem time-zone 1/3600)) + (encode-universal-time second minute hour date month year time-zone) + (give-up-ir1-transform)))) -- 1.7.10.4