Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove equals from method table #5

Merged
merged 1 commit into from
Jul 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions numba/_listobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
#ifndef NUMBA_LIST_H
#define NUMBA_LIST_H

typedef int (*list_item_comparator_t)(const char *lhs, const char *rhs);
typedef void (*list_refcount_op_t)(const void*);

typedef struct {
list_item_comparator_t item_equal;
list_refcount_op_t item_incref;
list_refcount_op_t item_decref;
} list_type_based_methods_table;
Expand Down
13 changes: 3 additions & 10 deletions numba/listobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ def _list_set_method_table(typingctx, lp, itemty):

def codegen(context, builder, sig, args):
vtablety = ir.LiteralStructType([
ll_voidptr_type, # equal
ll_voidptr_type, # item incref
ll_voidptr_type, # item decref
])
Expand All @@ -174,21 +173,15 @@ def codegen(context, builder, sig, args):
dp = args[0]
vtable = cgutils.alloca_once(builder, vtablety, zfill=True)

# install key incref/decref
item_equal_ptr = cgutils.gep_inbounds(builder, vtable, 0, 0)
item_incref_ptr = cgutils.gep_inbounds(builder, vtable, 0, 1)
item_decref_ptr = cgutils.gep_inbounds(builder, vtable, 0, 2)
# install item incref/decref
item_incref_ptr = cgutils.gep_inbounds(builder, vtable, 0, 0)
item_decref_ptr = cgutils.gep_inbounds(builder, vtable, 0, 1)

dm_item = context.data_model_manager[itemty.instance_type]
if dm_item.contains_nrt_meminfo():
equal = _get_equal(context, builder.module, dm_item, 'list')
item_incref, item_decref = _get_incref_decref(
context, builder.module, dm_item, "list"
)
builder.store(
builder.bitcast(equal, item_equal_ptr.type.pointee),
item_equal_ptr,
)
builder.store(
builder.bitcast(item_incref, item_incref_ptr.type.pointee),
item_incref_ptr,
Expand Down