diff -r df17ddfce21c -r e81b912b94a5 src/cpu/aarch64/vm/aarch64.ad
--- a/src/cpu/aarch64/vm/aarch64.ad	Thu Dec 12 22:44:18 2013 +0000
+++ b/src/cpu/aarch64/vm/aarch64.ad	Tue Dec 17 15:17:24 2013 +0000
@@ -1716,6 +1716,11 @@
   return R0_REG_mask();
 }
 
+const RegMask Matcher::mathExactL_result_proj_mask() {
+  ShouldNotReachHere();
+  return R0_REG_mask();
+}
+
 const RegMask Matcher::mathExactI_flags_proj_mask() {
   return INT_FLAGS_mask();
 }
diff -r df17ddfce21c -r e81b912b94a5 src/cpu/aarch64/vm/c1_FrameMap_aarch64.cpp
--- a/src/cpu/aarch64/vm/c1_FrameMap_aarch64.cpp	Thu Dec 12 22:44:18 2013 +0000
+++ b/src/cpu/aarch64/vm/c1_FrameMap_aarch64.cpp	Tue Dec 17 15:17:24 2013 +0000
@@ -52,6 +52,8 @@
 #endif // _LP64
     } else if (type == T_OBJECT || type == T_ARRAY) {
       opr = as_oop_opr(reg);
+    } else if (type == T_METADATA) {
+      opr = as_metadata_opr(reg);
     } else {
       opr = as_opr(reg);
     }
diff -r df17ddfce21c -r e81b912b94a5 src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp
--- a/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp	Thu Dec 12 22:44:18 2013 +0000
+++ b/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp	Tue Dec 17 15:17:24 2013 +0000
@@ -943,8 +943,12 @@
 
 void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_PatchCode patch_code, CodeEmitInfo* info, bool wide, bool /* unaligned */) {
   LIR_Address* addr = src->as_address_ptr();
-
   LIR_Address* from_addr = src->as_address_ptr();
+
+  if (addr->base()->type() == T_OBJECT) {
+    __ verify_oop(addr->base()->as_pointer_register());
+  }
+
   PatchingStub* patch = NULL;
 
   if (patch_code != lir_patch_none) {
@@ -2628,6 +2632,10 @@
   fatal("CRC32 intrinsic is not implemented on this platform");
 }
 
+void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) {
+  fatal("Type profiling not implemented on this platform");
+}
+
 void LIR_Assembler::align_backward_branch_target() {
 }
 
diff -r df17ddfce21c -r e81b912b94a5 src/cpu/aarch64/vm/globals_aarch64.hpp
--- a/src/cpu/aarch64/vm/globals_aarch64.hpp	Thu Dec 12 22:44:18 2013 +0000
+++ b/src/cpu/aarch64/vm/globals_aarch64.hpp	Tue Dec 17 15:17:24 2013 +0000
@@ -71,6 +71,8 @@
 // GC Ergo Flags
 define_pd_global(uintx, CMSYoungGenPerWorker, 64*M);  // default max size of CMS young gen, per GC worker thread
 
+define_pd_global(uintx, TypeProfileLevel, 0);
+
 // avoid biased locking while we are bootstrapping the aarch64 build
 define_pd_global(bool, UseBiasedLocking, false);
 
