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
dc85d001
Commit
dc85d001
authored
May 29, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bjit: make nonzeroHelper return a borrowed reference
parent
4253de66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
src/codegen/baseline_jit.cpp
src/codegen/baseline_jit.cpp
+11
-11
src/codegen/baseline_jit.h
src/codegen/baseline_jit.h
+2
-2
No files found.
src/codegen/baseline_jit.cpp
View file @
dc85d001
...
...
@@ -454,11 +454,11 @@ RewriterVar* JitFragmentWriter::emitLandingpad() {
RewriterVar
*
JitFragmentWriter
::
emitNonzero
(
RewriterVar
*
v
)
{
// nonzeroHelper returns bool
return
call
(
false
,
(
void
*
)
nonzeroHelper
,
v
)
->
setType
(
RefType
::
OWN
ED
);
return
call
(
false
,
(
void
*
)
nonzeroHelper
,
v
)
->
setType
(
RefType
::
BORROW
ED
);
}
RewriterVar
*
JitFragmentWriter
::
emitNotNonzero
(
RewriterVar
*
v
)
{
return
call
(
false
,
(
void
*
)
notHelper
,
v
)
->
setType
(
RefType
::
OWN
ED
);
return
call
(
false
,
(
void
*
)
notHelper
,
v
)
->
setType
(
RefType
::
BORROW
ED
);
}
RewriterVar
*
JitFragmentWriter
::
emitRepr
(
RewriterVar
*
v
)
{
...
...
@@ -960,12 +960,12 @@ Box* JitFragmentWriter::hasnextHelper(Box* b) {
return
boxBool
(
pyston
::
hasnext
(
b
));
}
B
ox
*
JitFragmentWriter
::
nonzeroHelper
(
Box
*
b
)
{
return
b
oxBool
(
b
->
nonzeroIC
())
;
B
ORROWED
(
Box
*
)
JitFragmentWriter
::
nonzeroHelper
(
Box
*
b
)
{
return
b
->
nonzeroIC
()
?
True
:
False
;
}
B
ox
*
JitFragmentWriter
::
notHelper
(
Box
*
b
)
{
return
b
oxBool
(
!
b
->
nonzeroIC
())
;
B
ORROWED
(
Box
*
)
JitFragmentWriter
::
notHelper
(
Box
*
b
)
{
return
b
->
nonzeroIC
()
?
False
:
True
;
}
Box
*
JitFragmentWriter
::
runtimeCallHelper
(
Box
*
obj
,
ArgPassSpec
argspec
,
TypeRecorder
*
type_recorder
,
Box
**
args
,
...
...
@@ -1164,12 +1164,12 @@ void JitFragmentWriter::_emitSideExit(STOLEN(RewriterVar*) var, RewriterVar* val
// Really, we should probably do a decref on either side post-jump.
// But the automatic refcounter doesn't support that, and since the value is either True or False,
// we can get away with doing the decref early.
// TODO: better solution is to just make NONZERO return a borrowed ref, so we don't have to decref at all.
_decref
(
var
);
// Hax: override the automatic refcount system
assert
(
var
->
reftype
==
RefType
::
OWNED
);
if
(
var
->
reftype
==
RefType
::
OWNED
)
{
_decref
(
var
);
// Hax: override the automatic refcount system
var
->
reftype
=
RefType
::
BORROWED
;
}
assert
(
var
->
num_refs_consumed
==
0
);
var
->
reftype
=
RefType
::
BORROWED
;
assembler
::
Register
var_reg
=
var
->
getInReg
();
if
(
isLargeConstant
(
val
))
{
...
...
src/codegen/baseline_jit.h
View file @
dc85d001
...
...
@@ -308,8 +308,8 @@ private:
static
Box
*
createTupleHelper
(
uint64_t
num
,
Box
**
data
);
static
Box
*
exceptionMatchesHelper
(
Box
*
obj
,
Box
*
cls
);
static
Box
*
hasnextHelper
(
Box
*
b
);
static
B
ox
*
nonzeroHelper
(
Box
*
b
);
static
B
ox
*
notHelper
(
Box
*
b
);
static
B
ORROWED
(
Box
*
)
nonzeroHelper
(
Box
*
b
);
static
B
ORROWED
(
Box
*
)
notHelper
(
Box
*
b
);
static
Box
*
runtimeCallHelper
(
Box
*
obj
,
ArgPassSpec
argspec
,
TypeRecorder
*
type_recorder
,
Box
**
args
,
std
::
vector
<
BoxedString
*>*
keyword_names
);
...
...
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