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
eb871acd
Commit
eb871acd
authored
Apr 06, 2015
by
Joris Vankerschaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add modified str to IR generator.
parent
2aa6fe48
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
6 deletions
+15
-6
src/codegen/irgen/irgenerator.cpp
src/codegen/irgen/irgenerator.cpp
+1
-1
src/codegen/runtime_hooks.cpp
src/codegen/runtime_hooks.cpp
+1
-0
src/codegen/runtime_hooks.h
src/codegen/runtime_hooks.h
+1
-1
src/runtime/inline/link_forcer.cpp
src/runtime/inline/link_forcer.cpp
+1
-0
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+8
-0
src/runtime/objmodel.h
src/runtime/objmodel.h
+1
-0
test/tests/unicode_test.py
test/tests/unicode_test.py
+2
-4
No files found.
src/codegen/irgen/irgenerator.cpp
View file @
eb871acd
...
...
@@ -1705,7 +1705,7 @@ private:
// end code for handling of softspace
llvm
::
Value
*
v
=
emitter
.
createCall
(
unw_info
,
g
.
funcs
.
str
,
converted
->
getValue
());
llvm
::
Value
*
v
=
emitter
.
createCall
(
unw_info
,
g
.
funcs
.
str
OrUnicode
,
converted
->
getValue
());
v
=
emitter
.
getBuilder
()
->
CreateBitCast
(
v
,
g
.
llvm_value_type_ptr
);
auto
s
=
new
ConcreteCompilerVariable
(
STR
,
v
,
true
);
r
=
dest
->
callattr
(
emitter
,
getOpInfoForNode
(
node
,
unw_info
),
&
write_str
,
flags
,
ArgPassSpec
(
1
),
{
s
},
...
...
src/codegen/runtime_hooks.cpp
View file @
eb871acd
...
...
@@ -206,6 +206,7 @@ void initGlobalFuncs(GlobalState& g) {
GET
(
importStar
);
GET
(
repr
);
GET
(
str
);
GET
(
strOrUnicode
);
GET
(
exceptionMatches
);
GET
(
yield
);
GET
(
getiterHelper
);
...
...
src/codegen/runtime_hooks.h
View file @
eb871acd
...
...
@@ -38,7 +38,7 @@ struct GlobalFuncs {
*
decodeUTF8StringPtr
;
llvm
::
Value
*
getattr
,
*
setattr
,
*
delattr
,
*
delitem
,
*
delGlobal
,
*
nonzero
,
*
binop
,
*
compare
,
*
augbinop
,
*
unboxedLen
,
*
getitem
,
*
getclsattr
,
*
getGlobal
,
*
setitem
,
*
unaryop
,
*
import
,
*
importFrom
,
*
importStar
,
*
repr
,
*
str
,
*
exceptionMatches
,
*
yield
,
*
getiterHelper
,
*
hasnext
;
*
strOrUnicode
,
*
exceptionMatches
,
*
yield
,
*
getiterHelper
,
*
hasnext
;
llvm
::
Value
*
unpackIntoArray
,
*
raiseAttributeError
,
*
raiseAttributeErrorStr
,
*
raiseNotIterableError
,
*
assertNameDefined
,
*
assertFail
;
...
...
src/runtime/inline/link_forcer.cpp
View file @
eb871acd
...
...
@@ -100,6 +100,7 @@ void force() {
FORCE
(
assertNameDefined
);
FORCE
(
assertFail
);
FORCE
(
strOrUnicode
);
FORCE
(
printFloat
);
FORCE
(
listAppendInternal
);
FORCE
(
getSysStdout
);
...
...
src/runtime/objmodel.cpp
View file @
eb871acd
...
...
@@ -2028,6 +2028,14 @@ extern "C" BoxedString* str(Box* obj) {
return
static_cast
<
BoxedString
*>
(
obj
);
}
extern
"C"
BoxedString
*
strOrUnicode
(
Box
*
obj
)
{
// Like str, but returns unicode objects unchanged.
if
(
obj
->
cls
==
unicode_cls
)
{
return
static_cast
<
BoxedString
*>
(
obj
);
}
return
str
(
obj
);
}
extern
"C"
BoxedString
*
repr
(
Box
*
obj
)
{
static
StatCounter
slowpath_repr
(
"slowpath_repr"
);
slowpath_repr
.
log
();
...
...
src/runtime/objmodel.h
View file @
eb871acd
...
...
@@ -61,6 +61,7 @@ extern "C" BoxedString* str(Box* obj);
extern
"C"
BoxedString
*
repr
(
Box
*
obj
);
extern
"C"
BoxedString
*
reprOrNull
(
Box
*
obj
);
// similar to repr, but returns NULL on exception
extern
"C"
BoxedString
*
strOrNull
(
Box
*
obj
);
// similar to str, but returns NULL on exception
extern
"C"
BoxedString
*
strOrUnicode
(
Box
*
obj
);
extern
"C"
bool
exceptionMatches
(
Box
*
obj
,
Box
*
cls
);
extern
"C"
BoxedInt
*
hash
(
Box
*
obj
);
extern
"C"
Box
*
abs_
(
Box
*
obj
);
...
...
test/tests/unicode_test.py
View file @
eb871acd
...
...
@@ -49,11 +49,9 @@ import gc
for
i
in
xrange
(
100
):
print
repr
(
BaseException
().
__unicode__
())
gc
.
collect
()
# TODO / FIXME: For some reason, uncommenting the loop below will cause printing unicode
# to fail!!!
# do some allocations:
#
for j in xrange(100):
#
[None] * j
for
j
in
xrange
(
100
):
[
None
]
*
j
print
u''
in
''
print
''
in
u''
...
...
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