Commit acdf1fdc authored by Kevin Modzelewski's avatar Kevin Modzelewski

LLVM thought our objects were constants

(At least, the ones that we referenced statically.)

Amazing that it didn't end up showing up until now.
parent d4aaa88a
...@@ -126,7 +126,7 @@ llvm::Constant* embedRelocatablePtr(const void* addr, llvm::Type* type, llvm::St ...@@ -126,7 +126,7 @@ llvm::Constant* embedRelocatablePtr(const void* addr, llvm::Type* type, llvm::St
std::string name; std::string name;
if (!shared_name.empty()) { if (!shared_name.empty()) {
llvm::GlobalVariable* gv = g.cur_module->getGlobalVariable(shared_name, true); llvm::GlobalVariable* gv = g.cur_module->getGlobalVariable(shared_name, /* AllowInternal */ true);
if (gv) if (gv)
return gv; return gv;
assert(!relocatable_syms.count(name)); assert(!relocatable_syms.count(name));
...@@ -139,7 +139,8 @@ llvm::Constant* embedRelocatablePtr(const void* addr, llvm::Type* type, llvm::St ...@@ -139,7 +139,8 @@ llvm::Constant* embedRelocatablePtr(const void* addr, llvm::Type* type, llvm::St
relocatable_syms[name] = addr; relocatable_syms[name] = addr;
llvm::Type* var_type = type->getPointerElementType(); llvm::Type* var_type = type->getPointerElementType();
return new llvm::GlobalVariable(*g.cur_module, var_type, true, llvm::GlobalVariable::ExternalLinkage, 0, name); return new llvm::GlobalVariable(*g.cur_module, var_type, /* isConstant */ false,
llvm::GlobalVariable::ExternalLinkage, 0, name);
} }
llvm::Constant* embedConstantPtr(const void* addr, llvm::Type* type) { llvm::Constant* embedConstantPtr(const void* addr, llvm::Type* type) {
......
...@@ -6,11 +6,11 @@ import subprocess ...@@ -6,11 +6,11 @@ import subprocess
import sys import sys
def get_objdump(func): def get_objdump(func):
for l in open("perf_map/index.txt"): for l in open(args.perf_map_dir + "/index.txt"):
addr, this_func = l.split() addr, this_func = l.split()
if this_func == func: if this_func == func:
# print ' '.join(["objdump", "-b", "binary", "-m", "i386", "-D", "perf_map/" + func, "--adjust-vma=0x%s" % addr]) # print ' '.join(["objdump", "-b", "binary", "-m", "i386", "-D", "perf_map/" + func, "--adjust-vma=0x%s" % addr])
p = subprocess.Popen(["objdump", "-b", "binary", "-m", "i386:x86-64", "-D", "perf_map/" + func, "--adjust-vma=0x%s" % addr], stdout=subprocess.PIPE) p = subprocess.Popen(["objdump", "-b", "binary", "-m", "i386:x86-64", "-D", args.perf_map_dir + "/" + func, "--adjust-vma=0x%s" % addr], stdout=subprocess.PIPE)
r = p.communicate()[0] r = p.communicate()[0]
assert p.wait() == 0 assert p.wait() == 0
return r return r
...@@ -108,6 +108,7 @@ Benchmark that was run. '--heap-map-target BENCHMARK' is ...@@ -108,6 +108,7 @@ Benchmark that was run. '--heap-map-target BENCHMARK' is
equivalent to '--heap-map-args ./pyston_release -i BENCHMARK'. equivalent to '--heap-map-args ./pyston_release -i BENCHMARK'.
""".strip()) """.strip())
parser.add_argument("--perf-data", default="perf.data") parser.add_argument("--perf-data", default="perf.data")
parser.add_argument("--perf-map-dir", default="perf_map")
args = parser.parse_args() args = parser.parse_args()
func = args.func_name func = args.func_name
......
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