Commit graph

49 commits

Author SHA1 Message Date
Stas Boukarev 564aef8890 Remove combination-implementation-style. 2024-03-06 18:09:08 +03:00
Charles Zhang 8416c7d188 Update OPTIMIZATIONS.
It stack allocates now.
2023-09-07 16:27:00 +02:00
Douglas Katzman fe3a4e89d2 Remove obsolete item. 2016-06-13 13:40:50 -04:00
Douglas Katzman d7004a0332 Update OPTIMIZATIONS 2014-12-03 01:30:04 -05:00
Paul Khuong 42fbc5e52f Bring OPTIMIZATIONS up to date
Some of these things were implemented months or a few years ago.

 Also, fix the header for NEWS.
2011-08-31 09:05:16 -04:00
Christophe Rhodes a18894dbea 1.0.32.21: compress most unibyte-external-format definitions
All the unibyte-mapper-based external-formats had huge amounts of
cut-and-pasted code, differing only in names of functions.  This is,
oddly enough, a clear case for abstracting away the repeated code into a
macro.

In the process, convert them to the multibyte apparatus, which has support
for the nice restarts, and remove the too-simple unibyte
DEFINE-EXTERNAL-FORMAT (and EXTERNAL-FORMAT-DECODING-ERROR) which are now
unused.

Include a far-from-comprehensive set of tests, which are mostly for
iso-8859-x formats
2009-11-11 17:34:09 +00:00
Nikodemus Siivola e840f48179 1.0.28.51: better MAKE-ARRAY transforms
* Add a source transform for MAKE-ARRAY that declaims LIST and VECTOR
   as NOTINLINE, so the the MAKE-ARRAY deftransforms are able to pick
   them apart (for DIMENSIONS and :INITIAL-CONTENTS.)

 * INITIALIZE-VECTOR is a new magic function with a IR2-CONVERT
   transform. It's purpose is to allow open coding :INITIAL-CONTENTS
   initialization without inhibiting stack allocation.

 * Turns out that making stack allocation decisions during locall
   analysis is not enough since optimization iterates: if a transform
   occurs and introduces new LVARs that would be good for DX after
   the locall analysis has run for the combination, the new LVARs
   will not get their share of stacky goodness. Therefore, after
   a transform propagate DX information to the new functional
   explicitly (see MAYBE-PROPAGATE-DYNAMIC-EXTENT.)

 * The new logic is in TRANSFORM-MAKE-ARRAY-VECTOR, which handles
   all the cases of vector allocation with a known element type:

   ** :INITIAL-CONTENTS (LIST ...), (VECTOR ...) and (BACKQ-LIST ...)
      are picked apart when the length matches the vector length,
      and their arguments are spliced into the call.

      Constant :INITIAL-CONTENTS is picked apart as well.

      Initialization is done using INITIALIZE-VECTOR.

   ** Otherwise :INITIAL-CONTENTS is splatted in place using
      REPLACE after we have checked that the length matches.

   ** :INITIAL-ELEMENT not EQL to the default element uses
      FILL.

   ** Otherwise the default initialization is fine.

   Some additional hair here, since MAYBE-PROPAGATE-DYNAMIC-EXTENT
   cannot deal with OPTIONAL-DISPATCH functionals. So to ensure we get
   full benefit of it, make sure the lambdas we transform to have only
   required arguments -- courtesy of new ELIMINATE-KEYWORD-ARGUMENT
   utility. (Note: it might be worth it to do something like this for
   many cases automatically, to reduce the number of lambdas the
   compiler generates. For inline lambdas we could do the whole &key
   handling _before_ the lambda is converted...)

 * Identify the case of (LIST N) as dimensions as being a vector,
   and delegate to TRANSFORM-MAKE-ARRAY-VECTOR.

 * More efficient allocation of simple multidimensional arrays in
   the presence of :INITIAL-CONTENTS (still slow, though) and
   :INITIAL-ELEMENT (not bad.)

 * Fix the source transform for VECTOR so that it too can stack
   allocate.

 * Updates tests and docs.
