提交 4b871a91 编写于 作者: H hseigel

8175932: Improve host instance supports

Reviewed-by: coleenp, mschoene
Contributed-by: harold.seigel@oracle.com
上级 908f9880
/*
* 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 @@ IRT_ENTRY(void, InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes
// 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:
......
......@@ -565,9 +565,11 @@ class InstanceKlass: public Klass {
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 @@ class InstanceKlass: public Klass {
*addr = host;
}
}
bool has_host_klass() const {
return adr_host_klass() != NULL;
}
bool is_anonymous() const {
return (_misc_flags & _misc_is_anonymous) != 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册