Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PortConcurrentSkipListMap from JSR-166#3325

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
mox692 wants to merge12 commits intoscala-native:main
base:main
Choose a base branch
Loading
frommox692:port/jsr166_concurrent_skip_list_map

Conversation

mox692
Copy link
Contributor

Still work in progress.

  • port source
  • port test

After porting this, we can portConcurrentSkipListSet.

armanbilge, tanishiking, and He-Pin reacted with heart emojiarmanbilge, i10416, and He-Pin reacted with rocket emoji
@mox692mox692 marked this pull request as draftJune 12, 2023 16:43
@mox692
Copy link
ContributorAuthor

@WojciechMazur
This PR is still totally in progress, but could you just reviewthis commit?

In jsr166,VarHandle is used to achieve atomic operation(source), but if I understand correctly,VarHandle orAtomicReferenceFieldUpdater are not currently implemented in scala-native.

So I useCAtomicRef andIntrinsics here, but I want to make sure this is the right way. (PerhapsSynchronousQueue etc. use the same trick?)

@WojciechMazur
Copy link
Contributor

So I use CAtomicRef and Intrinsics here, but I want to make sure this is the right way.

Yes, that would be the correct way to workaround these issues. Instead ofVarHandle useCAtomic as a wrapper for the underlying field pointer.

For AtomicFieldUpdaters they're partially supported, but not directly - we cannot use Java reflection-based API, howeverAtomicReferenceFieldUpdater and other are in fact defined asabstract class. We use this fact to implement their Intrinisc based version, without usage of reflection. It was used to makescala.collection.concurent.TrieMap work:definition,usage to port Java sources of stdlib definedhere. And we test the API/JDK compliancehere in unit-tests. However Intrinsic based Atomic Field Updaters are not yet defined in public API. In case of the ported source it should be fine, as it seems to be not using them, but I would try to create a ScalaNative specific API to create field updater without usage of intrinsics in users code. To some extent we might be able to do something similar with VarHandlers as well in the future.

Btw.LongAdder is not yet ported - it is using single-threaded implementation ported from Scala.js

mox692 reacted with thumbs up emoji

@mox692
Copy link
ContributorAuthor

Thanks for the detailed explanation! Ok, then I can proceed the porting the code related to varHandle.

LongAdder is not yet ported

Oops, I missed that. I'll portLongAdder in another PR before this.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@mox692@WojciechMazur

[8]ページ先頭

©2009-2025 Movatter.jp