# HG changeset patch # User zmajo # Date 1457339670 -3600 # Node ID 463ac0c1ec5e24bacdb081b6af745241df994146 # Parent 765906c6f2a726af1c8b79155da154d650f423a6# Parent 953635dbec06aac84da3024f14315e17fd135d40 Merge diff -r 765906c6f2a7 -r 463ac0c1ec5e .hgtags --- a/.hgtags Thu Mar 03 23:57:07 2016 +0300 +++ b/.hgtags Mon Mar 07 09:34:30 2016 +0100 @@ -349,3 +349,4 @@ 086c682bd8c5f195c324f61e2c61fbcd0226d63b jdk-9+104 db483b34fa7148d257a429acddbde9c13687dcae jdk-9+105 6c644cca3f3fc2763e2ff7d669849a75d34543ba jdk-9+106 +1c076468bf7dad5b8f2ee5dcf66e2279caa3e208 jdk-9+107 diff -r 765906c6f2a7 -r 463ac0c1ec5e .hgtags-top-repo --- a/.hgtags-top-repo Thu Mar 03 23:57:07 2016 +0300 +++ b/.hgtags-top-repo Mon Mar 07 09:34:30 2016 +0100 @@ -349,3 +349,4 @@ 9a38f8b4ba220708db198d08d82fd2144a64777d jdk-9+104 be58b02c11f90b88c67e4d0e2cb5e4cf2d9b3c57 jdk-9+105 54575d8783b3a39a2d710c28cda675d44261f9d9 jdk-9+106 +4d65eba233a8730f913734a6804910b842d2cb54 jdk-9+107 diff -r 765906c6f2a7 -r 463ac0c1ec5e common/autoconf/flags.m4 --- a/common/autoconf/flags.m4 Thu Mar 03 23:57:07 2016 +0300 +++ b/common/autoconf/flags.m4 Mon Mar 07 09:34:30 2016 +0100 @@ -123,12 +123,16 @@ [ # COMPILER_TARGET_BITS_FLAG : option for selecting 32- or 64-bit output # COMPILER_COMMAND_FILE_FLAG : option for passing a command file to the compiler + # COMPILER_BINDCMD_FILE_FLAG : option for specifying a file which saves the binder + # commands produced by the link step (currently AIX only) if test "x$TOOLCHAIN_TYPE" = xxlc; then COMPILER_TARGET_BITS_FLAG="-q" COMPILER_COMMAND_FILE_FLAG="-f" + COMPILER_BINDCMD_FILE_FLAG="-bloadmap:" else COMPILER_TARGET_BITS_FLAG="-m" COMPILER_COMMAND_FILE_FLAG="@" + COMPILER_BINDCMD_FILE_FLAG="" # The solstudio linker does not support @-files. if test "x$TOOLCHAIN_TYPE" = xsolstudio; then @@ -152,6 +156,7 @@ fi AC_SUBST(COMPILER_TARGET_BITS_FLAG) AC_SUBST(COMPILER_COMMAND_FILE_FLAG) + AC_SUBST(COMPILER_BINDCMD_FILE_FLAG) # FIXME: figure out if we should select AR flags depending on OS or toolchain. if test "x$OPENJDK_TARGET_OS" = xmacosx; then @@ -294,10 +299,23 @@ SET_SHARED_LIBRARY_NAME='-h [$]1' SET_SHARED_LIBRARY_MAPFILE='-M[$]1' elif test "x$TOOLCHAIN_TYPE" = xxlc; then - PICFLAG="-qpic=large" + # '-qpic' defaults to 'qpic=small'. This means that the compiler generates only + # one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker + # will have to patch this single instruction with a call to some out-of-order code which + # does the load from the TOC. This is of course slow. But in that case we also would have + # to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'. + # With 'qpic=large' the compiler will by default generate a two-instruction sequence which + # can be patched directly by the linker and does not require a jump to out-of-order code. + # Another alternative instead of using 'qpic=large -bbigtoc' may be to use '-qminimaltoc' + # instead. This creates a distinct TOC for every compilation unit (and thus requires two + # loads for accessing a global variable). But there are rumors that this may be seen as a + # 'performance feature' because of improved code locality of the symbols used in a + # compilation unit. + PICFLAG="-qpic" + JVM_CFLAGS="$JVM_CFLAGS $PICFLAG" C_FLAG_REORDER='' CXX_FLAG_REORDER='' - SHARED_LIBRARY_FLAGS="-qmkshrobj" + SHARED_LIBRARY_FLAGS="-qmkshrobj -bM:SRE -bnoentry" SET_EXECUTABLE_ORIGIN="" SET_SHARED_LIBRARY_ORIGIN='' SET_SHARED_LIBRARY_NAME='' @@ -835,7 +853,7 @@ LDFLAGS_CXX_SOLSTUDIO="-norunpath" LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib" elif test "x$TOOLCHAIN_TYPE" = xxlc; then - LDFLAGS_XLC="-brtl -bnolibpath -bexpall -bernotok" + LDFLAGS_XLC="-b64 -brtl -bnolibpath -bexpall -bernotok" LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_XLC" fi @@ -891,6 +909,7 @@ AC_SUBST(JDKLIB_LIBS) AC_SUBST(JDKEXE_LIBS) AC_SUBST(LDFLAGS_CXX_JDK) + AC_SUBST(LDFLAGS_HASH_STYLE) LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB" LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE" diff -r 765906c6f2a7 -r 463ac0c1ec5e common/autoconf/generated-configure.sh --- a/common/autoconf/generated-configure.sh Thu Mar 03 23:57:07 2016 +0300 +++ b/common/autoconf/generated-configure.sh Mon Mar 07 09:34:30 2016 +0100 @@ -701,6 +701,7 @@ ZERO_ARCHFLAG LDFLAGS_TESTEXE LDFLAGS_TESTLIB +LDFLAGS_HASH_STYLE LDFLAGS_CXX_JDK JDKEXE_LIBS JDKLIB_LIBS @@ -743,6 +744,7 @@ CC_OUT_OPTION STRIPFLAGS ARFLAGS +COMPILER_BINDCMD_FILE_FLAG COMPILER_COMMAND_FILE_FLAG COMPILER_TARGET_BITS_FLAG JT_HOME @@ -4230,7 +4232,7 @@ # -# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 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 @@ -4860,7 +4862,7 @@ #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1455271513 +DATE_WHEN_GENERATED=1456136781 ############################################################################### # @@ -45391,12 +45393,16 @@ # COMPILER_TARGET_BITS_FLAG : option for selecting 32- or 64-bit output # COMPILER_COMMAND_FILE_FLAG : option for passing a command file to the compiler + # COMPILER_BINDCMD_FILE_FLAG : option for specifying a file which saves the binder + # commands produced by the link step (currently AIX only) if test "x$TOOLCHAIN_TYPE" = xxlc; then COMPILER_TARGET_BITS_FLAG="-q" COMPILER_COMMAND_FILE_FLAG="-f" + COMPILER_BINDCMD_FILE_FLAG="-bloadmap:" else COMPILER_TARGET_BITS_FLAG="-m" COMPILER_COMMAND_FILE_FLAG="@" + COMPILER_BINDCMD_FILE_FLAG="" # The solstudio linker does not support @-files. if test "x$TOOLCHAIN_TYPE" = xsolstudio; then @@ -45424,6 +45430,7 @@ + # FIXME: figure out if we should select AR flags depending on OS or toolchain. if test "x$OPENJDK_TARGET_OS" = xmacosx; then ARFLAGS="-r" @@ -46198,10 +46205,23 @@ SET_SHARED_LIBRARY_NAME='-h $1' SET_SHARED_LIBRARY_MAPFILE='-M$1' elif test "x$TOOLCHAIN_TYPE" = xxlc; then - PICFLAG="-qpic=large" + # '-qpic' defaults to 'qpic=small'. This means that the compiler generates only + # one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker + # will have to patch this single instruction with a call to some out-of-order code which + # does the load from the TOC. This is of course slow. But in that case we also would have + # to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'. + # With 'qpic=large' the compiler will by default generate a two-instruction sequence which + # can be patched directly by the linker and does not require a jump to out-of-order code. + # Another alternative instead of using 'qpic=large -bbigtoc' may be to use '-qminimaltoc' + # instead. This creates a distinct TOC for every compilation unit (and thus requires two + # loads for accessing a global variable). But there are rumors that this may be seen as a + # 'performance feature' because of improved code locality of the symbols used in a + # compilation unit. + PICFLAG="-qpic" + JVM_CFLAGS="$JVM_CFLAGS $PICFLAG" C_FLAG_REORDER='' CXX_FLAG_REORDER='' - SHARED_LIBRARY_FLAGS="-qmkshrobj" + SHARED_LIBRARY_FLAGS="-qmkshrobj -bM:SRE -bnoentry" SET_EXECUTABLE_ORIGIN="" SET_SHARED_LIBRARY_ORIGIN='' SET_SHARED_LIBRARY_NAME='' @@ -46824,7 +46844,7 @@ LDFLAGS_CXX_SOLSTUDIO="-norunpath" LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib" elif test "x$TOOLCHAIN_TYPE" = xxlc; then - LDFLAGS_XLC="-brtl -bnolibpath -bexpall -bernotok" + LDFLAGS_XLC="-b64 -brtl -bnolibpath -bexpall -bernotok" LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_XLC" fi @@ -46881,6 +46901,7 @@ + LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB" LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE" @@ -58630,7 +58651,8 @@ # Setup libm (the maths library) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 + if test "x$OPENJDK_TARGET_OS" != "xwindows"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 $as_echo_n "checking for cos in -lm... " >&6; } if ${ac_cv_lib_m_cos+:} false; then : $as_echo_n "(cached) " >&6 @@ -58675,12 +58697,15 @@ else - { $as_echo "$as_me:${as_lineno-$LINENO}: Maths library was not found" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: Maths library was not found" >&5 $as_echo "$as_me: Maths library was not found" >&6;} fi - LIBM=-lm + LIBM="-lm" + else + LIBM="" + fi # Setup libdl (for dynamic library loading) diff -r 765906c6f2a7 -r 463ac0c1ec5e common/autoconf/libraries.m4 --- a/common/autoconf/libraries.m4 Thu Mar 03 23:57:07 2016 +0300 +++ b/common/autoconf/libraries.m4 Mon Mar 07 09:34:30 2016 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 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 @@ -160,10 +160,14 @@ AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS], [ # Setup libm (the maths library) - AC_CHECK_LIB(m, cos, [], [ - AC_MSG_NOTICE([Maths library was not found]) - ]) - LIBM=-lm + if test "x$OPENJDK_TARGET_OS" != "xwindows"; then + AC_CHECK_LIB(m, cos, [], [ + AC_MSG_NOTICE([Maths library was not found]) + ]) + LIBM="-lm" + else + LIBM="" + fi AC_SUBST(LIBM) # Setup libdl (for dynamic library loading) diff -r 765906c6f2a7 -r 463ac0c1ec5e common/autoconf/spec.gmk.in --- a/common/autoconf/spec.gmk.in Thu Mar 03 23:57:07 2016 +0300 +++ b/common/autoconf/spec.gmk.in Mon Mar 07 09:34:30 2016 +0100 @@ -314,6 +314,10 @@ # Option used to pass a command file to the compiler COMPILER_COMMAND_FILE_FLAG:=@COMPILER_COMMAND_FILE_FLAG@ +# Option for specifying a file which saves the binder commands +# produced by the link step (for debugging, currently AIX only) +COMPILER_BINDCMD_FILE_FLAG:=@COMPILER_BINDCMD_FILE_FLAG@ + CC_OUT_OPTION:=@CC_OUT_OPTION@ EXE_OUT_OPTION:=@EXE_OUT_OPTION@ LD_OUT_OPTION:=@LD_OUT_OPTION@ @@ -351,6 +355,8 @@ CFLAGS_JDKEXE:=@CFLAGS_JDKEXE@ CXXFLAGS_JDKEXE:=@CXXFLAGS_JDKEXE@ +LDFLAGS_HASH_STYLE := @LDFLAGS_HASH_STYLE@ + CXX:=@FIXPATH@ @CCACHE@ @ICECC@ @CXX@ CPP:=@FIXPATH@ @CPP@ diff -r 765906c6f2a7 -r 463ac0c1ec5e corba/.hgtags --- a/corba/.hgtags Thu Mar 03 23:57:07 2016 +0300 +++ b/corba/.hgtags Mon Mar 07 09:34:30 2016 +0100 @@ -349,3 +349,4 @@ e385e95e6101711d5c63e7b1a827e99b6ec7a1cc jdk-9+104 64006ae915b3aa85ac7e6fac679024d2da7fe526 jdk-9+105 8ec4f97943fe56f93e4621f622b56b7144c0181a jdk-9+106 +49202432b69445164a42be7cbdf74ed5fce98157 jdk-9+107 diff -r 765906c6f2a7 -r 463ac0c1ec5e hotspot/.hgignore --- a/hotspot/.hgignore Thu Mar 03 23:57:07 2016 +0300 +++ b/hotspot/.hgignore Mon Mar 07 09:34:30 2016 +0100 @@ -10,7 +10,6 @@ .igv.log ^.hgtip .DS_Store -\.class$ ^\.mx.jvmci/env ^\.mx.jvmci/.*\.pyc ^\.mx.jvmci/eclipse-launches/.* diff -r 765906c6f2a7 -r 463ac0c1ec5e hotspot/.hgtags --- a/hotspot/.hgtags Thu Mar 03 23:57:07 2016 +0300 +++ b/hotspot/.hgtags Mon Mar 07 09:34:30 2016 +0100 @@ -509,3 +509,4 @@ 534c50395957c6025fb6627e93b35756f8d48a08 jdk-9+104 266fa9bb5297bf02cb2a7b038b10a109817d2b48 jdk-9+105 7232de4c17c37f60aecec4f3191090bd3d41d334 jdk-9+106 +c5146d4da417f76edfc43097d2e2ced042a65b4e jdk-9+107 diff -r 765906c6f2a7 -r 463ac0c1ec5e hotspot/make/bsd/makefiles/arm.make --- a/hotspot/make/bsd/makefiles/arm.make Thu Mar 03 23:57:07 2016 +0300 +++ b/hotspot/make/bsd/makefiles/arm.make Mon Mar 07 09:34:30 2016 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 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 @@ -24,8 +24,4 @@ Obj_Files += bsd_arm.o -ifneq ($(EXT_LIBS_PATH),) - LIBS += $(EXT_LIBS_PATH)/sflt_glibc.a -endif - CFLAGS += -DVM_LITTLE_ENDIAN diff -r 765906c6f2a7 -r 463ac0c1ec5e hotspot/src/cpu/aarch64/vm/c2_globals_aarch64.hpp --- a/hotspot/src/cpu/aarch64/vm/c2_globals_aarch64.hpp Thu Mar 03 23:57:07 2016 +0300 +++ b/hotspot/src/cpu/aarch64/vm/c2_globals_aarch64.hpp Mon Mar 07 09:34:30 2016 +0100 @@ -54,6 +54,7 @@ define_pd_global(intx, InteriorEntryAlignment, 16); define_pd_global(intx, NewSizeThreadIncrease, ScaleForWordSize(4*K)); define_pd_global(intx, LoopUnrollLimit, 60); +define_pd_global(intx, LoopPercentProfileLimit, 10); // InitialCodeCacheSize derived from specjbb2000 run. define_pd_global(intx, InitialCodeCacheSize, 2496*K); // Integral multiple of CodeCacheExpansionSize define_pd_global(intx, CodeCacheExpansionSize, 64*K); diff -r 765906c6f2a7 -r 463ac0c1ec5e hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp --- a/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp Thu Mar 03 23:57:07 2016 +0300 +++ b/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp Mon Mar 07 09:34:30 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -32,7 +32,6 @@ // Sets the default values for platform dependent flags used by the runtime system. // (see globals.hpp) -define_pd_global(bool, ConvertSleepToYield, true); define_pd_global(bool, ShareVtableStubs, true); define_pd_global(bool, NeedsDeoptSuspend, false); // only register window machines need this diff -r 765906c6f2a7 -r 463ac0c1ec5e hotspot/src/cpu/aarch64/vm/jvmciCodeInstaller_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/jvmciCodeInstaller_aarch64.cpp Thu Mar 03 23:57:07 2016 +0300 +++ b/hotspot/src/cpu/aarch64/vm/jvmciCodeInstaller_aarch64.cpp Mon Mar 07 09:34:30 2016 +0100 @@ -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 @@ -30,39 +30,151 @@ #include "vmreg_aarch64.inline.hpp" jint CodeInstaller::pd_next_offset(NativeInstruction* inst, jint pc_offset, Handle method, TRAPS) { - Unimplemented(); - return 0; + if (inst->is_call() || inst->is_jump() || inst->is_blr()) { + return pc_offset + NativeCall::instruction_size; + } else if (inst->is_general_jump()) { + return pc_offset + NativeGeneralJump::instruction_size; + } else { + JVMCI_ERROR_0("unsupported type of instruction for call site"); + } } void CodeInstaller::pd_patch_OopConstant(int pc_offset, Handle constant, TRAPS) { - Unimplemented(); + address pc = _instructions->start() + pc_offset; + Handle obj = HotSpotObjectConstantImpl::object(constant); + jobject value = JNIHandles::make_local(obj()); + if (HotSpotObjectConstantImpl::compressed(constant)) { + int oop_index = _oop_recorder->find_index(value); + RelocationHolder rspec = oop_Relocation::spec(oop_index); + _instructions->relocate(pc, rspec, 1); + Unimplemented(); + } else { + NativeMovConstReg* move = nativeMovConstReg_at(pc); + move->set_data((intptr_t) value); + int oop_index = _oop_recorder->find_index(value); + RelocationHolder rspec = oop_Relocation::spec(oop_index); + _instructions->relocate(pc, rspec); + } } void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle constant, TRAPS) { - Unimplemented(); + address pc = _instructions->start() + pc_offset; + if (HotSpotMetaspaceConstantImpl::compressed(constant)) { + narrowKlass narrowOop = record_narrow_metadata_reference(constant, CHECK); + TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/0x%x", p2i(pc), narrowOop); + Unimplemented(); + } else { + NativeMovConstReg* move = nativeMovConstReg_at(pc); + Metadata* reference = record_metadata_reference(constant, CHECK); + move->set_data((intptr_t) reference); + TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(reference)); + } } -void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) { - Unimplemented(); +void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset, TRAPS) { + address pc = _instructions->start() + pc_offset; + NativeInstruction* inst = nativeInstruction_at(pc); + if (inst->is_adr_aligned()) { + address dest = _constants->start() + data_offset; + _instructions->relocate(pc, section_word_Relocation::spec((address) dest, CodeBuffer::SECT_CONSTS)); + TRACE_jvmci_3("relocating at " PTR_FORMAT " (+%d) with destination at %d", p2i(pc), pc_offset, data_offset); + } else { + JVMCI_ERROR("unknown load or move instruction at " PTR_FORMAT, p2i(pc)); + } } void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination, TRAPS) { - Unimplemented(); + address pc = (address) inst; + if (inst->is_call()) { + NativeCall* call = nativeCall_at(pc); + call->set_destination((address) foreign_call_destination); + _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec()); + } else if (inst->is_jump()) { + NativeJump* jump = nativeJump_at(pc); + jump->set_jump_destination((address) foreign_call_destination); + _instructions->relocate(jump->instruction_address(), runtime_call_Relocation::spec()); + } else if (inst->is_general_jump()) { + NativeGeneralJump* jump = nativeGeneralJump_at(pc); + jump->set_jump_destination((address) foreign_call_destination); + _instructions->relocate(jump->instruction_address(), runtime_call_Relocation::spec()); + } else { + JVMCI_ERROR("unknown call or jump instruction at " PTR_FORMAT, p2i(pc)); + } + TRACE_jvmci_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst)); } void CodeInstaller::pd_relocate_JavaMethod(Handle hotspot_method, jint pc_offset, TRAPS) { - Unimplemented(); +#ifdef ASSERT + Method* method = NULL; + // we need to check, this might also be an unresolved method + if (hotspot_method->is_a(HotSpotResolvedJavaMethodImpl::klass())) { + method = getMethodFromHotSpotMethod(hotspot_method()); + } +#endif + switch (_next_call_type) { + case INLINE_INVOKE: + break; + case INVOKEVIRTUAL: + case INVOKEINTERFACE: { + assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface"); + NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); + call->set_destination(SharedRuntime::get_resolve_virtual_call_stub()); + _instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc)); + break; + } + case INVOKESTATIC: { + assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic"); + NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); + call->set_destination(SharedRuntime::get_resolve_static_call_stub()); + _instructions->relocate(call->instruction_address(), relocInfo::static_call_type); + break; + } + case INVOKESPECIAL: { + assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial"); + NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); + call->set_destination(SharedRuntime::get_resolve_opt_virtual_call_stub()); + _instructions->relocate(call->instruction_address(), relocInfo::opt_virtual_call_type); + break; + } + default: + JVMCI_ERROR("invalid _next_call_type value"); + break; + } } void CodeInstaller::pd_relocate_poll(address pc, jint mark, TRAPS) { - Unimplemented(); + switch (mark) { + case POLL_NEAR: + JVMCI_ERROR("unimplemented"); + break; + case POLL_FAR: + _instructions->relocate(pc, relocInfo::poll_type); + break; + case POLL_RETURN_NEAR: + JVMCI_ERROR("unimplemented"); + break; + case POLL_RETURN_FAR: + _instructions->relocate(pc, relocInfo::poll_return_type); + break; + default: + JVMCI_ERROR("invalid mark value"); + break; + } } // convert JVMCI register indices (as used in oop maps) to HotSpot registers VMReg CodeInstaller::get_hotspot_reg(jint jvmci_reg, TRAPS) { - return NULL; + if (jvmci_reg < RegisterImpl::number_of_registers) { + return as_Register(jvmci_reg)->as_VMReg(); + } else { + jint floatRegisterNumber = jvmci_reg - RegisterImpl::number_of_registers; + if (floatRegisterNumber < FloatRegisterImpl::number_of_registers) { + return as_FloatRegister(floatRegisterNumber)->as_VMReg(); + } + JVMCI_ERROR_NULL("invalid register number: %d", jvmci_reg); + } } bool CodeInstaller::is_general_purpose_reg(VMReg hotspotRegister) { - return false; + return !hotspotRegister->is_FloatRegister(); } diff -r 765906c6f2a7 -r 463ac0c1ec5e hotspot/src/cpu/aarch64/vm/nativeInst_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/nativeInst_aarch64.cpp Thu Mar 03 23:57:07 2016 +0300 +++ b/hotspot/src/cpu/aarch64/vm/nativeInst_aarch64.cpp Mon Mar 07 09:34:30 2016 +0100 @@ -136,7 +136,7 @@ MacroAssembler::pd_patch_instruction(instruction_address(), (address)x); ICache::invalidate_range(instruction_address(), instruction_size); } -}; +} void NativeMovConstReg::print() { tty->print_cr(PTR_FORMAT ": mov reg, " INTPTR_FORMAT, @@ -208,6 +208,32 @@ //------------------------------------------------------------------- +address NativeGeneralJump::jump_destination() const { + NativeMovConstReg* move = nativeMovConstReg_at(instruction_address()); + address dest = (address) move->data(); + + // We use jump to self as the unresolved address which the inline + // cache code (and relocs) know about + + // return -1 if jump to self + dest = (dest == (address) this) ? (address) -1 : dest; + return dest; +} + +void NativeGeneralJump::set_jump_destination(address dest) { + NativeMovConstReg* move = nativeMovConstReg_at(instruction_address()); + + // We use jump to self as the unresolved address which the inline + // cache code (and relocs) know about + if (dest == (address) -1) { + dest = instruction_address(); + } + + move->set_data((uintptr_t) dest); +}; + +//------------------------------------------------------------------- + bool NativeInstruction::is_safepoint_poll() { // a safepoint_poll is implemented in two steps as either // @@ -249,6 +275,22 @@ Instruction_aarch64::extract(insn, 4, 0) == 0b11111); } +bool NativeInstruction::is_general_jump() { + if (is_movz()) { + NativeInstruction* inst1 = nativeInstruction_at(addr_at(instruction_size * 1)); + if (inst1->is_movk()) { + NativeInstruction* inst2 = nativeInstruction_at(addr_at(instruction_size * 2)); + if (inst2->is_movk()) { + NativeInstruction* inst3 = nativeInstruction_at(addr_at(instruction_size * 3)); + if (inst3->is_blr()) { + return true; + } + } + } + } + return false; +} + bool NativeInstruction::is_movz() { return Instruction_aarch64::extract(int_at(0), 30, 23) == 0b10100101; } diff -r 765906c6f2a7 -r 463ac0c1ec5e hotspot/src/cpu/aarch64/vm/nativeInst_aarch64.hpp --- a/hotspot/src/cpu/aarch64/vm/nativeInst_aarch64.hpp Thu Mar 03 23:57:07 2016 +0300 +++ b/hotspot/src/cpu/aarch64/vm/nativeInst_aarch64.hpp Mon Mar 07 09:34:30 2016 +0100 @@ -54,11 +54,22 @@ friend class Relocation; friend bool is_NativeCallTrampolineStub_at(address); public: - enum { instruction_size = 4 }; + enum { + instruction_size = 4 + }; + + juint encoding() const { + return uint_at(0); + } + + bool is_blr() const { return (encoding() & 0xfffffc1f) == 0xd63f0000; } + bool is_adr_aligned() const { return (encoding() & 0xff000000) == 0x10000000; } // adr Xn,