Skip to content

Commit

Permalink
kernel: move some HPC-GAP functions to region.c
Browse files Browse the repository at this point in the history
They were in boehm_gc.c, but in reality these functions
are not Bohem specific but rather HPC-GAP specific.
  • Loading branch information
rbehrends authored and fingolfin committed Nov 14, 2019
1 parent baf4761 commit 85588b0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
22 changes: 0 additions & 22 deletions src/boehm_gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,6 @@ void MakeBagTypePublic(int type)
DSInfoBags[type] = DSI_PUBLIC;
}

Bag MakeBagPublic(Bag bag)
{
MEMBAR_WRITE();
SET_REGION(bag, 0);
return bag;
}

Bag MakeBagReadOnly(Bag bag)
{
MEMBAR_WRITE();
SET_REGION(bag, ReadOnlyRegion);
return bag;
}

#endif // HPCGAP


Expand Down Expand Up @@ -332,14 +318,6 @@ UInt CollectBags(UInt size, UInt full)
return 1;
}

#ifdef HPCGAP
void RetypeBagIfWritable(Obj obj, UInt new_type)
{
if (CheckWriteAccess(obj))
RetypeBag(obj, new_type);
}
#endif

void RetypeBag(Bag bag, UInt new_type)
{
BagHeader * header = BAG_HEADER(bag);
Expand Down
22 changes: 21 additions & 1 deletion src/hpc/region.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

// #include "hpc/misc.h"
#include "hpc/thread.h"
// #include "hpc/guards.h"
#include "hpc/guards.h"


#include <pthread.h>
Expand Down Expand Up @@ -59,3 +59,23 @@ Region * RegionBag(Bag bag)
MEMBAR_READ();
return result;
}

Bag MakeBagPublic(Bag bag)
{
MEMBAR_WRITE();
SET_REGION(bag, 0);
return bag;
}

Bag MakeBagReadOnly(Bag bag)
{
MEMBAR_WRITE();
SET_REGION(bag, ReadOnlyRegion);
return bag;
}

void RetypeBagIfWritable(Obj obj, UInt new_type)
{
if (CheckWriteAccess(obj))
RetypeBag(obj, new_type);
}

0 comments on commit 85588b0

Please sign in to comment.