2009-05-16 12:23:13 +00:00
Nikodemus Siivola 35ec0bb705 1.0.24.7: CHAR-CODE type derivation
* Patch by Paul Khuong.
2009-01-02 16:05:28 +00:00
Nikodemus Siivola ff5c74843b 1.0.24.6: OPTIMIZATION #23 is there already
* Type information for &REST lists is available after constraint
   propagation.
2009-01-02 15:11:08 +00:00
Nikodemus Siivola 9264b512a2 1.0.19.9: elide runtime calls to %COERCE-CALLABLE-TO-FUN in more cases
* Core change: %COERCE-CALLABLE-TO-FUN can now convert to
   GLOBAL-FUNCTION.

 * While at it, refactor the whole "make up a form that returns a
   function to use instead of this lvar or source form" thing for
   clarity.

 * Record slightly crazy OPTIMIZATION possibility.
2008-07-31 12:52:37 +00:00
Nikodemus Siivola 45bc305be4 1.0.17.24: refactor handling of constants in the compiler
* Coalesce non-circular lists, bit-vectors, and non-base-strings in the
   file-compiler. (We could do more, but these are the "easy" ones.) Takes
   care of OPTIMIZATIONS #34 in practice: outside the file compiler one can
   still trick the system into similar behaviour, but that seems a fairly
   academic concern.

 * Never go through SYMBOL-VALUE at runtime to fetch the value of a constant
   variable in compiled code.

 * Use (SYMBOL-VALUE <NAME>) as the load-form to dump references to named
   constants into fasls.

 * Signal a continuable error if an attempt to change the SYMBOL-VALUE of a
   constant variable is made.

 * Assignments to undefined variables go through SET, so that one
   cannot accidentally modify a constant by doing something like:

    (defun set-foo (x) (setq foo x))
    (defconstant foo 42)
    (set-foo 13)

 * Gets rid of INFO :VARIABLE :CONSTANT-VALUE, and just uses SYMBOL-VALUE to
   store constant values.

 * Move definition of SB!XC:LAMBDA-LIST-KEYWORDS to be beginning of the build,
   and use it instead of the host LAMBDA-LIST-KEYWORDS where appropriate.

 * Tests.
2008-06-04 12:39:38 +00:00
Nikodemus Siivola 975f1932ac 1.0.10.7: multiply-used DX LVARS
* HANDLE-NESTED-DYNAMIC-EXTENT maps over all the uses of the LVAR,
  collecting their argument lvars as well.

* RECHECK-DYNAMIC-EXTENT-LVARS accepts multiply-used DX LVARs,
  checking that all uses support stack allocation.

* UPDATE-UVL-LIVE-SETS accepts multiply-used DX LVARs, doing that
  lifetime merging with all uses.

* ...and OOPS, move the NEWS entries of .5 and .6 to a new section for
  1.0.11...
2007-09-26 16:00:44 +00:00
Nikodemus Siivola 6d69dfcc43 1.0.10.6: nested DX allocation
* RECOGNIZE-DYNAMIC-EXTENT-LVARS needs to propagate DX information to
  combination arguments, so that

  (LET ((X (LIST (LIST 1 2) (LIST 3 4))))
    (DECLARE (DYNAMIC-EXTENT X))
    (FOO X))

  does the right thing.
2007-09-26 15:54:58 +00:00
Nikodemus Siivola 66cff1e131 1.0.10.5: dynamic-extent CONS
* Extend EMIT-FIXED-ALLOC to support stack-allocation.

* Appropriate DEFOPTIMIZER for CONS.

