Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hash-table and package symcount #492

Merged
merged 5 commits into from
Apr 18, 2024

Conversation

Affonso-Gui
Copy link
Member

@Affonso-Gui Affonso-Gui commented May 5, 2022

In current implementation euslisp's hash tables only keep count of its active members.
This allows for the hash-table to end up cluttered by deleted members, causing problems such as #405.

The same behavior is seen in packages' internal and external vectors, which are implemented to act as hash tables.

(setq pkg (make-package "TEST"))
(dotimes (i 10000)
  (print i)
  (unintern (intern (symbol-pname (gensym)) pkg) pkg))
;; infinite loop

In this PR we solve this by keeping count of the used members (active + deleted) instead.

@Affonso-Gui
Copy link
Member Author

I've updated the PR to use a different slot (fill-count) in hash-tables. This is done to keep the formatting and compatibility with the following ansi test:

(deftest hash-table-count.11
  (let ((table (make-hash-table)))
    (setf (gethash 'x table) 1)
    (values (hash-table-count table)
            (progn
              (remhash 'x table)
              (hash-table-count table))))
  1 0)

@Affonso-Gui
Copy link
Member Author

ppc64le/debian:buster times out. Restarting..
Function compile.euslisp takes 47 min 42 sec
https://github.com/euslisp/EusLisp/runs/6304908324?check_suite_focus=true#step:3:2433

@k-okada
Copy link
Member

k-okada commented Apr 18, 2024

confirmed that the test code works properly #510

2024-04-17T00:48:34.2745776Z   TEST-NUM: 0
2024-04-17T00:48:34.2746149Z     PASSED:   0
2024-04-17T00:48:34.2746523Z     FAILURE:  0
2024-04-17T00:48:34.2746980Z RESULT: test-hashtable-delete
2024-04-17T00:48:34.2747481Z   TEST-NUM: 1
2024-04-17T00:48:34.2747828Z     PASSED:   0
2024-04-17T00:48:34.2748247Z �[31m    FAILURE:  1�[0m
2024-04-17T00:48:34.2748739Z RESULT: test-hashtable-count
2024-04-17T00:48:34.2749174Z   TEST-NUM: 1
2024-04-17T00:48:34.2749396Z     PASSED:   1
2024-04-17T00:48:34.2749624Z     FAILURE:  0
2024-04-17T00:48:34.2749886Z RESULT: test-package-unintern
2024-04-17T00:48:34.2750206Z   TEST-NUM: 1
2024-04-17T00:48:34.2750518Z     PASSED:   0
2024-04-17T00:48:34.2750946Z �[31m    FAILURE:  1�[0m

@k-okada k-okada closed this Apr 18, 2024
@k-okada k-okada reopened this Apr 18, 2024
@k-okada k-okada merged commit 868484f into euslisp:master Apr 18, 2024
36 checks passed
k-okada added a commit that referenced this pull request Apr 18, 2024
* apply patches in dfsg (#511, https://salsa.debian.org/science-team/euslisp/-/tree/debian/9.29+dfsg-1/debian/patches?ref_type=tags)
* fix rotate-vertices when an axis input is float-vector (#504)
* load proper packages(g/x/gl) for full program path, this enables gdb works correctly (#495)
* fix infinite loops when hash-table has no empty members (#492)
@Affonso-Gui Affonso-Gui deleted the fix-hashtable-delete branch April 18, 2024 08:31
k-okada added a commit that referenced this pull request Apr 18, 2024
* apply patches in dfsg (#511, #482, https://salsa.debian.org/science-team/euslisp/-/tree/debian/9.29+dfsg-1/debian/patches?ref_type=tags)
* fix rotate-vertices when an axis input is float-vector (#504)
* load proper packages(g/x/gl) for full program path, this enables gdb works correctly (#495)
* fix infinite loops when hash-table has no empty members (#492)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants