Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
18f9e7e0
Commit
18f9e7e0
authored
Jun 17, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
I am really not good at running 'make format' before committing...
parent
0691f5bc
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
28 deletions
+24
-28
src/core/stats.cpp
src/core/stats.cpp
+0
-1
src/core/stats.h
src/core/stats.h
+6
-7
src/core/threading.cpp
src/core/threading.cpp
+4
-5
src/gc/heap.cpp
src/gc/heap.cpp
+13
-14
src/gc/heap.h
src/gc/heap.h
+1
-1
No files found.
src/core/stats.cpp
View file @
18f9e7e0
...
@@ -70,5 +70,4 @@ void Stats::dump() {
...
@@ -70,5 +70,4 @@ void Stats::dump() {
}
}
#endif
#endif
}
}
src/core/stats.h
View file @
18f9e7e0
...
@@ -38,7 +38,9 @@ public:
...
@@ -38,7 +38,9 @@ public:
static
int
getStatId
(
const
std
::
string
&
name
);
static
int
getStatId
(
const
std
::
string
&
name
);
static
void
log
(
int
id
,
int
count
=
1
)
{
(
*
counts
)[
id
]
+=
count
;
}
static
void
log
(
int
id
,
int
count
=
1
)
{
(
*
counts
)[
id
]
+=
count
;
}
static
void
threadsafe_log
(
int
id
,
int
count
=
1
)
{
(
*
threadsafe_counts
)[
id
].
fetch_add
(
count
,
std
::
memory_order_relaxed
);
}
static
void
threadsafe_log
(
int
id
,
int
count
=
1
)
{
(
*
threadsafe_counts
)[
id
].
fetch_add
(
count
,
std
::
memory_order_relaxed
);
}
static
void
dump
();
static
void
dump
();
};
};
...
@@ -67,20 +69,17 @@ public:
...
@@ -67,20 +69,17 @@ public:
#else
#else
struct
Stats
{
struct
Stats
{
static
void
dump
()
{
static
void
dump
()
{
printf
(
"(Stats disabled)
\n
"
);
}
printf
(
"(Stats disabled)
\n
"
);
}
};
};
struct
StatCounter
{
struct
StatCounter
{
StatCounter
(
const
char
*
name
)
{}
StatCounter
(
const
char
*
name
)
{}
void
log
(
int
count
=
1
)
{};
void
log
(
int
count
=
1
)
{};
};
};
struct
StatPerThreadCounter
{
struct
StatPerThreadCounter
{
StatPerThreadCounter
(
const
char
*
name
)
{}
StatPerThreadCounter
(
const
char
*
name
)
{}
void
log
(
int
count
=
1
)
{};
void
log
(
int
count
=
1
)
{};
};
};
#endif
#endif
}
}
#endif
#endif
src/core/threading.cpp
View file @
18f9e7e0
...
@@ -434,10 +434,10 @@ static __thread int gl_check_count = 0;
...
@@ -434,10 +434,10 @@ static __thread int gl_check_count = 0;
void
allowGLReadPreemption
()
{
void
allowGLReadPreemption
()
{
assert
(
grwl_state
==
GRWLHeldState
::
R
);
assert
(
grwl_state
==
GRWLHeldState
::
R
);
//gl_check_count++;
//
gl_check_count++;
//if (gl_check_count < 10)
//
if (gl_check_count < 10)
//
return;
//
return;
//gl_check_count = 0;
//
gl_check_count = 0;
if
(
__builtin_expect
(
!
writers_waiting
.
load
(
std
::
memory_order_relaxed
),
1
))
if
(
__builtin_expect
(
!
writers_waiting
.
load
(
std
::
memory_order_relaxed
),
1
))
return
;
return
;
...
@@ -451,7 +451,6 @@ void allowGLReadPreemption() {
...
@@ -451,7 +451,6 @@ void allowGLReadPreemption() {
long
preempt_us
=
_t2
.
end
();
long
preempt_us
=
_t2
.
end
();
static
thread_local
StatPerThreadCounter
sc_preempting_us
(
"grwl_preempt_us"
);
static
thread_local
StatPerThreadCounter
sc_preempting_us
(
"grwl_preempt_us"
);
sc_preempting_us
.
log
(
preempt_us
);
sc_preempting_us
.
log
(
preempt_us
);
}
}
#endif
#endif
...
...
src/gc/heap.cpp
View file @
18f9e7e0
...
@@ -39,9 +39,9 @@ static __thread unsigned thread_bytesAllocatedSinceCollection;
...
@@ -39,9 +39,9 @@ static __thread unsigned thread_bytesAllocatedSinceCollection;
void
_collectIfNeeded
(
size_t
bytes
)
{
void
_collectIfNeeded
(
size_t
bytes
)
{
if
(
bytesAllocatedSinceCollection
>=
ALLOCBYTES_PER_COLLECTION
)
{
if
(
bytesAllocatedSinceCollection
>=
ALLOCBYTES_PER_COLLECTION
)
{
//bytesAllocatedSinceCollection = 0;
//
bytesAllocatedSinceCollection = 0;
//threading::GLPromoteRegion _lock;
//
threading::GLPromoteRegion _lock;
//runCollection();
//
runCollection();
threading
::
GLPromoteRegion
_lock
;
threading
::
GLPromoteRegion
_lock
;
if
(
bytesAllocatedSinceCollection
>=
ALLOCBYTES_PER_COLLECTION
)
{
if
(
bytesAllocatedSinceCollection
>=
ALLOCBYTES_PER_COLLECTION
)
{
...
@@ -137,7 +137,7 @@ static Block* alloc_block(uint64_t size, Block** prev) {
...
@@ -137,7 +137,7 @@ static Block* alloc_block(uint64_t size, Block** prev) {
// VALGRIND_CREATE_MEMPOOL(rtn, 0, true);
// VALGRIND_CREATE_MEMPOOL(rtn, 0, true);
#endif
#endif
//printf("Allocated new block %p\n", rtn);
//
printf("Allocated new block %p\n", rtn);
// Don't think I need to do this:
// Don't think I need to do this:
memset
(
rtn
->
isfree
,
0
,
sizeof
(
Block
::
isfree
));
memset
(
rtn
->
isfree
,
0
,
sizeof
(
Block
::
isfree
));
...
@@ -243,11 +243,11 @@ void* Heap::allocSmall(size_t rounded_size, int bucket_idx) {
...
@@ -243,11 +243,11 @@ void* Heap::allocSmall(size_t rounded_size, int bucket_idx) {
Block
**
cache_head
=
&
cache
->
cache_free_heads
[
bucket_idx
];
Block
**
cache_head
=
&
cache
->
cache_free_heads
[
bucket_idx
];
//static __thread int gc_allocs = 0;
//
static __thread int gc_allocs = 0;
//if (++gc_allocs == 128) {
//
if (++gc_allocs == 128) {
//
static StatCounter sc_total("gc_allocs");
//
static StatCounter sc_total("gc_allocs");
//
sc_total.log(128);
//
sc_total.log(128);
//
gc_allocs = 0;
//
gc_allocs = 0;
//}
//}
while
(
true
)
{
while
(
true
)
{
...
@@ -261,8 +261,8 @@ void* Heap::allocSmall(size_t rounded_size, int bucket_idx) {
...
@@ -261,8 +261,8 @@ void* Heap::allocSmall(size_t rounded_size, int bucket_idx) {
}
}
// Not very useful to count the cache misses if we don't count the total attempts:
// Not very useful to count the cache misses if we don't count the total attempts:
//static StatCounter sc_fallback("gc_allocs_cachemiss");
//
static StatCounter sc_fallback("gc_allocs_cachemiss");
//sc_fallback.log();
//
sc_fallback.log();
LOCK_REGION
(
lock
);
LOCK_REGION
(
lock
);
...
@@ -274,7 +274,7 @@ void* Heap::allocSmall(size_t rounded_size, int bucket_idx) {
...
@@ -274,7 +274,7 @@ void* Heap::allocSmall(size_t rounded_size, int bucket_idx) {
assert
(
!
myblock
->
next
);
assert
(
!
myblock
->
next
);
assert
(
!
myblock
->
prev
);
assert
(
!
myblock
->
prev
);
//printf("%d claimed new block %p with %d objects\n", threading::gettid(), myblock, myblock->numObjects());
//
printf("%d claimed new block %p with %d objects\n", threading::gettid(), myblock, myblock->numObjects());
insertIntoLL
(
cache_head
,
myblock
);
insertIntoLL
(
cache_head
,
myblock
);
}
}
...
@@ -425,7 +425,7 @@ void Heap::freeUnmarked() {
...
@@ -425,7 +425,7 @@ void Heap::freeUnmarked() {
Timer
_t
(
"looking at the thread caches"
);
Timer
_t
(
"looking at the thread caches"
);
thread_caches
.
forEachValue
([
this
](
ThreadBlockCache
*
cache
)
{
thread_caches
.
forEachValue
([
this
](
ThreadBlockCache
*
cache
)
{
for
(
int
bidx
=
0
;
bidx
<
NUM_BUCKETS
;
bidx
++
)
{
for
(
int
bidx
=
0
;
bidx
<
NUM_BUCKETS
;
bidx
++
)
{
Block
*
h
=
cache
->
cache_free_heads
[
bidx
];
Block
*
h
=
cache
->
cache_free_heads
[
bidx
];
// Try to limit the amount of unused memory a thread can hold onto;
// Try to limit the amount of unused memory a thread can hold onto;
// currently pretty dumb, just limit the number of blocks in the free-list
// currently pretty dumb, just limit the number of blocks in the free-list
// to 50. (blocks in the full list don't need to be limited, since we're sure
// to 50. (blocks in the full list don't need to be limited, since we're sure
...
@@ -450,7 +450,6 @@ void Heap::freeUnmarked() {
...
@@ -450,7 +450,6 @@ void Heap::freeUnmarked() {
removeFromLL
(
b
);
removeFromLL
(
b
);
insertIntoLL
(
chain_end
,
b
);
insertIntoLL
(
chain_end
,
b
);
}
}
}
}
});
});
_t
.
end
();
_t
.
end
();
...
...
src/gc/heap.h
View file @
18f9e7e0
...
@@ -31,7 +31,7 @@ inline GCObjectHeader* headerFromObject(void* obj) {
...
@@ -31,7 +31,7 @@ inline GCObjectHeader* headerFromObject(void* obj) {
#endif
#endif
}
}
#define BLOCK_SIZE (4
*
4096)
#define BLOCK_SIZE (4
*
4096)
#define ATOM_SIZE 16
#define ATOM_SIZE 16
static_assert
(
BLOCK_SIZE
%
ATOM_SIZE
==
0
,
""
);
static_assert
(
BLOCK_SIZE
%
ATOM_SIZE
==
0
,
""
);
#define ATOMS_PER_BLOCK (BLOCK_SIZE / ATOM_SIZE)
#define ATOMS_PER_BLOCK (BLOCK_SIZE / ATOM_SIZE)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment