# HG changeset patch # User hseigel # Date 1490035115 14400 # Node ID b56e03b3e2d9a937b91bf2de8e1a9dbccafc246e # Parent 733615d6afdaaaa60fb78be78eba01b61c9c6070 8175932: Improve host instance supports Reviewed-by: coleenp, mschoene Contributed-by: harold.seigel@oracle.com diff -r 733615d6afda -r b56e03b3e2d9 src/share/vm/interpreter/interpreterRuntime.cpp --- a/src/share/vm/interpreter/interpreterRuntime.cpp Thu Mar 16 17:38:32 2017 +0000 +++ b/src/share/vm/interpreter/interpreterRuntime.cpp Mon Mar 20 14:38:35 2017 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -768,7 +768,7 @@ // it is not an interface. The receiver for invokespecial calls within interface // methods must be checked for every call. InstanceKlass* sender = pool->pool_holder(); - sender = sender->is_anonymous() ? InstanceKlass::cast(sender->host_klass()) : sender; + sender = sender->has_host_klass() ? InstanceKlass::cast(sender->host_klass()) : sender; switch (info.call_kind()) { case CallInfo::direct_call: diff -r 733615d6afda -r b56e03b3e2d9 src/share/vm/oops/instanceKlass.hpp --- a/src/share/vm/oops/instanceKlass.hpp Thu Mar 16 17:38:32 2017 +0000 +++ b/src/share/vm/oops/instanceKlass.hpp Mon Mar 20 14:38:35 2017 -0400 @@ -565,9 +565,11 @@ Klass* host_klass() const { Klass** hk = (Klass**)adr_host_klass(); if (hk == NULL) { + assert(!is_anonymous(), "Anonymous classes have host klasses"); return NULL; } else { assert(*hk != NULL, "host klass should always be set if the address is not null"); + assert(is_anonymous(), "Only anonymous classes have host klasses"); return *hk; } } @@ -579,6 +581,9 @@ *addr = host; } } + bool has_host_klass() const { + return adr_host_klass() != NULL; + } bool is_anonymous() const { return (_misc_flags & _misc_is_anonymous) != 0; }