Skip to content

Commit

Permalink
Refactor bigval_t struct and move it to gc-common.h
Browse files Browse the repository at this point in the history
  • Loading branch information
udesou committed Nov 29, 2024
1 parent 6aabb27 commit 3e68f3c
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 53 deletions.
25 changes: 25 additions & 0 deletions src/gc-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,31 @@
extern "C" {
#endif

// =========================================================================== //
// GC Big objects
// =========================================================================== //

JL_EXTENSION typedef struct _bigval_t {
struct _bigval_t *next;
struct _bigval_t *prev;
size_t sz;
#ifdef _P64 // Add padding so that the value is 64-byte aligned
// (8 pointers of 8 bytes each) - (4 other pointers in struct)
void *_padding[8 - 4];
#else
// (16 pointers of 4 bytes each) - (4 other pointers in struct)
void *_padding[16 - 4];
#endif
//struct jl_taggedvalue_t <>;
union {
uintptr_t header;
struct {
uintptr_t gc:2;
} bits;
};
// must be 64-byte aligned here, in 32 & 64 bit modes
} bigval_t;

// =========================================================================== //
// GC Callbacks
// =========================================================================== //
Expand Down
1 change: 0 additions & 1 deletion src/gc-mmtk.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "gc-common.h"
#include "mmtkMutator.h"
#include "gc-mmtk.h"
#include "threading.h"

// File exists in the binding
Expand Down
29 changes: 0 additions & 29 deletions src/gc-mmtk.h

This file was deleted.

22 changes: 1 addition & 21 deletions src/gc-stock.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "julia_internal.h"
#include "julia_assert.h"
#include "threading.h"
#include "gc-common.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -84,27 +85,6 @@ typedef struct _jl_gc_chunk_t {

extern uintptr_t gc_bigval_sentinel_tag;

JL_EXTENSION typedef struct _bigval_t {
struct _bigval_t *next;
struct _bigval_t *prev;
size_t sz;
#ifdef _P64 // Add padding so that the value is 64-byte aligned
// (8 pointers of 8 bytes each) - (4 other pointers in struct)
void *_padding[8 - 4];
#else
// (16 pointers of 4 bytes each) - (4 other pointers in struct)
void *_padding[16 - 4];
#endif
//struct jl_taggedvalue_t <>;
union {
uintptr_t header;
struct {
uintptr_t gc:2;
} bits;
};
// must be 64-byte aligned here, in 32 & 64 bit modes
} bigval_t;

// pool page metadata
typedef struct _jl_gc_pagemeta_t {
// next metadata structure in per-thread list
Expand Down
2 changes: 1 addition & 1 deletion src/llvm-late-gc-lowering-mmtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ Value* LateLowerGCFrame::lowerGCAllocBytesLate(CallInst *target, Function &F)
}
}
return target;
}
}
2 changes: 1 addition & 1 deletion src/llvm-late-gc-lowering-stock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Value* LateLowerGCFrame::lowerGCAllocBytesLate(CallInst *target, Function &F)
{
// Do nothing for the stock GC
return target;
}
}

0 comments on commit 3e68f3c

Please sign in to comment.