Skip to content
Permalink
Browse files

8242003: Remove CallInfo::_selected_klass

Reviewed-by: lfoltan, dcubed, coleenp
  • Loading branch information
cl4es committed Apr 1, 2020
1 parent 25b2118 commit e08f25a942830e4b21dbcfd52a4f5aa46a0246e9
Showing with 12 additions and 20 deletions.
  1. +8 −13 src/hotspot/share/interpreter/linkResolver.cpp
  2. +4 −7 src/hotspot/share/interpreter/linkResolver.hpp
@@ -64,12 +64,11 @@

void CallInfo::set_static(Klass* resolved_klass, const methodHandle& resolved_method, TRAPS) {
int vtable_index = Method::nonvirtual_vtable_index;
set_common(resolved_klass, resolved_klass, resolved_method, resolved_method, CallInfo::direct_call, vtable_index, CHECK);
set_common(resolved_klass, resolved_method, resolved_method, CallInfo::direct_call, vtable_index, CHECK);
}


void CallInfo::set_interface(Klass* resolved_klass,
Klass* selected_klass,
const methodHandle& resolved_method,
const methodHandle& selected_method,
int itable_index, TRAPS) {
@@ -79,18 +78,17 @@ void CallInfo::set_interface(Klass* resolved_klass,
// In that case, the caller must call set_virtual instead of set_interface.
assert(resolved_method->method_holder()->is_interface(), "");
assert(itable_index == resolved_method()->itable_index(), "");
set_common(resolved_klass, selected_klass, resolved_method, selected_method, CallInfo::itable_call, itable_index, CHECK);
set_common(resolved_klass, resolved_method, selected_method, CallInfo::itable_call, itable_index, CHECK);
}

void CallInfo::set_virtual(Klass* resolved_klass,
Klass* selected_klass,
const methodHandle& resolved_method,
const methodHandle& selected_method,
int vtable_index, TRAPS) {
assert(vtable_index >= 0 || vtable_index == Method::nonvirtual_vtable_index, "valid index");
assert(vtable_index < 0 || !resolved_method->has_vtable_index() || vtable_index == resolved_method->vtable_index(), "");
CallKind kind = (vtable_index >= 0 && !resolved_method->can_be_statically_bound() ? CallInfo::vtable_call : CallInfo::direct_call);
set_common(resolved_klass, selected_klass, resolved_method, selected_method, kind, vtable_index, CHECK);
set_common(resolved_klass, resolved_method, selected_method, kind, vtable_index, CHECK);
assert(!resolved_method->is_compiled_lambda_form(), "these must be handled via an invokehandle call");
}

@@ -108,20 +106,18 @@ void CallInfo::set_handle(Klass* resolved_klass,
"linkMethod must return one of these");
int vtable_index = Method::nonvirtual_vtable_index;
assert(!resolved_method->has_vtable_index(), "");
set_common(resolved_klass, resolved_klass, resolved_method, resolved_method, CallInfo::direct_call, vtable_index, CHECK);
set_common(resolved_klass, resolved_method, resolved_method, CallInfo::direct_call, vtable_index, CHECK);
_resolved_appendix = resolved_appendix;
}

void CallInfo::set_common(Klass* resolved_klass,
Klass* selected_klass,
const methodHandle& resolved_method,
const methodHandle& selected_method,
CallKind kind,
int index,
TRAPS) {
assert(resolved_method->signature() == selected_method->signature(), "signatures must correspond");
_resolved_klass = resolved_klass;
_selected_klass = selected_klass;
_resolved_method = resolved_method;
_selected_method = selected_method;
_call_kind = kind;
@@ -139,7 +135,6 @@ CallInfo::CallInfo(Method* resolved_method, Klass* resolved_klass, TRAPS) {
resolved_klass = resolved_method_holder;
}
_resolved_klass = resolved_klass;
_selected_klass = resolved_klass;
_resolved_method = methodHandle(THREAD, resolved_method);
_selected_method = methodHandle(THREAD, resolved_method);
// classify:
@@ -1397,7 +1392,7 @@ void LinkResolver::runtime_resolve_virtual_method(CallInfo& result,
false, vtable_index);
}
// setup result
result.set_virtual(resolved_klass, recv_klass, resolved_method, selected_method, vtable_index, CHECK);
result.set_virtual(resolved_klass, resolved_method, selected_method, vtable_index, CHECK);
}

