Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8263679: C1: Remove vtable call
Reviewed-by: vlivanov, kvn
  • Loading branch information
zhengyu123 committed Mar 16, 2021
1 parent 11c8c78 commit a67a679c78eddfe8ef69ccb55a10d14832440b02
@@ -2075,13 +2075,6 @@ void LIR_Assembler::ic_call(LIR_OpJavaCall* op) {
add_call_info(code_offset(), op->info());
}


/* vtable-dispatch is not enabled for aarch64 platform*/
void LIR_Assembler::vtable_call(LIR_OpJavaCall* op) {
ShouldNotReachHere();
}


void LIR_Assembler::emit_static_call_stub() {
address call_pc = __ pc();
address stub = __ start_a_stub(call_stub_size());
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, 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
@@ -1941,12 +1941,6 @@ void LIR_Assembler::ic_call(LIR_OpJavaCall *op) {
add_call_info(code_offset(), op->info());
}


/* vtable-dispatch is not enabled for arm platforms */
void LIR_Assembler::vtable_call(LIR_OpJavaCall* op) {
ShouldNotReachHere();
}

void LIR_Assembler::emit_static_call_stub() {
address call_pc = __ pc();
address stub = __ start_a_stub(call_stub_size());
@@ -706,13 +706,6 @@ void LIR_Assembler::ic_call(LIR_OpJavaCall* op) {
add_call_info(code_offset(), op->info());
}


/* vtable_call is not enabled for ppc platform */
void LIR_Assembler::vtable_call(LIR_OpJavaCall* op) {
ShouldNotReachHere(); // ic_call is used instead.
}


void LIR_Assembler::explicit_null_check(Register addr, CodeEmitInfo* info) {
ImplicitNullCheckStub* stub = new ImplicitNullCheckStub(code_offset(), info);
__ null_check(addr, stub->entry());
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -496,7 +496,6 @@ void LIR_Assembler::align_call(LIR_Code code) {
case lir_dynamic_call:
offset += NativeCall::call_far_pcrelative_displacement_offset;
break;
case lir_virtual_call: // currently, sparc-specific for niagara
default: ShouldNotReachHere();
}
if ((offset & (NativeCall::call_far_pcrelative_displacement_alignment-1)) != 0) {
@@ -533,11 +532,6 @@ void LIR_Assembler::ic_call(LIR_OpJavaCall* op) {
call(op, relocInfo::none);
}

// not supported
void LIR_Assembler::vtable_call(LIR_OpJavaCall* op) {
ShouldNotReachHere();
}

void LIR_Assembler::move_regs(Register from_reg, Register to_reg) {
if (from_reg != to_reg) __ z_lgr(to_reg, from_reg);
}
@@ -2884,7 +2884,6 @@ void LIR_Assembler::align_call(LIR_Code code) {
case lir_icvirtual_call:
offset += NativeCall::displacement_offset + NativeMovConstReg::instruction_size;
break;
case lir_virtual_call: // currently, sparc-specific for niagara
default: ShouldNotReachHere();
}
__ align(BytesPerWord, offset);
@@ -2907,12 +2906,6 @@ void LIR_Assembler::ic_call(LIR_OpJavaCall* op) {
}


/* Currently, vtable-dispatch is only enabled for sparc platforms */
void LIR_Assembler::vtable_call(LIR_OpJavaCall* op) {
ShouldNotReachHere();
}


void LIR_Assembler::emit_static_call_stub() {
address call_pc = __ pc();
address stub = __ start_a_stub(call_stub_size());
@@ -2081,7 +2081,6 @@ void GraphBuilder::invoke(Bytecodes::Code code) {
code == Bytecodes::_invokeinterface;
Values* args = state()->pop_arguments(target->arg_size_no_receiver() + patching_appendix_arg);
Value recv = has_receiver ? apop() : NULL;
int vtable_index = Method::invalid_vtable_index;

// A null check is required here (when there is a receiver) for any of the following cases
// - invokespecial, always need a null check.
@@ -2121,7 +2120,7 @@ void GraphBuilder::invoke(Bytecodes::Code code) {
}
}

Invoke* result = new Invoke(code, result_type, recv, args, vtable_index, target, state_before);
Invoke* result = new Invoke(code, result_type, recv, args, target, state_before);
// push result
append_split(result);

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2021, 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
@@ -323,12 +323,11 @@ void BlockBegin::state_values_do(ValueVisitor* f) {


Invoke::Invoke(Bytecodes::Code code, ValueType* result_type, Value recv, Values* args,
int vtable_index, ciMethod* target, ValueStack* state_before)
ciMethod* target, ValueStack* state_before)
: StateSplit(result_type, state_before)
, _code(code)
, _recv(recv)
, _args(args)
, _vtable_index(vtable_index)
, _target(target)
{
set_flag(TargetIsLoadedFlag, target->is_loaded());
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2021, 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
@@ -1248,21 +1248,19 @@ LEAF(Invoke, StateSplit)
Value _recv;
Values* _args;
BasicTypeList* _signature;
int _vtable_index;
ciMethod* _target;

public:
// creation
Invoke(Bytecodes::Code code, ValueType* result_type, Value recv, Values* args,
int vtable_index, ciMethod* target, ValueStack* state_before);
ciMethod* target, ValueStack* state_before);

// accessors
Bytecodes::Code code() const { return _code; }
Value receiver() const { return _recv; }
bool has_receiver() const { return receiver() != NULL; }
int number_of_arguments() const { return _args->length(); }
Value argument_at(int i) const { return _args->at(i); }
int vtable_index() const { return _vtable_index; }
BasicTypeList* signature() const { return _signature; }
ciMethod* target() const { return _target; }

@@ -705,7 +705,6 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
case lir_static_call:
case lir_optvirtual_call:
case lir_icvirtual_call:
case lir_virtual_call:
case lir_dynamic_call: {
LIR_OpJavaCall* opJavaCall = op->as_OpJavaCall();
assert(opJavaCall != NULL, "must be");
@@ -1701,7 +1700,6 @@ const char * LIR_Op::name() const {
case lir_static_call: s = "static"; break;
case lir_optvirtual_call: s = "optvirtual"; break;
case lir_icvirtual_call: s = "icvirtual"; break;
case lir_virtual_call: s = "virtual"; break;
case lir_dynamic_call: s = "dynamic"; break;
// LIR_OpArrayCopy
case lir_arraycopy: s = "arraycopy"; break;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, 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
@@ -961,7 +961,6 @@ enum LIR_Code {
, lir_static_call
, lir_optvirtual_call
, lir_icvirtual_call
, lir_virtual_call
, lir_dynamic_call
, end_opJavaCall
, begin_opArrayCopy
@@ -1205,11 +1204,6 @@ class LIR_OpJavaCall: public LIR_OpCall {
method()->is_method_handle_intrinsic(); // JVM-generated MH intrinsic
}

intptr_t vtable_offset() const {
assert(_code == lir_virtual_call, "only have vtable for real vcall");
return (intptr_t) addr();
}

virtual void emit_code(LIR_Assembler* masm);
virtual LIR_OpJavaCall* as_OpJavaCall() { return this; }
virtual void print_instr(outputStream* out) const PRODUCT_RETURN;
@@ -2054,10 +2048,6 @@ class LIR_List: public CompilationResourceObj {
address dest, LIR_OprList* arguments, CodeEmitInfo* info) {
append(new LIR_OpJavaCall(lir_icvirtual_call, method, receiver, result, dest, arguments, info));
}
void call_virtual(ciMethod* method, LIR_Opr receiver, LIR_Opr result,
intptr_t vtable_offset, LIR_OprList* arguments, CodeEmitInfo* info) {
append(new LIR_OpJavaCall(lir_virtual_call, method, receiver, result, vtable_offset, arguments, info));
}
void call_dynamic(ciMethod* method, LIR_Opr receiver, LIR_Opr result,
address dest, LIR_OprList* arguments, CodeEmitInfo* info) {
append(new LIR_OpJavaCall(lir_dynamic_call, method, receiver, result, dest, arguments, info));
@@ -468,9 +468,6 @@ void LIR_Assembler::emit_call(LIR_OpJavaCall* op) {
case lir_icvirtual_call:
ic_call(op);
break;
case lir_virtual_call:
vtable_call(op);
break;
default:
fatal("unexpected op code: %s", op->name());
break;
@@ -2958,14 +2958,10 @@ void LIRGenerator::do_Invoke(Invoke* x) {
__ call_opt_virtual(target, receiver, result_register,
SharedRuntime::get_resolve_opt_virtual_call_stub(),
arg_list, info);
} else if (x->vtable_index() < 0) {
} else {
__ call_icvirtual(target, receiver, result_register,
SharedRuntime::get_resolve_virtual_call_stub(),
arg_list, info);
} else {
int entry_offset = in_bytes(Klass::vtable_start_offset()) + x->vtable_index() * vtableEntry::size_in_bytes();
int vtable_offset = entry_offset + vtableEntry::method_offset_in_bytes();
__ call_virtual(target, receiver, result_register, vtable_offset, arg_list, info);
}
break;
case Bytecodes::_invokedynamic: {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, 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
@@ -6660,8 +6660,7 @@ void LinearScanStatistic::collect(LinearScan* allocator) {

case lir_rtcall:
case lir_static_call:
case lir_optvirtual_call:
case lir_virtual_call: inc_counter(counter_call); break;
case lir_optvirtual_call: inc_counter(counter_call); break;

case lir_move: {
inc_counter(counter_move);

0 comments on commit a67a679

Please sign in to comment.