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
b7837499
Commit
b7837499
authored
Nov 04, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some refactoring for some GC changes
parent
3d9bca6b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
66 deletions
+39
-66
src/Makefile
src/Makefile
+2
-2
src/core/common.h
src/core/common.h
+3
-0
src/gc/collector.cpp
src/gc/collector.cpp
+30
-0
src/gc/collector.h
src/gc/collector.h
+0
-23
test/test.cpp
test/test.cpp
+4
-41
No files found.
src/Makefile
View file @
b7837499
...
@@ -187,7 +187,7 @@ endif
...
@@ -187,7 +187,7 @@ endif
EXTRA_CXXFLAGS
?=
EXTRA_CXXFLAGS
?=
CXXFLAGS_DBG
:=
$(LLVM_CXXFLAGS)
$(COMMON_CXXFLAGS)
-O0
-DBINARY_SUFFIX
=
-DBINARY_STRIPPED_SUFFIX
=
_stripped
$(EXTRA_CXXFLAGS)
CXXFLAGS_DBG
:=
$(LLVM_CXXFLAGS)
$(COMMON_CXXFLAGS)
-O0
-DBINARY_SUFFIX
=
-DBINARY_STRIPPED_SUFFIX
=
_stripped
$(EXTRA_CXXFLAGS)
CXXFLAGS_PROFILE
=
$(LLVM_PROFILE_CXXFLAGS)
$(COMMON_CXXFLAGS)
-pg
-O3
-DNDEBUG
-DNVALGRIND
-DBINARY_SUFFIX
=
_release
-DBINARY_STRIPPED_SUFFIX
=
-fno-function-sections
$(EXTRA_CXXFLAGS)
CXXFLAGS_PROFILE
=
$(LLVM_PROFILE_CXXFLAGS)
$(COMMON_CXXFLAGS)
-pg
-O3
-DNDEBUG
-DNVALGRIND
-DBINARY_SUFFIX
=
_release
-DBINARY_STRIPPED_SUFFIX
=
-fno-function-sections
$(EXTRA_CXXFLAGS)
CXXFLAGS_RELEASE
:=
$(LLVM_RELEASE_CXXFLAGS)
$(COMMON_CXXFLAGS)
-O3
-fstrict-aliasing
-
enable-tbaa
-
DNDEBUG
-DNVALGRIND
-DBINARY_SUFFIX
=
_release
-DBINARY_STRIPPED_SUFFIX
=
$(EXTRA_CXXFLAGS)
CXXFLAGS_RELEASE
:=
$(LLVM_RELEASE_CXXFLAGS)
$(COMMON_CXXFLAGS)
-O3
-fstrict-aliasing
-DNDEBUG
-DNVALGRIND
-DBINARY_SUFFIX
=
_release
-DBINARY_STRIPPED_SUFFIX
=
$(EXTRA_CXXFLAGS)
LDFLAGS
:=
$(LLVM_LDFLAGS)
$(COMMON_LDFLAGS)
LDFLAGS
:=
$(LLVM_LDFLAGS)
$(COMMON_LDFLAGS)
LDFLAGS_DEBUG
:=
$(LLVM_DEBUG_LDFLAGS)
$(COMMON_LDFLAGS)
LDFLAGS_DEBUG
:=
$(LLVM_DEBUG_LDFLAGS)
$(COMMON_LDFLAGS)
...
@@ -203,7 +203,7 @@ CLANG_DEPS := $(CLANGPP_EXE) $(abspath $(dir $(CLANGPP_EXE))/../../built_release
...
@@ -203,7 +203,7 @@ CLANG_DEPS := $(CLANGPP_EXE) $(abspath $(dir $(CLANGPP_EXE))/../../built_release
# settings to make clang and ccache play nicely:
# settings to make clang and ccache play nicely:
CLANG_CCACHE_FLAGS
:=
-Qunused-arguments
CLANG_CCACHE_FLAGS
:=
-Qunused-arguments
CLANG_EXTRA_FLAGS
:=
-Wno-mismatched-tags
-ferror-limit
=
$(ERROR_LIMIT)
$(CLANG_CCACHE_FLAGS)
CLANG_EXTRA_FLAGS
:=
-Wno-mismatched-tags
-
enable-tbaa
-
ferror-limit
=
$(ERROR_LIMIT)
$(CLANG_CCACHE_FLAGS)
ifeq
($(COLOR),1)
ifeq
($(COLOR),1)
CLANG_EXTRA_FLAGS
+=
-fcolor-diagnostics
CLANG_EXTRA_FLAGS
+=
-fcolor-diagnostics
else
else
...
...
src/core/common.h
View file @
b7837499
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
#define __has_builtin(x) 0
#define __has_builtin(x) 0
#endif
#endif
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#define _STRINGIFY(N) #N
#define _STRINGIFY(N) #N
#define STRINGIFY(N) _STRINGIFY(N)
#define STRINGIFY(N) _STRINGIFY(N)
#define _CAT(A, B) A##B
#define _CAT(A, B) A##B
...
...
src/gc/collector.cpp
View file @
b7837499
...
@@ -36,6 +36,36 @@
...
@@ -36,6 +36,36 @@
namespace
pyston
{
namespace
pyston
{
namespace
gc
{
namespace
gc
{
class
TraceStack
{
private:
std
::
vector
<
void
*>
v
;
public:
TraceStack
()
{}
TraceStack
(
const
TraceStack
&
rhs
)
{
for
(
void
*
p
:
rhs
.
v
)
{
push
(
p
);
}
}
void
push
(
void
*
p
)
{
v
.
push_back
(
p
);
}
int
size
()
{
return
v
.
size
();
}
void
reserve
(
int
num
)
{
v
.
reserve
(
num
+
v
.
size
());
}
void
*
pop
()
{
if
(
v
.
size
())
{
void
*
r
=
v
.
back
();
v
.
pop_back
();
return
r
;
}
return
NULL
;
}
};
static
TraceStack
roots
;
static
TraceStack
roots
;
void
registerPermanentRoot
(
void
*
obj
)
{
void
registerPermanentRoot
(
void
*
obj
)
{
assert
(
global_heap
.
getAllocationFromInteriorPointer
(
obj
));
assert
(
global_heap
.
getAllocationFromInteriorPointer
(
obj
));
...
...
src/gc/collector.h
View file @
b7837499
...
@@ -22,29 +22,6 @@
...
@@ -22,29 +22,6 @@
namespace
pyston
{
namespace
pyston
{
namespace
gc
{
namespace
gc
{
class
TraceStack
{
private:
std
::
vector
<
void
*>
v
;
public:
template
<
typename
T
>
void
pushall
(
T
start
,
T
end
)
{
v
.
insert
(
v
.
end
(),
start
,
end
);
}
void
push
(
void
*
p
)
{
v
.
push_back
(
p
);
}
int
size
()
{
return
v
.
size
();
}
void
reserve
(
int
num
)
{
v
.
reserve
(
num
+
v
.
size
());
}
void
*
pop
()
{
if
(
v
.
size
())
{
void
*
r
=
v
.
back
();
v
.
pop_back
();
return
r
;
}
return
NULL
;
}
};
// Mark this gc-allocated object as being a root, even if there are no visible references to it.
// Mark this gc-allocated object as being a root, even if there are no visible references to it.
// (Note: this marks the gc allocation itself, not the pointer that points to one. For that, use
// (Note: this marks the gc allocation itself, not the pointer that points to one. For that, use
// a GCRootHandle)
// a GCRootHandle)
...
...
test/test.cpp
View file @
b7837499
...
@@ -2,46 +2,9 @@
...
@@ -2,46 +2,9 @@
#include <cstdio>
#include <cstdio>
#include "stdint.h"
#include "stdint.h"
class
C
{
extern
void
foo
();
public:
C
(
int
i
)
{
printf
(
"ctor
\n
"
);
}
void
*
operator
new
(
size_t
bytes
)
{
printf
(
"operator new
\n
"
);
return
NULL
;
}
};
int
f
()
{
void
bar
(
int
*
x
)
{
printf
(
"f()"
);
if
(
*
x
&
0x08
)
return
1
;
foo
();
}
extern
"C"
C
*
c
()
{
return
new
C
(
f
());
}
void
moo
(
double
);
float
chrs
[
10
];
void
foo
(
int
i
)
{
moo
(
chrs
[
i
]);
}
void
moo2
(
long
long
);
int
chrs2
[
10
];
void
foo2
(
int
i
)
{
moo2
(
chrs2
[
i
]);
}
void
moo3
(
long
long
);
short
chrs3
[
10
];
void
foo3
(
int
i
)
{
moo3
(
chrs3
[
i
]);
}
void
moo4
(
bool
);
bool
chrs4
[
10
];
void
foo4
(
int
i
)
{
moo4
(
chrs4
[
i
]);
}
}
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