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
46af909b
Commit
46af909b
authored
Feb 01, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More small improvements
parent
38a58d5a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
88 additions
and
26 deletions
+88
-26
src/asm_writing/rewriter.cpp
src/asm_writing/rewriter.cpp
+27
-2
src/asm_writing/rewriter.h
src/asm_writing/rewriter.h
+38
-4
src/codegen/baseline_jit.cpp
src/codegen/baseline_jit.cpp
+16
-14
src/codegen/baseline_jit.h
src/codegen/baseline_jit.h
+1
-1
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+6
-5
No files found.
src/asm_writing/rewriter.cpp
View file @
46af909b
...
@@ -1205,8 +1205,6 @@ void RewriterVar::bumpUse() {
...
@@ -1205,8 +1205,6 @@ void RewriterVar::bumpUse() {
}
}
this
->
locations
.
clear
();
this
->
locations
.
clear
();
}
else
{
assert
(
vrefcount
>
0
);
}
}
}
}
...
@@ -1721,6 +1719,33 @@ void Rewriter::_checkAndThrowCAPIException(RewriterVar* r, int64_t exc_val) {
...
@@ -1721,6 +1719,33 @@ void Rewriter::_checkAndThrowCAPIException(RewriterVar* r, int64_t exc_val) {
assertConsistent
();
assertConsistent
();
}
}
void
RewriterVar
::
addAssertLastActionAction
(
int
num_left
)
{
static
int
n
=
0
;
n
++
;
// printf("addAssertLastActionAction(); %d\n", n);
int
this_n
=
n
;
// The rewriter adds a phony use of all constants to keep them alive:
if
(
this
->
is_constant
)
num_left
++
;
rewriter
->
addAction
([
=
]()
{
if
(
this
->
next_use
+
num_left
!=
this
->
uses
.
size
())
{
printf
(
"n: %d
\n
"
,
this_n
);
printf
(
"this: %p
\n
"
,
this
);
printf
(
"uses: %p
\n
"
,
&
this
->
uses
);
// for (auto idx : this->uses) {
// printf("Action: %p\n", rewriter->actions[idx].action.func);
// }
printf
(
"%ld
\n
"
,
this
->
uses
.
size
());
raise
(
SIGTRAP
);
}
RELEASE_ASSERT
(
this
->
next_use
+
num_left
==
this
->
uses
.
size
(),
"%d %d %ld
\n
"
,
this
->
next_use
,
num_left
,
this
->
uses
.
size
());
},
{},
ActionType
::
NORMAL
);
}
assembler
::
Indirect
Rewriter
::
indirectFor
(
Location
l
)
{
assembler
::
Indirect
Rewriter
::
indirectFor
(
Location
l
)
{
assert
(
l
.
type
==
Location
::
Scratch
||
l
.
type
==
Location
::
Stack
);
assert
(
l
.
type
==
Location
::
Scratch
||
l
.
type
==
Location
::
Stack
);
...
...
src/asm_writing/rewriter.h
View file @
46af909b
...
@@ -246,19 +246,26 @@ public:
...
@@ -246,19 +246,26 @@ public:
return
this
;
return
this
;
}
}
// Assert that there are exactly num_left actions get added after this call.
// Meant for debugging. It's a way to cross between the two rewriter phases.
void
addAssertLastActionAction
(
int
num_left
=
0
);
RewriterVar
*
decvref
()
{
RewriterVar
*
decvref
()
{
assert
(
reftype
==
RefType
::
OWNED
||
reftype
==
RefType
::
BORROWED
);
assert
(
reftype
==
RefType
::
OWNED
||
reftype
==
RefType
::
BORROWED
);
assert
(
vrefcount
>
0
);
assert
(
vrefcount
>
0
);
vrefcount
--
;
vrefcount
--
;
if
(
vrefcount
==
0
)
{
if
(
vrefcount
==
0
)
{
// Assert that there are no more uses of the this at the machine-code level.
// This is kind of weird to cross this abstraction boundary like this, but
// I think it's a good safety net.
assert
(
next_use
==
uses
.
size
());
if
(
reftype
==
RefType
::
OWNED
)
if
(
reftype
==
RefType
::
OWNED
)
decref
();
decref
();
// Assert that there are no more uses of the this at the machine-code level.
// This is kind of weird to cross this abstraction boundary like this, but
// I think it's a good safety net.
#ifndef NDEBUG
addAssertLastActionAction
();
#endif
}
}
return
this
;
return
this
;
}
}
...
@@ -279,6 +286,9 @@ public:
...
@@ -279,6 +286,9 @@ public:
// See the comment in decvref.
// See the comment in decvref.
// This is similar, except that we want there to be exactly one more use of this variable:
// This is similar, except that we want there to be exactly one more use of this variable:
// whatever consumes the vref. We want that to happen after the materializeVref call.
// whatever consumes the vref. We want that to happen after the materializeVref call.
#ifndef NDEBUG
addAssertLastActionAction
(
1
);
#endif
}
}
return
this
;
return
this
;
}
}
...
@@ -710,6 +720,30 @@ public:
...
@@ -710,6 +720,30 @@ public:
friend
class
RewriterVar
;
friend
class
RewriterVar
;
};
};
struct
AutoDecvref
{
private:
RewriterVar
*
var
;
public:
AutoDecvref
(
RewriterVar
*
var
)
:
var
(
var
)
{}
~
AutoDecvref
()
{
if
(
var
)
var
->
decvref
();
}
operator
RewriterVar
*
()
{
return
var
;
}
RewriterVar
*
operator
->
()
{
return
var
;
}
void
operator
=
(
RewriterVar
*
new_var
)
{
assert
(
!
var
);
var
=
new_var
;
}
};
void
setSlowpathFunc
(
uint8_t
*
pp_addr
,
void
*
func
);
void
setSlowpathFunc
(
uint8_t
*
pp_addr
,
void
*
func
);
struct
GRCompare
{
struct
GRCompare
{
...
...
src/codegen/baseline_jit.cpp
View file @
46af909b
...
@@ -163,7 +163,7 @@ RewriterVar* JitFragmentWriter::imm(void* val) {
...
@@ -163,7 +163,7 @@ RewriterVar* JitFragmentWriter::imm(void* val) {
}
}
RewriterVar
*
JitFragmentWriter
::
emitAugbinop
(
AST_expr
*
node
,
RewriterVar
*
lhs
,
RewriterVar
*
rhs
,
int
op_type
)
{
RewriterVar
*
JitFragmentWriter
::
emitAugbinop
(
AST_expr
*
node
,
RewriterVar
*
lhs
,
RewriterVar
*
rhs
,
int
op_type
)
{
return
emitPPCall
((
void
*
)
augbinop
,
{
lhs
,
rhs
,
imm
(
op_type
)
},
2
,
320
,
node
);
return
emitPPCall
((
void
*
)
augbinop
,
{
lhs
,
rhs
,
imm
(
op_type
)
},
2
,
320
,
node
)
->
setType
(
RefType
::
OWNED
)
;
}
}
RewriterVar
*
JitFragmentWriter
::
emitBinop
(
AST_expr
*
node
,
RewriterVar
*
lhs
,
RewriterVar
*
rhs
,
int
op_type
)
{
RewriterVar
*
JitFragmentWriter
::
emitBinop
(
AST_expr
*
node
,
RewriterVar
*
lhs
,
RewriterVar
*
rhs
,
int
op_type
)
{
...
@@ -199,7 +199,7 @@ RewriterVar* JitFragmentWriter::emitCallattr(AST_expr* node, RewriterVar* obj, B
...
@@ -199,7 +199,7 @@ RewriterVar* JitFragmentWriter::emitCallattr(AST_expr* node, RewriterVar* obj, B
if
(
keyword_names
)
if
(
keyword_names
)
call_args
.
push_back
(
imm
(
keyword_names
));
call_args
.
push_back
(
imm
(
keyword_names
));
return
emitPPCall
((
void
*
)
callattr
,
call_args
,
2
,
640
,
node
,
type_recorder
);
return
emitPPCall
((
void
*
)
callattr
,
call_args
,
2
,
640
,
node
,
type_recorder
)
->
setType
(
RefType
::
OWNED
)
;
#else
#else
// We could make this faster but for now: keep it simple, stupid...
// We could make this faster but for now: keep it simple, stupid...
RewriterVar
*
attr_var
=
imm
(
attr
);
RewriterVar
*
attr_var
=
imm
(
attr
);
...
@@ -230,7 +230,7 @@ RewriterVar* JitFragmentWriter::emitCallattr(AST_expr* node, RewriterVar* obj, B
...
@@ -230,7 +230,7 @@ RewriterVar* JitFragmentWriter::emitCallattr(AST_expr* node, RewriterVar* obj, B
RewriterVar
*
JitFragmentWriter
::
emitCompare
(
AST_expr
*
node
,
RewriterVar
*
lhs
,
RewriterVar
*
rhs
,
int
op_type
)
{
RewriterVar
*
JitFragmentWriter
::
emitCompare
(
AST_expr
*
node
,
RewriterVar
*
lhs
,
RewriterVar
*
rhs
,
int
op_type
)
{
// TODO: can directly emit the assembly for Is/IsNot
// TODO: can directly emit the assembly for Is/IsNot
return
emitPPCall
((
void
*
)
compare
,
{
lhs
,
rhs
,
imm
(
op_type
)
},
2
,
240
,
node
);
return
emitPPCall
((
void
*
)
compare
,
{
lhs
,
rhs
,
imm
(
op_type
)
},
2
,
240
,
node
)
->
setType
(
RefType
::
OWNED
)
;
}
}
RewriterVar
*
JitFragmentWriter
::
emitCreateDict
(
const
llvm
::
ArrayRef
<
RewriterVar
*>
keys
,
RewriterVar
*
JitFragmentWriter
::
emitCreateDict
(
const
llvm
::
ArrayRef
<
RewriterVar
*>
keys
,
...
@@ -296,7 +296,7 @@ RewriterVar* JitFragmentWriter::emitExceptionMatches(RewriterVar* v, RewriterVar
...
@@ -296,7 +296,7 @@ RewriterVar* JitFragmentWriter::emitExceptionMatches(RewriterVar* v, RewriterVar
}
}
RewriterVar
*
JitFragmentWriter
::
emitGetAttr
(
RewriterVar
*
obj
,
BoxedString
*
s
,
AST_expr
*
node
)
{
RewriterVar
*
JitFragmentWriter
::
emitGetAttr
(
RewriterVar
*
obj
,
BoxedString
*
s
,
AST_expr
*
node
)
{
return
emitPPCall
((
void
*
)
getattr
,
{
obj
,
imm
(
s
)
},
2
,
512
,
node
,
getTypeRecorderForNode
(
node
));
return
emitPPCall
((
void
*
)
getattr
,
{
obj
,
imm
(
s
)
},
2
,
512
,
node
,
getTypeRecorderForNode
(
node
))
->
setType
(
RefType
::
OWNED
)
;
}
}
RewriterVar
*
JitFragmentWriter
::
emitGetBlockLocal
(
InternedString
s
,
int
vreg
)
{
RewriterVar
*
JitFragmentWriter
::
emitGetBlockLocal
(
InternedString
s
,
int
vreg
)
{
...
@@ -318,7 +318,7 @@ RewriterVar* JitFragmentWriter::emitGetBoxedLocals() {
...
@@ -318,7 +318,7 @@ RewriterVar* JitFragmentWriter::emitGetBoxedLocals() {
}
}
RewriterVar
*
JitFragmentWriter
::
emitGetClsAttr
(
RewriterVar
*
obj
,
BoxedString
*
s
)
{
RewriterVar
*
JitFragmentWriter
::
emitGetClsAttr
(
RewriterVar
*
obj
,
BoxedString
*
s
)
{
return
emitPPCall
((
void
*
)
getclsattr
,
{
obj
,
imm
(
s
)
},
2
,
512
);
return
emitPPCall
((
void
*
)
getclsattr
,
{
obj
,
imm
(
s
)
},
2
,
512
)
->
setType
(
RefType
::
OWNED
)
;
}
}
RewriterVar
*
JitFragmentWriter
::
emitGetGlobal
(
Box
*
global
,
BoxedString
*
s
)
{
RewriterVar
*
JitFragmentWriter
::
emitGetGlobal
(
Box
*
global
,
BoxedString
*
s
)
{
...
@@ -334,7 +334,7 @@ RewriterVar* JitFragmentWriter::emitGetGlobal(Box* global, BoxedString* s) {
...
@@ -334,7 +334,7 @@ RewriterVar* JitFragmentWriter::emitGetGlobal(Box* global, BoxedString* s) {
}
}
RewriterVar
*
JitFragmentWriter
::
emitGetItem
(
AST_expr
*
node
,
RewriterVar
*
value
,
RewriterVar
*
slice
)
{
RewriterVar
*
JitFragmentWriter
::
emitGetItem
(
AST_expr
*
node
,
RewriterVar
*
value
,
RewriterVar
*
slice
)
{
return
emitPPCall
((
void
*
)
getitem
,
{
value
,
slice
},
2
,
512
,
node
);
return
emitPPCall
((
void
*
)
getitem
,
{
value
,
slice
},
2
,
512
,
node
)
->
setType
(
RefType
::
OWNED
)
;
}
}
RewriterVar
*
JitFragmentWriter
::
emitGetLocal
(
InternedString
s
,
int
vreg
)
{
RewriterVar
*
JitFragmentWriter
::
emitGetLocal
(
InternedString
s
,
int
vreg
)
{
...
@@ -431,7 +431,7 @@ RewriterVar* JitFragmentWriter::emitRuntimeCall(AST_expr* node, RewriterVar* obj
...
@@ -431,7 +431,7 @@ RewriterVar* JitFragmentWriter::emitRuntimeCall(AST_expr* node, RewriterVar* obj
}
}
RewriterVar
*
JitFragmentWriter
::
emitUnaryop
(
RewriterVar
*
v
,
int
op_type
)
{
RewriterVar
*
JitFragmentWriter
::
emitUnaryop
(
RewriterVar
*
v
,
int
op_type
)
{
return
emitPPCall
((
void
*
)
unaryop
,
{
v
,
imm
(
op_type
)
},
2
,
160
);
return
emitPPCall
((
void
*
)
unaryop
,
{
v
,
imm
(
op_type
)
},
2
,
160
)
->
setType
(
RefType
::
OWNED
)
;
}
}
RewriterVar
*
JitFragmentWriter
::
emitUnpackIntoArray
(
RewriterVar
*
v
,
uint64_t
num
)
{
RewriterVar
*
JitFragmentWriter
::
emitUnpackIntoArray
(
RewriterVar
*
v
,
uint64_t
num
)
{
...
@@ -445,16 +445,16 @@ RewriterVar* JitFragmentWriter::emitYield(RewriterVar* v) {
...
@@ -445,16 +445,16 @@ RewriterVar* JitFragmentWriter::emitYield(RewriterVar* v) {
}
}
void
JitFragmentWriter
::
emitDelAttr
(
RewriterVar
*
target
,
BoxedString
*
attr
)
{
void
JitFragmentWriter
::
emitDelAttr
(
RewriterVar
*
target
,
BoxedString
*
attr
)
{
emitPPCall
((
void
*
)
delattr
,
{
target
,
imm
(
attr
)
},
1
,
512
);
emitPPCall
((
void
*
)
delattr
,
{
target
,
imm
(
attr
)
},
1
,
512
)
->
setType
(
RefType
::
OWNED
)
;
}
}
void
JitFragmentWriter
::
emitDelGlobal
(
BoxedString
*
name
)
{
void
JitFragmentWriter
::
emitDelGlobal
(
BoxedString
*
name
)
{
RewriterVar
*
globals
=
getInterp
()
->
getAttr
(
ASTInterpreterJitInterface
::
getGlobalsOffset
());
RewriterVar
*
globals
=
getInterp
()
->
getAttr
(
ASTInterpreterJitInterface
::
getGlobalsOffset
());
emitPPCall
((
void
*
)
delGlobal
,
{
globals
,
imm
(
name
)
},
1
,
512
);
emitPPCall
((
void
*
)
delGlobal
,
{
globals
,
imm
(
name
)
},
1
,
512
)
->
setType
(
RefType
::
OWNED
)
;
}
}
void
JitFragmentWriter
::
emitDelItem
(
RewriterVar
*
target
,
RewriterVar
*
slice
)
{
void
JitFragmentWriter
::
emitDelItem
(
RewriterVar
*
target
,
RewriterVar
*
slice
)
{
emitPPCall
((
void
*
)
delitem
,
{
target
,
slice
},
1
,
512
);
emitPPCall
((
void
*
)
delitem
,
{
target
,
slice
},
1
,
512
)
->
setType
(
RefType
::
OWNED
)
;
}
}
void
JitFragmentWriter
::
emitDelName
(
InternedString
name
)
{
void
JitFragmentWriter
::
emitDelName
(
InternedString
name
)
{
...
@@ -518,7 +518,7 @@ void JitFragmentWriter::emitReturn(RewriterVar* v) {
...
@@ -518,7 +518,7 @@ void JitFragmentWriter::emitReturn(RewriterVar* v) {
}
}
void
JitFragmentWriter
::
emitSetAttr
(
AST_expr
*
node
,
RewriterVar
*
obj
,
BoxedString
*
s
,
RewriterVar
*
attr
)
{
void
JitFragmentWriter
::
emitSetAttr
(
AST_expr
*
node
,
RewriterVar
*
obj
,
BoxedString
*
s
,
RewriterVar
*
attr
)
{
emitPPCall
((
void
*
)
setattr
,
{
obj
,
imm
(
s
),
attr
},
2
,
512
,
node
);
emitPPCall
((
void
*
)
setattr
,
{
obj
,
imm
(
s
),
attr
},
2
,
512
,
node
)
->
setType
(
RefType
::
OWNED
)
;
}
}
void
JitFragmentWriter
::
emitSetBlockLocal
(
InternedString
s
,
RewriterVar
*
v
)
{
void
JitFragmentWriter
::
emitSetBlockLocal
(
InternedString
s
,
RewriterVar
*
v
)
{
...
@@ -539,11 +539,11 @@ void JitFragmentWriter::emitSetExcInfo(RewriterVar* type, RewriterVar* value, Re
...
@@ -539,11 +539,11 @@ void JitFragmentWriter::emitSetExcInfo(RewriterVar* type, RewriterVar* value, Re
}
}
void
JitFragmentWriter
::
emitSetGlobal
(
Box
*
global
,
BoxedString
*
s
,
RewriterVar
*
v
)
{
void
JitFragmentWriter
::
emitSetGlobal
(
Box
*
global
,
BoxedString
*
s
,
RewriterVar
*
v
)
{
emitPPCall
((
void
*
)
setGlobal
,
{
imm
(
global
),
imm
(
s
),
v
},
2
,
512
);
emitPPCall
((
void
*
)
setGlobal
,
{
imm
(
global
),
imm
(
s
),
v
},
2
,
512
)
->
setType
(
RefType
::
OWNED
)
;
}
}
void
JitFragmentWriter
::
emitSetItem
(
RewriterVar
*
target
,
RewriterVar
*
slice
,
RewriterVar
*
value
)
{
void
JitFragmentWriter
::
emitSetItem
(
RewriterVar
*
target
,
RewriterVar
*
slice
,
RewriterVar
*
value
)
{
emitPPCall
((
void
*
)
setitem
,
{
target
,
slice
,
value
},
2
,
512
);
emitPPCall
((
void
*
)
setitem
,
{
target
,
slice
,
value
},
2
,
512
)
->
setType
(
RefType
::
OWNED
)
;
}
}
void
JitFragmentWriter
::
emitSetItemName
(
BoxedString
*
s
,
RewriterVar
*
v
)
{
void
JitFragmentWriter
::
emitSetItemName
(
BoxedString
*
s
,
RewriterVar
*
v
)
{
...
@@ -563,6 +563,7 @@ void JitFragmentWriter::emitSetLocal(InternedString s, int vreg, bool set_closur
...
@@ -563,6 +563,7 @@ void JitFragmentWriter::emitSetLocal(InternedString s, int vreg, bool set_closur
v
);
v
);
}
else
{
}
else
{
RewriterVar
*
prev
=
vregs_array
->
getAttr
(
8
*
vreg
)
->
setType
(
RefType
::
OWNED
);
RewriterVar
*
prev
=
vregs_array
->
getAttr
(
8
*
vreg
)
->
setType
(
RefType
::
OWNED
);
v
->
materializeVref
();
vregs_array
->
setAttr
(
8
*
vreg
,
v
);
vregs_array
->
setAttr
(
8
*
vreg
,
v
);
// XXX: this either needs to be an xdecref or we should check liveness analysis.
// XXX: this either needs to be an xdecref or we should check liveness analysis.
prev
->
decvref
();
prev
->
decvref
();
...
@@ -990,7 +991,8 @@ void JitFragmentWriter::_emitSideExit(RewriterVar* var, RewriterVar* val_constan
...
@@ -990,7 +991,8 @@ void JitFragmentWriter::_emitSideExit(RewriterVar* var, RewriterVar* val_constan
}
}
{
{
assembler
::
ForwardJump
jne
(
*
assembler
,
assembler
::
COND_EQUAL
);
// TODO: Figure out if we need a large/small forward based on the number of local syms we will have to decref?
assembler
::
LargeForwardJump
jne
(
*
assembler
,
assembler
::
COND_EQUAL
);
_decref
(
var
);
_decref
(
var
);
...
...
src/codegen/baseline_jit.h
View file @
46af909b
...
@@ -258,7 +258,7 @@ public:
...
@@ -258,7 +258,7 @@ public:
void
emitRaise3
(
RewriterVar
*
arg0
,
RewriterVar
*
arg1
,
RewriterVar
*
arg2
);
void
emitRaise3
(
RewriterVar
*
arg0
,
RewriterVar
*
arg1
,
RewriterVar
*
arg2
);
void
emitReturn
(
RewriterVar
*
v
);
void
emitReturn
(
RewriterVar
*
v
);
void
emitSetAttr
(
AST_expr
*
node
,
RewriterVar
*
obj
,
BoxedString
*
s
,
RewriterVar
*
attr
);
void
emitSetAttr
(
AST_expr
*
node
,
RewriterVar
*
obj
,
BoxedString
*
s
,
RewriterVar
*
attr
);
void
emitSetBlockLocal
(
InternedString
s
,
RewriterVar
*
v
);
void
emitSetBlockLocal
(
InternedString
s
,
STOLEN
(
RewriterVar
*
)
v
);
void
emitSetCurrentInst
(
AST_stmt
*
node
);
void
emitSetCurrentInst
(
AST_stmt
*
node
);
void
emitSetExcInfo
(
RewriterVar
*
type
,
RewriterVar
*
value
,
RewriterVar
*
traceback
);
void
emitSetExcInfo
(
RewriterVar
*
type
,
RewriterVar
*
value
,
RewriterVar
*
traceback
);
void
emitSetGlobal
(
Box
*
global
,
BoxedString
*
s
,
RewriterVar
*
v
);
void
emitSetGlobal
(
Box
*
global
,
BoxedString
*
s
,
RewriterVar
*
v
);
...
...
src/runtime/objmodel.cpp
View file @
46af909b
...
@@ -1282,7 +1282,6 @@ template <Rewritable rewritable> Box* typeLookup(BoxedClass* cls, BoxedString* a
...
@@ -1282,7 +1282,6 @@ template <Rewritable rewritable> Box* typeLookup(BoxedClass* cls, BoxedString* a
if
(
!
val
)
if
(
!
val
)
rewrite_args
->
setReturn
(
NULL
,
ReturnConvention
::
NO_RETURN
);
rewrite_args
->
setReturn
(
NULL
,
ReturnConvention
::
NO_RETURN
);
else
{
else
{
// typeLookup is special since it doesn't even return a vref
rewrite_args
->
setReturn
(
rewrite_args
->
setReturn
(
rewrite_args
->
rewriter
->
loadConst
((
int64_t
)
val
)
->
setType
(
RefType
::
BORROWED
),
rewrite_args
->
rewriter
->
loadConst
((
int64_t
)
val
)
->
setType
(
RefType
::
BORROWED
),
ReturnConvention
::
HAS_RETURN
);
ReturnConvention
::
HAS_RETURN
);
...
@@ -1945,7 +1944,7 @@ Box* getattrInternalGeneric(Box* obj, BoxedString* attr, GetattrRewriteArgs* rew
...
@@ -1945,7 +1944,7 @@ Box* getattrInternalGeneric(Box* obj, BoxedString* attr, GetattrRewriteArgs* rew
// Look up the class attribute (called `descr` here because it might
// Look up the class attribute (called `descr` here because it might
// be a descriptor).
// be a descriptor).
Box
*
descr
=
NULL
;
Box
*
descr
=
NULL
;
RewriterVar
*
r_descr
=
NULL
;
AutoDecvref
r_descr
=
NULL
;
if
(
rewrite_args
)
{
if
(
rewrite_args
)
{
RewriterVar
*
r_obj_cls
=
rewrite_args
->
obj
->
getAttr
(
offsetof
(
Box
,
cls
),
Location
::
any
());
RewriterVar
*
r_obj_cls
=
rewrite_args
->
obj
->
getAttr
(
offsetof
(
Box
,
cls
),
Location
::
any
());
GetattrRewriteArgs
grewrite_args
(
rewrite_args
->
rewriter
,
r_obj_cls
,
rewrite_args
->
destination
);
GetattrRewriteArgs
grewrite_args
(
rewrite_args
->
rewriter
,
r_obj_cls
,
rewrite_args
->
destination
);
...
@@ -3575,9 +3574,9 @@ void rearrangeArgumentsInternal(ParamReceiveSpec paramspec, const ParamNames* pa
...
@@ -3575,9 +3574,9 @@ void rearrangeArgumentsInternal(ParamReceiveSpec paramspec, const ParamNames* pa
rewrite_args
->
arg3
->
incvref
();
rewrite_args
->
arg3
->
incvref
();
if
(
num_output_args
>=
3
)
{
if
(
num_output_args
>=
3
)
{
RELEASE_ASSERT
(
0
,
"not sure what to do here
\n
"
);
RELEASE_ASSERT
(
0
,
"not sure what to do here
\n
"
);
for
(
int
i
=
0
;
i
<
num_output_args
-
3
;
i
++
)
{
//
for (int i = 0; i < num_output_args - 3; i++) {
rewrite_args
->
args
->
getAttr
(
i
*
sizeof
(
Box
*
))
->
incref
();
//
rewrite_args->args->getAttr(i * sizeof(Box*))->incref();
}
//
}
}
}
}
}
return
;
return
;
...
@@ -4858,6 +4857,8 @@ extern "C" Box* binop(Box* lhs, Box* rhs, int op_type) {
...
@@ -4858,6 +4857,8 @@ extern "C" Box* binop(Box* lhs, Box* rhs, int op_type) {
if
(
!
rewrite_args
.
out_success
)
{
if
(
!
rewrite_args
.
out_success
)
{
rewriter
.
reset
(
NULL
);
rewriter
.
reset
(
NULL
);
}
else
{
}
else
{
rewriter
->
getArg
(
0
)
->
decvref
();
rewriter
->
getArg
(
1
)
->
decvref
();
rewrite_args
.
out_rtn
->
materializeVref
();
rewrite_args
.
out_rtn
->
materializeVref
();
rewriter
->
commitReturning
(
rewrite_args
.
out_rtn
);
rewriter
->
commitReturning
(
rewrite_args
.
out_rtn
);
}
}
...
...
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