Commit 78a0f1fd authored by Robert Bradshaw's avatar Robert Bradshaw

Eliminate vtab lookup for unbound methods.

parent 1c3855fb
...@@ -5314,9 +5314,16 @@ class AttributeNode(ExprNode): ...@@ -5314,9 +5314,16 @@ class AttributeNode(ExprNode):
else: else:
# Create a temporary entry describing the C method # Create a temporary entry describing the C method
# as an ordinary function. # as an ordinary function.
ubcm_entry = Symtab.Entry(entry.name, if entry.func_cname:
"%s->%s" % (type.vtabptr_cname, entry.cname), cname = entry.func_cname
entry.type) # Fix self type.
ctype = copy.copy(entry.type)
ctype.args = ctype.args[:]
ctype.args[0] = PyrexTypes.CFuncTypeArg('self', type, 'self', None)
else:
cname = "%s->%s" % (type.vtabptr_cname, entry.cname)
ctype = entry.type
ubcm_entry = Symtab.Entry(entry.name, cname, ctype)
ubcm_entry.is_cfunction = 1 ubcm_entry.is_cfunction = 1
ubcm_entry.func_cname = entry.func_cname ubcm_entry.func_cname = entry.func_cname
ubcm_entry.is_unbound_cmethod = 1 ubcm_entry.is_unbound_cmethod = 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment