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

some codegen tests & fixes #15632

Merged
merged 5 commits into from
Mar 28, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 1 addition & 9 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1393,9 +1393,7 @@ const jl_value_t *jl_dump_function_asm(void *f, int raw_mc)
#endif
const object::ObjectFile *object = NULL;
assert(fptr != 0);
bool isJIT = true;
if (!jl_DI_for_fptr(fptr, &symsize, &slide, &section_slide, &object, &context)) {
isJIT = false;
if (!jl_dylib_DI_for_fptr(fptr, &object, &objcontext, &slide, &section_slide, false,
NULL, NULL, NULL, NULL)) {
jl_printf(JL_STDERR, "WARNING: Unable to find function pointer\n");
Expand All @@ -1410,9 +1408,6 @@ const jl_value_t *jl_dump_function_asm(void *f, int raw_mc)
}

if (raw_mc) {
#ifdef LLVM37
jl_cleanup_DI(context);
#endif
return (jl_value_t*)jl_pchar_to_array((char*)fptr, symsize);
}

Expand All @@ -1428,10 +1423,7 @@ const jl_value_t *jl_dump_function_asm(void *f, int raw_mc)
#endif
);

#ifdef LLVM37
if (isJIT)
jl_cleanup_DI(context);
#else
#ifndef LLVM37
fstream.flush();
#endif

Expand Down
4 changes: 0 additions & 4 deletions src/codegen_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ extern int jl_DI_for_fptr(uint64_t fptr, uint64_t *symsize, int64_t *slide, int6
extern bool jl_dylib_DI_for_fptr(size_t pointer, const object::ObjectFile **object, llvm::DIContext **context, int64_t *slide, int64_t *section_slide,
bool onlySysImg, bool *isSysImg, void **saddr, char **name, char **filename);

#ifdef USE_MCJIT
extern void jl_cleanup_DI(llvm::DIContext *context);
#endif

#ifdef USE_ORCJIT
extern JL_DLLEXPORT void ORCNotifyObjectEmitted(JITEventListener *Listener,
const object::ObjectFile &obj,
Expand Down
25 changes: 2 additions & 23 deletions src/debuginfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,8 @@ struct ObjectInfo {
const object::ObjectFile *object;
size_t SectionSize;
ptrdiff_t slide;
#ifdef LLVM39
#ifdef LLVM37
DIContext *context;
#elif defined(LLVM37)
const llvm::LoadedObjectInfo *L;
#endif
#if defined(_OS_DARWIN_) && !defined(LLVM37)
const char *name;
Expand Down Expand Up @@ -444,11 +442,7 @@ class JuliaJITEventListener: public JITEventListener
ObjectInfo tmp = {&debugObj,
(size_t)SectionSize,
(ptrdiff_t)(SectionAddr - SectionLoadAddr),
#ifdef LLVM39
new DWARFContextInMemory(debugObj, &L),
#else
L.clone().release(),
#endif
};
objectmap[SectionLoadAddr] = tmp;
first = false;
Expand Down Expand Up @@ -524,11 +518,6 @@ class JuliaJITEventListener: public JITEventListener
#endif
ObjectInfo tmp = {objfile, (size_t)Size,
(ptrdiff_t)(SectionAddr - SectionLoadAddr),
#ifdef LLVM39
new DWARFContextInMemory(*objfile, &L),
#elif defined(LLVM37)
L.clone().release(),
#endif
#ifdef _OS_DARWIN_
strndup(sName.data(), sName.size()),
#endif
Expand Down Expand Up @@ -1066,10 +1055,8 @@ int jl_DI_for_fptr(uint64_t fptr, uint64_t *symsize, int64_t *slide, int64_t *se
*section_slide = fit->second.slide;
*object = fit->second.object;
if (context) {
#if defined(LLVM39)
#if defined(LLVM37)
*context = fit->second.context;
#elif defined(LLVM37)
*context = new DWARFContextInMemory(*fit->second.object, fit->second.L);
#else
*context = DIContext::getDWARFContext(*fit->second.object);
#endif
Expand Down Expand Up @@ -1121,13 +1108,6 @@ JL_DLLEXPORT uint64_t jl_get_section_start(uint64_t fptr)

#endif

void jl_cleanup_DI(llvm::DIContext *context)
{
#ifndef LLVM39
delete context;
#endif
}

// Set *name and *filename to either NULL or malloc'd string
void jl_getFunctionInfo(char **name, char **filename, size_t *line,
char **inlinedat_file, size_t *inlinedat_line, jl_lambda_info_t **outer_linfo,
Expand All @@ -1151,7 +1131,6 @@ void jl_getFunctionInfo(char **name, char **filename, size_t *line,
if (jl_DI_for_fptr(pointer, &symsize, &slide, NULL, &object, &context)) {
*outer_linfo = jl_jit_events->lookupLinfo(pointer);
lookup_pointer(context, name, line, filename, inlinedat_line, inlinedat_file, pointer+slide, 1, fromC);
jl_cleanup_DI(context);
return;
}
#else // !USE_MCJIT
Expand Down
Loading