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
c0ffc375
Commit
c0ffc375
authored
Jun 12, 2015
by
Chris Toshok
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do beginUnwind() inside __cxa_allocate_exception so we can support 'throw e' (instead of aborting)
parent
49d146cc
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
15 deletions
+13
-15
src/runtime/capi.cpp
src/runtime/capi.cpp
+1
-1
src/runtime/cxx_unwind.cpp
src/runtime/cxx_unwind.cpp
+1
-1
src/runtime/generator.cpp
src/runtime/generator.cpp
+3
-3
src/runtime/import.cpp
src/runtime/import.cpp
+4
-4
src/runtime/list.cpp
src/runtime/list.cpp
+1
-1
src/runtime/stacktrace.cpp
src/runtime/stacktrace.cpp
+3
-5
No files found.
src/runtime/capi.cpp
View file @
c0ffc375
...
...
@@ -926,7 +926,7 @@ void checkAndThrowCAPIException() {
RELEASE_ASSERT
(
value
->
cls
==
type
,
"unsupported"
);
if
(
tb
!=
None
)
raiseRaw
(
ExcInfo
(
value
->
cls
,
value
,
tb
)
);
throw
ExcInfo
(
value
->
cls
,
value
,
tb
);
raiseExc
(
value
);
}
}
...
...
src/runtime/cxx_unwind.cpp
View file @
c0ffc375
...
...
@@ -635,7 +635,7 @@ extern "C" void* __cxa_allocate_exception(size_t size) noexcept {
// our exception info in curexc_*, and then unset these in __cxa_end_catch, then we'll wipe our exception info
// during unwinding!
return
pyston
::
getExceptionStorage
(
pyston
::
get
Unwind
());
return
pyston
::
getExceptionStorage
(
pyston
::
begin
Unwind
());
}
// Takes the value that resume() sent us in RAX, and returns a pointer to the exception object actually thrown. In our
...
...
src/runtime/generator.cpp
View file @
c0ffc375
...
...
@@ -155,7 +155,7 @@ static void generatorSendInternal(BoxedGenerator* self, Box* v) {
freeGeneratorStack
(
self
);
// don't raise StopIteration exceptions because those are handled specially.
if
(
!
self
->
exception
.
matches
(
StopIteration
))
raiseRaw
(
self
->
exception
)
;
throw
self
->
exception
;
return
;
}
...
...
@@ -193,7 +193,7 @@ Box* generatorSend(Box* s, Box* v) {
self
->
exception
=
ExcInfo
(
nullptr
,
nullptr
,
nullptr
);
if
(
old_exc
.
type
==
NULL
)
raiseExcHelper
(
StopIteration
,
(
const
char
*
)
nullptr
);
raiseRaw
(
old_exc
)
;
throw
old_exc
;
}
return
self
->
returnValue
;
...
...
@@ -272,7 +272,7 @@ extern "C" Box* yield(BoxedGenerator* obj, Box* value) {
if
(
self
->
exception
.
type
)
{
ExcInfo
e
=
self
->
exception
;
self
->
exception
=
ExcInfo
(
NULL
,
NULL
,
NULL
);
raiseRaw
(
e
)
;
throw
e
;
}
return
self
->
returnValue
;
}
...
...
src/runtime/import.cpp
View file @
c0ffc375
...
...
@@ -49,7 +49,7 @@ Box* createAndRunModule(const std::string& name, const std::string& fn) {
compileAndRunModule
(
ast
,
module
);
}
catch
(
ExcInfo
e
)
{
removeModule
(
name
);
raiseRaw
(
e
)
;
throw
e
;
}
Box
*
r
=
getSysModulesDict
()
->
getOrNull
(
boxString
(
name
));
...
...
@@ -74,7 +74,7 @@ static Box* createAndRunModule(const std::string& name, const std::string& fn, c
compileAndRunModule
(
ast
,
module
);
}
catch
(
ExcInfo
e
)
{
removeModule
(
name
);
raiseRaw
(
e
)
;
throw
e
;
}
Box
*
r
=
getSysModulesDict
()
->
getOrNull
(
boxString
(
name
));
...
...
@@ -406,7 +406,7 @@ static Box* importSub(const std::string& name, const std::string& full_name, Box
RELEASE_ASSERT
(
0
,
"%d"
,
sr
.
type
);
}
catch
(
ExcInfo
e
)
{
removeModule
(
name
);
raiseRaw
(
e
)
;
throw
e
;
}
if
(
parent_module
&&
parent_module
!=
None
)
...
...
@@ -560,7 +560,7 @@ static void ensureFromlist(Box* module, Box* fromlist, std::string& buf, bool re
pathlist
=
getattrInternal
(
module
,
path_str
,
NULL
);
}
catch
(
ExcInfo
e
)
{
if
(
!
e
.
matches
(
AttributeError
))
raiseRaw
(
e
)
;
throw
e
;
}
if
(
pathlist
==
NULL
)
{
...
...
src/runtime/list.cpp
View file @
c0ffc375
...
...
@@ -727,7 +727,7 @@ void listSort(BoxedList* self, Box* cmp, Box* key, Box* reverse) {
std
::
stable_sort
<
Box
**
,
PyLt
>
(
self
->
elts
->
elts
,
self
->
elts
->
elts
+
self
->
size
,
PyLt
());
}
catch
(
ExcInfo
e
)
{
remove_keys
();
raiseRaw
(
e
)
;
throw
e
;
}
remove_keys
();
...
...
src/runtime/stacktrace.cpp
View file @
c0ffc375
...
...
@@ -72,8 +72,6 @@ void raiseRaw(const ExcInfo& e) {
#endif
#endif
// printf ("beginning unwind\n");
beginUnwind
();
throw
e
;
}
...
...
@@ -88,7 +86,7 @@ void raiseSyntaxError(const char* msg, int lineno, int col_offset, llvm::StringR
auto
tb
=
new
BoxedTraceback
();
tb
->
addLine
(
LineInfo
(
lineno
,
col_offset
,
file
,
func
));
raiseRaw
(
ExcInfo
(
exc
->
cls
,
exc
,
tb
)
);
throw
ExcInfo
(
exc
->
cls
,
exc
,
tb
);
}
void
raiseSyntaxErrorHelper
(
llvm
::
StringRef
file
,
llvm
::
StringRef
func
,
AST
*
node_at
,
const
char
*
msg
,
...)
{
...
...
@@ -207,7 +205,7 @@ extern "C" void raise0() {
raiseExcHelper
(
TypeError
,
"exceptions must be old-style classes or derived from BaseException, not NoneType"
);
exc_info
->
reraise
=
true
;
raiseRaw
(
*
exc_info
)
;
throw
*
exc_info
;
}
#ifndef NDEBUG
...
...
@@ -288,7 +286,7 @@ extern "C" void raise3(Box* arg0, Box* arg1, Box* arg2) {
auto
exc_info
=
excInfoForRaise
(
arg0
,
arg1
,
arg2
);
exc_info
.
reraise
=
reraise
;
raiseRaw
(
exc_info
)
;
throw
exc_info
;
}
void
raiseExcHelper
(
BoxedClass
*
cls
,
Box
*
arg
)
{
...
...
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