Skip to content

Commit

Permalink
Revert "Merge pull request numba#967 from apmasell/orcjit_lib_name"
Browse files Browse the repository at this point in the history
This reverts commit bbb88a7, reversing
changes made to ff1d118.
  • Loading branch information
gmarkall committed Oct 12, 2023
1 parent cbdc770 commit 711bfac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
22 changes: 8 additions & 14 deletions llvmlite/binding/orcjit.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def link(self, lljit, library_name):
however, the name of the library cannot be reused.
"""
assert not lljit.closed, "Cannot add to closed JIT"
encoded_library_name = str(library_name).encode('utf-8')
assert len(encoded_library_name) > 0, "Library cannot be empty"
library_name = str(library_name).encode('utf-8')
assert len(library_name) > 0, "Library cannot be empty"
elements = (_LinkElement * len(self.__entries))()
for idx, (kind, value) in enumerate(self.__entries):
elements[idx].element_kind = c_uint8(kind)
Expand All @@ -163,7 +163,7 @@ def link(self, lljit, library_name):
with ffi.OutputString() as outerr:
tracker = lljit._capi.LLVMPY_LLJIT_Link(
lljit._ptr,
encoded_library_name,
library_name,
elements,
len(self.__entries),
imports,
Expand All @@ -173,10 +173,9 @@ def link(self, lljit, library_name):
outerr)
if not tracker:
raise RuntimeError(str(outerr))
return ResourceTracker(tracker,
library_name,
{name: exports[idx].address
for idx, name in enumerate(self.__exports)})
return ResourceTracker(tracker, {name: exports[idx].address
for idx, name in
enumerate(self.__exports)})


class ResourceTracker(ffi.ObjectRef):
Expand All @@ -196,9 +195,8 @@ class ResourceTracker(ffi.ObjectRef):
LLVM internally tracks references between different libraries, so only
"leaf" libraries need to be tracked.
"""
def __init__(self, ptr, name, addresses):
def __init__(self, ptr, addresses):
self.__addresses = addresses
self.__name = name
ffi.ObjectRef.__init__(self, ptr)

def __getitem__(self, item):
Expand All @@ -207,10 +205,6 @@ def __getitem__(self, item):
"""
return self.__addresses[item]

@property
def name(self):
return self.__name

def _dispose(self):
with ffi.OutputString() as outerr:
if self._capi.LLVMPY_LLJIT_Dylib_Tracker_Dispose(self, outerr):
Expand Down Expand Up @@ -258,7 +252,7 @@ def lookup(self, dylib, fn):
if not tracker:
raise RuntimeError(str(outerr))

return ResourceTracker(tracker, dylib, {fn: address.value})
return ResourceTracker(tracker, {fn: address.value})

@property
def target_data(self):
Expand Down
1 change: 0 additions & 1 deletion llvmlite/tests/test_binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,6 @@ def jit(self, asm=asm_sum, func_name="sum", target_machine=None,
.link(lljit, func_name)
cfptr = rt[func_name]
self.assertTrue(cfptr)
self.assertEqual(func_name, rt.name)
return lljit, rt, func_type(cfptr)

# From test_dylib_symbols
Expand Down

0 comments on commit 711bfac

Please sign in to comment.