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

Add support for ABCL and Clasp #2

Merged
merged 8 commits into from
Jun 11, 2023
Merged

Add support for ABCL and Clasp #2

merged 8 commits into from
Jun 11, 2023

Conversation

Sasanidas
Copy link
Member

Adapt the SLIME backed for Micros, it has been superficially testes tho, so there is probably need for some more testing.

Copy link
Member

@cxxxr cxxxr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really appreciate your support for adapting to implementation other than sbcl.
Thank you!

micros.asd Outdated
@@ -1,41 +1,48 @@
(defsystem "micros"
:depends-on ()
:depends-on (:bordeaux-threads)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a dependency in micros may risk a conflict between the library used by the user and the library used by micros, causing a malfunction.

Is there any way to avoid this?

Copy link
Member Author

@Sasanidas Sasanidas Jun 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ummm, I don't know really, if we want to make this compiled alone (without the Lem system), I think it's necessary

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, if users are developing bordeaux-threads, changing their implementation will likely cause micros to stop working.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooh, I see ummm, then maybe use some specific functions depending on the implementation, a little more manual, but that can be a solution

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so.... SBCL implement a couple of more things for hash-tables to work concurrently so I'm experimenting with https://github.com/no-defun-allowed/concurrent-hash-tables .

It doesn't solve the problem, given that we still have to use external dependencies, so I think if this version works for more implementation, the solution might be to fork it and integrate it in micro as a internal system.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a pain if there is a but, because we would have to go to the main repo to check it, buut I'll add the default option for default SBCL to work with the native calls, so at least it works as intended in the reference implementation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The concurrent-hash-table is very interesting, thanks for sharing.

In this case, we need a mutex of hash-table in eval-for-emacs, but I don't think it requires much performance.
What about going with a simple with-lock-held pattern?

Copy link
Member Author

@Sasanidas Sasanidas Jun 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still, I would have to use the bt library for that (if I want it to be portable)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

micros(swank) has definterface and defimplementation.
Since we already have the bare minimum for threads, why not just use them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, seems like swank already have some thread-locks implementations 🤦 , the code seems fine but it doesn't seem to work for SBCL.

swank.lisp Outdated
;; Needless to say, this also excludes some internal bits, but
;; getting there is too much detail when "unspecified" says what
;; is important -- unpredictable, but harmless.
`(bt:with-recursive-lock-held((hash-table-lock ,hash-table))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok if don't add sb-int for hash-table-count?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, what do you mean?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it was hash-table-lock, not hash-table-count.

In other words, I think the function is unbound.
(fboundp 'hash-table-lock) => NIL

Copy link
Member Author

@Sasanidas Sasanidas Jun 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups! Sorry, I was looking at the implementation and seems very sbcl specific
(https://www.sbcl.org/manual/#Hash-Table-Extensions)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know how to solve it easily

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a workaround, what about using mutex for except sbcl?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take a look and see if it works, thanks 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to the top comment

@cxxxr
Copy link
Member

cxxxr commented Jun 11, 2023

Thank you so much 🙏

@cxxxr cxxxr merged commit 9539adc into lem-project:main Jun 11, 2023
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