Skip to content

Commit

Permalink
Add asm interpreter implementation of LOAD_ATTR_INSTANCE_TYPE
Browse files Browse the repository at this point in the history
This brings it down from 19727 to 4101 transitions from asm to C++.
  • Loading branch information
tekknolagi committed Apr 17, 2023
1 parent d106b9c commit 1c08d58
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions runtime/interpreter-gen-x64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,29 @@ void emitHandler<LOAD_ATTR_INSTANCE_SLOT_DESCR>(EmitEnv* env) {
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

0 comments on commit 1c08d58

Please sign in to comment.