Skip to content
Open
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
60 changes: 60 additions & 0 deletions runtime/interpreter-gen-x64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,15 @@ const word kHandlerSizeShift = 8;
const word kHandlerSize = 1 << kHandlerSizeShift;

const Interpreter::OpcodeHandler kCppHandlers[] = {
#if DCHECK_IS_ON()
#define OP(name, id, handler) \
[](Thread* thread, word arg) { \
EVENT(InterpreterDeopt_##name); \
return Interpreter::handler(thread, arg); \
},
#else
#define OP(name, id, handler) Interpreter::handler,
#endif
FOREACH_BYTECODE(OP)
#undef OP
};
Expand Down Expand Up @@ -1219,6 +1227,58 @@ void emitHandler<LOAD_ATTR_INSTANCE>(EmitEnv* env) {
emitJumpToGenericHandler(env);
}

template <>
void emitHandler<LOAD_ATTR_INSTANCE_SLOT_DESCR>(EmitEnv* env) {
ScratchReg r_base(env);
ScratchReg r_layout_id(env);
ScratchReg r_offset(env);
ScratchReg r_caches(env);
ScratchReg r_result(env);
Label slow_path;
__ popq(r_base);
emitGetLayoutId(env, r_layout_id, r_base);
__ movq(r_caches, Address(env->frame, Frame::kCachesOffset));
emitIcLookupMonomorphic(env, &slow_path, r_offset, r_layout_id, r_caches);

emitConvertFromSmallInt(env, r_offset);
__ movq(r_result, Address(r_base, r_offset, TIMES_1, heapObjectDisp(0)));
__ cmpl(r_result, Immediate(Unbound::object().raw()));
__ jcc(EQUAL, &slow_path, Assembler::kNearJump);
__ pushq(r_result);
emitNextOpcode(env);

__ bind(&slow_path);
__ pushq(r_base);
if (env->in_jit) {
emitJumpToDeopt(env);
return;
}
emitJumpToGenericHandler(env);
}

template <>
void emitHandler<LOAD_ATTR_INSTANCE_TYPE>(EmitEnv* env) {
ScratchReg r_base(env);
ScratchReg r_layout_id(env);
ScratchReg r_cached(env);
ScratchReg r_caches(env);
Label slow_path;
__ popq(r_base);
emitGetLayoutId(env, r_layout_id, r_base);
__ movq(r_caches, Address(env->frame, Frame::kCachesOffset));
emitIcLookupMonomorphic(env, &slow_path, r_cached, r_layout_id, r_caches);
__ pushq(r_cached);
emitNextOpcode(env);

__ bind(&slow_path);
__ pushq(r_base);
if (env->in_jit) {
emitJumpToDeopt(env);
return;
}
emitJumpToGenericHandler(env);
}

template <>
void emitHandler<LOAD_ATTR_INSTANCE_TYPE_BOUND_METHOD>(EmitEnv* env) {
ScratchReg r_base(env);
Expand Down
4 changes: 4 additions & 0 deletions util/probes/asm2cpp.bt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
usdt:./build/bin/python:python:InterpreterDeopt_* {
@interpreter_deopt[probe]++;
}