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
5efde076
Commit
5efde076
authored
Feb 20, 2015
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compvars: Add CallattrFlags support
parent
9cd8624a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
39 deletions
+52
-39
src/codegen/compvars.cpp
src/codegen/compvars.cpp
+28
-20
src/codegen/compvars.h
src/codegen/compvars.h
+6
-5
src/codegen/irgen/irgenerator.cpp
src/codegen/irgen/irgenerator.cpp
+13
-10
src/core/types.h
src/core/types.h
+5
-0
src/runtime/objmodel.h
src/runtime/objmodel.h
+0
-4
No files found.
src/codegen/compvars.cpp
View file @
5efde076
...
@@ -210,7 +210,7 @@ public:
...
@@ -210,7 +210,7 @@ public:
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
;
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
;
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
ConcreteCompilerVariable
*
var
,
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
ConcreteCompilerVariable
*
var
,
const
std
::
string
*
attr
,
bool
clsonly
,
ArgPassSpec
argspec
,
const
std
::
string
*
attr
,
CallattrFlags
flags
,
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
;
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
;
ConcreteCompilerVariable
*
nonzero
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
ConcreteCompilerVariable
*
var
)
override
;
ConcreteCompilerVariable
*
nonzero
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
ConcreteCompilerVariable
*
var
)
override
;
...
@@ -579,7 +579,7 @@ CompilerVariable* UnknownType::call(IREmitter& emitter, const OpInfo& info, Conc
...
@@ -579,7 +579,7 @@ CompilerVariable* UnknownType::call(IREmitter& emitter, const OpInfo& info, Conc
}
}
CompilerVariable
*
UnknownType
::
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
ConcreteCompilerVariable
*
var
,
CompilerVariable
*
UnknownType
::
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
ConcreteCompilerVariable
*
var
,
const
std
::
string
*
attr
,
bool
clsonly
,
ArgPassSpec
argspec
,
const
std
::
string
*
attr
,
CallattrFlags
flags
,
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
{
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
{
bool
pass_keywords
=
(
argspec
.
num_keywords
!=
0
);
bool
pass_keywords
=
(
argspec
.
num_keywords
!=
0
);
...
@@ -599,10 +599,17 @@ CompilerVariable* UnknownType::callattr(IREmitter& emitter, const OpInfo& info,
...
@@ -599,10 +599,17 @@ CompilerVariable* UnknownType::callattr(IREmitter& emitter, const OpInfo& info,
else
else
func
=
g
.
funcs
.
callattrN
;
func
=
g
.
funcs
.
callattrN
;
union
{
CallattrFlags
flags
;
char
value
;
}
flags_to_int
;
static_assert
(
sizeof
(
CallattrFlags
)
==
sizeof
(
char
),
""
);
flags_to_int
.
flags
=
flags
;
std
::
vector
<
llvm
::
Value
*>
other_args
;
std
::
vector
<
llvm
::
Value
*>
other_args
;
other_args
.
push_back
(
var
->
getValue
());
other_args
.
push_back
(
var
->
getValue
());
other_args
.
push_back
(
embedConstantPtr
(
attr
,
g
.
llvm_str_type_ptr
));
other_args
.
push_back
(
embedConstantPtr
(
attr
,
g
.
llvm_str_type_ptr
));
other_args
.
push_back
(
getConstantInt
(
clsonly
,
g
.
i1
));
other_args
.
push_back
(
getConstantInt
(
flags_to_int
.
value
,
g
.
i8
));
llvm
::
Value
*
llvm_argspec
=
llvm
::
ConstantInt
::
get
(
g
.
i32
,
argspec
.
asInt
(),
false
);
llvm
::
Value
*
llvm_argspec
=
llvm
::
ConstantInt
::
get
(
g
.
i32
,
argspec
.
asInt
(),
false
);
other_args
.
push_back
(
llvm_argspec
);
other_args
.
push_back
(
llvm_argspec
);
...
@@ -819,11 +826,11 @@ public:
...
@@ -819,11 +826,11 @@ public:
}
}
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
ConcreteCompilerVariable
*
var
,
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
ConcreteCompilerVariable
*
var
,
const
std
::
string
*
attr
,
bool
clsonly
,
ArgPassSpec
argspec
,
const
std
::
string
*
attr
,
CallattrFlags
flags
,
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
ConcreteCompilerVariable
*
converted
=
var
->
makeConverted
(
emitter
,
BOXED_INT
);
ConcreteCompilerVariable
*
converted
=
var
->
makeConverted
(
emitter
,
BOXED_INT
);
CompilerVariable
*
rtn
=
converted
->
callattr
(
emitter
,
info
,
attr
,
clsonly
,
argspec
,
args
,
keyword_names
);
CompilerVariable
*
rtn
=
converted
->
callattr
(
emitter
,
info
,
attr
,
flags
,
argspec
,
args
,
keyword_names
);
converted
->
decvref
(
emitter
);
converted
->
decvref
(
emitter
);
return
rtn
;
return
rtn
;
}
}
...
@@ -1057,11 +1064,11 @@ public:
...
@@ -1057,11 +1064,11 @@ public:
}
}
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
ConcreteCompilerVariable
*
var
,
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
ConcreteCompilerVariable
*
var
,
const
std
::
string
*
attr
,
bool
clsonly
,
ArgPassSpec
argspec
,
const
std
::
string
*
attr
,
CallattrFlags
flags
,
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
ConcreteCompilerVariable
*
converted
=
var
->
makeConverted
(
emitter
,
BOXED_FLOAT
);
ConcreteCompilerVariable
*
converted
=
var
->
makeConverted
(
emitter
,
BOXED_FLOAT
);
CompilerVariable
*
rtn
=
converted
->
callattr
(
emitter
,
info
,
attr
,
clsonly
,
argspec
,
args
,
keyword_names
);
CompilerVariable
*
rtn
=
converted
->
callattr
(
emitter
,
info
,
attr
,
flags
,
argspec
,
args
,
keyword_names
);
converted
->
decvref
(
emitter
);
converted
->
decvref
(
emitter
);
return
rtn
;
return
rtn
;
}
}
...
@@ -1523,16 +1530,16 @@ public:
...
@@ -1523,16 +1530,16 @@ public:
}
}
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
ConcreteCompilerVariable
*
var
,
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
ConcreteCompilerVariable
*
var
,
const
std
::
string
*
attr
,
bool
clsonly
,
ArgPassSpec
argspec
,
const
std
::
string
*
attr
,
CallattrFlags
flags
,
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
ConcreteCompilerVariable
*
called_constant
ConcreteCompilerVariable
*
called_constant
=
tryCallattrConstant
(
emitter
,
info
,
var
,
attr
,
cls
only
,
argspec
,
args
,
keyword_names
);
=
tryCallattrConstant
(
emitter
,
info
,
var
,
attr
,
flags
.
cls_
only
,
argspec
,
args
,
keyword_names
);
if
(
called_constant
)
if
(
called_constant
)
return
called_constant
;
return
called_constant
;
ConcreteCompilerVariable
*
converted
=
var
->
makeConverted
(
emitter
,
UNKNOWN
);
ConcreteCompilerVariable
*
converted
=
var
->
makeConverted
(
emitter
,
UNKNOWN
);
CompilerVariable
*
rtn
=
converted
->
callattr
(
emitter
,
info
,
attr
,
clsonly
,
argspec
,
args
,
keyword_names
);
CompilerVariable
*
rtn
=
converted
->
callattr
(
emitter
,
info
,
attr
,
flags
,
argspec
,
args
,
keyword_names
);
converted
->
decvref
(
emitter
);
converted
->
decvref
(
emitter
);
return
rtn
;
return
rtn
;
}
}
...
@@ -1551,6 +1558,7 @@ public:
...
@@ -1551,6 +1558,7 @@ public:
const
std
::
string
&
left_side_name
=
getOpName
(
op_type
);
const
std
::
string
&
left_side_name
=
getOpName
(
op_type
);
bool
no_attribute
=
false
;
bool
no_attribute
=
false
;
ConcreteCompilerVariable
*
called_constant
ConcreteCompilerVariable
*
called_constant
=
tryCallattrConstant
(
emitter
,
info
,
var
,
&
left_side_name
,
true
,
ArgPassSpec
(
1
,
0
,
0
,
0
),
=
tryCallattrConstant
(
emitter
,
info
,
var
,
&
left_side_name
,
true
,
ArgPassSpec
(
1
,
0
,
0
,
0
),
{
converted_rhs
},
NULL
,
&
no_attribute
);
{
converted_rhs
},
NULL
,
&
no_attribute
);
...
@@ -1741,11 +1749,11 @@ public:
...
@@ -1741,11 +1749,11 @@ public:
return
rtn
;
return
rtn
;
}
}
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
VAR
*
var
,
const
std
::
string
*
attr
,
bool
clsonly
,
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
VAR
*
var
,
const
std
::
string
*
attr
,
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
CallattrFlags
flags
,
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
ConcreteCompilerVariable
*
converted
=
var
->
makeConverted
(
emitter
,
STR
);
ConcreteCompilerVariable
*
converted
=
var
->
makeConverted
(
emitter
,
STR
);
CompilerVariable
*
rtn
=
converted
->
callattr
(
emitter
,
info
,
attr
,
clsonly
,
argspec
,
args
,
keyword_names
);
CompilerVariable
*
rtn
=
converted
->
callattr
(
emitter
,
info
,
attr
,
flags
,
argspec
,
args
,
keyword_names
);
converted
->
decvref
(
emitter
);
converted
->
decvref
(
emitter
);
return
rtn
;
return
rtn
;
}
}
...
@@ -1864,11 +1872,11 @@ public:
...
@@ -1864,11 +1872,11 @@ public:
}
}
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
ConcreteCompilerVariable
*
var
,
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
ConcreteCompilerVariable
*
var
,
const
std
::
string
*
attr
,
bool
clsonly
,
ArgPassSpec
argspec
,
const
std
::
string
*
attr
,
CallattrFlags
flags
,
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
ConcreteCompilerVariable
*
converted
=
var
->
makeConverted
(
emitter
,
BOXED_BOOL
);
ConcreteCompilerVariable
*
converted
=
var
->
makeConverted
(
emitter
,
BOXED_BOOL
);
CompilerVariable
*
rtn
=
converted
->
callattr
(
emitter
,
info
,
attr
,
clsonly
,
argspec
,
args
,
keyword_names
);
CompilerVariable
*
rtn
=
converted
->
callattr
(
emitter
,
info
,
attr
,
flags
,
argspec
,
args
,
keyword_names
);
converted
->
decvref
(
emitter
);
converted
->
decvref
(
emitter
);
return
rtn
;
return
rtn
;
}
}
...
@@ -2037,11 +2045,11 @@ public:
...
@@ -2037,11 +2045,11 @@ public:
return
rtn
;
return
rtn
;
}
}
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
VAR
*
var
,
const
std
::
string
*
attr
,
bool
clsonly
,
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
VAR
*
var
,
const
std
::
string
*
attr
,
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
CallattrFlags
flags
,
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
return
makeConverted
(
emitter
,
var
,
getConcreteType
())
return
makeConverted
(
emitter
,
var
,
getConcreteType
())
->
callattr
(
emitter
,
info
,
attr
,
clsonly
,
argspec
,
args
,
keyword_names
);
->
callattr
(
emitter
,
info
,
attr
,
flags
,
argspec
,
args
,
keyword_names
);
}
}
void
serializeToFrame
(
VAR
*
var
,
std
::
vector
<
llvm
::
Value
*>&
stackmap_args
)
override
{
void
serializeToFrame
(
VAR
*
var
,
std
::
vector
<
llvm
::
Value
*>&
stackmap_args
)
override
{
...
@@ -2141,8 +2149,8 @@ public:
...
@@ -2141,8 +2149,8 @@ public:
return
undefVariable
();
return
undefVariable
();
}
}
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
VAR
*
var
,
const
std
::
string
*
attr
,
bool
clsonly
,
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
VAR
*
var
,
const
std
::
string
*
attr
,
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
CallattrFlags
flags
,
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
return
undefVariable
();
return
undefVariable
();
}
}
...
...
src/codegen/compvars.h
View file @
5efde076
...
@@ -112,7 +112,7 @@ public:
...
@@ -112,7 +112,7 @@ public:
}
}
virtual
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
VAR
*
var
,
const
std
::
string
*
attr
,
virtual
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
VAR
*
var
,
const
std
::
string
*
attr
,
bool
clsonly
,
struct
ArgPassSpec
argspec
,
CallattrFlags
flags
,
struct
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
{
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
{
printf
(
"callattr not defined for %s
\n
"
,
debugName
().
c_str
());
printf
(
"callattr not defined for %s
\n
"
,
debugName
().
c_str
());
...
@@ -254,8 +254,9 @@ public:
...
@@ -254,8 +254,9 @@ public:
=
0
;
=
0
;
virtual
void
setattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
const
std
::
string
*
attr
,
CompilerVariable
*
v
)
=
0
;
virtual
void
setattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
const
std
::
string
*
attr
,
CompilerVariable
*
v
)
=
0
;
virtual
void
delattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
const
std
::
string
*
attr
)
=
0
;
virtual
void
delattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
const
std
::
string
*
attr
)
=
0
;
virtual
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
const
std
::
string
*
attr
,
bool
clsonly
,
virtual
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
const
std
::
string
*
attr
,
struct
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
CallattrFlags
flags
,
struct
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
=
0
;
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
=
0
;
virtual
CompilerVariable
*
call
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
struct
ArgPassSpec
argspec
,
virtual
CompilerVariable
*
call
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
struct
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
...
@@ -330,10 +331,10 @@ public:
...
@@ -330,10 +331,10 @@ public:
type
->
delattr
(
emitter
,
info
,
this
,
attr
);
type
->
delattr
(
emitter
,
info
,
this
,
attr
);
}
}
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
const
std
::
string
*
attr
,
bool
clsonly
,
CompilerVariable
*
callattr
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
const
std
::
string
*
attr
,
CallattrFlags
flags
,
struct
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
struct
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
)
override
{
return
type
->
callattr
(
emitter
,
info
,
this
,
attr
,
clsonly
,
argspec
,
args
,
keyword_names
);
return
type
->
callattr
(
emitter
,
info
,
this
,
attr
,
flags
,
argspec
,
args
,
keyword_names
);
}
}
CompilerVariable
*
call
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
struct
ArgPassSpec
argspec
,
CompilerVariable
*
call
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
struct
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
...
...
src/codegen/irgen/irgenerator.cpp
View file @
5efde076
...
@@ -457,8 +457,9 @@ private:
...
@@ -457,8 +457,9 @@ private:
ConcreteCompilerVariable
*
converted
=
p
.
second
->
makeConverted
(
emitter
,
p
.
second
->
getBoxType
());
ConcreteCompilerVariable
*
converted
=
p
.
second
->
makeConverted
(
emitter
,
p
.
second
->
getBoxType
());
// TODO super dumb that it reallocates the name again
// TODO super dumb that it reallocates the name again
CallattrFlags
flags
=
{.
cls_only
=
true
,
.
null_on_nonexistent
=
false
};
CompilerVariable
*
_r
CompilerVariable
*
_r
=
rtn
->
callattr
(
emitter
,
getEmptyOpInfo
(
unw_info
),
&
setitem_str
,
true
,
ArgPassSpec
(
2
),
=
rtn
->
callattr
(
emitter
,
getEmptyOpInfo
(
unw_info
),
&
setitem_str
,
flags
,
ArgPassSpec
(
2
),
{
makeStr
(
new
std
::
string
(
p
.
first
.
str
())),
converted
},
NULL
);
{
makeStr
(
new
std
::
string
(
p
.
first
.
str
())),
converted
},
NULL
);
converted
->
decvref
(
emitter
);
converted
->
decvref
(
emitter
);
_r
->
decvref
(
emitter
);
_r
->
decvref
(
emitter
);
...
@@ -474,8 +475,9 @@ private:
...
@@ -474,8 +475,9 @@ private:
emitter
.
getBuilder
()
->
SetInsertPoint
(
was_defined
);
emitter
.
getBuilder
()
->
SetInsertPoint
(
was_defined
);
ConcreteCompilerVariable
*
converted
=
p
.
second
->
makeConverted
(
emitter
,
p
.
second
->
getBoxType
());
ConcreteCompilerVariable
*
converted
=
p
.
second
->
makeConverted
(
emitter
,
p
.
second
->
getBoxType
());
// TODO super dumb that it reallocates the name again
// TODO super dumb that it reallocates the name again
CallattrFlags
flags
=
{.
cls_only
=
true
,
.
null_on_nonexistent
=
false
};
CompilerVariable
*
_r
CompilerVariable
*
_r
=
rtn
->
callattr
(
emitter
,
getEmptyOpInfo
(
unw_info
),
&
setitem_str
,
true
,
ArgPassSpec
(
2
),
=
rtn
->
callattr
(
emitter
,
getEmptyOpInfo
(
unw_info
),
&
setitem_str
,
flags
,
ArgPassSpec
(
2
),
{
makeStr
(
new
std
::
string
(
p
.
first
.
str
())),
converted
},
NULL
);
{
makeStr
(
new
std
::
string
(
p
.
first
.
str
())),
converted
},
NULL
);
converted
->
decvref
(
emitter
);
converted
->
decvref
(
emitter
);
_r
->
decvref
(
emitter
);
_r
->
decvref
(
emitter
);
...
@@ -744,8 +746,8 @@ private:
...
@@ -744,8 +746,8 @@ private:
CompilerVariable
*
rtn
;
CompilerVariable
*
rtn
;
if
(
is_callattr
)
{
if
(
is_callattr
)
{
rtn
=
func
->
callattr
(
emitter
,
getOpInfoForNode
(
node
,
unw_info
),
attr
,
callattr_clsonly
,
argspec
,
args
,
CallattrFlags
flags
=
{.
cls_only
=
callattr_clsonly
,
.
null_on_nonexistent
=
false
};
keyword_names
);
rtn
=
func
->
callattr
(
emitter
,
getOpInfoForNode
(
node
,
unw_info
),
attr
,
flags
,
argspec
,
args
,
keyword_names
);
}
else
{
}
else
{
rtn
=
func
->
call
(
emitter
,
getOpInfoForNode
(
node
,
unw_info
),
argspec
,
args
,
keyword_names
);
rtn
=
func
->
call
(
emitter
,
getOpInfoForNode
(
node
,
unw_info
),
argspec
,
args
,
keyword_names
);
}
}
...
@@ -972,8 +974,8 @@ private:
...
@@ -972,8 +974,8 @@ private:
for
(
int
i
=
0
;
i
<
node
->
elts
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
node
->
elts
.
size
();
i
++
)
{
CompilerVariable
*
elt
=
elts
[
i
];
CompilerVariable
*
elt
=
elts
[
i
];
CallattrFlags
flags
=
{.
cls_only
=
true
,
.
null_on_nonexistent
=
false
};
CompilerVariable
*
r
=
rtn
->
callattr
(
emitter
,
getOpInfoForNode
(
node
,
unw_info
),
&
add_str
,
true
,
CompilerVariable
*
r
=
rtn
->
callattr
(
emitter
,
getOpInfoForNode
(
node
,
unw_info
),
&
add_str
,
flags
,
ArgPassSpec
(
1
),
{
elt
},
NULL
);
ArgPassSpec
(
1
),
{
elt
},
NULL
);
r
->
decvref
(
emitter
);
r
->
decvref
(
emitter
);
elt
->
decvref
(
emitter
);
elt
->
decvref
(
emitter
);
...
@@ -1636,8 +1638,8 @@ private:
...
@@ -1636,8 +1638,8 @@ private:
curblock
=
ss_block
;
curblock
=
ss_block
;
emitter
.
getBuilder
()
->
SetInsertPoint
(
ss_block
);
emitter
.
getBuilder
()
->
SetInsertPoint
(
ss_block
);
CallattrFlags
flags
=
{.
cls_only
=
false
,
.
null_on_nonexistent
=
false
};
auto
r
=
dest
->
callattr
(
emitter
,
getOpInfoForNode
(
node
,
unw_info
),
&
write_str
,
f
alse
,
ArgPassSpec
(
1
),
auto
r
=
dest
->
callattr
(
emitter
,
getOpInfoForNode
(
node
,
unw_info
),
&
write_str
,
f
lags
,
ArgPassSpec
(
1
),
{
makeStr
(
&
space_str
)
},
NULL
);
{
makeStr
(
&
space_str
)
},
NULL
);
r
->
decvref
(
emitter
);
r
->
decvref
(
emitter
);
...
@@ -1650,7 +1652,7 @@ private:
...
@@ -1650,7 +1652,7 @@ private:
llvm
::
Value
*
v
=
emitter
.
createCall
(
unw_info
,
g
.
funcs
.
str
,
converted
->
getValue
());
llvm
::
Value
*
v
=
emitter
.
createCall
(
unw_info
,
g
.
funcs
.
str
,
converted
->
getValue
());
v
=
emitter
.
getBuilder
()
->
CreateBitCast
(
v
,
g
.
llvm_value_type_ptr
);
v
=
emitter
.
getBuilder
()
->
CreateBitCast
(
v
,
g
.
llvm_value_type_ptr
);
auto
s
=
new
ConcreteCompilerVariable
(
STR
,
v
,
true
);
auto
s
=
new
ConcreteCompilerVariable
(
STR
,
v
,
true
);
r
=
dest
->
callattr
(
emitter
,
getOpInfoForNode
(
node
,
unw_info
),
&
write_str
,
f
alse
,
ArgPassSpec
(
1
),
{
s
},
r
=
dest
->
callattr
(
emitter
,
getOpInfoForNode
(
node
,
unw_info
),
&
write_str
,
f
lags
,
ArgPassSpec
(
1
),
{
s
},
NULL
);
NULL
);
s
->
decvref
(
emitter
);
s
->
decvref
(
emitter
);
r
->
decvref
(
emitter
);
r
->
decvref
(
emitter
);
...
@@ -1658,7 +1660,8 @@ private:
...
@@ -1658,7 +1660,8 @@ private:
}
}
if
(
node
->
nl
)
{
if
(
node
->
nl
)
{
auto
r
=
dest
->
callattr
(
emitter
,
getOpInfoForNode
(
node
,
unw_info
),
&
write_str
,
false
,
ArgPassSpec
(
1
),
CallattrFlags
flags
=
{.
cls_only
=
false
,
.
null_on_nonexistent
=
false
};
auto
r
=
dest
->
callattr
(
emitter
,
getOpInfoForNode
(
node
,
unw_info
),
&
write_str
,
flags
,
ArgPassSpec
(
1
),
{
makeStr
(
&
newline_str
)
},
NULL
);
{
makeStr
(
&
newline_str
)
},
NULL
);
r
->
decvref
(
emitter
);
r
->
decvref
(
emitter
);
...
...
src/core/types.h
View file @
5efde076
...
@@ -559,6 +559,11 @@ struct FrameInfo {
...
@@ -559,6 +559,11 @@ struct FrameInfo {
FrameInfo
(
ExcInfo
exc
)
:
exc
(
exc
)
{}
FrameInfo
(
ExcInfo
exc
)
:
exc
(
exc
)
{}
};
};
struct
CallattrFlags
{
bool
cls_only
:
1
;
bool
null_on_nonexistent
:
1
;
};
}
}
#endif
#endif
src/runtime/objmodel.h
View file @
5efde076
...
@@ -52,10 +52,6 @@ extern "C" void setattr(Box* obj, const char* attr, Box* attr_val);
...
@@ -52,10 +52,6 @@ extern "C" void setattr(Box* obj, const char* attr, Box* attr_val);
extern
"C"
void
delattr
(
Box
*
obj
,
const
char
*
attr
);
extern
"C"
void
delattr
(
Box
*
obj
,
const
char
*
attr
);
extern
"C"
bool
nonzero
(
Box
*
obj
);
extern
"C"
bool
nonzero
(
Box
*
obj
);
extern
"C"
Box
*
runtimeCall
(
Box
*
,
ArgPassSpec
,
Box
*
,
Box
*
,
Box
*
,
Box
**
,
const
std
::
vector
<
const
std
::
string
*>*
);
extern
"C"
Box
*
runtimeCall
(
Box
*
,
ArgPassSpec
,
Box
*
,
Box
*
,
Box
*
,
Box
**
,
const
std
::
vector
<
const
std
::
string
*>*
);
struct
CallattrFlags
{
bool
cls_only
:
1
;
bool
null_on_nonexistent
:
1
;
};
extern
"C"
Box
*
callattr
(
Box
*
,
const
std
::
string
*
,
CallattrFlags
,
ArgPassSpec
,
Box
*
,
Box
*
,
Box
*
,
Box
**
,
extern
"C"
Box
*
callattr
(
Box
*
,
const
std
::
string
*
,
CallattrFlags
,
ArgPassSpec
,
Box
*
,
Box
*
,
Box
*
,
Box
**
,
const
std
::
vector
<
const
std
::
string
*>*
);
const
std
::
vector
<
const
std
::
string
*>*
);
extern
"C"
BoxedString
*
str
(
Box
*
obj
);
extern
"C"
BoxedString
*
str
(
Box
*
obj
);
...
...
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