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 CONST_ADDR_OBJ, use it in some places (WIP) #1677

Merged
merged 8 commits into from
Sep 18, 2017

Conversation

fingolfin
Copy link
Member

This PR adds new macros CONST_ADDR_OBJ and CONST_PTR_BAG, which work like their counterparts without CONST_, but return const pointers. Then, various places in the code are changed to use them. In some places, I added new setter helpers etc.

This work is clearly incomplete, tons of more places could be changed.

As to the why: This week, Reimer discovered that ward generates almost no guards for HPC-GAP in master, see here: gap-system/ward#46 -- this is of course a serious problem, caused by our recent move from macros to static inline functions.

Reimer has come up with a plan to tackle this, by essentially getting rid of ward. Basically, the idea is to a write guard into PTR_BAG and a read guard into CONST_PTR_BAG, and then stop using ward (of course more work likely is necessary, but you get the idea). For this to not be unusable due to high overhead, he came up with some clever tricks involving a C language extension supported by GCC and clang for declaring functions pure... I'll leave it to him to explain the details.

But even without this, I think there is some merit in making use of const here; it might enable some extra optimization opportunities.

If people think this PR is in the right direction, I'll clean up the final commit and put in some more work. Thought to get through the whole kernel, I might need some help. We'll see.

@codecov
Copy link

codecov bot commented Sep 6, 2017

Codecov Report

Merging #1677 into master will increase coverage by 0.06%.
The diff coverage is 88.75%.

@@            Coverage Diff             @@
##           master    #1677      +/-   ##
==========================================
+ Coverage   64.35%   64.42%   +0.06%     
==========================================
  Files        1002     1003       +1     
  Lines      326699   326742      +43     
  Branches    13218    13197      -21     
==========================================
+ Hits       210244   210500     +256     
+ Misses     113585   113368     -217     
- Partials     2870     2874       +4
Impacted Files Coverage Δ
src/objfgelm.h 100% <ø> (ø) ⬆️
src/permutat.c 75.21% <ø> (ø) ⬆️
src/hpc/serialize.c 8.03% <ø> (ø) ⬆️
src/stringobj.c 78.13% <100%> (ø) ⬆️
src/stringobj.h 98.36% <100%> (+0.17%) ⬆️
src/rational.c 94.38% <100%> (ø) ⬆️
src/blister.h 92% <100%> (ø) ⬆️
src/range.c 87.39% <100%> (ø) ⬆️
src/plist.h 93.75% <100%> (ø) ⬆️
src/gasman.h 100% <100%> (ø) ⬆️
... and 40 more

@olexandr-konovalov olexandr-konovalov added the gapdays2017-fall Issues and PRs that arose at https://www.gapdays.de/gapdays2017-fall label Sep 9, 2017
@ChrisJefferson
Copy link
Contributor

I would suggest maybe cleaning up this patch as is, and then it can be merged. Obviously more changes can follow, but don't want to risk it drifting too far and merging getting hard.

@fingolfin
Copy link
Member Author

@ChrisJefferson OK... I wasn't sure if this had any worth unless @rbehrends's plan works out...

I rebased this and cleaned it up slightly.

@ChrisJefferson
Copy link
Contributor

Personally I always like const-correctness, and also really hope we can eliminate ward :)

@fingolfin
Copy link
Member Author

@ChrisJefferson well, then either merge this, or get somebody else to merge it, or close it -- otherwise it'll just rot again...

@ChrisJefferson ChrisJefferson merged commit 6e6a9ff into gap-system:master Sep 18, 2017
@fingolfin fingolfin deleted the mh/CONST_ADDR_OBJ branch September 18, 2017 12:36
@fingolfin fingolfin added the release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes label Dec 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gapdays2017-fall Issues and PRs that arose at https://www.gapdays.de/gapdays2017-fall release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes topic: kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants