Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
83a2fa70
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
83a2fa70
编写于
9月 15, 2014
作者:
J
jiangli
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
0e15cf9e
5704a64a
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
252 addition
and
71 deletion
+252
-71
make/bsd/makefiles/mapfile-vers-debug
make/bsd/makefiles/mapfile-vers-debug
+2
-1
make/bsd/makefiles/mapfile-vers-product
make/bsd/makefiles/mapfile-vers-product
+2
-1
make/linux/makefiles/mapfile-vers-debug
make/linux/makefiles/mapfile-vers-debug
+2
-1
make/linux/makefiles/mapfile-vers-product
make/linux/makefiles/mapfile-vers-product
+2
-1
make/solaris/makefiles/mapfile-vers
make/solaris/makefiles/mapfile-vers
+2
-1
src/share/vm/classfile/classFileParser.cpp
src/share/vm/classfile/classFileParser.cpp
+5
-1
src/share/vm/classfile/classLoader.cpp
src/share/vm/classfile/classLoader.cpp
+10
-1
src/share/vm/classfile/classLoader.hpp
src/share/vm/classfile/classLoader.hpp
+1
-0
src/share/vm/classfile/stackMapFrame.cpp
src/share/vm/classfile/stackMapFrame.cpp
+5
-5
src/share/vm/classfile/stackMapFrame.hpp
src/share/vm/classfile/stackMapFrame.hpp
+3
-3
src/share/vm/classfile/verificationType.cpp
src/share/vm/classfile/verificationType.cpp
+10
-6
src/share/vm/classfile/verificationType.hpp
src/share/vm/classfile/verificationType.hpp
+7
-3
src/share/vm/classfile/verifier.cpp
src/share/vm/classfile/verifier.cpp
+9
-9
src/share/vm/interpreter/linkResolver.cpp
src/share/vm/interpreter/linkResolver.cpp
+32
-20
src/share/vm/memory/filemap.cpp
src/share/vm/memory/filemap.cpp
+47
-7
src/share/vm/memory/filemap.hpp
src/share/vm/memory/filemap.hpp
+8
-2
src/share/vm/memory/metaspaceShared.cpp
src/share/vm/memory/metaspaceShared.cpp
+5
-0
src/share/vm/oops/arrayKlass.cpp
src/share/vm/oops/arrayKlass.cpp
+7
-0
src/share/vm/oops/arrayKlass.hpp
src/share/vm/oops/arrayKlass.hpp
+4
-0
src/share/vm/oops/klass.cpp
src/share/vm/oops/klass.cpp
+9
-0
src/share/vm/oops/klass.hpp
src/share/vm/oops/klass.hpp
+2
-0
src/share/vm/prims/jvm.cpp
src/share/vm/prims/jvm.cpp
+44
-2
src/share/vm/prims/jvm.h
src/share/vm/prims/jvm.h
+14
-1
src/share/vm/runtime/arguments.cpp
src/share/vm/runtime/arguments.cpp
+9
-0
src/share/vm/runtime/globals.hpp
src/share/vm/runtime/globals.hpp
+7
-3
src/share/vm/runtime/reflection.cpp
src/share/vm/runtime/reflection.cpp
+4
-3
未找到文件。
make/bsd/makefiles/mapfile-vers-debug
浏览文件 @
83a2fa70
#
#
# Copyright (c) 2002, 201
3
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2002, 201
4
, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
#
# This code is free software; you can redistribute it and/or modify it
# This code is free software; you can redistribute it and/or modify it
...
@@ -82,6 +82,7 @@
...
@@ -82,6 +82,7 @@
_JVM_EnableCompiler
_JVM_EnableCompiler
_JVM_Exit
_JVM_Exit
_JVM_FillInStackTrace
_JVM_FillInStackTrace
_JVM_FindClassFromCaller
_JVM_FindClassFromClass
_JVM_FindClassFromClass
_JVM_FindClassFromClassLoader
_JVM_FindClassFromClassLoader
_JVM_FindClassFromBootLoader
_JVM_FindClassFromBootLoader
...
...
make/bsd/makefiles/mapfile-vers-product
浏览文件 @
83a2fa70
#
#
# Copyright (c) 2002, 201
3
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2002, 201
4
, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
#
# This code is free software; you can redistribute it and/or modify it
# This code is free software; you can redistribute it and/or modify it
...
@@ -82,6 +82,7 @@
...
@@ -82,6 +82,7 @@
_JVM_EnableCompiler
_JVM_EnableCompiler
_JVM_Exit
_JVM_Exit
_JVM_FillInStackTrace
_JVM_FillInStackTrace
_JVM_FindClassFromCaller
_JVM_FindClassFromClass
_JVM_FindClassFromClass
_JVM_FindClassFromClassLoader
_JVM_FindClassFromClassLoader
_JVM_FindClassFromBootLoader
_JVM_FindClassFromBootLoader
...
...
make/linux/makefiles/mapfile-vers-debug
浏览文件 @
83a2fa70
#
#
# Copyright (c) 2002, 201
3
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2002, 201
4
, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
#
# This code is free software; you can redistribute it and/or modify it
# This code is free software; you can redistribute it and/or modify it
...
@@ -84,6 +84,7 @@ SUNWprivate_1.1 {
...
@@ -84,6 +84,7 @@ SUNWprivate_1.1 {
JVM_EnableCompiler;
JVM_EnableCompiler;
JVM_Exit;
JVM_Exit;
JVM_FillInStackTrace;
JVM_FillInStackTrace;
JVM_FindClassFromCaller;
JVM_FindClassFromClass;
JVM_FindClassFromClass;
JVM_FindClassFromClassLoader;
JVM_FindClassFromClassLoader;
JVM_FindClassFromBootLoader;
JVM_FindClassFromBootLoader;
...
...
make/linux/makefiles/mapfile-vers-product
浏览文件 @
83a2fa70
#
#
# Copyright (c) 2002, 201
3
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2002, 201
4
, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
#
# This code is free software; you can redistribute it and/or modify it
# This code is free software; you can redistribute it and/or modify it
...
@@ -84,6 +84,7 @@ SUNWprivate_1.1 {
...
@@ -84,6 +84,7 @@ SUNWprivate_1.1 {
JVM_EnableCompiler;
JVM_EnableCompiler;
JVM_Exit;
JVM_Exit;
JVM_FillInStackTrace;
JVM_FillInStackTrace;
JVM_FindClassFromCaller;
JVM_FindClassFromClass;
JVM_FindClassFromClass;
JVM_FindClassFromClassLoader;
JVM_FindClassFromClassLoader;
JVM_FindClassFromBootLoader;
JVM_FindClassFromBootLoader;
...
...
make/solaris/makefiles/mapfile-vers
浏览文件 @
83a2fa70
#
#
# Copyright (c) 2000, 201
3
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2000, 201
4
, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
#
# This code is free software; you can redistribute it and/or modify it
# This code is free software; you can redistribute it and/or modify it
...
@@ -84,6 +84,7 @@ SUNWprivate_1.1 {
...
@@ -84,6 +84,7 @@ SUNWprivate_1.1 {
JVM_EnableCompiler;
JVM_EnableCompiler;
JVM_Exit;
JVM_Exit;
JVM_FillInStackTrace;
JVM_FillInStackTrace;
JVM_FindClassFromCaller;
JVM_FindClassFromClass;
JVM_FindClassFromClass;
JVM_FindClassFromClassLoader;
JVM_FindClassFromClassLoader;
JVM_FindClassFromBootLoader;
JVM_FindClassFromBootLoader;
...
...
src/share/vm/classfile/classFileParser.cpp
浏览文件 @
83a2fa70
...
@@ -2830,6 +2830,11 @@ void ClassFileParser::parse_classfile_bootstrap_methods_attribute(u4 attribute_b
...
@@ -2830,6 +2830,11 @@ void ClassFileParser::parse_classfile_bootstrap_methods_attribute(u4 attribute_b
"bootstrap_method_index %u has bad constant type in class file %s"
,
"bootstrap_method_index %u has bad constant type in class file %s"
,
bootstrap_method_index
,
bootstrap_method_index
,
CHECK
);
CHECK
);
guarantee_property
((
operand_fill_index
+
1
+
argument_count
)
<
operands
->
length
(),
"Invalid BootstrapMethods num_bootstrap_methods or num_bootstrap_arguments value in class file %s"
,
CHECK
);
operands
->
at_put
(
operand_fill_index
++
,
bootstrap_method_index
);
operands
->
at_put
(
operand_fill_index
++
,
bootstrap_method_index
);
operands
->
at_put
(
operand_fill_index
++
,
argument_count
);
operands
->
at_put
(
operand_fill_index
++
,
argument_count
);
...
@@ -2847,7 +2852,6 @@ void ClassFileParser::parse_classfile_bootstrap_methods_attribute(u4 attribute_b
...
@@ -2847,7 +2852,6 @@ void ClassFileParser::parse_classfile_bootstrap_methods_attribute(u4 attribute_b
}
}
assert
(
operand_fill_index
==
operands
->
length
(),
"exact fill"
);
assert
(
operand_fill_index
==
operands
->
length
(),
"exact fill"
);
assert
(
ConstantPool
::
operand_array_length
(
operands
)
==
attribute_array_length
,
"correct decode"
);
u1
*
current_end
=
cfs
->
current
();
u1
*
current_end
=
cfs
->
current
();
guarantee_property
(
current_end
==
current_start
+
attribute_byte_length
,
guarantee_property
(
current_end
==
current_start
+
attribute_byte_length
,
...
...
src/share/vm/classfile/classLoader.cpp
浏览文件 @
83a2fa70
...
@@ -90,6 +90,7 @@ typedef jzentry* (JNICALL *FindEntry_t)(jzfile *zip, const char *name, jint *siz
...
@@ -90,6 +90,7 @@ typedef jzentry* (JNICALL *FindEntry_t)(jzfile *zip, const char *name, jint *siz
typedef
jboolean
(
JNICALL
*
ReadEntry_t
)(
jzfile
*
zip
,
jzentry
*
entry
,
unsigned
char
*
buf
,
char
*
namebuf
);
typedef
jboolean
(
JNICALL
*
ReadEntry_t
)(
jzfile
*
zip
,
jzentry
*
entry
,
unsigned
char
*
buf
,
char
*
namebuf
);
typedef
jboolean
(
JNICALL
*
ReadMappedEntry_t
)(
jzfile
*
zip
,
jzentry
*
entry
,
unsigned
char
**
buf
,
char
*
namebuf
);
typedef
jboolean
(
JNICALL
*
ReadMappedEntry_t
)(
jzfile
*
zip
,
jzentry
*
entry
,
unsigned
char
**
buf
,
char
*
namebuf
);
typedef
jzentry
*
(
JNICALL
*
GetNextEntry_t
)(
jzfile
*
zip
,
jint
n
);
typedef
jzentry
*
(
JNICALL
*
GetNextEntry_t
)(
jzfile
*
zip
,
jint
n
);
typedef
jint
(
JNICALL
*
Crc32_t
)(
jint
crc
,
const
jbyte
*
buf
,
jint
len
);
static
ZipOpen_t
ZipOpen
=
NULL
;
static
ZipOpen_t
ZipOpen
=
NULL
;
static
ZipClose_t
ZipClose
=
NULL
;
static
ZipClose_t
ZipClose
=
NULL
;
...
@@ -98,6 +99,7 @@ static ReadEntry_t ReadEntry = NULL;
...
@@ -98,6 +99,7 @@ static ReadEntry_t ReadEntry = NULL;
static
ReadMappedEntry_t
ReadMappedEntry
=
NULL
;
static
ReadMappedEntry_t
ReadMappedEntry
=
NULL
;
static
GetNextEntry_t
GetNextEntry
=
NULL
;
static
GetNextEntry_t
GetNextEntry
=
NULL
;
static
canonicalize_fn_t
CanonicalizeEntry
=
NULL
;
static
canonicalize_fn_t
CanonicalizeEntry
=
NULL
;
static
Crc32_t
Crc32
=
NULL
;
// Globals
// Globals
...
@@ -810,9 +812,11 @@ void ClassLoader::load_zip_library() {
...
@@ -810,9 +812,11 @@ void ClassLoader::load_zip_library() {
ReadEntry
=
CAST_TO_FN_PTR
(
ReadEntry_t
,
os
::
dll_lookup
(
handle
,
"ZIP_ReadEntry"
));
ReadEntry
=
CAST_TO_FN_PTR
(
ReadEntry_t
,
os
::
dll_lookup
(
handle
,
"ZIP_ReadEntry"
));
ReadMappedEntry
=
CAST_TO_FN_PTR
(
ReadMappedEntry_t
,
os
::
dll_lookup
(
handle
,
"ZIP_ReadMappedEntry"
));
ReadMappedEntry
=
CAST_TO_FN_PTR
(
ReadMappedEntry_t
,
os
::
dll_lookup
(
handle
,
"ZIP_ReadMappedEntry"
));
GetNextEntry
=
CAST_TO_FN_PTR
(
GetNextEntry_t
,
os
::
dll_lookup
(
handle
,
"ZIP_GetNextEntry"
));
GetNextEntry
=
CAST_TO_FN_PTR
(
GetNextEntry_t
,
os
::
dll_lookup
(
handle
,
"ZIP_GetNextEntry"
));
Crc32
=
CAST_TO_FN_PTR
(
Crc32_t
,
os
::
dll_lookup
(
handle
,
"ZIP_CRC32"
));
// ZIP_Close is not exported on Windows in JDK5.0 so don't abort if ZIP_Close is NULL
// ZIP_Close is not exported on Windows in JDK5.0 so don't abort if ZIP_Close is NULL
if
(
ZipOpen
==
NULL
||
FindEntry
==
NULL
||
ReadEntry
==
NULL
||
GetNextEntry
==
NULL
)
{
if
(
ZipOpen
==
NULL
||
FindEntry
==
NULL
||
ReadEntry
==
NULL
||
GetNextEntry
==
NULL
||
Crc32
==
NULL
)
{
vm_exit_during_initialization
(
"Corrupted ZIP library"
,
path
);
vm_exit_during_initialization
(
"Corrupted ZIP library"
,
path
);
}
}
...
@@ -822,6 +826,11 @@ void ClassLoader::load_zip_library() {
...
@@ -822,6 +826,11 @@ void ClassLoader::load_zip_library() {
// This lookup only works on 1.3. Do not check for non-null here
// This lookup only works on 1.3. Do not check for non-null here
}
}
int
ClassLoader
::
crc32
(
int
crc
,
const
char
*
buf
,
int
len
)
{
assert
(
Crc32
!=
NULL
,
"ZIP_CRC32 is not found"
);
return
(
*
Crc32
)(
crc
,
(
const
jbyte
*
)
buf
,
len
);
}
// PackageInfo data exists in order to support the java.lang.Package
// PackageInfo data exists in order to support the java.lang.Package
// class. A Package object provides information about a java package
// class. A Package object provides information about a java package
// (version, vendor, etc.) which originates in the manifest of the jar
// (version, vendor, etc.) which originates in the manifest of the jar
...
...
src/share/vm/classfile/classLoader.hpp
浏览文件 @
83a2fa70
...
@@ -228,6 +228,7 @@ class ClassLoader: AllStatic {
...
@@ -228,6 +228,7 @@ class ClassLoader: AllStatic {
// to avoid confusing the zip library
// to avoid confusing the zip library
static
bool
get_canonical_path
(
const
char
*
orig
,
char
*
out
,
int
len
);
static
bool
get_canonical_path
(
const
char
*
orig
,
char
*
out
,
int
len
);
public:
public:
static
int
crc32
(
int
crc
,
const
char
*
buf
,
int
len
);
static
bool
update_class_path_entry_list
(
const
char
*
path
,
static
bool
update_class_path_entry_list
(
const
char
*
path
,
bool
check_for_duplicates
,
bool
check_for_duplicates
,
bool
throw_exception
=
true
);
bool
throw_exception
=
true
);
...
...
src/share/vm/classfile/stackMapFrame.cpp
浏览文件 @
83a2fa70
...
@@ -148,7 +148,7 @@ int StackMapFrame::is_assignable_to(
...
@@ -148,7 +148,7 @@ int StackMapFrame::is_assignable_to(
VerificationType
*
from
,
VerificationType
*
to
,
int32_t
len
,
TRAPS
)
const
{
VerificationType
*
from
,
VerificationType
*
to
,
int32_t
len
,
TRAPS
)
const
{
int32_t
i
=
0
;
int32_t
i
=
0
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
!
to
[
i
].
is_assignable_from
(
from
[
i
],
verifier
(),
THREAD
))
{
if
(
!
to
[
i
].
is_assignable_from
(
from
[
i
],
verifier
(),
false
,
THREAD
))
{
break
;
break
;
}
}
}
}
...
@@ -245,7 +245,7 @@ VerificationType StackMapFrame::pop_stack_ex(VerificationType type, TRAPS) {
...
@@ -245,7 +245,7 @@ VerificationType StackMapFrame::pop_stack_ex(VerificationType type, TRAPS) {
}
}
VerificationType
top
=
_stack
[
--
_stack_size
];
VerificationType
top
=
_stack
[
--
_stack_size
];
bool
subtype
=
type
.
is_assignable_from
(
bool
subtype
=
type
.
is_assignable_from
(
top
,
verifier
(),
CHECK_
(
VerificationType
::
bogus_type
()));
top
,
verifier
(),
false
,
CHECK_
(
VerificationType
::
bogus_type
()));
if
(
!
subtype
)
{
if
(
!
subtype
)
{
verifier
()
->
verify_error
(
verifier
()
->
verify_error
(
ErrorContext
::
bad_type
(
_offset
,
stack_top_ctx
(),
ErrorContext
::
bad_type
(
_offset
,
stack_top_ctx
(),
...
@@ -265,7 +265,7 @@ VerificationType StackMapFrame::get_local(
...
@@ -265,7 +265,7 @@ VerificationType StackMapFrame::get_local(
return
VerificationType
::
bogus_type
();
return
VerificationType
::
bogus_type
();
}
}
bool
subtype
=
type
.
is_assignable_from
(
_locals
[
index
],
bool
subtype
=
type
.
is_assignable_from
(
_locals
[
index
],
verifier
(),
CHECK_
(
VerificationType
::
bogus_type
()));
verifier
(),
false
,
CHECK_
(
VerificationType
::
bogus_type
()));
if
(
!
subtype
)
{
if
(
!
subtype
)
{
verifier
()
->
verify_error
(
verifier
()
->
verify_error
(
ErrorContext
::
bad_type
(
_offset
,
ErrorContext
::
bad_type
(
_offset
,
...
@@ -288,14 +288,14 @@ void StackMapFrame::get_local_2(
...
@@ -288,14 +288,14 @@ void StackMapFrame::get_local_2(
"get long/double overflows locals"
);
"get long/double overflows locals"
);
return
;
return
;
}
}
bool
subtype
=
type1
.
is_assignable_from
(
_locals
[
index
],
verifier
(),
CHECK
);
bool
subtype
=
type1
.
is_assignable_from
(
_locals
[
index
],
verifier
(),
false
,
CHECK
);
if
(
!
subtype
)
{
if
(
!
subtype
)
{
verifier
()
->
verify_error
(
verifier
()
->
verify_error
(
ErrorContext
::
bad_type
(
_offset
,
ErrorContext
::
bad_type
(
_offset
,
TypeOrigin
::
local
(
index
,
this
),
TypeOrigin
::
implicit
(
type1
)),
TypeOrigin
::
local
(
index
,
this
),
TypeOrigin
::
implicit
(
type1
)),
"Bad local variable type"
);
"Bad local variable type"
);
}
else
{
}
else
{
subtype
=
type2
.
is_assignable_from
(
_locals
[
index
+
1
],
verifier
(),
CHECK
);
subtype
=
type2
.
is_assignable_from
(
_locals
[
index
+
1
],
verifier
(),
false
,
CHECK
);
if
(
!
subtype
)
{
if
(
!
subtype
)
{
/* Unreachable? All local store routines convert a split long or double
/* Unreachable? All local store routines convert a split long or double
* into a TOP during the store. So we should never end up seeing an
* into a TOP during the store. So we should never end up seeing an
...
...
src/share/vm/classfile/stackMapFrame.hpp
浏览文件 @
83a2fa70
...
@@ -234,7 +234,7 @@ class StackMapFrame : public ResourceObj {
...
@@ -234,7 +234,7 @@ class StackMapFrame : public ResourceObj {
if
(
_stack_size
!=
0
)
{
if
(
_stack_size
!=
0
)
{
VerificationType
top
=
_stack
[
_stack_size
-
1
];
VerificationType
top
=
_stack
[
_stack_size
-
1
];
bool
subtype
=
type
.
is_assignable_from
(
bool
subtype
=
type
.
is_assignable_from
(
top
,
verifier
(),
CHECK_
(
VerificationType
::
bogus_type
()));
top
,
verifier
(),
false
,
CHECK_
(
VerificationType
::
bogus_type
()));
if
(
subtype
)
{
if
(
subtype
)
{
--
_stack_size
;
--
_stack_size
;
return
top
;
return
top
;
...
@@ -249,9 +249,9 @@ class StackMapFrame : public ResourceObj {
...
@@ -249,9 +249,9 @@ class StackMapFrame : public ResourceObj {
assert
(
type2
.
is_long
()
||
type2
.
is_double
(),
"must be long/double_2"
);
assert
(
type2
.
is_long
()
||
type2
.
is_double
(),
"must be long/double_2"
);
if
(
_stack_size
>=
2
)
{
if
(
_stack_size
>=
2
)
{
VerificationType
top1
=
_stack
[
_stack_size
-
1
];
VerificationType
top1
=
_stack
[
_stack_size
-
1
];
bool
subtype1
=
type1
.
is_assignable_from
(
top1
,
verifier
(),
CHECK
);
bool
subtype1
=
type1
.
is_assignable_from
(
top1
,
verifier
(),
false
,
CHECK
);
VerificationType
top2
=
_stack
[
_stack_size
-
2
];
VerificationType
top2
=
_stack
[
_stack_size
-
2
];
bool
subtype2
=
type2
.
is_assignable_from
(
top2
,
verifier
(),
CHECK
);
bool
subtype2
=
type2
.
is_assignable_from
(
top2
,
verifier
(),
false
,
CHECK
);
if
(
subtype1
&&
subtype2
)
{
if
(
subtype1
&&
subtype2
)
{
_stack_size
-=
2
;
_stack_size
-=
2
;
return
;
return
;
...
...
src/share/vm/classfile/verificationType.cpp
浏览文件 @
83a2fa70
/*
/*
* Copyright (c) 2003, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -42,7 +42,8 @@ VerificationType VerificationType::from_tag(u1 tag) {
...
@@ -42,7 +42,8 @@ VerificationType VerificationType::from_tag(u1 tag) {
}
}
bool
VerificationType
::
is_reference_assignable_from
(
bool
VerificationType
::
is_reference_assignable_from
(
const
VerificationType
&
from
,
ClassVerifier
*
context
,
TRAPS
)
const
{
const
VerificationType
&
from
,
ClassVerifier
*
context
,
bool
from_field_is_protected
,
TRAPS
)
const
{
instanceKlassHandle
klass
=
context
->
current_class
();
instanceKlassHandle
klass
=
context
->
current_class
();
if
(
from
.
is_null
())
{
if
(
from
.
is_null
())
{
// null is assignable to any reference
// null is assignable to any reference
...
@@ -62,9 +63,11 @@ bool VerificationType::is_reference_assignable_from(
...
@@ -62,9 +63,11 @@ bool VerificationType::is_reference_assignable_from(
Handle
(
THREAD
,
klass
->
protection_domain
()),
true
,
CHECK_false
);
Handle
(
THREAD
,
klass
->
protection_domain
()),
true
,
CHECK_false
);
KlassHandle
this_class
(
THREAD
,
obj
);
KlassHandle
this_class
(
THREAD
,
obj
);
if
(
this_class
->
is_interface
())
{
if
(
this_class
->
is_interface
()
&&
(
!
from_field_is_protected
||
// We treat interfaces as java.lang.Object, including
from
.
name
()
!=
vmSymbols
::
java_lang_Object
()))
{
// java.lang.Cloneable and java.io.Serializable
// If we are not trying to access a protected field or method in
// java.lang.Object then we treat interfaces as java.lang.Object,
// including java.lang.Cloneable and java.io.Serializable.
return
true
;
return
true
;
}
else
if
(
from
.
is_object
())
{
}
else
if
(
from
.
is_object
())
{
Klass
*
from_class
=
SystemDictionary
::
resolve_or_fail
(
Klass
*
from_class
=
SystemDictionary
::
resolve_or_fail
(
...
@@ -76,7 +79,8 @@ bool VerificationType::is_reference_assignable_from(
...
@@ -76,7 +79,8 @@ bool VerificationType::is_reference_assignable_from(
VerificationType
comp_this
=
get_component
(
context
,
CHECK_false
);
VerificationType
comp_this
=
get_component
(
context
,
CHECK_false
);
VerificationType
comp_from
=
from
.
get_component
(
context
,
CHECK_false
);
VerificationType
comp_from
=
from
.
get_component
(
context
,
CHECK_false
);
if
(
!
comp_this
.
is_bogus
()
&&
!
comp_from
.
is_bogus
())
{
if
(
!
comp_this
.
is_bogus
()
&&
!
comp_from
.
is_bogus
())
{
return
comp_this
.
is_assignable_from
(
comp_from
,
context
,
CHECK_false
);
return
comp_this
.
is_assignable_from
(
comp_from
,
context
,
from_field_is_protected
,
CHECK_false
);
}
}
}
}
return
false
;
return
false
;
...
...
src/share/vm/classfile/verificationType.hpp
浏览文件 @
83a2fa70
...
@@ -265,7 +265,8 @@ class VerificationType VALUE_OBJ_CLASS_SPEC {
...
@@ -265,7 +265,8 @@ class VerificationType VALUE_OBJ_CLASS_SPEC {
// is assignable to another. Returns true if one can assign 'from' to
// is assignable to another. Returns true if one can assign 'from' to
// this.
// this.
bool
is_assignable_from
(
bool
is_assignable_from
(
const
VerificationType
&
from
,
ClassVerifier
*
context
,
TRAPS
)
const
{
const
VerificationType
&
from
,
ClassVerifier
*
context
,
bool
from_field_is_protected
,
TRAPS
)
const
{
if
(
equals
(
from
)
||
is_bogus
())
{
if
(
equals
(
from
)
||
is_bogus
())
{
return
true
;
return
true
;
}
else
{
}
else
{
...
@@ -286,7 +287,9 @@ class VerificationType VALUE_OBJ_CLASS_SPEC {
...
@@ -286,7 +287,9 @@ class VerificationType VALUE_OBJ_CLASS_SPEC {
return
from
.
is_integer
();
return
from
.
is_integer
();
default:
default:
if
(
is_reference
()
&&
from
.
is_reference
())
{
if
(
is_reference
()
&&
from
.
is_reference
())
{
return
is_reference_assignable_from
(
from
,
context
,
CHECK_false
);
return
is_reference_assignable_from
(
from
,
context
,
from_field_is_protected
,
CHECK_false
);
}
else
{
}
else
{
return
false
;
return
false
;
}
}
...
@@ -308,7 +311,8 @@ class VerificationType VALUE_OBJ_CLASS_SPEC {
...
@@ -308,7 +311,8 @@ class VerificationType VALUE_OBJ_CLASS_SPEC {
private:
private:
bool
is_reference_assignable_from
(
bool
is_reference_assignable_from
(
const
VerificationType
&
,
ClassVerifier
*
,
TRAPS
)
const
;
const
VerificationType
&
,
ClassVerifier
*
,
bool
from_field_is_protected
,
TRAPS
)
const
;
};
};
#endif // SHARE_VM_CLASSFILE_VERIFICATIONTYPE_HPP
#endif // SHARE_VM_CLASSFILE_VERIFICATIONTYPE_HPP
src/share/vm/classfile/verifier.cpp
浏览文件 @
83a2fa70
...
@@ -1734,7 +1734,7 @@ void ClassVerifier::verify_exception_handler_table(u4 code_length, char* code_da
...
@@ -1734,7 +1734,7 @@ void ClassVerifier::verify_exception_handler_table(u4 code_length, char* code_da
VerificationType
throwable
=
VerificationType
throwable
=
VerificationType
::
reference_type
(
vmSymbols
::
java_lang_Throwable
());
VerificationType
::
reference_type
(
vmSymbols
::
java_lang_Throwable
());
bool
is_subclass
=
throwable
.
is_assignable_from
(
bool
is_subclass
=
throwable
.
is_assignable_from
(
catch_type
,
this
,
CHECK_VERIFY
(
this
));
catch_type
,
this
,
false
,
CHECK_VERIFY
(
this
));
if
(
!
is_subclass
)
{
if
(
!
is_subclass
)
{
// 4286534: should throw VerifyError according to recent spec change
// 4286534: should throw VerifyError according to recent spec change
verify_error
(
ErrorContext
::
bad_type
(
handler_pc
,
verify_error
(
ErrorContext
::
bad_type
(
handler_pc
,
...
@@ -2189,7 +2189,7 @@ void ClassVerifier::verify_field_instructions(RawBytecodeStream* bcs,
...
@@ -2189,7 +2189,7 @@ void ClassVerifier::verify_field_instructions(RawBytecodeStream* bcs,
stack_object_type
=
current_type
();
stack_object_type
=
current_type
();
}
}
is_assignable
=
target_class_type
.
is_assignable_from
(
is_assignable
=
target_class_type
.
is_assignable_from
(
stack_object_type
,
this
,
CHECK_VERIFY
(
this
));
stack_object_type
,
this
,
false
,
CHECK_VERIFY
(
this
));
if
(
!
is_assignable
)
{
if
(
!
is_assignable
)
{
verify_error
(
ErrorContext
::
bad_type
(
bci
,
verify_error
(
ErrorContext
::
bad_type
(
bci
,
current_frame
->
stack_top_ctx
(),
current_frame
->
stack_top_ctx
(),
...
@@ -2216,7 +2216,7 @@ void ClassVerifier::verify_field_instructions(RawBytecodeStream* bcs,
...
@@ -2216,7 +2216,7 @@ void ClassVerifier::verify_field_instructions(RawBytecodeStream* bcs,
// It's protected access, check if stack object is assignable to
// It's protected access, check if stack object is assignable to
// current class.
// current class.
is_assignable
=
current_type
().
is_assignable_from
(
is_assignable
=
current_type
().
is_assignable_from
(
stack_object_type
,
this
,
CHECK_VERIFY
(
this
));
stack_object_type
,
this
,
true
,
CHECK_VERIFY
(
this
));
if
(
!
is_assignable
)
{
if
(
!
is_assignable
)
{
verify_error
(
ErrorContext
::
bad_type
(
bci
,
verify_error
(
ErrorContext
::
bad_type
(
bci
,
current_frame
->
stack_top_ctx
(),
current_frame
->
stack_top_ctx
(),
...
@@ -2489,7 +2489,7 @@ void ClassVerifier::verify_invoke_init(
...
@@ -2489,7 +2489,7 @@ void ClassVerifier::verify_invoke_init(
instanceKlassHandle
mh
(
THREAD
,
m
->
method_holder
());
instanceKlassHandle
mh
(
THREAD
,
m
->
method_holder
());
if
(
m
->
is_protected
()
&&
!
mh
->
is_same_class_package
(
_klass
()))
{
if
(
m
->
is_protected
()
&&
!
mh
->
is_same_class_package
(
_klass
()))
{
bool
assignable
=
current_type
().
is_assignable_from
(
bool
assignable
=
current_type
().
is_assignable_from
(
objectref_type
,
this
,
CHECK_VERIFY
(
this
));
objectref_type
,
this
,
true
,
CHECK_VERIFY
(
this
));
if
(
!
assignable
)
{
if
(
!
assignable
)
{
verify_error
(
ErrorContext
::
bad_type
(
bci
,
verify_error
(
ErrorContext
::
bad_type
(
bci
,
TypeOrigin
::
cp
(
new_class_index
,
objectref_type
),
TypeOrigin
::
cp
(
new_class_index
,
objectref_type
),
...
@@ -2664,11 +2664,11 @@ void ClassVerifier::verify_invoke_instructions(
...
@@ -2664,11 +2664,11 @@ void ClassVerifier::verify_invoke_instructions(
bool
have_imr_indirect
=
cp
->
tag_at
(
index
).
value
()
==
JVM_CONSTANT_InterfaceMethodref
;
bool
have_imr_indirect
=
cp
->
tag_at
(
index
).
value
()
==
JVM_CONSTANT_InterfaceMethodref
;
if
(
!
current_class
()
->
is_anonymous
())
{
if
(
!
current_class
()
->
is_anonymous
())
{
subtype
=
ref_class_type
.
is_assignable_from
(
subtype
=
ref_class_type
.
is_assignable_from
(
current_type
(),
this
,
CHECK_VERIFY
(
this
));
current_type
(),
this
,
false
,
CHECK_VERIFY
(
this
));
}
else
{
}
else
{
VerificationType
host_klass_type
=
VerificationType
host_klass_type
=
VerificationType
::
reference_type
(
current_class
()
->
host_klass
()
->
name
());
VerificationType
::
reference_type
(
current_class
()
->
host_klass
()
->
name
());
subtype
=
ref_class_type
.
is_assignable_from
(
host_klass_type
,
this
,
CHECK_VERIFY
(
this
));
subtype
=
ref_class_type
.
is_assignable_from
(
host_klass_type
,
this
,
false
,
CHECK_VERIFY
(
this
));
// If invokespecial of IMR, need to recheck for same or
// If invokespecial of IMR, need to recheck for same or
// direct interface relative to the host class
// direct interface relative to the host class
...
@@ -2712,7 +2712,7 @@ void ClassVerifier::verify_invoke_instructions(
...
@@ -2712,7 +2712,7 @@ void ClassVerifier::verify_invoke_instructions(
VerificationType
top
=
current_frame
->
pop_stack
(
CHECK_VERIFY
(
this
));
VerificationType
top
=
current_frame
->
pop_stack
(
CHECK_VERIFY
(
this
));
VerificationType
hosttype
=
VerificationType
hosttype
=
VerificationType
::
reference_type
(
current_class
()
->
host_klass
()
->
name
());
VerificationType
::
reference_type
(
current_class
()
->
host_klass
()
->
name
());
bool
subtype
=
hosttype
.
is_assignable_from
(
top
,
this
,
CHECK_VERIFY
(
this
));
bool
subtype
=
hosttype
.
is_assignable_from
(
top
,
this
,
false
,
CHECK_VERIFY
(
this
));
if
(
!
subtype
)
{
if
(
!
subtype
)
{
verify_error
(
ErrorContext
::
bad_type
(
current_frame
->
offset
(),
verify_error
(
ErrorContext
::
bad_type
(
current_frame
->
offset
(),
current_frame
->
stack_top_ctx
(),
current_frame
->
stack_top_ctx
(),
...
@@ -2737,7 +2737,7 @@ void ClassVerifier::verify_invoke_instructions(
...
@@ -2737,7 +2737,7 @@ void ClassVerifier::verify_invoke_instructions(
// It's protected access, check if stack object is
// It's protected access, check if stack object is
// assignable to current class.
// assignable to current class.
bool
is_assignable
=
current_type
().
is_assignable_from
(
bool
is_assignable
=
current_type
().
is_assignable_from
(
stack_object_type
,
this
,
CHECK_VERIFY
(
this
));
stack_object_type
,
this
,
true
,
CHECK_VERIFY
(
this
));
if
(
!
is_assignable
)
{
if
(
!
is_assignable
)
{
if
(
ref_class_type
.
name
()
==
vmSymbols
::
java_lang_Object
()
if
(
ref_class_type
.
name
()
==
vmSymbols
::
java_lang_Object
()
&&
stack_object_type
.
is_array
()
&&
stack_object_type
.
is_array
()
...
@@ -2920,7 +2920,7 @@ void ClassVerifier::verify_return_value(
...
@@ -2920,7 +2920,7 @@ void ClassVerifier::verify_return_value(
"Method expects a return value"
);
"Method expects a return value"
);
return
;
return
;
}
}
bool
match
=
return_type
.
is_assignable_from
(
type
,
this
,
CHECK_VERIFY
(
this
));
bool
match
=
return_type
.
is_assignable_from
(
type
,
this
,
false
,
CHECK_VERIFY
(
this
));
if
(
!
match
)
{
if
(
!
match
)
{
verify_error
(
ErrorContext
::
bad_type
(
bci
,
verify_error
(
ErrorContext
::
bad_type
(
bci
,
current_frame
->
stack_top_ctx
(),
TypeOrigin
::
signature
(
return_type
)),
current_frame
->
stack_top_ctx
(),
TypeOrigin
::
signature
(
return_type
)),
...
...
src/share/vm/interpreter/linkResolver.cpp
浏览文件 @
83a2fa70
...
@@ -246,6 +246,12 @@ void LinkResolver::lookup_method_in_klasses(methodHandle& result, KlassHandle kl
...
@@ -246,6 +246,12 @@ void LinkResolver::lookup_method_in_klasses(methodHandle& result, KlassHandle kl
// Ignore overpasses so statics can be found during resolution
// Ignore overpasses so statics can be found during resolution
Method
*
result_oop
=
klass
->
uncached_lookup_method
(
name
,
signature
,
Klass
::
skip_overpass
);
Method
*
result_oop
=
klass
->
uncached_lookup_method
(
name
,
signature
,
Klass
::
skip_overpass
);
if
(
klass
->
oop_is_array
())
{
// Only consider klass and super klass for arrays
result
=
methodHandle
(
THREAD
,
result_oop
);
return
;
}
// JDK 8, JVMS 5.4.3.4: Interface method resolution should
// JDK 8, JVMS 5.4.3.4: Interface method resolution should
// ignore static and non-public methods of java.lang.Object,
// ignore static and non-public methods of java.lang.Object,
// like clone, finalize, registerNatives.
// like clone, finalize, registerNatives.
...
@@ -290,6 +296,11 @@ void LinkResolver::lookup_instance_method_in_klasses(methodHandle& result, Klass
...
@@ -290,6 +296,11 @@ void LinkResolver::lookup_instance_method_in_klasses(methodHandle& result, Klass
result
=
methodHandle
(
THREAD
,
super_klass
->
uncached_lookup_method
(
name
,
signature
,
Klass
::
normal
));
result
=
methodHandle
(
THREAD
,
super_klass
->
uncached_lookup_method
(
name
,
signature
,
Klass
::
normal
));
}
}
if
(
klass
->
oop_is_array
())
{
// Only consider klass and super klass for arrays
return
;
}
if
(
result
.
is_null
())
{
if
(
result
.
is_null
())
{
Array
<
Method
*>*
default_methods
=
InstanceKlass
::
cast
(
klass
())
->
default_methods
();
Array
<
Method
*>*
default_methods
=
InstanceKlass
::
cast
(
klass
())
->
default_methods
();
if
(
default_methods
!=
NULL
)
{
if
(
default_methods
!=
NULL
)
{
...
@@ -546,7 +557,7 @@ void LinkResolver::resolve_method(methodHandle& resolved_method, KlassHandle res
...
@@ -546,7 +557,7 @@ void LinkResolver::resolve_method(methodHandle& resolved_method, KlassHandle res
// 2. lookup method in resolved klass and its super klasses
// 2. lookup method in resolved klass and its super klasses
lookup_method_in_klasses
(
resolved_method
,
resolved_klass
,
method_name
,
method_signature
,
true
,
false
,
CHECK
);
lookup_method_in_klasses
(
resolved_method
,
resolved_klass
,
method_name
,
method_signature
,
true
,
false
,
CHECK
);
if
(
resolved_method
.
is_null
())
{
// not found in the class hierarchy
if
(
resolved_method
.
is_null
()
&&
!
resolved_klass
->
oop_is_array
()
)
{
// not found in the class hierarchy
// 3. lookup method in all the interfaces implemented by the resolved klass
// 3. lookup method in all the interfaces implemented by the resolved klass
lookup_method_in_interfaces
(
resolved_method
,
resolved_klass
,
method_name
,
method_signature
,
CHECK
);
lookup_method_in_interfaces
(
resolved_method
,
resolved_klass
,
method_name
,
method_signature
,
CHECK
);
...
@@ -559,16 +570,16 @@ void LinkResolver::resolve_method(methodHandle& resolved_method, KlassHandle res
...
@@ -559,16 +570,16 @@ void LinkResolver::resolve_method(methodHandle& resolved_method, KlassHandle res
CLEAR_PENDING_EXCEPTION
;
CLEAR_PENDING_EXCEPTION
;
}
}
}
}
}
if
(
resolved_method
.
is_null
())
{
if
(
resolved_method
.
is_null
())
{
// 4. method lookup failed
// 4. method lookup failed
ResourceMark
rm
(
THREAD
);
ResourceMark
rm
(
THREAD
);
THROW_MSG_CAUSE
(
vmSymbols
::
java_lang_NoSuchMethodError
(),
THROW_MSG_CAUSE
(
vmSymbols
::
java_lang_NoSuchMethodError
(),
Method
::
name_and_sig_as_C_string
(
resolved_klass
(),
Method
::
name_and_sig_as_C_string
(
resolved_klass
(),
method_name
,
method_name
,
method_signature
),
method_signature
),
nested_exception
);
nested_exception
);
}
}
}
// 5. access checks, access checking may be turned off when calling from within the VM.
// 5. access checks, access checking may be turned off when calling from within the VM.
...
@@ -634,17 +645,18 @@ void LinkResolver::resolve_interface_method(methodHandle& resolved_method,
...
@@ -634,17 +645,18 @@ void LinkResolver::resolve_interface_method(methodHandle& resolved_method,
// JDK8: also look for static methods
// JDK8: also look for static methods
lookup_method_in_klasses
(
resolved_method
,
resolved_klass
,
method_name
,
method_signature
,
false
,
true
,
CHECK
);
lookup_method_in_klasses
(
resolved_method
,
resolved_klass
,
method_name
,
method_signature
,
false
,
true
,
CHECK
);
if
(
resolved_method
.
is_null
())
{
if
(
resolved_method
.
is_null
()
&&
!
resolved_klass
->
oop_is_array
()
)
{
// lookup method in all the super-interfaces
// lookup method in all the super-interfaces
lookup_method_in_interfaces
(
resolved_method
,
resolved_klass
,
method_name
,
method_signature
,
CHECK
);
lookup_method_in_interfaces
(
resolved_method
,
resolved_klass
,
method_name
,
method_signature
,
CHECK
);
if
(
resolved_method
.
is_null
())
{
}
// no method found
ResourceMark
rm
(
THREAD
);
if
(
resolved_method
.
is_null
())
{
THROW_MSG
(
vmSymbols
::
java_lang_NoSuchMethodError
(),
// no method found
Method
::
name_and_sig_as_C_string
(
resolved_klass
(),
ResourceMark
rm
(
THREAD
);
method_name
,
THROW_MSG
(
vmSymbols
::
java_lang_NoSuchMethodError
(),
method_signature
));
Method
::
name_and_sig_as_C_string
(
resolved_klass
(),
}
method_name
,
method_signature
));
}
}
if
(
check_access
)
{
if
(
check_access
)
{
...
@@ -776,7 +788,7 @@ void LinkResolver::resolve_field(fieldDescriptor& fd, KlassHandle resolved_klass
...
@@ -776,7 +788,7 @@ void LinkResolver::resolve_field(fieldDescriptor& fd, KlassHandle resolved_klass
}
}
// Resolve instance field
// Resolve instance field
KlassHandle
sel_klass
(
THREAD
,
InstanceKlass
::
cast
(
resolved_klass
())
->
find_field
(
field
,
sig
,
&
fd
));
KlassHandle
sel_klass
(
THREAD
,
resolved_klass
->
find_field
(
field
,
sig
,
&
fd
));
// check if field exists; i.e., if a klass containing the field def has been selected
// check if field exists; i.e., if a klass containing the field def has been selected
if
(
sel_klass
.
is_null
())
{
if
(
sel_klass
.
is_null
())
{
ResourceMark
rm
(
THREAD
);
ResourceMark
rm
(
THREAD
);
...
...
src/share/vm/memory/filemap.cpp
浏览文件 @
83a2fa70
...
@@ -314,7 +314,6 @@ bool FileMapInfo::init_from_file(int fd) {
...
@@ -314,7 +314,6 @@ bool FileMapInfo::init_from_file(int fd) {
fail_continue
(
"The shared archive file has the wrong version."
);
fail_continue
(
"The shared archive file has the wrong version."
);
return
false
;
return
false
;
}
}
_file_offset
=
(
long
)
n
;
size_t
info_size
=
_header
->
_paths_misc_info_size
;
size_t
info_size
=
_header
->
_paths_misc_info_size
;
_paths_misc_info
=
NEW_C_HEAP_ARRAY_RETURN_NULL
(
char
,
info_size
,
mtClass
);
_paths_misc_info
=
NEW_C_HEAP_ARRAY_RETURN_NULL
(
char
,
info_size
,
mtClass
);
...
@@ -330,6 +329,14 @@ bool FileMapInfo::init_from_file(int fd) {
...
@@ -330,6 +329,14 @@ bool FileMapInfo::init_from_file(int fd) {
return
false
;
return
false
;
}
}
size_t
len
=
lseek
(
fd
,
0
,
SEEK_END
);
struct
FileMapInfo
::
FileMapHeader
::
space_info
*
si
=
&
_header
->
_space
[
MetaspaceShared
::
mc
];
if
(
si
->
_file_offset
>=
len
||
len
-
si
->
_file_offset
<
si
->
_used
)
{
fail_continue
(
"The shared archive file has been truncated."
);
return
false
;
}
_file_offset
+=
(
long
)
n
;
_file_offset
+=
(
long
)
n
;
return
true
;
return
true
;
}
}
...
@@ -430,6 +437,7 @@ void FileMapInfo::write_region(int region, char* base, size_t size,
...
@@ -430,6 +437,7 @@ void FileMapInfo::write_region(int region, char* base, size_t size,
si
->
_capacity
=
capacity
;
si
->
_capacity
=
capacity
;
si
->
_read_only
=
read_only
;
si
->
_read_only
=
read_only
;
si
->
_allow_exec
=
allow_exec
;
si
->
_allow_exec
=
allow_exec
;
si
->
_crc
=
ClassLoader
::
crc32
(
0
,
base
,
(
jint
)
size
);
write_bytes_aligned
(
base
,
(
int
)
size
);
write_bytes_aligned
(
base
,
(
int
)
size
);
}
}
...
@@ -454,14 +462,15 @@ void FileMapInfo::write_bytes(const void* buffer, int nbytes) {
...
@@ -454,14 +462,15 @@ void FileMapInfo::write_bytes(const void* buffer, int nbytes) {
// Align file position to an allocation unit boundary.
// Align file position to an allocation unit boundary.
void
FileMapInfo
::
align_file_position
()
{
void
FileMapInfo
::
align_file_position
()
{
long
new_file_offset
=
align_size_up
(
_file_offset
,
os
::
vm_allocation_granularity
());
size_t
new_file_offset
=
align_size_up
(
_file_offset
,
os
::
vm_allocation_granularity
());
if
(
new_file_offset
!=
_file_offset
)
{
if
(
new_file_offset
!=
_file_offset
)
{
_file_offset
=
new_file_offset
;
_file_offset
=
new_file_offset
;
if
(
_file_open
)
{
if
(
_file_open
)
{
// Seek one byte back from the target and write a byte to insure
// Seek one byte back from the target and write a byte to insure
// that the written file is the correct length.
// that the written file is the correct length.
_file_offset
-=
1
;
_file_offset
-=
1
;
if
(
lseek
(
_fd
,
_file_offset
,
SEEK_SET
)
<
0
)
{
if
(
lseek
(
_fd
,
(
long
)
_file_offset
,
SEEK_SET
)
<
0
)
{
fail_stop
(
"Unable to seek."
,
NULL
);
fail_stop
(
"Unable to seek."
,
NULL
);
}
}
char
zero
=
0
;
char
zero
=
0
;
...
@@ -568,6 +577,19 @@ char* FileMapInfo::map_region(int i) {
...
@@ -568,6 +577,19 @@ char* FileMapInfo::map_region(int i) {
return
base
;
return
base
;
}
}
bool
FileMapInfo
::
verify_region_checksum
(
int
i
)
{
if
(
!
VerifySharedSpaces
)
{
return
true
;
}
const
char
*
buf
=
_header
->
_space
[
i
].
_base
;
size_t
sz
=
_header
->
_space
[
i
].
_used
;
int
crc
=
ClassLoader
::
crc32
(
0
,
buf
,
(
jint
)
sz
);
if
(
crc
!=
_header
->
_space
[
i
].
_crc
)
{
fail_continue
(
"Checksum verification failed."
);
return
false
;
}
return
true
;
}
// Unmap a memory region in the address space.
// Unmap a memory region in the address space.
...
@@ -628,15 +650,33 @@ bool FileMapInfo::initialize() {
...
@@ -628,15 +650,33 @@ bool FileMapInfo::initialize() {
return
true
;
return
true
;
}
}
int
FileMapInfo
::
FileMapHeader
::
compute_crc
()
{
char
*
header
=
data
();
// start computing from the field after _crc
char
*
buf
=
(
char
*
)
&
_crc
+
sizeof
(
int
);
size_t
sz
=
data_size
()
-
(
buf
-
header
);
int
crc
=
ClassLoader
::
crc32
(
0
,
buf
,
(
jint
)
sz
);
return
crc
;
}
int
FileMapInfo
::
compute_header_crc
()
{
return
_header
->
compute_crc
();
}
bool
FileMapInfo
::
FileMapHeader
::
validate
()
{
bool
FileMapInfo
::
FileMapHeader
::
validate
()
{
if
(
_version
!=
current_version
())
{
FileMapInfo
::
fail_continue
(
"The shared archive file is the wrong version."
);
return
false
;
}
if
(
_magic
!=
(
int
)
0xf00baba2
)
{
if
(
_magic
!=
(
int
)
0xf00baba2
)
{
FileMapInfo
::
fail_continue
(
"The shared archive file has a bad magic number."
);
FileMapInfo
::
fail_continue
(
"The shared archive file has a bad magic number."
);
return
false
;
return
false
;
}
}
if
(
VerifySharedSpaces
&&
compute_crc
()
!=
_crc
)
{
fail_continue
(
"Header checksum verification failed."
);
return
false
;
}
if
(
_version
!=
current_version
())
{
FileMapInfo
::
fail_continue
(
"The shared archive file is the wrong version."
);
return
false
;
}
char
header_version
[
JVM_IDENT_MAX
];
char
header_version
[
JVM_IDENT_MAX
];
get_header_version
(
header_version
);
get_header_version
(
header_version
);
if
(
strncmp
(
_jvm_ident
,
header_version
,
JVM_IDENT_MAX
-
1
)
!=
0
)
{
if
(
strncmp
(
_jvm_ident
,
header_version
,
JVM_IDENT_MAX
-
1
)
!=
0
)
{
...
...
src/share/vm/memory/filemap.hpp
浏览文件 @
83a2fa70
...
@@ -61,7 +61,7 @@ private:
...
@@ -61,7 +61,7 @@ private:
bool
_file_open
;
bool
_file_open
;
int
_fd
;
int
_fd
;
long
_file_offset
;
size_t
_file_offset
;
private:
private:
static
SharedClassPathEntry
*
_classpath_entry_table
;
static
SharedClassPathEntry
*
_classpath_entry_table
;
...
@@ -87,12 +87,14 @@ public:
...
@@ -87,12 +87,14 @@ public:
}
}
int
_magic
;
// identify file type.
int
_magic
;
// identify file type.
int
_crc
;
// header crc checksum.
int
_version
;
// (from enum, above.)
int
_version
;
// (from enum, above.)
size_t
_alignment
;
// how shared archive should be aligned
size_t
_alignment
;
// how shared archive should be aligned
int
_obj_alignment
;
// value of ObjectAlignmentInBytes
int
_obj_alignment
;
// value of ObjectAlignmentInBytes
struct
space_info
{
struct
space_info
{
int
_file_offset
;
// sizeof(this) rounded to vm page size
int
_crc
;
// crc checksum of the current space
size_t
_file_offset
;
// sizeof(this) rounded to vm page size
char
*
_base
;
// copy-on-write base address
char
*
_base
;
// copy-on-write base address
size_t
_capacity
;
// for validity checking
size_t
_capacity
;
// for validity checking
size_t
_used
;
// for setting space top on read
size_t
_used
;
// for setting space top on read
...
@@ -135,6 +137,7 @@ public:
...
@@ -135,6 +137,7 @@ public:
virtual
bool
validate
();
virtual
bool
validate
();
virtual
void
populate
(
FileMapInfo
*
info
,
size_t
alignment
);
virtual
void
populate
(
FileMapInfo
*
info
,
size_t
alignment
);
int
compute_crc
();
};
};
FileMapHeader
*
_header
;
FileMapHeader
*
_header
;
...
@@ -153,6 +156,8 @@ public:
...
@@ -153,6 +156,8 @@ public:
~
FileMapInfo
();
~
FileMapInfo
();
static
int
current_version
()
{
return
_current_version
;
}
static
int
current_version
()
{
return
_current_version
;
}
int
compute_header_crc
();
void
set_header_crc
(
int
crc
)
{
_header
->
_crc
=
crc
;
}
void
populate_header
(
size_t
alignment
);
void
populate_header
(
size_t
alignment
);
bool
validate_header
();
bool
validate_header
();
void
invalidate
();
void
invalidate
();
...
@@ -181,6 +186,7 @@ public:
...
@@ -181,6 +186,7 @@ public:
void
write_bytes_aligned
(
const
void
*
buffer
,
int
count
);
void
write_bytes_aligned
(
const
void
*
buffer
,
int
count
);
char
*
map_region
(
int
i
);
char
*
map_region
(
int
i
);
void
unmap_region
(
int
i
);
void
unmap_region
(
int
i
);
bool
verify_region_checksum
(
int
i
);
void
close
();
void
close
();
bool
is_open
()
{
return
_file_open
;
}
bool
is_open
()
{
return
_file_open
;
}
ReservedSpace
reserve_shared_memory
();
ReservedSpace
reserve_shared_memory
();
...
...
src/share/vm/memory/metaspaceShared.cpp
浏览文件 @
83a2fa70
...
@@ -607,6 +607,7 @@ void VM_PopulateDumpSharedSpace::doit() {
...
@@ -607,6 +607,7 @@ void VM_PopulateDumpSharedSpace::doit() {
// Pass 2 - write data.
// Pass 2 - write data.
mapinfo
->
open_for_write
();
mapinfo
->
open_for_write
();
mapinfo
->
set_header_crc
(
mapinfo
->
compute_header_crc
());
mapinfo
->
write_header
();
mapinfo
->
write_header
();
mapinfo
->
write_space
(
MetaspaceShared
::
ro
,
_loader_data
->
ro_metaspace
(),
true
);
mapinfo
->
write_space
(
MetaspaceShared
::
ro
,
_loader_data
->
ro_metaspace
(),
true
);
mapinfo
->
write_space
(
MetaspaceShared
::
rw
,
_loader_data
->
rw_metaspace
(),
false
);
mapinfo
->
write_space
(
MetaspaceShared
::
rw
,
_loader_data
->
rw_metaspace
(),
false
);
...
@@ -936,9 +937,13 @@ bool MetaspaceShared::map_shared_spaces(FileMapInfo* mapinfo) {
...
@@ -936,9 +937,13 @@ bool MetaspaceShared::map_shared_spaces(FileMapInfo* mapinfo) {
// Map each shared region
// Map each shared region
if
((
_ro_base
=
mapinfo
->
map_region
(
ro
))
!=
NULL
&&
if
((
_ro_base
=
mapinfo
->
map_region
(
ro
))
!=
NULL
&&
mapinfo
->
verify_region_checksum
(
ro
)
&&
(
_rw_base
=
mapinfo
->
map_region
(
rw
))
!=
NULL
&&
(
_rw_base
=
mapinfo
->
map_region
(
rw
))
!=
NULL
&&
mapinfo
->
verify_region_checksum
(
rw
)
&&
(
_md_base
=
mapinfo
->
map_region
(
md
))
!=
NULL
&&
(
_md_base
=
mapinfo
->
map_region
(
md
))
!=
NULL
&&
mapinfo
->
verify_region_checksum
(
md
)
&&
(
_mc_base
=
mapinfo
->
map_region
(
mc
))
!=
NULL
&&
(
_mc_base
=
mapinfo
->
map_region
(
mc
))
!=
NULL
&&
mapinfo
->
verify_region_checksum
(
mc
)
&&
(
image_alignment
==
(
size_t
)
max_alignment
())
&&
(
image_alignment
==
(
size_t
)
max_alignment
())
&&
mapinfo
->
validate_classpath_entry_table
())
{
mapinfo
->
validate_classpath_entry_table
())
{
// Success (no need to do anything)
// Success (no need to do anything)
...
...
src/share/vm/oops/arrayKlass.cpp
浏览文件 @
83a2fa70
...
@@ -64,6 +64,13 @@ oop ArrayKlass::multi_allocate(int rank, jint* sizes, TRAPS) {
...
@@ -64,6 +64,13 @@ oop ArrayKlass::multi_allocate(int rank, jint* sizes, TRAPS) {
return
NULL
;
return
NULL
;
}
}
// find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined
Klass
*
ArrayKlass
::
find_field
(
Symbol
*
name
,
Symbol
*
sig
,
fieldDescriptor
*
fd
)
const
{
// There are no fields in an array klass but look to the super class (Object)
assert
(
super
(),
"super klass must be present"
);
return
super
()
->
find_field
(
name
,
sig
,
fd
);
}
Method
*
ArrayKlass
::
uncached_lookup_method
(
Symbol
*
name
,
Symbol
*
signature
,
MethodLookupMode
mode
)
const
{
Method
*
ArrayKlass
::
uncached_lookup_method
(
Symbol
*
name
,
Symbol
*
signature
,
MethodLookupMode
mode
)
const
{
// There are no methods in an array klass but the super class (Object) has some
// There are no methods in an array klass but the super class (Object) has some
assert
(
super
(),
"super klass must be present"
);
assert
(
super
(),
"super klass must be present"
);
...
...
src/share/vm/oops/arrayKlass.hpp
浏览文件 @
83a2fa70
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include "memory/universe.hpp"
#include "memory/universe.hpp"
#include "oops/klass.hpp"
#include "oops/klass.hpp"
class
fieldDescriptor
;
class
klassVtable
;
class
klassVtable
;
// ArrayKlass is the abstract baseclass for all array classes
// ArrayKlass is the abstract baseclass for all array classes
...
@@ -85,6 +86,9 @@ class ArrayKlass: public Klass {
...
@@ -85,6 +86,9 @@ class ArrayKlass: public Klass {
virtual
oop
multi_allocate
(
int
rank
,
jint
*
sizes
,
TRAPS
);
virtual
oop
multi_allocate
(
int
rank
,
jint
*
sizes
,
TRAPS
);
objArrayOop
allocate_arrayArray
(
int
n
,
int
length
,
TRAPS
);
objArrayOop
allocate_arrayArray
(
int
n
,
int
length
,
TRAPS
);
// find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined
Klass
*
find_field
(
Symbol
*
name
,
Symbol
*
sig
,
fieldDescriptor
*
fd
)
const
;
// Lookup operations
// Lookup operations
Method
*
uncached_lookup_method
(
Symbol
*
name
,
Symbol
*
signature
,
MethodLookupMode
mode
)
const
;
Method
*
uncached_lookup_method
(
Symbol
*
name
,
Symbol
*
signature
,
MethodLookupMode
mode
)
const
;
...
...
src/share/vm/oops/klass.cpp
浏览文件 @
83a2fa70
...
@@ -130,6 +130,15 @@ bool Klass::compute_is_subtype_of(Klass* k) {
...
@@ -130,6 +130,15 @@ bool Klass::compute_is_subtype_of(Klass* k) {
return
is_subclass_of
(
k
);
return
is_subclass_of
(
k
);
}
}
Klass
*
Klass
::
find_field
(
Symbol
*
name
,
Symbol
*
sig
,
fieldDescriptor
*
fd
)
const
{
#ifdef ASSERT
tty
->
print_cr
(
"Error: find_field called on a klass oop."
" Likely error: reflection method does not correctly"
" wrap return value in a mirror object."
);
#endif
ShouldNotReachHere
();
return
NULL
;
}
Method
*
Klass
::
uncached_lookup_method
(
Symbol
*
name
,
Symbol
*
signature
,
MethodLookupMode
mode
)
const
{
Method
*
Klass
::
uncached_lookup_method
(
Symbol
*
name
,
Symbol
*
signature
,
MethodLookupMode
mode
)
const
{
#ifdef ASSERT
#ifdef ASSERT
...
...
src/share/vm/oops/klass.hpp
浏览文件 @
83a2fa70
...
@@ -90,6 +90,7 @@ class ClassLoaderData;
...
@@ -90,6 +90,7 @@ class ClassLoaderData;
class
klassVtable
;
class
klassVtable
;
class
ParCompactionManager
;
class
ParCompactionManager
;
class
KlassSizeStats
;
class
KlassSizeStats
;
class
fieldDescriptor
;
class
Klass
:
public
Metadata
{
class
Klass
:
public
Metadata
{
friend
class
VMStructs
;
friend
class
VMStructs
;
...
@@ -441,6 +442,7 @@ protected:
...
@@ -441,6 +442,7 @@ protected:
virtual
void
initialize
(
TRAPS
);
virtual
void
initialize
(
TRAPS
);
// lookup operation for MethodLookupCache
// lookup operation for MethodLookupCache
friend
class
MethodLookupCache
;
friend
class
MethodLookupCache
;
virtual
Klass
*
find_field
(
Symbol
*
name
,
Symbol
*
signature
,
fieldDescriptor
*
fd
)
const
;
virtual
Method
*
uncached_lookup_method
(
Symbol
*
name
,
Symbol
*
signature
,
MethodLookupMode
mode
)
const
;
virtual
Method
*
uncached_lookup_method
(
Symbol
*
name
,
Symbol
*
signature
,
MethodLookupMode
mode
)
const
;
public:
public:
Method
*
lookup_method
(
Symbol
*
name
,
Symbol
*
signature
)
const
{
Method
*
lookup_method
(
Symbol
*
name
,
Symbol
*
signature
)
const
{
...
...
src/share/vm/prims/jvm.cpp
浏览文件 @
83a2fa70
...
@@ -808,6 +808,7 @@ JVM_ENTRY(jclass, JVM_FindClassFromBootLoader(JNIEnv* env,
...
@@ -808,6 +808,7 @@ JVM_ENTRY(jclass, JVM_FindClassFromBootLoader(JNIEnv* env,
return
(
jclass
)
JNIHandles
::
make_local
(
env
,
k
->
java_mirror
());
return
(
jclass
)
JNIHandles
::
make_local
(
env
,
k
->
java_mirror
());
JVM_END
JVM_END
// Not used; JVM_FindClassFromCaller replaces this.
JVM_ENTRY
(
jclass
,
JVM_FindClassFromClassLoader
(
JNIEnv
*
env
,
const
char
*
name
,
JVM_ENTRY
(
jclass
,
JVM_FindClassFromClassLoader
(
JNIEnv
*
env
,
const
char
*
name
,
jboolean
init
,
jobject
loader
,
jboolean
init
,
jobject
loader
,
jboolean
throwError
))
jboolean
throwError
))
...
@@ -834,6 +835,42 @@ JVM_ENTRY(jclass, JVM_FindClassFromClassLoader(JNIEnv* env, const char* name,
...
@@ -834,6 +835,42 @@ JVM_ENTRY(jclass, JVM_FindClassFromClassLoader(JNIEnv* env, const char* name,
return
result
;
return
result
;
JVM_END
JVM_END
// Find a class with this name in this loader, using the caller's protection domain.
JVM_ENTRY
(
jclass
,
JVM_FindClassFromCaller
(
JNIEnv
*
env
,
const
char
*
name
,
jboolean
init
,
jobject
loader
,
jclass
caller
))
JVMWrapper2
(
"JVM_FindClassFromCaller %s throws ClassNotFoundException"
,
name
);
// Java libraries should ensure that name is never null...
if
(
name
==
NULL
||
(
int
)
strlen
(
name
)
>
Symbol
::
max_length
())
{
// It's impossible to create this class; the name cannot fit
// into the constant pool.
THROW_MSG_0
(
vmSymbols
::
java_lang_ClassNotFoundException
(),
name
);
}
TempNewSymbol
h_name
=
SymbolTable
::
new_symbol
(
name
,
CHECK_NULL
);
oop
loader_oop
=
JNIHandles
::
resolve
(
loader
);
oop
from_class
=
JNIHandles
::
resolve
(
caller
);
oop
protection_domain
=
NULL
;
// If loader is null, shouldn't call ClassLoader.checkPackageAccess; otherwise get
// NPE. Put it in another way, the bootstrap class loader has all permission and
// thus no checkPackageAccess equivalence in the VM class loader.
// The caller is also passed as NULL by the java code if there is no security
// manager to avoid the performance cost of getting the calling class.
if
(
from_class
!=
NULL
&&
loader_oop
!=
NULL
)
{
protection_domain
=
java_lang_Class
::
as_Klass
(
from_class
)
->
protection_domain
();
}
Handle
h_loader
(
THREAD
,
loader_oop
);
Handle
h_prot
(
THREAD
,
protection_domain
);
jclass
result
=
find_class_from_class_loader
(
env
,
h_name
,
init
,
h_loader
,
h_prot
,
false
,
THREAD
);
if
(
TraceClassResolution
&&
result
!=
NULL
)
{
trace_class_resolution
(
java_lang_Class
::
as_Klass
(
JNIHandles
::
resolve_non_null
(
result
)));
}
return
result
;
JVM_END
JVM_ENTRY
(
jclass
,
JVM_FindClassFromClass
(
JNIEnv
*
env
,
const
char
*
name
,
JVM_ENTRY
(
jclass
,
JVM_FindClassFromClass
(
JNIEnv
*
env
,
const
char
*
name
,
jboolean
init
,
jclass
from
))
jboolean
init
,
jclass
from
))
...
@@ -3997,10 +4034,15 @@ void initialize_converter_functions() {
...
@@ -3997,10 +4034,15 @@ void initialize_converter_functions() {
// Shared JNI/JVM entry points //////////////////////////////////////////////////////////////
// Shared JNI/JVM entry points //////////////////////////////////////////////////////////////
jclass
find_class_from_class_loader
(
JNIEnv
*
env
,
Symbol
*
name
,
jboolean
init
,
Handle
loader
,
Handle
protection_domain
,
jboolean
throwError
,
TRAPS
)
{
jclass
find_class_from_class_loader
(
JNIEnv
*
env
,
Symbol
*
name
,
jboolean
init
,
Handle
loader
,
Handle
protection_domain
,
jboolean
throwError
,
TRAPS
)
{
// Security Note:
// Security Note:
// The Java level wrapper will perform the necessary security check allowing
// The Java level wrapper will perform the necessary security check allowing
// us to pass the NULL as the initiating class loader.
// us to pass the NULL as the initiating class loader. The VM is responsible for
// the checkPackageAccess relative to the initiating class loader via the
// protection_domain. The protection_domain is passed as NULL by the java code
// if there is no security manager in 3-arg Class.forName().
Klass
*
klass
=
SystemDictionary
::
resolve_or_fail
(
name
,
loader
,
protection_domain
,
throwError
!=
0
,
CHECK_NULL
);
Klass
*
klass
=
SystemDictionary
::
resolve_or_fail
(
name
,
loader
,
protection_domain
,
throwError
!=
0
,
CHECK_NULL
);
KlassHandle
klass_handle
(
THREAD
,
klass
);
KlassHandle
klass_handle
(
THREAD
,
klass
);
...
...
src/share/vm/prims/jvm.h
浏览文件 @
83a2fa70
/*
/*
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -419,6 +419,19 @@ JVM_FindClassFromClassLoader(JNIEnv *env, const char *name, jboolean init,
...
@@ -419,6 +419,19 @@ JVM_FindClassFromClassLoader(JNIEnv *env, const char *name, jboolean init,
JNIEXPORT
jclass
JNICALL
JNIEXPORT
jclass
JNICALL
JVM_FindClassFromBootLoader
(
JNIEnv
*
env
,
const
char
*
name
);
JVM_FindClassFromBootLoader
(
JNIEnv
*
env
,
const
char
*
name
);
/*
* Find a class from a given class loader. Throws ClassNotFoundException.
* name: name of class
* init: whether initialization is done
* loader: class loader to look up the class. This may not be the same as the caller's
* class loader.
* caller: initiating class. The initiating class may be null when a security
* manager is not installed.
*/
JNIEXPORT
jclass
JNICALL
JVM_FindClassFromCaller
(
JNIEnv
*
env
,
const
char
*
name
,
jboolean
init
,
jobject
loader
,
jclass
caller
);
/*
/*
* Find a class from a given class.
* Find a class from a given class.
*/
*/
...
...
src/share/vm/runtime/arguments.cpp
浏览文件 @
83a2fa70
...
@@ -2448,6 +2448,10 @@ bool Arguments::check_vm_args_consistency() {
...
@@ -2448,6 +2448,10 @@ bool Arguments::check_vm_args_consistency() {
warning
(
"The VM option CICompilerCountPerCPU overrides CICompilerCount."
);
warning
(
"The VM option CICompilerCountPerCPU overrides CICompilerCount."
);
}
}
#ifdef COMPILER1
status
&=
verify_interval
(
SafepointPollOffset
,
0
,
os
::
vm_page_size
()
-
BytesPerWord
,
"SafepointPollOffset"
);
#endif
return
status
;
return
status
;
}
}
...
@@ -3701,6 +3705,11 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
...
@@ -3701,6 +3705,11 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
return
JNI_ENOMEM
;
return
JNI_ENOMEM
;
}
}
// Set up VerifySharedSpaces
if
(
FLAG_IS_DEFAULT
(
VerifySharedSpaces
)
&&
SharedArchiveFile
!=
NULL
)
{
VerifySharedSpaces
=
true
;
}
// Delay warning until here so that we've had a chance to process
// Delay warning until here so that we've had a chance to process
// the -XX:-PrintWarnings flag
// the -XX:-PrintWarnings flag
if
(
needs_hotspotrc_warning
)
{
if
(
needs_hotspotrc_warning
)
{
...
...
src/share/vm/runtime/globals.hpp
浏览文件 @
83a2fa70
...
@@ -1154,11 +1154,11 @@ class CommandLineFlags {
...
@@ -1154,11 +1154,11 @@ class CommandLineFlags {
"Prevent spurious or premature wakeups from object.wait " \
"Prevent spurious or premature wakeups from object.wait " \
"(Solaris only)") \
"(Solaris only)") \
\
\
product(intx, NativeMonitorTimeout, -1, "(Unstable)")
\
experimental(intx, NativeMonitorTimeout, -1, "(Unstable)")
\
\
\
product(intx, NativeMonitorFlags, 0, "(Unstable)")
\
experimental(intx, NativeMonitorFlags, 0, "(Unstable)")
\
\
\
product(intx, NativeMonitorSpinLimit, 20, "(Unstable)")
\
experimental(intx, NativeMonitorSpinLimit, 20, "(Unstable)")
\
\
\
develop(bool, UsePthreads, false, \
develop(bool, UsePthreads, false, \
"Use pthread-based instead of libthread-based synchronization " \
"Use pthread-based instead of libthread-based synchronization " \
...
@@ -3775,6 +3775,10 @@ class CommandLineFlags {
...
@@ -3775,6 +3775,10 @@ class CommandLineFlags {
product(bool, UseSharedSpaces, true, \
product(bool, UseSharedSpaces, true, \
"Use shared spaces for metadata") \
"Use shared spaces for metadata") \
\
\
product(bool, VerifySharedSpaces, false, \
"Verify shared spaces (false for default archive, true for " \
"archive specified by -XX:SharedArchiveFile)") \
\
product(bool, RequireSharedSpaces, false, \
product(bool, RequireSharedSpaces, false, \
"Require shared spaces for metadata") \
"Require shared spaces for metadata") \
\
\
...
...
src/share/vm/runtime/reflection.cpp
浏览文件 @
83a2fa70
/*
/*
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -482,7 +482,7 @@ static bool under_host_klass(InstanceKlass* ik, Klass* host_klass) {
...
@@ -482,7 +482,7 @@ static bool under_host_klass(InstanceKlass* ik, Klass* host_klass) {
ik
=
InstanceKlass
::
cast
(
hc
);
ik
=
InstanceKlass
::
cast
(
hc
);
// There's no way to make a host class loop short of patching memory.
// There's no way to make a host class loop short of patching memory.
// Therefore there cannot be a loop here unles there's another bug.
// Therefore there cannot be a loop here unles
s
there's another bug.
// Still, let's check for it.
// Still, let's check for it.
assert
(
--
inf_loop_check
>
0
,
"no host_klass loop"
);
assert
(
--
inf_loop_check
>
0
,
"no host_klass loop"
);
}
}
...
@@ -551,7 +551,8 @@ bool Reflection::verify_field_access(Klass* current_class,
...
@@ -551,7 +551,8 @@ bool Reflection::verify_field_access(Klass* current_class,
if
(
access
.
is_protected
())
{
if
(
access
.
is_protected
())
{
if
(
!
protected_restriction
)
{
if
(
!
protected_restriction
)
{
// See if current_class (or outermost host class) is a subclass of field_class
// See if current_class (or outermost host class) is a subclass of field_class
if
(
host_class
->
is_subclass_of
(
field_class
))
{
// An interface may not access protected members of j.l.Object
if
(
!
host_class
->
is_interface
()
&&
host_class
->
is_subclass_of
(
field_class
))
{
if
(
access
.
is_static
()
||
// static fields are ok, see 6622385
if
(
access
.
is_static
()
||
// static fields are ok, see 6622385
current_class
==
resolved_class
||
current_class
==
resolved_class
||
field_class
==
resolved_class
||
field_class
==
resolved_class
||
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录