Note: it seems like it should be a simple matter to support stack
allocation of all primitive objects allocated using the :ALLOC-TRANS
framework.
2007-09-26 15:44:23 +00:00
Nikodemus Siivola 90c2b05636 1.0.6.33: small CLOS cache improvements
* General PCL cleanups:
   -- Get rid of FUNCTION-FUNCALL and FUNCTION-APPLY: instead just
      declare the argument type. ETOOMANYLAYERSOFABSTRACTION.
   -- Implement the unused GET-FUN in terms of GET-FUN1 for clarity.

 * Use a single bitmask instead of multiply and mask to compute the
   cache index (like the original implementation).

 * Slower probe depth limit growth: caches with 1024 lines used to
   have probe depth 16, which is starting to be on the slow side, and
   some fairly common generics like PRINT-OBJECT have caches with
   enough entries that they will be large no matter what. Instead of
   (ceiling (sqrt lines) 2) make it (ceiling (sqrt (sqrt lines))).

 * Better CACHE-HAS-INVALID-ENTRIES-P (does less work, picks up
   incomplete lines.)

 * MAP-ALL-CACHES and CHECK-CACHE-CONSISTENCY for debugging and
   analysis.

 * Typo in the format string in PRINT-OBJECT (CACHE T).

 * A couple of non-CLOS optimization possibilities recorded.
2007-06-08 08:37:10 +00:00
Nathan Froyd bef0d9c127 1.0.4.66: Undo D-X changes in 1.0.4.63 2007-04-11 20:51:56 +00:00
Nathan Froyd 43b1750ede 1.0.4.63: Don't zeroize dynamic-extent simple-unboxed-arrays on x86 and x86-64 2007-04-11 16:35:27 +00:00
Juho Snellman f68d0f59fa 1.0.1.15:
Add RESTART-FRAME command to the debugger, reduce the runtime cost
        of the debug catch tags.

        * Change the debugger catch tag to funcall the thrown value, rather
          than just returning it.
        * Make RETURN throw a thunk that returns an appropriate value,
          and RESTART-FRAME throw a thunk that calls the same function again
          with the same arguments.
        * Always emit the debug catch with a static tag, rather than consing
          up a new tag every time the catch is entered.
        * To ensure that the tags are unique, the RETURN and RESTART-FRAME
          commands will first cons up a new tag, find the right catch-block
          structure on the stack, assign the new tag to the tag slot, and
          then throw the new tag.
        * Don't add the catch tags to some uninteresting (usually
          compiler-generated) functions, to reduce the compilation speed
          hit.
