Mon, 20 Mar 2017 14:38:35 -0400
8175932: Improve host instance supports
Reviewed-by: coleenp, mschoene
Contributed-by: harold.seigel@oracle.com
src/share/vm/interpreter/interpreterRuntime.cpp | file | annotate | diff | comparison | revisions | |
src/share/vm/oops/instanceKlass.hpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/interpreter/interpreterRuntime.cpp Thu Mar 16 17:38:32 2017 +0000 1.2 +++ b/src/share/vm/interpreter/interpreterRuntime.cpp Mon Mar 20 14:38:35 2017 -0400 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2017, 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 @@ -768,7 +768,7 @@ 1.11 // it is not an interface. The receiver for invokespecial calls within interface 1.12 // methods must be checked for every call. 1.13 InstanceKlass* sender = pool->pool_holder(); 1.14 - sender = sender->is_anonymous() ? InstanceKlass::cast(sender->host_klass()) : sender; 1.15 + sender = sender->has_host_klass() ? InstanceKlass::cast(sender->host_klass()) : sender; 1.16 1.17 switch (info.call_kind()) { 1.18 case CallInfo::direct_call:
2.1 --- a/src/share/vm/oops/instanceKlass.hpp Thu Mar 16 17:38:32 2017 +0000 2.2 +++ b/src/share/vm/oops/instanceKlass.hpp Mon Mar 20 14:38:35 2017 -0400 2.3 @@ -565,9 +565,11 @@ 2.4 Klass* host_klass() const { 2.5 Klass** hk = (Klass**)adr_host_klass(); 2.6 if (hk == NULL) { 2.7 + assert(!is_anonymous(), "Anonymous classes have host klasses"); 2.8 return NULL; 2.9 } else { 2.10 assert(*hk != NULL, "host klass should always be set if the address is not null"); 2.11 + assert(is_anonymous(), "Only anonymous classes have host klasses"); 2.12 return *hk; 2.13 } 2.14 } 2.15 @@ -579,6 +581,9 @@ 2.16 *addr = host; 2.17 } 2.18 } 2.19 + bool has_host_klass() const { 2.20 + return adr_host_klass() != NULL; 2.21 + } 2.22 bool is_anonymous() const { 2.23 return (_misc_flags & _misc_is_anonymous) != 0; 2.24 }