Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
5eaf905d
Commit
5eaf905d
authored
Jun 19, 2019
by
gsamain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use builtin acthon types directly, do not rely on lookup anymore
parent
166685f9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
14 deletions
+19
-14
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+6
-5
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+4
-3
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+9
-6
No files found.
Cython/Compiler/Builtin.py
View file @
5eaf905d
...
...
@@ -380,6 +380,7 @@ builtin_structs_table = [
# inject acthon interfaces
def
inject_acthon_interfaces
(
self
):
global
acthon_result_type
,
acthon_message_type
,
acthon_sync_type
,
acthon_queue_type
,
acthon_activable_type
def
init_scope
(
scope
):
scope
.
is_cpp_class_scope
=
1
scope
.
inherited_var_entries
=
[]
...
...
@@ -394,7 +395,7 @@ def inject_acthon_interfaces(self):
result_scope
=
Scope
(
"ActhonResultInterface"
,
self
,
None
)
init_scope
(
result_scope
)
result_type
=
PyrexTypes
.
CypClassType
(
acthon_result_type
=
result_type
=
PyrexTypes
.
CypClassType
(
"ActhonResultInterface"
,
result_scope
,
"ActhonResultInterface"
,
(
PyrexTypes
.
cy_object_type
,),
lock_mode
=
"nolock"
,
activable
=
False
)
result_scope
.
type
=
result_type
...
...
@@ -443,7 +444,7 @@ def inject_acthon_interfaces(self):
message_scope
=
Scope
(
"ActhonMessageInterface"
,
self
,
None
)
init_scope
(
message_scope
)
message_type
=
PyrexTypes
.
CypClassType
(
acthon_message_type
=
message_type
=
PyrexTypes
.
CypClassType
(
"ActhonMessageInterface"
,
message_scope
,
"ActhonMessageInterface"
,
(
PyrexTypes
.
cy_object_type
,),
lock_mode
=
"nolock"
,
activable
=
False
)
message_scope
.
type
=
message_type
...
...
@@ -456,7 +457,7 @@ def inject_acthon_interfaces(self):
sync_scope
=
Scope
(
"ActhonSyncInterface"
,
self
,
None
)
init_scope
(
sync_scope
)
sync_type
=
PyrexTypes
.
CypClassType
(
acthon_sync_type
=
sync_type
=
PyrexTypes
.
CypClassType
(
"ActhonSyncInterface"
,
sync_scope
,
"ActhonSyncInterface"
,
(
PyrexTypes
.
cy_object_type
,),
lock_mode
=
"nolock"
,
activable
=
False
)
sync_scope
.
type
=
sync_type
...
...
@@ -522,7 +523,7 @@ def inject_acthon_interfaces(self):
queue_scope
=
Scope
(
"ActhonQueueInterface"
,
self
,
None
)
init_scope
(
queue_scope
)
queue_type
=
PyrexTypes
.
CypClassType
(
acthon_queue_type
=
queue_type
=
PyrexTypes
.
CypClassType
(
"ActhonQueueInterface"
,
queue_scope
,
"ActhonQueueInterface"
,
(
PyrexTypes
.
cy_object_type
,),
lock_mode
=
"nolock"
,
activable
=
False
)
queue_scope
.
type
=
queue_type
...
...
@@ -550,7 +551,7 @@ def inject_acthon_interfaces(self):
activable_scope
=
Scope
(
"ActhonActivableClass"
,
self
,
None
)
init_scope
(
activable_scope
)
activable_type
=
PyrexTypes
.
CypClassType
(
act
hon_activable_type
=
act
ivable_type
=
PyrexTypes
.
CypClassType
(
"ActhonActivableClass"
,
activable_scope
,
"ActhonActivableClass"
,
(
PyrexTypes
.
cy_object_type
,),
lock_mode
=
"nolock"
,
activable
=
False
)
activable_entry
=
self
.
declare
(
"ActhonActivableClass"
,
None
,
activable_type
,
"ActhonActivableClass"
,
"extern"
)
...
...
Cython/Compiler/ModuleNode.py
View file @
5eaf905d
...
...
@@ -1132,7 +1132,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
"}"
)
def
generate_cyp_class_activated_class
(
self
,
entry
,
code
):
result_interface_entry
=
entry
.
scope
.
lookup
(
"ActhonResultInterface"
)
from
.
import
Builtin
result_interface_type
=
Builtin
.
acthon_result_type
activable_bases_cnames
=
[
base
.
cname
for
base
in
entry
.
type
.
base_classes
if
base
.
activable
]
activable_bases_inheritance_list
=
[
"public %s::Activated"
%
cname
for
cname
in
activable_bases_cnames
]
if
activable_bases_cnames
:
...
...
@@ -1170,9 +1171,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
activated_method_arg_decl_code
=
", "
.
join
([
"ActhonSyncInterface* sync_object"
]
+
reified_arg_decl_list
)
function_header
=
reified_function_entry
.
type
.
function_header_code
(
reified_function_entry
.
cname
,
activated_method_arg_decl_code
)
function_code
=
result_interface_
entry
.
type
.
declaration_code
(
function_header
)
function_code
=
result_interface_type
.
declaration_code
(
function_header
)
code
.
putln
(
"%s {"
%
function_code
)
code
.
putln
(
"%s = this->_active_result_class();"
%
result_interface_
entry
.
type
.
declaration_code
(
"result_object"
))
code
.
putln
(
"%s = this->_active_result_class();"
%
result_interface_type
.
declaration_code
(
"result_object"
))
message_constructor_args_list
=
[
"this->_passive_self"
,
"sync_object"
,
"result_object"
]
+
reified_arg_cname_list
message_constructor_args_code
=
", "
.
join
(
message_constructor_args_list
)
...
...
Cython/Compiler/Symtab.py
View file @
5eaf905d
...
...
@@ -721,9 +721,11 @@ class Scope(object):
# Declaring active_self member and activate function (its definition is generated automatically)
act_attr_name
=
Naming
.
builtin_prefix
+
"_active_self"
scope
.
declare_var
(
"<active_self>"
,
act_type
,
pos
,
cname
=
act_attr_name
)
queue_type
=
self
.
lookup
(
"ActhonQueueInterface"
).
type
from
.
import
Builtin
queue_type
=
Builtin
.
acthon_queue_type
result_type
=
Builtin
.
acthon_result_type
queue_arg
=
PyrexTypes
.
CFuncTypeArg
(
"queue"
,
queue_type
,
pos
)
result_type
=
PyrexTypes
.
CPtrType
(
PyrexTypes
.
CFuncType
(
self
.
lookup
(
"ActhonResultInterface"
).
type
,
[],
nogil
=
1
))
result_type
=
PyrexTypes
.
CPtrType
(
PyrexTypes
.
CFuncType
(
result_
type
,
[],
nogil
=
1
))
result_arg
=
PyrexTypes
.
CFuncTypeArg
(
"result"
,
result_type
,
pos
)
activate_type
=
PyrexTypes
.
CFuncType
(
act_type
,
[
queue_arg
,
result_arg
],
nogil
=
1
,
optional_arg_count
=
2
)
...
...
@@ -2613,14 +2615,15 @@ class CppClassScope(Scope):
reifying_entry
.
reified_entry
=
entry
self
.
reifying_entries
.
append
(
reifying_entry
)
# Add the base method to the Activated member class
from
.
import
Builtin
activated_class_entry
=
self
.
lookup_here
(
"Activated"
)
result_
interface_entry
=
self
.
lookup
(
"ActhonResultInterface"
)
sync_
interface_entry
=
self
.
lookup
(
"ActhonSyncInterface"
)
result_
type
=
Builtin
.
acthon_result_type
sync_
type
=
Builtin
.
acthon_sync_type
activated_method_sync_attr_type
=
PyrexTypes
.
CFuncTypeArg
(
"sync_method"
,
sync_
interface_entry
.
type
,
entry
.
pos
,
"sync_method"
)
"sync_method"
,
sync_type
,
entry
.
pos
,
"sync_method"
)
activated_method_type
=
PyrexTypes
.
CFuncType
(
result_
interface_entry
.
type
,
activated_method_type
=
PyrexTypes
.
CFuncType
(
result_type
,
[
activated_method_sync_attr_type
]
+
entry
.
type
.
args
,
nogil
=
entry
.
type
.
nogil
,
has_varargs
=
entry
.
type
.
has_varargs
,
optional_arg_count
=
entry
.
type
.
optional_arg_count
)
...
...
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