Skip to content

Commit

Permalink
Merge pull request #38 from 40ants/fix-stack-exhausting
Browse files Browse the repository at this point in the history
Fixed stack exhausting when trying to collect dependencies for some ASDF systems.
  • Loading branch information
svetlyak40wt authored Nov 28, 2023
2 parents 827926b + 519a350 commit 36d8243
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
24 changes: 21 additions & 3 deletions full/locatives/asdf-system.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,25 @@
serves as an example of a symbol that's not accessible in the
current package and consequently is not exported.")


(defun find-system (name)
"ASDF:FIND-SYSTEM is 1000 times slower than ASDF:REGISTERED-SYSTEM,
but REGISTERED-SYSTEM sometimes unable to find a system (for example
when this is a primary ASDF system, but it's defpackage defines
package with the name of primary system and a nickname equal to the
subsystem name. See log4cl-extras/core as example).
This we first try to use fast method and fallback to the slow one."
(or (asdf:registered-system name)
(asdf:find-system name)))


(defmethod locate-object (symbol (locative-type (eql 'asdf:system))
locative-args)
(assert (endp locative-args))
;; FIXME: This is slow as hell.
;; TODO: check if replacement of find-system with registered-system helped
(or (asdf:registered-system symbol)
(or (find-system symbol)
(locate-error)))

(defmethod canonical-reference ((system asdf:system))
Expand Down Expand Up @@ -118,9 +131,14 @@

(defgeneric asdf-system-dependencies (system)
(:method ((system-name string))
(asdf-system-dependencies (asdf:registered-system system-name)))
(asdf-system-dependencies (find-system system-name)))
(:method ((system-name (eql nil)))
;; Sometimes find-system might return NIL
;; and if we'll not process it separately, execution will go back
;; to the method where system-name is a symbol leading to heap exhaustion.
nil)
(:method ((system-name symbol))
(asdf-system-dependencies (asdf:registered-system system-name)))
(asdf-system-dependencies (find-system system-name)))
(:method ((system asdf:system))
(loop with base-system = (asdf:primary-system-name system)
with results = nil
Expand Down
2 changes: 2 additions & 0 deletions src/changelog.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
"*DOCUMENT-DOWNCASE-UPPERCASE-CODE*"
;; These objects are not documented yet:
"40ANTS-DOC/COMMONDOC/XREF:XREF"))
(0.15.2 2023-11-28
"* Fixed stack exhausting when trying to collect dependencies for some ASDF systems.")
(0.15.1 2023-08-05
"* Fixed issue with unpacking Highlight.js archive when it is having absolute pathnames.
Expand Down

0 comments on commit 36d8243

Please sign in to comment.