diff -r df17ddfce21c -r e81b912b94a5 src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
--- a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Thu Dec 12 22:44:18 2013 +0000
+++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Tue Dec 17 15:17:24 2013 +0000
@@ -2080,6 +2080,16 @@
 }
 
 void MacroAssembler::encode_klass_not_null(Register dst, Register src) {
+  if (Universe::narrow_klass_base() == NULL) {
+    if (Universe::narrow_klass_shift() != 0) {
+      assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
+      lsr(dst, src, LogKlassAlignmentInBytes);
+    } else {
+      if (dst != src) mov(dst, src);
+    }
+    return;
+  }
+
   if (use_XOR_for_compressed_class_base) {
     if (Universe::narrow_klass_shift() != 0) {
       eor(dst, src, (uint64_t)Universe::narrow_klass_base());
@@ -2111,9 +2121,18 @@
 
 void  MacroAssembler::decode_klass_not_null(Register dst, Register src) {
   Register rbase = dst;
-  assert(Universe::narrow_klass_base() != NULL, "Base should be initialized");
   assert (UseCompressedClassPointers, "should only be used for compressed headers");
 
+  if (Universe::narrow_klass_base() == NULL) {
+    if (Universe::narrow_klass_shift() != 0) {
+      assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
+      lsl(dst, src, LogKlassAlignmentInBytes);
+    } else {
+      if (dst != src) mov(dst, src);
+    }
+    return;
+  }
+
   if (use_XOR_for_compressed_class_base) {
     if (Universe::narrow_klass_shift() != 0) {
       lsl(dst, src, LogKlassAlignmentInBytes);
diff -r df17ddfce21c -r e81b912b94a5 src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp
--- a/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp	Thu Dec 12 22:44:18 2013 +0000
+++ b/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp	Tue Dec 17 15:17:24 2013 +0000
@@ -172,7 +172,7 @@
 address TemplateInterpreterGenerator::generate_continuation_for(TosState state) { __ call_Unimplemented(); return 0; }
 
 
-address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) {
+address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) {
   address entry = __ pc();
 
   // Restore stack bottom in case i2c adjusted stack
@@ -184,18 +184,11 @@
   __ restore_constant_pool_cache();
   __ get_method(rmethod);
 
-  Label L_got_cache, L_giant_index;
-  if (EnableInvokeDynamic) {
-    __ ldrb(r1, Address(rbcp, 0));
-    __ cmpw(r1, Bytecodes::_invokedynamic);
-    __ br(Assembler::EQ, L_giant_index);
-  }
   // Pop N words from the stack
-  __ get_cache_and_index_at_bcp(r1, r2, 1, sizeof(u2));
-  __ bind(L_got_cache);
-  __ ldrb(r1, Address(r1,
-		     in_bytes(ConstantPoolCache::base_offset()) +
-		     3 * wordSize));
+  __ get_cache_and_index_at_bcp(r1, r2, 1, index_size);
+  __ ldr(r1, Address(r1, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
+  __ andr(r1, r1, ConstantPoolCacheEntry::parameter_size_mask);
+
   __ add(esp, esp, r1, Assembler::LSL, 3);
 
   // Restore machine SP in case i2c adjusted it
@@ -217,13 +210,6 @@
   __ get_dispatch();
   __ dispatch_next(state, step);
 
-  // out of the main line of code...
-  if (EnableInvokeDynamic) {
-    __ bind(L_giant_index);
-    __ get_cache_and_index_at_bcp(r1, r2, 1, sizeof(u4));
-    __ b(L_got_cache);
-  }
-
   return entry;
 }
 
diff -r df17ddfce21c -r e81b912b94a5 src/cpu/aarch64/vm/templateTable_aarch64.cpp
--- a/src/cpu/aarch64/vm/templateTable_aarch64.cpp	Thu Dec 12 22:44:18 2013 +0000
+++ b/src/cpu/aarch64/vm/templateTable_aarch64.cpp	Tue Dec 17 15:17:24 2013 +0000
@@ -2974,9 +2974,7 @@
   __ ubfxw(rscratch2, flags, ConstantPoolCacheEntry::tos_state_shift,  ConstantPoolCacheEntry::tos_state_bits);
   // load return address
   {
-    const address table_addr = (is_invokeinterface || is_invokedynamic) ?
-      (address)Interpreter::return_5_addrs_by_index_table() :
-      (address)Interpreter::return_3_addrs_by_index_table();
+    const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code);
     __ mov(rscratch1, table_addr);
     __ ldr(lr, Address(rscratch1, rscratch2, Address::lsl(3)));
   }
diff -r df17ddfce21c -r e81b912b94a5 src/share/vm/code/relocInfo.cpp
--- a/src/share/vm/code/relocInfo.cpp	Thu Dec 12 22:44:18 2013 +0000
+++ b/src/share/vm/code/relocInfo.cpp	Tue Dec 17 15:17:24 2013 +0000
@@ -109,6 +109,7 @@
       found=true;
     }
   }
+  assert(found, "no relocInfo found for pc");
 }
 
 
diff -r df17ddfce21c -r e81b912b94a5 src/share/vm/compiler/compileBroker.cpp
--- a/src/share/vm/compiler/compileBroker.cpp	Thu Dec 12 22:44:18 2013 +0000
+++ b/src/share/vm/compiler/compileBroker.cpp	Tue Dec 17 15:17:24 2013 +0000
@@ -998,7 +998,7 @@
 
 void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler_count) {
   EXCEPTION_MARK;
-#if !defined(ZERO) && !defined(SHARK) && !defined(TARGET_ARCH_aarch64)
+#if !defined(ZERO) && !defined(SHARK)
   assert(c2_compiler_count > 0 || c1_compiler_count > 0, "No compilers?");
 #endif // !ZERO && !SHARK
   // Initialize the compilation queue
diff -r df17ddfce21c -r e81b912b94a5 src/share/vm/opto/chaitin.hpp
--- a/src/share/vm/opto/chaitin.hpp	Thu Dec 12 22:44:18 2013 +0000
+++ b/src/share/vm/opto/chaitin.hpp	Tue Dec 17 15:17:24 2013 +0000
@@ -321,7 +321,10 @@
   }
 
   uint live_range_id(const Node *node) const {
-    return _names.at(node->_idx);
+    if (node->_idx >= size())
+      return 0;
+    else
+      return _names.at(node->_idx);
   }
 
   uint uf_live_range_id(uint lrg_id) const {
diff -r df17ddfce21c -r e81b912b94a5 src/share/vm/runtime/arguments.cpp
--- a/src/share/vm/runtime/arguments.cpp	Thu Dec 12 22:44:18 2013 +0000
+++ b/src/share/vm/runtime/arguments.cpp	Tue Dec 17 15:17:24 2013 +0000
@@ -1132,9 +1132,6 @@
     Tier3InvokeNotifyFreqLog = 0;
     Tier4InvocationThreshold = 0;
   }
-  if (FLAG_IS_DEFAULT(NmethodSweepFraction)) {
-    FLAG_SET_DEFAULT(NmethodSweepFraction, 1 + ReservedCodeCacheSize / (16 * M));
-  }
 }
 
 #if INCLUDE_ALL_GCS
diff -r df17ddfce21c -r e81b912b94a5 test/gc/metaspace/TestPerfCountersAndMemoryPools.java
--- a/test/gc/metaspace/TestPerfCountersAndMemoryPools.java	Thu Dec 12 22:44:18 2013 +0000
+++ b/test/gc/metaspace/TestPerfCountersAndMemoryPools.java	Tue Dec 17 15:17:24 2013 +0000
@@ -32,8 +32,8 @@
  * @library /testlibrary
  * @summary Tests that a MemoryPoolMXBeans and PerfCounters for metaspace
  *          report the same data.
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedKlassPointers -XX:+UseSerialGC -XX:+UsePerfData -Xint TestPerfCountersAndMemoryPools
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedKlassPointers -XX:+UseSerialGC -XX:+UsePerfData -Xint TestPerfCountersAndMemoryPools
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UseSerialGC -XX:+UsePerfData TestPerfCountersAndMemoryPools
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:+UseSerialGC -XX:+UsePerfData TestPerfCountersAndMemoryPools
  */
 public class TestPerfCountersAndMemoryPools {
     public static void main(String[] args) throws Exception {
--- CUT HERE (end hotspot patch) ---

--- CUT HERE (start jdk8 patch) ---
# HG changeset patch
# User Edward Nevill edward.nevill@linaro.org
# Date 1387293183 0
#      Tue Dec 17 15:13:03 2013 +0000
# Node ID dd3371184ae207ff2a4a7a0637733e3434674efd
# Parent  91b84cf2c36158ba2085c4198b1ea94fdd5dd4c8
Additional aarch64 changes for merge to jdk8-b117

diff -r 91b84cf2c361 -r dd3371184ae2 common/autoconf/generated-configure.sh
--- a/common/autoconf/generated-configure.sh	Wed Dec 11 20:30:20 2013 +0000
+++ b/common/autoconf/generated-configure.sh	Tue Dec 17 15:13:03 2013 +0000
@@ -659,7 +659,6 @@
 X_LIBS
 X_PRE_LIBS
 X_CFLAGS
-XMKMF
 FIXPATH
 CXXFLAGS_DEBUG_SYMBOLS
 CFLAGS_DEBUG_SYMBOLS
@@ -1081,7 +1080,6 @@
 OBJCFLAGS
 CPP
 CXXCPP
-XMKMF
 FREETYPE_CFLAGS
 FREETYPE_LIBS
 ALSA_CFLAGS
@@ -1855,7 +1853,6 @@
   OBJCFLAGS   Objective C compiler flags
   CPP         C preprocessor
   CXXCPP      C++ preprocessor
-  XMKMF       Path to xmkmf, Makefile generator for X Window System
   FREETYPE_CFLAGS
               C compiler flags for FREETYPE, overriding pkg-config
   FREETYPE_LIBS
@@ -2869,14 +2866,8 @@
     */*) ac_site_file1=$CONFIG_SITE;;
     *)   ac_site_file1=./$CONFIG_SITE;;
   esac
-elif test "x$prefix" != xNONE; then
-  ac_site_file1=$prefix/share/config.site
-  ac_site_file2=$prefix/etc/config.site
-else
-  ac_site_file1=$ac_default_prefix/share/config.site
-  ac_site_file2=$ac_default_prefix/etc/config.site
-fi
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+fi
+for ac_site_file in $ac_site_file1
 do
   test "x$ac_site_file" = xNONE && continue
   if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
@@ -3864,7 +3855,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1383151988
+DATE_WHEN_GENERATED=1387281898
 
 ###############################################################################
 #
@@ -7863,7 +7854,7 @@
   JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'`
   JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'`
 
-if test "x$JVM_VARIANT_KERNEL" = xtrue; then
+  if test "x$JVM_VARIANT_KERNEL" = xtrue; then
     if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
       as_fn_error $? "You cannot build a kernel JVM for a 64-bit machine." "$LINENO" 5
     fi
@@ -7897,10 +7888,10 @@
   fi
   if test "x$JVM_VARIANT_ZEROSHARK" = xtrue ; then
     INCLUDE_SA=false
-fi
-if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
+  fi
+  if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
     INCLUDE_SA=false
-fi
+  fi
 
 
   if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
diff -r 91b84cf2c361 -r dd3371184ae2 common/autoconf/jdk-options.m4
--- a/common/autoconf/jdk-options.m4	Wed Dec 11 20:30:20 2013 +0000
+++ b/common/autoconf/jdk-options.m4	Tue Dec 17 15:13:03 2013 +0000
@@ -88,11 +88,6 @@
   JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'`
   JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'`
 
-  if test "x$JVM_VARIANT_CLIENT" = xtrue; then
-    if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
-      AC_MSG_ERROR([You cannot build a client JVM for a 64-bit machine.])
-    fi
-  fi
   if test "x$JVM_VARIANT_KERNEL" = xtrue; then
     if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
       AC_MSG_ERROR([You cannot build a kernel JVM for a 64-bit machine.])
@@ -127,11 +122,11 @@
   fi
   if test "x$JVM_VARIANT_ZEROSHARK" = xtrue ; then
     INCLUDE_SA=false
-fi
-if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
+  fi
+  if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
     INCLUDE_SA=false
-fi
-AC_SUBST(INCLUDE_SA)
+  fi
+  AC_SUBST(INCLUDE_SA)
 
   if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
     MACOSX_UNIVERSAL="true"
diff -r 91b84cf2c361 -r dd3371184ae2 common/bin/hgforest.sh
--- a/common/bin/hgforest.sh	Wed Dec 11 20:30:20 2013 +0000
+++ b/common/bin/hgforest.sh	Tue Dec 17 15:13:03 2013 +0000
@@ -144,7 +144,8 @@
   (
     (
       if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then
-        pull_newrepo="`echo ${pull_base}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`"
+        pull_newrepo="${pull_base}/${i}"
+        # pull_newrepo="`echo ${pull_base}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`"
         echo hg clone ${pull_newrepo} ${i}
         path="`dirname ${i}`"
         if [ "${path}" != "." ] ; then
--- CUT HERE (end jdk8 patch) ---
