-
Notifications
You must be signed in to change notification settings - Fork 162
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
Add CONST_ADDR_OBJ, use it in some places (WIP) #1677
Conversation
Codecov Report
@@ 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
|
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. |
Also remove BAG_HEADER_CONTENTS helper
4a443c8
to
42a48ea
Compare
@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. |
Personally I always like const-correctness, and also really hope we can eliminate ward :) |
@ChrisJefferson well, then either merge this, or get somebody else to merge it, or close it -- otherwise it'll just rot again... |
This PR adds new macros
CONST_ADDR_OBJ
andCONST_PTR_BAG
, which work like their counterparts withoutCONST_
, 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 intoPTR_BAG
and a read guard intoCONST_PTR_BAG
, and then stop usingward
(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.