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

atomicInc global alloc counters #20571

Merged
merged 1 commit into from
Oct 15, 2022
Merged

Conversation

planetis-m
Copy link
Contributor

No description provided.

@Araq
Copy link
Member

Araq commented Oct 15, 2022

Use ATOMIC_RELAXED instead.

@planetis-m
Copy link
Contributor Author

Use ATOMIC_RELAXED instead.

I would have to duplicate that code and also as forward declarations:

proc atomicInc*(memLoc: var int, x: int = 1): int =
  when someGcc and hasThreadSupport:
    result = atomicAddFetch(memLoc.addr, x, ATOMIC_SEQ_CST)
  elif someVcc and hasThreadSupport:
    result = addAndFetch(memLoc.addr, x)
    inc(result, x)
  else:
    inc(memLoc, x)
    result = memLoc

Seems a bit excessive for a debug thing. If you are ok with that give me a thumps up and I will do it.

@Araq Araq merged commit ed26156 into nim-lang:devel Oct 15, 2022
@Araq
Copy link
Member

Araq commented Oct 15, 2022

No, I agree with you. The current solution is the better one.

@github-actions
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from ed26156

Hint: mm: orc; opt: speed; options: -d:release
162749 lines; 7.999s; 614.703MiB peakmem

capocasa pushed a commit to capocasa/Nim that referenced this pull request Mar 31, 2023
narimiran pushed a commit that referenced this pull request Apr 25, 2023
narimiran pushed a commit that referenced this pull request Apr 25, 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