src/share/vm/opto/doCall.cpp

changeset 8914
75000d7dd468
parent 8739
0b85ccd62409
child 8758
e7db67a9ddfd
     1.1 --- a/src/share/vm/opto/doCall.cpp	Mon Nov 21 22:56:59 2016 -0800
     1.2 +++ b/src/share/vm/opto/doCall.cpp	Tue Dec 13 14:37:04 2016 -0500
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -477,6 +477,30 @@
    1.11      speculative_receiver_type = receiver_type != NULL ? receiver_type->speculative_type() : NULL;
    1.12    }
    1.13  
    1.14 +  // invoke-super-special
    1.15 +  if (iter().cur_bc_raw() == Bytecodes::_invokespecial && !orig_callee->is_object_initializer()) {
    1.16 +    ciInstanceKlass* calling_klass = method()->holder();
    1.17 +    ciInstanceKlass* sender_klass =
    1.18 +        calling_klass->is_anonymous() ? calling_klass->host_klass() :
    1.19 +                                        calling_klass;
    1.20 +    if (sender_klass->is_interface()) {
    1.21 +      Node* receiver_node = stack(sp() - nargs);
    1.22 +      Node* cls_node = makecon(TypeKlassPtr::make(sender_klass));
    1.23 +      Node* bad_type_ctrl = NULL;
    1.24 +      Node* casted_receiver = gen_checkcast(receiver_node, cls_node, &bad_type_ctrl);
    1.25 +      if (bad_type_ctrl != NULL) {
    1.26 +        PreserveJVMState pjvms(this);
    1.27 +        set_control(bad_type_ctrl);
    1.28 +        uncommon_trap(Deoptimization::Reason_class_check,
    1.29 +                      Deoptimization::Action_none);
    1.30 +      }
    1.31 +      if (stopped()) {
    1.32 +        return; // MUST uncommon-trap?
    1.33 +      }
    1.34 +      set_stack(sp() - nargs, casted_receiver);
    1.35 +    }
    1.36 +  }
    1.37 +
    1.38    // Note:  It's OK to try to inline a virtual call.
    1.39    // The call generator will not attempt to inline a polymorphic call
    1.40    // unless it knows how to optimize the receiver dispatch.

mercurial