void LinkResolver::resolve_interface_call(CallInfo& result, Handle recv, Klass* recv_klass,
@@ -1493,11 +1488,11 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result,
int vtable_index = resolved_method->vtable_index();
log_develop_trace(itables)(" -- vtable index: %d", vtable_index);
assert(vtable_index == selected_method->vtable_index(), "sanity check");
result.set_virtual(resolved_klass, recv_klass, resolved_method, selected_method, vtable_index, CHECK);
result.set_virtual(resolved_klass, resolved_method, selected_method, vtable_index, CHECK);
} else if (resolved_method->has_itable_index()) {
int itable_index = resolved_method()->itable_index();
log_develop_trace(itables)(" -- itable index: %d", itable_index);
result.set_interface(resolved_klass, recv_klass, resolved_method, selected_method, itable_index, CHECK);
result.set_interface(resolved_klass, resolved_method, selected_method, itable_index, CHECK);
} else {
int index = resolved_method->vtable_index();
log_develop_trace(itables)(" -- non itable/vtable index: %d", index);
@@ -1507,7 +1502,7 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result,
"Should only have non-virtual invokeinterface for private or final-Object methods!");
assert(resolved_method()->can_be_statically_bound(), "Should only have non-virtual invokeinterface for statically bound methods!");
// This sets up the nonvirtual form of "virtual" call (as needed for final and private methods)
result.set_virtual(resolved_klass, resolved_klass, resolved_method, resolved_method, index, CHECK);
result.set_virtual(resolved_klass, resolved_method, resolved_method, index, CHECK);
}
}

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -49,7 +49,6 @@ class CallInfo : public StackObj {
};
private:
Klass* _resolved_klass; // static receiver klass, resolved from a symbolic reference
Klass* _selected_klass; // dynamic receiver class (same as static, or subklass)
methodHandle _resolved_method; // static target method
methodHandle _selected_method; // dynamic (actual) target method
CallKind _call_kind; // kind of call (static(=bytecode static/special +
@@ -59,11 +58,11 @@ class CallInfo : public StackObj {
Handle _resolved_method_name; // Object holding the ResolvedMethodName

void set_static(Klass* resolved_klass, const methodHandle& resolved_method, TRAPS);
void set_interface(Klass* resolved_klass, Klass* selected_klass,
void set_interface(Klass* resolved_klass,
const methodHandle& resolved_method,
const methodHandle& selected_method,
int itable_index, TRAPS);
void set_virtual(Klass* resolved_klass, Klass* selected_klass,
void set_virtual(Klass* resolved_klass,
const methodHandle& resolved_method,
const methodHandle& selected_method,
int vtable_index, TRAPS);
@@ -72,7 +71,7 @@ class CallInfo : public StackObj {
void set_handle(Klass* resolved_klass,
const methodHandle& resolved_method,
Handle resolved_appendix, TRAPS);
void set_common(Klass* resolved_klass, Klass* selected_klass,
void set_common(Klass* resolved_klass,
const methodHandle& resolved_method,
const methodHandle& selected_method,
CallKind kind,
@@ -95,7 +94,6 @@ class CallInfo : public StackObj {
CallInfo(Method* resolved_method, Klass* resolved_klass, TRAPS);

Klass* resolved_klass() const { return _resolved_klass; }
Klass* selected_klass() const { return _selected_klass; }
Method* resolved_method() const { return _resolved_method(); }
Method* selected_method() const { return _selected_method(); }
Handle resolved_appendix() const { return _resolved_appendix; }
@@ -105,7 +103,6 @@ class CallInfo : public StackObj {

BasicType result_type() const { return selected_method()->result_type(); }
CallKind call_kind() const { return _call_kind; }
int call_index() const { return _call_index; }
int vtable_index() const {
// Even for interface calls the vtable index could be non-negative.
// See CallInfo::set_interface.

0 comments on commit e08f25a

Please sign in to comment.