Skip to content

Commit 2920b6f

Browse files
committed
Remove patchpoint called func can@t be symbolic workaround
1 parent fd579c1 commit 2920b6f

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

src/asm_writing/rewriter.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,6 +2064,27 @@ bool spillFrameArgumentIfNecessary(StackMap::Record::Location& l, uint8_t*& inst
20642064
}
20652065
}
20662066

2067+
void* getSlowpathFunc(uint8_t* pp_addr) {
2068+
#ifndef NDEBUG
2069+
// mov $imm, %r11:
2070+
ASSERT(pp_addr[0] == 0x49, "%x", pp_addr[0]);
2071+
assert(pp_addr[1] == 0xbb);
2072+
// 8 bytes of the addr
2073+
2074+
// callq *%r11:
2075+
assert(pp_addr[10] == 0x41);
2076+
assert(pp_addr[11] == 0xff);
2077+
assert(pp_addr[12] == 0xd3);
2078+
2079+
int i = INITIAL_CALL_SIZE;
2080+
while (*(pp_addr + i) == 0x66 || *(pp_addr + i) == 0x0f || *(pp_addr + i) == 0x2e)
2081+
i++;
2082+
assert(*(pp_addr + i) == 0x90 || *(pp_addr + i) == 0x1f);
2083+
#endif
2084+
2085+
return *(void**)&pp_addr[2];
2086+
}
2087+
20672088
void setSlowpathFunc(uint8_t* pp_addr, void* func) {
20682089
#ifndef NDEBUG
20692090
// mov $imm, %r11:

src/asm_writing/rewriter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ class Rewriter : public ICSlotRewrite::CommitHook, public gc::GCVisitable {
608608
friend class RewriterVar;
609609
};
610610

611+
void* getSlowpathFunc(uint8_t* pp_addr);
611612
void setSlowpathFunc(uint8_t* pp_addr, void* func);
612613

613614
struct GRCompare {

src/codegen/irgen/irgenerator.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,16 @@ class IREmitterImpl : public IREmitter {
332332
std::vector<llvm::Value*> pp_args;
333333
pp_args.push_back(getConstantInt(pp_id, g.i64));
334334
pp_args.push_back(getConstantInt(pp_size, g.i32));
335+
336+
#if LLVMREV < 235483
335337
if (ENABLE_JIT_OBJECT_CACHE)
336338
// add fixed dummy dest pointer, we will replace it with the correct address during stackmap processing
337339
pp_args.push_back(embedConstantPtr((void*)-1L, g.i8_ptr));
338340
else
339341
pp_args.push_back(func);
342+
#else
343+
pp_args.push_back(func);
344+
#endif
340345
pp_args.push_back(getConstantInt(args.size(), g.i32));
341346

342347
pp_args.insert(pp_args.end(), args.begin(), args.end());

src/codegen/irgen/util.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ class PrettifyingMaterializer : public llvm::ValueMaterializer {
229229
ii->setArgOperand(i, llvm::MapValue(op, VMap, flags, type_remapper, this));
230230
continue;
231231
} else {
232+
#if LLVMREV < 235483
232233
assert(pp_id != -1);
233234
void* addr = PatchpointInfo::getSlowpathAddr(pp_id);
234235

@@ -249,6 +250,9 @@ class PrettifyingMaterializer : public llvm::ValueMaterializer {
249250
} else {
250251
ii->setArgOperand(i, module->getOrInsertGlobal(name, g.i8));
251252
}
253+
#else
254+
assert(0);
255+
#endif
252256
}
253257
}
254258
return ii;

src/codegen/patchpoints.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ void processStackmap(CompiledFunction* cf, StackMap* stackmap) {
162162
PatchpointInfo* pp = new_patchpoints[r->id].first;
163163
assert(pp);
164164

165-
void* slowpath_func = PatchpointInfo::getSlowpathAddr(r->id);
166165
if (VERBOSITY() >= 2) {
167166
printf("Processing pp %ld; [%d, %d)\n", reinterpret_cast<int64_t>(pp), r->offset,
168167
r->offset + pp->patchpointSize());
@@ -178,8 +177,13 @@ void processStackmap(CompiledFunction* cf, StackMap* stackmap) {
178177
uint8_t* start_addr = (uint8_t*)pp->parentFunction()->code + r->offset;
179178
uint8_t* end_addr = start_addr + pp->patchpointSize();
180179

180+
#if LLVMREV < 235483
181+
void* slowpath_func = PatchpointInfo::getSlowpathAddr(r->id);
181182
if (ENABLE_JIT_OBJECT_CACHE)
182183
setSlowpathFunc(start_addr, slowpath_func);
184+
#else
185+
void* slowpath_func = getSlowpathFunc(start_addr);
186+
#endif
183187

184188
//*start_addr = 0xcc;
185189
// start_addr++;

0 commit comments

Comments
 (0)