mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-06 14:10:36 +00:00
Merge
This commit is contained in:
commit
2e4cd63893
1
.hgtags
1
.hgtags
@ -356,3 +356,4 @@ c870cb782aca71093d2584376f27f0cfbfec0e3a jdk-9+109
|
||||
a6614ff7bf09da74be1d0ef3d9755090d244697a jdk-9+111
|
||||
7359994942f8d8e723b584d66a3a92c2e9e95e5c jdk-9+112
|
||||
6072af7a98be3922f26bdce71b53bb3646cb2ac9 jdk-9+113
|
||||
c84d0cce090e161d736de69e941830adf8c2f87a jdk-9+114
|
||||
|
||||
@ -356,3 +356,4 @@ c7be2a78c31b3b6132f2f5e9e4b3d3bb1c20245c jdk-9+108
|
||||
f900d5afd9c83a0df8f36161c27c5e4c86a66f4c jdk-9+111
|
||||
03543a758cd5890f2266e4b9678378a925dde22a jdk-9+112
|
||||
55b6d550828d1223b364e6ead4a56e56411c56df jdk-9+113
|
||||
1d992540870ff33fe6cc550443388588df9b9e4f jdk-9+114
|
||||
|
||||
@ -305,7 +305,7 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
|
||||
BOOT_JDK_SOURCETARGET="-source 8 -target 8"
|
||||
AC_SUBST(BOOT_JDK_SOURCETARGET)
|
||||
|
||||
ADD_JVM_ARG_IF_OK([-Xpatch:], dummy, [$JAVA])
|
||||
ADD_JVM_ARG_IF_OK([-Xpatch:foo=bar], dummy, [$JAVA])
|
||||
AC_MSG_CHECKING([if Boot JDK supports modules])
|
||||
if test "x$JVM_ARG_OK" = "xtrue"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
@ -444,9 +444,9 @@ AC_DEFUN([BOOTJDK_CHECK_BUILD_JDK],
|
||||
BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | head -n 1`
|
||||
|
||||
# Extra M4 quote needed to protect [] in grep expression.
|
||||
[FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | grep '\"1\.[9]\.'`]
|
||||
[FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"'`]
|
||||
if test "x$FOUND_CORRECT_VERSION" = x; then
|
||||
AC_MSG_NOTICE([Potential Boot JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring])
|
||||
AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring])
|
||||
AC_MSG_NOTICE([(Your Build JDK must be version 9)])
|
||||
BUILD_JDK_FOUND=no
|
||||
else
|
||||
|
||||
@ -454,7 +454,7 @@ AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
|
||||
AC_MSG_RESULT([$ENABLE_JAVAC_SERVER])
|
||||
AC_SUBST(ENABLE_JAVAC_SERVER)
|
||||
|
||||
if test "x$ENABLE_JAVAC_SERVER" = "xyes" || "x$ENABLE_SJAVAC" = "xyes"; then
|
||||
if test "x$ENABLE_JAVAC_SERVER" = "xyes" || test "x$ENABLE_SJAVAC" = "xyes"; then
|
||||
# When using a server javac, the small client instances do not need much
|
||||
# resources.
|
||||
JAVA_FLAGS_JAVAC="$JAVA_FLAGS_SMALL"
|
||||
|
||||
@ -227,6 +227,7 @@ LIB_SETUP_LIBRARIES
|
||||
|
||||
HOTSPOT_SETUP_BUILD_TWEAKS
|
||||
JDKOPT_DETECT_INTREE_EC
|
||||
JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
|
||||
@ -650,6 +650,7 @@ TEST_JOBS
|
||||
JOBS
|
||||
MEMORY_SIZE
|
||||
NUM_CORES
|
||||
BUILD_FAILURE_HANDLER
|
||||
ENABLE_INTREE_EC
|
||||
HOTSPOT_MAKE_ARGS
|
||||
LIBZIP_CAN_USE_MMAP
|
||||
@ -1172,6 +1173,7 @@ with_lcms
|
||||
with_dxsdk
|
||||
with_dxsdk_lib
|
||||
with_dxsdk_include
|
||||
enable_jtreg_failure_handler
|
||||
with_num_cores
|
||||
with_memory_size
|
||||
with_jobs
|
||||
@ -1940,6 +1942,12 @@ Optional Features:
|
||||
disable bundling of the freetype library with the
|
||||
build result [enabled on Windows or when using
|
||||
--with-freetype, disabled otherwise]
|
||||
--enable-jtreg-failure-handler
|
||||
forces build of the jtreg failure handler to be
|
||||
enabled, missing dependencies become fatal errors.
|
||||
Default is auto, where the failure handler is built
|
||||
if all dependencies are present and otherwise just
|
||||
disabled.
|
||||
--enable-sjavac use sjavac to do fast incremental compiles
|
||||
[disabled]
|
||||
--disable-javac-server disable javac server [enabled]
|
||||
@ -4274,6 +4282,12 @@ pkgadd_help() {
|
||||
#
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Check if building of the jtreg failure handler should be enabled.
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
@ -4950,7 +4964,7 @@ VS_SDK_PLATFORM_NAME_2013=
|
||||
#CUSTOM_AUTOCONF_INCLUDE
|
||||
|
||||
# Do not change or remove the following line, it is needed for consistency checks:
|
||||
DATE_WHEN_GENERATED=1458755892
|
||||
DATE_WHEN_GENERATED=1460963400
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
@ -29770,13 +29784,13 @@ $as_echo "$tool_specified" >&6; }
|
||||
|
||||
|
||||
|
||||
$ECHO "Check if jvm arg is ok: -Xpatch:" >&5
|
||||
$ECHO "Command: $JAVA -Xpatch: -version" >&5
|
||||
OUTPUT=`$JAVA -Xpatch: -version 2>&1`
|
||||
$ECHO "Check if jvm arg is ok: -Xpatch:foo=bar" >&5
|
||||
$ECHO "Command: $JAVA -Xpatch:foo=bar -version" >&5
|
||||
OUTPUT=`$JAVA -Xpatch:foo=bar -version 2>&1`
|
||||
FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
|
||||
FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
|
||||
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
|
||||
dummy="$dummy -Xpatch:"
|
||||
dummy="$dummy -Xpatch:foo=bar"
|
||||
JVM_ARG_OK=true
|
||||
else
|
||||
$ECHO "Arg failed:" >&5
|
||||
@ -29856,10 +29870,10 @@ $as_echo "$as_me: (This might be a JRE instead of an JDK)" >&6;}
|
||||
BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | head -n 1`
|
||||
|
||||
# Extra M4 quote needed to protect [] in grep expression.
|
||||
FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | grep '\"1\.[9]\.'`
|
||||
FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"'`
|
||||
if test "x$FOUND_CORRECT_VERSION" = x; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring" >&5
|
||||
$as_echo "$as_me: Potential Boot JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring" >&6;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Build JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring" >&5
|
||||
$as_echo "$as_me: Potential Build JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring" >&6;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: (Your Build JDK must be version 9)" >&5
|
||||
$as_echo "$as_me: (Your Build JDK must be version 9)" >&6;}
|
||||
BUILD_JDK_FOUND=no
|
||||
@ -62037,6 +62051,45 @@ $as_echo "no" >&6; }
|
||||
|
||||
|
||||
|
||||
# Check whether --enable-jtreg-failure-handler was given.
|
||||
if test "${enable_jtreg_failure_handler+set}" = set; then :
|
||||
enableval=$enable_jtreg_failure_handler;
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if jtreg failure handler should be built" >&5
|
||||
$as_echo_n "checking if jtreg failure handler should be built... " >&6; }
|
||||
|
||||
if test "x$enable_jtreg_failure_handler" = "xyes"; then
|
||||
if test "x$JT_HOME" = "x"; then
|
||||
as_fn_error $? "Cannot enable jtreg failure handler without jtreg." "$LINENO" 5
|
||||
else
|
||||
BUILD_FAILURE_HANDLER=true
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, forced" >&5
|
||||
$as_echo "yes, forced" >&6; }
|
||||
fi
|
||||
elif test "x$enable_jtreg_failure_handler" = "xno"; then
|
||||
BUILD_FAILURE_HANDLER=false
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no, forced" >&5
|
||||
$as_echo "no, forced" >&6; }
|
||||
elif test "x$enable_jtreg_failure_handler" = "xauto" \
|
||||
|| test "x$enable_jtreg_failure_handler" = "x"; then
|
||||
if test "x$JT_HOME" = "x"; then
|
||||
BUILD_FAILURE_HANDLER=false
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no, missing jtreg" >&5
|
||||
$as_echo "no, missing jtreg" >&6; }
|
||||
else
|
||||
BUILD_FAILURE_HANDLER=true
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, jtreg present" >&5
|
||||
$as_echo "yes, jtreg present" >&6; }
|
||||
fi
|
||||
else
|
||||
as_fn_error $? "Invalid value for --enable-jtreg-failure-handler: $enable_jtreg_failure_handler" "$LINENO" 5
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Configure parts of the build that only affect the build performance,
|
||||
@ -62510,7 +62563,7 @@ $as_echo_n "checking whether to use javac server... " >&6; }
|
||||
$as_echo "$ENABLE_JAVAC_SERVER" >&6; }
|
||||
|
||||
|
||||
if test "x$ENABLE_JAVAC_SERVER" = "xyes" || "x$ENABLE_SJAVAC" = "xyes"; then
|
||||
if test "x$ENABLE_JAVAC_SERVER" = "xyes" || test "x$ENABLE_SJAVAC" = "xyes"; then
|
||||
# When using a server javac, the small client instances do not need much
|
||||
# resources.
|
||||
JAVA_FLAGS_JAVAC="$JAVA_FLAGS_SMALL"
|
||||
|
||||
@ -408,7 +408,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_STATIC_BUILD],
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# jlink options.
|
||||
# jlink options.
|
||||
# We always keep packaged modules in JDK image.
|
||||
#
|
||||
AC_DEFUN_ONCE([JDKOPT_SETUP_JLINK_OPTIONS],
|
||||
@ -433,3 +433,42 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JLINK_OPTIONS],
|
||||
|
||||
AC_SUBST(JLINK_KEEP_PACKAGED_MODULES)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Check if building of the jtreg failure handler should be enabled.
|
||||
#
|
||||
AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER],
|
||||
[
|
||||
AC_ARG_ENABLE([jtreg-failure-handler], [AS_HELP_STRING([--enable-jtreg-failure-handler],
|
||||
[forces build of the jtreg failure handler to be enabled, missing dependencies
|
||||
become fatal errors. Default is auto, where the failure handler is built if all
|
||||
dependencies are present and otherwise just disabled.])])
|
||||
|
||||
AC_MSG_CHECKING([if jtreg failure handler should be built])
|
||||
|
||||
if test "x$enable_jtreg_failure_handler" = "xyes"; then
|
||||
if test "x$JT_HOME" = "x"; then
|
||||
AC_MSG_ERROR([Cannot enable jtreg failure handler without jtreg.])
|
||||
else
|
||||
BUILD_FAILURE_HANDLER=true
|
||||
AC_MSG_RESULT([yes, forced])
|
||||
fi
|
||||
elif test "x$enable_jtreg_failure_handler" = "xno"; then
|
||||
BUILD_FAILURE_HANDLER=false
|
||||
AC_MSG_RESULT([no, forced])
|
||||
elif test "x$enable_jtreg_failure_handler" = "xauto" \
|
||||
|| test "x$enable_jtreg_failure_handler" = "x"; then
|
||||
if test "x$JT_HOME" = "x"; then
|
||||
BUILD_FAILURE_HANDLER=false
|
||||
AC_MSG_RESULT([no, missing jtreg])
|
||||
else
|
||||
BUILD_FAILURE_HANDLER=true
|
||||
AC_MSG_RESULT([yes, jtreg present])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([Invalid value for --enable-jtreg-failure-handler: $enable_jtreg_failure_handler])
|
||||
fi
|
||||
|
||||
AC_SUBST(BUILD_FAILURE_HANDLER)
|
||||
])
|
||||
|
||||
@ -260,6 +260,8 @@ HOTSPOT_DIST=@HOTSPOT_DIST@
|
||||
|
||||
BUILD_HOTSPOT=@BUILD_HOTSPOT@
|
||||
|
||||
BUILD_FAILURE_HANDLER := @BUILD_FAILURE_HANDLER@
|
||||
|
||||
# The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
|
||||
# it in sync.
|
||||
BOOT_JDK:=@BOOT_JDK@
|
||||
|
||||
@ -41,7 +41,7 @@ if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
|
||||
STAT_PRINT_SIZE="-f %z"
|
||||
elif [ "$OPENJDK_TARGET_OS" = "windows" ]; then
|
||||
FULLDUMP_CMD="$DUMPBIN -all"
|
||||
LDD_CMD="$DUMPBIN -dependants | $GREP .dll"
|
||||
LDD_CMD="$DUMPBIN -dependents"
|
||||
DIS_CMD="$DUMPBIN -disasm:nobytes"
|
||||
STAT_PRINT_SIZE="-c %s"
|
||||
elif [ "$OPENJDK_TARGET_OS" = "aix" ]; then
|
||||
@ -824,12 +824,25 @@ compare_bin_file() {
|
||||
|
||||
# Check dependencies
|
||||
if [ -n "$LDD_CMD" ]; then
|
||||
(cd $FILE_WORK_DIR && $CP $OTHER_FILE . && $LDD_CMD $NAME 2>/dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.other | $UNIQ > $WORK_FILE_BASE.deps.other.uniq)
|
||||
(cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME 2</dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.this | $UNIQ > $WORK_FILE_BASE.deps.this.uniq)
|
||||
if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
|
||||
LDD_FILTER="$GREP \.dll"
|
||||
else
|
||||
LDD_FILTER="$CAT"
|
||||
fi
|
||||
(cd $FILE_WORK_DIR && $CP $OTHER_FILE . && $LDD_CMD $NAME 2>/dev/null \
|
||||
| $LDD_FILTER | $AWK '{ print $1;}' | $SORT \
|
||||
| $TEE $WORK_FILE_BASE.deps.other \
|
||||
| $UNIQ > $WORK_FILE_BASE.deps.other.uniq)
|
||||
(cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME 2</dev/null \
|
||||
| $LDD_FILTER | $AWK '{ print $1;}' | $SORT \
|
||||
| $TEE $WORK_FILE_BASE.deps.this \
|
||||
| $UNIQ > $WORK_FILE_BASE.deps.this.uniq)
|
||||
(cd $FILE_WORK_DIR && $RM -f $NAME)
|
||||
|
||||
LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff
|
||||
LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq
|
||||
LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this \
|
||||
> $WORK_FILE_BASE.deps.diff
|
||||
LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq \
|
||||
> $WORK_FILE_BASE.deps.diff.uniq
|
||||
|
||||
if [ -s $WORK_FILE_BASE.deps.diff ]; then
|
||||
if [ -s $WORK_FILE_BASE.deps.diff.uniq ]; then
|
||||
|
||||
@ -214,7 +214,7 @@ var getJibProfiles = function (input) {
|
||||
var getJibProfilesCommon = function (input) {
|
||||
var common = {
|
||||
dependencies: ["boot_jdk", "gnumake", "jtreg"],
|
||||
configure_args: ["--with-default-make-target=all"],
|
||||
configure_args: ["--with-default-make-target=all", "--enable-jtreg-failure-handler"],
|
||||
configure_args_32bit: ["--with-target-bits=32", "--with-jvm-variants=client,server"],
|
||||
configure_args_debug: ["--enable-debug"],
|
||||
configure_args_slowdebug: ["--with-debug-level=slowdebug"],
|
||||
|
||||
@ -356,3 +356,4 @@ b75afa17aefe480c23c616a6a2497063312f7189 jdk-9+109
|
||||
2bb92dd44275679edb29fdbffc3b7cbebc9a6bf0 jdk-9+111
|
||||
780d0620add32bf545471cf65038c9ac6d9c036d jdk-9+112
|
||||
cc30faa2da498c478e89ab062ff160653ca1b170 jdk-9+113
|
||||
10d175b0368c30f54350fc648adc41b94ce357ee jdk-9+114
|
||||
|
||||
@ -37,7 +37,7 @@ import java.security.Permission;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import jdk.internal.misc.Unsafe ;
|
||||
import sun.reflect.ReflectionFactory ;
|
||||
import jdk.internal.reflect.ReflectionFactory;
|
||||
|
||||
/** This class provides the methods for fundamental JVM operations
|
||||
* needed in the ORB that are not part of the public Java API. This includes:
|
||||
|
||||
@ -517,3 +517,4 @@ c558850fac5750d8ca98a45180121980f57cdd28 jdk-9+111
|
||||
76582e8dc9e6374e4f99ab797c8d364b6e9449b4 jdk-9+112
|
||||
c569f8d89269fb6205b90f727581eb8cc04132f9 jdk-9+113
|
||||
b64432bae5271735fd53300b2005b713e98ef411 jdk-9+114
|
||||
88dd08d7be0fe7fb9f1914b1628f0aae9bf56e25 jdk-9+115
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2015, 2016, 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
|
||||
@ -47,6 +47,7 @@ BUILD_HOTSPOT_JTREG_NATIVE_SRC := \
|
||||
$(HOTSPOT_TOPDIR)/test/runtime/jni/ToStringInInterfaceTest \
|
||||
$(HOTSPOT_TOPDIR)/test/runtime/modules/getModuleJNI \
|
||||
$(HOTSPOT_TOPDIR)/test/runtime/SameObject \
|
||||
$(HOTSPOT_TOPDIR)/test/runtime/BoolReturn \
|
||||
$(HOTSPOT_TOPDIR)/test/compiler/floatingpoint/ \
|
||||
$(HOTSPOT_TOPDIR)/test/compiler/calls \
|
||||
$(HOTSPOT_TOPDIR)/test/compiler/native \
|
||||
|
||||
@ -344,7 +344,7 @@ void LIRGenerator::do_StoreIndexed(StoreIndexed* x) {
|
||||
length.set_instruction(x->length());
|
||||
length.load_item();
|
||||
}
|
||||
if (needs_store_check) {
|
||||
if (needs_store_check || x->check_boolean()) {
|
||||
value.load_item();
|
||||
} else {
|
||||
value.load_for_store(x->elt_type());
|
||||
@ -389,7 +389,8 @@ void LIRGenerator::do_StoreIndexed(StoreIndexed* x) {
|
||||
pre_barrier(LIR_OprFact::address(array_addr), LIR_OprFact::illegalOpr /* pre_val */,
|
||||
true /* do_load */, false /* patch */, NULL);
|
||||
}
|
||||
__ move(value.result(), array_addr, null_check_info);
|
||||
LIR_Opr result = maybe_mask_boolean(x, array.result(), value.result(), null_check_info);
|
||||
__ move(result, array_addr, null_check_info);
|
||||
if (obj_store) {
|
||||
// Precise card mark
|
||||
post_barrier(LIR_OprFact::address(array_addr), value.result());
|
||||
|
||||
@ -208,6 +208,7 @@ void InterpreterMacroAssembler::load_earlyret_value(TosState state) {
|
||||
case atos: ld_ptr(oop_addr, Otos_l);
|
||||
st_ptr(G0, oop_addr); break;
|
||||
case btos: // fall through
|
||||
case ztos: // fall through
|
||||
case ctos: // fall through
|
||||
case stos: // fall through
|
||||
case itos: ld(val_addr, Otos_l1); break;
|
||||
@ -452,9 +453,10 @@ void InterpreterMacroAssembler::push(TosState state) {
|
||||
interp_verify_oop(Otos_i, state, __FILE__, __LINE__);
|
||||
switch (state) {
|
||||
case atos: push_ptr(); break;
|
||||
case btos: push_i(); break;
|
||||
case ctos:
|
||||
case stos: push_i(); break;
|
||||
case btos: // fall through
|
||||
case ztos: // fall through
|
||||
case ctos: // fall through
|
||||
case stos: // fall through
|
||||
case itos: push_i(); break;
|
||||
case ltos: push_l(); break;
|
||||
case ftos: push_f(); break;
|
||||
@ -468,9 +470,10 @@ void InterpreterMacroAssembler::push(TosState state) {
|
||||
void InterpreterMacroAssembler::pop(TosState state) {
|
||||
switch (state) {
|
||||
case atos: pop_ptr(); break;
|
||||
case btos: pop_i(); break;
|
||||
case ctos:
|
||||
case stos: pop_i(); break;
|
||||
case btos: // fall through
|
||||
case ztos: // fall through
|
||||
case ctos: // fall through
|
||||
case stos: // fall through
|
||||
case itos: pop_i(); break;
|
||||
case ltos: pop_l(); break;
|
||||
case ftos: pop_f(); break;
|
||||
@ -1103,6 +1106,49 @@ void InterpreterMacroAssembler::unlock_if_synchronized_method(TosState state,
|
||||
interp_verify_oop(Otos_i, state, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void InterpreterMacroAssembler::narrow(Register result) {
|
||||
|
||||
ld_ptr(Address(Lmethod, Method::const_offset()), G3_scratch);
|
||||
ldub(G3_scratch, in_bytes(ConstMethod::result_type_offset()), G3_scratch);
|
||||
|
||||
Label notBool, notByte, notChar, done;
|
||||
|
||||
// common case first
|
||||
cmp(G3_scratch, T_INT);
|
||||
br(Assembler::equal, true, pn, done);
|
||||
delayed()->nop();
|
||||
|
||||
cmp(G3_scratch, T_BOOLEAN);
|
||||
br(Assembler::notEqual, true, pn, notBool);
|
||||
delayed()->cmp(G3_scratch, T_BYTE);
|
||||
and3(result, 1, result);
|
||||
ba(done);
|
||||
delayed()->nop();
|
||||
|
||||
bind(notBool);
|
||||
// cmp(G3_scratch, T_BYTE);
|
||||
br(Assembler::notEqual, true, pn, notByte);
|
||||
delayed()->cmp(G3_scratch, T_CHAR);
|
||||
sll(result, 24, result);
|
||||
sra(result, 24, result);
|
||||
ba(done);
|
||||
delayed()->nop();
|
||||
|
||||
bind(notByte);
|
||||
// cmp(G3_scratch, T_CHAR);
|
||||
sll(result, 16, result);
|
||||
br(Assembler::notEqual, true, pn, done);
|
||||
delayed()->sra(result, 16, result);
|
||||
// sll(result, 16, result);
|
||||
srl(result, 16, result);
|
||||
|
||||
// bind(notChar);
|
||||
// must be short, instructions already executed in delay slot
|
||||
// sll(result, 16, result);
|
||||
// sra(result, 16, result);
|
||||
|
||||
bind(done);
|
||||
}
|
||||
|
||||
// remove activation
|
||||
//
|
||||
@ -1151,6 +1197,7 @@ void InterpreterMacroAssembler::remove_activation(TosState state,
|
||||
case ltos: mov(Otos_l2, Otos_l2->after_save()); // fall through // O1 -> I1
|
||||
#endif
|
||||
case btos: // fall through
|
||||
case ztos: // fall through
|
||||
case ctos:
|
||||
case stos: // fall through
|
||||
case atos: // fall through
|
||||
|
||||
@ -103,6 +103,8 @@ class InterpreterMacroAssembler: public MacroAssembler {
|
||||
void dispatch_via (TosState state, address* table);
|
||||
|
||||
|
||||
void narrow(Register result);
|
||||
|
||||
// Removes the current activation (incl. unlocking of monitors).
|
||||
// Additionally this code is used for earlyReturn in which case we
|
||||
// want to skip throwing an exception and installing an exception.
|
||||
|
||||
@ -165,6 +165,7 @@ void TemplateTable::patch_bytecode(Bytecodes::Code bc, Register bc_reg,
|
||||
switch (bc) {
|
||||
case Bytecodes::_fast_aputfield:
|
||||
case Bytecodes::_fast_bputfield:
|
||||
case Bytecodes::_fast_zputfield:
|
||||
case Bytecodes::_fast_cputfield:
|
||||
case Bytecodes::_fast_dputfield:
|
||||
case Bytecodes::_fast_fputfield:
|
||||
@ -922,8 +923,20 @@ void TemplateTable::bastore() {
|
||||
transition(itos, vtos);
|
||||
__ pop_i(O2); // index
|
||||
// Otos_i: val
|
||||
// O2: index
|
||||
// O3: array
|
||||
__ index_check(O3, O2, 0, G3_scratch, O2);
|
||||
// Need to check whether array is boolean or byte
|
||||
// since both types share the bastore bytecode.
|
||||
__ load_klass(O3, G4_scratch);
|
||||
__ ld(G4_scratch, in_bytes(Klass::layout_helper_offset()), G4_scratch);
|
||||
__ set(Klass::layout_helper_boolean_diffbit(), G3_scratch);
|
||||
__ andcc(G3_scratch, G4_scratch, G0);
|
||||
Label L_skip;
|
||||
__ br(Assembler::zero, false, Assembler::pn, L_skip);
|
||||
__ delayed()->nop();
|
||||
__ and3(Otos_i, 1, Otos_i); // if it is a T_BOOLEAN array, mask the stored value to 0/1
|
||||
__ bind(L_skip);
|
||||
__ stb(Otos_i, O2, arrayOopDesc::base_offset_in_bytes(T_BYTE));
|
||||
}
|
||||
|
||||
@ -2008,6 +2021,12 @@ void TemplateTable::_return(TosState state) {
|
||||
__ bind(skip_register_finalizer);
|
||||
}
|
||||
|
||||
// Narrow result if state is itos but result type is smaller.
|
||||
// Need to narrow in the return bytecode rather than in generate_return_entry
|
||||
// since compiled code callers expect the result to already be narrowed.
|
||||
if (state == itos) {
|
||||
__ narrow(Otos_i);
|
||||
}
|
||||
__ remove_activation(state, /* throw_monitor_exception */ true);
|
||||
|
||||
// The caller's SP was adjusted upon method entry to accomodate
|
||||
@ -2218,7 +2237,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
|
||||
Label checkVolatile;
|
||||
|
||||
// compute field type
|
||||
Label notByte, notInt, notShort, notChar, notLong, notFloat, notObj;
|
||||
Label notByte, notBool, notInt, notShort, notChar, notLong, notFloat, notObj;
|
||||
__ srl(Rflags, ConstantPoolCacheEntry::tos_state_shift, Rflags);
|
||||
// Make sure we don't need to mask Rflags after the above shift
|
||||
ConstantPoolCacheEntry::verify_tos_state_shift();
|
||||
@ -2273,7 +2292,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
|
||||
|
||||
// cmp(Rflags, btos);
|
||||
__ br(Assembler::notEqual, false, Assembler::pt, notByte);
|
||||
__ delayed() ->cmp(Rflags, ctos);
|
||||
__ delayed() ->cmp(Rflags, ztos);
|
||||
|
||||
// btos
|
||||
__ ldsb(Rclass, Roffset, Otos_i);
|
||||
@ -2286,6 +2305,22 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
|
||||
|
||||
__ bind(notByte);
|
||||
|
||||
// cmp(Rflags, ztos);
|
||||
__ br(Assembler::notEqual, false, Assembler::pt, notBool);
|
||||
__ delayed() ->cmp(Rflags, ctos);
|
||||
|
||||
// ztos
|
||||
__ ldsb(Rclass, Roffset, Otos_i);
|
||||
__ push(itos);
|
||||
if (!is_static && rc == may_rewrite) {
|
||||
// use btos rewriting, no truncating to t/f bit is needed for getfield.
|
||||
patch_bytecode(Bytecodes::_fast_bgetfield, G3_scratch, G4_scratch);
|
||||
}
|
||||
__ ba(checkVolatile);
|
||||
__ delayed()->tst(Lscratch);
|
||||
|
||||
__ bind(notBool);
|
||||
|
||||
// cmp(Rflags, ctos);
|
||||
__ br(Assembler::notEqual, false, Assembler::pt, notChar);
|
||||
__ delayed() ->cmp(Rflags, stos);
|
||||
@ -2449,6 +2484,7 @@ void TemplateTable::jvmti_post_fast_field_mod() {
|
||||
switch (bytecode()) { // save tos values before call_VM() clobbers them
|
||||
case Bytecodes::_fast_aputfield: __ push_ptr(Otos_i); break;
|
||||
case Bytecodes::_fast_bputfield: // fall through
|
||||
case Bytecodes::_fast_zputfield: // fall through
|
||||
case Bytecodes::_fast_sputfield: // fall through
|
||||
case Bytecodes::_fast_cputfield: // fall through
|
||||
case Bytecodes::_fast_iputfield: __ push_i(Otos_i); break;
|
||||
@ -2466,6 +2502,7 @@ void TemplateTable::jvmti_post_fast_field_mod() {
|
||||
switch (bytecode()) { // restore tos values
|
||||
case Bytecodes::_fast_aputfield: __ pop_ptr(Otos_i); break;
|
||||
case Bytecodes::_fast_bputfield: // fall through
|
||||
case Bytecodes::_fast_zputfield: // fall through
|
||||
case Bytecodes::_fast_sputfield: // fall through
|
||||
case Bytecodes::_fast_cputfield: // fall through
|
||||
case Bytecodes::_fast_iputfield: __ pop_i(Otos_i); break;
|
||||
@ -2581,7 +2618,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
|
||||
ConstantPoolCacheEntry::verify_tos_state_shift();
|
||||
|
||||
// compute field type
|
||||
Label notInt, notShort, notChar, notObj, notByte, notLong, notFloat;
|
||||
Label notInt, notShort, notChar, notObj, notByte, notBool, notLong, notFloat;
|
||||
|
||||
if (is_static) {
|
||||
// putstatic with object type most likely, check that first
|
||||
@ -2649,7 +2686,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
|
||||
|
||||
// cmp(Rflags, btos);
|
||||
__ br(Assembler::notEqual, false, Assembler::pt, notByte);
|
||||
__ delayed()->cmp(Rflags, ltos);
|
||||
__ delayed()->cmp(Rflags, ztos);
|
||||
|
||||
// btos
|
||||
{
|
||||
@ -2664,6 +2701,25 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
|
||||
}
|
||||
|
||||
__ bind(notByte);
|
||||
|
||||
// cmp(Rflags, btos);
|
||||
__ br(Assembler::notEqual, false, Assembler::pt, notBool);
|
||||
__ delayed()->cmp(Rflags, ltos);
|
||||
|
||||
// ztos
|
||||
{
|
||||
__ pop_i();
|
||||
if (!is_static) pop_and_check_object(Rclass);
|
||||
__ and3(Otos_i, 1, Otos_i);
|
||||
__ stb(Otos_i, Rclass, Roffset);
|
||||
if (!is_static && rc == may_rewrite) {
|
||||
patch_bytecode(Bytecodes::_fast_zputfield, G3_scratch, G4_scratch, true, byte_no);
|
||||
}
|
||||
__ ba(checkVolatile);
|
||||
__ delayed()->tst(Lscratch);
|
||||
}
|
||||
|
||||
__ bind(notBool);
|
||||
// cmp(Rflags, ltos);
|
||||
__ br(Assembler::notEqual, false, Assembler::pt, notLong);
|
||||
__ delayed()->cmp(Rflags, ctos);
|
||||
@ -2787,6 +2843,7 @@ void TemplateTable::fast_storefield(TosState state) {
|
||||
pop_and_check_object(Rclass);
|
||||
|
||||
switch (bytecode()) {
|
||||
case Bytecodes::_fast_zputfield: __ and3(Otos_i, 1, Otos_i); // fall through to bputfield
|
||||
case Bytecodes::_fast_bputfield: __ stb(Otos_i, Rclass, Roffset); break;
|
||||
case Bytecodes::_fast_cputfield: /* fall through */
|
||||
case Bytecodes::_fast_sputfield: __ sth(Otos_i, Rclass, Roffset); break;
|
||||
|
||||
@ -284,7 +284,7 @@ void LIRGenerator::do_StoreIndexed(StoreIndexed* x) {
|
||||
length.load_item();
|
||||
|
||||
}
|
||||
if (needs_store_check) {
|
||||
if (needs_store_check || x->check_boolean()) {
|
||||
value.load_item();
|
||||
} else {
|
||||
value.load_for_store(x->elt_type());
|
||||
@ -332,7 +332,8 @@ void LIRGenerator::do_StoreIndexed(StoreIndexed* x) {
|
||||
// Seems to be a precise
|
||||
post_barrier(LIR_OprFact::address(array_addr), value.result());
|
||||
} else {
|
||||
__ move(value.result(), array_addr, null_check_info);
|
||||
LIR_Opr result = maybe_mask_boolean(x, array.result(), value.result(), null_check_info);
|
||||
__ move(result, array_addr, null_check_info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -349,6 +349,7 @@ void InterpreterMacroAssembler::load_earlyret_value(TosState state) {
|
||||
verify_oop(rax, state); break;
|
||||
case ltos: movptr(rax, val_addr); break;
|
||||
case btos: // fall through
|
||||
case ztos: // fall through
|
||||
case ctos: // fall through
|
||||
case stos: // fall through
|
||||
case itos: movl(rax, val_addr); break;
|
||||
@ -370,6 +371,7 @@ void InterpreterMacroAssembler::load_earlyret_value(TosState state) {
|
||||
case ltos:
|
||||
movl(rdx, val_addr1); // fall through
|
||||
case btos: // fall through
|
||||
case ztos: // fall through
|
||||
case ctos: // fall through
|
||||
case stos: // fall through
|
||||
case itos: movl(rax, val_addr); break;
|
||||
@ -616,6 +618,7 @@ void InterpreterMacroAssembler::pop(TosState state) {
|
||||
switch (state) {
|
||||
case atos: pop_ptr(); break;
|
||||
case btos:
|
||||
case ztos:
|
||||
case ctos:
|
||||
case stos:
|
||||
case itos: pop_i(); break;
|
||||
@ -633,6 +636,7 @@ void InterpreterMacroAssembler::push(TosState state) {
|
||||
switch (state) {
|
||||
case atos: push_ptr(); break;
|
||||
case btos:
|
||||
case ztos:
|
||||
case ctos:
|
||||
case stos:
|
||||
case itos: push_i(); break;
|
||||
@ -668,6 +672,7 @@ void InterpreterMacroAssembler::pop(TosState state) {
|
||||
switch (state) {
|
||||
case atos: pop_ptr(rax); break;
|
||||
case btos: // fall through
|
||||
case ztos: // fall through
|
||||
case ctos: // fall through
|
||||
case stos: // fall through
|
||||
case itos: pop_i(rax); break;
|
||||
@ -716,6 +721,7 @@ void InterpreterMacroAssembler::push(TosState state) {
|
||||
switch (state) {
|
||||
case atos: push_ptr(rax); break;
|
||||
case btos: // fall through
|
||||
case ztos: // fall through
|
||||
case ctos: // fall through
|
||||
case stos: // fall through
|
||||
case itos: push_i(rax); break;
|
||||
@ -849,6 +855,51 @@ void InterpreterMacroAssembler::dispatch_via(TosState state, address* table) {
|
||||
dispatch_base(state, table);
|
||||
}
|
||||
|
||||
void InterpreterMacroAssembler::narrow(Register result) {
|
||||
|
||||
// Get method->_constMethod->_result_type
|
||||
movptr(rcx, Address(rbp, frame::interpreter_frame_method_offset * wordSize));
|
||||
movptr(rcx, Address(rcx, Method::const_offset()));
|
||||
load_unsigned_byte(rcx, Address(rcx, ConstMethod::result_type_offset()));
|
||||
|
||||
Label done, notBool, notByte, notChar;
|
||||
|
||||
// common case first
|
||||
cmpl(rcx, T_INT);
|
||||
jcc(Assembler::equal, done);
|
||||
|
||||
// mask integer result to narrower return type.
|
||||
cmpl(rcx, T_BOOLEAN);
|
||||
jcc(Assembler::notEqual, notBool);
|
||||
andl(result, 0x1);
|
||||
jmp(done);
|
||||
|
||||
bind(notBool);
|
||||
cmpl(rcx, T_BYTE);
|
||||
jcc(Assembler::notEqual, notByte);
|
||||
LP64_ONLY(movsbl(result, result);)
|
||||
NOT_LP64(shll(result, 24);) // truncate upper 24 bits
|
||||
NOT_LP64(sarl(result, 24);) // and sign-extend byte
|
||||
jmp(done);
|
||||
|
||||
bind(notByte);
|
||||
cmpl(rcx, T_CHAR);
|
||||
jcc(Assembler::notEqual, notChar);
|
||||
LP64_ONLY(movzwl(result, result);)
|
||||
NOT_LP64(andl(result, 0xFFFF);) // truncate upper 16 bits
|
||||
jmp(done);
|
||||
|
||||
bind(notChar);
|
||||
// cmpl(rcx, T_SHORT); // all that's left
|
||||
// jcc(Assembler::notEqual, done);
|
||||
LP64_ONLY(movswl(result, result);)
|
||||
NOT_LP64(shll(result, 16);) // truncate upper 16 bits
|
||||
NOT_LP64(sarl(result, 16);) // and sign-extend short
|
||||
|
||||
// Nothing to do for T_INT
|
||||
bind(done);
|
||||
}
|
||||
|
||||
// remove activation
|
||||
//
|
||||
// Unlock the receiver if this is a synchronized method.
|
||||
|
||||
@ -192,6 +192,9 @@ class InterpreterMacroAssembler: public MacroAssembler {
|
||||
void prepare_to_jump_from_interpreted();
|
||||
void jump_from_interpreted(Register method, Register temp);
|
||||
|
||||
// narrow int return value
|
||||
void narrow(Register result);
|
||||
|
||||
// Returning from interpreted functions
|
||||
//
|
||||
// Removes the current activation (incl. unlocking of monitors)
|
||||
|
||||
@ -243,6 +243,7 @@ void TemplateTable::patch_bytecode(Bytecodes::Code bc, Register bc_reg,
|
||||
switch (bc) {
|
||||
case Bytecodes::_fast_aputfield:
|
||||
case Bytecodes::_fast_bputfield:
|
||||
case Bytecodes::_fast_zputfield:
|
||||
case Bytecodes::_fast_cputfield:
|
||||
case Bytecodes::_fast_dputfield:
|
||||
case Bytecodes::_fast_fputfield:
|
||||
@ -1082,6 +1083,16 @@ void TemplateTable::bastore() {
|
||||
// rbx: index
|
||||
// rdx: array
|
||||
index_check(rdx, rbx); // prefer index in rbx
|
||||
// Need to check whether array is boolean or byte
|
||||
// since both types share the bastore bytecode.
|
||||
__ load_klass(rcx, rdx);
|
||||
__ movl(rcx, Address(rcx, Klass::layout_helper_offset()));
|
||||
int diffbit = Klass::layout_helper_boolean_diffbit();
|
||||
__ testl(rcx, diffbit);
|
||||
Label L_skip;
|
||||
__ jccb(Assembler::zero, L_skip);
|
||||
__ andl(rax, 1); // if it is a T_BOOLEAN array, mask the stored value to 0/1
|
||||
__ bind(L_skip);
|
||||
__ movb(Address(rdx, rbx,
|
||||
Address::times_1,
|
||||
arrayOopDesc::base_offset_in_bytes(T_BYTE)),
|
||||
@ -2540,13 +2551,12 @@ void TemplateTable::fast_binaryswitch() {
|
||||
void TemplateTable::_return(TosState state) {
|
||||
transition(state, state);
|
||||
|
||||
Register robj = LP64_ONLY(c_rarg1) NOT_LP64(rax);
|
||||
|
||||
assert(_desc->calls_vm(),
|
||||
"inconsistent calls_vm information"); // call in remove_activation
|
||||
|
||||
if (_desc->bytecode() == Bytecodes::_return_register_finalizer) {
|
||||
assert(state == vtos, "only valid state");
|
||||
Register robj = LP64_ONLY(c_rarg1) NOT_LP64(rax);
|
||||
__ movptr(robj, aaddress(0));
|
||||
__ load_klass(rdi, robj);
|
||||
__ movl(rdi, Address(rdi, Klass::access_flags_offset()));
|
||||
@ -2559,7 +2569,14 @@ void TemplateTable::_return(TosState state) {
|
||||
__ bind(skip_register_finalizer);
|
||||
}
|
||||
|
||||
// Narrow result if state is itos but result type is smaller.
|
||||
// Need to narrow in the return bytecode rather than in generate_return_entry
|
||||
// since compiled code callers expect the result to already be narrowed.
|
||||
if (state == itos) {
|
||||
__ narrow(rax);
|
||||
}
|
||||
__ remove_activation(state, rbcp);
|
||||
|
||||
__ jmp(rbcp);
|
||||
}
|
||||
|
||||
@ -2754,7 +2771,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
|
||||
const Address field(obj, off, Address::times_1, 0*wordSize);
|
||||
NOT_LP64(const Address hi(obj, off, Address::times_1, 1*wordSize));
|
||||
|
||||
Label Done, notByte, notInt, notShort, notChar, notLong, notFloat, notObj, notDouble;
|
||||
Label Done, notByte, notBool, notInt, notShort, notChar, notLong, notFloat, notObj, notDouble;
|
||||
|
||||
__ shrl(flags, ConstantPoolCacheEntry::tos_state_shift);
|
||||
// Make sure we don't need to mask edx after the above shift
|
||||
@ -2773,6 +2790,20 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
|
||||
__ jmp(Done);
|
||||
|
||||
__ bind(notByte);
|
||||
__ cmpl(flags, ztos);
|
||||
__ jcc(Assembler::notEqual, notBool);
|
||||
|
||||
// ztos (same code as btos)
|
||||
__ load_signed_byte(rax, field);
|
||||
__ push(ztos);
|
||||
// Rewrite bytecode to be faster
|
||||
if (!is_static && rc == may_rewrite) {
|
||||
// use btos rewriting, no truncating to t/f bit is needed for getfield.
|
||||
patch_bytecode(Bytecodes::_fast_bgetfield, bc, rbx);
|
||||
}
|
||||
__ jmp(Done);
|
||||
|
||||
__ bind(notBool);
|
||||
__ cmpl(flags, atos);
|
||||
__ jcc(Assembler::notEqual, notObj);
|
||||
// atos
|
||||
@ -3006,7 +3037,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
|
||||
const Address field(obj, off, Address::times_1, 0*wordSize);
|
||||
NOT_LP64( const Address hi(obj, off, Address::times_1, 1*wordSize);)
|
||||
|
||||
Label notByte, notInt, notShort, notChar,
|
||||
Label notByte, notBool, notInt, notShort, notChar,
|
||||
notLong, notFloat, notObj, notDouble;
|
||||
|
||||
__ shrl(flags, ConstantPoolCacheEntry::tos_state_shift);
|
||||
@ -3027,6 +3058,22 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
|
||||
}
|
||||
|
||||
__ bind(notByte);
|
||||
__ cmpl(flags, ztos);
|
||||
__ jcc(Assembler::notEqual, notBool);
|
||||
|
||||
// ztos
|
||||
{
|
||||
__ pop(ztos);
|
||||
if (!is_static) pop_and_check_object(obj);
|
||||
__ andl(rax, 0x1);
|
||||
__ movb(field, rax);
|
||||
if (!is_static && rc == may_rewrite) {
|
||||
patch_bytecode(Bytecodes::_fast_zputfield, bc, rbx, true, byte_no);
|
||||
}
|
||||
__ jmp(Done);
|
||||
}
|
||||
|
||||
__ bind(notBool);
|
||||
__ cmpl(flags, atos);
|
||||
__ jcc(Assembler::notEqual, notObj);
|
||||
|
||||
@ -3214,6 +3261,7 @@ void TemplateTable::jvmti_post_fast_field_mod() {
|
||||
switch (bytecode()) { // load values into the jvalue object
|
||||
case Bytecodes::_fast_aputfield: __ push_ptr(rax); break;
|
||||
case Bytecodes::_fast_bputfield: // fall through
|
||||
case Bytecodes::_fast_zputfield: // fall through
|
||||
case Bytecodes::_fast_sputfield: // fall through
|
||||
case Bytecodes::_fast_cputfield: // fall through
|
||||
case Bytecodes::_fast_iputfield: __ push_i(rax); break;
|
||||
@ -3238,6 +3286,7 @@ void TemplateTable::jvmti_post_fast_field_mod() {
|
||||
switch (bytecode()) { // restore tos values
|
||||
case Bytecodes::_fast_aputfield: __ pop_ptr(rax); break;
|
||||
case Bytecodes::_fast_bputfield: // fall through
|
||||
case Bytecodes::_fast_zputfield: // fall through
|
||||
case Bytecodes::_fast_sputfield: // fall through
|
||||
case Bytecodes::_fast_cputfield: // fall through
|
||||
case Bytecodes::_fast_iputfield: __ pop_i(rax); break;
|
||||
@ -3297,6 +3346,9 @@ void TemplateTable::fast_storefield(TosState state) {
|
||||
case Bytecodes::_fast_iputfield:
|
||||
__ movl(field, rax);
|
||||
break;
|
||||
case Bytecodes::_fast_zputfield:
|
||||
__ andl(rax, 0x1); // boolean is true if LSB is 1
|
||||
// fall through to bputfield
|
||||
case Bytecodes::_fast_bputfield:
|
||||
__ movb(field, rax);
|
||||
break;
|
||||
|
||||
@ -82,6 +82,30 @@ int CppInterpreter::normal_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
intptr_t narrow(BasicType type, intptr_t result) {
|
||||
// mask integer result to narrower return type.
|
||||
switch (type) {
|
||||
case T_BOOLEAN:
|
||||
return result&1;
|
||||
case T_BYTE:
|
||||
return (intptr_t)(jbyte)result;
|
||||
case T_CHAR:
|
||||
return (intptr_t)(uintptr_t)(jchar)result;
|
||||
case T_SHORT:
|
||||
return (intptr_t)(jshort)result;
|
||||
case T_OBJECT: // nothing to do fall through
|
||||
case T_ARRAY:
|
||||
case T_LONG:
|
||||
case T_INT:
|
||||
case T_FLOAT:
|
||||
case T_DOUBLE:
|
||||
case T_VOID:
|
||||
return result;
|
||||
default : ShouldNotReachHere();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CppInterpreter::main_loop(int recurse, TRAPS) {
|
||||
JavaThread *thread = (JavaThread *) THREAD;
|
||||
ZeroStack *stack = thread->zero_stack();
|
||||
@ -161,7 +185,7 @@ void CppInterpreter::main_loop(int recurse, TRAPS) {
|
||||
}
|
||||
else if (istate->msg() == BytecodeInterpreter::return_from_method) {
|
||||
// Copy the result into the caller's frame
|
||||
result_slots = type2size[result_type_of(method)];
|
||||
result_slots = type2size[method->result_type()];
|
||||
assert(result_slots >= 0 && result_slots <= 2, "what?");
|
||||
result = istate->stack() + result_slots;
|
||||
break;
|
||||
@ -195,8 +219,14 @@ void CppInterpreter::main_loop(int recurse, TRAPS) {
|
||||
stack->set_sp(stack->sp() + method->max_locals());
|
||||
|
||||
// Push our result
|
||||
for (int i = 0; i < result_slots; i++)
|
||||
stack->push(result[-i]);
|
||||
for (int i = 0; i < result_slots; i++) {
|
||||
// Adjust result to smaller
|
||||
intptr_t res = result[-i];
|
||||
if (result_slots == 1) {
|
||||
res = narrow(method->result_type(), res);
|
||||
}
|
||||
stack->push(res);
|
||||
}
|
||||
}
|
||||
|
||||
int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
@ -407,7 +437,7 @@ int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
|
||||
// Push our result
|
||||
if (!HAS_PENDING_EXCEPTION) {
|
||||
BasicType type = result_type_of(method);
|
||||
BasicType type = method->result_type();
|
||||
stack->set_sp(stack->sp() - type2size[type]);
|
||||
|
||||
switch (type) {
|
||||
@ -532,6 +562,7 @@ int CppInterpreter::accessor_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
break;
|
||||
|
||||
case btos:
|
||||
case ztos:
|
||||
SET_LOCALS_INT(object->byte_field_acquire(entry->f2_as_index()), 0);
|
||||
break;
|
||||
|
||||
@ -570,6 +601,7 @@ int CppInterpreter::accessor_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
break;
|
||||
|
||||
case btos:
|
||||
case ztos:
|
||||
SET_LOCALS_INT(object->byte_field(entry->f2_as_index()), 0);
|
||||
break;
|
||||
|
||||
@ -772,26 +804,6 @@ InterpreterFrame *InterpreterFrame::build(int size, TRAPS) {
|
||||
return (InterpreterFrame *) fp;
|
||||
}
|
||||
|
||||
BasicType CppInterpreter::result_type_of(Method* method) {
|
||||
BasicType t = T_ILLEGAL; // silence compiler warnings
|
||||
switch (method->result_index()) {
|
||||
case 0 : t = T_BOOLEAN; break;
|
||||
case 1 : t = T_CHAR; break;
|
||||
case 2 : t = T_BYTE; break;
|
||||
case 3 : t = T_SHORT; break;
|
||||
case 4 : t = T_INT; break;
|
||||
case 5 : t = T_LONG; break;
|
||||
case 6 : t = T_VOID; break;
|
||||
case 7 : t = T_FLOAT; break;
|
||||
case 8 : t = T_DOUBLE; break;
|
||||
case 9 : t = T_OBJECT; break;
|
||||
default: ShouldNotReachHere();
|
||||
}
|
||||
assert(AbstractInterpreter::BasicType_as_index(t) == method->result_index(),
|
||||
"out of step with AbstractInterpreter::BasicType_as_index");
|
||||
return t;
|
||||
}
|
||||
|
||||
address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
|
||||
ShouldNotCallThis();
|
||||
return NULL;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2007, 2008, 2010, 2011 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -49,8 +49,4 @@
|
||||
static intptr_t* calculate_unwind_sp(ZeroStack* stack, oop method_handle);
|
||||
static void throw_exception(JavaThread* thread, Symbol* name,char *msg=NULL);
|
||||
|
||||
private:
|
||||
// Fast result type determination
|
||||
static BasicType result_type_of(Method* method);
|
||||
|
||||
#endif // CPU_ZERO_VM_CPPINTERPRETER_ZERO_HPP
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2016, 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
|
||||
@ -253,29 +253,30 @@ public class Bytecodes {
|
||||
public static final int _fast_sgetfield = 210;
|
||||
public static final int _fast_aputfield = 211;
|
||||
public static final int _fast_bputfield = 212;
|
||||
public static final int _fast_cputfield = 213;
|
||||
public static final int _fast_dputfield = 214;
|
||||
public static final int _fast_fputfield = 215;
|
||||
public static final int _fast_iputfield = 216;
|
||||
public static final int _fast_lputfield = 217;
|
||||
public static final int _fast_sputfield = 218;
|
||||
public static final int _fast_aload_0 = 219;
|
||||
public static final int _fast_iaccess_0 = 220;
|
||||
public static final int _fast_aaccess_0 = 221;
|
||||
public static final int _fast_faccess_0 = 222;
|
||||
public static final int _fast_iload = 223;
|
||||
public static final int _fast_iload2 = 224;
|
||||
public static final int _fast_icaload = 225;
|
||||
public static final int _fast_invokevfinal = 226;
|
||||
public static final int _fast_linearswitch = 227;
|
||||
public static final int _fast_binaryswitch = 228;
|
||||
public static final int _fast_aldc = 229;
|
||||
public static final int _fast_aldc_w = 230;
|
||||
public static final int _return_register_finalizer = 231;
|
||||
public static final int _invokehandle = 232;
|
||||
public static final int _shouldnotreachhere = 233; // For debugging
|
||||
public static final int _fast_zputfield = 213;
|
||||
public static final int _fast_cputfield = 214;
|
||||
public static final int _fast_dputfield = 215;
|
||||
public static final int _fast_fputfield = 216;
|
||||
public static final int _fast_iputfield = 217;
|
||||
public static final int _fast_lputfield = 218;
|
||||
public static final int _fast_sputfield = 219;
|
||||
public static final int _fast_aload_0 = 220;
|
||||
public static final int _fast_iaccess_0 = 221;
|
||||
public static final int _fast_aaccess_0 = 222;
|
||||
public static final int _fast_faccess_0 = 223;
|
||||
public static final int _fast_iload = 224;
|
||||
public static final int _fast_iload2 = 225;
|
||||
public static final int _fast_icaload = 226;
|
||||
public static final int _fast_invokevfinal = 227;
|
||||
public static final int _fast_linearswitch = 228;
|
||||
public static final int _fast_binaryswitch = 229;
|
||||
public static final int _fast_aldc = 230;
|
||||
public static final int _fast_aldc_w = 231;
|
||||
public static final int _return_register_finalizer = 232;
|
||||
public static final int _invokehandle = 233;
|
||||
public static final int _shouldnotreachhere = 234; // For debugging
|
||||
|
||||
public static final int number_of_codes = 234;
|
||||
public static final int number_of_codes = 235;
|
||||
|
||||
// Flag bits derived from format strings, can_trap, can_rewrite, etc.:
|
||||
// semantic flags:
|
||||
@ -776,6 +777,7 @@ public class Bytecodes {
|
||||
|
||||
def(_fast_aputfield , "fast_aputfield" , "bJJ" , null , BasicType.getTObject() , 0, true , _putfield );
|
||||
def(_fast_bputfield , "fast_bputfield" , "bJJ" , null , BasicType.getTInt() , 0, true , _putfield );
|
||||
def(_fast_zputfield , "fast_zputfield" , "bJJ" , null , BasicType.getTInt() , 0, true , _putfield );
|
||||
def(_fast_cputfield , "fast_cputfield" , "bJJ" , null , BasicType.getTChar() , 0, true , _putfield );
|
||||
def(_fast_dputfield , "fast_dputfield" , "bJJ" , null , BasicType.getTDouble() , 0, true , _putfield );
|
||||
def(_fast_fputfield , "fast_fputfield" , "bJJ" , null , BasicType.getTFloat() , 0, true , _putfield );
|
||||
|
||||
@ -305,7 +305,8 @@ void Canonicalizer::do_StoreIndexed (StoreIndexed* x) {
|
||||
// limit this optimization to current block
|
||||
if (value != NULL && in_current_block(conv)) {
|
||||
set_canonical(new StoreIndexed(x->array(), x->index(), x->length(),
|
||||
x->elt_type(), value, x->state_before()));
|
||||
x->elt_type(), value, x->state_before(),
|
||||
x->check_boolean()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -976,7 +976,19 @@ void GraphBuilder::store_indexed(BasicType type) {
|
||||
(array->as_NewArray() && array->as_NewArray()->length() && array->as_NewArray()->length()->type()->is_constant())) {
|
||||
length = append(new ArrayLength(array, state_before));
|
||||
}
|
||||
StoreIndexed* result = new StoreIndexed(array, index, length, type, value, state_before);
|
||||
ciType* array_type = array->declared_type();
|
||||
bool check_boolean = false;
|
||||
if (array_type != NULL) {
|
||||
if (array_type->is_loaded() &&
|
||||
array_type->as_array_klass()->element_type()->basic_type() == T_BOOLEAN) {
|
||||
assert(type == T_BYTE, "boolean store uses bastore");
|
||||
Value mask = append(new Constant(new IntConstant(1)));
|
||||
value = append(new LogicOp(Bytecodes::_iand, value, mask));
|
||||
}
|
||||
} else if (type == T_BYTE) {
|
||||
check_boolean = true;
|
||||
}
|
||||
StoreIndexed* result = new StoreIndexed(array, index, length, type, value, state_before, check_boolean);
|
||||
append(result);
|
||||
_memory->store_value(value);
|
||||
|
||||
@ -1443,6 +1455,36 @@ void GraphBuilder::method_return(Value x) {
|
||||
need_mem_bar = true;
|
||||
}
|
||||
|
||||
BasicType bt = method()->return_type()->basic_type();
|
||||
switch (bt) {
|
||||
case T_BYTE:
|
||||
{
|
||||
Value shift = append(new Constant(new IntConstant(24)));
|
||||
x = append(new ShiftOp(Bytecodes::_ishl, x, shift));
|
||||
x = append(new ShiftOp(Bytecodes::_ishr, x, shift));
|
||||
break;
|
||||
}
|
||||
case T_SHORT:
|
||||
{
|
||||
Value shift = append(new Constant(new IntConstant(16)));
|
||||
x = append(new ShiftOp(Bytecodes::_ishl, x, shift));
|
||||
x = append(new ShiftOp(Bytecodes::_ishr, x, shift));
|
||||
break;
|
||||
}
|
||||
case T_CHAR:
|
||||
{
|
||||
Value mask = append(new Constant(new IntConstant(0xFFFF)));
|
||||
x = append(new LogicOp(Bytecodes::_iand, x, mask));
|
||||
break;
|
||||
}
|
||||
case T_BOOLEAN:
|
||||
{
|
||||
Value mask = append(new Constant(new IntConstant(1)));
|
||||
x = append(new LogicOp(Bytecodes::_iand, x, mask));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check to see whether we are inlining. If so, Return
|
||||
// instructions become Gotos to the continuation point.
|
||||
if (continuation() != NULL) {
|
||||
@ -1612,6 +1654,10 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
|
||||
if (state_before == NULL) {
|
||||
state_before = copy_state_for_exception();
|
||||
}
|
||||
if (field->type()->basic_type() == T_BOOLEAN) {
|
||||
Value mask = append(new Constant(new IntConstant(1)));
|
||||
val = append(new LogicOp(Bytecodes::_iand, val, mask));
|
||||
}
|
||||
append(new StoreField(append(obj), offset, field, val, true, state_before, needs_patching));
|
||||
break;
|
||||
}
|
||||
@ -1660,6 +1706,10 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
|
||||
if (state_before == NULL) {
|
||||
state_before = copy_state_for_exception();
|
||||
}
|
||||
if (field->type()->basic_type() == T_BOOLEAN) {
|
||||
Value mask = append(new Constant(new IntConstant(1)));
|
||||
val = append(new LogicOp(Bytecodes::_iand, val, mask));
|
||||
}
|
||||
StoreField* store = new StoreField(obj, offset, field, val, false, state_before, needs_patching);
|
||||
if (!needs_patching) store = _memory->store(store);
|
||||
if (store != NULL) {
|
||||
@ -4122,7 +4172,12 @@ void GraphBuilder::append_unsafe_put_obj(ciMethod* callee, BasicType t, bool is_
|
||||
#ifndef _LP64
|
||||
offset = append(new Convert(Bytecodes::_l2i, offset, as_ValueType(T_INT)));
|
||||
#endif
|
||||
Instruction* op = append(new UnsafePutObject(t, args->at(1), offset, args->at(3), is_volatile));
|
||||
Value val = args->at(3);
|
||||
if (t == T_BOOLEAN) {
|
||||
Value mask = append(new Constant(new IntConstant(1)));
|
||||
val = append(new LogicOp(Bytecodes::_iand, val, mask));
|
||||
}
|
||||
Instruction* op = append(new UnsafePutObject(t, args->at(1), offset, val, is_volatile));
|
||||
compilation()->set_has_unsafe_access(true);
|
||||
kill_all();
|
||||
}
|
||||
@ -4196,7 +4251,7 @@ void GraphBuilder::append_char_access(ciMethod* callee, bool is_store) {
|
||||
Value index = args->at(1);
|
||||
if (is_store) {
|
||||
Value value = args->at(2);
|
||||
Instruction* store = append(new StoreIndexed(array, index, NULL, T_CHAR, value, state_before));
|
||||
Instruction* store = append(new StoreIndexed(array, index, NULL, T_CHAR, value, state_before, false));
|
||||
store->set_flag(Instruction::NeedsRangeCheckFlag, false);
|
||||
_memory->store_value(value);
|
||||
} else {
|
||||
|
||||
@ -970,11 +970,13 @@ LEAF(StoreIndexed, AccessIndexed)
|
||||
|
||||
ciMethod* _profiled_method;
|
||||
int _profiled_bci;
|
||||
bool _check_boolean;
|
||||
|
||||
public:
|
||||
// creation
|
||||
StoreIndexed(Value array, Value index, Value length, BasicType elt_type, Value value, ValueStack* state_before)
|
||||
StoreIndexed(Value array, Value index, Value length, BasicType elt_type, Value value, ValueStack* state_before, bool check_boolean)
|
||||
: AccessIndexed(array, index, length, elt_type, state_before)
|
||||
, _value(value), _profiled_method(NULL), _profiled_bci(0)
|
||||
, _value(value), _profiled_method(NULL), _profiled_bci(0), _check_boolean(check_boolean)
|
||||
{
|
||||
set_flag(NeedsWriteBarrierFlag, (as_ValueType(elt_type)->is_object()));
|
||||
set_flag(NeedsStoreCheckFlag, (as_ValueType(elt_type)->is_object()));
|
||||
@ -986,6 +988,7 @@ LEAF(StoreIndexed, AccessIndexed)
|
||||
Value value() const { return _value; }
|
||||
bool needs_write_barrier() const { return check_flag(NeedsWriteBarrierFlag); }
|
||||
bool needs_store_check() const { return check_flag(NeedsStoreCheckFlag); }
|
||||
bool check_boolean() const { return _check_boolean; }
|
||||
// Helpers for MethodData* profiling
|
||||
void set_should_profile(bool value) { set_flag(ProfileMDOFlag, value); }
|
||||
void set_profiled_method(ciMethod* method) { _profiled_method = method; }
|
||||
|
||||
@ -3682,3 +3682,26 @@ void LIRGenerator::do_MemBar(MemBar* x) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LIR_Opr LIRGenerator::maybe_mask_boolean(StoreIndexed* x, LIR_Opr array, LIR_Opr value, CodeEmitInfo*& null_check_info) {
|
||||
if (x->check_boolean()) {
|
||||
LIR_Opr value_fixed = rlock_byte(T_BYTE);
|
||||
if (TwoOperandLIRForm) {
|
||||
__ move(value, value_fixed);
|
||||
__ logical_and(value_fixed, LIR_OprFact::intConst(1), value_fixed);
|
||||
} else {
|
||||
__ logical_and(value, LIR_OprFact::intConst(1), value_fixed);
|
||||
}
|
||||
LIR_Opr klass = new_register(T_METADATA);
|
||||
__ move(new LIR_Address(array, oopDesc::klass_offset_in_bytes(), T_ADDRESS), klass, null_check_info);
|
||||
null_check_info = NULL;
|
||||
LIR_Opr layout = new_register(T_INT);
|
||||
__ move(new LIR_Address(klass, in_bytes(Klass::layout_helper_offset()), T_INT), layout);
|
||||
int diffbit = Klass::layout_helper_boolean_diffbit();
|
||||
__ logical_and(layout, LIR_OprFact::intConst(diffbit), layout);
|
||||
__ cmp(lir_cond_notEqual, layout, LIR_OprFact::intConst(0));
|
||||
__ cmove(lir_cond_notEqual, value_fixed, value, value_fixed, T_BYTE);
|
||||
value = value_fixed;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -444,6 +444,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
|
||||
void profile_arguments(ProfileCall* x);
|
||||
void profile_parameters(Base* x);
|
||||
void profile_parameters_at_call(ProfileCall* x);
|
||||
LIR_Opr maybe_mask_boolean(StoreIndexed* x, LIR_Opr array, LIR_Opr value, CodeEmitInfo*& null_check_info);
|
||||
|
||||
public:
|
||||
Compilation* compilation() const { return _compilation; }
|
||||
|
||||
@ -1967,7 +1967,7 @@ AnnotationCollector::annotation_index(const ClassLoaderData* loader_data,
|
||||
loader_data->is_platform_class_loader_data() ||
|
||||
loader_data->is_anonymous();
|
||||
switch (sid) {
|
||||
case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_reflect_CallerSensitive_signature): {
|
||||
case vmSymbols::VM_SYMBOL_ENUM_NAME(reflect_CallerSensitive_signature): {
|
||||
if (_location != _in_method) break; // only allow for methods
|
||||
if (!privileged) break; // only allow in privileged code
|
||||
return _method_CallerSensitive;
|
||||
@ -2713,11 +2713,9 @@ Method* ClassFileParser::parse_method(const ClassFileStream* const cfs,
|
||||
m->set_constants(_cp);
|
||||
m->set_name_index(name_index);
|
||||
m->set_signature_index(signature_index);
|
||||
#ifdef CC_INTERP
|
||||
// hmm is there a gc issue here??
|
||||
|
||||
ResultTypeFinder rtf(cp->symbol_at(signature_index));
|
||||
m->set_result_index(rtf.type());
|
||||
#endif
|
||||
m->constMethod()->set_result_type(rtf.type());
|
||||
|
||||
if (args_size >= 0) {
|
||||
m->set_size_of_parameters(args_size);
|
||||
|
||||
@ -860,10 +860,8 @@ static Method* new_method(
|
||||
m->set_constants(NULL); // This will get filled in later
|
||||
m->set_name_index(cp->utf8(name));
|
||||
m->set_signature_index(cp->utf8(sig));
|
||||
#ifdef CC_INTERP
|
||||
ResultTypeFinder rtf(sig);
|
||||
m->set_result_index(rtf.type());
|
||||
#endif
|
||||
m->constMethod()->set_result_type(rtf.type());
|
||||
m->set_size_of_parameters(params);
|
||||
m->set_max_stack(max_stack);
|
||||
m->set_max_locals(params);
|
||||
|
||||
@ -2698,7 +2698,7 @@ void java_lang_reflect_Field::set_type_annotations(oop field, oop value) {
|
||||
field->obj_field_put(type_annotations_offset, value);
|
||||
}
|
||||
|
||||
void sun_reflect_ConstantPool::compute_offsets() {
|
||||
void reflect_ConstantPool::compute_offsets() {
|
||||
Klass* k = SystemDictionary::reflect_ConstantPool_klass();
|
||||
// This null test can be removed post beta
|
||||
if (k != NULL) {
|
||||
@ -2842,7 +2842,7 @@ void java_lang_reflect_Module::set_module_entry(oop module, ModuleEntry* module_
|
||||
module->address_field_put(_module_entry_offset, (address)module_entry);
|
||||
}
|
||||
|
||||
Handle sun_reflect_ConstantPool::create(TRAPS) {
|
||||
Handle reflect_ConstantPool::create(TRAPS) {
|
||||
assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
|
||||
Klass* k = SystemDictionary::reflect_ConstantPool_klass();
|
||||
instanceKlassHandle klass (THREAD, k);
|
||||
@ -2852,14 +2852,14 @@ Handle sun_reflect_ConstantPool::create(TRAPS) {
|
||||
}
|
||||
|
||||
|
||||
void sun_reflect_ConstantPool::set_cp(oop reflect, ConstantPool* value) {
|
||||
void reflect_ConstantPool::set_cp(oop reflect, ConstantPool* value) {
|
||||
assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
|
||||
oop mirror = value->pool_holder()->java_mirror();
|
||||
// Save the mirror to get back the constant pool.
|
||||
reflect->obj_field_put(_oop_offset, mirror);
|
||||
}
|
||||
|
||||
ConstantPool* sun_reflect_ConstantPool::get_cp(oop reflect) {
|
||||
ConstantPool* reflect_ConstantPool::get_cp(oop reflect) {
|
||||
assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
|
||||
|
||||
oop mirror = reflect->obj_field(_oop_offset);
|
||||
@ -2874,7 +2874,7 @@ ConstantPool* sun_reflect_ConstantPool::get_cp(oop reflect) {
|
||||
return InstanceKlass::cast(k)->constants();
|
||||
}
|
||||
|
||||
void sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets() {
|
||||
void reflect_UnsafeStaticFieldAccessorImpl::compute_offsets() {
|
||||
Klass* k = SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass();
|
||||
// This null test can be removed post beta
|
||||
if (k != NULL) {
|
||||
@ -3649,8 +3649,8 @@ int java_lang_AssertionStatusDirectives::packageEnabled_offset;
|
||||
int java_lang_AssertionStatusDirectives::deflt_offset;
|
||||
int java_nio_Buffer::_limit_offset;
|
||||
int java_util_concurrent_locks_AbstractOwnableSynchronizer::_owner_offset = 0;
|
||||
int sun_reflect_ConstantPool::_oop_offset;
|
||||
int sun_reflect_UnsafeStaticFieldAccessorImpl::_base_offset;
|
||||
int reflect_ConstantPool::_oop_offset;
|
||||
int reflect_UnsafeStaticFieldAccessorImpl::_base_offset;
|
||||
|
||||
|
||||
// Support for java_lang_StackTraceElement
|
||||
@ -3835,8 +3835,8 @@ void JavaClasses::compute_offsets() {
|
||||
java_lang_reflect_Constructor::compute_offsets();
|
||||
java_lang_reflect_Field::compute_offsets();
|
||||
java_nio_Buffer::compute_offsets();
|
||||
sun_reflect_ConstantPool::compute_offsets();
|
||||
sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
|
||||
reflect_ConstantPool::compute_offsets();
|
||||
reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
|
||||
java_lang_reflect_Parameter::compute_offsets();
|
||||
java_lang_reflect_Module::compute_offsets();
|
||||
java_lang_StackFrameInfo::compute_offsets();
|
||||
|
||||
@ -799,8 +799,8 @@ class java_lang_reflect_Module {
|
||||
friend class JavaClasses;
|
||||
};
|
||||
|
||||
// Interface to sun.reflect.ConstantPool objects
|
||||
class sun_reflect_ConstantPool {
|
||||
// Interface to jdk.internal.reflect.ConstantPool objects
|
||||
class reflect_ConstantPool {
|
||||
private:
|
||||
// Note that to reduce dependencies on the JDK we compute these
|
||||
// offsets at run-time.
|
||||
@ -824,8 +824,8 @@ class sun_reflect_ConstantPool {
|
||||
friend class JavaClasses;
|
||||
};
|
||||
|
||||
// Interface to sun.reflect.UnsafeStaticFieldAccessorImpl objects
|
||||
class sun_reflect_UnsafeStaticFieldAccessorImpl {
|
||||
// Interface to jdk.internal.reflect.UnsafeStaticFieldAccessorImpl objects
|
||||
class reflect_UnsafeStaticFieldAccessorImpl {
|
||||
private:
|
||||
static int _base_offset;
|
||||
static void compute_offsets();
|
||||
|
||||
@ -142,13 +142,13 @@ class SymbolPropertyTable;
|
||||
\
|
||||
/* NOTE: needed too early in bootstrapping process to have checks based on JDK version */ \
|
||||
/* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \
|
||||
do_klass(reflect_MagicAccessorImpl_klass, sun_reflect_MagicAccessorImpl, Opt ) \
|
||||
do_klass(reflect_MethodAccessorImpl_klass, sun_reflect_MethodAccessorImpl, Pre ) \
|
||||
do_klass(reflect_ConstructorAccessorImpl_klass, sun_reflect_ConstructorAccessorImpl, Pre ) \
|
||||
do_klass(reflect_DelegatingClassLoader_klass, sun_reflect_DelegatingClassLoader, Opt ) \
|
||||
do_klass(reflect_ConstantPool_klass, sun_reflect_ConstantPool, Opt ) \
|
||||
do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, sun_reflect_UnsafeStaticFieldAccessorImpl, Opt ) \
|
||||
do_klass(reflect_CallerSensitive_klass, sun_reflect_CallerSensitive, Opt ) \
|
||||
do_klass(reflect_MagicAccessorImpl_klass, reflect_MagicAccessorImpl, Opt ) \
|
||||
do_klass(reflect_MethodAccessorImpl_klass, reflect_MethodAccessorImpl, Pre ) \
|
||||
do_klass(reflect_ConstructorAccessorImpl_klass, reflect_ConstructorAccessorImpl, Pre ) \
|
||||
do_klass(reflect_DelegatingClassLoader_klass, reflect_DelegatingClassLoader, Opt ) \
|
||||
do_klass(reflect_ConstantPool_klass, reflect_ConstantPool, Opt ) \
|
||||
do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, reflect_UnsafeStaticFieldAccessorImpl, Opt ) \
|
||||
do_klass(reflect_CallerSensitive_klass, reflect_CallerSensitive, Opt ) \
|
||||
\
|
||||
/* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \
|
||||
do_klass(DirectMethodHandle_klass, java_lang_invoke_DirectMethodHandle, Opt ) \
|
||||
|
||||
@ -248,7 +248,7 @@ bool Verifier::is_eligible_for_verification(instanceKlassHandle klass, bool shou
|
||||
// As of the fix for 4486457 we disable verification for all of the
|
||||
// dynamically-generated bytecodes associated with the 1.4
|
||||
// reflection implementation, not just those associated with
|
||||
// sun/reflect/SerializationConstructorAccessor.
|
||||
// jdk/internal/reflect/SerializationConstructorAccessor.
|
||||
// NOTE: this is called too early in the bootstrapping process to be
|
||||
// guarded by Universe::is_gte_jdk14x_version().
|
||||
// Also for lambda generated code, gte jdk8
|
||||
|
||||
@ -227,26 +227,20 @@
|
||||
\
|
||||
/* Support for reflection based on dynamic bytecode generation (JDK 1.4 and above) */ \
|
||||
\
|
||||
template(sun_reflect_FieldInfo, "sun/reflect/FieldInfo") \
|
||||
template(sun_reflect_MethodInfo, "sun/reflect/MethodInfo") \
|
||||
template(sun_reflect_MagicAccessorImpl, "sun/reflect/MagicAccessorImpl") \
|
||||
template(sun_reflect_MethodAccessorImpl, "sun/reflect/MethodAccessorImpl") \
|
||||
template(sun_reflect_ConstructorAccessorImpl, "sun/reflect/ConstructorAccessorImpl") \
|
||||
template(sun_reflect_SerializationConstructorAccessorImpl, "sun/reflect/SerializationConstructorAccessorImpl") \
|
||||
template(sun_reflect_DelegatingClassLoader, "sun/reflect/DelegatingClassLoader") \
|
||||
template(sun_reflect_Reflection, "sun/reflect/Reflection") \
|
||||
template(sun_reflect_CallerSensitive, "sun/reflect/CallerSensitive") \
|
||||
template(sun_reflect_CallerSensitive_signature, "Lsun/reflect/CallerSensitive;") \
|
||||
template(reflect_MagicAccessorImpl, "jdk/internal/reflect/MagicAccessorImpl") \
|
||||
template(reflect_MethodAccessorImpl, "jdk/internal/reflect/MethodAccessorImpl") \
|
||||
template(reflect_ConstructorAccessorImpl, "jdk/internal/reflect/ConstructorAccessorImpl") \
|
||||
template(reflect_DelegatingClassLoader, "jdk/internal/reflect/DelegatingClassLoader") \
|
||||
template(reflect_Reflection, "jdk/internal/reflect/Reflection") \
|
||||
template(reflect_CallerSensitive, "jdk/internal/reflect/CallerSensitive") \
|
||||
template(reflect_CallerSensitive_signature, "Ljdk/internal/reflect/CallerSensitive;") \
|
||||
template(checkedExceptions_name, "checkedExceptions") \
|
||||
template(clazz_name, "clazz") \
|
||||
template(exceptionTypes_name, "exceptionTypes") \
|
||||
template(modifiers_name, "modifiers") \
|
||||
template(newConstructor_name, "newConstructor") \
|
||||
template(newConstructor_signature, "(Lsun/reflect/MethodInfo;)Ljava/lang/reflect/Constructor;") \
|
||||
template(newField_name, "newField") \
|
||||
template(newField_signature, "(Lsun/reflect/FieldInfo;)Ljava/lang/reflect/Field;") \
|
||||
template(newMethod_name, "newMethod") \
|
||||
template(newMethod_signature, "(Lsun/reflect/MethodInfo;)Ljava/lang/reflect/Method;") \
|
||||
template(invokeBasic_name, "invokeBasic") \
|
||||
template(linkToVirtual_name, "linkToVirtual") \
|
||||
template(linkToStatic_name, "linkToStatic") \
|
||||
@ -268,9 +262,9 @@
|
||||
template(executable_name, "executable") \
|
||||
template(parameter_annotations_name, "parameterAnnotations") \
|
||||
template(annotation_default_name, "annotationDefault") \
|
||||
template(sun_reflect_ConstantPool, "sun/reflect/ConstantPool") \
|
||||
template(reflect_ConstantPool, "jdk/internal/reflect/ConstantPool") \
|
||||
template(ConstantPool_name, "constantPoolOop") \
|
||||
template(sun_reflect_UnsafeStaticFieldAccessorImpl, "sun/reflect/UnsafeStaticFieldAccessorImpl")\
|
||||
template(reflect_UnsafeStaticFieldAccessorImpl, "jdk/internal/reflect/UnsafeStaticFieldAccessorImpl")\
|
||||
template(base_name, "base") \
|
||||
/* Type Annotations (JDK 8 and above) */ \
|
||||
template(type_annotations_name, "typeAnnotations") \
|
||||
@ -870,12 +864,12 @@
|
||||
do_intrinsic(_Class_cast, java_lang_Class, Class_cast_name, object_object_signature, F_R) \
|
||||
do_name( Class_cast_name, "cast") \
|
||||
\
|
||||
do_intrinsic(_getClassAccessFlags, sun_reflect_Reflection, getClassAccessFlags_name, class_int_signature, F_SN) \
|
||||
do_intrinsic(_getClassAccessFlags, reflect_Reflection, getClassAccessFlags_name, class_int_signature, F_SN) \
|
||||
do_name( getClassAccessFlags_name, "getClassAccessFlags") \
|
||||
do_intrinsic(_getLength, java_lang_reflect_Array, getLength_name, object_int_signature, F_SN) \
|
||||
do_name( getLength_name, "getLength") \
|
||||
\
|
||||
do_intrinsic(_getCallerClass, sun_reflect_Reflection, getCallerClass_name, void_class_signature, F_SN) \
|
||||
do_intrinsic(_getCallerClass, reflect_Reflection, getCallerClass_name, void_class_signature, F_SN) \
|
||||
do_name( getCallerClass_name, "getCallerClass") \
|
||||
\
|
||||
do_intrinsic(_newArray, java_lang_reflect_Array, newArray_name, newArray_signature, F_SN) \
|
||||
|
||||
@ -1767,8 +1767,19 @@ run:
|
||||
((objArrayOop) arrObj)->obj_at_put(index, rhsObject);
|
||||
UPDATE_PC_AND_TOS_AND_CONTINUE(1, -3);
|
||||
}
|
||||
CASE(_bastore):
|
||||
ARRAY_STOREFROM32(T_BYTE, jbyte, "%d", STACK_INT, 0);
|
||||
CASE(_bastore): {
|
||||
ARRAY_INTRO(-3);
|
||||
int item = STACK_INT(-1);
|
||||
// if it is a T_BOOLEAN array, mask the stored value to 0/1
|
||||
if (arrObj->klass() == Universe::boolArrayKlassObj()) {
|
||||
item &= 1;
|
||||
} else {
|
||||
assert(arrObj->klass() == Universe::byteArrayKlassObj(),
|
||||
"should be byte array otherwise");
|
||||
}
|
||||
((typeArrayOop)arrObj)->byte_at_put(index, item);
|
||||
UPDATE_PC_AND_TOS_AND_CONTINUE(1, -3);
|
||||
}
|
||||
CASE(_castore):
|
||||
ARRAY_STOREFROM32(T_CHAR, jchar, "%d", STACK_INT, 0);
|
||||
CASE(_sastore):
|
||||
@ -1999,7 +2010,7 @@ run:
|
||||
} else if (tos_type == ltos) {
|
||||
SET_STACK_LONG(obj->long_field_acquire(field_offset), 0);
|
||||
MORE_STACK(1);
|
||||
} else if (tos_type == btos) {
|
||||
} else if (tos_type == btos || tos_type == ztos) {
|
||||
SET_STACK_INT(obj->byte_field_acquire(field_offset), -1);
|
||||
} else if (tos_type == ctos) {
|
||||
SET_STACK_INT(obj->char_field_acquire(field_offset), -1);
|
||||
@ -2020,7 +2031,7 @@ run:
|
||||
} else if (tos_type == ltos) {
|
||||
SET_STACK_LONG(obj->long_field(field_offset), 0);
|
||||
MORE_STACK(1);
|
||||
} else if (tos_type == btos) {
|
||||
} else if (tos_type == btos || tos_type == ztos) {
|
||||
SET_STACK_INT(obj->byte_field(field_offset), -1);
|
||||
} else if (tos_type == ctos) {
|
||||
SET_STACK_INT(obj->char_field(field_offset), -1);
|
||||
@ -2109,6 +2120,9 @@ run:
|
||||
obj->release_obj_field_put(field_offset, STACK_OBJECT(-1));
|
||||
} else if (tos_type == btos) {
|
||||
obj->release_byte_field_put(field_offset, STACK_INT(-1));
|
||||
} else if (tos_type == ztos) {
|
||||
int bool_field = STACK_INT(-1); // only store LSB
|
||||
obj->release_byte_field_put(field_offset, (bool_field & 1));
|
||||
} else if (tos_type == ltos) {
|
||||
obj->release_long_field_put(field_offset, STACK_LONG(-1));
|
||||
} else if (tos_type == ctos) {
|
||||
@ -2129,6 +2143,9 @@ run:
|
||||
obj->obj_field_put(field_offset, STACK_OBJECT(-1));
|
||||
} else if (tos_type == btos) {
|
||||
obj->byte_field_put(field_offset, STACK_INT(-1));
|
||||
} else if (tos_type == ztos) {
|
||||
int bool_field = STACK_INT(-1); // only store LSB
|
||||
obj->byte_field_put(field_offset, (bool_field & 1));
|
||||
} else if (tos_type == ltos) {
|
||||
obj->long_field_put(field_offset, STACK_LONG(-1));
|
||||
} else if (tos_type == ctos) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, 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
|
||||
@ -496,6 +496,7 @@ void Bytecodes::initialize() {
|
||||
|
||||
def(_fast_aputfield , "fast_aputfield" , "bJJ" , NULL , T_OBJECT , 0, true , _putfield );
|
||||
def(_fast_bputfield , "fast_bputfield" , "bJJ" , NULL , T_INT , 0, true , _putfield );
|
||||
def(_fast_zputfield , "fast_zputfield" , "bJJ" , NULL , T_INT , 0, true , _putfield );
|
||||
def(_fast_cputfield , "fast_cputfield" , "bJJ" , NULL , T_CHAR , 0, true , _putfield );
|
||||
def(_fast_dputfield , "fast_dputfield" , "bJJ" , NULL , T_DOUBLE , 0, true , _putfield );
|
||||
def(_fast_fputfield , "fast_fputfield" , "bJJ" , NULL , T_FLOAT , 0, true , _putfield );
|
||||
|
||||
@ -257,6 +257,7 @@ class Bytecodes: AllStatic {
|
||||
|
||||
_fast_aputfield ,
|
||||
_fast_bputfield ,
|
||||
_fast_zputfield ,
|
||||
_fast_cputfield ,
|
||||
_fast_dputfield ,
|
||||
_fast_fputfield ,
|
||||
|
||||
@ -1077,7 +1077,8 @@ IRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread,
|
||||
char sig_type = '\0';
|
||||
|
||||
switch(cp_entry->flag_state()) {
|
||||
case btos: sig_type = 'Z'; break;
|
||||
case btos: sig_type = 'B'; break;
|
||||
case ztos: sig_type = 'Z'; break;
|
||||
case ctos: sig_type = 'C'; break;
|
||||
case stos: sig_type = 'S'; break;
|
||||
case itos: sig_type = 'I'; break;
|
||||
|
||||
@ -89,8 +89,9 @@ void TemplateInterpreter::initialize() {
|
||||
// Implementation of EntryPoint
|
||||
|
||||
EntryPoint::EntryPoint() {
|
||||
assert(number_of_states == 9, "check the code below");
|
||||
assert(number_of_states == 10, "check the code below");
|
||||
_entry[btos] = NULL;
|
||||
_entry[ztos] = NULL;
|
||||
_entry[ctos] = NULL;
|
||||
_entry[stos] = NULL;
|
||||
_entry[atos] = NULL;
|
||||
@ -102,9 +103,10 @@ EntryPoint::EntryPoint() {
|
||||
}
|
||||
|
||||
|
||||
EntryPoint::EntryPoint(address bentry, address centry, address sentry, address aentry, address ientry, address lentry, address fentry, address dentry, address ventry) {
|
||||
assert(number_of_states == 9, "check the code below");
|
||||
EntryPoint::EntryPoint(address bentry, address zentry, address centry, address sentry, address aentry, address ientry, address lentry, address fentry, address dentry, address ventry) {
|
||||
assert(number_of_states == 10, "check the code below");
|
||||
_entry[btos] = bentry;
|
||||
_entry[ztos] = zentry;
|
||||
_entry[ctos] = centry;
|
||||
_entry[stos] = sentry;
|
||||
_entry[atos] = aentry;
|
||||
@ -155,6 +157,7 @@ EntryPoint DispatchTable::entry(int i) const {
|
||||
return
|
||||
EntryPoint(
|
||||
_table[btos][i],
|
||||
_table[ztos][i],
|
||||
_table[ctos][i],
|
||||
_table[stos][i],
|
||||
_table[atos][i],
|
||||
@ -169,8 +172,9 @@ EntryPoint DispatchTable::entry(int i) const {
|
||||
|
||||
void DispatchTable::set_entry(int i, EntryPoint& entry) {
|
||||
assert(0 <= i && i < length, "index out of bounds");
|
||||
assert(number_of_states == 9, "check the code below");
|
||||
assert(number_of_states == 10, "check the code below");
|
||||
_table[btos][i] = entry.entry(btos);
|
||||
_table[ztos][i] = entry.entry(ztos);
|
||||
_table[ctos][i] = entry.entry(ctos);
|
||||
_table[stos][i] = entry.entry(stos);
|
||||
_table[atos][i] = entry.entry(atos);
|
||||
|
||||
@ -47,7 +47,7 @@ class EntryPoint VALUE_OBJ_CLASS_SPEC {
|
||||
public:
|
||||
// Construction
|
||||
EntryPoint();
|
||||
EntryPoint(address bentry, address centry, address sentry, address aentry, address ientry, address lentry, address fentry, address dentry, address ventry);
|
||||
EntryPoint(address bentry, address zentry, address centry, address sentry, address aentry, address ientry, address lentry, address fentry, address dentry, address ventry);
|
||||
|
||||
// Attributes
|
||||
address entry(TosState state) const; // return target address for a given tosca state
|
||||
|
||||
@ -74,6 +74,7 @@ void TemplateInterpreterGenerator::generate_all() {
|
||||
Interpreter::_trace_code =
|
||||
EntryPoint(
|
||||
generate_trace_code(btos),
|
||||
generate_trace_code(ztos),
|
||||
generate_trace_code(ctos),
|
||||
generate_trace_code(stos),
|
||||
generate_trace_code(atos),
|
||||
@ -94,6 +95,7 @@ void TemplateInterpreterGenerator::generate_all() {
|
||||
generate_return_entry_for(itos, i, index_size),
|
||||
generate_return_entry_for(itos, i, index_size),
|
||||
generate_return_entry_for(itos, i, index_size),
|
||||
generate_return_entry_for(itos, i, index_size),
|
||||
generate_return_entry_for(atos, i, index_size),
|
||||
generate_return_entry_for(itos, i, index_size),
|
||||
generate_return_entry_for(ltos, i, index_size),
|
||||
@ -105,13 +107,16 @@ void TemplateInterpreterGenerator::generate_all() {
|
||||
}
|
||||
|
||||
{ CodeletMark cm(_masm, "invoke return entry points");
|
||||
const TosState states[] = {itos, itos, itos, itos, ltos, ftos, dtos, atos, vtos};
|
||||
// These states are in order specified in TosState, except btos/ztos/ctos/stos are
|
||||
// really the same as itos since there is no top of stack optimization for these types
|
||||
const TosState states[] = {itos, itos, itos, itos, itos, ltos, ftos, dtos, atos, vtos, ilgl};
|
||||
const int invoke_length = Bytecodes::length_for(Bytecodes::_invokestatic);
|
||||
const int invokeinterface_length = Bytecodes::length_for(Bytecodes::_invokeinterface);
|
||||
const int invokedynamic_length = Bytecodes::length_for(Bytecodes::_invokedynamic);
|
||||
|
||||
for (int i = 0; i < Interpreter::number_of_return_addrs; i++) {
|
||||
TosState state = states[i];
|
||||
assert(state != ilgl, "states array is wrong above");
|
||||
Interpreter::_invoke_return_entry[i] = generate_return_entry_for(state, invoke_length, sizeof(u2));
|
||||
Interpreter::_invokeinterface_return_entry[i] = generate_return_entry_for(state, invokeinterface_length, sizeof(u2));
|
||||
Interpreter::_invokedynamic_return_entry[i] = generate_return_entry_for(state, invokedynamic_length, sizeof(u4));
|
||||
@ -122,6 +127,7 @@ void TemplateInterpreterGenerator::generate_all() {
|
||||
Interpreter::_earlyret_entry =
|
||||
EntryPoint(
|
||||
generate_earlyret_entry_for(btos),
|
||||
generate_earlyret_entry_for(ztos),
|
||||
generate_earlyret_entry_for(ctos),
|
||||
generate_earlyret_entry_for(stos),
|
||||
generate_earlyret_entry_for(atos),
|
||||
@ -140,6 +146,7 @@ void TemplateInterpreterGenerator::generate_all() {
|
||||
generate_deopt_entry_for(itos, i),
|
||||
generate_deopt_entry_for(itos, i),
|
||||
generate_deopt_entry_for(itos, i),
|
||||
generate_deopt_entry_for(itos, i),
|
||||
generate_deopt_entry_for(atos, i),
|
||||
generate_deopt_entry_for(itos, i),
|
||||
generate_deopt_entry_for(ltos, i),
|
||||
@ -167,6 +174,7 @@ void TemplateInterpreterGenerator::generate_all() {
|
||||
Interpreter::_continuation_entry =
|
||||
EntryPoint(
|
||||
generate_continuation_for(btos),
|
||||
generate_continuation_for(ztos),
|
||||
generate_continuation_for(ctos),
|
||||
generate_continuation_for(stos),
|
||||
generate_continuation_for(atos),
|
||||
@ -182,6 +190,7 @@ void TemplateInterpreterGenerator::generate_all() {
|
||||
Interpreter::_safept_entry =
|
||||
EntryPoint(
|
||||
generate_safept_entry_for(btos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint)),
|
||||
generate_safept_entry_for(ztos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint)),
|
||||
generate_safept_entry_for(ctos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint)),
|
||||
generate_safept_entry_for(stos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint)),
|
||||
generate_safept_entry_for(atos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint)),
|
||||
@ -301,7 +310,7 @@ void TemplateInterpreterGenerator::set_safepoints_for_all_bytes() {
|
||||
|
||||
void TemplateInterpreterGenerator::set_unimplemented(int i) {
|
||||
address e = _unimplemented_bytecode;
|
||||
EntryPoint entry(e, e, e, e, e, e, e, e, e);
|
||||
EntryPoint entry(e, e, e, e, e, e, e, e, e, e);
|
||||
Interpreter::_normal_table.set_entry(i, entry);
|
||||
Interpreter::_wentry_point[i] = _unimplemented_bytecode;
|
||||
}
|
||||
@ -316,6 +325,7 @@ void TemplateInterpreterGenerator::set_entry_points(Bytecodes::Code code) {
|
||||
assert(_unimplemented_bytecode != NULL, "should have been generated before");
|
||||
assert(_illegal_bytecode_sequence != NULL, "should have been generated before");
|
||||
address bep = _illegal_bytecode_sequence;
|
||||
address zep = _illegal_bytecode_sequence;
|
||||
address cep = _illegal_bytecode_sequence;
|
||||
address sep = _illegal_bytecode_sequence;
|
||||
address aep = _illegal_bytecode_sequence;
|
||||
@ -337,7 +347,7 @@ void TemplateInterpreterGenerator::set_entry_points(Bytecodes::Code code) {
|
||||
set_wide_entry_point(t, wep);
|
||||
}
|
||||
// set entry points
|
||||
EntryPoint entry(bep, cep, sep, aep, iep, lep, fep, dep, vep);
|
||||
EntryPoint entry(bep, zep, cep, sep, aep, iep, lep, fep, dep, vep);
|
||||
Interpreter::_normal_table.set_entry(code, entry);
|
||||
Interpreter::_wentry_point[code] = wep;
|
||||
CodeCacheExtensions::completed_template_interpreter_entries(_masm, code);
|
||||
@ -355,6 +365,7 @@ void TemplateInterpreterGenerator::set_short_entry_points(Template* t, address&
|
||||
assert(t->is_valid(), "template must exist");
|
||||
switch (t->tos_in()) {
|
||||
case btos:
|
||||
case ztos:
|
||||
case ctos:
|
||||
case stos:
|
||||
ShouldNotReachHere(); // btos/ctos/stos should use itos.
|
||||
|
||||
@ -488,6 +488,7 @@ void TemplateTable::initialize() {
|
||||
|
||||
def(Bytecodes::_fast_aputfield , ubcp|____|____|____, atos, vtos, fast_storefield , atos );
|
||||
def(Bytecodes::_fast_bputfield , ubcp|____|____|____, itos, vtos, fast_storefield , itos );
|
||||
def(Bytecodes::_fast_zputfield , ubcp|____|____|____, itos, vtos, fast_storefield , itos );
|
||||
def(Bytecodes::_fast_cputfield , ubcp|____|____|____, itos, vtos, fast_storefield , itos );
|
||||
def(Bytecodes::_fast_dputfield , ubcp|____|____|____, dtos, vtos, fast_storefield , dtos );
|
||||
def(Bytecodes::_fast_fputfield , ubcp|____|____|____, ftos, vtos, fast_storefield , ftos );
|
||||
|
||||
@ -66,6 +66,7 @@ ConstMethod::ConstMethod(int byte_code_size,
|
||||
set_max_locals(0);
|
||||
set_method_idnum(0);
|
||||
set_size_of_parameters(0);
|
||||
set_result_type(T_VOID);
|
||||
}
|
||||
|
||||
// Accessor that copies to metadata.
|
||||
|
||||
@ -210,6 +210,7 @@ private:
|
||||
|
||||
int _constMethod_size;
|
||||
u2 _flags;
|
||||
u1 _result_type; // BasicType of result
|
||||
|
||||
// Size of Java bytecodes allocated immediately after Method*.
|
||||
u2 _code_size;
|
||||
@ -494,6 +495,8 @@ public:
|
||||
static ByteSize size_of_parameters_offset()
|
||||
{ return byte_offset_of(ConstMethod, _size_of_parameters); }
|
||||
|
||||
static ByteSize result_type_offset()
|
||||
{ return byte_offset_of(ConstMethod, _result_type); }
|
||||
|
||||
// Unique id for the method
|
||||
static const u2 MAX_IDNUM;
|
||||
@ -516,6 +519,8 @@ public:
|
||||
int size_of_parameters() const { return _size_of_parameters; }
|
||||
void set_size_of_parameters(int size) { _size_of_parameters = size; }
|
||||
|
||||
void set_result_type(BasicType rt) { assert(rt < 16, "result type too large");
|
||||
_result_type = (u1)rt; }
|
||||
// Deallocation for RedefineClasses
|
||||
void deallocate_contents(ClassLoaderData* loader_data);
|
||||
bool is_klass() const { return false; }
|
||||
|
||||
@ -77,18 +77,19 @@ class PSPromotionManager;
|
||||
// f2 flag true if f2 contains an oop (e.g., virtual final method)
|
||||
// fv flag true if invokeinterface used for method in class Object
|
||||
//
|
||||
// The flags 31, 30, 29, 28 together build a 4 bit number 0 to 8 with the
|
||||
// The flags 31, 30, 29, 28 together build a 4 bit number 0 to 16 with the
|
||||
// following mapping to the TosState states:
|
||||
//
|
||||
// btos: 0
|
||||
// ctos: 1
|
||||
// stos: 2
|
||||
// itos: 3
|
||||
// ltos: 4
|
||||
// ftos: 5
|
||||
// dtos: 6
|
||||
// atos: 7
|
||||
// vtos: 8
|
||||
// ztos: 1
|
||||
// ctos: 2
|
||||
// stos: 3
|
||||
// itos: 4
|
||||
// ltos: 5
|
||||
// ftos: 6
|
||||
// dtos: 7
|
||||
// atos: 8
|
||||
// vtos: 9
|
||||
//
|
||||
// Entry specific: field entries:
|
||||
// _indices = get (b1 section) and put (b2 section) bytecodes, original constant pool index
|
||||
@ -352,14 +353,8 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
|
||||
bool has_method_type() const { return (!is_f1_null()) && (_flags & (1 << has_method_type_shift)) != 0; }
|
||||
bool is_method_entry() const { return (_flags & (1 << is_field_entry_shift)) == 0; }
|
||||
bool is_field_entry() const { return (_flags & (1 << is_field_entry_shift)) != 0; }
|
||||
bool is_byte() const { return flag_state() == btos; }
|
||||
bool is_char() const { return flag_state() == ctos; }
|
||||
bool is_short() const { return flag_state() == stos; }
|
||||
bool is_int() const { return flag_state() == itos; }
|
||||
bool is_long() const { return flag_state() == ltos; }
|
||||
bool is_float() const { return flag_state() == ftos; }
|
||||
bool is_double() const { return flag_state() == dtos; }
|
||||
bool is_object() const { return flag_state() == atos; }
|
||||
TosState flag_state() const { assert((uint)number_of_states <= (uint)tos_state_mask+1, "");
|
||||
return (TosState)((_flags >> tos_state_shift) & tos_state_mask); }
|
||||
|
||||
|
||||
@ -342,6 +342,21 @@ protected:
|
||||
assert(btvalue >= T_BOOLEAN && btvalue <= T_OBJECT, "sanity");
|
||||
return (BasicType) btvalue;
|
||||
}
|
||||
|
||||
// Want a pattern to quickly diff against layout header in register
|
||||
// find something less clever!
|
||||
static int layout_helper_boolean_diffbit() {
|
||||
jint zlh = array_layout_helper(T_BOOLEAN);
|
||||
jint blh = array_layout_helper(T_BYTE);
|
||||
assert(zlh != blh, "array layout helpers must differ");
|
||||
int diffbit = 1;
|
||||
while ((diffbit & (zlh ^ blh)) == 0 && (diffbit & zlh) == 0) {
|
||||
diffbit <<= 1;
|
||||
assert(diffbit != 0, "make sure T_BOOLEAN has a different bit than T_BYTE");
|
||||
}
|
||||
return diffbit;
|
||||
}
|
||||
|
||||
static int layout_helper_log2_element_size(jint lh) {
|
||||
assert(lh < (jint)_lh_neutral_value, "must be array");
|
||||
int l2esz = (lh >> _lh_log2_element_size_shift) & _lh_log2_element_size_mask;
|
||||
|
||||
@ -84,9 +84,6 @@ Method::Method(ConstMethod* xconst, AccessFlags access_flags) {
|
||||
NoSafepointVerifier no_safepoint;
|
||||
set_constMethod(xconst);
|
||||
set_access_flags(access_flags);
|
||||
#ifdef CC_INTERP
|
||||
set_result_index(T_VOID);
|
||||
#endif
|
||||
set_intrinsic_id(vmIntrinsics::_none);
|
||||
set_jfr_towrite(false);
|
||||
set_force_inline(false);
|
||||
@ -445,12 +442,6 @@ void Method::compute_size_of_parameters(Thread *thread) {
|
||||
set_size_of_parameters(asc.size() + (is_static() ? 0 : 1));
|
||||
}
|
||||
|
||||
#ifdef CC_INTERP
|
||||
void Method::set_result_index(BasicType type) {
|
||||
_result_index = Interpreter::BasicType_as_index(type);
|
||||
}
|
||||
#endif
|
||||
|
||||
BasicType Method::result_type() const {
|
||||
ResultTypeFinder rtf(signature());
|
||||
return rtf.type();
|
||||
@ -1220,10 +1211,8 @@ methodHandle Method::make_method_handle_intrinsic(vmIntrinsics::ID iid,
|
||||
m->set_signature_index(_imcp_invoke_signature);
|
||||
assert(MethodHandles::is_signature_polymorphic_name(m->name()), "");
|
||||
assert(m->signature() == signature, "");
|
||||
#ifdef CC_INTERP
|
||||
ResultTypeFinder rtf(signature);
|
||||
m->set_result_index(rtf.type());
|
||||
#endif
|
||||
m->constMethod()->set_result_type(rtf.type());
|
||||
m->compute_size_of_parameters(THREAD);
|
||||
m->init_intrinsic_id();
|
||||
assert(m->is_method_handle_intrinsic(), "");
|
||||
|
||||
@ -69,9 +69,6 @@ class Method : public Metadata {
|
||||
AccessFlags _access_flags; // Access flags
|
||||
int _vtable_index; // vtable index of this method (see VtableIndexFlag)
|
||||
// note: can have vtables with >2**16 elements (because of inheritance)
|
||||
#ifdef CC_INTERP
|
||||
int _result_index; // C++ interpreter needs for converting results to/from stack
|
||||
#endif
|
||||
u2 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none)
|
||||
|
||||
// Flags
|
||||
@ -171,11 +168,6 @@ class Method : public Metadata {
|
||||
return constMethod()->type_annotations();
|
||||
}
|
||||
|
||||
#ifdef CC_INTERP
|
||||
void set_result_index(BasicType type);
|
||||
int result_index() { return _result_index; }
|
||||
#endif
|
||||
|
||||
// Helper routine: get klass name + "." + method name + signature as
|
||||
// C string, for the purpose of providing more useful NoSuchMethodErrors
|
||||
// and fatal error handling. The string is allocated in resource
|
||||
@ -563,7 +555,6 @@ class Method : public Metadata {
|
||||
void compute_size_of_parameters(Thread *thread); // word size of parameters (receiver if any + arguments)
|
||||
Symbol* klass_name() const; // returns the name of the method holder
|
||||
BasicType result_type() const; // type of the method result
|
||||
int result_type_index() const; // type index of the method result
|
||||
bool is_returning_oop() const { BasicType r = result_type(); return (r == T_OBJECT || r == T_ARRAY); }
|
||||
bool is_returning_fp() const { BasicType r = result_type(); return (r == T_FLOAT || r == T_DOUBLE); }
|
||||
|
||||
@ -664,9 +655,6 @@ class Method : public Metadata {
|
||||
// interpreter support
|
||||
static ByteSize const_offset() { return byte_offset_of(Method, _constMethod ); }
|
||||
static ByteSize access_flags_offset() { return byte_offset_of(Method, _access_flags ); }
|
||||
#ifdef CC_INTERP
|
||||
static ByteSize result_index_offset() { return byte_offset_of(Method, _result_index ); }
|
||||
#endif /* CC_INTERP */
|
||||
static ByteSize from_compiled_offset() { return byte_offset_of(Method, _from_compiled_entry); }
|
||||
static ByteSize code_offset() { return byte_offset_of(Method, _code); }
|
||||
static ByteSize method_data_offset() {
|
||||
|
||||
@ -443,7 +443,7 @@ jchar oopDesc::char_field(int offset) const { return (jchar) *
|
||||
void oopDesc::char_field_put(int offset, jchar contents) { *char_field_addr(offset) = (jint) contents; }
|
||||
|
||||
jboolean oopDesc::bool_field(int offset) const { return (jboolean) *bool_field_addr(offset); }
|
||||
void oopDesc::bool_field_put(int offset, jboolean contents) { *bool_field_addr(offset) = (jint) contents; }
|
||||
void oopDesc::bool_field_put(int offset, jboolean contents) { *bool_field_addr(offset) = (((jint) contents) & 1); }
|
||||
|
||||
jint oopDesc::int_field(int offset) const { return *int_field_addr(offset); }
|
||||
void oopDesc::int_field_put(int offset, jint contents) { *int_field_addr(offset) = contents; }
|
||||
@ -483,7 +483,7 @@ jchar oopDesc::char_field_acquire(int offset) const { return O
|
||||
void oopDesc::release_char_field_put(int offset, jchar contents) { OrderAccess::release_store(char_field_addr(offset), contents); }
|
||||
|
||||
jboolean oopDesc::bool_field_acquire(int offset) const { return OrderAccess::load_acquire(bool_field_addr(offset)); }
|
||||
void oopDesc::release_bool_field_put(int offset, jboolean contents) { OrderAccess::release_store(bool_field_addr(offset), contents); }
|
||||
void oopDesc::release_bool_field_put(int offset, jboolean contents) { OrderAccess::release_store(bool_field_addr(offset), (contents & 1)); }
|
||||
|
||||
jint oopDesc::int_field_acquire(int offset) const { return OrderAccess::load_acquire(int_field_addr(offset)); }
|
||||
void oopDesc::release_int_field_put(int offset, jint contents) { OrderAccess::release_store(int_field_addr(offset), contents); }
|
||||
|
||||
@ -96,7 +96,7 @@ class typeArrayOopDesc : public arrayOopDesc {
|
||||
void byte_at_put(int which, jbyte contents) { *byte_at_addr(which) = contents; }
|
||||
|
||||
jboolean bool_at(int which) const { return *bool_at_addr(which); }
|
||||
void bool_at_put(int which, jboolean contents) { *bool_at_addr(which) = contents; }
|
||||
void bool_at_put(int which, jboolean contents) { *bool_at_addr(which) = (((jint)contents) & 1); }
|
||||
|
||||
jchar char_at(int which) const { return *char_at_addr(which); }
|
||||
void char_at_put(int which, jchar contents) { *char_at_addr(which) = contents; }
|
||||
|
||||
@ -2309,7 +2309,7 @@ StoreNode* StoreNode::make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const
|
||||
ctl != NULL, "raw memory operations should have control edge");
|
||||
|
||||
switch (bt) {
|
||||
case T_BOOLEAN:
|
||||
case T_BOOLEAN: val = gvn.transform(new AndINode(val, gvn.intcon(0x1))); // Fall through to T_BYTE case
|
||||
case T_BYTE: return new StoreBNode(ctl, mem, adr, adr_type, val, mo);
|
||||
case T_INT: return new StoreINode(ctl, mem, adr, adr_type, val, mo);
|
||||
case T_CHAR:
|
||||
|
||||
@ -730,6 +730,26 @@ void Parse::do_all_blocks() {
|
||||
#endif
|
||||
}
|
||||
|
||||
static Node* mask_int_value(Node* v, BasicType bt, PhaseGVN* gvn) {
|
||||
switch (bt) {
|
||||
case T_BYTE:
|
||||
v = gvn->transform(new LShiftINode(v, gvn->intcon(24)));
|
||||
v = gvn->transform(new RShiftINode(v, gvn->intcon(24)));
|
||||
break;
|
||||
case T_SHORT:
|
||||
v = gvn->transform(new LShiftINode(v, gvn->intcon(16)));
|
||||
v = gvn->transform(new RShiftINode(v, gvn->intcon(16)));
|
||||
break;
|
||||
case T_CHAR:
|
||||
v = gvn->transform(new AndINode(v, gvn->intcon(0xFFFF)));
|
||||
break;
|
||||
case T_BOOLEAN:
|
||||
v = gvn->transform(new AndINode(v, gvn->intcon(0x1)));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
//-------------------------------build_exits----------------------------------
|
||||
// Build normal and exceptional exit merge points.
|
||||
void Parse::build_exits() {
|
||||
@ -754,6 +774,16 @@ void Parse::build_exits() {
|
||||
// Add a return value to the exit state. (Do not push it yet.)
|
||||
if (tf()->range()->cnt() > TypeFunc::Parms) {
|
||||
const Type* ret_type = tf()->range()->field_at(TypeFunc::Parms);
|
||||
if (ret_type->isa_int()) {
|
||||
BasicType ret_bt = method()->return_type()->basic_type();
|
||||
if (ret_bt == T_BOOLEAN ||
|
||||
ret_bt == T_CHAR ||
|
||||
ret_bt == T_BYTE ||
|
||||
ret_bt == T_SHORT) {
|
||||
ret_type = TypeInt::INT;
|
||||
}
|
||||
}
|
||||
|
||||
// Don't "bind" an unloaded return klass to the ret_phi. If the klass
|
||||
// becomes loaded during the subsequent parsing, the loaded and unloaded
|
||||
// types will not join when we transform and push in do_exits().
|
||||
@ -1014,6 +1044,10 @@ void Parse::do_exits() {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (ret_type->isa_int()) {
|
||||
BasicType ret_bt = method()->return_type()->basic_type();
|
||||
ret_phi = mask_int_value(ret_phi, ret_bt, &_gvn);
|
||||
}
|
||||
_exits.push_node(ret_type->basic_type(), ret_phi);
|
||||
}
|
||||
|
||||
|
||||
@ -64,11 +64,15 @@ void Parse::array_load(BasicType elem_type) {
|
||||
|
||||
//--------------------------------array_store----------------------------------
|
||||
void Parse::array_store(BasicType elem_type) {
|
||||
Node* adr = array_addressing(elem_type, 1);
|
||||
const Type* elem = Type::TOP;
|
||||
Node* adr = array_addressing(elem_type, 1, &elem);
|
||||
if (stopped()) return; // guaranteed null or range check
|
||||
Node* val = pop();
|
||||
dec_sp(2); // Pop array and index
|
||||
const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type);
|
||||
if (elem == TypeInt::BOOL) {
|
||||
elem_type = T_BOOLEAN;
|
||||
}
|
||||
store_to_memory(control(), adr, val, elem_type, adr_type, StoreNode::release_if_reference(elem_type));
|
||||
}
|
||||
|
||||
|
||||
@ -1902,14 +1902,16 @@ const TypeTuple *TypeTuple::make_domain(ciInstanceKlass* recv, ciSignature* sig)
|
||||
break;
|
||||
case T_OBJECT:
|
||||
case T_ARRAY:
|
||||
case T_BOOLEAN:
|
||||
case T_CHAR:
|
||||
case T_FLOAT:
|
||||
case T_BYTE:
|
||||
case T_SHORT:
|
||||
case T_INT:
|
||||
field_array[pos++] = get_const_type(type);
|
||||
break;
|
||||
case T_BOOLEAN:
|
||||
case T_CHAR:
|
||||
case T_BYTE:
|
||||
case T_SHORT:
|
||||
field_array[pos++] = TypeInt::INT;
|
||||
break;
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
|
||||
@ -919,7 +919,14 @@ class JNI_ArgumentPusherVaArg : public JNI_ArgumentPusher {
|
||||
protected:
|
||||
va_list _ap;
|
||||
|
||||
inline void get_bool() { _arguments->push_int(va_arg(_ap, jint)); } // bool is coerced to int when using va_arg
|
||||
inline void get_bool() {
|
||||
// Normalize boolean arguments from native code by converting 1-255 to JNI_TRUE and
|
||||
// 0 to JNI_FALSE. Boolean return values from native are normalized the same in
|
||||
// TemplateInterpreterGenerator::generate_result_handler_for and
|
||||
// SharedRuntime::generate_native_wrapper.
|
||||
jboolean b = va_arg(_ap, jint);
|
||||
_arguments->push_int((jint)(b == 0 ? JNI_FALSE : JNI_TRUE));
|
||||
}
|
||||
inline void get_char() { _arguments->push_int(va_arg(_ap, jint)); } // char is coerced to int when using va_arg
|
||||
inline void get_short() { _arguments->push_int(va_arg(_ap, jint)); } // short is coerced to int when using va_arg
|
||||
inline void get_byte() { _arguments->push_int(va_arg(_ap, jint)); } // byte is coerced to int when using va_arg
|
||||
@ -960,9 +967,17 @@ class JNI_ArgumentPusherVaArg : public JNI_ArgumentPusher {
|
||||
while ( 1 ) {
|
||||
switch ( fingerprint & parameter_feature_mask ) {
|
||||
case bool_parm:
|
||||
get_bool();
|
||||
break;
|
||||
case char_parm:
|
||||
get_char();
|
||||
break;
|
||||
case short_parm:
|
||||
get_short();
|
||||
break;
|
||||
case byte_parm:
|
||||
get_byte();
|
||||
break;
|
||||
case int_parm:
|
||||
get_int();
|
||||
break;
|
||||
@ -996,7 +1011,14 @@ class JNI_ArgumentPusherArray : public JNI_ArgumentPusher {
|
||||
protected:
|
||||
const jvalue *_ap;
|
||||
|
||||
inline void get_bool() { _arguments->push_int((jint)(_ap++)->z); }
|
||||
inline void get_bool() {
|
||||
// Normalize boolean arguments from native code by converting 1-255 to JNI_TRUE and
|
||||
// 0 to JNI_FALSE. Boolean return values from native are normalized the same in
|
||||
// TemplateInterpreterGenerator::generate_result_handler_for and
|
||||
// SharedRuntime::generate_native_wrapper.
|
||||
jboolean b = (_ap++)->z;
|
||||
_arguments->push_int((jint)(b == 0 ? JNI_FALSE : JNI_TRUE));
|
||||
}
|
||||
inline void get_char() { _arguments->push_int((jint)(_ap++)->c); }
|
||||
inline void get_short() { _arguments->push_int((jint)(_ap++)->s); }
|
||||
inline void get_byte() { _arguments->push_int((jint)(_ap++)->b); }
|
||||
@ -2188,6 +2210,7 @@ JNI_QUICK_ENTRY(void, jni_Set##Result##Field(JNIEnv *env, jobject obj, jfieldID
|
||||
field_value.unionType = value; \
|
||||
o = JvmtiExport::jni_SetField_probe_nh(thread, obj, o, k, fieldID, false, SigType, (jvalue *)&field_value); \
|
||||
} \
|
||||
if (SigType == 'Z') { value = ((jboolean)value) & 1; } \
|
||||
o->Fieldname##_field_put(offset, value); \
|
||||
ReturnProbe; \
|
||||
JNI_END
|
||||
@ -2387,6 +2410,7 @@ JNI_ENTRY(void, jni_SetStatic##Result##Field(JNIEnv *env, jclass clazz, jfieldID
|
||||
field_value.unionType = value; \
|
||||
JvmtiExport::jni_SetField_probe(thread, NULL, NULL, id->holder(), fieldID, true, SigType, (jvalue *)&field_value); \
|
||||
} \
|
||||
if (SigType == 'Z') { value = ((jboolean)value) & 1; } \
|
||||
id->holder()->java_mirror()-> Fieldname##_field_put (id->offset(), value); \
|
||||
ReturnProbe;\
|
||||
JNI_END
|
||||
|
||||
@ -1940,8 +1940,8 @@ JVM_ENTRY(jobject, JVM_GetClassConstantPool(JNIEnv *env, jclass cls))
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
if (k->is_instance_klass()) {
|
||||
instanceKlassHandle k_h(THREAD, k);
|
||||
Handle jcp = sun_reflect_ConstantPool::create(CHECK_NULL);
|
||||
sun_reflect_ConstantPool::set_cp(jcp(), k_h->constants());
|
||||
Handle jcp = reflect_ConstantPool::create(CHECK_NULL);
|
||||
reflect_ConstantPool::set_cp(jcp(), k_h->constants());
|
||||
return JNIHandles::make_local(jcp());
|
||||
}
|
||||
}
|
||||
@ -1953,7 +1953,7 @@ JVM_END
|
||||
JVM_ENTRY(jint, JVM_ConstantPoolGetSize(JNIEnv *env, jobject obj, jobject unused))
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetSize");
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
return cp->length();
|
||||
}
|
||||
JVM_END
|
||||
@ -1962,7 +1962,7 @@ JVM_END
|
||||
JVM_ENTRY(jclass, JVM_ConstantPoolGetClassAt(JNIEnv *env, jobject obj, jobject unused, jint index))
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetClassAt");
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_NULL);
|
||||
constantTag tag = cp->tag_at(index);
|
||||
if (!tag.is_klass() && !tag.is_unresolved_klass()) {
|
||||
@ -1976,7 +1976,7 @@ JVM_END
|
||||
JVM_ENTRY(jclass, JVM_ConstantPoolGetClassAtIfLoaded(JNIEnv *env, jobject obj, jobject unused, jint index))
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetClassAtIfLoaded");
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_NULL);
|
||||
constantTag tag = cp->tag_at(index);
|
||||
if (!tag.is_klass() && !tag.is_unresolved_klass()) {
|
||||
@ -2021,7 +2021,7 @@ JVM_ENTRY(jobject, JVM_ConstantPoolGetMethodAt(JNIEnv *env, jobject obj, jobject
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetMethodAt");
|
||||
JvmtiVMObjectAllocEventCollector oam;
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_NULL);
|
||||
jobject res = get_method_at_helper(cp, index, true, CHECK_NULL);
|
||||
return res;
|
||||
@ -2032,7 +2032,7 @@ JVM_ENTRY(jobject, JVM_ConstantPoolGetMethodAtIfLoaded(JNIEnv *env, jobject obj,
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetMethodAtIfLoaded");
|
||||
JvmtiVMObjectAllocEventCollector oam;
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_NULL);
|
||||
jobject res = get_method_at_helper(cp, index, false, CHECK_NULL);
|
||||
return res;
|
||||
@ -2068,7 +2068,7 @@ JVM_ENTRY(jobject, JVM_ConstantPoolGetFieldAt(JNIEnv *env, jobject obj, jobject
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetFieldAt");
|
||||
JvmtiVMObjectAllocEventCollector oam;
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_NULL);
|
||||
jobject res = get_field_at_helper(cp, index, true, CHECK_NULL);
|
||||
return res;
|
||||
@ -2079,7 +2079,7 @@ JVM_ENTRY(jobject, JVM_ConstantPoolGetFieldAtIfLoaded(JNIEnv *env, jobject obj,
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetFieldAtIfLoaded");
|
||||
JvmtiVMObjectAllocEventCollector oam;
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_NULL);
|
||||
jobject res = get_field_at_helper(cp, index, false, CHECK_NULL);
|
||||
return res;
|
||||
@ -2090,7 +2090,7 @@ JVM_ENTRY(jobjectArray, JVM_ConstantPoolGetMemberRefInfoAt(JNIEnv *env, jobject
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetMemberRefInfoAt");
|
||||
JvmtiVMObjectAllocEventCollector oam;
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_NULL);
|
||||
constantTag tag = cp->tag_at(index);
|
||||
if (!tag.is_field_or_method()) {
|
||||
@ -2116,7 +2116,7 @@ JVM_ENTRY(jint, JVM_ConstantPoolGetClassRefIndexAt(JNIEnv *env, jobject obj, job
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetClassRefIndexAt");
|
||||
JvmtiVMObjectAllocEventCollector oam;
|
||||
constantPoolHandle cp(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_0);
|
||||
constantTag tag = cp->tag_at(index);
|
||||
if (!tag.is_field_or_method()) {
|
||||
@ -2130,7 +2130,7 @@ JVM_ENTRY(jint, JVM_ConstantPoolGetNameAndTypeRefIndexAt(JNIEnv *env, jobject ob
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetNameAndTypeRefIndexAt");
|
||||
JvmtiVMObjectAllocEventCollector oam;
|
||||
constantPoolHandle cp(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_0);
|
||||
constantTag tag = cp->tag_at(index);
|
||||
if (!tag.is_invoke_dynamic() && !tag.is_field_or_method()) {
|
||||
@ -2144,7 +2144,7 @@ JVM_ENTRY(jobjectArray, JVM_ConstantPoolGetNameAndTypeRefInfoAt(JNIEnv *env, job
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetNameAndTypeRefInfoAt");
|
||||
JvmtiVMObjectAllocEventCollector oam;
|
||||
constantPoolHandle cp(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_NULL);
|
||||
constantTag tag = cp->tag_at(index);
|
||||
if (!tag.is_name_and_type()) {
|
||||
@ -2165,7 +2165,7 @@ JVM_END
|
||||
JVM_ENTRY(jint, JVM_ConstantPoolGetIntAt(JNIEnv *env, jobject obj, jobject unused, jint index))
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetIntAt");
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_0);
|
||||
constantTag tag = cp->tag_at(index);
|
||||
if (!tag.is_int()) {
|
||||
@ -2178,7 +2178,7 @@ JVM_END
|
||||
JVM_ENTRY(jlong, JVM_ConstantPoolGetLongAt(JNIEnv *env, jobject obj, jobject unused, jint index))
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetLongAt");
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_(0L));
|
||||
constantTag tag = cp->tag_at(index);
|
||||
if (!tag.is_long()) {
|
||||
@ -2191,7 +2191,7 @@ JVM_END
|
||||
JVM_ENTRY(jfloat, JVM_ConstantPoolGetFloatAt(JNIEnv *env, jobject obj, jobject unused, jint index))
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetFloatAt");
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_(0.0f));
|
||||
constantTag tag = cp->tag_at(index);
|
||||
if (!tag.is_float()) {
|
||||
@ -2204,7 +2204,7 @@ JVM_END
|
||||
JVM_ENTRY(jdouble, JVM_ConstantPoolGetDoubleAt(JNIEnv *env, jobject obj, jobject unused, jint index))
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetDoubleAt");
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_(0.0));
|
||||
constantTag tag = cp->tag_at(index);
|
||||
if (!tag.is_double()) {
|
||||
@ -2217,7 +2217,7 @@ JVM_END
|
||||
JVM_ENTRY(jstring, JVM_ConstantPoolGetStringAt(JNIEnv *env, jobject obj, jobject unused, jint index))
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetStringAt");
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_NULL);
|
||||
constantTag tag = cp->tag_at(index);
|
||||
if (!tag.is_string()) {
|
||||
@ -2232,7 +2232,7 @@ JVM_ENTRY(jstring, JVM_ConstantPoolGetUTF8At(JNIEnv *env, jobject obj, jobject u
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetUTF8At");
|
||||
JvmtiVMObjectAllocEventCollector oam;
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_NULL);
|
||||
constantTag tag = cp->tag_at(index);
|
||||
if (!tag.is_symbol()) {
|
||||
@ -2247,7 +2247,7 @@ JVM_END
|
||||
JVM_ENTRY(jbyte, JVM_ConstantPoolGetTagAt(JNIEnv *env, jobject obj, jobject unused, jint index))
|
||||
{
|
||||
JVMWrapper("JVM_ConstantPoolGetTagAt");
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
|
||||
bounds_check(cp, index, CHECK_0);
|
||||
constantTag tag = cp->tag_at(index);
|
||||
jbyte result = tag.value();
|
||||
|
||||
@ -1354,7 +1354,7 @@ JvmtiEnvBase::check_top_frame(JavaThread* current_thread, JavaThread* java_threa
|
||||
ResultTypeFinder rtf(signature);
|
||||
TosState fr_tos = as_TosState(rtf.type());
|
||||
if (fr_tos != tos) {
|
||||
if (tos != itos || (fr_tos != btos && fr_tos != ctos && fr_tos != stos)) {
|
||||
if (tos != itos || (fr_tos != btos && fr_tos != ztos && fr_tos != ctos && fr_tos != stos)) {
|
||||
return JVMTI_ERROR_TYPE_MISMATCH;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1699,7 +1699,7 @@ void JvmtiExport::post_raw_field_modification(JavaThread *thread, Method* method
|
||||
address location, KlassHandle field_klass, Handle object, jfieldID field,
|
||||
char sig_type, jvalue *value) {
|
||||
|
||||
if (sig_type == 'I' || sig_type == 'Z' || sig_type == 'C' || sig_type == 'S') {
|
||||
if (sig_type == 'I' || sig_type == 'Z' || sig_type == 'B' || sig_type == 'C' || sig_type == 'S') {
|
||||
// 'I' instructions are used for byte, char, short and int.
|
||||
// determine which it really is, and convert
|
||||
fieldDescriptor fd;
|
||||
|
||||
@ -133,13 +133,22 @@ jlong Unsafe_field_offset_from_byte_offset(jlong byte_offset) {
|
||||
|
||||
///// Data in the Java heap.
|
||||
|
||||
#define truncate_jboolean(x) ((x) & 1)
|
||||
#define truncate_jbyte(x) (x)
|
||||
#define truncate_jshort(x) (x)
|
||||
#define truncate_jchar(x) (x)
|
||||
#define truncate_jint(x) (x)
|
||||
#define truncate_jlong(x) (x)
|
||||
#define truncate_jfloat(x) (x)
|
||||
#define truncate_jdouble(x) (x)
|
||||
|
||||
#define GET_FIELD(obj, offset, type_name, v) \
|
||||
oop p = JNIHandles::resolve(obj); \
|
||||
type_name v = *(type_name*)index_oop_from_field_offset_long(p, offset)
|
||||
|
||||
#define SET_FIELD(obj, offset, type_name, x) \
|
||||
oop p = JNIHandles::resolve(obj); \
|
||||
*(type_name*)index_oop_from_field_offset_long(p, offset) = x
|
||||
*(type_name*)index_oop_from_field_offset_long(p, offset) = truncate_##type_name(x)
|
||||
|
||||
#define GET_FIELD_VOLATILE(obj, offset, type_name, v) \
|
||||
oop p = JNIHandles::resolve(obj); \
|
||||
@ -150,7 +159,7 @@ jlong Unsafe_field_offset_from_byte_offset(jlong byte_offset) {
|
||||
|
||||
#define SET_FIELD_VOLATILE(obj, offset, type_name, x) \
|
||||
oop p = JNIHandles::resolve(obj); \
|
||||
OrderAccess::release_store_fence((volatile type_name*)index_oop_from_field_offset_long(p, offset), x);
|
||||
OrderAccess::release_store_fence((volatile type_name*)index_oop_from_field_offset_long(p, offset), truncate_##type_name(x));
|
||||
|
||||
|
||||
// Get/SetObject must be special-cased, since it works with handles.
|
||||
|
||||
@ -896,13 +896,25 @@ void Deoptimization::reassign_type_array_elements(frame* fr, RegisterMap* reg_ma
|
||||
break;
|
||||
}
|
||||
|
||||
case T_SHORT: case T_CHAR: // 2 bytes
|
||||
case T_SHORT:
|
||||
assert(value->type() == T_INT, "Agreement.");
|
||||
val = value->get_int();
|
||||
obj->short_at_put(index, (jshort)*((jint*)&val));
|
||||
break;
|
||||
|
||||
case T_BOOLEAN: case T_BYTE: // 1 byte
|
||||
case T_CHAR:
|
||||
assert(value->type() == T_INT, "Agreement.");
|
||||
val = value->get_int();
|
||||
obj->char_at_put(index, (jchar)*((jint*)&val));
|
||||
break;
|
||||
|
||||
case T_BYTE:
|
||||
assert(value->type() == T_INT, "Agreement.");
|
||||
val = value->get_int();
|
||||
obj->byte_at_put(index, (jbyte)*((jint*)&val));
|
||||
break;
|
||||
|
||||
case T_BOOLEAN:
|
||||
assert(value->type() == T_INT, "Agreement.");
|
||||
val = value->get_int();
|
||||
obj->bool_at_put(index, (jboolean)*((jint*)&val));
|
||||
@ -1017,13 +1029,25 @@ static int reassign_fields_by_klass(InstanceKlass* klass, frame* fr, RegisterMap
|
||||
break;
|
||||
}
|
||||
|
||||
case T_SHORT: case T_CHAR: // 2 bytes
|
||||
case T_SHORT:
|
||||
assert(value->type() == T_INT, "Agreement.");
|
||||
val = value->get_int();
|
||||
obj->short_field_put(offset, (jshort)*((jint*)&val));
|
||||
break;
|
||||
|
||||
case T_BOOLEAN: case T_BYTE: // 1 byte
|
||||
case T_CHAR:
|
||||
assert(value->type() == T_INT, "Agreement.");
|
||||
val = value->get_int();
|
||||
obj->char_field_put(offset, (jchar)*((jint*)&val));
|
||||
break;
|
||||
|
||||
case T_BYTE:
|
||||
assert(value->type() == T_INT, "Agreement.");
|
||||
val = value->get_int();
|
||||
obj->byte_field_put(offset, (jbyte)*((jint*)&val));
|
||||
break;
|
||||
|
||||
case T_BOOLEAN:
|
||||
assert(value->type() == T_INT, "Agreement.");
|
||||
val = value->get_int();
|
||||
obj->bool_field_put(offset, (jboolean)*((jint*)&val));
|
||||
|
||||
@ -487,7 +487,7 @@ Reflection::VerifyClassAccessResults Reflection::verify_class_access(
|
||||
is_same_class_package(current_class, new_class)) {
|
||||
return ACCESS_OK;
|
||||
}
|
||||
// Allow all accesses from sun/reflect/MagicAccessorImpl subclasses to
|
||||
// Allow all accesses from jdk/internal/reflect/MagicAccessorImpl subclasses to
|
||||
// succeed trivially.
|
||||
if (current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
|
||||
return ACCESS_OK;
|
||||
@ -698,7 +698,7 @@ bool Reflection::verify_field_access(const Klass* current_class,
|
||||
return true;
|
||||
}
|
||||
|
||||
// Allow all accesses from sun/reflect/MagicAccessorImpl subclasses to
|
||||
// Allow all accesses from jdk/internal/reflect/MagicAccessorImpl subclasses to
|
||||
// succeed trivially.
|
||||
if (current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
|
||||
return true;
|
||||
@ -1025,7 +1025,7 @@ static BasicType basic_type_mirror_to_basic_type(oop basic_type_mirror, TRAPS) {
|
||||
static void narrow(jvalue* value, BasicType narrow_type, TRAPS) {
|
||||
switch (narrow_type) {
|
||||
case T_BOOLEAN:
|
||||
value->z = (jboolean)value->i;
|
||||
value->z = (jboolean) (value->i & 1);
|
||||
return;
|
||||
case T_BYTE:
|
||||
value->b = (jbyte)value->i;
|
||||
|
||||
@ -76,9 +76,9 @@ void FilteredFieldsMap::initialize() {
|
||||
int offset;
|
||||
offset = java_lang_Throwable::get_backtrace_offset();
|
||||
_filtered_fields->append(new FilteredField(SystemDictionary::Throwable_klass(), offset));
|
||||
offset = sun_reflect_ConstantPool::oop_offset();
|
||||
offset = reflect_ConstantPool::oop_offset();
|
||||
_filtered_fields->append(new FilteredField(SystemDictionary::reflect_ConstantPool_klass(), offset));
|
||||
offset = sun_reflect_UnsafeStaticFieldAccessorImpl::base_offset();
|
||||
offset = reflect_UnsafeStaticFieldAccessorImpl::base_offset();
|
||||
_filtered_fields->append(new FilteredField(SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass(), offset));
|
||||
}
|
||||
|
||||
|
||||
@ -851,14 +851,15 @@ class JavaValue {
|
||||
|
||||
enum TosState { // describes the tos cache contents
|
||||
btos = 0, // byte, bool tos cached
|
||||
ctos = 1, // char tos cached
|
||||
stos = 2, // short tos cached
|
||||
itos = 3, // int tos cached
|
||||
ltos = 4, // long tos cached
|
||||
ftos = 5, // float tos cached
|
||||
dtos = 6, // double tos cached
|
||||
atos = 7, // object cached
|
||||
vtos = 8, // tos not cached
|
||||
ztos = 1, // byte, bool tos cached
|
||||
ctos = 2, // char tos cached
|
||||
stos = 3, // short tos cached
|
||||
itos = 4, // int tos cached
|
||||
ltos = 5, // long tos cached
|
||||
ftos = 6, // float tos cached
|
||||
dtos = 7, // double tos cached
|
||||
atos = 8, // object cached
|
||||
vtos = 9, // tos not cached
|
||||
number_of_states,
|
||||
ilgl // illegal state: should not occur
|
||||
};
|
||||
@ -867,7 +868,7 @@ enum TosState { // describes the tos cache contents
|
||||
inline TosState as_TosState(BasicType type) {
|
||||
switch (type) {
|
||||
case T_BYTE : return btos;
|
||||
case T_BOOLEAN: return btos; // FIXME: Add ztos
|
||||
case T_BOOLEAN: return ztos;
|
||||
case T_CHAR : return ctos;
|
||||
case T_SHORT : return stos;
|
||||
case T_INT : return itos;
|
||||
@ -883,8 +884,8 @@ inline TosState as_TosState(BasicType type) {
|
||||
|
||||
inline BasicType as_BasicType(TosState state) {
|
||||
switch (state) {
|
||||
//case ztos: return T_BOOLEAN;//FIXME
|
||||
case btos : return T_BYTE;
|
||||
case ztos : return T_BOOLEAN;
|
||||
case ctos : return T_CHAR;
|
||||
case stos : return T_SHORT;
|
||||
case itos : return T_INT;
|
||||
|
||||
@ -28,8 +28,8 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
|
||||
import sun.hotspot.WhiteBox;
|
||||
import sun.reflect.ConstantPool;
|
||||
import sun.reflect.ConstantPool.Tag;
|
||||
import jdk.internal.reflect.ConstantPool;
|
||||
import jdk.internal.reflect.ConstantPool.Tag;
|
||||
import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
|
||||
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
|
||||
|
||||
|
||||
@ -34,8 +34,8 @@ import java.util.Map;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.org.objectweb.asm.Opcodes;
|
||||
import sun.hotspot.WhiteBox;
|
||||
import sun.reflect.ConstantPool;
|
||||
import sun.reflect.ConstantPool.Tag;
|
||||
import jdk.internal.reflect.ConstantPool;
|
||||
import jdk.internal.reflect.ConstantPool.Tag;
|
||||
|
||||
/**
|
||||
* Class contains hard-coded constant pool tables for dummy classes used for
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
* @library /testlibrary /test/lib /
|
||||
* @library ../common/patches
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.base/jdk.internal.reflect
|
||||
* java.base/jdk.internal.org.objectweb.asm
|
||||
* java.base/jdk.internal.org.objectweb.asm.tree
|
||||
* jdk.vm.ci/jdk.vm.ci.hotspot
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
* @library /testlibrary /test/lib /
|
||||
* @library ../common/patches
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.base/jdk.internal.reflect
|
||||
* java.base/jdk.internal.org.objectweb.asm
|
||||
* java.base/jdk.internal.org.objectweb.asm.tree
|
||||
* jdk.vm.ci/jdk.vm.ci.hotspot
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
* @library /testlibrary /test/lib /
|
||||
* @library ../common/patches
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.base/jdk.internal.reflect
|
||||
* java.base/jdk.internal.org.objectweb.asm
|
||||
* java.base/jdk.internal.org.objectweb.asm.tree
|
||||
* jdk.vm.ci/jdk.vm.ci.hotspot
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
* @library /testlibrary /test/lib /
|
||||
* @library ../common/patches
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.base/jdk.internal.reflect
|
||||
* java.base/jdk.internal.org.objectweb.asm
|
||||
* java.base/jdk.internal.org.objectweb.asm.tree
|
||||
* jdk.vm.ci/jdk.vm.ci.hotspot
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
* @library /testlibrary /test/lib /
|
||||
* @library ../common/patches
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.base/jdk.internal.reflect
|
||||
* java.base/jdk.internal.org.objectweb.asm
|
||||
* java.base/jdk.internal.org.objectweb.asm.tree
|
||||
* jdk.vm.ci/jdk.vm.ci.hotspot
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
* @library /testlibrary /test/lib /
|
||||
* @library ../common/patches
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.base/jdk.internal.reflect
|
||||
* java.base/jdk.internal.org.objectweb.asm
|
||||
* java.base/jdk.internal.org.objectweb.asm.tree
|
||||
* jdk.vm.ci/jdk.vm.ci.hotspot
|
||||
|
||||
@ -28,7 +28,8 @@
|
||||
* @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
|
||||
* @library /testlibrary /test/lib /
|
||||
* @library ../common/patches
|
||||
* @modules java.base/jdk.internal.org.objectweb.asm
|
||||
* @modules java.base/jdk.internal.reflect
|
||||
* java.base/jdk.internal.org.objectweb.asm
|
||||
* java.base/jdk.internal.org.objectweb.asm.tree
|
||||
* jdk.vm.ci/jdk.vm.ci.hotspot
|
||||
* jdk.vm.ci/jdk.vm.ci.code
|
||||
@ -76,7 +77,7 @@ public class MethodIsIgnoredBySecurityStackWalkTest {
|
||||
testCases.put(aClass.getMethod("invoke", Object.class,
|
||||
Object[].class), true);
|
||||
|
||||
aClass = Class.forName("sun.reflect.NativeMethodAccessorImpl");
|
||||
aClass = Class.forName("jdk.internal.reflect.NativeMethodAccessorImpl");
|
||||
testCases.put(aClass.getMethod("invoke", Object.class,
|
||||
Object[].class), true);
|
||||
testCases.put(aClass.getDeclaredMethod("invoke0", Method.class,
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
* @library /testlibrary /test/lib /
|
||||
* @library ../common/patches
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.base/jdk.internal.reflect
|
||||
* java.base/jdk.internal.org.objectweb.asm
|
||||
* jdk.vm.ci/jdk.vm.ci.hotspot
|
||||
* jdk.vm.ci/jdk.vm.ci.meta
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
* @library /testlibrary /test/lib /
|
||||
* @library ../common/patches
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.base/jdk.internal.reflect
|
||||
* java.base/jdk.internal.org.objectweb.asm
|
||||
* java.base/jdk.internal.org.objectweb.asm.tree
|
||||
* jdk.vm.ci/jdk.vm.ci.hotspot
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
* @library /testlibrary /test/lib /
|
||||
* @library ../common/patches
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.base/jdk.internal.reflect
|
||||
* java.base/jdk.internal.org.objectweb.asm
|
||||
* java.base/jdk.internal.org.objectweb.asm.tree
|
||||
* jdk.vm.ci/jdk.vm.ci.hotspot
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
* @library /testlibrary /test/lib /
|
||||
* @library ../common/patches
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.base/jdk.internal.reflect
|
||||
* java.base/jdk.internal.org.objectweb.asm
|
||||
* jdk.vm.ci/jdk.vm.ci.hotspot
|
||||
* jdk.vm.ci/jdk.vm.ci.meta
|
||||
|
||||
@ -25,7 +25,8 @@
|
||||
* @test
|
||||
* @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
|
||||
* @library ../../../../../
|
||||
* @modules jdk.vm.ci/jdk.vm.ci.meta
|
||||
* @modules java.base/jdk.internal.reflect
|
||||
* jdk.vm.ci/jdk.vm.ci.meta
|
||||
* jdk.vm.ci/jdk.vm.ci.runtime
|
||||
* jdk.vm.ci/jdk.vm.ci.common
|
||||
* @build jdk.vm.ci.runtime.test.TestResolvedJavaType
|
||||
@ -70,7 +71,7 @@ import jdk.vm.ci.meta.TrustedInterface;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import sun.reflect.ConstantPool;
|
||||
import jdk.internal.reflect.ConstantPool;
|
||||
|
||||
/**
|
||||
* Tests for {@link ResolvedJavaType}.
|
||||
|
||||
35
hotspot/test/runtime/BoolReturn/BoolConstructor.java
Normal file
35
hotspot/test/runtime/BoolReturn/BoolConstructor.java
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import jdk.test.lib.Asserts;
|
||||
|
||||
public class BoolConstructor {
|
||||
|
||||
boolean field;
|
||||
BoolConstructor(boolean b, boolean expected) {
|
||||
field = b;
|
||||
// System.out.println("b is " + b + " field is " + field);
|
||||
Asserts.assertTrue(field == b, "BoolConstructor argument not converted correctly");
|
||||
Asserts.assertTrue(field == expected, "BoolConstructor argument not stored correctly");
|
||||
}
|
||||
}
|
||||
60
hotspot/test/runtime/BoolReturn/NativeSmallIntCallsTest.java
Normal file
60
hotspot/test/runtime/BoolReturn/NativeSmallIntCallsTest.java
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* @test
|
||||
* @bug 8149170
|
||||
* @summary Test native functions return booleans as 0/1 but differently than java functions
|
||||
* @library /testlibrary
|
||||
* @compile BoolConstructor.java
|
||||
* @run main/native NativeSmallIntCallsTest
|
||||
*/
|
||||
|
||||
// This test shows that returns from native calls for boolean truncate to JNI_TRUE if value != 0
|
||||
// and JNI_FALSE if value returned is 0.
|
||||
|
||||
import jdk.test.lib.Asserts;
|
||||
|
||||
public class NativeSmallIntCallsTest {
|
||||
static native boolean nativeCastToBoolCallTrue();
|
||||
static native boolean nativeCastToBoolCallFalse();
|
||||
static native boolean nativeCallBoolConstructor(int visible, boolean expected);
|
||||
static {
|
||||
System.loadLibrary("NativeSmallIntCalls");
|
||||
}
|
||||
|
||||
public static void main(java.lang.String[] unused) throws Exception {
|
||||
// Call through jni
|
||||
// JNI makes all results != 0 true for compatibility
|
||||
boolean nativeTrueVal = nativeCastToBoolCallTrue();
|
||||
Asserts.assertTrue(nativeTrueVal, "trueval is false!");
|
||||
|
||||
boolean nativeFalseVal = nativeCastToBoolCallFalse();
|
||||
Asserts.assertTrue(nativeFalseVal, "falseval is false in native!");
|
||||
|
||||
// Call a constructor or method that passes jboolean values into Java from native
|
||||
nativeCallBoolConstructor(1, true);
|
||||
nativeCallBoolConstructor(0x10, true);
|
||||
nativeCallBoolConstructor(0x100, false);
|
||||
nativeCallBoolConstructor(0x1000, false);
|
||||
}
|
||||
}
|
||||
57
hotspot/test/runtime/BoolReturn/libNativeSmallIntCalls.c
Normal file
57
hotspot/test/runtime/BoolReturn/libNativeSmallIntCalls.c
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_NativeSmallIntCallsTest_nativeCallBoolConstructor(JNIEnv* env, jobject obj, int visible, int expected) {
|
||||
jclass cls;
|
||||
jmethodID ctor;
|
||||
|
||||
cls = (*env)->FindClass(env, "BoolConstructor");
|
||||
if(NULL == cls) {
|
||||
return;
|
||||
}
|
||||
|
||||
ctor = (*env)->GetMethodID(env, cls, "<init>", "(ZZ)V");
|
||||
if(NULL == ctor) {
|
||||
return;
|
||||
}
|
||||
|
||||
// printf("visible 0x%x expected %d\n", visible, expected);
|
||||
|
||||
(*env)->NewObject(env, cls, ctor, (jboolean) visible, expected);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_NativeSmallIntCallsTest_nativeCastToBoolCallTrue(JNIEnv* env, jobject obj) {
|
||||
|
||||
return 55;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_NativeSmallIntCallsTest_nativeCastToBoolCallFalse(JNIEnv* env, jobject obj) {
|
||||
|
||||
return 44;
|
||||
}
|
||||
|
||||
@ -356,3 +356,4 @@ bdbf2342b21bd8ecad1b4e6499a0dfb314952bd7 jdk-9+103
|
||||
27a3d65e1580386d060e0aa3a68ab52c1a9ab568 jdk-9+111
|
||||
36326537f929d20cc5885b93939f90c0efcc4681 jdk-9+112
|
||||
28626780e245fccbfb9bad8e3b05f62357958038 jdk-9+113
|
||||
147114dd0641cd7c9fe6e81642eb993a7b9c6f0b jdk-9+114
|
||||
|
||||
@ -52,8 +52,8 @@ final class CatalogResolverImpl implements CatalogResolver {
|
||||
@Override
|
||||
public InputSource resolveEntity(String publicId, String systemId) {
|
||||
//Normalize publicId and systemId
|
||||
systemId = Normalizer.normalizeURI(systemId);
|
||||
publicId = Normalizer.normalizePublicId(Normalizer.decodeURN(publicId));
|
||||
systemId = Normalizer.normalizeURI(Util.getNotNullOrEmpty(systemId));
|
||||
publicId = Normalizer.normalizePublicId(Normalizer.decodeURN(Util.getNotNullOrEmpty(publicId)));
|
||||
|
||||
//check whether systemId is an urn
|
||||
if (systemId != null && systemId.startsWith("urn:publicid:")) {
|
||||
@ -87,7 +87,17 @@ final class CatalogResolverImpl implements CatalogResolver {
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the publicId or systemId to one specified in the catalog.
|
||||
* Resolves the publicId or systemId using public or system entries in the catalog.
|
||||
*
|
||||
* The resolution follows the following rules determined by the prefer setting:
|
||||
*
|
||||
* prefer "system": attempts to resolve with a system entry;
|
||||
* attempts to resolve with a public entry when only
|
||||
* publicId is specified.
|
||||
*
|
||||
* prefer "public": attempts to resolve with a system entry;
|
||||
* attempts to resolve with a public entry if no matching
|
||||
* system entry is found.
|
||||
* @param catalog the catalog
|
||||
* @param publicId the publicId
|
||||
* @param systemId the systemId
|
||||
@ -99,9 +109,14 @@ final class CatalogResolverImpl implements CatalogResolver {
|
||||
//search the current catalog
|
||||
catalog.reset();
|
||||
if (systemId != null) {
|
||||
/*
|
||||
If a system identifier is specified, it is used no matter how
|
||||
prefer is set.
|
||||
*/
|
||||
resolvedSystemId = catalog.matchSystem(systemId);
|
||||
}
|
||||
if (resolvedSystemId == null) {
|
||||
|
||||
if (resolvedSystemId == null && publicId != null) {
|
||||
resolvedSystemId = catalog.matchPublic(publicId);
|
||||
}
|
||||
|
||||
|
||||
@ -60,6 +60,9 @@ final class CatalogUriResolverImpl implements CatalogUriResolver {
|
||||
|
||||
@Override
|
||||
public Source resolve(String href, String base) {
|
||||
href = Util.getNotNullOrEmpty(href);
|
||||
base = Util.getNotNullOrEmpty(base);
|
||||
|
||||
if (href == null) return null;
|
||||
|
||||
CatalogImpl c = (CatalogImpl)catalog;
|
||||
|
||||
@ -82,6 +82,9 @@ class GroupEntry extends BaseEntry {
|
||||
//The length of the longest match of a suffix type
|
||||
int longestSuffixMatch = 0;
|
||||
|
||||
//Indicate whether a system entry has been searched
|
||||
boolean systemEntrySearched = false;
|
||||
|
||||
/**
|
||||
* PreferType represents possible values of the prefer property
|
||||
*/
|
||||
@ -156,6 +159,7 @@ class GroupEntry extends BaseEntry {
|
||||
longestRewriteMatch = 0;
|
||||
suffixMatch = null;
|
||||
longestSuffixMatch = 0;
|
||||
systemEntrySearched = false;
|
||||
}
|
||||
/**
|
||||
* Constructs a group entry.
|
||||
@ -212,6 +216,7 @@ class GroupEntry extends BaseEntry {
|
||||
* @return An URI string if a mapping is found, or null otherwise.
|
||||
*/
|
||||
public String matchSystem(String systemId) {
|
||||
systemEntrySearched = true;
|
||||
String match = null;
|
||||
for (BaseEntry entry : entries) {
|
||||
switch (entry.type) {
|
||||
@ -244,8 +249,10 @@ class GroupEntry extends BaseEntry {
|
||||
//use it if there is a match of the system type
|
||||
return match;
|
||||
} else if (grpEntry.longestRewriteMatch > longestRewriteMatch) {
|
||||
longestRewriteMatch = grpEntry.longestRewriteMatch;
|
||||
rewriteMatch = match;
|
||||
} else if (grpEntry.longestSuffixMatch > longestSuffixMatch) {
|
||||
longestSuffixMatch = grpEntry.longestSuffixMatch;
|
||||
suffixMatch = match;
|
||||
}
|
||||
break;
|
||||
@ -277,11 +284,13 @@ class GroupEntry extends BaseEntry {
|
||||
* @return An URI string if a mapping is found, or null otherwise.
|
||||
*/
|
||||
public String matchPublic(String publicId) {
|
||||
//as the specification required
|
||||
if (!isPreferPublic) {
|
||||
/*
|
||||
When both public and system identifiers are specified, and prefer is
|
||||
not public (that is, system), only system entry will be used.
|
||||
*/
|
||||
if (!isPreferPublic && systemEntrySearched) {
|
||||
return null;
|
||||
}
|
||||
|
||||
//match public entries
|
||||
String match = null;
|
||||
for (BaseEntry entry : entries) {
|
||||
|
||||
@ -122,4 +122,25 @@ class Util {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the specified string is null or empty, returns the original
|
||||
* string with leading and trailing spaces removed if not.
|
||||
* @param test the string to be tested
|
||||
* @return the original string with leading and trailing spaces removed,
|
||||
* or null if it is null or empty
|
||||
*
|
||||
*/
|
||||
static String getNotNullOrEmpty(String test) {
|
||||
if (test == null) {
|
||||
return test;
|
||||
} else {
|
||||
String temp = test.trim();
|
||||
if (temp.length() == 0) {
|
||||
return null;
|
||||
} else {
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,15 +38,71 @@ import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.ext.DefaultHandler2;
|
||||
|
||||
/*
|
||||
* @bug 8081248, 8144966, 8146606, 8146237, 8151154, 8150969
|
||||
* @bug 8081248, 8144966, 8146606, 8146237, 8151154, 8150969, 8151162, 8152527
|
||||
* @summary Tests basic Catalog functions.
|
||||
*/
|
||||
public class CatalogTest {
|
||||
/*
|
||||
* @bug 8152527
|
||||
* This test is the same as the JDK test ResolveEntityTests:testMatch1.
|
||||
* Verifies that the CatalogResolver resolves a publicId and/or systemId as
|
||||
* expected.
|
||||
*/
|
||||
@Test(dataProvider = "resolveEntity")
|
||||
public void testMatch1(String cfile, String prefer, String sysId, String pubId, String expectedUri, String expectedFile, String msg) {
|
||||
String catalogFile = getClass().getResource(cfile).getFile();
|
||||
CatalogFeatures features = CatalogFeatures.builder().with(CatalogFeatures.Feature.PREFER, prefer).build();
|
||||
CatalogResolver catalogResolver = CatalogManager.catalogResolver(features, catalogFile);
|
||||
InputSource is = catalogResolver.resolveEntity(pubId, sysId);
|
||||
Assert.assertNotNull(is, msg);
|
||||
String expected = (expectedUri == null) ? expectedFile : expectedUri;
|
||||
Assert.assertEquals(expected, is.getSystemId(), msg);
|
||||
}
|
||||
|
||||
/*
|
||||
* @bug 8151162
|
||||
* Verifies that the Catalog matches specified publicId or systemId and returns
|
||||
* results as expected.
|
||||
*/
|
||||
@Test(dataProvider = "matchWithPrefer")
|
||||
public void matchWithPrefer(String prefer, String cfile, String publicId, String systemId, String expected) {
|
||||
String catalogFile = getClass().getResource(cfile).getFile();
|
||||
Catalog c = CatalogManager.catalog(CatalogFeatures.builder().with(CatalogFeatures.Feature.PREFER, prefer).build(), catalogFile);
|
||||
String result;
|
||||
if (publicId != null && publicId.length() > 0) {
|
||||
result = c.matchPublic(publicId);
|
||||
} else {
|
||||
result = c.matchSystem(systemId);
|
||||
}
|
||||
Assert.assertEquals(expected, result);
|
||||
}
|
||||
|
||||
/*
|
||||
* @bug 8151162
|
||||
* Verifies that the CatalogResolver resolves specified publicId or systemId
|
||||
* in accordance with the prefer setting.
|
||||
* prefer "system": resolves with a system entry.
|
||||
* Exception: use the public entry when the catalog contains
|
||||
* only public entry and only publicId is specified.
|
||||
* prefer "public": attempts to resolve with a system entry;
|
||||
* attempts to resolve with a public entry if no matching
|
||||
* system entry is found.
|
||||
*/
|
||||
@Test(dataProvider = "resolveWithPrefer")
|
||||
public void resolveWithPrefer(String prefer, String cfile, String publicId, String systemId, String expected) {
|
||||
String catalogFile = getClass().getResource(cfile).getFile();
|
||||
CatalogFeatures f = CatalogFeatures.builder().with(CatalogFeatures.Feature.PREFER, prefer).with(CatalogFeatures.Feature.RESOLVE, "ignore").build();
|
||||
CatalogResolver catalogResolver = CatalogManager.catalogResolver(f, catalogFile);
|
||||
String result = catalogResolver.resolveEntity(publicId, systemId).getSystemId();
|
||||
Assert.assertEquals(expected, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @bug 8150969
|
||||
* Verifies that the defer attribute set in the catalog file takes precedence
|
||||
@ -232,6 +288,72 @@ public class CatalogTest {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DataProvider: used to verify CatalogResolver's resolveEntity function.
|
||||
Data columns:
|
||||
catalog, prefer, systemId, publicId, expectedUri, expectedFile, msg
|
||||
*/
|
||||
@DataProvider(name = "resolveEntity")
|
||||
Object[][] getDataForMatchingBothIds() {
|
||||
String expected = "http://www.groupxmlbase.com/dtds/rewrite.dtd";
|
||||
return new Object[][]{
|
||||
{"rewriteSystem_id.xml", "system", "http://www.sys00test.com/rewrite.dtd", "PUB-404", expected, expected, "Relative rewriteSystem with xml:base at group level failed"},
|
||||
};
|
||||
}
|
||||
static String id = "http://openjdk.java.net/xml/catalog/dtd/system.dtd";
|
||||
/*
|
||||
DataProvider: used to verify how prefer settings affect the result of the
|
||||
Catalog's matching operation.
|
||||
Data columns:
|
||||
prefer, catalog, publicId, systemId, expected result
|
||||
*/
|
||||
@DataProvider(name = "matchWithPrefer")
|
||||
Object[][] getDataForMatch() {
|
||||
return new Object[][]{
|
||||
{"public", "pubOnly.xml", id, "", "http://local/base/dtd/public.dtd"},
|
||||
{"public", "sysOnly.xml", id, "", null},
|
||||
{"public", "sysAndPub.xml", id, "", "http://local/base/dtd/public.dtd"},
|
||||
{"system", "pubOnly.xml", id, "", "http://local/base/dtd/public.dtd"},
|
||||
{"system", "sysOnly.xml", id, "", null},
|
||||
{"system", "sysAndPub.xml", id, "", "http://local/base/dtd/public.dtd"},
|
||||
{"public", "pubOnly.xml", "", id, null},
|
||||
{"public", "sysOnly.xml", "", id, "http://local/base/dtd/system.dtd"},
|
||||
{"public", "sysAndPub.xml", "", id, "http://local/base/dtd/system.dtd"},
|
||||
{"system", "pubOnly.xml", "", id, null},
|
||||
{"system", "sysOnly.xml", "", id, "http://local/base/dtd/system.dtd"},
|
||||
{"system", "sysAndPub.xml", "", id, "http://local/base/dtd/system.dtd"},
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
DataProvider: used to verify how prefer settings affect the result of the
|
||||
CatalogResolver's resolution operation.
|
||||
Data columns:
|
||||
prefer, catalog, publicId, systemId, expected result
|
||||
*/
|
||||
@DataProvider(name = "resolveWithPrefer")
|
||||
Object[][] getDataForResolve() {
|
||||
return new Object[][]{
|
||||
{"system", "pubOnly.xml", id, "", "http://local/base/dtd/public.dtd"},
|
||||
{"system", "pubOnly.xml", "", id, null},
|
||||
{"system", "pubOnly.xml", id, id, null},
|
||||
{"public", "pubOnly.xml", id, "", "http://local/base/dtd/public.dtd"},
|
||||
{"public", "pubOnly.xml", "", id, null},
|
||||
{"public", "pubOnly.xml", id, id, "http://local/base/dtd/public.dtd"},
|
||||
{"system", "sysOnly.xml", id, "", null},
|
||||
{"system", "sysOnly.xml", "", id, "http://local/base/dtd/system.dtd"},
|
||||
{"system", "sysOnly.xml", id, id, "http://local/base/dtd/system.dtd"},
|
||||
{"public", "sysOnly.xml", id, "", null},
|
||||
{"public", "sysOnly.xml", "", id, "http://local/base/dtd/system.dtd"},
|
||||
{"public", "sysOnly.xml", id, id, "http://local/base/dtd/system.dtd"},
|
||||
{"system", "sysAndPub.xml", id, "", "http://local/base/dtd/public.dtd"},
|
||||
{"system", "sysAndPub.xml", "", id, "http://local/base/dtd/system.dtd"},
|
||||
{"system", "sysAndPub.xml", id, id, "http://local/base/dtd/system.dtd"},
|
||||
{"public", "sysAndPub.xml", id, "", "http://local/base/dtd/public.dtd"},
|
||||
{"public", "sysAndPub.xml", "", id, "http://local/base/dtd/system.dtd"},
|
||||
{"public", "sysAndPub.xml", id, id, "http://local/base/dtd/system.dtd"},
|
||||
};
|
||||
}
|
||||
/*
|
||||
DataProvider: catalogs that contain invalid next or delegate catalogs.
|
||||
The defer attribute is set to false.
|
||||
|
||||
6
jaxp/test/javax/xml/jaxp/unittest/catalog/pubOnly.xml
Normal file
6
jaxp/test/javax/xml/jaxp/unittest/catalog/pubOnly.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
|
||||
|
||||
<public publicId="http://openjdk.java.net/xml/catalog/dtd/system.dtd" uri="public.dtd"/>
|
||||
|
||||
</catalog>
|
||||
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
|
||||
<rewriteSystem systemIdStartString="http://remote/dtd/alice/" rewritePrefix="http://local/dtd/alice/rs/" />
|
||||
|
||||
<rewriteSystem systemIdStartString="http://remote/dtd/bob/" rewritePrefix="bob/rs/" />
|
||||
|
||||
<rewriteSystem systemIdStartString="http://remote/dtd/carl/" rewritePrefix="carl/rs/"
|
||||
xml:base="http://local/carlBase/dtd/" />
|
||||
|
||||
<rewriteSystem systemIdStartString="http://remote/dtd/david/" rewritePrefix="david1/rs/" />
|
||||
<rewriteSystem systemIdStartString="http://remote/dtd/david/" rewritePrefix="david2/rs/" />
|
||||
|
||||
<rewriteSystem systemIdStartString="http://remote/dtd/" rewritePrefix="ella/" />
|
||||
<rewriteSystem systemIdStartString="http://remote/dtd/ella/" rewritePrefix="ella/rs/" />
|
||||
|
||||
<rewriteSystem systemIdStartString="http://remote.com/"
|
||||
rewritePrefix="file:///share/doctypes/dtd/fail/"/>
|
||||
<rewriteSystem systemIdStartString="http://remote.com/dtd"
|
||||
rewritePrefix="file:///share/docbook/docbook/pass"/>
|
||||
|
||||
<group xml:base="http://www.groupxmlbase.com/">
|
||||
<rewriteSystem systemIdStartString="http://www.sys00test.com" rewritePrefix="dtds"/>
|
||||
</group>
|
||||
</catalog>
|
||||
7
jaxp/test/javax/xml/jaxp/unittest/catalog/sysAndPub.xml
Normal file
7
jaxp/test/javax/xml/jaxp/unittest/catalog/sysAndPub.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
|
||||
|
||||
<system systemId="http://openjdk.java.net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
|
||||
<public publicId="http://openjdk.java.net/xml/catalog/dtd/system.dtd" uri="public.dtd"/>
|
||||
|
||||
</catalog>
|
||||
6
jaxp/test/javax/xml/jaxp/unittest/catalog/sysOnly.xml
Normal file
6
jaxp/test/javax/xml/jaxp/unittest/catalog/sysOnly.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
|
||||
|
||||
<system systemId="http://openjdk.java.net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
|
||||
|
||||
</catalog>
|
||||
@ -359,3 +359,4 @@ fafd694e801f0f5a7c737fb08630ced3ca8f772c jdk-9+107
|
||||
4d5296e0920afe7ef8d4db1939b76f0d407a3812 jdk-9+111
|
||||
21274e7937bae291658d68143aca0e3ee9296db0 jdk-9+112
|
||||
e980062475c10d21137051045bf95ee229db9b27 jdk-9+113
|
||||
b314bb02182b9ca94708a91f312c377f5435f740 jdk-9+114
|
||||
|
||||
@ -356,3 +356,4 @@ eee1ced1d8e78293f2a004af818ca474387dbebf jdk-9+103
|
||||
b2a69d66dc65ad1d3aeb3bd362cf5bb0deba040e jdk-9+111
|
||||
1565a0efe6f0ca411a6df277df1e069431c60988 jdk-9+112
|
||||
68f8be44b6a6b33dfa841ec671c0ba6e4056b372 jdk-9+113
|
||||
bb8379287f3736f38c52b2d1418784e2592461d1 jdk-9+114
|
||||
|
||||
@ -26,6 +26,6 @@
|
||||
include LauncherCommon.gmk
|
||||
|
||||
$(eval $(call SetupBuildLauncher, rmic, \
|
||||
MAIN_CLASS := jdk.rmi.rmic.Main, \
|
||||
MAIN_CLASS := sun.rmi.rmic.Main, \
|
||||
CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \
|
||||
))
|
||||
|
||||
@ -224,8 +224,7 @@ SUNWprivate_1.1 {
|
||||
Java_java_lang_System_setOut0;
|
||||
Java_java_lang_Thread_registerNatives;
|
||||
Java_java_lang_Throwable_fillInStackTrace;
|
||||
Java_java_lang_Throwable_getStackTraceDepth;
|
||||
Java_java_lang_Throwable_getStackTraceElement;
|
||||
Java_java_lang_Throwable_getStackTraceElements;
|
||||
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2;
|
||||
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2Ljava_security_AccessControlContext_2;
|
||||
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
|
||||
@ -238,32 +237,32 @@ SUNWprivate_1.1 {
|
||||
Java_jdk_internal_misc_Signal_findSignal0;
|
||||
Java_jdk_internal_misc_Signal_handle0;
|
||||
Java_jdk_internal_misc_Signal_raise0;
|
||||
Java_sun_reflect_ConstantPool_getClassAt0;
|
||||
Java_sun_reflect_ConstantPool_getClassAtIfLoaded0;
|
||||
Java_sun_reflect_ConstantPool_getClassRefIndexAt0;
|
||||
Java_sun_reflect_ConstantPool_getDoubleAt0;
|
||||
Java_sun_reflect_ConstantPool_getFieldAt0;
|
||||
Java_sun_reflect_ConstantPool_getFieldAtIfLoaded0;
|
||||
Java_sun_reflect_ConstantPool_getFloatAt0;
|
||||
Java_sun_reflect_ConstantPool_getIntAt0;
|
||||
Java_sun_reflect_ConstantPool_getLongAt0;
|
||||
Java_sun_reflect_ConstantPool_getMemberRefInfoAt0;
|
||||
Java_sun_reflect_ConstantPool_getMethodAt0;
|
||||
Java_sun_reflect_ConstantPool_getMethodAtIfLoaded0;
|
||||
Java_sun_reflect_ConstantPool_getNameAndTypeRefIndexAt0;
|
||||
Java_sun_reflect_ConstantPool_getNameAndTypeRefInfoAt0;
|
||||
Java_sun_reflect_ConstantPool_getSize0;
|
||||
Java_sun_reflect_ConstantPool_getStringAt0;
|
||||
Java_sun_reflect_ConstantPool_getTagAt0;
|
||||
Java_sun_reflect_ConstantPool_getUTF8At0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getClassAt0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getClassAtIfLoaded0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getClassRefIndexAt0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getDoubleAt0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getFieldAt0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getFieldAtIfLoaded0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getFloatAt0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getIntAt0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getLongAt0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getMemberRefInfoAt0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getMethodAt0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getMethodAtIfLoaded0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getNameAndTypeRefIndexAt0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getNameAndTypeRefInfoAt0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getSize0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getStringAt0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getTagAt0;
|
||||
Java_jdk_internal_reflect_ConstantPool_getUTF8At0;
|
||||
Java_java_io_Console_istty;
|
||||
Java_java_io_Console_encoding;
|
||||
Java_java_io_Console_echo;
|
||||
Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0;
|
||||
Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
|
||||
Java_sun_reflect_Reflection_getCallerClass__;
|
||||
Java_sun_reflect_Reflection_getCallerClass__I;
|
||||
Java_sun_reflect_Reflection_getClassAccessFlags;
|
||||
Java_jdk_internal_reflect_NativeConstructorAccessorImpl_newInstance0;
|
||||
Java_jdk_internal_reflect_NativeMethodAccessorImpl_invoke0;
|
||||
Java_jdk_internal_reflect_Reflection_getCallerClass__;
|
||||
Java_jdk_internal_reflect_Reflection_getCallerClass__I;
|
||||
Java_jdk_internal_reflect_Reflection_getClassAccessFlags;
|
||||
Java_jdk_internal_misc_VM_latestUserDefinedLoader;
|
||||
Java_jdk_internal_misc_VM_getuid;
|
||||
Java_jdk_internal_misc_VM_geteuid;
|
||||
|
||||
@ -78,8 +78,7 @@ text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_Pri
|
||||
text: .text%JNU_GetEnv;
|
||||
text: .text%Java_java_io_UnixFileSystem_checkAccess;
|
||||
text: .text%Java_java_lang_reflect_Array_newArray;
|
||||
text: .text%Java_java_lang_Throwable_getStackTraceDepth;
|
||||
text: .text%Java_java_lang_Throwable_getStackTraceElement;
|
||||
text: .text%Java_java_lang_Throwable_getStackTraceElements;
|
||||
text: .text%throwFileNotFoundException;
|
||||
text: .text%JNU_NotifyAll;
|
||||
# Test LoadFrame
|
||||
|
||||
@ -74,8 +74,7 @@ text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_Pri
|
||||
text: .text%JNU_GetEnv;
|
||||
text: .text%Java_java_io_UnixFileSystem_checkAccess;
|
||||
text: .text%Java_java_lang_reflect_Array_newArray;
|
||||
text: .text%Java_java_lang_Throwable_getStackTraceDepth;
|
||||
text: .text%Java_java_lang_Throwable_getStackTraceElement;
|
||||
text: .text%Java_java_lang_Throwable_getStackTraceElements;
|
||||
text: .text%throwFileNotFoundException: OUTPUTDIR/io_util.o;
|
||||
text: .text%JNU_NotifyAll;
|
||||
# Test LoadFrame
|
||||
|
||||
@ -78,8 +78,7 @@ text: .text%Java_java_io_UnixFileSystem_checkAccess;
|
||||
text: .text%Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
|
||||
text: .text%Java_java_io_FileInputStream_available;
|
||||
text: .text%Java_java_lang_reflect_Array_newArray;
|
||||
text: .text%Java_java_lang_Throwable_getStackTraceDepth;
|
||||
text: .text%Java_java_lang_Throwable_getStackTraceElement;
|
||||
text: .text%Java_java_lang_Throwable_getStackTraceElements;
|
||||
text: .text%Java_java_lang_System_identityHashCode;
|
||||
text: .text%JNU_NotifyAll;
|
||||
# Test LoadFrame
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user