2007-01-09 03:25:02 +00:00
Nathan Froyd eb3db8fe3e 0.9.15.7:
More OPTIMIZATIONS.
2006-07-29 21:50:39 +00:00
Nathan Froyd 8877972d33 0.9.12.29:
Brain-dump some OPTIMIZATIONS.
2006-05-23 21:33:39 +00:00
Nathan Froyd 51344a3364 0.9.9.18:
Introduce new vm-support-routine COMBINATION-IMPLEMENTATION-STYLE
	  for letting the backend have a crack at implementing certain
	  functions directly (cf. OPTIMIZATIONS, #29);
	...implement a few efficient cases for PPC and x86.
2006-02-07 02:35:25 +00:00
Nathan Froyd 6c2c952e89 0.9.3.54:
Minor cleanups:

        * INSTALL spelling fix by Luis Oliveira;
        * dependent policy LET-CONVERTION => LET-CONVERSION;
        * Note optimization opportunity in OPTIMIZATIONS.
2005-08-15 22:00:39 +00:00
Nathan Froyd d319b944d9 0.9.3.2:
Micro-optimizations:
	* MAKE-FIXNUM on PPC now takes one instruction rather than two;
	* signed-num INTEGER-LENGTH VOP on PPC does not require a
          temporary register;
	* Added unsigned-num INTEGER-LENGTH VOP on PPC;
	* Musings on processor-specific micro-optimizations added to
	  OPTIMIZATIONS.
2005-07-26 18:51:43 +00:00
Christophe Rhodes f3f677703e 0.9.1.38:
Merge DFL raw-slots patch (sbcl-devel "raw slot changes"
	2005-05-18)
	... with an amalgam of ths' two mips versions;
	... note in OPTIMIZATIONS about the negative index idea, and the
		disabledness of HPPA
2005-06-12 14:02:34 +00:00
Alexey Dejneka 69ef68ba73 0.8.21.50:
* Changed implementation on ALLOCATE-VECTOR on X86:
        ... two VOPs: A-V-ON-HEAP and A-V-ON-STACK;
        ... choice between them is made with LTN-ANALYZEr;
        ... A-V-ON-STACK always fills vector with zeroes (fixes bug
            reported by Brian Downing).
2005-04-19 05:54:17 +00:00
Nikodemus Siivola d04b59670a 0.8.21.39: implement optimization #25
* transform EQL to EQ when at least other argument is known to be
    (OR FIXNUM (NOT NUMBER)).
2005-04-14 14:05:20 +00:00
Alexey Dejneka c097c9c3d4 0.8.19.38:
* Fix MISC.535: CONSTANT-LVAR-P looks through CASTs.
        * Workaround lack of recursion recognition in XC for
          PRINCIPAL-LVAR-USE.
2005-02-23 08:31:18 +00:00
Alexey Dejneka f846a7a310 0.8.19.34:
* Fix MISC.527: DEFTRANSFORM for BIT-AND and similar for
          vectors use (ARRAY-DIMENSION v 0) instead if LENGTH to get
          the full vector size.
2005-02-20 18:53:13 +00:00
Paul F. Dietz 9afd3958cf Added optimization opportunity #25: improved type-based optimization
of EQL forms.
2005-02-09 23:48:45 +00:00
Juho Snellman bffa99d35c 0.8.15.13:
Port over / reconstruct ancient CMUCL loop analysis code.
	Improve register allocation:
	... Pack TNs that are used in deep loops first, giving them a
	    higher chance of getting allocated in a register.
	... Inside loops, pack the most used TNs first.
	... When (> SPEED COMPILE-SPEED) attempt to pack the TNs into
	    the most used locations in the SB instead of the earlier
	    behaviour of scattering them into as many locations as
	    possible. This results in tighter allocation / fewer spills.
2004-10-12 22:01:39 +00:00
Alexey Dejneka 8902b8b6bd sbcl-0.8.14.11:
* Merge DX sbcl-0-8-13-dx branch.
        * Out-of-line VALUES does not cons.
        * Forbid loading of initialization files in foreign.test.sh.
2004-09-13 05:40:27 +00:00
Christophe Rhodes 59ac7389b0 0.8.12.35:
Possibly pointless micro-optimization for SXHASH
	... type tests for CONS are more expensive than type tests for
		LIST.  Distinguish between CONS and LIST manually, then,
		so that we can return the right answer more quickly for
		NIL.
	... exposes a bug in the cross-compiler: SXHASH is most
		definitely not constant-foldable there.
	... be even more paranoid about SXHASH/PSXHASH testing
2004-07-15 09:38:12 +00:00
Christophe Rhodes 3a4229d4a9 0.8.12.33:
Minor adjustment to BIT, SBIT source transforms
	... assert the dimensionality of the bit array based on the
		number of arguments in the call;
	... note potential for further optimization in OPTIMIZATIONS
2004-07-14 20:26:16 +00:00
Alexey Dejneka 64ec717cf1 0.8.7.13:
* Stack analysis: propagate liveness information from
          NLEs. (fixes bug 299, PFD's MISC.185, 186, 231, 232, 235,
          236, 237).
2004-01-14 04:42:52 +00:00
Christophe Rhodes 8f4ef01b8c 0.8.3.94:
Compiler fixes (touching only files in the alpha backend)
	... the assembly routine for (signed-byte 32) [sic] truncate did
		in fact work only for signed-byte 32 quantities, but was
		being called on signed-byte 64 quantities.  Fix it.
	... the translators for ASH were broken in amusing ways: some
		led to internal compiler errors when fed out-of-range
		numbers; more insidiously, others allowed temporaries
		to be overwritten in some cases.  Fix them.
	... lastly but not leastly, the %LI code to load an immediate
		was wrong in a very small proportion of cases.  After
		much scribbling, deduce why and fix it.
	... test cases to go with all of the above.
2003-09-26 17:19:13 +00:00
Alexey Dejneka 51c5280a4b 0.8.2.55:
* New bugs.
2003-08-23 04:17:55 +00:00
Alexey Dejneka d6cacf1366 0.8.2.38:
* Try to fix bug 267 = optimization issue #7: inside
          NAMED-LAMBDA replace references to a function with the same
          name with self-references;
        * ASSERT-GLOBAL-FUNCTION-DEFINITION-TYPE: do not put type
          assertions for functions with EXPLICIT-CHECK attribute;
        ... FLOAT-RADIX does not perform explicit check;
        * implement cross-compiler versions of %DPB and %WITH-ARRAY-DATA.
2003-08-17 17:17:06 +00:00
Christophe Rhodes 043a882050 0.8.2.30:
Fix PPC (complex double-float) bug as reported on sbcl-devel
	by Clemens Heitzinger 2003-08-12
	... the right way, not as per CSR patch sbcl-devel, but as per
		CSR words sbcl-devel;
	... also fix error reporting in CERROR format DEFTRANSFORM
		(oh, the irony).
2003-08-15 18:07:07 +00:00
Alexey Dejneka d59fb0b067 0.8.1.51:
* Update BUGS.
2003-07-21 06:09:55 +00:00
Christophe Rhodes 5808427974 0.8.1.14:
Fix OPTIMIZATIONS #1b on x86, at Gilbert Baumann's request (on
	#lisp IRC 2003-07-01)
	... new VOPs for base-char comparisons with constant second
		argument;
	... new transforms for CHAR< and CHAR> to ensure that any constant
		argument is second;
	... don't fall into the trap of assuming that the world is ASCII;
		instead, define SB!XC:CODE-CHAR and SB!XC:CHAR-CODE that
		deal with converting STANDARD-CHARs to and from ASCII codes;
	... in the interest of the sanity of those with slow machines, refactor
		tests/seq.impure.lisp slightly so that it takes somewhat less
		time than the cosmological epoch to run
2003-07-02 08:36:56 +00:00
Alexey Dejneka f601ededaa 0.8.1.4:
Update documentation for type checking.
2003-06-25 16:07:06 +00:00
Alexey Dejneka ef8086e0ef 0.8.0.85:
* New optimization to do.
        * Fix problem description for the bug 188 (thanks to cliini on
          #lisp).
2003-06-22 18:36:26 +00:00
Alexey Dejneka 37496d2b1c 0.pre8.31:
When EXTRACT-FUN-ARGS replaces inner function with the dummy
        LIST, mark the inner combination as known.
2003-04-03 09:09:39 +00:00
Alexey Dejneka ed85afcccb 0.pre8.26:
* Fixed bug reported by Robert E. Brown on sbcl-devel
          2003-01-21 (optimization issue 10)
          ** DERIVE-NODE-TYPE replaces references to lambda variables
             of type (EQL x) with a constant reference to x;
          ** UNLINK-NODE checks for a possibility of IF optimization;
2003-04-02 10:20:21 +00:00
Alexey Dejneka c5c178ceac 0.7.11.13:
Bugs.
2003-01-22 07:37:48 +00:00
Alexey Dejneka e049902f5e 0.7.11.10:
Fixed some bugs revealed by Paul Dietz' test suite:
        ** BOA constructor with &AUX argument without a default value does
           not cause a type error;
        ** CONSTANTP now returns true for all self-evaluating objects.
2003-01-19 09:40:15 +00:00
Alexey Dejneka 852a4504e8 0.7.11.1:
New bug.
2003-01-03 18:53:46 +00:00
Alexey Dejneka 34e8e7fd14 0.7.10.32:
Fix bug in CONSTANT-REFERENCE-P: function name may be
	(SETF symbol).
2002-12-27 11:05:20 +00:00
Alexey Dejneka caf8bb05a8 0.7.10.30:
Fixed bug 232, shown by Paul Dietz' test suite.
2002-12-22 14:19:52 +00:00