Merge
authorduke
Wed, 05 Jul 2017 22:06:46 +0200
changeset 40475 ce60d6f5c643
parent 40474 93cc31534cc4 (current diff)
parent 40471 ad45133ff99e (diff)
child 40481 5c4e7012ff6e
Merge
jdk/src/java.base/share/classes/java/lang/reflect/AbstractClassLoaderValue.java
jdk/src/java.base/share/classes/java/lang/reflect/ClassLoaderValue.java
jdk/src/java.desktop/share/classes/sun/java2d/marlin/ArrayCache.java
jdk/test/java/lang/reflect/ClassLoaderValue/Driver.java
jdk/test/java/lang/reflect/ClassLoaderValue/java.base/java/lang/reflect/ClassLoaderValueTest.java
--- a/.hgtags-top-repo	Thu Aug 18 21:34:24 2016 +0000
+++ b/.hgtags-top-repo	Wed Jul 05 22:06:46 2017 +0200
@@ -374,3 +374,4 @@
 f5902d3841b82cac6e7716a20c24e8e916fb14a8 jdk-9+129
 d94d54a3192fea79234c3ac55cd0b4052d45e954 jdk-9+130
 8728756c2f70a79a90188f4019cfd6b9a275765c jdk-9+131
+a24702d4d5ab0015a5c553ed57f66fce7d85155e jdk-9+132
--- a/common/autoconf/spec.gmk.in	Thu Aug 18 21:34:24 2016 +0000
+++ b/common/autoconf/spec.gmk.in	Wed Jul 05 22:06:46 2017 +0200
@@ -251,8 +251,6 @@
 # Legacy support
 USE_NEW_HOTSPOT_BUILD:=@USE_NEW_HOTSPOT_BUILD@
 
-MACOSX_UNIVERSAL=@MACOSX_UNIVERSAL@
-
 # JDK_OUTPUTDIR specifies where a working jvm is built.
 # You can run $(JDK_OUTPUTDIR)/bin/java
 # Though the layout of the contents of $(JDK_OUTPUTDIR) is not
--- a/hotspot/.hgtags	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/.hgtags	Wed Jul 05 22:06:46 2017 +0200
@@ -534,3 +534,4 @@
 e96b34b76d863ed1fa04e0eeb3f297ac17b490fd jdk-9+129
 7d54c7056328b6a2bf4877458b8f4d8cd870f93b jdk-9+130
 943bf73b49c33c2d7cbd796f6a4ae3c7a00ae932 jdk-9+131
+713951c08aa26813375175c2ab6cc99ff2a56903 jdk-9+132
--- a/hotspot/make/Dist.gmk	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/make/Dist.gmk	Wed Jul 05 22:06:46 2017 +0200
@@ -46,15 +46,6 @@
 endif
 
 ################################################################################
-# Functions to setup copying of files for variants
-
-# Support macro for SetupDistLibFile
-define macosx_universalize
-	$(MKDIR) -p $(@D)
-	$(LIPO) -create -output $@ $<
-endef
-
-################################################################################
 # Setup make rules to copy a native library and associated data.
 #
 # Parameter 1 is the name of the rule. This name is used as variable prefix,
@@ -74,16 +65,9 @@
   $1_LIB_NAME := $(LIBRARY_PREFIX)$$($1_NAME)
   $1_TARGET_DIR := $$(DIST_OUTPUTDIR)/$$(LIB_SUBDIR)/$$($1_VARIANT_TARGET_DIR)
 
-  ifeq ($(OPENJDK_TARGET_OS), macosx)
-    # We must use the 'universalize' macro to run lipo on shared libraries, at
-    # least until JDK-8069540 is fixed.
-    $1_MACRO := macosx_universalize
-  endif
-
   # Copy the the native library.
   $$(eval $$(call SetupCopyFiles, $1_COPY_LIB, \
       DEST := $$($1_TARGET_DIR), \
-      MACRO := $$($1_MACRO), \
       FILES := $$(wildcard \
           $$($1_SRC_DIR)/$$($1_LIB_NAME)$(SHARED_LIBRARY_SUFFIX)), \
   ))
--- a/hotspot/make/test/JtregNative.gmk	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/make/test/JtregNative.gmk	Wed Jul 05 22:06:46 2017 +0200
@@ -50,7 +50,6 @@
     $(HOTSPOT_TOPDIR)/test/runtime/BoolReturn \
     $(HOTSPOT_TOPDIR)/test/compiler/floatingpoint/ \
     $(HOTSPOT_TOPDIR)/test/compiler/calls \
-    $(HOTSPOT_TOPDIR)/test/compiler/native \
     $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/GetNamedModule \
     $(HOTSPOT_TOPDIR)/test/testlibrary/jvmti \
     $(HOTSPOT_TOPDIR)/test/compiler/jvmci/jdk.vm.ci.code.test \
--- a/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -110,17 +110,7 @@
     // Entry frame checks
     if (is_entry_frame()) {
       // an entry frame must have a valid fp.
-
-      if (!fp_safe) return false;
-
-      // Validate the JavaCallWrapper an entry frame must have
-
-      address jcw = (address)entry_frame_call_wrapper();
-
-      bool jcw_safe = (jcw < thread->stack_base()) && ( jcw > fp);
-
-      return jcw_safe;
-
+      return fp_safe && is_entry_frame_valid(thread);
     }
 
     intptr_t* sender_sp = NULL;
@@ -210,15 +200,8 @@
       }
 
       // construct the potential sender
-
       frame sender(sender_sp, sender_unextended_sp, saved_fp, sender_pc);
-
-      // Validate the JavaCallWrapper an entry frame must have
-      address jcw = (address)sender.entry_frame_call_wrapper();
-
-      bool jcw_safe = (jcw < thread->stack_base()) && ( jcw > (address)sender.fp());
-
-      return jcw_safe;
+      return sender.is_entry_frame_valid(thread);
     }
 
     CompiledMethod* nm = sender_blob->as_compiled_method_or_null();
--- a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -225,19 +225,7 @@
     // Entry frame checks
     if (is_entry_frame()) {
       // an entry frame must have a valid fp.
-
-      if (!fp_safe) {
-        return false;
-      }
-
-      // Validate the JavaCallWrapper an entry frame must have
-
-      address jcw = (address)entry_frame_call_wrapper();
-
-      bool jcw_safe = (jcw <= thread->stack_base()) && ( jcw > _FP);
-
-      return jcw_safe;
-
+      return fp_safe && is_entry_frame_valid(thread);
     }
 
     intptr_t* younger_sp = sp();
@@ -290,14 +278,8 @@
       return false;
     }
 
-    if( sender.is_entry_frame()) {
-      // Validate the JavaCallWrapper an entry frame must have
-
-      address jcw = (address)sender.entry_frame_call_wrapper();
-
-      bool jcw_safe = (jcw <= thread->stack_base()) && ( jcw > sender_fp);
-
-      return jcw_safe;
+    if (sender.is_entry_frame()) {
+      return sender.is_entry_frame_valid(thread);
     }
 
     // If the frame size is 0 something (or less) is bad because every nmethod has a non-zero frame size
@@ -357,12 +339,6 @@
     _cb = CodeCache::find_blob(_pc);
   }
   _deopt_state = unknown;
-#ifdef ASSERT
-  if ( _cb != NULL && _cb->is_compiled()) {
-    // Without a valid unextended_sp() we can't convert the pc to "original"
-    assert(!((CompiledMethod*)_cb)->is_deopt_pc(_pc), "invariant broken");
-  }
-#endif // ASSERT
 }
 
 frame::frame(intptr_t* sp, unpatchable_t, address pc, CodeBlob* cb) {
@@ -534,6 +510,7 @@
 
 
 void frame::patch_pc(Thread* thread, address pc) {
+  vmassert(_deopt_state != unknown, "frame is unpatchable");
   if(thread == Thread::current()) {
    StubRoutines::Sparc::flush_callers_register_windows_func()();
   }
--- a/hotspot/src/cpu/x86/vm/frame_x86.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -108,17 +108,7 @@
     // Entry frame checks
     if (is_entry_frame()) {
       // an entry frame must have a valid fp.
-
-      if (!fp_safe) return false;
-
-      // Validate the JavaCallWrapper an entry frame must have
-
-      address jcw = (address)entry_frame_call_wrapper();
-
-      bool jcw_safe = (jcw < thread->stack_base()) && ( jcw > fp);
-
-      return jcw_safe;
-
+      return fp_safe && is_entry_frame_valid(thread);
     }
 
     intptr_t* sender_sp = NULL;
@@ -209,15 +199,8 @@
       }
 
       // construct the potential sender
-
       frame sender(sender_sp, sender_unextended_sp, saved_fp, sender_pc);
-
-      // Validate the JavaCallWrapper an entry frame must have
-      address jcw = (address)sender.entry_frame_call_wrapper();
-
-      bool jcw_safe = (jcw < thread->stack_base()) && ( jcw > (address)sender.fp());
-
-      return jcw_safe;
+      return sender.is_entry_frame_valid(thread);
     }
 
     CompiledMethod* nm = sender_blob->as_compiled_method_or_null();
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -1071,6 +1071,9 @@
 
     NOT_LP64(get_thread(rthread);)
 
+    cmpl(Address(rthread, JavaThread::stack_guard_state_offset()), JavaThread::stack_guard_enabled);
+    jcc(Assembler::equal, no_reserved_zone_enabling);
+
     cmpptr(rbx, Address(rthread, JavaThread::reserved_stack_activation_offset()));
     jcc(Assembler::lessEqual, no_reserved_zone_enabling);
 
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java	Wed Jul 05 22:06:46 2017 +0200
@@ -255,7 +255,8 @@
         }
 
         buildAttachArgs(newArgs, pid, exe, core, false);
-        JStack.main(newArgs.toArray(new String[newArgs.size()]));
+        JStack jstack = new JStack(false, false);
+        jstack.runWithArgs(newArgs.toArray(new String[newArgs.size()]));
     }
 
     private static void runJMAP(String[] oldArgs) {
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/BreakpointInfo.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/BreakpointInfo.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/MethodCounters.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/MethodCounters.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64Frame.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64Frame.java	Wed Jul 05 22:06:46 2017 +0200
@@ -46,7 +46,6 @@
   private static final int SENDER_SP_OFFSET           =  0;
 
   // Interpreter frames
-  private static final int INTERPRETER_FRAME_MIRROR_OFFSET = -3; // for native calls only
   private static final int INTERPRETER_FRAME_SENDER_SP_OFFSET = -4;
   private static final int INTERPRETER_FRAME_LAST_SP_OFFSET = INTERPRETER_FRAME_SENDER_SP_OFFSET - 1;
   private static final int INTERPRETER_FRAME_MDX_OFFSET = INTERPRETER_FRAME_LAST_SP_OFFSET -1;
@@ -55,7 +54,8 @@
   private static final int INTERPRETER_FRAME_CACHE_OFFSET =INTERPRETER_FRAME_BCX_OFFSET - 1;
   private static final int INTERPRETER_FRAME_MONITORS_OFFSET = INTERPRETER_FRAME_CACHE_OFFSET - 1;
   private static final int INTERPRETER_FRAME_LOCALS_OFFSET = INTERPRETER_FRAME_MONITORS_OFFSET - 1;
-  private static final int INTERPRETER_FRAME_METHOD_OFFSET = INTERPRETER_FRAME_LOCALS_OFFSET - 1;
+  private static final int INTERPRETER_FRAME_MIRROR_OFFSET = INTERPRETER_FRAME_LOCALS_OFFSET - 1;
+  private static final int INTERPRETER_FRAME_METHOD_OFFSET = INTERPRETER_FRAME_MIRROR_OFFSET - 1;
   private static final int INTERPRETER_FRAME_INITIAL_SP_OFFSET = INTERPRETER_FRAME_BCX_OFFSET - 1; // FIXME: probably wrong, but unused anyway
   private static final int INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET = INTERPRETER_FRAME_INITIAL_SP_OFFSET;
   private static final int INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET = INTERPRETER_FRAME_INITIAL_SP_OFFSET;
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCFrame.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCFrame.java	Wed Jul 05 22:06:46 2017 +0200
@@ -714,11 +714,7 @@
   /** 2 words, also used to save float regs across  calls to C */
   public static final int INTERPRETER_FRAME_D_SCRATCH_FP_OFFSET           = -2;
   public static final int INTERPRETER_FRAME_L_SCRATCH_FP_OFFSET           = -4;
-  /** For native calls only */
-  public static final int INTERPRETER_FRAME_PADDING_OFFSET                = -5;
-  /** For native calls only */
-  public static final int INTERPRETER_FRAME_MIRROR_OFFSET                 = -6;
-  /** Should be same as above, and should be zero mod 8 */
+  public static final int INTERPRETER_FRAME_MIRROR_OFFSET                 = -5;
   public static final int INTERPRETER_FRAME_VM_LOCALS_FP_OFFSET           = -6;
   public static final int INTERPRETER_FRAME_VM_LOCAL_WORDS                = -INTERPRETER_FRAME_VM_LOCALS_FP_OFFSET;
 
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java	Wed Jul 05 22:06:46 2017 +0200
@@ -48,10 +48,10 @@
   private static final int SENDER_SP_OFFSET           =  2;
 
   // Interpreter frames
-  private static final int INTERPRETER_FRAME_MIRROR_OFFSET    =  2; // for native calls only
   private static final int INTERPRETER_FRAME_SENDER_SP_OFFSET = -1;
   private static final int INTERPRETER_FRAME_LAST_SP_OFFSET   = INTERPRETER_FRAME_SENDER_SP_OFFSET - 1;
   private static final int INTERPRETER_FRAME_METHOD_OFFSET    = INTERPRETER_FRAME_LAST_SP_OFFSET - 1;
+  private static       int INTERPRETER_FRAME_MIRROR_OFFSET;
   private static       int INTERPRETER_FRAME_MDX_OFFSET;         // Non-core builds only
   private static       int INTERPRETER_FRAME_CACHE_OFFSET;
   private static       int INTERPRETER_FRAME_LOCALS_OFFSET;
@@ -74,7 +74,8 @@
   }
 
   private static synchronized void initialize(TypeDataBase db) {
-    INTERPRETER_FRAME_MDX_OFFSET                  = INTERPRETER_FRAME_METHOD_OFFSET - 1;
+    INTERPRETER_FRAME_MIRROR_OFFSET               = INTERPRETER_FRAME_METHOD_OFFSET - 1;
+    INTERPRETER_FRAME_MDX_OFFSET                  = INTERPRETER_FRAME_MIRROR_OFFSET - 1;
     INTERPRETER_FRAME_CACHE_OFFSET                = INTERPRETER_FRAME_MDX_OFFSET - 1;
     INTERPRETER_FRAME_LOCALS_OFFSET               = INTERPRETER_FRAME_CACHE_OFFSET - 1;
     INTERPRETER_FRAME_BCX_OFFSET                  = INTERPRETER_FRAME_LOCALS_OFFSET - 1;
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/ObjectReader.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/ObjectReader.java	Wed Jul 05 22:06:46 2017 +0200
@@ -26,6 +26,7 @@
 
 import java.lang.reflect.Modifier;
 import java.util.*;
+import java.util.stream.*;
 import sun.jvm.hotspot.debugger.*;
 import sun.jvm.hotspot.oops.*;
 import sun.jvm.hotspot.runtime.*;
@@ -204,15 +205,29 @@
       }
    }
 
-   protected Object getHashtable(Instance oop, boolean isProperties) {
+   private void setPropertiesEntry(java.util.Properties p, Oop oop) {
+      InstanceKlass ik = (InstanceKlass)oop.getKlass();
+      OopField keyField = (OopField)ik.findField("key", "Ljava/lang/Object;");
+      OopField valueField = (OopField)ik.findField("val", "Ljava/lang/Object;");
+
+      try {
+         p.setProperty((String)readObject(keyField.getValue(oop)),
+                       (String)readObject(valueField.getValue(oop)));
+      } catch (ClassNotFoundException ce) {
+         if (DEBUG) {
+            debugPrintStackTrace(ce);
+         }
+      }
+   }
+
+   protected Object getHashtable(Instance oop) {
       InstanceKlass k = (InstanceKlass)oop.getKlass();
       OopField tableField = (OopField)k.findField("table", "[Ljava/util/Hashtable$Entry;");
       if (tableField == null) {
          debugPrintln("Could not find field of [Ljava/util/Hashtable$Entry;");
          return null;
       }
-      java.util.Hashtable table = (isProperties) ? new java.util.Properties()
-                                                 : new java.util.Hashtable();
+      java.util.Hashtable table = new java.util.Hashtable();
       ObjArray kvs = (ObjArray)tableField.getValue(oop);
       long size = kvs.getLength();
       debugPrintln("Hashtable$Entry Size = " + size);
@@ -225,6 +240,39 @@
       return table;
    }
 
+   private Properties getProperties(Instance oop) {
+      InstanceKlass k = (InstanceKlass)oop.getKlass();
+      OopField mapField = (OopField)k.findField("map", "Ljava/util/concurrent/ConcurrentHashMap;");
+      if (mapField == null) {
+         debugPrintln("Could not find field of Ljava/util/concurrent/ConcurrentHashMap");
+         return null;
+      }
+
+      Instance mapObj = (Instance)mapField.getValue(oop);
+      if (mapObj == null) {
+         debugPrintln("Could not get map field from java.util.Properties");
+         return null;
+      }
+
+      InstanceKlass mk = (InstanceKlass)mapObj.getKlass();
+      OopField tableField = (OopField)mk.findField("table", "[Ljava/util/concurrent/ConcurrentHashMap$Node;");
+      if (tableField == null) {
+         debugPrintln("Could not find field of [Ljava/util/concurrent/ConcurrentHashMap$Node");
+         return null;
+      }
+
+      java.util.Properties props = new java.util.Properties();
+      ObjArray kvs = (ObjArray)tableField.getValue(mapObj);
+      long size = kvs.getLength();
+      debugPrintln("ConcurrentHashMap$Node Size = " + size);
+      LongStream.range(0, size)
+                .mapToObj(kvs::getObjAt)
+                .filter(o -> o != null)
+                .forEach(o -> setPropertiesEntry(props, o));
+
+      return props;
+   }
+
    public Object readInstance(Instance oop) throws ClassNotFoundException {
       Object result = getFromObjTable(oop);
       if (result == null) {
@@ -240,11 +288,11 @@
          }
 
          if (kls.getName().equals(javaUtilHashtable())) {
-            return getHashtable(oop, false);
+            return getHashtable(oop);
          }
 
          if (kls.getName().equals(javaUtilProperties())) {
-            return getHashtable(oop, true);
+            return getProperties(oop);
          }
 
          Class clz = readClass(kls);
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java	Wed Jul 05 22:06:46 2017 +0200
@@ -265,9 +265,10 @@
     native HotSpotResolvedObjectTypeImpl resolveTypeInPool(HotSpotConstantPool constantPool, int cpi) throws LinkageError;
 
     /**
-     * Looks up and attempts to resolve the {@code JVM_CONSTANT_Field} entry for at index {@code cpi} in
-     * {@code constantPool}. For some opcodes, checks are performed that require the {@code method}
-     * that contains {@code opcode} to be specified. The values returned in {@code info} are:
+     * Looks up and attempts to resolve the {@code JVM_CONSTANT_Field} entry for at index
+     * {@code cpi} in {@code constantPool}. For some opcodes, checks are performed that require the
+     * {@code method} that contains {@code opcode} to be specified. The values returned in
+     * {@code info} are:
      *
      * <pre>
      *     [(int) flags,   // only valid if field is resolved
@@ -556,20 +557,18 @@
     native HotSpotResolvedJavaMethodImpl getResolvedJavaMethod(Object base, long displacement);
 
     /**
-     * Read a HotSpot ConstantPool* value from the memory location described by {@code base} plus
-     * {@code displacement} and return the {@link HotSpotConstantPool} wrapping it. This method does
-     * no checking that the memory location actually contains a valid pointer and may crash the VM
-     * if an invalid location is provided. If the {@code base} is null then {@code displacement} is
-     * used by itself. If {@code base} is a {@link HotSpotResolvedJavaMethodImpl},
-     * {@link HotSpotConstantPool} or {@link HotSpotResolvedObjectTypeImpl} then the metaspace
-     * pointer is fetched from that object and added to {@code displacement}. Any other non-null
-     * object type causes an {@link IllegalArgumentException} to be thrown.
+     * Gets the {@code ConstantPool*} associated with {@code object} and returns a
+     * {@link HotSpotConstantPool} wrapping it.
      *
-     * @param base an object to read from or null
-     * @param displacement
-     * @return null or the resolved method for this location
+     * @param object a {@link HotSpotResolvedJavaMethodImpl} or
+     *            {@link HotSpotResolvedObjectTypeImpl} object
+     * @return a {@link HotSpotConstantPool} wrapping the {@code ConstantPool*} associated with
+     *         {@code object}
+     * @throws NullPointerException if {@code object == null}
+     * @throws IllegalArgumentException if {@code object} is neither a
+     *             {@link HotSpotResolvedJavaMethodImpl} nor a {@link HotSpotResolvedObjectTypeImpl}
      */
-    native HotSpotConstantPool getConstantPool(Object base, long displacement);
+    native HotSpotConstantPool getConstantPool(Object object);
 
     /**
      * Read a HotSpot Klass* value from the memory location described by {@code base} plus
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java	Wed Jul 05 22:06:46 2017 +0200
@@ -121,7 +121,7 @@
         if (metaspaceConstantPool == holder.getConstantPool().getMetaspaceConstantPool()) {
             this.constantPool = holder.getConstantPool();
         } else {
-            this.constantPool = compilerToVM().getConstantPool(null, constMethod + config.constMethodConstantsOffset);
+            this.constantPool = compilerToVM().getConstantPool(this);
         }
 
         final int nameIndex = UNSAFE.getChar(constMethod + config.constMethodNameIndexOffset);
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java	Wed Jul 05 22:06:46 2017 +0200
@@ -445,7 +445,7 @@
              * operating on the latest one and that HotSpotResolvedJavaMethodImpls will be able to
              * use the shared copy instead of creating their own instance.
              */
-            constantPool = compilerToVM().getConstantPool(this, config().instanceKlassConstantsOffset);
+            constantPool = compilerToVM().getConstantPool(this);
         }
         return constantPool;
     }
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -2686,7 +2686,8 @@
 //      - sets target osthread state to continue
 //      - sends signal to end the sigsuspend loop in the SR_handler
 //
-//  Note that the SR_lock plays no role in this suspend/resume protocol.
+//  Note that the SR_lock plays no role in this suspend/resume protocol,
+//  but is checked for NULL in SR_handler as a thread termination indicator.
 //
 
 static void resume_clear_context(OSThread *osthread) {
@@ -2718,9 +2719,22 @@
   // after sigsuspend.
   int old_errno = errno;
 
-  Thread* thread = Thread::current();
+  Thread* thread = Thread::current_or_null_safe();
+  assert(thread != NULL, "Missing current thread in SR_handler");
+
+  // On some systems we have seen signal delivery get "stuck" until the signal
+  // mask is changed as part of thread termination. Check that the current thread
+  // has not already terminated (via SR_lock()) - else the following assertion
+  // will fail because the thread is no longer a JavaThread as the ~JavaThread
+  // destructor has completed.
+
+  if (thread->SR_lock() == NULL) {
+    return;
+  }
+
+  assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
+
   OSThread* osthread = thread->osthread();
-  assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
 
   os::SuspendResume::State current = osthread->sr.state();
   if (current == os::SuspendResume::SR_SUSPEND_REQUEST) {
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -2716,7 +2716,8 @@
 //      - sets target osthread state to continue
 //      - sends signal to end the sigsuspend loop in the SR_handler
 //
-//  Note that the SR_lock plays no role in this suspend/resume protocol.
+//  Note that the SR_lock plays no role in this suspend/resume protocol,
+//  but is checked for NULL in SR_handler as a thread termination indicator.
 
 static void resume_clear_context(OSThread *osthread) {
   osthread->set_ucontext(NULL);
@@ -2746,9 +2747,22 @@
   // after sigsuspend.
   int old_errno = errno;
 
-  Thread* thread = Thread::current();
+  Thread* thread = Thread::current_or_null_safe();
+  assert(thread != NULL, "Missing current thread in SR_handler");
+
+  // On some systems we have seen signal delivery get "stuck" until the signal
+  // mask is changed as part of thread termination. Check that the current thread
+  // has not already terminated (via SR_lock()) - else the following assertion
+  // will fail because the thread is no longer a JavaThread as the ~JavaThread
+  // destructor has completed.
+
+  if (thread->SR_lock() == NULL) {
+    return;
+  }
+
+  assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
+
   OSThread* osthread = thread->osthread();
-  assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
 
   os::SuspendResume::State current = osthread->sr.state();
   if (current == os::SuspendResume::SR_SUSPEND_REQUEST) {
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -3971,7 +3971,8 @@
 //      - sets target osthread state to continue
 //      - sends signal to end the sigsuspend loop in the SR_handler
 //
-//  Note that the SR_lock plays no role in this suspend/resume protocol.
+//  Note that the SR_lock plays no role in this suspend/resume protocol,
+//  but is checked for NULL in SR_handler as a thread termination indicator.
 
 static void resume_clear_context(OSThread *osthread) {
   osthread->set_ucontext(NULL);
@@ -4004,8 +4005,20 @@
 
   Thread* thread = Thread::current_or_null_safe();
   assert(thread != NULL, "Missing current thread in SR_handler");
+
+  // On some systems we have seen signal delivery get "stuck" until the signal
+  // mask is changed as part of thread termination. Check that the current thread
+  // has not already terminated (via SR_lock()) - else the following assertion
+  // will fail because the thread is no longer a JavaThread as the ~JavaThread
+  // destructor has completed.
+
+  if (thread->SR_lock() == NULL) {
+    return;
+  }
+
+  assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
+
   OSThread* osthread = thread->osthread();
-  assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
 
   os::SuspendResume::State current = osthread->sr.state();
   if (current == os::SuspendResume::SR_SUSPEND_REQUEST) {
--- a/hotspot/src/os/posix/vm/os_posix.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/os/posix/vm/os_posix.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -93,10 +93,6 @@
 }
 
 int os::get_native_stack(address* stack, int frames, int toSkip) {
-#ifdef _NMT_NOINLINE_
-  toSkip++;
-#endif
-
   int frame_idx = 0;
   int num_of_frames;  // number of frames captured
   frame fr = os::current_frame();
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -318,9 +318,6 @@
 // only supported on Windows XP or later.
 //
 int os::get_native_stack(address* stack, int frames, int toSkip) {
-#ifdef _NMT_NOINLINE_
-  toSkip++;
-#endif
   int captured = RtlCaptureStackBackTrace(toSkip + 1, frames, (PVOID*)stack, NULL);
   for (int index = captured; index < frames; index ++) {
     stack[index] = NULL;
--- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -417,7 +417,15 @@
 #else
   register intptr_t **ebp __asm__ (SPELL_REG_FP);
 #endif
-  return (intptr_t*) *ebp;   // we want what it points to.
+  // ebp is for this frame (_get_previous_fp). We want the ebp for the
+  // caller of os::current_frame*(), so go up two frames. However, for
+  // optimized builds, _get_previous_fp() will be inlined, so only go
+  // up 1 frame in that case.
+#ifdef _NMT_NOINLINE_
+  return **(intptr_t***)ebp;
+#else
+  return *ebp;
+#endif
 }
 
 
--- a/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -238,6 +238,28 @@
     }
   }
 
+  // Make the signal handler transaction-aware by checking the existence of a
+  // second (transactional) context with MSR TS bits active. If the signal is
+  // caught during a transaction, then just return to the HTM abort handler.
+  // Please refer to Linux kernel document powerpc/transactional_memory.txt,
+  // section "Signals".
+  if (uc && uc->uc_link) {
+    ucontext_t* second_uc = uc->uc_link;
+
+    // MSR TS bits are 29 and 30 (Power ISA, v2.07B, Book III-S, pp. 857-858,
+    // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+    // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+    // bits 33 and 34. It's not related to endianness, just a notation matter.
+    if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
+      if (TraceTraps) {
+        tty->print_cr("caught signal in transaction, "
+                        "ignoring to jump to abort handler");
+      }
+      // Return control to the HTM abort handler.
+      return true;
+    }
+  }
+
   JavaThread* thread = NULL;
   VMThread* vmthread = NULL;
   if (os::Linux::signal_handlers_are_installed) {
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -235,7 +235,15 @@
 #else
   register intptr_t **ebp __asm__ (SPELL_REG_FP);
 #endif
-  return (intptr_t*) *ebp;   // we want what it points to.
+  // ebp is for this frame (_get_previous_fp). We want the ebp for the
+  // caller of os::current_frame*(), so go up two frames. However, for
+  // optimized builds, _get_previous_fp() will be inlined, so only go
+  // up 1 frame in that case.
+#ifdef _NMT_NOINLINE_
+  return **(intptr_t***)ebp;
+#else
+  return *ebp;
+#endif
 }
 
 
--- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -292,15 +292,19 @@
 
 frame os::current_frame() {
   intptr_t* fp = _get_current_fp();  // it's inlined so want current fp
+  // fp is for os::current_frame. We want the fp for our caller.
   frame myframe((intptr_t*)os::current_stack_pointer(),
                 (intptr_t*)fp,
                 CAST_FROM_FN_PTR(address, os::current_frame));
-  if (os::is_first_C_frame(&myframe)) {
+  frame caller_frame = os::get_sender_for_C_frame(&myframe);
+
+  if (os::is_first_C_frame(&caller_frame)) {
     // stack is not walkable
     frame ret; // This will be a null useless frame
     return ret;
   } else {
-    return os::get_sender_for_C_frame(&myframe);
+    // return frame for our caller's caller
+    return os::get_sender_for_C_frame(&caller_frame);
   }
 }
 
--- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -496,7 +496,15 @@
   __asm {
     mov frameptr, ebp
   };
+  // ebp (frameptr) is for this frame (_get_previous_fp). We want the ebp for the
+  // caller of os::current_frame*(), so go up two frames. However, for
+  // optimized builds, _get_previous_fp() will be inlined, so only go
+  // up 1 frame in that case.
+#ifdef _NMT_NOINLINE_
+  return **(intptr_t***)frameptr;
+#else
   return *frameptr;
+#endif
 }
 #endif // !AMD64
 
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -126,13 +126,17 @@
 // ClassLoaderData, no other non-GC thread has knowledge of the anonymous class while
 // it is being defined, therefore _keep_alive is not volatile or atomic.
 void ClassLoaderData::inc_keep_alive() {
-  assert(_keep_alive >= 0, "Invalid keep alive count");
-  _keep_alive++;
+  if (is_anonymous()) {
+    assert(_keep_alive >= 0, "Invalid keep alive increment count");
+    _keep_alive++;
+  }
 }
 
 void ClassLoaderData::dec_keep_alive() {
-  assert(_keep_alive > 0, "Invalid keep alive count");
-  _keep_alive--;
+  if (is_anonymous()) {
+    assert(_keep_alive > 0, "Invalid keep alive decrement count");
+    _keep_alive--;
+  }
 }
 
 void ClassLoaderData::oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim) {
@@ -1173,7 +1177,7 @@
   if (class_loader() == NULL) {
     out->print("NULL class_loader");
   } else {
-    out->print("class loader " INTPTR_FORMAT, p2i(this));
+    out->print("class loader " INTPTR_FORMAT " ", p2i(this));
     class_loader()->print_value_on(out);
   }
 }
--- a/hotspot/src/share/vm/classfile/classLoaderData.hpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp	Wed Jul 05 22:06:46 2017 +0200
@@ -176,9 +176,9 @@
   Mutex* _metaspace_lock;  // Locks the metaspace for allocations and setup.
   bool _unloading;         // true if this class loader goes away
   bool _is_anonymous;      // if this CLD is for an anonymous class
-  int _keep_alive;         // if this CLD is kept alive without a keep_alive_object().
-                           // Currently used solely for anonymous classes.
-                           // _keep_alive does not need to be volatile or
+  s2 _keep_alive;          // if this CLD is kept alive without a keep_alive_object().
+                           // Used for anonymous classes and the boot class
+                           // loader. _keep_alive does not need to be volatile or
                            // atomic since there is one unique CLD per anonymous class.
   volatile int _claimed;   // true if claimed, for example during GC traces.
                            // To avoid applying oop closure more than once.
@@ -289,6 +289,8 @@
     return _unloading;
   }
 
+  // Used to refcount an anonymous class's CLD in order to
+  // indicate their aliveness without a keep_alive_object().
   void inc_keep_alive();
   void dec_keep_alive();
 
--- a/hotspot/src/share/vm/code/dependencies.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/code/dependencies.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -1082,12 +1082,11 @@
     if (!(m->is_public() || m->is_protected()))
       // The override story is complex when packages get involved.
       return true;  // Must punt the assertion to true.
-    Klass* k = ctxk;
-    Method* lm = k->lookup_method(m->name(), m->signature());
-    if (lm == NULL && k->is_instance_klass()) {
+    Method* lm = ctxk->lookup_method(m->name(), m->signature());
+    if (lm == NULL && ctxk->is_instance_klass()) {
       // It might be an interface method
-      lm = InstanceKlass::cast(k)->lookup_method_in_ordered_interfaces(m->name(),
-                                                                 m->signature());
+      lm = InstanceKlass::cast(ctxk)->lookup_method_in_ordered_interfaces(m->name(),
+                                                                          m->signature());
     }
     if (lm == m)
       // Method m is inherited into ctxk.
@@ -1101,11 +1100,19 @@
         // Static methods don't override non-static so punt
         return true;
       }
-      if (   !Dependencies::is_concrete_method(lm, k)
-          && !Dependencies::is_concrete_method(m, ctxk)
-          && lm->method_holder()->is_subtype_of(m->method_holder()))
-        // Method m is overridden by lm, but both are non-concrete.
-        return true;
+      if (!Dependencies::is_concrete_method(lm, ctxk) &&
+          !Dependencies::is_concrete_method(m, ctxk)) {
+        // They are both non-concrete
+        if (lm->method_holder()->is_subtype_of(m->method_holder())) {
+          // Method m is overridden by lm, but both are non-concrete.
+          return true;
+        }
+        if (lm->method_holder()->is_interface() && m->method_holder()->is_interface() &&
+            ctxk->is_subtype_of(m->method_holder()) && ctxk->is_subtype_of(lm->method_holder())) {
+          // Interface method defined in multiple super interfaces
+          return true;
+        }
+      }
     }
     ResourceMark rm;
     tty->print_cr("Dependency method not found in the associated context:");
--- a/hotspot/src/share/vm/gc/g1/g1Analytics.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1Analytics.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -316,8 +316,12 @@
   return get_new_size_prediction(_pending_cards_seq);
 }
 
+double G1Analytics::oldest_known_gc_end_time_sec() const {
+  return _recent_prev_end_times_for_all_gcs_sec->oldest();
+}
+
 double G1Analytics::last_known_gc_end_time_sec() const {
-  return _recent_prev_end_times_for_all_gcs_sec->oldest();
+  return _recent_prev_end_times_for_all_gcs_sec->last();
 }
 
 void G1Analytics::update_recent_gc_times(double end_time_sec,
--- a/hotspot/src/share/vm/gc/g1/g1Analytics.hpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1Analytics.hpp	Wed Jul 05 22:06:46 2017 +0200
@@ -155,6 +155,7 @@
   void update_recent_gc_times(double end_time_sec, double elapsed_ms);
   void compute_pause_time_ratio(double interval_ms, double pause_time_ms);
 
+  double oldest_known_gc_end_time_sec() const;
   double last_known_gc_end_time_sec() const;
 };
 
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -28,6 +28,7 @@
 #include "classfile/symbolTable.hpp"
 #include "code/codeCache.hpp"
 #include "code/icBuffer.hpp"
+#include "gc/g1/g1Analytics.hpp"
 #include "gc/g1/bufferingOopClosure.hpp"
 #include "gc/g1/concurrentG1Refine.hpp"
 #include "gc/g1/concurrentG1RefineThread.hpp"
@@ -2473,8 +2474,19 @@
 }
 
 jlong G1CollectedHeap::millis_since_last_gc() {
-  // assert(false, "NYI");
-  return 0;
+  jlong now = os::elapsed_counter() / NANOSECS_PER_MILLISEC;
+  const G1Analytics* analytics = _g1_policy->analytics();
+  double last = analytics->last_known_gc_end_time_sec();
+  jlong ret_val = now - (last * 1000);
+  if (ret_val < 0) {
+    // See the notes in GenCollectedHeap::millis_since_last_gc()
+    // for more information about the implementation.
+    log_warning(gc)("Detected clock going backwards. "
+      "Milliseconds since last GC would be " JLONG_FORMAT
+      ". returning zero instead.", ret_val);
+    return 0;
+  }
+  return ret_val;
 }
 
 void G1CollectedHeap::prepare_for_verify() {
--- a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -604,7 +604,7 @@
     _analytics->report_alloc_rate_ms(alloc_rate_ms);
 
     double interval_ms =
-      (end_time_sec - _analytics->last_known_gc_end_time_sec()) * 1000.0;
+      (end_time_sec - _analytics->oldest_known_gc_end_time_sec()) * 1000.0;
     _analytics->update_recent_gc_times(end_time_sec, pause_time_ms);
     _analytics->compute_pause_time_ratio(interval_ms, pause_time_ms);
   }
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -1256,21 +1256,21 @@
 };
 
 jlong GenCollectedHeap::millis_since_last_gc() {
-  // We need a monotonically non-decreasing time in ms but
-  // os::javaTimeMillis() does not guarantee monotonicity.
+  // javaTimeNanos() is guaranteed to be monotonically non-decreasing
+  // provided the underlying platform provides such a time source
+  // (and it is bug free). So we still have to guard against getting
+  // back a time later than 'now'.
   jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
   GenTimeOfLastGCClosure tolgc_cl(now);
   // iterate over generations getting the oldest
   // time that a generation was collected
   generation_iterate(&tolgc_cl, false);
 
-  // javaTimeNanos() is guaranteed to be monotonically non-decreasing
-  // provided the underlying platform provides such a time source
-  // (and it is bug free). So we still have to guard against getting
-  // back a time later than 'now'.
   jlong retVal = now - tolgc_cl.time();
   if (retVal < 0) {
-    NOT_PRODUCT(log_warning(gc)("time warp: " JLONG_FORMAT, retVal);)
+    log_warning(gc)("Detected clock going backwards. "
+      "Milliseconds since last GC would be " JLONG_FORMAT
+      ". returning zero instead.", retVal);
     return 0;
   }
   return retVal;
--- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -461,31 +461,26 @@
   return JNIHandles::make_local(THREAD, result);
 }
 
-C2V_VMENTRY(jobject, getConstantPool, (JNIEnv *, jobject, jobject base, jlong offset))
+C2V_VMENTRY(jobject, getConstantPool, (JNIEnv *, jobject, jobject object_handle))
   constantPoolHandle cp;
-  oop base_object = JNIHandles::resolve(base);
-  jlong base_address = 0;
-  if (base_object != NULL) {
-    if (base_object->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) {
-      base_address = HotSpotResolvedJavaMethodImpl::metaspaceMethod(base_object);
-    } else if (base_object->is_a(SystemDictionary::HotSpotConstantPool_klass())) {
-      base_address = HotSpotConstantPool::metaspaceConstantPool(base_object);
-    } else if (base_object->is_a(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass())) {
-      base_address = (jlong) CompilerToVM::asKlass(base_object);
-    } else {
-      THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
-                  err_msg("Unexpected type: %s", base_object->klass()->external_name()));
-    }
+  oop object = JNIHandles::resolve(object_handle);
+  if (object == NULL) {
+    THROW_0(vmSymbols::java_lang_NullPointerException());
   }
-  cp = *((ConstantPool**) (intptr_t) (base_address + offset));
-  if (!cp.is_null()) {
-    JavaValue method_result(T_OBJECT);
-    JavaCallArguments args;
-    args.push_long((jlong) (address) cp());
-    JavaCalls::call_static(&method_result, SystemDictionary::HotSpotConstantPool_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::constantPool_fromMetaspace_signature(), &args, CHECK_NULL);
-    return JNIHandles::make_local(THREAD, (oop)method_result.get_jobject());
+  if (object->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) {
+    cp = CompilerToVM::asMethod(object)->constMethod()->constants();
+  } else if (object->is_a(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass())) {
+    cp = InstanceKlass::cast(CompilerToVM::asKlass(object))->constants();
+  } else {
+    THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
+                err_msg("Unexpected type: %s", object->klass()->external_name()));
   }
-  return NULL;
+  assert(!cp.is_null(), "npe");
+  JavaValue method_result(T_OBJECT);
+  JavaCallArguments args;
+  args.push_long((jlong) (address) cp());
+  JavaCalls::call_static(&method_result, SystemDictionary::HotSpotConstantPool_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::constantPool_fromMetaspace_signature(), &args, CHECK_NULL);
+  return JNIHandles::make_local(THREAD, (oop)method_result.get_jobject());
 }
 
 C2V_VMENTRY(jobject, getResolvedJavaType, (JNIEnv *, jobject, jobject base, jlong offset, jboolean compressed))
@@ -1522,7 +1517,7 @@
   {CC "getMaxCallTargetOffset",                       CC "(J)J",                                                                            FN_PTR(getMaxCallTargetOffset)},
   {CC "getResolvedJavaMethodAtSlot",                  CC "(" CLASS "I)" HS_RESOLVED_METHOD,                                                 FN_PTR(getResolvedJavaMethodAtSlot)},
   {CC "getResolvedJavaMethod",                        CC "(Ljava/lang/Object;J)" HS_RESOLVED_METHOD,                                        FN_PTR(getResolvedJavaMethod)},
-  {CC "getConstantPool",                              CC "(Ljava/lang/Object;J)" HS_CONSTANT_POOL,                                          FN_PTR(getConstantPool)},
+  {CC "getConstantPool",                              CC "(Ljava/lang/Object;)" HS_CONSTANT_POOL,                                           FN_PTR(getConstantPool)},
   {CC "getResolvedJavaType",                          CC "(Ljava/lang/Object;JZ)" HS_RESOLVED_KLASS,                                        FN_PTR(getResolvedJavaType)},
   {CC "readConfiguration",                            CC "()[" OBJECT,                                                                      FN_PTR(readConfiguration)},
   {CC "installCode",                                  CC "(" TARGET_DESCRIPTION HS_COMPILED_CODE INSTALLED_CODE HS_SPECULATION_LOG ")I",    FN_PTR(installCode)},
--- a/hotspot/src/share/vm/logging/logTagSet.hpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/logging/logTagSet.hpp	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 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
--- a/hotspot/src/share/vm/oops/methodCounters.hpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/oops/methodCounters.hpp	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
--- a/hotspot/src/share/vm/opto/arraycopynode.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/opto/arraycopynode.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -630,6 +630,12 @@
 }
 
 bool ArrayCopyNode::may_modify_helper(const TypeOopPtr *t_oop, Node* n, PhaseTransform *phase, ArrayCopyNode*& ac) {
+  if (n->Opcode() == Op_StoreCM ||
+      n->Opcode() == Op_StoreB) {
+    // Ignore card mark stores
+    n = n->in(MemNode::Memory);
+  }
+
   if (n->is_Proj()) {
     n = n->in(0);
     if (n->is_Call() && n->as_Call()->may_modify(t_oop, phase)) {
@@ -657,9 +663,6 @@
           }
         }
       }
-    } else if (n->Opcode() == Op_StoreCM) {
-      // Ignore card mark stores
-      return may_modify_helper(t_oop, n->in(MemNode::Memory), phase, ac);
     }
   }
 
--- a/hotspot/src/share/vm/opto/cfgnode.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/opto/cfgnode.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -1703,29 +1703,51 @@
     }
 
     if (uncasted) {
-      // Add a cast node between the phi to be removed and its unique input.
+      // Add cast nodes between the phi to be removed and its unique input.
       // Wait until after parsing for the type information to propagate from the casts.
       assert(can_reshape, "Invalid during parsing");
       const Type* phi_type = bottom_type();
       assert(phi_type->isa_int() || phi_type->isa_ptr(), "bad phi type");
-      int opcode;
-      // Determine the type of cast to be added.
+      // Add casts to carry the control dependency of the Phi that is
+      // going away
+      Node* cast = NULL;
       if (phi_type->isa_int()) {
-        opcode = Op_CastII;
+        cast = ConstraintCastNode::make_cast(Op_CastII, r, uin, phi_type, true);
       } else {
         const Type* uin_type = phase->type(uin);
-        if ((phi_type->join(TypePtr::NOTNULL) == uin_type->join(TypePtr::NOTNULL)) ||
-            (!phi_type->isa_oopptr() && !uin_type->isa_oopptr())) {
-          opcode = Op_CastPP;
+        if (!phi_type->isa_oopptr() && !uin_type->isa_oopptr()) {
+          cast = ConstraintCastNode::make_cast(Op_CastPP, r, uin, phi_type, true);
         } else {
-          opcode = Op_CheckCastPP;
+          // Use a CastPP for a cast to not null and a CheckCastPP for
+          // a cast to a new klass (and both if both null-ness and
+          // klass change).
+
+          // If the type of phi is not null but the type of uin may be
+          // null, uin's type must be casted to not null
+          if (phi_type->join(TypePtr::NOTNULL) == phi_type->remove_speculative() &&
+              uin_type->join(TypePtr::NOTNULL) != uin_type->remove_speculative()) {
+            cast = ConstraintCastNode::make_cast(Op_CastPP, r, uin, TypePtr::NOTNULL, true);
+          }
+
+          // If the type of phi and uin, both casted to not null,
+          // differ the klass of uin must be (check)cast'ed to match
+          // that of phi
+          if (phi_type->join_speculative(TypePtr::NOTNULL) != uin_type->join_speculative(TypePtr::NOTNULL)) {
+            Node* n = uin;
+            if (cast != NULL) {
+              cast = phase->transform(cast);
+              n = cast;
+            }
+            cast = ConstraintCastNode::make_cast(Op_CheckCastPP, r, n, phi_type, true);
+          }
+          if (cast == NULL) {
+            cast = ConstraintCastNode::make_cast(Op_CastPP, r, uin, phi_type, true);
+          }
         }
       }
-      // Add a cast to carry the control dependency of the Phi that is
-      // going away
-      Node* cast = ConstraintCastNode::make_cast(opcode, r, uin, phi_type, true);
+      assert(cast != NULL, "cast should be set");
       cast = phase->transform(cast);
-      // set all inputs to the new cast so the Phi is removed by Identity
+      // set all inputs to the new cast(s) so the Phi is removed by Identity
       PhaseIterGVN* igvn = phase->is_IterGVN();
       for (uint i = 1; i < req(); i++) {
         set_req_X(i, cast, igvn);
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -861,6 +861,13 @@
   }
 
   const Klass* host_klass = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(host_class));
+
+  // Make sure it's the real host class, not another anonymous class.
+  while (host_klass != NULL && host_klass->is_instance_klass() &&
+         InstanceKlass::cast(host_klass)->is_anonymous()) {
+    host_klass = InstanceKlass::cast(host_klass)->host_klass();
+  }
+
   // Primitive types have NULL Klass* fields in their java.lang.Class instances.
   if (host_klass == NULL) {
     THROW_0(vmSymbols::java_lang_IllegalArgumentException());
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -679,7 +679,7 @@
 WB_END
 
 WB_ENTRY(jboolean, WB_IsIntrinsicAvailable(JNIEnv* env, jobject o, jobject method, jobject compilation_context, jint compLevel))
-  if (compLevel < CompLevel_none || compLevel > CompLevel_highest_tier) {
+  if (compLevel < CompLevel_none || compLevel > MIN2((CompLevel) TieredStopAtLevel, CompLevel_highest_tier)) {
     return false; // Intrinsic is not available on a non-existent compilation level.
   }
   jmethodID method_id, compilation_context_id;
@@ -689,6 +689,7 @@
 
   DirectiveSet* directive;
   AbstractCompiler* comp = CompileBroker::compiler((int)compLevel);
+  assert(comp != NULL, "compiler not available");
   if (compilation_context != NULL) {
     compilation_context_id = reflected_method_to_jmid(thread, env, compilation_context);
     CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
@@ -698,7 +699,7 @@
     // Calling with NULL matches default directive
     directive = DirectivesStack::getDefaultDirective(comp);
   }
-  bool result = CompileBroker::compiler(compLevel)->is_intrinsic_available(mh, directive);
+  bool result = comp->is_intrinsic_available(mh, directive);
   DirectivesStack::release(directive);
   return result;
 WB_END
--- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -55,7 +55,8 @@
     // Simple log n seems to grow too slowly for tiered, try something faster: log n * log log n
     int log_cpu = log2_intptr(os::active_processor_count());
     int loglog_cpu = log2_intptr(MAX2(log_cpu, 1));
-    count = MAX2(log_cpu * loglog_cpu, 1) * 3 / 2;
+    count = MAX2(log_cpu * loglog_cpu * 3 / 2, 2);
+    FLAG_SET_ERGO(intx, CICompilerCount, count);
   }
 #else
   // On 32-bit systems, the number of compiler threads is limited to 3.
@@ -67,12 +68,18 @@
   /// available to the VM and thus cause the VM to crash.
   if (FLAG_IS_DEFAULT(CICompilerCount)) {
     count = 3;
+    FLAG_SET_ERGO(intx, CICompilerCount, count);
   }
 #endif
 
-  set_c1_count(MAX2(count / 3, 1));
-  set_c2_count(MAX2(count - c1_count(), 1));
-  FLAG_SET_ERGO(intx, CICompilerCount, c1_count() + c2_count());
+  if (TieredStopAtLevel < CompLevel_full_optimization) {
+    // No C2 compiler thread required
+    set_c1_count(count);
+  } else {
+    set_c1_count(MAX2(count / 3, 1));
+    set_c2_count(MAX2(count - c1_count(), 1));
+  }
+  assert(count == c1_count() + c2_count(), "inconsistent compiler thread count");
 
   // Some inlining tuning
 #ifdef X86
--- a/hotspot/src/share/vm/runtime/frame.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/runtime/frame.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -225,6 +225,19 @@
   return NULL;
 }
 
+bool frame::is_entry_frame_valid(JavaThread* thread) const {
+  // Validate the JavaCallWrapper an entry frame must have
+  address jcw = (address)entry_frame_call_wrapper();
+  bool jcw_safe = (jcw < thread->stack_base()) && (jcw > (address)fp()); // less than stack base
+  if (!jcw_safe) {
+    return false;
+  }
+
+  // Validate sp saved in the java frame anchor
+  JavaFrameAnchor* jfa = entry_frame_call_wrapper()->anchor();
+  return (jfa->last_Java_sp() > sp());
+}
+
 bool frame::should_be_deoptimized() const {
   if (_deopt_state == is_deoptimized ||
       !is_compiled_frame() ) return false;
--- a/hotspot/src/share/vm/runtime/frame.hpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/runtime/frame.hpp	Wed Jul 05 22:06:46 2017 +0200
@@ -166,6 +166,8 @@
   frame sender_for_interpreter_frame(RegisterMap* map) const;
   frame sender_for_native_frame(RegisterMap* map) const;
 
+  bool is_entry_frame_valid(JavaThread* thread) const;
+
   // All frames:
 
   // A low-level interface for vframes:
--- a/hotspot/src/share/vm/runtime/globals.hpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed Jul 05 22:06:46 2017 +0200
@@ -2411,7 +2411,7 @@
   product(intx, CICompilerCount, CI_COMPILER_COUNT,                         \
           "Number of compiler threads to run")                              \
           range(0, max_jint)                                                \
-          constraint(CICompilerCountConstraintFunc, AtParse)                \
+          constraint(CICompilerCountConstraintFunc, AfterErgo)              \
                                                                             \
   product(intx, CompilationPolicyChoice, 0,                                 \
           "which compilation policy (0-3)")                                 \
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -660,11 +660,13 @@
   }
 
   const Klass* host_class = current_class;
-  while (host_class->is_instance_klass() &&
-         InstanceKlass::cast(host_class)->is_anonymous()) {
-    const Klass* next_host_class = InstanceKlass::cast(host_class)->host_klass();
-    if (next_host_class == NULL)  break;
-    host_class = next_host_class;
+  if (host_class->is_instance_klass() &&
+      InstanceKlass::cast(host_class)->is_anonymous()) {
+    host_class = InstanceKlass::cast(host_class)->host_klass();
+    assert(host_class != NULL, "Anonymous class has null host class");
+    assert(!(host_class->is_instance_klass() &&
+           InstanceKlass::cast(host_class)->is_anonymous()),
+           "host_class should not be anonymous");
   }
   if (host_class == field_class) {
     return true;
--- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -147,12 +147,18 @@
   // performed on 32-bit systems because it can lead to exhaustion
   // of the virtual memory address space available to the JVM.
   if (CICompilerCountPerCPU) {
-    count = MAX2(log2_intptr(os::active_processor_count()), 1) * 3 / 2;
+    count = MAX2(log2_intptr(os::active_processor_count()) * 3 / 2, 2);
+    FLAG_SET_ERGO(intx, CICompilerCount, count);
   }
 #endif
-  set_c1_count(MAX2(count / 3, 1));
-  set_c2_count(MAX2(count - c1_count(), 1));
-  FLAG_SET_ERGO(intx, CICompilerCount, c1_count() + c2_count());
+  if (TieredStopAtLevel < CompLevel_full_optimization) {
+    // No C2 compiler thread required
+    set_c1_count(count);
+  } else {
+    set_c1_count(MAX2(count / 3, 1));
+    set_c2_count(MAX2(count - c1_count(), 1));
+  }
+  assert(count == c1_count() + c2_count(), "inconsistent compiler thread count");
 }
 
 void SimpleThresholdPolicy::set_carry_if_necessary(InvocationCounter *counter) {
--- a/hotspot/src/share/vm/runtime/thread.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -374,11 +374,14 @@
   delete handle_area();
   delete metadata_handles();
 
+  // SR_handler uses this as a termination indicator -
+  // needs to happen before os::free_thread()
+  delete _SR_lock;
+  _SR_lock = NULL;
+
   // osthread() can be NULL, if creation of thread failed.
   if (osthread() != NULL) os::free_thread(osthread());
 
-  delete _SR_lock;
-
   // clear Thread::current if thread is deleting itself.
   // Needed to ensure JNI correctly detects non-attached threads.
   if (this == Thread::current()) {
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -2643,7 +2643,7 @@
   /* DEFAULT_CACHE_LINE_SIZE (globalDefinitions.hpp) */                   \
   /***************************************************/                   \
                                                                           \
-  declare_constant(DEFAULT_CACHE_LINE_SIZE)                               \
+  declare_preprocessor_constant("DEFAULT_CACHE_LINE_SIZE", DEFAULT_CACHE_LINE_SIZE) \
                                                                           \
   declare_constant(Deoptimization::Unpack_deopt)                          \
   declare_constant(Deoptimization::Unpack_exception)                      \
--- a/hotspot/src/share/vm/utilities/nativeCallStack.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/src/share/vm/utilities/nativeCallStack.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,6 +33,19 @@
   _hash_value(0) {
 
   if (fillStack) {
+    // We need to skip the NativeCallStack::NativeCallStack frame if a tail call is NOT used
+    // to call os::get_native_stack. A tail call is used if _NMT_NOINLINE_ is not defined
+    // (which means this is not a slowdebug build), and we are on 64-bit (except Windows).
+    // This is not necessarily a rule, but what has been obvserved to date.
+#define TAIL_CALL (!defined(_NMT_NOINLINE_) && !defined(WINDOWS) && defined(_LP64))
+#if !TAIL_CALL
+    toSkip++;
+#if (defined(_NMT_NOINLINE_) && defined(BSD) && defined(_LP64))
+    // Mac OS X slowdebug builds have this odd behavior where NativeCallStack::NativeCallStack
+    // appears as two frames, so we need to skip an extra frame.
+    toSkip++;
+#endif
+#endif
     os::get_native_stack(_stack, NMT_TrackingStackDepth, toSkip);
   } else {
     for (int index = 0; index < NMT_TrackingStackDepth; index ++) {
--- a/hotspot/test/Makefile	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/Makefile	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 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
@@ -226,6 +226,9 @@
 ( \
   jtregExitCode=$$? && \
   _summary="$(SUMMARY_TXT)"; \
+  if [ $${jtregExitCode} = 1 ] ; then \
+    jtregExitCode=0; \
+  fi; \
   $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
   $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
   if [ -r "$${_summary}" ] ; then \
--- a/hotspot/test/TEST.groups	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/TEST.groups	Wed Jul 05 22:06:46 2017 +0200
@@ -167,7 +167,7 @@
   gc/survivorAlignment \
   runtime/InternalApi/ThreadCpuTimesDeadlock.java \
   runtime/NMT/JcmdSummaryDiff.java \
-  runtime/RedefineTests/RedefineAnnotations.java
+  runtime/RedefineTests/RedefineAnnotations.java \
   serviceability/sa/jmap-hashcode/Test8028623.java \
   serviceability/threads/TestFalseDeadLock.java \
   compiler/codecache/jmx \
@@ -282,7 +282,7 @@
   -compiler/c2/Test6905845.java \
   -compiler/c2/cr6340864 \
   -compiler/c2/cr6589834 \
-  -compiler/c2/cr8004867
+  -compiler/c2/cr8004867 \
   -compiler/c2/stemmer \
   -compiler/c2/Test6792161.java \
   -compiler/c2/Test6603011.java \
--- a/hotspot/test/compiler/arguments/CheckCICompilerCount.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/arguments/CheckCICompilerCount.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,8 +23,7 @@
 
 /*
  * @test CheckCheckCICompilerCount
- * @bug 8130858
- * @bug 8132525
+ * @bug 8130858 8132525 8162881
  * @summary Check that correct range of values for CICompilerCount are allowed depending on whether tiered is enabled or not
  * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
@@ -54,6 +53,13 @@
             "-version"
         },
         {
+            "-server",
+            "-XX:+PrintFlagsFinal",
+            "-XX:CICompilerCount=1",
+            "-XX:-TieredCompilation",
+            "-version"
+        },
+        {
             "-client",
             "-XX:-TieredCompilation",
             "-XX:+PrintFlagsFinal",
@@ -66,30 +72,31 @@
             "-XX:+PrintFlagsFinal",
             "-XX:CICompilerCount=1",
             "-version"
+        },
+        {
+            "-client",
+            "-XX:+PrintFlagsFinal",
+            "-XX:CICompilerCount=1",
+            "-XX:-TieredCompilation",
+            "-version"
         }
     };
 
-    private static final String[][] NON_TIERED_EXPECTED_OUTPUTS = {
-        {
+    private static final String[] NON_TIERED_EXPECTED_OUTPUTS = {
             "CICompilerCount (0) must be at least 1",
-            "Improperly specified VM option 'CICompilerCount=0'"
-        },
-        {
+            "intx CICompilerCount                          = 1                                        {product} {command line}",
+            "intx CICompilerCount                          = 1                                        {product} {command line}",
+            "CICompilerCount (0) must be at least 1",
+            "intx CICompilerCount                          = 1                                        {product} {command line}",
             "intx CICompilerCount                          = 1                                        {product} {command line}"
-        },
-        {
-            "CICompilerCount (0) must be at least 1",
-            "Improperly specified VM option 'CICompilerCount=0'"
-        },
-        {
-            "intx CICompilerCount                          = 1                                        {product} {command line}"
-        }
     };
 
     private static final int[] NON_TIERED_EXIT = {
         1,
         0,
+        0,
         1,
+        0,
         0
     };
 
@@ -104,6 +111,22 @@
         {
             "-server",
             "-XX:+TieredCompilation",
+            "-XX:TieredStopAtLevel=1",
+            "-XX:+PrintFlagsFinal",
+            "-XX:CICompilerCount=1",
+            "-version"
+        },
+        {
+            "-server",
+            "-XX:+TieredCompilation",
+            "-XX:+PrintFlagsFinal",
+            "-XX:CICompilerCount=1",
+            "-XX:TieredStopAtLevel=1",
+            "-version"
+        },
+        {
+            "-server",
+            "-XX:+TieredCompilation",
             "-XX:+PrintFlagsFinal",
             "-XX:CICompilerCount=2",
             "-version"
@@ -118,37 +141,51 @@
         {
             "-client",
             "-XX:+TieredCompilation",
+            "-XX:TieredStopAtLevel=1",
+            "-XX:+PrintFlagsFinal",
+            "-XX:CICompilerCount=1",
+            "-version"
+        },
+        {
+            "-client",
+            "-XX:+TieredCompilation",
+            "-XX:+PrintFlagsFinal",
+            "-XX:CICompilerCount=1",
+            "-XX:TieredStopAtLevel=1",
+            "-version"
+        },
+        {
+            "-client",
+            "-XX:+TieredCompilation",
             "-XX:+PrintFlagsFinal",
             "-XX:CICompilerCount=2",
             "-version"
         }
     };
 
-    private static final String[][] TIERED_EXPECTED_OUTPUTS = {
-        {
+    private static final String[] TIERED_EXPECTED_OUTPUTS = {
             "CICompilerCount (1) must be at least 2",
-            "Improperly specified VM option 'CICompilerCount=1'"
-        },
-        {
-            "intx CICompilerCount                          = 2                                        {product} {command line, ergonomic}"
-        },
-        {
+            "intx CICompilerCount                          = 1                                        {product} {command line}",
+            "intx CICompilerCount                          = 1                                        {product} {command line}",
+            "intx CICompilerCount                          = 2                                        {product} {command line}",
             "CICompilerCount (1) must be at least 2",
-            "Improperly specified VM option 'CICompilerCount=1'"
-        },
-        {
-            "intx CICompilerCount                          = 2                                        {product} {command line, ergonomic}"
-        }
+            "intx CICompilerCount                          = 1                                        {product} {command line}",
+            "intx CICompilerCount                          = 1                                        {product} {command line}",
+            "intx CICompilerCount                          = 2                                        {product} {command line}",
     };
 
     private static final int[] TIERED_EXIT = {
         1,
         0,
+        0,
+        0,
         1,
+        0,
+        0,
         0
     };
 
-    private static void verifyValidOption(String[] arguments, String[] expected_outputs, int exit, boolean tiered) throws Exception {
+    private static void verifyValidOption(String[] arguments, String expected_output, int exit, boolean tiered) throws Exception {
         ProcessBuilder pb;
         OutputAnalyzer out;
 
@@ -157,9 +194,7 @@
 
         try {
             out.shouldHaveExitValue(exit);
-            for (String expected_output : expected_outputs) {
-                out.shouldContain(expected_output);
-            }
+            out.shouldContain(expected_output);
         } catch (RuntimeException e) {
             // Check if tiered compilation is available in this JVM
             // Version. Throw exception only if it is available.
--- a/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java	Wed Jul 05 22:06:46 2017 +0200
@@ -25,7 +25,6 @@
  * @test
  * @bug 8130847 8156760
  * @summary Eliminated instance/array written to by an array copy variant must be correctly initialized when reallocated at a deopt
- * @ignore 8136818
  * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
  *                   compiler.arraycopy.TestEliminatedArrayCopyDeopt
  * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
--- a/hotspot/test/compiler/c2/Test6792161.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/c2/Test6792161.java	Wed Jul 05 22:06:46 2017 +0200
@@ -27,7 +27,7 @@
  * @bug 6792161
  * @summary assert("No dead instructions after post-alloc")
  *
- * @run main/othervm/timeout=600 -Xcomp -XX:MaxInlineSize=120 compiler.c2.Test6792161
+ * @run main/othervm/timeout=600 -Xcomp -XX:-TieredCompilation -XX:MaxInlineSize=120 compiler.c2.Test6792161
  */
 
 package compiler.c2;
--- a/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -36,6 +36,11 @@
  *     -XX:CompileCommand=compileonly,null::* -XX:-UseLargePages
  *     -XX:+SegmentedCodeCache
  *     compiler.codecache.jmx.InitialAndMaxUsageTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing
+ *     -XX:-MethodFlushing -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *     -XX:CompileCommand=compileonly,null::* -XX:-UseLargePages
+ *     -XX:-SegmentedCodeCache
+ *     compiler.codecache.jmx.InitialAndMaxUsageTest
  */
 
 package compiler.codecache.jmx;
@@ -70,10 +75,16 @@
         }
     }
 
-    private void fillWithSize(long size, List<Long> blobs) {
+    private void fillWithSize(long size, List<Long> blobs, MemoryPoolMXBean bean) {
         long blob;
-        while ((blob = CodeCacheUtils.WB.allocateCodeBlob(size, btype.id))
-                != 0L) {
+        /* Don't fill too much to have space for adapters. So, stop after crossing 95% and
+           don't allocate in case we'll cross 97% on next allocation. We can hit situation
+           like 94% -> (1 allocation) -> 100% otherwise. So, check if
+           <Usage + allocatedSize> is less than 97%, then allocate in case it is, then, stop
+           further allocations with given size in case <Usage> more than 95% */
+        while (((double) bean.getUsage().getUsed() + size <= (CACHE_USAGE_COEF + 0.02d)  * maxSize)
+                && (blob = CodeCacheUtils.WB.allocateCodeBlob(size, btype.id)) != 0L
+                && ((double) bean.getUsage().getUsed() <= CACHE_USAGE_COEF * maxSize)) {
             blobs.add(blob);
         }
     }
@@ -90,13 +101,13 @@
             Asserts.assertEQ(initialUsage, 0L, "Unexpected initial usage");
         }
         ArrayList<Long> blobs = new ArrayList<>();
-        long minAllocationUnit = Math.max(0, CodeCacheUtils.MIN_ALLOCATION - headerSize);
+        long minAllocationUnit = Math.max(1, CodeCacheUtils.MIN_ALLOCATION - headerSize);
         /* now filling code cache with large-sized allocation first, since
          lots of small allocations takes too much time, so, just a small
          optimization */
         try {
             for (int coef = 1000000; coef > 0; coef /= 10) {
-                fillWithSize(coef * minAllocationUnit, blobs);
+                fillWithSize(coef * minAllocationUnit, blobs, bean);
             }
             Asserts.assertGT((double) bean.getUsage().getUsed(),
                     CACHE_USAGE_COEF * maxSize, String.format("Unable to fill "
--- a/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -31,11 +31,11 @@
  * @build compiler.codecache.jmx.ThresholdNotificationsTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing
  *     -XX:+WhiteBoxAPI -XX:-MethodFlushing -XX:CompileCommand=compileonly,null::*
  *     -XX:+SegmentedCodeCache
  *     compiler.codecache.jmx.ThresholdNotificationsTest
- * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing
  *     -XX:+WhiteBoxAPI -XX:-MethodFlushing -XX:CompileCommand=compileonly,null::*
  *     -XX:-SegmentedCodeCache
  *     compiler.codecache.jmx.ThresholdNotificationsTest
@@ -63,7 +63,9 @@
 
     public static void main(String[] args) {
         for (BlobType bt : BlobType.getAvailable()) {
-            new ThresholdNotificationsTest(bt).runTest();
+            if (CodeCacheUtils.isCodeHeapPredictable(bt)) {
+                new ThresholdNotificationsTest(bt).runTest();
+            }
         }
     }
 
--- a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -63,7 +63,9 @@
     public static void main(String[] args) {
         int iterationsCount = Integer.getInteger("jdk.test.lib.iterations", 1);
         for (BlobType btype : BlobType.getAvailable()) {
-            new UsageThresholdExceededTest(btype, iterationsCount).runTest();
+            if (CodeCacheUtils.isCodeHeapPredictable(btype)) {
+                new UsageThresholdExceededTest(btype, iterationsCount).runTest();
+            }
         }
     }
 
--- a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -29,9 +29,9 @@
  * @modules java.base/jdk.internal.misc
  *          java.management
  *
+ * @build compiler.codecache.jmx.UsageThresholdIncreasedTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @build compiler.codecache.jmx.UsageThresholdIncreasedTest
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *     -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing  -XX:-MethodFlushing
  *     -XX:CompileCommand=compileonly,null::*
--- a/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -24,6 +24,7 @@
 
 /*
  * @test RandomAllocationTest
+ * @key stress
  * @summary stressing code cache by allocating randomly sized "dummy" code blobs
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -24,6 +24,7 @@
 
 /*
  * @test UnexpectedDeoptimizationTest
+ * @key stress
  * @summary stressing code cache by forcing unexpected deoptimizations
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/codegen/aes/TestAESMain.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/codegen/aes/TestAESMain.java	Wed Jul 05 22:06:46 2017 +0200
@@ -25,6 +25,7 @@
 /**
  * @test
  * @bug 7184394
+ * @key stress
  * @summary add intrinsics to use AES instructions
  * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/floatingpoint/ModNaN.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/floatingpoint/ModNaN.java	Wed Jul 05 22:06:46 2017 +0200
@@ -26,7 +26,6 @@
  * @bug 8015396
  * @summary double a%b returns NaN for some (a,b) (|a| < inf, |b|>0) (on Core i7 980X)
  *
- * @ignore 8145543
  * @run main compiler.floatingpoint.ModNaN
  */
 
--- a/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -114,7 +114,7 @@
 
     public void test() throws Exception {
         Executable intrinsicMethod = testCase.getExecutable();
-        if (Platform.isServer()) {
+        if (Platform.isServer() && (TIERED_STOP_AT_LEVEL == COMP_LEVEL_FULL_OPTIMIZATION)) {
             if (TIERED_COMPILATION) {
                 checkIntrinsicForCompilationLevel(intrinsicMethod, COMP_LEVEL_SIMPLE);
             }
--- a/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -59,9 +59,9 @@
     private static final int COMP_LEVEL_FULL_OPTIMIZATION = 4;
 
     /* Determine if tiered compilation is enabled. */
-    private static boolean isTieredCompilationEnabled() {
-        return Boolean.valueOf(Objects.toString(wb.getVMFlag("TieredCompilation")));
-    }
+    private static final boolean TIERED_COMPILATION = wb.getBooleanVMFlag("TieredCompilation");
+
+    private static final int TIERED_STOP_AT_LEVEL = wb.getIntxVMFlag("TieredStopAtLevel").intValue();
 
     /* This test uses several methods from jdk.internal.misc.Unsafe. The method
      * getMethod() returns a different Executable for each different
@@ -202,8 +202,8 @@
     }
 
     public static void main(String args[]) {
-        if (Platform.isServer()) {
-            if (isTieredCompilationEnabled()) {
+        if (Platform.isServer() && (TIERED_STOP_AT_LEVEL == COMP_LEVEL_FULL_OPTIMIZATION)) {
+            if (TIERED_COMPILATION) {
                 test(COMP_LEVEL_SIMPLE);
             }
             test(COMP_LEVEL_FULL_OPTIMIZATION);
--- a/hotspot/test/compiler/jvmci/common/patches/jdk.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/jvmci/common/patches/jdk.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java	Wed Jul 05 22:06:46 2017 +0200
@@ -273,8 +273,8 @@
         return CTVM.getResolvedJavaMethod(base, displacement);
     }
 
-    public static HotSpotConstantPool getConstantPool(Object base, long displacement) {
-        return CTVM.getConstantPool(base, displacement);
+    public static HotSpotConstantPool getConstantPool(Object object) {
+        return CTVM.getConstantPool(object);
     }
 
     public static HotSpotResolvedObjectType getResolvedJavaType(Object base,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jvmci/common/testcases/DuplicateSimpleSingleImplementerInterface.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package compiler.jvmci.common.testcases;
+
+public interface DuplicateSimpleSingleImplementerInterface {
+    void interfaceMethod();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jvmci/common/testcases/MultipleSuperImplementers.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+package compiler.jvmci.common.testcases;
+
+public abstract class MultipleSuperImplementers implements DuplicateSimpleSingleImplementerInterface, SimpleSingleImplementerInterface {
+    public void finalize() {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jvmci/common/testcases/SimpleSingleImplementerInterface.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package compiler.jvmci.common.testcases;
+
+public interface SimpleSingleImplementerInterface {
+    void interfaceMethod();
+}
--- a/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -32,6 +32,8 @@
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
+ *          jdk.vm.ci/jdk.vm.ci.meta
+ *          jdk.vm.ci/jdk.vm.ci.runtime
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.FindUniqueConcreteMethodTest
  * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
@@ -41,7 +43,10 @@
 package compiler.jvmci.compilerToVM;
 
 import compiler.jvmci.common.CTVMUtilities;
+import compiler.jvmci.common.testcases.DuplicateSimpleSingleImplementerInterface;
+import compiler.jvmci.common.testcases.SimpleSingleImplementerInterface;
 import compiler.jvmci.common.testcases.MultipleImplementer1;
+import compiler.jvmci.common.testcases.MultipleSuperImplementers;
 import compiler.jvmci.common.testcases.SingleImplementer;
 import compiler.jvmci.common.testcases.SingleImplementerInterface;
 import compiler.jvmci.common.testcases.SingleSubclass;
@@ -96,6 +101,11 @@
         // static method
         result.add(new TestCase(false, SingleSubclass.class,
                 SingleSubclass.class, "staticMethod"));
+        // interface method
+        result.add(new TestCase(false, MultipleSuperImplementers.class,
+                                DuplicateSimpleSingleImplementerInterface.class, "interfaceMethod", false));
+        result.add(new TestCase(false, MultipleSuperImplementers.class,
+                                SimpleSingleImplementerInterface.class, "interfaceMethod", false));
         return result;
     }
 
@@ -103,7 +113,7 @@
         System.out.println(tcase);
         Method method = tcase.holder.getDeclaredMethod(tcase.methodName);
         HotSpotResolvedJavaMethod testMethod = CTVMUtilities
-                .getResolvedMethod(tcase.receiver, method);
+            .getResolvedMethod(tcase.methodFromReceiver ? tcase.receiver : tcase.holder, method);
         HotSpotResolvedObjectType resolvedType = CompilerToVMHelper
                 .lookupType(Utils.toJVMTypeSignature(tcase.receiver), getClass(),
                 /* resolve = */ true);
@@ -118,20 +128,25 @@
         public final Class<?> holder;
         public final String methodName;
         public final boolean isPositive;
+        public final boolean methodFromReceiver;
 
         public TestCase(boolean isPositive, Class<?> clazz, Class<?> holder,
-                String methodName) {
+                        String methodName, boolean methodFromReceiver) {
             this.receiver = clazz;
             this.methodName = methodName;
             this.isPositive = isPositive;
             this.holder = holder;
+            this.methodFromReceiver = methodFromReceiver;
+        }
+
+        public TestCase(boolean isPositive, Class<?> clazz, Class<?> holder, String methodName) {
+            this(isPositive, clazz, holder, methodName, true);
         }
 
         @Override
         public String toString() {
-            return String.format("CASE: receiver=%s, holder=%s, method=%s,"
-                    + " isPositive=%s", receiver.getName(),
-                    holder.getName(), methodName, isPositive);
+            return String.format("CASE: receiver=%s, holder=%s, method=%s, isPositive=%s, methodFromReceiver=%s",
+                                 receiver.getName(), holder.getName(), methodName, isPositive, methodFromReceiver);
         }
     }
 }
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -29,187 +29,76 @@
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
- * @modules jdk.vm.ci/jdk.vm.ci.hotspot
+ * @modules 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.meta
+ *          jdk.vm.ci/jdk.vm.ci.code
  *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
- * @build jdk.vm.ci/jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject
  * @build compiler.jvmci.compilerToVM.GetConstantPoolTest
- * @build sun.hotspot.WhiteBox
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *                   -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   compiler.jvmci.compilerToVM.GetConstantPoolTest
  */
 package compiler.jvmci.compilerToVM;
 
-import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Utils;
+import compiler.jvmci.common.CTVMUtilities;
+import compiler.jvmci.common.testcases.TestCase;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
 import jdk.vm.ci.meta.ConstantPool;
-import sun.hotspot.WhiteBox;
 
 import java.lang.reflect.Field;
+import java.lang.reflect.Executable;
 
 /**
  * Tests for jdk.vm.ci.hotspot.CompilerToVM::getConstantPool method
  */
 public class GetConstantPoolTest {
-    private static enum TestCase {
-        NULL_BASE {
-            @Override
-            ConstantPool getConstantPool() {
-                return CompilerToVMHelper.getConstantPool(null,
-                        getPtrToCpAddress());
-            }
-        },
-        JAVA_METHOD_BASE {
-            @Override
-            ConstantPool getConstantPool() {
-                HotSpotResolvedJavaMethod methodInstance
-                        = CompilerToVMHelper.getResolvedJavaMethodAtSlot(
-                                TEST_CLASS, 0);
-                Field field;
-                try {
-                    // jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl.metaspaceMethod
-                    field = methodInstance.getClass()
-                            .getDeclaredField("metaspaceMethod");
-                    field.setAccessible(true);
-                    field.set(methodInstance, getPtrToCpAddress());
-                } catch (ReflectiveOperationException e) {
-                    throw new Error("TESTBUG : " + e, e);
-                }
 
-                return CompilerToVMHelper.getConstantPool(methodInstance, 0L);
-            }
-        },
-        CONSTANT_POOL_BASE {
-            @Override
-            ConstantPool getConstantPool() {
-                ConstantPool cpInst;
-                try {
-                    cpInst = CompilerToVMHelper.getConstantPool(null,
-                            getPtrToCpAddress());
-                    Field field = CompilerToVMHelper.HotSpotConstantPoolClass()
-                            .getDeclaredField("metaspaceConstantPool");
-                    field.setAccessible(true);
-                    field.set(cpInst, getPtrToCpAddress());
-                } catch (ReflectiveOperationException e) {
-                    throw new Error("TESTBUG : " + e.getMessage(), e);
-                }
-                return CompilerToVMHelper.getConstantPool(cpInst, 0L);
-            }
-        },
-        CONSTANT_POOL_BASE_IN_TWO {
-            @Override
-            ConstantPool getConstantPool() {
-                long ptr = getPtrToCpAddress();
-                ConstantPool cpInst;
-                try {
-                    cpInst = CompilerToVMHelper.getConstantPool(null, ptr);
-                    Field field = CompilerToVMHelper.HotSpotConstantPoolClass()
-                            .getDeclaredField("metaspaceConstantPool");
-                    field.setAccessible(true);
-                    field.set(cpInst, ptr / 2L);
-                } catch (ReflectiveOperationException e) {
-                    throw new Error("TESTBUG : " + e.getMessage(), e);
-                }
-                return CompilerToVMHelper.getConstantPool(cpInst,
-                        ptr - ptr / 2L);
-            }
-        },
-        CONSTANT_POOL_BASE_ZERO {
-            @Override
-            ConstantPool getConstantPool() {
-                long ptr = getPtrToCpAddress();
-                ConstantPool cpInst;
-                try {
-                    cpInst = CompilerToVMHelper.getConstantPool(null, ptr);
-                    Field field = CompilerToVMHelper.HotSpotConstantPoolClass()
-                            .getDeclaredField("metaspaceConstantPool");
-                    field.setAccessible(true);
-                    field.set(cpInst, 0L);
-                } catch (ReflectiveOperationException e) {
-                    throw new Error("TESTBUG : " + e.getMessage(), e);
-                }
-                return CompilerToVMHelper.getConstantPool(cpInst, ptr);
-            }
-        },
-        ;
-        abstract ConstantPool getConstantPool();
+    public static void testMethod(Executable executable) {
+        test(CTVMUtilities.getResolvedMethod(executable));
     }
 
-    private static final WhiteBox WB = WhiteBox.getWhiteBox();
-    private static final Unsafe UNSAFE = Utils.getUnsafe();
-
-    private static final Class TEST_CLASS = GetConstantPoolTest.class;
-    private static final long CP_ADDRESS
-            = WB.getConstantPool(GetConstantPoolTest.class);
+    public static void testClass(Class cls) {
+        HotSpotResolvedObjectType type = CompilerToVMHelper
+                .lookupType(Utils.toJVMTypeSignature(cls),
+                        GetConstantPoolTest.class, /* resolve = */ true);
+        test(type);
+    }
 
-    public void test(TestCase testCase) {
-        System.out.println(testCase.name());
-        ConstantPool cp = testCase.getConstantPool();
-        String cpStringRep = cp.toString();
-        String cpClassSimpleName
-                = CompilerToVMHelper.HotSpotConstantPoolClass().getSimpleName();
-        if (!cpStringRep.contains(cpClassSimpleName)
-                || !cpStringRep.contains(TEST_CLASS.getName())) {
-            String msg = String.format("%s : "
-                    + " Constant pool is not valid."
-                    + " String representation should contain \"%s\" and \"%s\"",
-                    testCase.name(), cpClassSimpleName,
-                    TEST_CLASS.getName());
-            throw new AssertionError(msg);
-        }
+    private static void test(Object object) {
+        ConstantPool cp = CompilerToVMHelper.getConstantPool(object);
+        System.out.println(object + " -> " + cp);
     }
 
     public static void main(String[] args) {
-        GetConstantPoolTest test = new GetConstantPoolTest();
-        for (TestCase testCase : TestCase.values()) {
-            test.test(testCase);
-        }
-        testObjectBase();
-        testMetaspaceWrapperBase();
+        TestCase.getAllClasses().forEach(GetConstantPoolTest::testClass);
+        TestCase.getAllExecutables().forEach(GetConstantPoolTest::testMethod);
+        testNull();
+        testObject();
     }
 
-    private static void testObjectBase() {
+    private static void testNull() {
         try {
-            Object cp = CompilerToVMHelper.getConstantPool(new Object(), 0L);
-            throw new AssertionError("Test OBJECT_BASE."
+            Object cp = CompilerToVMHelper.getConstantPool(null);
+            throw new AssertionError("Test OBJECT."
+                + " Expected IllegalArgumentException has not been caught");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+    }
+    private static void testObject() {
+        try {
+            Object cp = CompilerToVMHelper.getConstantPool(new Object());
+            throw new AssertionError("Test OBJECT."
                 + " Expected IllegalArgumentException has not been caught");
         } catch (IllegalArgumentException iae) {
             // expected
         }
     }
-    private static void testMetaspaceWrapperBase() {
-        try {
-            Object cp = CompilerToVMHelper.getConstantPool(
-                    new PublicMetaspaceWrapperObject() {
-                        @Override
-                        public long getMetaspacePointer() {
-                            return getPtrToCpAddress();
-                        }
-                    }, 0L);
-            throw new AssertionError("Test METASPACE_WRAPPER_BASE."
-                + " Expected IllegalArgumentException has not been caught");
-        } catch (IllegalArgumentException iae) {
-            // expected
-        }
-    }
-
-    private static long getPtrToCpAddress() {
-        Field field;
-        try {
-            field = TEST_CLASS.getDeclaredField("CP_ADDRESS");
-        } catch (NoSuchFieldException nsfe) {
-            throw new Error("TESTBUG : cannot find field \"CP_ADDRESS\" : "
-                    + nsfe.getMessage(), nsfe);
-        }
-        Object base = UNSAFE.staticFieldBase(field);
-        return WB.getObjectAddress(base) + UNSAFE.staticFieldOffset(field);
-    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/runtime/cr8015436/Driver8015436.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+package compiler.runtime.cr8015436;
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class Driver8015436 {
+    public static void main(String args[]) {
+        OutputAnalyzer oa;
+        try {
+            oa = ProcessTools.executeProcess(ProcessTools.createJavaProcessBuilder(
+                    /* add test vm options */ true, Test8015436.class.getName()));
+        } catch (Exception ex) {
+            throw new Error("TESTBUG: exception while running child process: " + ex, ex);
+        }
+        oa.shouldHaveExitValue(0);
+        oa.shouldContain(Test8015436.SOME_MTD_INVOKED);
+        oa.shouldContain(Test8015436.DEFAULT_MTD_INVOKED_DIRECTLY);
+        oa.shouldContain(Test8015436.DEFAULT_MTD_INVOKED_MH);
+    }
+}
--- a/hotspot/test/compiler/runtime/cr8015436/Test8015436.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/compiler/runtime/cr8015436/Test8015436.java	Wed Jul 05 22:06:46 2017 +0200
@@ -25,8 +25,12 @@
  * @test
  * @bug 8015436
  * @summary the IK _initial_method_idnum value must be adjusted if overpass methods are added
+ * @library /test/lib/share/classes /
+ * @modules java.base/jdk.internal.misc
+ * @build compiler.runtime.cr8015436.Test8015436
+ *        compiler.runtime.cr8015436.Driver8015436
  *
- * @run main compiler.runtime.cr8015436.Test8015436
+ * @run driver compiler.runtime.cr8015436.Driver8015436
  */
 
 /*
@@ -45,20 +49,24 @@
 import java.lang.invoke.MethodType;
 
 public class Test8015436 implements InterfaceWithDefaultMethod {
+    public static final String SOME_MTD_INVOKED = "someMethod() invoked";
+    public static final String DEFAULT_MTD_INVOKED_DIRECTLY = "defaultMethod() invoked directly";
+    public static final String DEFAULT_MTD_INVOKED_MH = "defaultMethod() invoked via a MethodHandle";
+
     @Override
     public void someMethod() {
-        System.out.println("someMethod() invoked");
+        System.out.println(SOME_MTD_INVOKED);
     }
 
     public static void main(String[] args) throws Throwable {
         Test8015436 testObj = new Test8015436();
         testObj.someMethod();
-        testObj.defaultMethod("invoked directly");
+        testObj.defaultMethod(DEFAULT_MTD_INVOKED_DIRECTLY);
 
         MethodHandles.Lookup lookup = MethodHandles.lookup();
         MethodType   mt = MethodType.methodType(void.class, String.class);
         MethodHandle mh = lookup.findVirtual(Test8015436.class, "defaultMethod", mt);
-        mh.invokeExact(testObj, "invoked via a MethodHandle");
+        mh.invokeExact(testObj, DEFAULT_MTD_INVOKED_MH);
     }
 }
 
@@ -66,7 +74,7 @@
     public void someMethod();
 
     default public void defaultMethod(String str){
-        System.out.println("defaultMethod() " + str);
+        System.out.println(str);
     }
 }
 /*
--- a/hotspot/test/gc/g1/ihop/TestIHOPErgo.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/gc/g1/ihop/TestIHOPErgo.java	Wed Jul 05 22:06:46 2017 +0200
@@ -24,6 +24,7 @@
  /*
  * @test TestIHOPErgo
  * @bug 8148397
+ * @key stress
  * @summary Test checks that behavior of Adaptive and Static IHOP at concurrent cycle initiation
  * @requires vm.gc.G1
  * @requires !vm.flightRecorder
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/NMT/CheckForProperDetailStackTrace.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,114 @@
+/*
+ * 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
+ * @key nmt
+ * @summary Running with NMT detail should produce expected stack traces.
+ * @library /testlibrary
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ */
+
+import jdk.test.lib.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class CheckForProperDetailStackTrace {
+    /* The stack trace we look for by default. Note that :: has been replaced by .*
+       to make sure it maches even if the symbol is not unmangled. */
+    public static String stackTraceDefault =
+        ".*ModuleEntryTable.*new_entry.*\n" +
+        ".*ModuleEntryTable.*locked_create_entry_or_null.*\n" +
+        ".*Modules.*define_module.*\n" +
+        ".*JVM_DefineModule.*\n";
+
+    /* The stack trace we look for on Solaris and Windows slowdebug builds. For some
+       reason ALWAYSINLINE for AllocateHeap is ignored, so it appears in the stack strace. */
+    public static String stackTraceAllocateHeap =
+        ".*AllocateHeap.*\n" +
+        ".*ModuleEntryTable.*new_entry.*\n" +
+        ".*ModuleEntryTable.*locked_create_entry_or_null.*\n" +
+        ".*Modules.*define_module.*\n";
+
+    /* A symbol that should always be present in NMT detail output. */
+    private static String expectedSymbol =
+        "locked_create_entry_or_null";
+
+    private static final String jdkDebug = System.getProperty("jdk.debug");
+    private static boolean isSlowDebugBuild() {
+        return (jdkDebug.toLowerCase().equals("slowdebug"));
+    }
+
+    public static void main(String args[]) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:NativeMemoryTracking=detail",
+            "-XX:+PrintNMTStatistics",
+            "-version");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+
+        output.shouldHaveExitValue(0);
+
+        // We should never see either of these frames because they are supposed to be skipped. */
+        output.shouldNotContain("NativeCallStack::NativeCallStack");
+        output.shouldNotContain("os::get_native_stack");
+
+        // AllocateHeap shouldn't be in the output because it is suppose to always be inlined.
+        // We check for that here, but allow it for Windows and Solaris slowdebug builds because
+        // the compiler ends up not inlining AllocateHeap.
+        Boolean okToHaveAllocateHeap =
+            isSlowDebugBuild() && (Platform.isSolaris() || Platform.isWindows());
+        if (!okToHaveAllocateHeap) {
+            output.shouldNotContain("AllocateHeap");
+        }
+
+        // See if we have any stack trace symbols in the output
+        boolean hasSymbols =
+            output.getStdout().contains(expectedSymbol) || output.getStderr().contains(expectedSymbol);
+        if (!hasSymbols) {
+            // It's ok for ARM not to have symbols, because it does not support NMT detail
+            // when targeting thumb2. It's also ok for Windows not to have symbols, because
+            // they are only available if the symbols file is included with the build.
+            if (Platform.isWindows() || Platform.isARM()) {
+                return; // we are done
+            }
+            output.reportDiagnosticSummary();
+            throw new RuntimeException("Expected symbol missing missing from output: " + expectedSymbol);
+        }
+
+        /* Make sure the expected NMT detail stack trace is found. */
+        String expectedStackTrace =
+            (okToHaveAllocateHeap ? stackTraceAllocateHeap : stackTraceDefault);
+        if (!stackTraceMatches(expectedStackTrace, output)) {
+            output.reportDiagnosticSummary();
+            throw new RuntimeException("Expected stack trace missing missing from output: " + expectedStackTrace);
+        }
+    }
+
+    public static boolean stackTraceMatches(String stackTrace, OutputAnalyzer output) {
+        Matcher stdoutMatcher = Pattern.compile(stackTrace, Pattern.MULTILINE).matcher(output.getStdout());
+        Matcher stderrMatcher = Pattern.compile(stackTrace, Pattern.MULTILINE).matcher(output.getStderr());
+        return (stdoutMatcher.find() || stderrMatcher.find());
+    }
+}
--- a/hotspot/test/runtime/StackGuardPages/exeinvoke.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/hotspot/test/runtime/StackGuardPages/exeinvoke.c	Wed Jul 05 22:06:46 2017 +0200
@@ -242,7 +242,7 @@
       CLASS_PATH_OPT, javaclasspath);
 
   options[0].optionString = "-Xint";
-  options[1].optionString = "-Xss328k";
+  options[1].optionString = "-Xss1M";
   options[2].optionString = javaclasspathopt;
 
   vm_args.version = JNI_VERSION_1_2;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/NestedUnsafe.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,90 @@
+/*
+ * 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
+ * @summary Creates an anonymous class inside of an anonymous class.
+ * @library /testlibrary
+ * @modules java.base/jdk.internal.misc
+ *          java.compiler
+ *          java.management
+ * @run main NestedUnsafe
+ */
+
+import java.security.ProtectionDomain;
+import java.io.InputStream;
+import java.lang.*;
+import jdk.test.lib.*;
+import jdk.internal.misc.Unsafe;
+import static jdk.test.lib.Asserts.*;
+
+// package p;
+
+public class NestedUnsafe {
+    // The String concatenation should create the nested anonymous class.
+    static byte klassbuf[] = InMemoryJavaCompiler.compile("TestClass",
+        "public class TestClass { " +
+        "    public static void concat(String one, String two) throws Throwable { " +
+        "        System.out.println(one + two);" +
+        " } } ");
+
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+
+        Class klass = unsafe.defineAnonymousClass(NestedUnsafe.class, klassbuf, new Object[0]);
+        unsafe.ensureClassInitialized(klass);
+        Class[] cArgs = new Class[2];
+        cArgs[0] = String.class;
+        cArgs[1] = String.class;
+        try {
+            klass.getMethod("concat", cArgs).invoke(null, "AA", "BB");
+        } catch (Throwable ex) {
+            throw new RuntimeException("Exception: " + ex.toString());
+        }
+
+        // The anonymous class calls defineAnonymousClass creating a nested anonymous class.
+        byte klassbuf2[] = InMemoryJavaCompiler.compile("TestClass2",
+            "import jdk.internal.misc.Unsafe; " +
+            "public class TestClass2 { " +
+            "    public static void doit() throws Throwable { " +
+            "        Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe(); " +
+            "        Class klass2 = unsafe.defineAnonymousClass(TestClass2.class, NestedUnsafe.klassbuf, new Object[0]); " +
+            "        unsafe.ensureClassInitialized(klass2); " +
+            "        Class[] dArgs = new Class[2]; " +
+            "        dArgs[0] = String.class; " +
+            "        dArgs[1] = String.class; " +
+            "        try { " +
+            "            klass2.getMethod(\"concat\", dArgs).invoke(null, \"CC\", \"DD\"); " +
+            "        } catch (Throwable ex) { " +
+            "            throw new RuntimeException(\"Exception: \" + ex.toString()); " +
+            "        } " +
+            "} } ",
+            "-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED");
+        Class klass2 = unsafe.defineAnonymousClass(NestedUnsafe.class, klassbuf2, new Object[0]);
+        try {
+            klass2.getMethod("doit").invoke(null);
+        } catch (Throwable ex) {
+            throw new RuntimeException("Exception: " + ex.toString());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/sa/sadebugd/SADebugDTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,86 @@
+/*
+ * 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
+ * @summary Checks that the jshdb debugd utility sucessfully starts
+ *          and tries to attach to a running process
+ * @modules java.base/jdk.internal.misc
+ * @library /test/lib/share/classes
+ *
+ * @ignore 8163805
+ * @run main/othervm SADebugDTest
+ */
+import java.io.File;
+import java.util.concurrent.CountDownLatch;
+import java.io.InputStreamReader;
+import java.io.BufferedReader;
+import java.io.Reader;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Predicate;
+import static jdk.test.lib.Asserts.assertTrue;
+import static jdk.test.lib.Platform.shouldSAAttach;
+import static jdk.test.lib.process.ProcessTools.startProcess;
+
+public class SADebugDTest {
+
+    private static final String GOLDEN = "Attaching to process ID %d and starting RMI services, please wait...";
+
+    private static final String JAVA_HOME = (System.getProperty("test.jdk") != null)
+            ? System.getProperty("test.jdk") : System.getProperty("java.home");
+
+    private static final String JAVA_BIN_DIR
+            = JAVA_HOME + File.separator + "bin" + File.separator;
+
+    private static final String JHSDB = JAVA_BIN_DIR + "jhsdb";
+
+    public static void main(String[] args) throws Exception {
+
+        if (!shouldSAAttach()) {
+            log("Not possible to attach the SA. Skipping the test");
+            return;
+        }
+
+        long ourPid = ProcessHandle.current().getPid();
+
+        // The string we are expecting in the debugd ouput
+        String golden = String.format(GOLDEN, ourPid);
+
+        // We are going to run 'jhsdb debugd <our pid>'
+        // The startProcess will block untl the 'golden' string appears in either process' stdout or stderr
+        // In case of timeout startProcess kills the debugd process
+        ProcessBuilder pb = new ProcessBuilder();
+        pb.command(JHSDB, "debugd", String.valueOf(ourPid));
+        Process debugd = startProcess("debugd", pb, null, (line) -> line.trim().contains(golden), 0, TimeUnit.SECONDS);
+
+        // If we are here, this means we have received the golden line and the test has passed
+        // The debugd remains running, we have to kill it
+        debugd.destroy();
+
+    }
+
+    private static void log(String string) {
+        System.out.println(string);
+    }
+
+}
--- a/jdk/.hgtags	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/.hgtags	Wed Jul 05 22:06:46 2017 +0200
@@ -374,3 +374,4 @@
 47699aa2e69ec2702542dc73eb01de3bfb61aea0 jdk-9+129
 6c827500e34587061af97ad6fef0e859280255c5 jdk-9+130
 8c57f4c293bbc5609928308a6d91ba765760b5f9 jdk-9+131
+d5c70818cd8a82e76632c8c815bdb4f75f53aeaf jdk-9+132
--- a/jdk/make/copy/Copy-java.base.gmk	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/make/copy/Copy-java.base.gmk	Wed Jul 05 22:06:46 2017 +0200
@@ -183,7 +183,7 @@
 
 DEF_POLICY_SRC_LIST := $(DEF_POLICY_SRC)
 
-ifeq ($(OPENJDK_TARGET_OS), windows)
+ifneq ($(filter $(OPENJDK_TARGET_OS), windows solaris), )
   DEF_POLICY_SRC_LIST += $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/lib/security/default.policy
 endif
 
--- a/jdk/src/java.base/macosx/classes/apple/security/AppleProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/macosx/classes/apple/security/AppleProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -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
@@ -26,6 +26,7 @@
 package apple.security;
 
 import java.security.*;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
 
 /**
  * The Apple Security Provider.
@@ -74,7 +75,7 @@
 
     public AppleProvider() {
         /* We are the Apple provider */
-        super("Apple", 9.0d, info);
+        super("Apple", PROVIDER_VER, info);
 
         final Provider p = this;
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -107,7 +107,12 @@
             throw new InvalidKeySpecException("Key length is negative");
         }
         try {
-            this.prf = Mac.getInstance(prfAlgo, SunJCE.getInstance());
+            this.prf = Mac.getInstance(prfAlgo);
+            // SunPKCS11 requires a non-empty PBE password
+            if (passwdBytes.length == 0 &&
+                this.prf.getProvider().getName().startsWith("SunPKCS11")) {
+                this.prf = Mac.getInstance(prfAlgo, SunJCE.getInstance());
+            }
         } catch (NoSuchAlgorithmException nsae) {
             // not gonna happen; re-throw just in case
             InvalidKeySpecException ike = new InvalidKeySpecException();
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/SunJCE.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/SunJCE.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -28,6 +28,7 @@
 import java.security.AccessController;
 import java.security.Provider;
 import java.security.SecureRandom;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
 
 
 /**
@@ -104,7 +105,7 @@
 
     public SunJCE() {
         /* We are the "SunJCE" provider */
-        super("SunJCE", 9.0d, info);
+        super("SunJCE", PROVIDER_VER, info);
 
         final String BLOCK_MODES = "ECB|CBC|PCBC|CTR|CTS|CFB|OFB" +
             "|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64" +
--- a/jdk/src/java.base/share/classes/java/io/BufferedReader.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/io/BufferedReader.java	Wed Jul 05 22:06:46 2017 +0200
@@ -560,7 +560,7 @@
      * @since 1.8
      */
     public Stream<String> lines() {
-        Iterator<String> iter = new Iterator<String>() {
+        Iterator<String> iter = new Iterator<>() {
             String nextLine = null;
 
             @Override
--- a/jdk/src/java.base/share/classes/java/io/ByteArrayOutputStream.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/io/ByteArrayOutputStream.java	Wed Jul 05 22:06:46 2017 +0200
@@ -187,7 +187,7 @@
      * @return  the current contents of this output stream, as a byte array.
      * @see     java.io.ByteArrayOutputStream#size()
      */
-    public synchronized byte toByteArray()[] {
+    public synchronized byte[] toByteArray() {
         return Arrays.copyOf(buf, count);
     }
 
--- a/jdk/src/java.base/share/classes/java/io/CharArrayWriter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/io/CharArrayWriter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -165,7 +165,7 @@
      *
      * @param  csq
      *         The character sequence to append.  If {@code csq} is
-     *         {@code null}, then the four characters "{@code null}" are
+     *         {@code null}, then the four characters {@code "null"} are
      *         appended to this writer.
      *
      * @return  This writer
@@ -173,7 +173,7 @@
      * @since  1.5
      */
     public CharArrayWriter append(CharSequence csq) {
-        String s = (csq == null ? "null" : csq.toString());
+        String s = String.valueOf(csq);
         write(s, 0, s.length());
         return this;
     }
@@ -193,7 +193,7 @@
      *         The character sequence from which a subsequence will be
      *         appended.  If {@code csq} is {@code null}, then characters
      *         will be appended as if {@code csq} contained the four
-     *         characters "{@code null}".
+     *         characters {@code "null"}.
      *
      * @param  start
      *         The index of the first character in the subsequence
@@ -212,9 +212,8 @@
      * @since  1.5
      */
     public CharArrayWriter append(CharSequence csq, int start, int end) {
-        String s = (csq == null ? "null" : csq).subSequence(start, end).toString();
-        write(s, 0, s.length());
-        return this;
+        if (csq == null) csq = "null";
+        return append(csq.subSequence(start, end));
     }
 
     /**
@@ -251,7 +250,7 @@
      *
      * @return an array of chars copied from the input data.
      */
-    public char toCharArray()[] {
+    public char[] toCharArray() {
         synchronized (lock) {
             return Arrays.copyOf(buf, count);
         }
--- a/jdk/src/java.base/share/classes/java/io/FileSystem.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/io/FileSystem.java	Wed Jul 05 22:06:46 2017 +0200
@@ -228,13 +228,8 @@
     static boolean useCanonPrefixCache = true;
 
     private static boolean getBooleanProperty(String prop, boolean defaultVal) {
-        String val = System.getProperty(prop);
-        if (val == null) return defaultVal;
-        if (val.equalsIgnoreCase("true")) {
-            return true;
-        } else {
-            return false;
-        }
+        return Boolean.parseBoolean(System.getProperty(prop,
+                String.valueOf(defaultVal)));
     }
 
     static {
--- a/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1265,22 +1265,21 @@
         WeakClassKey key = new WeakClassKey(cl, Caches.subclassAuditsQueue);
         Boolean result = Caches.subclassAudits.get(key);
         if (result == null) {
-            result = Boolean.valueOf(auditSubclass(cl));
+            result = auditSubclass(cl);
             Caches.subclassAudits.putIfAbsent(key, result);
         }
-        if (result.booleanValue()) {
-            return;
+        if (!result) {
+            sm.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION);
         }
-        sm.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION);
     }
 
     /**
      * Performs reflective checks on given subclass to verify that it doesn't
-     * override security-sensitive non-final methods.  Returns true if subclass
-     * is "safe", false otherwise.
+     * override security-sensitive non-final methods.  Returns TRUE if subclass
+     * is "safe", FALSE otherwise.
      */
-    private static boolean auditSubclass(final Class<?> subcl) {
-        Boolean result = AccessController.doPrivileged(
+    private static Boolean auditSubclass(Class<?> subcl) {
+        return AccessController.doPrivileged(
             new PrivilegedAction<>() {
                 public Boolean run() {
                     for (Class<?> cl = subcl;
@@ -1303,7 +1302,6 @@
                 }
             }
         );
-        return result.booleanValue();
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/io/ObjectOutputStream.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/io/ObjectOutputStream.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1050,22 +1050,21 @@
         WeakClassKey key = new WeakClassKey(cl, Caches.subclassAuditsQueue);
         Boolean result = Caches.subclassAudits.get(key);
         if (result == null) {
-            result = Boolean.valueOf(auditSubclass(cl));
+            result = auditSubclass(cl);
             Caches.subclassAudits.putIfAbsent(key, result);
         }
-        if (result.booleanValue()) {
-            return;
+        if (!result) {
+            sm.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION);
         }
-        sm.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION);
     }
 
     /**
      * Performs reflective checks on given subclass to verify that it doesn't
-     * override security-sensitive non-final methods.  Returns true if subclass
-     * is "safe", false otherwise.
+     * override security-sensitive non-final methods.  Returns TRUE if subclass
+     * is "safe", FALSE otherwise.
      */
-    private static boolean auditSubclass(final Class<?> subcl) {
-        Boolean result = AccessController.doPrivileged(
+    private static Boolean auditSubclass(Class<?> subcl) {
+        return AccessController.doPrivileged(
             new PrivilegedAction<>() {
                 public Boolean run() {
                     for (Class<?> cl = subcl;
@@ -1088,7 +1087,6 @@
                 }
             }
         );
-        return result.booleanValue();
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1509,11 +1509,9 @@
     private static String getPackageName(Class<?> cl) {
         String s = cl.getName();
         int i = s.lastIndexOf('[');
-        if (i >= 0) {
-            s = s.substring(i + 2);
-        }
-        i = s.lastIndexOf('.');
-        return (i >= 0) ? s.substring(0, i) : "";
+        i = (i < 0) ? 0 : i + 2;
+        int j = s.lastIndexOf('.');
+        return (i < j) ? s.substring(i, j) : "";
     }
 
     /**
@@ -1535,14 +1533,14 @@
     private static String getMethodSignature(Class<?>[] paramTypes,
                                              Class<?> retType)
     {
-        StringBuilder sbuf = new StringBuilder();
-        sbuf.append('(');
+        StringBuilder sb = new StringBuilder();
+        sb.append('(');
         for (int i = 0; i < paramTypes.length; i++) {
-            appendClassSignature(sbuf, paramTypes[i]);
+            appendClassSignature(sb, paramTypes[i]);
         }
-        sbuf.append(')');
-        appendClassSignature(sbuf, retType);
-        return sbuf.toString();
+        sb.append(')');
+        appendClassSignature(sb, retType);
+        return sb.toString();
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/io/OutputStreamWriter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/io/OutputStreamWriter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -233,22 +233,16 @@
 
     @Override
     public Writer append(CharSequence csq, int start, int end) throws IOException {
-        if (csq == null) {
-            write("null".subSequence(start, end).toString());
-            return this;
-        } else {
-            return append(csq.subSequence(start, end));
-        }
+        if (csq == null) csq = "null";
+        return append(csq.subSequence(start, end));
     }
 
     @Override
     public Writer append(CharSequence csq) throws IOException {
-        if (csq == null) {
-            se.write("null");
-        } else if (csq instanceof CharBuffer) {
+        if (csq instanceof CharBuffer) {
             se.write((CharBuffer) csq);
         } else {
-            se.write(csq.toString());
+            se.write(String.valueOf(csq));
         }
         return this;
     }
--- a/jdk/src/java.base/share/classes/java/io/PrintStream.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/io/PrintStream.java	Wed Jul 05 22:06:46 2017 +0200
@@ -568,7 +568,7 @@
      * @param      b   The {@code boolean} to be printed
      */
     public void print(boolean b) {
-        write(b ? "true" : "false");
+        write(String.valueOf(b));
     }
 
     /**
@@ -663,10 +663,7 @@
      * @param      s   The {@code String} to be printed
      */
     public void print(String s) {
-        if (s == null) {
-            s = "null";
-        }
-        write(s);
+        write(String.valueOf(s));
     }
 
     /**
@@ -1068,10 +1065,7 @@
      * @since  1.5
      */
     public PrintStream append(CharSequence csq) {
-        if (csq == null)
-            print("null");
-        else
-            print(csq.toString());
+        print(String.valueOf(csq));
         return this;
     }
 
@@ -1111,9 +1105,8 @@
      * @since  1.5
      */
     public PrintStream append(CharSequence csq, int start, int end) {
-        CharSequence cs = (csq == null ? "null" : csq);
-        write(cs.subSequence(start, end).toString());
-        return this;
+        if (csq == null) csq = "null";
+        return append(csq.subSequence(start, end));
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/io/PrintWriter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/io/PrintWriter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -504,7 +504,7 @@
      * @param      b   The {@code boolean} to be printed
      */
     public void print(boolean b) {
-        write(b ? "true" : "false");
+        write(String.valueOf(b));
     }
 
     /**
@@ -599,10 +599,7 @@
      * @param      s   The {@code String} to be printed
      */
     public void print(String s) {
-        if (s == null) {
-            s = "null";
-        }
-        write(s);
+        write(String.valueOf(s));
     }
 
     /**
@@ -1005,10 +1002,7 @@
      * @since  1.5
      */
     public PrintWriter append(CharSequence csq) {
-        if (csq == null)
-            write("null");
-        else
-            write(csq.toString());
+        write(String.valueOf(csq));
         return this;
     }
 
@@ -1047,9 +1041,8 @@
      * @since  1.5
      */
     public PrintWriter append(CharSequence csq, int start, int end) {
-        CharSequence cs = (csq == null ? "null" : csq);
-        write(cs.subSequence(start, end).toString());
-        return this;
+        if (csq == null) csq = "null";
+        return append(csq.subSequence(start, end));
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/io/SequenceInputStream.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/io/SequenceInputStream.java	Wed Jul 05 22:06:46 2017 +0200
@@ -65,12 +65,7 @@
      */
     public SequenceInputStream(Enumeration<? extends InputStream> e) {
         this.e = e;
-        try {
-            nextStream();
-        } catch (IOException ex) {
-            // This should never happen
-            throw new Error("panic");
-        }
+        peekNextStream();
     }
 
     /**
@@ -86,16 +81,10 @@
      */
     public SequenceInputStream(InputStream s1, InputStream s2) {
         Vector<InputStream> v = new Vector<>(2);
-
         v.addElement(s1);
         v.addElement(s2);
         e = v.elements();
-        try {
-            nextStream();
-        } catch (IOException ex) {
-            // This should never happen
-            throw new Error("panic");
-        }
+        peekNextStream();
     }
 
     /**
@@ -105,14 +94,17 @@
         if (in != null) {
             in.close();
         }
+        peekNextStream();
+    }
 
+    private void peekNextStream() {
         if (e.hasMoreElements()) {
             in = (InputStream) e.nextElement();
             if (in == null)
                 throw new NullPointerException();
+        } else {
+            in = null;
         }
-        else in = null;
-
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/io/StringBufferInputStream.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/io/StringBufferInputStream.java	Wed Jul 05 22:06:46 2017 +0200
@@ -108,6 +108,7 @@
      *             <code>-1</code> if there is no more data because the end of
      *             the stream has been reached.
      */
+    @SuppressWarnings("deprecation")
     public synchronized int read(byte b[], int off, int len) {
         if (b == null) {
             throw new NullPointerException();
@@ -126,12 +127,8 @@
         if (len <= 0) {
             return 0;
         }
-        String  s = buffer;
-        int cnt = len;
-        while (--cnt >= 0) {
-            b[off++] = (byte)s.charAt(pos++);
-        }
-
+        buffer.getBytes(pos, pos + len, b, off);
+        pos += len;
         return len;
     }
 
--- a/jdk/src/java.base/share/classes/java/io/StringReader.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/io/StringReader.java	Wed Jul 05 22:06:46 2017 +0200
@@ -142,8 +142,8 @@
      */
     public boolean ready() throws IOException {
         synchronized (lock) {
-        ensureOpen();
-        return true;
+            ensureOpen();
+            return true;
         }
     }
 
--- a/jdk/src/java.base/share/classes/java/io/StringWriter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/io/StringWriter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -139,7 +139,7 @@
      *
      * @param  csq
      *         The character sequence to append.  If {@code csq} is
-     *         {@code null}, then the four characters "{@code null}" are
+     *         {@code null}, then the four characters {@code "null"} are
      *         appended to this writer.
      *
      * @return  This writer
@@ -147,10 +147,7 @@
      * @since  1.5
      */
     public StringWriter append(CharSequence csq) {
-        if (csq == null)
-            write("null");
-        else
-            write(csq.toString());
+        write(String.valueOf(csq));
         return this;
     }
 
@@ -170,7 +167,7 @@
      *         The character sequence from which a subsequence will be
      *         appended.  If {@code csq} is {@code null}, then characters
      *         will be appended as if {@code csq} contained the four
-     *         characters "{@code null}".
+     *         characters {@code "null"}.
      *
      * @param  start
      *         The index of the first character in the subsequence
@@ -189,9 +186,8 @@
      * @since  1.5
      */
     public StringWriter append(CharSequence csq, int start, int end) {
-        CharSequence cs = (csq == null ? "null" : csq);
-        write(cs.subSequence(start, end).toString());
-        return this;
+        if (csq == null) csq = "null";
+        return append(csq.subSequence(start, end));
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/io/Writer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/io/Writer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -221,7 +221,7 @@
      *
      * @param  csq
      *         The character sequence to append.  If {@code csq} is
-     *         {@code null}, then the four characters "{@code null}" are
+     *         {@code null}, then the four characters {@code "null"} are
      *         appended to this writer.
      *
      * @return  This writer
@@ -232,10 +232,7 @@
      * @since  1.5
      */
     public Writer append(CharSequence csq) throws IOException {
-        if (csq == null)
-            write("null");
-        else
-            write(csq.toString());
+        write(String.valueOf(csq));
         return this;
     }
 
@@ -256,7 +253,7 @@
      *         The character sequence from which a subsequence will be
      *         appended.  If {@code csq} is {@code null}, then characters
      *         will be appended as if {@code csq} contained the four
-     *         characters "{@code null}".
+     *         characters {@code "null"}.
      *
      * @param  start
      *         The index of the first character in the subsequence
@@ -278,9 +275,8 @@
      * @since  1.5
      */
     public Writer append(CharSequence csq, int start, int end) throws IOException {
-        CharSequence cs = (csq == null ? "null" : csq);
-        write(cs.subSequence(start, end).toString());
-        return this;
+        if (csq == null) csq = "null";
+        return append(csq.subSequence(start, end));
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java	Wed Jul 05 22:06:46 2017 +0200
@@ -36,7 +36,6 @@
 import java.lang.invoke.LambdaForm.NamedFunction;
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.reflect.Field;
-import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.function.Function;
@@ -308,7 +307,7 @@
         /*non-public*/ char fieldTypeChar(int i) {
             return typeChars.charAt(i);
         }
-        Object fieldSignature() {
+        String fieldSignature() {
             return typeChars;
         }
         public Class<? extends BoundMethodHandle> fieldHolder() {
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java	Wed Jul 05 22:06:46 2017 +0200
@@ -27,6 +27,7 @@
 
 import java.util.Arrays;
 import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.LambdaForm.Kind.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 
 /**
@@ -96,14 +97,8 @@
                                         int whichCache,
                                         Object constraint,
                                         NamedFunction getTargetFn) {
-        String debugString;
-        switch(whichCache) {
-            case MethodTypeForm.LF_REBIND:            debugString = "BMH.reinvoke";      break;
-            case MethodTypeForm.LF_DELEGATE:          debugString = "MH.delegate";       break;
-            default:                                  debugString = "MH.reinvoke";       break;
-        }
         // No pre-action needed.
-        return makeReinvokerForm(target, whichCache, constraint, debugString, true, getTargetFn, null);
+        return makeReinvokerForm(target, whichCache, constraint, null, true, getTargetFn, null);
     }
     /** Create a LF which simply reinvokes a target of the given basic type. */
     static LambdaForm makeReinvokerForm(MethodHandle target,
@@ -114,6 +109,10 @@
                                         NamedFunction getTargetFn,
                                         NamedFunction preActionFn) {
         MethodType mtype = target.type().basicType();
+        Kind kind = whichKind(whichCache);
+        if (debugString == null) {
+            debugString = kind.defaultLambdaName;
+        }
         boolean customized = (whichCache < 0 ||
                 mtype.parameterSlotCount() > MethodType.MAX_MH_INVOKER_ARITY);
         boolean hasPreAction = (preActionFn != null);
@@ -145,13 +144,21 @@
             targetArgs[0] = names[NEXT_MH];  // overwrite this MH with next MH
             names[REINVOKE] = new LambdaForm.Name(mtype, targetArgs);
         }
-        form = new LambdaForm(debugString, ARG_LIMIT, names, forceInline);
+        form = new LambdaForm(debugString, ARG_LIMIT, names, forceInline, kind);
         if (!customized) {
             form = mtype.form().setCachedLambdaForm(whichCache, form);
         }
         return form;
     }
 
+    private static Kind whichKind(int whichCache) {
+        switch(whichCache) {
+            case MethodTypeForm.LF_REBIND:   return BOUND_REINVOKER;
+            case MethodTypeForm.LF_DELEGATE: return DELEGATE;
+            default:                         return REINVOKER;
+        }
+    }
+
     static final NamedFunction NF_getTarget;
     static {
         try {
@@ -160,5 +167,13 @@
         } catch (ReflectiveOperationException ex) {
             throw newInternalError(ex);
         }
+        // The Holder class will contain pre-generated DelegatingMethodHandles resolved
+        // speculatively using MemberName.getFactory().resolveOrNull. However, that
+        // doesn't initialize the class, which subtly breaks inlining etc. By forcing
+        // initialization of the Holder class we avoid these issues.
+        UNSAFE.ensureClassInitialized(Holder.class);
     }
+
+    /* Placeholder class for DelegatingMethodHandles generated ahead of time */
+    final class Holder {}
 }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Wed Jul 05 22:06:46 2017 +0200
@@ -38,6 +38,7 @@
 import java.util.Objects;
 
 import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.LambdaForm.Kind.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import static java.lang.invoke.MethodHandleStatics.UNSAFE;
 import static java.lang.invoke.MethodHandleStatics.newInternalError;
@@ -189,14 +190,15 @@
     static LambdaForm makePreparedLambdaForm(MethodType mtype, int which) {
         boolean needsInit = (which == LF_INVSTATIC_INIT);
         boolean doesAlloc = (which == LF_NEWINVSPECIAL);
-        String linkerName, lambdaName;
+        String linkerName;
+        LambdaForm.Kind kind;
         switch (which) {
-        case LF_INVVIRTUAL:    linkerName = "linkToVirtual";    lambdaName = "DMH.invokeVirtual";    break;
-        case LF_INVSTATIC:     linkerName = "linkToStatic";     lambdaName = "DMH.invokeStatic";     break;
-        case LF_INVSTATIC_INIT:linkerName = "linkToStatic";     lambdaName = "DMH.invokeStaticInit"; break;
-        case LF_INVSPECIAL:    linkerName = "linkToSpecial";    lambdaName = "DMH.invokeSpecial";    break;
-        case LF_INVINTERFACE:  linkerName = "linkToInterface";  lambdaName = "DMH.invokeInterface";  break;
-        case LF_NEWINVSPECIAL: linkerName = "linkToSpecial";    lambdaName = "DMH.newInvokeSpecial"; break;
+        case LF_INVVIRTUAL:    linkerName = "linkToVirtual";   kind = DIRECT_INVOKE_VIRTUAL;     break;
+        case LF_INVSTATIC:     linkerName = "linkToStatic";    kind = DIRECT_INVOKE_STATIC;      break;
+        case LF_INVSTATIC_INIT:linkerName = "linkToStatic";    kind = DIRECT_INVOKE_STATIC_INIT; break;
+        case LF_INVSPECIAL:    linkerName = "linkToSpecial";   kind = DIRECT_INVOKE_SPECIAL;     break;
+        case LF_INVINTERFACE:  linkerName = "linkToInterface"; kind = DIRECT_INVOKE_INTERFACE;   break;
+        case LF_NEWINVSPECIAL: linkerName = "linkToSpecial";   kind = DIRECT_NEW_INVOKE_SPECIAL; break;
         default:  throw new InternalError("which="+which);
         }
 
@@ -240,11 +242,11 @@
             result = NEW_OBJ;
         }
         names[LINKER_CALL] = new Name(linker, outArgs);
-        lambdaName += "_" + shortenSignature(basicTypeSignature(mtype));
-        LambdaForm lform = new LambdaForm(lambdaName, ARG_LIMIT, names, result);
+        String lambdaName = kind.defaultLambdaName + "_" + shortenSignature(basicTypeSignature(mtype));
+        LambdaForm lform = new LambdaForm(lambdaName, ARG_LIMIT, names, result, kind);
 
         // This is a tricky bit of code.  Don't send it through the LF interpreter.
-        lform.compileToBytecode(Holder.class);
+        lform.compileToBytecode();
         return lform;
     }
 
@@ -705,7 +707,7 @@
     }
 
     static {
-        // The DMH class will contain pre-generated DirectMethodHandles resolved
+        // The Holder class will contain pre-generated DirectMethodHandles resolved
         // speculatively using MemberName.getFactory().resolveOrNull. However, that
         // doesn't initialize the class, which subtly breaks inlining etc. By forcing
         // initialization of the Holder class we avoid these issues.
@@ -713,5 +715,5 @@
     }
 
     /* Placeholder class for DirectMethodHandles generated ahead of time */
-    private final class Holder {}
+    final class Holder {}
 }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/GenerateJLIClassesHelper.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/GenerateJLIClassesHelper.java	Wed Jul 05 22:06:46 2017 +0200
@@ -29,21 +29,82 @@
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.Opcodes;
 
+import java.util.ArrayList;
+import java.util.HashSet;
+
 /**
  * Helper class to assist the GenerateJLIClassesPlugin to get access to
  * generate classes ahead of time.
  */
 class GenerateJLIClassesHelper {
 
-    static byte[] generateDMHClassBytes(String className,
+    static byte[] generateBasicFormsClassBytes(String className) {
+        ArrayList<LambdaForm> forms = new ArrayList<>();
+        ArrayList<String> names = new ArrayList<>();
+        HashSet<String> dedupSet = new HashSet<>();
+        for (LambdaForm.BasicType type : LambdaForm.BasicType.values()) {
+            LambdaForm zero = LambdaForm.zeroForm(type);
+            String name = zero.kind.defaultLambdaName
+                   + "_" + zero.returnType().basicTypeChar();
+            if (dedupSet.add(name)) {
+                names.add(name);
+                forms.add(zero);
+            }
+
+            LambdaForm identity = LambdaForm.identityForm(type);
+            name = identity.kind.defaultLambdaName
+                   + "_" + identity.returnType().basicTypeChar();
+            if (dedupSet.add(name)) {
+                names.add(name);
+                forms.add(identity);
+            }
+        }
+        return generateCodeBytesForLFs(className,
+                names.toArray(new String[0]),
+                forms.toArray(new LambdaForm[0]));
+    }
+
+    static byte[] generateDirectMethodHandleHolderClassBytes(String className,
             MethodType[] methodTypes, int[] types) {
         LambdaForm[] forms = new LambdaForm[methodTypes.length];
+        String[] names = new String[methodTypes.length];
         for (int i = 0; i < forms.length; i++) {
             forms[i] = DirectMethodHandle.makePreparedLambdaForm(methodTypes[i],
                                                                  types[i]);
-            methodTypes[i] = forms[i].methodType();
+            names[i] = forms[i].kind.defaultLambdaName;
         }
-        return generateCodeBytesForLFs(className, forms, methodTypes);
+        return generateCodeBytesForLFs(className, names, forms);
+    }
+
+    static byte[] generateDelegatingMethodHandleHolderClassBytes(String className,
+            MethodType[] methodTypes) {
+
+        HashSet<MethodType> dedupSet = new HashSet<>();
+        ArrayList<LambdaForm> forms = new ArrayList<>();
+        ArrayList<String> names = new ArrayList<>();
+        for (int i = 0; i < methodTypes.length; i++) {
+            // generate methods representing the DelegatingMethodHandle
+            if (dedupSet.add(methodTypes[i])) {
+                // reinvokers are variant with the associated SpeciesData
+                // and shape of the target LF, but we can easily pregenerate
+                // the basic reinvokers associated with Species_L. Ultimately we
+                // may want to consider pregenerating more of these, which will
+                // require an even more complex naming scheme
+                LambdaForm reinvoker = makeReinvokerFor(methodTypes[i]);
+                forms.add(reinvoker);
+                String speciesSig = BoundMethodHandle
+                        .speciesData(reinvoker).fieldSignature();
+                assert(speciesSig.equals("L"));
+                names.add(reinvoker.kind.defaultLambdaName + "_" + speciesSig);
+
+                LambdaForm delegate = makeDelegateFor(methodTypes[i]);
+                forms.add(delegate);
+                names.add(delegate.kind.defaultLambdaName);
+            }
+        }
+        return generateCodeBytesForLFs(className,
+                names.toArray(new String[0]),
+                forms.toArray(new LambdaForm[0]));
     }
 
     /*
@@ -51,22 +112,45 @@
      * a class with a specified name.
      */
     private static byte[] generateCodeBytesForLFs(String className,
-            LambdaForm[] forms, MethodType[] types) {
-        assert(forms.length == types.length);
+            String[] names, LambdaForm[] forms) {
 
         ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS + ClassWriter.COMPUTE_FRAMES);
         cw.visit(Opcodes.V1_8, Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER,
                 className, null, InvokerBytecodeGenerator.INVOKER_SUPER_NAME, null);
         cw.visitSource(className.substring(className.lastIndexOf('/') + 1), null);
+
         for (int i = 0; i < forms.length; i++) {
-            InvokerBytecodeGenerator g
-                    = new InvokerBytecodeGenerator(className, forms[i], types[i]);
-            g.setClassWriter(cw);
-            g.addMethod();
+            addMethod(className, names[i], forms[i],
+                    forms[i].methodType(), cw);
         }
         return cw.toByteArray();
     }
 
+    private static void addMethod(String className, String methodName, LambdaForm form,
+            MethodType type, ClassWriter cw) {
+        InvokerBytecodeGenerator g
+                = new InvokerBytecodeGenerator(className, methodName, form, type);
+        g.setClassWriter(cw);
+        g.addMethod();
+    }
+
+    private static LambdaForm makeReinvokerFor(MethodType type) {
+        MethodHandle emptyHandle = MethodHandles.empty(type);
+        return DelegatingMethodHandle.makeReinvokerForm(emptyHandle,
+                MethodTypeForm.LF_REBIND,
+                BoundMethodHandle.speciesData_L(),
+                BoundMethodHandle.speciesData_L().getterFunction(0));
+    }
+
+    private static LambdaForm makeDelegateFor(MethodType type) {
+        MethodHandle handle = MethodHandles.empty(type);
+        return DelegatingMethodHandle.makeReinvokerForm(
+                handle,
+                MethodTypeForm.LF_DELEGATE,
+                DelegatingMethodHandle.class,
+                DelegatingMethodHandle.NF_getTarget);
+    }
+
     static Map.Entry<String, byte[]> generateConcreteBMHClassBytes(
             final String types) {
         for (char c : types.toCharArray()) {
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Wed Jul 05 22:06:46 2017 +0200
@@ -46,6 +46,7 @@
 
 import static java.lang.invoke.LambdaForm.*;
 import static java.lang.invoke.LambdaForm.BasicType.*;
+import static java.lang.invoke.LambdaForm.Kind.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 
@@ -125,9 +126,15 @@
     }
 
     /** For generating customized code for a single LambdaForm. */
-    InvokerBytecodeGenerator(String className, LambdaForm form, MethodType invokerType) {
+    private InvokerBytecodeGenerator(String className, LambdaForm form, MethodType invokerType) {
+        this(className, form.debugName, form, invokerType);
+    }
+
+    /** For generating customized code for a single LambdaForm. */
+    InvokerBytecodeGenerator(String className, String invokerName,
+            LambdaForm form, MethodType invokerType) {
         this(form, form.names.length,
-             className, form.debugName, invokerType);
+             className, invokerName, invokerType);
         // Create an array to map name indexes to locals indexes.
         Name[] names = form.names;
         for (int i = 0, index = 0; i < localsMap.length; i++) {
@@ -597,10 +604,47 @@
         return c.getName().replace('.', '/');
     }
 
+    private static MemberName resolveFrom(String name, MethodType type, Class<?> holder) {
+        MemberName member = new MemberName(holder, name, type, REF_invokeStatic);
+        MemberName resolvedMember = MemberName.getFactory().resolveOrNull(REF_invokeStatic, member, holder);
+
+        return resolvedMember;
+    }
+
+    private static MemberName lookupPregenerated(LambdaForm form) {
+        if (form.customized != null) {
+            // No pre-generated version for customized LF
+            return null;
+        }
+        MethodType invokerType = form.methodType();
+        String name = form.kind.methodName;
+        switch (form.kind) {
+            case BOUND_REINVOKER: {
+                name = name + "_" + BoundMethodHandle.speciesData(form).fieldSignature();
+                return resolveFrom(name, invokerType, DelegatingMethodHandle.Holder.class);
+            }
+            case DELEGATE:                  return resolveFrom(name, invokerType, DelegatingMethodHandle.Holder.class);
+            case ZERO:                      // fall-through
+            case IDENTITY: {
+                name = name + "_" + form.returnType().basicTypeChar();
+                return resolveFrom(name, invokerType, LambdaForm.Holder.class);
+            }
+            case DIRECT_INVOKE_INTERFACE:   // fall-through
+            case DIRECT_INVOKE_SPECIAL:     // fall-through
+            case DIRECT_INVOKE_STATIC:      // fall-through
+            case DIRECT_INVOKE_STATIC_INIT: // fall-through
+            case DIRECT_INVOKE_VIRTUAL:     return resolveFrom(name, invokerType, DirectMethodHandle.Holder.class);
+        }
+        return null;
+    }
+
     /**
      * Generate customized bytecode for a given LambdaForm.
      */
     static MemberName generateCustomizedCode(LambdaForm form, MethodType invokerType) {
+        MemberName pregenerated = lookupPregenerated(form);
+        if (pregenerated != null)  return pregenerated; // pre-generated bytecode
+
         InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("MH", form, invokerType);
         return g.loadMethod(g.generateCustomizedCodeBytes());
     }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Wed Jul 05 22:06:46 2017 +0200
@@ -41,6 +41,7 @@
 import static java.lang.invoke.LambdaForm.BasicType.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic;
 import static java.lang.invoke.MethodHandleStatics.*;
+import java.util.Objects;
 
 /**
  * The symbolic, non-executable form of a method handle's invocation semantics.
@@ -127,6 +128,7 @@
     final MethodHandle customized;
     @Stable final Name[] names;
     final String debugName;
+    final Kind kind;
     MemberName vmentry;   // low-level behavior, or null if not yet prepared
     private boolean isCompiled;
 
@@ -266,12 +268,48 @@
         }
     }
 
+    enum Kind {
+        GENERIC(""),
+        ZERO("zero"),
+        IDENTITY("identity"),
+        BOUND_REINVOKER("BMH.reinvoke"),
+        REINVOKER("MH.reinvoke"),
+        DELEGATE("MH.delegate"),
+        DIRECT_INVOKE_VIRTUAL("DMH.invokeVirtual"),
+        DIRECT_INVOKE_SPECIAL("DMH.invokeSpecial"),
+        DIRECT_INVOKE_STATIC("DMH.invokeStatic"),
+        DIRECT_NEW_INVOKE_SPECIAL("DMH.newInvokeSpecial"),
+        DIRECT_INVOKE_INTERFACE("DMH.invokeInterface"),
+        DIRECT_INVOKE_STATIC_INIT("DMH.invokeStaticInit");
+
+        final String defaultLambdaName;
+        final String methodName;
+
+        private Kind(String defaultLambdaName) {
+            this.defaultLambdaName = defaultLambdaName;
+            int p = defaultLambdaName.indexOf('.');
+            if (p > -1) {
+                this.methodName = defaultLambdaName.substring(p + 1);
+            } else {
+                this.methodName = defaultLambdaName;
+            }
+        }
+    }
+
     LambdaForm(String debugName,
                int arity, Name[] names, int result) {
-        this(debugName, arity, names, result, /*forceInline=*/true, /*customized=*/null);
+        this(debugName, arity, names, result, /*forceInline=*/true, /*customized=*/null, Kind.GENERIC);
+    }
+    LambdaForm(String debugName,
+               int arity, Name[] names, int result, Kind kind) {
+        this(debugName, arity, names, result, /*forceInline=*/true, /*customized=*/null, kind);
     }
     LambdaForm(String debugName,
                int arity, Name[] names, int result, boolean forceInline, MethodHandle customized) {
+        this(debugName, arity, names, result, forceInline, customized, Kind.GENERIC);
+    }
+    LambdaForm(String debugName,
+               int arity, Name[] names, int result, boolean forceInline, MethodHandle customized, Kind kind) {
         assert(namesOK(arity, names));
         this.arity = arity;
         this.result = fixResult(result, names);
@@ -279,6 +317,7 @@
         this.debugName = fixDebugName(debugName);
         this.forceInline = forceInline;
         this.customized = customized;
+        this.kind = kind;
         int maxOutArity = normalize();
         if (maxOutArity > MethodType.MAX_MH_INVOKER_ARITY) {
             // Cannot use LF interpreter on very high arity expressions.
@@ -288,11 +327,15 @@
     }
     LambdaForm(String debugName,
                int arity, Name[] names) {
-        this(debugName, arity, names, LAST_RESULT, /*forceInline=*/true, /*customized=*/null);
+        this(debugName, arity, names, LAST_RESULT, /*forceInline=*/true, /*customized=*/null, Kind.GENERIC);
     }
     LambdaForm(String debugName,
                int arity, Name[] names, boolean forceInline) {
-        this(debugName, arity, names, LAST_RESULT, forceInline, /*customized=*/null);
+        this(debugName, arity, names, LAST_RESULT, forceInline, /*customized=*/null, Kind.GENERIC);
+    }
+    LambdaForm(String debugName,
+               int arity, Name[] names, boolean forceInline, Kind kind) {
+        this(debugName, arity, names, LAST_RESULT, forceInline, /*customized=*/null, kind);
     }
     LambdaForm(String debugName,
                Name[] formals, Name[] temps, Name result) {
@@ -325,6 +368,7 @@
         this.debugName = "LF.zero";
         this.forceInline = true;
         this.customized = null;
+        this.kind = Kind.GENERIC;
         assert(nameRefsAreLegal());
         assert(isEmpty());
         String sig = null;
@@ -395,7 +439,7 @@
 
     /** Customize LambdaForm for a particular MethodHandle */
     LambdaForm customize(MethodHandle mh) {
-        LambdaForm customForm = new LambdaForm(debugName, arity, names, result, forceInline, mh);
+        LambdaForm customForm = new LambdaForm(debugName, arity, names, result, forceInline, mh, kind);
         if (COMPILE_THRESHOLD >= 0 && isCompiled) {
             // If shared LambdaForm has been compiled, compile customized version as well.
             customForm.compileToBytecode();
@@ -773,28 +817,6 @@
         }
     }
 
-    /**
-     * Generate optimizable bytecode for this form after first looking for a
-     * pregenerated version in a specified class.
-     */
-    void compileToBytecode(Class<?> lookupClass) {
-        if (vmentry != null && isCompiled) {
-            return;  // already compiled somehow
-        }
-        MethodType invokerType = methodType();
-        assert(vmentry == null || vmentry.getMethodType().basicType().equals(invokerType));
-        int dot = debugName.indexOf('.');
-        String methodName = (dot > 0) ? debugName.substring(dot + 1) : debugName;
-        MemberName member = new MemberName(lookupClass, methodName, invokerType, REF_invokeStatic);
-        MemberName resolvedMember = MemberName.getFactory().resolveOrNull(REF_invokeStatic, member, lookupClass);
-        if (resolvedMember != null) {
-            vmentry = resolvedMember;
-            isCompiled = true;
-        } else {
-            compileToBytecode();
-        }
-    }
-
     private static void computeInitialPreparedForms() {
         // Find all predefined invokers and associate them with canonical empty lambda forms.
         for (MemberName m : MemberName.getFactory().getMethods(LambdaForm.class, false, null, null, null)) {
@@ -1828,7 +1850,7 @@
         // bootstrap dependency on this method in case we're interpreting LFs
         if (isVoid) {
             Name[] idNames = new Name[] { argument(0, L_TYPE) };
-            idForm = new LambdaForm(idMem.getName(), 1, idNames, VOID_RESULT);
+            idForm = new LambdaForm(idMem.getName(), 1, idNames, VOID_RESULT, Kind.IDENTITY);
             idForm.compileToBytecode();
             idFun = new NamedFunction(idMem, SimpleMethodHandle.make(idMem.getInvocationType(), idForm));
 
@@ -1836,15 +1858,17 @@
             zeFun = idFun;
         } else {
             Name[] idNames = new Name[] { argument(0, L_TYPE), argument(1, type) };
-            idForm = new LambdaForm(idMem.getName(), 2, idNames, 1);
+            idForm = new LambdaForm(idMem.getName(), 2, idNames, 1, Kind.IDENTITY);
             idForm.compileToBytecode();
-            idFun = new NamedFunction(idMem, SimpleMethodHandle.make(idMem.getInvocationType(), idForm));
+            idFun = new NamedFunction(idMem, MethodHandleImpl.makeIntrinsic(
+                    idMem.getInvocationType(), idForm, MethodHandleImpl.Intrinsic.IDENTITY));
 
             Object zeValue = Wrapper.forBasicType(btChar).zero();
             Name[] zeNames = new Name[] { argument(0, L_TYPE), new Name(idFun, zeValue) };
-            zeForm = new LambdaForm(zeMem.getName(), 1, zeNames, 1);
+            zeForm = new LambdaForm(zeMem.getName(), 1, zeNames, 1, Kind.ZERO);
             zeForm.compileToBytecode();
-            zeFun = new NamedFunction(zeMem, SimpleMethodHandle.make(zeMem.getInvocationType(), zeForm));
+            zeFun = new NamedFunction(zeMem, MethodHandleImpl.makeIntrinsic(
+                    zeMem.getInvocationType(), zeForm, MethodHandleImpl.Intrinsic.ZERO));
         }
 
         LF_zero[ord] = zeForm;
@@ -1901,8 +1925,17 @@
         if (USE_PREDEFINED_INTERPRET_METHODS)
             computeInitialPreparedForms();
         NamedFunction.initializeInvokers();
+
+        // The Holder class will contain pre-generated forms resolved
+        // using MemberName.getFactory(). However, that doesn't initialize the
+        // class, which subtly breaks inlining etc. By forcing
+        // initialization of the Holder class we avoid these issues.
+        UNSAFE.ensureClassInitialized(Holder.class);
     }
 
+    /* Placeholder class for zero and identity forms generated ahead of time */
+    final class Holder {}
+
     // The following hack is necessary in order to suppress TRACE_INTERPRETER
     // during execution of the static initializes of this class.
     // Turning on TRACE_INTERPRETER too early will cause
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1718,10 +1718,19 @@
             }
 
             @Override
-            public byte[] generateDMHClassBytes(String className,
-            MethodType[] methodTypes, int[] types) {
+            public byte[] generateDirectMethodHandleHolderClassBytes(
+                    String className, MethodType[] methodTypes, int[] types) {
                 return GenerateJLIClassesHelper
-                        .generateDMHClassBytes(className, methodTypes, types);
+                        .generateDirectMethodHandleHolderClassBytes(
+                                className, methodTypes, types);
+            }
+
+            @Override
+            public byte[] generateDelegatingMethodHandleHolderClassBytes(
+                    String className, MethodType[] methodTypes) {
+                return GenerateJLIClassesHelper
+                        .generateDelegatingMethodHandleHolderClassBytes(
+                                className, methodTypes);
             }
 
             @Override
@@ -1730,6 +1739,12 @@
                 return GenerateJLIClassesHelper
                         .generateConcreteBMHClassBytes(types);
             }
+
+            @Override
+            public byte[] generateBasicFormsClassBytes(final String className) {
+                return GenerateJLIClassesHelper
+                        .generateBasicFormsClassBytes(className);
+            }
         });
     }
 
@@ -1925,7 +1940,7 @@
      * @return whether the counter has reached the limit.
      */
     static boolean countedLoopPredicate(int counter, int limit) {
-        return counter <= limit;
+        return counter < limit;
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Wed Jul 05 22:06:46 2017 +0200
@@ -4583,7 +4583,8 @@
      *     // assume MH_decrement is a handle to x-1 of type int
      *     MethodHandle[]
      *         indexVar = {start, MH_increment}, // i = start; i = i+1
-     *         loopLimit = {end, null, MH_lessThan, returnVar }, // i<end
+     *         loopLimit = {end, null,
+     *                       filterArgument(MH_lessThan, 0, MH_decrement), returnVar}, // i-1<end
      *         bodyClause = {init,
      *                       filterArgument(dropArguments(body, 1, int.class), 0, MH_decrement}; // v = body(i-1, v)
      *     return loop(indexVar, loopLimit, bodyClause);
@@ -4619,12 +4620,12 @@
         MethodHandle actualBody = body == null ? dropArguments(defaultResultHandle, 0, int.class) : body;
         MethodHandle returnVar = dropArguments(defaultResultHandle, 0, int.class, int.class);
         MethodHandle actualEnd = end == null ? constant(int.class, 0) : end;
+        MethodHandle decr = MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_decrementCounter);
         MethodHandle[] indexVar = {start, MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_countedLoopStep)};
         MethodHandle[] loopLimit = {actualEnd, null,
-                MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_countedLoopPred), returnVar};
-        MethodHandle[] bodyClause = {actualInit,
-                filterArgument(dropArguments(actualBody, 1, int.class), 0,
-                        MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_decrementCounter))};
+                filterArgument(MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_countedLoopPred), 0, decr),
+                returnVar};
+        MethodHandle[] bodyClause = {actualInit, filterArgument(dropArguments(actualBody, 1, int.class), 0, decr)};
         return loop(indexVar, loopLimit, bodyClause);
     }
 
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AbstractClassLoaderValue.java	Thu Aug 18 21:34:24 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,431 +0,0 @@
-/*
- * 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.
- */
-
-package java.lang.reflect;
-
-import jdk.internal.loader.BootLoader;
-import jdk.internal.misc.JavaLangAccess;
-import jdk.internal.misc.SharedSecrets;
-
-import java.util.Iterator;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.function.BiFunction;
-import java.util.function.Supplier;
-
-/**
- * AbstractClassLoaderValue is a superclass of root-{@link ClassLoaderValue}
- * and {@link Sub sub}-ClassLoaderValue.
- *
- * @param <CLV> the type of concrete ClassLoaderValue (this type)
- * @param <V>   the type of values associated with ClassLoaderValue
- */
-abstract class AbstractClassLoaderValue<CLV extends AbstractClassLoaderValue<CLV, V>, V> {
-
-    /**
-     * Sole constructor.
-     */
-    AbstractClassLoaderValue() {}
-
-    /**
-     * Returns the key component of this ClassLoaderValue. The key component of
-     * the root-{@link ClassLoaderValue} is the ClassLoaderValue itself,
-     * while the key component of a {@link #sub(Object) sub}-ClassLoaderValue
-     * is what was given to construct it.
-     *
-     * @return the key component of this ClassLoaderValue.
-     */
-    public abstract Object key();
-
-    /**
-     * Constructs new sub-ClassLoaderValue of this ClassLoaderValue with given
-     * key component.
-     *
-     * @param key the key component of the sub-ClassLoaderValue.
-     * @param <K> the type of the key component.
-     * @return a sub-ClassLoaderValue of this ClassLoaderValue for given key
-     */
-    public <K> Sub<K> sub(K key) {
-        return new Sub<>(key);
-    }
-
-    /**
-     * Returns {@code true} if this ClassLoaderValue is equal to given {@code clv}
-     * or if this ClassLoaderValue was derived from given {@code clv} by a chain
-     * of {@link #sub(Object)} invocations.
-     *
-     * @param clv the ClassLoaderValue to test this against
-     * @return if this ClassLoaderValue is equal to given {@code clv} or
-     * its descendant
-     */
-    public abstract boolean isEqualOrDescendantOf(AbstractClassLoaderValue<?, V> clv);
-
-    /**
-     * Returns the value associated with this ClassLoaderValue and given ClassLoader
-     * or {@code null} if there is none.
-     *
-     * @param cl the ClassLoader for the associated value
-     * @return the value associated with this ClassLoaderValue and given ClassLoader
-     * or {@code null} if there is none.
-     */
-    public V get(ClassLoader cl) {
-        Object val = AbstractClassLoaderValue.<CLV>map(cl).get(this);
-        try {
-            return extractValue(val);
-        } catch (Memoizer.RecursiveInvocationException e) {
-            // propagate recursive get() for the same key that is just
-            // being calculated in computeIfAbsent()
-            throw e;
-        } catch (Throwable t) {
-            // don't propagate exceptions thrown from Memoizer - pretend
-            // that there was no entry
-            // (computeIfAbsent invocation will try to remove it anyway)
-            return null;
-        }
-    }
-
-    /**
-     * Associates given value {@code v} with this ClassLoaderValue and given
-     * ClassLoader and returns {@code null} if there was no previously associated
-     * value or does nothing and returns previously associated value if there
-     * was one.
-     *
-     * @param cl the ClassLoader for the associated value
-     * @param v  the value to associate
-     * @return previously associated value or null if there was none
-     */
-    public V putIfAbsent(ClassLoader cl, V v) {
-        ConcurrentHashMap<CLV, Object> map = map(cl);
-        @SuppressWarnings("unchecked")
-        CLV clv = (CLV) this;
-        while (true) {
-            try {
-                Object val = map.putIfAbsent(clv, v);
-                return extractValue(val);
-            } catch (Memoizer.RecursiveInvocationException e) {
-                // propagate RecursiveInvocationException for the same key that
-                // is just being calculated in computeIfAbsent
-                throw e;
-            } catch (Throwable t) {
-                // don't propagate exceptions thrown from foreign Memoizer -
-                // pretend that there was no entry and retry
-                // (foreign computeIfAbsent invocation will try to remove it anyway)
-            }
-            // TODO:
-            // Thread.onSpinLoop(); // when available
-        }
-    }
-
-    /**
-     * Removes the value associated with this ClassLoaderValue and given
-     * ClassLoader if the associated value is equal to given value {@code v} and
-     * returns {@code true} or does nothing and returns {@code false} if there is
-     * no currently associated value or it is not equal to given value {@code v}.
-     *
-     * @param cl the ClassLoader for the associated value
-     * @param v  the value to compare with currently associated value
-     * @return {@code true} if the association was removed or {@code false} if not
-     */
-    public boolean remove(ClassLoader cl, Object v) {
-        return AbstractClassLoaderValue.<CLV>map(cl).remove(this, v);
-    }
-
-    /**
-     * Returns the value associated with this ClassLoaderValue and given
-     * ClassLoader if there is one or computes the value by invoking given
-     * {@code mappingFunction}, associates it and returns it.
-     * <p>
-     * Computation and association of the computed value is performed atomically
-     * by the 1st thread that requests a particular association while holding a
-     * lock associated with this ClassLoaderValue and given ClassLoader.
-     * Nested calls from the {@code mappingFunction} to {@link #get},
-     * {@link #putIfAbsent} or {@link #computeIfAbsent} for the same association
-     * are not allowed and throw {@link IllegalStateException}. Nested call to
-     * {@link #remove} for the same association is allowed but will always return
-     * {@code false} regardless of passed-in comparison value. Nested calls for
-     * other association(s) are allowed, but care should be taken to avoid
-     * deadlocks. When two threads perform nested computations of the overlapping
-     * set of associations they should always request them in the same order.
-     *
-     * @param cl              the ClassLoader for the associated value
-     * @param mappingFunction the function to compute the value
-     * @return the value associated with this ClassLoaderValue and given
-     * ClassLoader.
-     * @throws IllegalStateException if a direct or indirect invocation from
-     *                               within given {@code mappingFunction} that
-     *                               computes the value of a particular association
-     *                               to {@link #get}, {@link #putIfAbsent} or
-     *                               {@link #computeIfAbsent}
-     *                               for the same association is attempted.
-     */
-    public V computeIfAbsent(ClassLoader cl,
-                             BiFunction<
-                                 ? super ClassLoader,
-                                 ? super CLV,
-                                 ? extends V
-                                 > mappingFunction) throws IllegalStateException {
-        ConcurrentHashMap<CLV, Object> map = map(cl);
-        @SuppressWarnings("unchecked")
-        CLV clv = (CLV) this;
-        Memoizer<CLV, V> mv = null;
-        while (true) {
-            Object val = (mv == null) ? map.get(clv) : map.putIfAbsent(clv, mv);
-            if (val == null) {
-                if (mv == null) {
-                    // create Memoizer lazily when 1st needed and restart loop
-                    mv = new Memoizer<>(cl, clv, mappingFunction);
-                    continue;
-                }
-                // mv != null, therefore sv == null was a result of successful
-                // putIfAbsent
-                try {
-                    // trigger Memoizer to compute the value
-                    V v = mv.get();
-                    // attempt to replace our Memoizer with the value
-                    map.replace(clv, mv, v);
-                    // return computed value
-                    return v;
-                } catch (Throwable t) {
-                    // our Memoizer has thrown, attempt to remove it
-                    map.remove(clv, mv);
-                    // propagate exception because it's from our Memoizer
-                    throw t;
-                }
-            } else {
-                try {
-                    return extractValue(val);
-                } catch (Memoizer.RecursiveInvocationException e) {
-                    // propagate recursive attempts to calculate the same
-                    // value as being calculated at the moment
-                    throw e;
-                } catch (Throwable t) {
-                    // don't propagate exceptions thrown from foreign Memoizer -
-                    // pretend that there was no entry and retry
-                    // (foreign computeIfAbsent invocation will try to remove it anyway)
-                }
-            }
-            // TODO:
-            // Thread.onSpinLoop(); // when available
-        }
-    }
-
-    /**
-     * Removes all values associated with given ClassLoader {@code cl} and
-     * {@link #isEqualOrDescendantOf(AbstractClassLoaderValue) this or descendants}
-     * of this ClassLoaderValue.
-     * This is not an atomic operation. Other threads may see some associations
-     * be already removed and others still present while this method is executing.
-     * <p>
-     * The sole intention of this method is to cleanup after a unit test that
-     * tests ClassLoaderValue directly. It is not intended for use in
-     * actual algorithms.
-     *
-     * @param cl the associated ClassLoader of the values to be removed
-     */
-    public void removeAll(ClassLoader cl) {
-        ConcurrentHashMap<CLV, Object> map = map(cl);
-        for (Iterator<CLV> i = map.keySet().iterator(); i.hasNext(); ) {
-            if (i.next().isEqualOrDescendantOf(this)) {
-                i.remove();
-            }
-        }
-    }
-
-    private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
-
-    /**
-     * @return a ConcurrentHashMap for given ClassLoader
-     */
-    @SuppressWarnings("unchecked")
-    private static <CLV extends AbstractClassLoaderValue<CLV, ?>>
-    ConcurrentHashMap<CLV, Object> map(ClassLoader cl) {
-        return (ConcurrentHashMap<CLV, Object>)
-            (cl == null ? BootLoader.getClassLoaderValueMap()
-                        : JLA.createOrGetClassLoaderValueMap(cl));
-    }
-
-    /**
-     * @return value extracted from the {@link Memoizer} if given
-     * {@code memoizerOrValue} parameter is a {@code Memoizer} or
-     * just return given parameter.
-     */
-    @SuppressWarnings("unchecked")
-    private V extractValue(Object memoizerOrValue) {
-        if (memoizerOrValue instanceof Memoizer) {
-            return ((Memoizer<?, V>) memoizerOrValue).get();
-        } else {
-            return (V) memoizerOrValue;
-        }
-    }
-
-    /**
-     * A memoized supplier that invokes given {@code mappingFunction} just once
-     * and remembers the result or thrown exception for subsequent calls.
-     * If given mappingFunction returns null, it is converted to NullPointerException,
-     * thrown from the Memoizer's {@link #get()} method and remembered.
-     * If the Memoizer is invoked recursively from the given {@code mappingFunction},
-     * {@link RecursiveInvocationException} is thrown, but it is not remembered.
-     * The in-flight call to the {@link #get()} can still complete successfully if
-     * such exception is handled by the mappingFunction.
-     */
-    private static final class Memoizer<CLV extends AbstractClassLoaderValue<CLV, V>, V>
-        implements Supplier<V> {
-
-        private final ClassLoader cl;
-        private final CLV clv;
-        private final BiFunction<? super ClassLoader, ? super CLV, ? extends V>
-            mappingFunction;
-
-        private volatile V v;
-        private volatile Throwable t;
-        private boolean inCall;
-
-        Memoizer(ClassLoader cl,
-                 CLV clv,
-                 BiFunction<? super ClassLoader, ? super CLV, ? extends V>
-                     mappingFunction
-        ) {
-            this.cl = cl;
-            this.clv = clv;
-            this.mappingFunction = mappingFunction;
-        }
-
-        @Override
-        public V get() throws RecursiveInvocationException {
-            V v = this.v;
-            if (v != null) return v;
-            Throwable t = this.t;
-            if (t == null) {
-                synchronized (this) {
-                    if ((v = this.v) == null && (t = this.t) == null) {
-                        if (inCall) {
-                            throw new RecursiveInvocationException();
-                        }
-                        inCall = true;
-                        try {
-                            this.v = v = Objects.requireNonNull(
-                                mappingFunction.apply(cl, clv));
-                        } catch (Throwable x) {
-                            this.t = t = x;
-                        } finally {
-                            inCall = false;
-                        }
-                    }
-                }
-            }
-            if (v != null) return v;
-            if (t instanceof Error) {
-                throw (Error) t;
-            } else if (t instanceof RuntimeException) {
-                throw (RuntimeException) t;
-            } else {
-                throw new UndeclaredThrowableException(t);
-            }
-        }
-
-        static class RecursiveInvocationException extends IllegalStateException {
-            private static final long serialVersionUID = 1L;
-
-            RecursiveInvocationException() {
-                super("Recursive call");
-            }
-        }
-    }
-
-    /**
-     * sub-ClassLoaderValue is an inner class of {@link AbstractClassLoaderValue}
-     * and also a subclass of it. It can therefore be instantiated as an inner
-     * class of either an instance of root-{@link ClassLoaderValue} or another
-     * instance of itself. This enables composing type-safe compound keys of
-     * arbitrary length:
-     * <pre>{@code
-     * ClassLoaderValue<V> clv = new ClassLoaderValue<>();
-     * ClassLoaderValue<V>.Sub<K1>.Sub<K2>.Sub<K3> clv_k123 =
-     *     clv.sub(k1).sub(k2).sub(k3);
-     * }</pre>
-     * From which individual components are accessible in a type-safe way:
-     * <pre>{@code
-     * K1 k1 = clv_k123.parent().parent().key();
-     * K2 k2 = clv_k123.parent().key();
-     * K3 k3 = clv_k123.key();
-     * }</pre>
-     * This allows specifying non-capturing lambdas for the mapping function of
-     * {@link #computeIfAbsent(ClassLoader, BiFunction)} operation that can
-     * access individual key components from passed-in
-     * sub-[sub-...]ClassLoaderValue instance in a type-safe way.
-     *
-     * @param <K> the type of {@link #key()} component contained in the
-     *            sub-ClassLoaderValue.
-     */
-    final class Sub<K> extends AbstractClassLoaderValue<Sub<K>, V> {
-
-        private final K key;
-
-        Sub(K key) {
-            this.key = key;
-        }
-
-        /**
-         * @return the parent ClassLoaderValue this sub-ClassLoaderValue
-         * has been {@link #sub(Object) derived} from.
-         */
-        public AbstractClassLoaderValue<CLV, V> parent() {
-            return AbstractClassLoaderValue.this;
-        }
-
-        /**
-         * @return the key component of this sub-ClassLoaderValue.
-         */
-        @Override
-        public K key() {
-            return key;
-        }
-
-        /**
-         * sub-ClassLoaderValue is a descendant of given {@code clv} if it is
-         * either equal to it or if its {@link #parent() parent} is a
-         * descendant of given {@code clv}.
-         */
-        @Override
-        public boolean isEqualOrDescendantOf(AbstractClassLoaderValue<?, V> clv) {
-            return equals(Objects.requireNonNull(clv)) ||
-                   parent().isEqualOrDescendantOf(clv);
-        }
-
-        @Override
-        public boolean equals(Object o) {
-            if (this == o) return true;
-            if (!(o instanceof Sub)) return false;
-            @SuppressWarnings("unchecked")
-            Sub<?> that = (Sub<?>) o;
-            return this.parent().equals(that.parent()) &&
-                   Objects.equals(this.key, that.key);
-        }
-
-        @Override
-        public int hashCode() {
-            return 31 * parent().hashCode() +
-                   Objects.hashCode(key);
-        }
-    }
-}
--- a/jdk/src/java.base/share/classes/java/lang/reflect/ClassLoaderValue.java	Thu Aug 18 21:34:24 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * 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.
- */
-
-package java.lang.reflect;
-
-import java.util.Objects;
-import java.util.function.BiFunction;
-
-/**
- * root-ClassLoaderValue. Each instance defines a separate namespace for
- * associated values.
- * <p>
- * ClassLoaderValue allows associating a
- * {@link #computeIfAbsent(ClassLoader, BiFunction) computed} non-null value with
- * a {@code (ClassLoader, keys...)} tuple. The associated value, as well as the
- * keys are strongly reachable from the associated ClassLoader so care should be
- * taken to use such keys and values that only reference types resolvable from
- * the associated ClassLoader. Failing that, ClassLoader leaks are inevitable.
- * <p>
- * Example usage:
- * <pre>{@code
- * // create a root instance which represents a namespace and declares the type of
- * // associated values (Class instances in this example)
- * static final ClassLoaderValue<Class<?>> proxyClasses = new ClassLoaderValue<>();
- *
- * // create a compound key composed of a Module and a list of interfaces
- * Module module = ...;
- * List<Class<?>> interfaces = ...;
- * ClassLoaderValue<Class<?>>.Sub<Module>.Sub<List<Class<?>>> key =
- *     proxyClasses.sub(module).sub(interfaces);
- *
- * // use the compound key together with ClassLoader to lazily associate
- * // the value with tuple (loader, module, interfaces) and return it
- * ClassLoader loader = ...;
- * Class<?> proxyClass = key.computeIfAbsent(loader, (ld, ky) -> {
- *     List<Class<?>> intfcs = ky.key();
- *     Module m = ky.parent().key();
- *     Class<?> clazz = defineProxyClass(ld, m, intfcs);
- *     return clazz;
- * });
- * }</pre>
- * <p>
- * {@code classLoaderValue.<operation>(classLoader, ...)} represents an operation
- * to {@link #get}, {@link #putIfAbsent}, {@link #computeIfAbsent} or {@link #remove}
- * a value associated with a (classLoader, classLoaderValue) tuple. ClassLoader
- * instances and root-{@link ClassLoaderValue} instances are compared using
- * identity equality while {@link Sub sub}-ClassLoaderValue instances define
- * {@link #equals(Object) equality} in terms of equality of its
- * {@link Sub#parent() parent} ClassLoaderValue and its
- * {@link #key() key} component.
- *
- * @param <V> the type of value(s) associated with the root-ClassLoaderValue and
- *            all its {@link #sub(Object) descendants}.
- * @author Peter Levart
- * @since 9
- */
-final class ClassLoaderValue<V>
-    extends AbstractClassLoaderValue<ClassLoaderValue<V>, V> {
-
-    /**
-     * Constructs new root-ClassLoaderValue representing its own namespace.
-     */
-    public ClassLoaderValue() {}
-
-    /**
-     * @return the key component of this root-ClassLoaderValue (itself).
-     */
-    @Override
-    public ClassLoaderValue<V> key() {
-        return this;
-    }
-
-    /**
-     * root-ClassLoaderValue can only be equal to itself and has no predecessors.
-     */
-    @Override
-    public boolean isEqualOrDescendantOf(AbstractClassLoaderValue<?, V> clv) {
-        return equals(Objects.requireNonNull(clv));
-    }
-}
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java	Wed Jul 05 22:06:46 2017 +0200
@@ -29,11 +29,9 @@
 import java.security.PrivilegedAction;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.Deque;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.IdentityHashMap;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -49,6 +47,7 @@
 import jdk.internal.misc.VM;
 import jdk.internal.reflect.CallerSensitive;
 import jdk.internal.reflect.Reflection;
+import jdk.internal.loader.ClassLoaderValue;
 import sun.reflect.misc.ReflectUtil;
 import sun.security.action.GetPropertyAction;
 import sun.security.util.SecurityConstants;
--- a/jdk/src/java.base/share/classes/java/security/AuthProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/security/AuthProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -50,9 +50,24 @@
      * @param name the provider name.
      * @param version the provider version number.
      * @param info a description of the provider and its services.
+     * @deprecated use {@link #AuthProvider(String, String, String)} instead.
      */
+    @Deprecated(since="9")
     protected AuthProvider(String name, double version, String info) {
-        super(name, version, info);
+        super(name, Double.toString(version), info);
+    }
+
+    /**
+     * Constructs a provider with the specified name, version string,
+     * and information.
+     *
+     * @param name the provider name.
+     * @param versionStr the provider version string.
+     * @param info a description of the provider and its services.
+     * @since 9
+     */
+    protected AuthProvider(String name, String versionStr, String info) {
+        super(name, versionStr, info);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/security/Provider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/security/Provider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -67,14 +67,14 @@
  * <tr><td>{@code Provider.id name}</td>
   *    <td>{@code String.valueOf(provider.getName())}</td>
  * <tr><td>{@code Provider.id version}</td>
- *     <td>{@code String.valueOf(provider.getVersion())}</td>
+ *     <td>{@code String.valueOf(provider.getVersionStr())}</td>
  * <tr><td>{@code Provider.id info}</td>
        <td>{@code String.valueOf(provider.getInfo())}</td>
  * <tr><td>{@code Provider.id className}</td>
  *     <td>{@code provider.getClass().getName()}</td>
  * </table>
  *
- * <p>Each provider has a name and a version number. A provider normally
+ * <p>Each provider has a name and a version string. A provider normally
  * identifies itself with a file named {@code java.security.Provider}
  * in the resource directory {@code META-INF/services}.
  * Security providers are looked up via the {@link ServiceLoader} mechanism
@@ -102,11 +102,10 @@
 public abstract class Provider extends Properties {
 
     // Declare serialVersionUID to be compatible with JDK1.1
-    static final long serialVersionUID = -4298000515446427739L;
+    private static final long serialVersionUID = -4298000515446427739L;
 
     private static final sun.security.util.Debug debug =
-        sun.security.util.Debug.getInstance
-        ("provider", "Provider");
+        sun.security.util.Debug.getInstance("provider", "Provider");
 
     /**
      * The provider name.
@@ -129,6 +128,12 @@
      */
     private double version;
 
+    /**
+     * The provider version string.
+     *
+     * @serial
+     */
+    private String versionStr;
 
     private transient Set<Map.Entry<Object,Object>> entrySet = null;
     private transient int entrySetCallCount = 0;
@@ -174,19 +179,83 @@
         }
     }
 
+    private static double parseVersionStr(String s) {
+        try {
+            int firstDotIdx = s.indexOf('.');
+            int nextDotIdx = s.indexOf('.', firstDotIdx + 1);
+            if (nextDotIdx != -1) {
+                s = s.substring(0, nextDotIdx);
+            }
+            int endIdx = s.indexOf('-');
+            if (endIdx > 0) {
+                s = s.substring(0, endIdx);
+            }
+            endIdx = s.indexOf('+');
+            if (endIdx > 0) {
+                s = s.substring(0, endIdx);
+            }
+            return Double.parseDouble(s);
+        } catch (NullPointerException | NumberFormatException e) {
+            return 0d;
+        }
+    }
+
     /**
      * Constructs a provider with the specified name, version number,
-     * and information.
+     * and information. Calling this constructor is equivalent to call the
+     * {@link #Provider(String, String, String)} with {@code name}
+     * name, {@code Double.toString(version)}, and {@code info}.
      *
      * @param name the provider name.
      *
      * @param version the provider version number.
      *
      * @param info a description of the provider and its services.
+     *
+     * @deprecated use {@link #Provider(String, String, String)} instead.
      */
+    @Deprecated(since="9")
     protected Provider(String name, double version, String info) {
         this.name = name;
         this.version = version;
+        this.versionStr = Double.toString(version);
+        this.info = info;
+        putId();
+        initialized = true;
+    }
+
+    /**
+     * Constructs a provider with the specified name, version string,
+     * and information.
+     *
+     * <p>The version string contains a version number optionally followed
+     * by other information separated by one of the characters of '+', '-'.
+     *
+     * The format for the version number is:
+     *
+     * <blockquote><pre>
+     *     ^[0-9]+(\.[0-9]+)*
+     * </pre></blockquote>
+     *
+     * <p>In order to return the version number in a double, when there are
+     * more than two components (separated by '.' as defined above), only
+     * the first two components are retained. The resulting string is then
+     * passed to {@link Double#valueOf(String)} to generate version number,
+     * i.e. {@link #getVersion}.
+     * <p>If the conversion failed, value 0 will be used.
+     *
+     * @param name the provider name.
+     *
+     * @param versionStr the provider version string.
+     *
+     * @param info a description of the provider and its services.
+     *
+     * @since 9
+     */
+    protected Provider(String name, String versionStr, String info) {
+        this.name = name;
+        this.versionStr = versionStr;
+        this.version = parseVersionStr(versionStr);
         this.info = info;
         putId();
         initialized = true;
@@ -250,12 +319,26 @@
      * Returns the version number for this provider.
      *
      * @return the version number for this provider.
+     *
+     * @deprecated use {@link #getVersionStr} instead.
      */
+    @Deprecated(since="9")
     public double getVersion() {
         return version;
     }
 
     /**
+     * Returns the version string for this provider.
+     *
+     * @return the version string for this provider.
+     *
+     * @since 9
+     */
+    public String getVersionStr() {
+        return versionStr;
+    }
+
+    /**
      * Returns a human-readable description of the provider and its
      * services.  This may return an HTML page, with relevant links.
      *
@@ -266,14 +349,14 @@
     }
 
     /**
-     * Returns a string with the name and the version number
+     * Returns a string with the name and the version string
      * of this provider.
      *
-     * @return the string with the name and the version number
+     * @return the string with the name and the version string
      * for this provider.
      */
     public String toString() {
-        return name + " version " + version;
+        return name + " version " + versionStr;
     }
 
     /*
@@ -601,7 +684,7 @@
     public synchronized Object compute(Object key, BiFunction<? super Object,
             ? super Object, ? extends Object> remappingFunction) {
         check("putProviderProperty." + name);
-        check("removeProviderProperty" + name);
+        check("removeProviderProperty." + name);
 
         if (debug != null) {
             debug.println("Compute " + name + " provider property " + key);
@@ -632,7 +715,7 @@
     public synchronized Object computeIfAbsent(Object key, Function<? super Object,
             ? extends Object> mappingFunction) {
         check("putProviderProperty." + name);
-        check("removeProviderProperty" + name);
+        check("removeProviderProperty." + name);
 
         if (debug != null) {
             debug.println("ComputeIfAbsent " + name + " provider property " +
@@ -662,7 +745,7 @@
     public synchronized Object computeIfPresent(Object key, BiFunction<? super Object,
             ? super Object, ? extends Object> remappingFunction) {
         check("putProviderProperty." + name);
-        check("removeProviderProperty" + name);
+        check("removeProviderProperty." + name);
 
         if (debug != null) {
             debug.println("ComputeIfPresent " + name + " provider property " +
@@ -695,7 +778,7 @@
     public synchronized Object merge(Object key, Object value,  BiFunction<? super Object,
             ? super Object, ? extends Object>  remappingFunction) {
         check("putProviderProperty." + name);
-        check("removeProviderProperty" + name);
+        check("removeProviderProperty." + name);
 
         if (debug != null) {
             debug.println("Merge " + name + " provider property " + key);
@@ -787,11 +870,21 @@
     private void putId() {
         // note: name and info may be null
         super.put("Provider.id name", String.valueOf(name));
-        super.put("Provider.id version", String.valueOf(version));
+        super.put("Provider.id version", String.valueOf(versionStr));
         super.put("Provider.id info", String.valueOf(info));
         super.put("Provider.id className", this.getClass().getName());
     }
 
+   /**
+    * Reads the {@code ObjectInputStream} for the default serializable fields.
+    * If the serialized field {@code versionStr} is found in the STREAM FIELDS,
+    * its String value will be used to populate both the version string and
+    * version number. If {@code versionStr} is not found, but {@code version}
+    * is, then its double value will be used to populate both fields.
+    *
+    * @param in the {@code ObjectInputStream} to read
+    * @serial
+    */
     private void readObject(ObjectInputStream in)
                 throws IOException, ClassNotFoundException {
         Map<Object,Object> copy = new HashMap<>();
@@ -800,6 +893,13 @@
         }
         defaults = null;
         in.defaultReadObject();
+        if (this.versionStr == null) {
+            // set versionStr based on version when not found in serialized bytes
+            this.versionStr = Double.toString(this.version);
+        } else {
+            // otherwise, set version based on versionStr
+            this.version = parseVersionStr(this.versionStr);
+        }
         implClear();
         initialized = true;
         putAll(copy);
@@ -904,8 +1004,8 @@
             if (!checkLegacy(key)) {
                 return null;
             }
-            legacyStrings.computeIfAbsent((String) key,
-                    (Function<? super String, ? extends String>) remappingFunction);
+            legacyStrings.compute((String) key,
+                    (BiFunction<? super String,? super String, ? extends String>) remappingFunction);
         }
         return super.compute(key, remappingFunction);
     }
@@ -1913,7 +2013,5 @@
             return provider.getName() + ": " + type + "." + algorithm
                 + " -> " + className + aString + attrs + "\r\n";
         }
-
     }
-
 }
--- a/jdk/src/java.base/share/classes/java/text/DateFormatSymbols.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/text/DateFormatSymbols.java	Wed Jul 05 22:06:46 2017 +0200
@@ -399,7 +399,10 @@
      * Calendar Elements in the Unicode Locale Data Markup Language
      * (LDML) specification</a> for more details.
      *
-     * @return the month strings.
+     * @return the month strings. Use
+     * {@link java.util.Calendar#JANUARY Calendar.JANUARY},
+     * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY},
+     * etc. to index the result array.
      */
     public String[] getMonths() {
         return Arrays.copyOf(months, months.length);
@@ -407,7 +410,9 @@
 
     /**
      * Sets month strings. For example: "January", "February", etc.
-     * @param newMonths the new month strings.
+     * @param newMonths the new month strings. The array should
+     * be indexed by {@link java.util.Calendar#JANUARY Calendar.JANUARY},
+     * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY}, etc.
      */
     public void setMonths(String[] newMonths) {
         months = Arrays.copyOf(newMonths, newMonths.length);
@@ -427,7 +432,10 @@
      * Calendar Elements in the Unicode Locale Data Markup Language
      * (LDML) specification</a> for more details.
      *
-     * @return the short month strings.
+     * @return the short month strings. Use
+     * {@link java.util.Calendar#JANUARY Calendar.JANUARY},
+     * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY},
+     * etc. to index the result array.
      */
     public String[] getShortMonths() {
         return Arrays.copyOf(shortMonths, shortMonths.length);
@@ -435,7 +443,9 @@
 
     /**
      * Sets short month strings. For example: "Jan", "Feb", etc.
-     * @param newShortMonths the new short month strings.
+     * @param newShortMonths the new short month strings. The array should
+     * be indexed by {@link java.util.Calendar#JANUARY Calendar.JANUARY},
+     * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY}, etc.
      */
     public void setShortMonths(String[] newShortMonths) {
         shortMonths = Arrays.copyOf(newShortMonths, newShortMonths.length);
@@ -444,8 +454,10 @@
 
     /**
      * Gets weekday strings. For example: "Sunday", "Monday", etc.
-     * @return the weekday strings. Use <code>Calendar.SUNDAY</code>,
-     * <code>Calendar.MONDAY</code>, etc. to index the result array.
+     * @return the weekday strings. Use
+     * {@link java.util.Calendar#SUNDAY Calendar.SUNDAY},
+     * {@link java.util.Calendar#MONDAY Calendar.MONDAY}, etc. to index
+     * the result array.
      */
     public String[] getWeekdays() {
         return Arrays.copyOf(weekdays, weekdays.length);
@@ -454,8 +466,8 @@
     /**
      * Sets weekday strings. For example: "Sunday", "Monday", etc.
      * @param newWeekdays the new weekday strings. The array should
-     * be indexed by <code>Calendar.SUNDAY</code>,
-     * <code>Calendar.MONDAY</code>, etc.
+     * be indexed by {@link java.util.Calendar#SUNDAY Calendar.SUNDAY},
+     * {@link java.util.Calendar#MONDAY Calendar.MONDAY}, etc.
      */
     public void setWeekdays(String[] newWeekdays) {
         weekdays = Arrays.copyOf(newWeekdays, newWeekdays.length);
@@ -464,8 +476,10 @@
 
     /**
      * Gets short weekday strings. For example: "Sun", "Mon", etc.
-     * @return the short weekday strings. Use <code>Calendar.SUNDAY</code>,
-     * <code>Calendar.MONDAY</code>, etc. to index the result array.
+     * @return the short weekday strings. Use
+     * {@link java.util.Calendar#SUNDAY Calendar.SUNDAY},
+     * {@link java.util.Calendar#MONDAY Calendar.MONDAY}, etc. to index
+     * the result array.
      */
     public String[] getShortWeekdays() {
         return Arrays.copyOf(shortWeekdays, shortWeekdays.length);
@@ -474,8 +488,8 @@
     /**
      * Sets short weekday strings. For example: "Sun", "Mon", etc.
      * @param newShortWeekdays the new short weekday strings. The array should
-     * be indexed by <code>Calendar.SUNDAY</code>,
-     * <code>Calendar.MONDAY</code>, etc.
+     * be indexed by {@link java.util.Calendar#SUNDAY Calendar.SUNDAY},
+     * {@link java.util.Calendar#MONDAY Calendar.MONDAY}, etc.
      */
     public void setShortWeekdays(String[] newShortWeekdays) {
         shortWeekdays = Arrays.copyOf(newShortWeekdays, newShortWeekdays.length);
--- a/jdk/src/java.base/share/classes/java/util/Date.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/Date.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -952,6 +952,9 @@
      * without affecting its internal state.
      */
     static final long getMillisOf(Date date) {
+        if (date.getClass() != Date.class) {
+            return date.getTime();
+        }
         if (date.cdate == null || date.cdate.isNormalized()) {
             return date.fastTime;
         }
--- a/jdk/src/java.base/share/classes/java/util/stream/Collectors.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/stream/Collectors.java	Wed Jul 05 22:06:46 2017 +0200
@@ -295,7 +295,13 @@
     public static <T>
     Collector<T, ?, Set<T>> toSet() {
         return new CollectorImpl<>((Supplier<Set<T>>) HashSet::new, Set::add,
-                                   (left, right) -> { left.addAll(right); return left; },
+                                   (left, right) -> {
+                                       if (left.size() < right.size()) {
+                                           right.addAll(left); return right;
+                                       } else {
+                                           left.addAll(right); return left;
+                                       }
+                                   },
                                    CH_UNORDERED_ID);
     }
 
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLEngine.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLEngine.java	Wed Jul 05 22:06:46 2017 +0200
@@ -861,6 +861,13 @@
      * be enabled by default, since this list may include cipher suites which
      * do not meet quality of service requirements for those defaults.  Such
      * cipher suites might be useful in specialized applications.
+     * <P>
+     * The returned array includes cipher suites from the list of standard
+     * cipher suite names in the <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation, and may also
+     * include other cipher suites that the provider supports.
      *
      * @return  an array of cipher suite names
      * @see     #getEnabledCipherSuites()
@@ -880,6 +887,13 @@
      * or the requisite certificates (and private keys) for the suite are
      * not available, or an anonymous suite is enabled but authentication
      * is required.
+     * <P>
+     * The returned array includes cipher suites from the list of standard
+     * cipher suite names in the <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation, and may also
+     * include other cipher suites that the provider supports.
      *
      * @return  an array of cipher suite names
      * @see     #getSupportedCipherSuites()
@@ -896,6 +910,14 @@
      * fail.  Following a successful call to this method, only suites
      * listed in the {@code suites} parameter are enabled for use.
      * <P>
+     * Note that the standard list of cipher suite names may be found in the
+     * <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation.  Providers
+     * may support cipher suite names not found in this list or might not
+     * use the recommended name for a certain cipher suite.
+     * <P>
      * See {@link #getEnabledCipherSuites()} for more information
      * on why a specific cipher suite may never be used on a engine.
      *
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLParameters.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLParameters.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -108,7 +108,12 @@
      * <p>
      * Calling this constructor is equivalent to calling the no-args
      * constructor followed by
-     * {@code setCipherSuites(cipherSuites);}.
+     * {@code setCipherSuites(cipherSuites);}.  Note that the
+     * standard list of cipher suite names may be found in the <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation.  Providers
+     * may support cipher suite names not found in this list.
      *
      * @param cipherSuites the array of ciphersuites (or null)
      */
@@ -123,6 +128,12 @@
      * Calling this constructor is equivalent to calling the no-args
      * constructor followed by
      * {@code setCipherSuites(cipherSuites); setProtocols(protocols);}.
+     * Note that the standard list of cipher suite names may be found in the
+     * <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation.  Providers
+     * may support cipher suite names not found in this list.
      *
      * @param cipherSuites the array of ciphersuites (or null)
      * @param protocols the array of protocols (or null)
@@ -139,6 +150,13 @@
     /**
      * Returns a copy of the array of ciphersuites or null if none
      * have been set.
+     * <P>
+     * The returned array includes cipher suites from the list of standard
+     * cipher suite names in the <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation, and may also
+     * include other cipher suites that the provider supports.
      *
      * @return a copy of the array of ciphersuites or null if none
      * have been set.
@@ -150,7 +168,13 @@
     /**
      * Sets the array of ciphersuites.
      *
-     * @param cipherSuites the array of ciphersuites (or null)
+     * @param cipherSuites the array of ciphersuites (or null).  Note that the
+     * standard list of cipher suite names may be found in the <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation.  Providers
+     * may support cipher suite names not found in this list or might not
+     * use the recommended name for a certain cipher suite.
      */
     public void setCipherSuites(String[] cipherSuites) {
         this.cipherSuites = clone(cipherSuites);
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java	Wed Jul 05 22:06:46 2017 +0200
@@ -195,6 +195,13 @@
      * or the requisite certificates (and private keys) for the suite are
      * not available, or an anonymous suite is enabled but authentication
      * is required.
+     * <P>
+     * The returned array includes cipher suites from the list of standard
+     * cipher suite names in the <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation, and may also
+     * include other cipher suites that the provider supports.
      *
      * @return an array of cipher suites enabled
      * @see #getSupportedCipherSuites()
@@ -215,6 +222,14 @@
      * in this ServerSocket's authentication context will not be used
      * in any case, even if they are enabled.
      * <P>
+     * Note that the standard list of cipher suite names may be found in the
+     * <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation.  Providers
+     * may support cipher suite names not found in this list or might not
+     * use the recommended name for a certain cipher suite.
+     * <P>
      * <code>SSLSocket</code>s returned from <code>accept()</code>
      * inherit this setting.
      *
@@ -236,6 +251,13 @@
      * be enabled by default, since this list may include cipher suites which
      * do not meet quality of service requirements for those defaults.  Such
      * cipher suites are useful in specialized applications.
+     * <P>
+     * The returned array includes cipher suites from the list of standard
+     * cipher suite names in the <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation, and may also
+     * include other cipher suites that the provider supports.
      *
      * @return an array of cipher suite names
      * @see #getEnabledCipherSuites()
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java	Wed Jul 05 22:06:46 2017 +0200
@@ -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.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -123,6 +123,13 @@
      * will use one of these cipher suites.  The minimum quality of service
      * for these defaults requires confidentiality protection and server
      * authentication (that is, no anonymous cipher suites).
+     * <P>
+     * The returned array includes cipher suites from the list of standard
+     * cipher suite names in the <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation, and may also
+     * include other cipher suites that the provider supports.
      *
      * @see #getSupportedCipherSuites()
      * @return array of the cipher suites enabled by default
@@ -137,6 +144,13 @@
      * be enabled by default, since this list may include cipher suites which
      * do not meet quality of service requirements for those defaults.  Such
      * cipher suites are useful in specialized applications.
+     * <P>
+     * The returned array includes cipher suites from the list of standard
+     * cipher suite names in the <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation, and may also
+     * include other cipher suites that the provider supports.
      *
      * @return an array of cipher suite names
      * @see #getDefaultCipherSuites()
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocket.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocket.java	Wed Jul 05 22:06:46 2017 +0200
@@ -265,6 +265,13 @@
      * be enabled by default, since this list may include cipher suites which
      * do not meet quality of service requirements for those defaults.  Such
      * cipher suites might be useful in specialized applications.
+     * <P>
+     * The returned array includes cipher suites from the list of standard
+     * cipher suite names in the <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation, and may also
+     * include other cipher suites that the provider supports.
      *
      * @return an array of cipher suite names
      * @see #getEnabledCipherSuites()
@@ -284,6 +291,13 @@
      * or the requisite certificates (and private keys) for the suite are
      * not available, or an anonymous suite is enabled but authentication
      * is required.
+     * <P>
+     * The returned array includes cipher suites from the list of standard
+     * cipher suite names in the <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation, and may also
+     * include other cipher suites that the provider supports.
      *
      * @return an array of cipher suite names
      * @see #getSupportedCipherSuites()
@@ -300,6 +314,14 @@
      * fail.  Following a successful call to this method, only suites
      * listed in the <code>suites</code> parameter are enabled for use.
      * <P>
+     * Note that the standard list of cipher suite names may be found in the
+     * <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation.  Providers
+     * may support cipher suite names not found in this list or might not
+     * use the recommended name for a certain cipher suite.
+     * <P>
      * See {@link #getEnabledCipherSuites()} for more information
      * on why a specific ciphersuite may never be used on a connection.
      *
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java	Wed Jul 05 22:06:46 2017 +0200
@@ -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.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -148,6 +148,13 @@
      * will use one of these cipher suites.  The minimum quality of service
      * for these defaults requires confidentiality protection and server
      * authentication (that is, no anonymous cipher suites).
+     * <P>
+     * The returned array includes cipher suites from the list of standard
+     * cipher suite names in the <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation, and may also
+     * include other cipher suites that the provider supports.
      *
      * @see #getSupportedCipherSuites()
      * @return array of the cipher suites enabled by default
@@ -160,6 +167,13 @@
      * be enabled by default, since this list may include cipher suites which
      * do not meet quality of service requirements for those defaults.  Such
      * cipher suites are useful in specialized applications.
+     * <P>
+     * The returned array includes cipher suites from the list of standard
+     * cipher suite names in the <a href=
+     * "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
+     * JSSE Cipher Suite Names</a> section of the Java Cryptography
+     * Architecture Standard Algorithm Name Documentation, and may also
+     * include other cipher suites that the provider supports.
      *
      * @see #getDefaultCipherSuites()
      * @return an array of cipher suite names
--- a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/jrtfsviewer.js	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/jrtfsviewer.js	Wed Jul 05 22:06:46 2017 +0200
@@ -53,6 +53,7 @@
 var Files = Java.type("java.nio.file.Files");
 var System = Java.type("java.lang.System");
 var URI = Java.type("java.net.URI");
+var Collections = Java.type("java.util.Collections");
 
 // JavaFX classes used
 var StackPane = Java.type("javafx.scene.layout.StackPane");
@@ -100,7 +101,7 @@
             print("did you miss specifying jrt-fs.jar with -cp option?");
             usage();
         }
-        return FileSystems.newFileSystem(uri, null, cls.classLoader);
+        return FileSystems.newFileSystem(uri, Collections.emptyMap(), cls.classLoader);
     }
 }
 
--- a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/jrtls.js	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/jrtls.js	Wed Jul 05 22:06:46 2017 +0200
@@ -34,7 +34,6 @@
  * but also compiled and delivered as part of the jrtfs.jar to support access
  * to the jimage file provided by the shipped JDK by tools running on JDK 8.
  */
- */
 
 // classes used
 var Files = Java.type("java.nio.file.Files");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/AbstractClassLoaderValue.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,431 @@
+/*
+ * 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.
+ */
+
+package jdk.internal.loader;
+
+import jdk.internal.misc.JavaLangAccess;
+import jdk.internal.misc.SharedSecrets;
+
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.BiFunction;
+import java.util.function.Supplier;
+
+/**
+ * AbstractClassLoaderValue is a superclass of root-{@link ClassLoaderValue}
+ * and {@link Sub sub}-ClassLoaderValue.
+ *
+ * @param <CLV> the type of concrete ClassLoaderValue (this type)
+ * @param <V>   the type of values associated with ClassLoaderValue
+ */
+public abstract class AbstractClassLoaderValue<CLV extends AbstractClassLoaderValue<CLV, V>, V> {
+
+    /**
+     * Sole constructor.
+     */
+    AbstractClassLoaderValue() {}
+
+    /**
+     * Returns the key component of this ClassLoaderValue. The key component of
+     * the root-{@link ClassLoaderValue} is the ClassLoaderValue itself,
+     * while the key component of a {@link #sub(Object) sub}-ClassLoaderValue
+     * is what was given to construct it.
+     *
+     * @return the key component of this ClassLoaderValue.
+     */
+    public abstract Object key();
+
+    /**
+     * Constructs new sub-ClassLoaderValue of this ClassLoaderValue with given
+     * key component.
+     *
+     * @param key the key component of the sub-ClassLoaderValue.
+     * @param <K> the type of the key component.
+     * @return a sub-ClassLoaderValue of this ClassLoaderValue for given key
+     */
+    public <K> Sub<K> sub(K key) {
+        return new Sub<>(key);
+    }
+
+    /**
+     * Returns {@code true} if this ClassLoaderValue is equal to given {@code clv}
+     * or if this ClassLoaderValue was derived from given {@code clv} by a chain
+     * of {@link #sub(Object)} invocations.
+     *
+     * @param clv the ClassLoaderValue to test this against
+     * @return if this ClassLoaderValue is equal to given {@code clv} or
+     * its descendant
+     */
+    public abstract boolean isEqualOrDescendantOf(AbstractClassLoaderValue<?, V> clv);
+
+    /**
+     * Returns the value associated with this ClassLoaderValue and given ClassLoader
+     * or {@code null} if there is none.
+     *
+     * @param cl the ClassLoader for the associated value
+     * @return the value associated with this ClassLoaderValue and given ClassLoader
+     * or {@code null} if there is none.
+     */
+    public V get(ClassLoader cl) {
+        Object val = AbstractClassLoaderValue.<CLV>map(cl).get(this);
+        try {
+            return extractValue(val);
+        } catch (Memoizer.RecursiveInvocationException e) {
+            // propagate recursive get() for the same key that is just
+            // being calculated in computeIfAbsent()
+            throw e;
+        } catch (Throwable t) {
+            // don't propagate exceptions thrown from Memoizer - pretend
+            // that there was no entry
+            // (computeIfAbsent invocation will try to remove it anyway)
+            return null;
+        }
+    }
+
+    /**
+     * Associates given value {@code v} with this ClassLoaderValue and given
+     * ClassLoader and returns {@code null} if there was no previously associated
+     * value or does nothing and returns previously associated value if there
+     * was one.
+     *
+     * @param cl the ClassLoader for the associated value
+     * @param v  the value to associate
+     * @return previously associated value or null if there was none
+     */
+    public V putIfAbsent(ClassLoader cl, V v) {
+        ConcurrentHashMap<CLV, Object> map = map(cl);
+        @SuppressWarnings("unchecked")
+        CLV clv = (CLV) this;
+        while (true) {
+            try {
+                Object val = map.putIfAbsent(clv, v);
+                return extractValue(val);
+            } catch (Memoizer.RecursiveInvocationException e) {
+                // propagate RecursiveInvocationException for the same key that
+                // is just being calculated in computeIfAbsent
+                throw e;
+            } catch (Throwable t) {
+                // don't propagate exceptions thrown from foreign Memoizer -
+                // pretend that there was no entry and retry
+                // (foreign computeIfAbsent invocation will try to remove it anyway)
+            }
+            // TODO:
+            // Thread.onSpinLoop(); // when available
+        }
+    }
+
+    /**
+     * Removes the value associated with this ClassLoaderValue and given
+     * ClassLoader if the associated value is equal to given value {@code v} and
+     * returns {@code true} or does nothing and returns {@code false} if there is
+     * no currently associated value or it is not equal to given value {@code v}.
+     *
+     * @param cl the ClassLoader for the associated value
+     * @param v  the value to compare with currently associated value
+     * @return {@code true} if the association was removed or {@code false} if not
+     */
+    public boolean remove(ClassLoader cl, Object v) {
+        return AbstractClassLoaderValue.<CLV>map(cl).remove(this, v);
+    }
+
+    /**
+     * Returns the value associated with this ClassLoaderValue and given
+     * ClassLoader if there is one or computes the value by invoking given
+     * {@code mappingFunction}, associates it and returns it.
+     * <p>
+     * Computation and association of the computed value is performed atomically
+     * by the 1st thread that requests a particular association while holding a
+     * lock associated with this ClassLoaderValue and given ClassLoader.
+     * Nested calls from the {@code mappingFunction} to {@link #get},
+     * {@link #putIfAbsent} or {@link #computeIfAbsent} for the same association
+     * are not allowed and throw {@link IllegalStateException}. Nested call to
+     * {@link #remove} for the same association is allowed but will always return
+     * {@code false} regardless of passed-in comparison value. Nested calls for
+     * other association(s) are allowed, but care should be taken to avoid
+     * deadlocks. When two threads perform nested computations of the overlapping
+     * set of associations they should always request them in the same order.
+     *
+     * @param cl              the ClassLoader for the associated value
+     * @param mappingFunction the function to compute the value
+     * @return the value associated with this ClassLoaderValue and given
+     * ClassLoader.
+     * @throws IllegalStateException if a direct or indirect invocation from
+     *                               within given {@code mappingFunction} that
+     *                               computes the value of a particular association
+     *                               to {@link #get}, {@link #putIfAbsent} or
+     *                               {@link #computeIfAbsent}
+     *                               for the same association is attempted.
+     */
+    public V computeIfAbsent(ClassLoader cl,
+                             BiFunction<
+                                 ? super ClassLoader,
+                                 ? super CLV,
+                                 ? extends V
+                                 > mappingFunction) throws IllegalStateException {
+        ConcurrentHashMap<CLV, Object> map = map(cl);
+        @SuppressWarnings("unchecked")
+        CLV clv = (CLV) this;
+        Memoizer<CLV, V> mv = null;
+        while (true) {
+            Object val = (mv == null) ? map.get(clv) : map.putIfAbsent(clv, mv);
+            if (val == null) {
+                if (mv == null) {
+                    // create Memoizer lazily when 1st needed and restart loop
+                    mv = new Memoizer<>(cl, clv, mappingFunction);
+                    continue;
+                }
+                // mv != null, therefore sv == null was a result of successful
+                // putIfAbsent
+                try {
+                    // trigger Memoizer to compute the value
+                    V v = mv.get();
+                    // attempt to replace our Memoizer with the value
+                    map.replace(clv, mv, v);
+                    // return computed value
+                    return v;
+                } catch (Throwable t) {
+                    // our Memoizer has thrown, attempt to remove it
+                    map.remove(clv, mv);
+                    // propagate exception because it's from our Memoizer
+                    throw t;
+                }
+            } else {
+                try {
+                    return extractValue(val);
+                } catch (Memoizer.RecursiveInvocationException e) {
+                    // propagate recursive attempts to calculate the same
+                    // value as being calculated at the moment
+                    throw e;
+                } catch (Throwable t) {
+                    // don't propagate exceptions thrown from foreign Memoizer -
+                    // pretend that there was no entry and retry
+                    // (foreign computeIfAbsent invocation will try to remove it anyway)
+                }
+            }
+            // TODO:
+            // Thread.onSpinLoop(); // when available
+        }
+    }
+
+    /**
+     * Removes all values associated with given ClassLoader {@code cl} and
+     * {@link #isEqualOrDescendantOf(AbstractClassLoaderValue) this or descendants}
+     * of this ClassLoaderValue.
+     * This is not an atomic operation. Other threads may see some associations
+     * be already removed and others still present while this method is executing.
+     * <p>
+     * The sole intention of this method is to cleanup after a unit test that
+     * tests ClassLoaderValue directly. It is not intended for use in
+     * actual algorithms.
+     *
+     * @param cl the associated ClassLoader of the values to be removed
+     */
+    public void removeAll(ClassLoader cl) {
+        ConcurrentHashMap<CLV, Object> map = map(cl);
+        for (Iterator<CLV> i = map.keySet().iterator(); i.hasNext(); ) {
+            if (i.next().isEqualOrDescendantOf(this)) {
+                i.remove();
+            }
+        }
+    }
+
+    private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
+
+    /**
+     * @return a ConcurrentHashMap for given ClassLoader
+     */
+    @SuppressWarnings("unchecked")
+    private static <CLV extends AbstractClassLoaderValue<CLV, ?>>
+    ConcurrentHashMap<CLV, Object> map(ClassLoader cl) {
+        return (ConcurrentHashMap<CLV, Object>)
+            (cl == null ? BootLoader.getClassLoaderValueMap()
+                        : JLA.createOrGetClassLoaderValueMap(cl));
+    }
+
+    /**
+     * @return value extracted from the {@link Memoizer} if given
+     * {@code memoizerOrValue} parameter is a {@code Memoizer} or
+     * just return given parameter.
+     */
+    @SuppressWarnings("unchecked")
+    private V extractValue(Object memoizerOrValue) {
+        if (memoizerOrValue instanceof Memoizer) {
+            return ((Memoizer<?, V>) memoizerOrValue).get();
+        } else {
+            return (V) memoizerOrValue;
+        }
+    }
+
+    /**
+     * A memoized supplier that invokes given {@code mappingFunction} just once
+     * and remembers the result or thrown exception for subsequent calls.
+     * If given mappingFunction returns null, it is converted to NullPointerException,
+     * thrown from the Memoizer's {@link #get()} method and remembered.
+     * If the Memoizer is invoked recursively from the given {@code mappingFunction},
+     * {@link RecursiveInvocationException} is thrown, but it is not remembered.
+     * The in-flight call to the {@link #get()} can still complete successfully if
+     * such exception is handled by the mappingFunction.
+     */
+    private static final class Memoizer<CLV extends AbstractClassLoaderValue<CLV, V>, V>
+        implements Supplier<V> {
+
+        private final ClassLoader cl;
+        private final CLV clv;
+        private final BiFunction<? super ClassLoader, ? super CLV, ? extends V>
+            mappingFunction;
+
+        private volatile V v;
+        private volatile Throwable t;
+        private boolean inCall;
+
+        Memoizer(ClassLoader cl,
+                 CLV clv,
+                 BiFunction<? super ClassLoader, ? super CLV, ? extends V>
+                     mappingFunction
+        ) {
+            this.cl = cl;
+            this.clv = clv;
+            this.mappingFunction = mappingFunction;
+        }
+
+        @Override
+        public V get() throws RecursiveInvocationException {
+            V v = this.v;
+            if (v != null) return v;
+            Throwable t = this.t;
+            if (t == null) {
+                synchronized (this) {
+                    if ((v = this.v) == null && (t = this.t) == null) {
+                        if (inCall) {
+                            throw new RecursiveInvocationException();
+                        }
+                        inCall = true;
+                        try {
+                            this.v = v = Objects.requireNonNull(
+                                mappingFunction.apply(cl, clv));
+                        } catch (Throwable x) {
+                            this.t = t = x;
+                        } finally {
+                            inCall = false;
+                        }
+                    }
+                }
+            }
+            if (v != null) return v;
+            if (t instanceof Error) {
+                throw (Error) t;
+            } else if (t instanceof RuntimeException) {
+                throw (RuntimeException) t;
+            } else {
+                throw new UndeclaredThrowableException(t);
+            }
+        }
+
+        static class RecursiveInvocationException extends IllegalStateException {
+            private static final long serialVersionUID = 1L;
+
+            RecursiveInvocationException() {
+                super("Recursive call");
+            }
+        }
+    }
+
+    /**
+     * sub-ClassLoaderValue is an inner class of {@link AbstractClassLoaderValue}
+     * and also a subclass of it. It can therefore be instantiated as an inner
+     * class of either an instance of root-{@link ClassLoaderValue} or another
+     * instance of itself. This enables composing type-safe compound keys of
+     * arbitrary length:
+     * <pre>{@code
+     * ClassLoaderValue<V> clv = new ClassLoaderValue<>();
+     * ClassLoaderValue<V>.Sub<K1>.Sub<K2>.Sub<K3> clv_k123 =
+     *     clv.sub(k1).sub(k2).sub(k3);
+     * }</pre>
+     * From which individual components are accessible in a type-safe way:
+     * <pre>{@code
+     * K1 k1 = clv_k123.parent().parent().key();
+     * K2 k2 = clv_k123.parent().key();
+     * K3 k3 = clv_k123.key();
+     * }</pre>
+     * This allows specifying non-capturing lambdas for the mapping function of
+     * {@link #computeIfAbsent(ClassLoader, BiFunction)} operation that can
+     * access individual key components from passed-in
+     * sub-[sub-...]ClassLoaderValue instance in a type-safe way.
+     *
+     * @param <K> the type of {@link #key()} component contained in the
+     *            sub-ClassLoaderValue.
+     */
+    public final class Sub<K> extends AbstractClassLoaderValue<Sub<K>, V> {
+
+        private final K key;
+
+        Sub(K key) {
+            this.key = key;
+        }
+
+        /**
+         * @return the parent ClassLoaderValue this sub-ClassLoaderValue
+         * has been {@link #sub(Object) derived} from.
+         */
+        public AbstractClassLoaderValue<CLV, V> parent() {
+            return AbstractClassLoaderValue.this;
+        }
+
+        /**
+         * @return the key component of this sub-ClassLoaderValue.
+         */
+        @Override
+        public K key() {
+            return key;
+        }
+
+        /**
+         * sub-ClassLoaderValue is a descendant of given {@code clv} if it is
+         * either equal to it or if its {@link #parent() parent} is a
+         * descendant of given {@code clv}.
+         */
+        @Override
+        public boolean isEqualOrDescendantOf(AbstractClassLoaderValue<?, V> clv) {
+            return equals(Objects.requireNonNull(clv)) ||
+                   parent().isEqualOrDescendantOf(clv);
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) return true;
+            if (!(o instanceof Sub)) return false;
+            @SuppressWarnings("unchecked")
+            Sub<?> that = (Sub<?>) o;
+            return this.parent().equals(that.parent()) &&
+                   Objects.equals(this.key, that.key);
+        }
+
+        @Override
+        public int hashCode() {
+            return 31 * parent().hashCode() +
+                   Objects.hashCode(key);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaderValue.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,100 @@
+/*
+ * 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.
+ */
+
+package jdk.internal.loader;
+
+import java.util.Objects;
+import java.util.function.BiFunction;
+
+/**
+ * root-ClassLoaderValue. Each instance defines a separate namespace for
+ * associated values.
+ * <p>
+ * ClassLoaderValue allows associating a
+ * {@link #computeIfAbsent(ClassLoader, BiFunction) computed} non-null value with
+ * a {@code (ClassLoader, keys...)} tuple. The associated value, as well as the
+ * keys are strongly reachable from the associated ClassLoader so care should be
+ * taken to use such keys and values that only reference types resolvable from
+ * the associated ClassLoader. Failing that, ClassLoader leaks are inevitable.
+ * <p>
+ * Example usage:
+ * <pre>{@code
+ * // create a root instance which represents a namespace and declares the type of
+ * // associated values (Class instances in this example)
+ * static final ClassLoaderValue<Class<?>> proxyClasses = new ClassLoaderValue<>();
+ *
+ * // create a compound key composed of a Module and a list of interfaces
+ * Module module = ...;
+ * List<Class<?>> interfaces = ...;
+ * ClassLoaderValue<Class<?>>.Sub<Module>.Sub<List<Class<?>>> key =
+ *     proxyClasses.sub(module).sub(interfaces);
+ *
+ * // use the compound key together with ClassLoader to lazily associate
+ * // the value with tuple (loader, module, interfaces) and return it
+ * ClassLoader loader = ...;
+ * Class<?> proxyClass = key.computeIfAbsent(loader, (ld, ky) -> {
+ *     List<Class<?>> intfcs = ky.key();
+ *     Module m = ky.parent().key();
+ *     Class<?> clazz = defineProxyClass(ld, m, intfcs);
+ *     return clazz;
+ * });
+ * }</pre>
+ * <p>
+ * {@code classLoaderValue.<operation>(classLoader, ...)} represents an operation
+ * to {@link #get}, {@link #putIfAbsent}, {@link #computeIfAbsent} or {@link #remove}
+ * a value associated with a (classLoader, classLoaderValue) tuple. ClassLoader
+ * instances and root-{@link ClassLoaderValue} instances are compared using
+ * identity equality while {@link Sub sub}-ClassLoaderValue instances define
+ * {@link #equals(Object) equality} in terms of equality of its
+ * {@link Sub#parent() parent} ClassLoaderValue and its
+ * {@link #key() key} component.
+ *
+ * @param <V> the type of value(s) associated with the root-ClassLoaderValue and
+ *            all its {@link #sub(Object) descendants}.
+ * @author Peter Levart
+ * @since 9
+ */
+public final class ClassLoaderValue<V>
+    extends AbstractClassLoaderValue<ClassLoaderValue<V>, V> {
+
+    /**
+     * Constructs new root-ClassLoaderValue representing its own namespace.
+     */
+    public ClassLoaderValue() {}
+
+    /**
+     * @return the key component of this root-ClassLoaderValue (itself).
+     */
+    @Override
+    public ClassLoaderValue<V> key() {
+        return this;
+    }
+
+    /**
+     * root-ClassLoaderValue can only be equal to itself and has no predecessors.
+     */
+    @Override
+    public boolean isEqualOrDescendantOf(AbstractClassLoaderValue<?, V> clv) {
+        return equals(Objects.requireNonNull(clv));
+    }
+}
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangInvokeAccess.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangInvokeAccess.java	Wed Jul 05 22:06:46 2017 +0200
@@ -51,8 +51,17 @@
      * an {@code int} representing method type.  Used by
      * GenerateJLIClassesPlugin to generate such a class during the jlink phase.
      */
-    byte[] generateDMHClassBytes(String className, MethodType[] methodTypes,
-            int[] types);
+    byte[] generateDirectMethodHandleHolderClassBytes(String className,
+            MethodType[] methodTypes, int[] types);
+
+    /**
+     * Returns a {@code byte[]} containing the bytecode for a class implementing
+     * DelegatingMethodHandles of each {@code MethodType} kind in the
+     * {@code methodTypes} argument.  Used by GenerateJLIClassesPlugin to
+     * generate such a class during the jlink phase.
+     */
+    byte[] generateDelegatingMethodHandleHolderClassBytes(String className,
+            MethodType[] methodTypes);
 
     /**
      * Returns a {@code byte[]} containing the bytecode for a BoundMethodHandle
@@ -63,4 +72,10 @@
      */
     Map.Entry<String, byte[]> generateConcreteBMHClassBytes(
             final String types);
+
+    /**
+     * Returns a {@code byte[]} containing the bytecode for a class implementing
+     * the zero and identity forms of all {@code LambdaForm.BasicType}s.
+     */
+    byte[] generateBasicFormsClassBytes(final String className);
 }
--- a/jdk/src/java.base/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -24,9 +24,8 @@
  */
 
 /**
- * java.base defines and exports the core APIs of the Java SE platform.
+ * Defines the foundational APIs of the Java SE Platform.
  */
-
 module java.base {
 
     exports java.io;
--- a/jdk/src/java.base/share/classes/sun/security/jca/ProviderList.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/jca/ProviderList.java	Wed Jul 05 22:06:46 2017 +0200
@@ -76,7 +76,7 @@
     // dummy provider object to use during initialization
     // used to avoid explicit null checks in various places
     private static final Provider EMPTY_PROVIDER =
-        new Provider("##Empty##", 1.0d, "initialization in progress") {
+        new Provider("##Empty##", "1.0", "initialization in progress") {
             private static final long serialVersionUID = 1151354171352296389L;
             // override getService() to return null slightly faster
             public Service getService(String type, String algorithm) {
--- a/jdk/src/java.base/share/classes/sun/security/provider/MD4.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/provider/MD4.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -28,6 +28,7 @@
 import java.security.*;
 
 import static sun.security.provider.ByteArrayAccess.*;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
 
 /**
  * The MD4 class is used to compute an MD4 message digest over a given
@@ -65,7 +66,8 @@
     private static final Provider md4Provider;
 
     static {
-        md4Provider = new Provider("MD4Provider", 9.0d, "MD4 MessageDigest") {
+        md4Provider = new Provider("MD4Provider", PROVIDER_VER,
+            "MD4 MessageDigest") {
             private static final long serialVersionUID = -8850464997518327965L;
         };
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
--- a/jdk/src/java.base/share/classes/sun/security/provider/Sun.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/provider/Sun.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -29,6 +29,8 @@
 import java.security.*;
 
 import sun.security.action.PutAllAction;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
+
 
 /**
  * The SUN Security Provider.
@@ -47,7 +49,7 @@
 
     public Sun() {
         /* We are the SUN provider */
-        super("SUN", 9.0d, INFO);
+        super("SUN", PROVIDER_VER, INFO);
 
         // if there is no security manager installed, put directly into
         // the provider. Otherwise, create a temporary map and use a
--- a/jdk/src/java.base/share/classes/sun/security/provider/VerificationProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/provider/VerificationProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -31,6 +31,8 @@
 import sun.security.action.PutAllAction;
 
 import sun.security.rsa.SunRsaSignEntries;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
+
 
 /**
  * Provider used for verification of signed JAR files *if* the Sun and
@@ -61,7 +63,7 @@
     }
 
     public VerificationProvider() {
-        super("SunJarVerification", 9.0d, "Jar Verification Provider");
+        super("SunJarVerification", PROVIDER_VER, "Jar Verification Provider");
         // register all algorithms normally registered by the Sun and SunRsaSign
         // providers, but only if they are missing
         if (ACTIVE == false) {
--- a/jdk/src/java.base/share/classes/sun/security/rsa/SunRsaSign.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/rsa/SunRsaSign.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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,6 +30,7 @@
 import java.security.*;
 
 import sun.security.action.PutAllAction;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
 
 /**
  * Provider class for the RSA signature provider. Supports RSA keyfactory,
@@ -43,7 +44,7 @@
     private static final long serialVersionUID = 866040293550393045L;
 
     public SunRsaSign() {
-        super("SunRsaSign", 9.0d, "Sun RSA signature provider");
+        super("SunRsaSign", PROVIDER_VER, "Sun RSA signature provider");
 
         // if there is no security manager installed, put directly into
         // the provider. Otherwise, create a temporary map and use a
--- a/jdk/src/java.base/share/classes/sun/security/ssl/JsseJce.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/JsseJce.java	Wed Jul 05 22:06:46 2017 +0200
@@ -44,6 +44,7 @@
 import sun.security.util.ECUtil;
 
 import static sun.security.ssl.SunJSSE.cryptoProvider;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
 
 /**
  * This class contains a few static methods for interaction with the JCA/JCE
@@ -90,7 +91,7 @@
         private static final long serialVersionUID = -3284138292032213752L;
 
         SunCertificates(final Provider p) {
-            super("SunCertificates", 9.0d, "SunJSSE internal");
+            super("SunCertificates", PROVIDER_VER, "SunJSSE internal");
             AccessController.doPrivileged(new PrivilegedAction<Object>() {
                 @Override
                 public Object run() {
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SunJSSE.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SunJSSE.java	Wed Jul 05 22:06:46 2017 +0200
@@ -27,6 +27,7 @@
 package sun.security.ssl;
 
 import java.security.*;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
 
 /**
  * The JSSE provider.
@@ -104,7 +105,7 @@
 
     // standard constructor
     protected SunJSSE() {
-        super("SunJSSE", 9.0d, info);
+        super("SunJSSE", PROVIDER_VER, info);
         subclassCheck();
         if (Boolean.TRUE.equals(fips)) {
             throw new ProviderException
@@ -132,7 +133,7 @@
 
     private SunJSSE(java.security.Provider cryptoProvider,
             String providerName) {
-        super("SunJSSE", 9.0d, fipsInfo + providerName + ")");
+        super("SunJSSE", PROVIDER_VER, fipsInfo + providerName + ")");
         subclassCheck();
         if (cryptoProvider == null) {
             // Calling Security.getProvider() will cause other providers to be
--- a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Wed Jul 05 22:06:46 2017 +0200
@@ -3631,8 +3631,8 @@
                 if (time != null) {
                     if (time.matches("\\d\\d:\\d\\d:\\d\\d")) {
                         c.set(Calendar.HOUR_OF_DAY, Integer.valueOf(time.substring(0, 2)));
-                        c.set(Calendar.MINUTE, Integer.valueOf(time.substring(0, 2)));
-                        c.set(Calendar.SECOND, Integer.valueOf(time.substring(0, 2)));
+                        c.set(Calendar.MINUTE, Integer.valueOf(time.substring(3, 5)));
+                        c.set(Calendar.SECOND, Integer.valueOf(time.substring(6, 8)));
                         c.set(Calendar.MILLISECOND, 0);
                     } else {
                         throw ioe;
--- a/jdk/src/java.base/share/classes/sun/security/util/SecurityConstants.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/util/SecurityConstants.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -33,6 +33,7 @@
 import java.security.BasicPermission;
 import java.security.SecurityPermission;
 import java.security.AllPermission;
+import sun.security.action.GetPropertyAction;
 
 /**
  * Permission constants and string constants used to create permissions
@@ -145,4 +146,7 @@
     // java.lang.SecurityManager
     public static final SocketPermission LOCAL_LISTEN_PERMISSION =
         new SocketPermission("localhost:0", SOCKET_LISTEN_ACTION);
+
+    public static final String PROVIDER_VER =
+        GetPropertyAction.privilegedGetProperty("java.specification.version");
 }
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -143,8 +143,8 @@
         defaultLocaleProviderAdapter = Type.CLDR;
         if (!typeList.isEmpty()) {
             // bona fide preference exists
-            if (!typeList.contains(Type.CLDR)) {
-                // Append FALLBACK as the last resort.
+            if (!(typeList.contains(Type.CLDR) || (typeList.contains(Type.JRE)))) {
+                // Append FALLBACK as the last resort when no ResourceBundleBasedAdapter is available.
                 typeList.add(Type.FALLBACK);
                 defaultLocaleProviderAdapter = Type.FALLBACK;
             }
--- a/jdk/src/java.compact1/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.compact1/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,9 @@
  * questions.
  */
 
+/**
+ * Aggregates {@code java.base}, {@code java.logging}, and {@code java.scripting}.
+ */
 module java.compact1 {
     requires public java.logging;
     requires public java.scripting;
--- a/jdk/src/java.compact2/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.compact2/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,9 @@
  * questions.
  */
 
+/**
+ * Supplements {@code java.compact1} with JDBC, JAXP, and RMI.
+ */
 module java.compact2 {
     requires public java.compact1;
     requires public java.rmi;
--- a/jdk/src/java.compact3/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.compact3/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,10 @@
  * questions.
  */
 
+/**
+ * Supplements {@code java.compact2} with JDBC RowSet, JMX, JNDI, Compiler,
+ * Instrumentation, Preferences, Security, and XML cryptography APIs.
+ */
 module java.compact3 {
     requires public java.compact2;
     requires public java.compiler;
--- a/jdk/src/java.datatransfer/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.datatransfer/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -24,10 +24,8 @@
  */
 
 /**
- * Provides interfaces and classes for transferring data between and
- * within applications.
+ * Defines an API for transferring data between and within applications.
  */
-
 module java.datatransfer {
     exports java.awt.datatransfer;
     exports sun.datatransfer to java.desktop;
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaProgressBarUI.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaProgressBarUI.java	Wed Jul 05 22:06:46 2017 +0200
@@ -124,7 +124,9 @@
             if (!progressBar.isIndeterminate()) return;
             stopAnimationTimer();
             // start the animation thread
-            startAnimationTimer();
+            if (progressBar.isDisplayable()) {
+              startAnimationTimer();
+            }
         }
 
         if ("JProgressBar.style".equals(prop)) {
@@ -141,7 +143,9 @@
 
     public void ancestorAdded(final AncestorEvent e) {
         if (!progressBar.isIndeterminate()) return;
-        startAnimationTimer();
+        if (progressBar.isDisplayable()) {
+          startAnimationTimer();
+        }
     }
 
     public void ancestorMoved(final AncestorEvent e) { }
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m	Wed Jul 05 22:06:46 2017 +0200
@@ -807,6 +807,18 @@
 
 - (void)sendEvent:(NSEvent *)event {
         if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) {
+            // Move parent windows to front and make sure that a child window is displayed
+            // in front of its nearest parent.
+            if (self.ownerWindow != nil) {
+                JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
+                jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
+                if (platformWindow != NULL) {
+                    static JNF_MEMBER_CACHE(jm_orderAboveSiblings, jc_CPlatformWindow, "orderAboveSiblings", "()V");
+                    JNFCallVoidMethod(env,platformWindow, jm_orderAboveSiblings);
+                    (*env)->DeleteLocalRef(env, platformWindow);
+                }
+            }
+            [self orderChildWindows:YES];
 
             NSPoint p = [NSEvent mouseLocation];
             NSRect frame = [self.nsWindow frame];
@@ -1159,6 +1171,16 @@
     NSWindow *nsWindow = OBJC(windowPtr);
     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
         [nsWindow orderBack:nil];
+        // Order parent windows
+        AWTWindow *awtWindow = (AWTWindow*)[nsWindow delegate];
+        while (awtWindow.ownerWindow != nil) {
+            awtWindow = awtWindow.ownerWindow;
+            if ([AWTWindow isJavaPlatformWindowVisible:awtWindow.nsWindow]) {
+                [awtWindow.nsWindow orderBack:nil];
+            }
+        }
+        // Order child windows
+        [(AWTWindow*)[nsWindow delegate] orderChildWindows:NO];
     }];
 
 JNF_COCOA_EXIT(env);
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFColorConverter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFColorConverter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -47,7 +47,7 @@
      * @throws NullPointerException if {@code result} is
      * {@code null}.
      * @throws ArrayIndexOutOfBoundsException if
-     * {@code result.length&nbsp;&lt;&nbsp;3}.
+     * {@code result.length < 3}.
      */
     public abstract void fromRGB(float r, float g, float b, float[] result);
 
@@ -63,7 +63,7 @@
      * @throws NullPointerException if {@code rgb} is
      * {@code null}.
      * @throws ArrayIndexOutOfBoundsException if
-     * {@code rgb.length&nbsp;&lt;&nbsp;3}.
+     * {@code rgb.length < 3}.
      */
     public abstract void toRGB(float x0, float x1, float x2, float[] rgb);
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDecompressor.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDecompressor.java	Wed Jul 05 22:06:46 2017 +0200
@@ -353,7 +353,7 @@
      * <p> The pixels in the source region to be copied are
      * those with X coordinates of the form {@code activeSrcMinX +
      * k*subsampleX}, where {@code k} is an integer such
-     * that {@code 0 &le; k &lt; dstWidth}.
+     * that {@code 0 <= k < dstWidth}.
      */
     protected int activeSrcMinX;
 
@@ -365,7 +365,7 @@
      * <p> The pixels in the source region to be copied are
      * those with Y coordinates of the form {@code activeSrcMinY +
      * k*subsampleY}, where {@code k} is an integer such
-     * that {@code 0 &le; k &lt; dstHeight}.
+     * that {@code 0 <= k < dstHeight}.
      */
     protected int activeSrcMinY;
 
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFIFD.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFIFD.java	Wed Jul 05 22:06:46 2017 +0200
@@ -49,6 +49,45 @@
     private long stripOrTileOffsetsPosition = -1;
     private long lastPosition = -1;
 
+
+    /**
+     * Converts a {@code TIFFDirectory} to a {@code TIFFIFD}.
+     */
+    public static TIFFIFD getDirectoryAsIFD(TIFFDirectory dir) {
+        if(dir instanceof TIFFIFD) {
+            return (TIFFIFD)dir;
+        }
+
+        TIFFIFD ifd = new TIFFIFD(Arrays.asList(dir.getTagSets()),
+                                  dir.getParentTag());
+        TIFFField[] fields = dir.getTIFFFields();
+        int numFields = fields.length;
+        for(int i = 0; i < numFields; i++) {
+            TIFFField f = fields[i];
+            TIFFTag tag = f.getTag();
+            if(tag.isIFDPointer()) {
+                TIFFDirectory subDir = null;
+                if (f.hasDirectory()) {
+                    subDir = f.getDirectory();
+                } else if (f.getData() instanceof TIFFDirectory) {
+                    subDir = (TIFFDirectory)f.getData();
+                }
+                if (subDir != null) {
+                    TIFFDirectory subIFD = getDirectoryAsIFD(subDir);
+                    f = new TIFFField(tag, f.getType(), (long)f.getCount(),
+                                      subIFD);
+                } else {
+                    f = null;
+                }
+            }
+            if (f != null) {
+                ifd.addTIFFField(f);
+            }
+        }
+
+        return ifd;
+    }
+
     public static TIFFTag getTag(int tagNumber, List<TIFFTagSet> tagSets) {
         Iterator<TIFFTagSet> iter = tagSets.iterator();
         while (iter.hasNext()) {
@@ -704,7 +743,7 @@
                 pos = nextSpace;
 
                 if (tag.isIFDPointer() && f.hasDirectory()) {
-                    TIFFIFD subIFD = (TIFFIFD)f.getDirectory();
+                    TIFFIFD subIFD = getDirectoryAsIFD(f.getDirectory());
                     subIFD.writeToStream(stream);
                     nextSpace = subIFD.lastPosition;
                 } else {
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java	Wed Jul 05 22:06:46 2017 +0200
@@ -132,7 +132,7 @@
             if (tag == null) {
                 node = f.getAsNativeNode();
             } else if (tag.isIFDPointer() && f.hasDirectory()) {
-                TIFFIFD subIFD = (TIFFIFD)f.getDirectory();
+                TIFFIFD subIFD = TIFFIFD.getDirectoryAsIFD(f.getDirectory());
 
                 // Recurse
                 node = getIFDAsTree(subIFD, tag.getName(), tag.getNumber());
@@ -1465,8 +1465,14 @@
                 String className = st.nextToken();
 
                 Object o = null;
+                Class<?> setClass = null;
                 try {
-                    Class<?> setClass = Class.forName(className);
+                    ClassLoader cl = TIFFImageMetadata.class.getClassLoader();
+                    setClass = Class.forName(className, false, cl);
+                    if (!TIFFTagSet.class.isAssignableFrom(setClass)) {
+                        fatal(node, "TagSets in IFD must be subset of"
+                                + " TIFFTagSet class");
+                    }
                     Method getInstanceMethod =
                         setClass.getMethod("getInstance", (Class[])null);
                     o = getInstanceMethod.invoke(null, (Object[])null);
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java	Wed Jul 05 22:06:46 2017 +0200
@@ -35,6 +35,7 @@
 import java.awt.image.Raster;
 import java.awt.image.RenderedImage;
 import java.awt.image.SampleModel;
+import java.io.EOFException;
 import java.io.IOException;
 import java.nio.ByteOrder;
 import java.util.ArrayList;
@@ -189,8 +190,8 @@
 
             // Seek to start of first IFD
             long offset = stream.readUnsignedInt();
+            stream.seek(offset);
             imageStartPosition.add(Long.valueOf(offset));
-            stream.seek(offset);
         } catch (IOException e) {
             throw new IIOException("I/O error reading header!", e);
         }
@@ -201,10 +202,10 @@
     private int locateImage(int imageIndex) throws IIOException {
         readHeader();
 
+        // Find closest known index
+        int index = Math.min(imageIndex, imageStartPosition.size() - 1);
+
         try {
-            // Find closest known index
-            int index = Math.min(imageIndex, imageStartPosition.size() - 1);
-
             // Seek to that position
             Long l = imageStartPosition.get(index);
             stream.seek(l.longValue());
@@ -212,6 +213,11 @@
             // Skip IFDs until at desired index or last image found
             while (index < imageIndex) {
                 int count = stream.readUnsignedShort();
+                // If zero-entry IFD, decrement the index and exit the loop
+                if (count == 0) {
+                    imageIndex = index > 0 ? index - 1 : 0;
+                    break;
+                }
                 stream.skipBytes(12 * count);
 
                 long offset = stream.readUnsignedInt();
@@ -219,12 +225,17 @@
                     return index;
                 }
 
+                stream.seek(offset);
                 imageStartPosition.add(Long.valueOf(offset));
-                stream.seek(offset);
                 ++index;
             }
-        } catch (IOException e) {
-            throw new IIOException("Couldn't seek!", e);
+        } catch (EOFException eofe) {
+            forwardWarningMessage("Ignored " + eofe);
+
+            // Ran off the end of stream: decrement index
+            imageIndex = index > 0 ? index - 1 : 0;
+        } catch (IOException ioe) {
+            throw new IIOException("Couldn't seek!", ioe);
         }
 
         if (currIndex != imageIndex) {
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1478,7 +1478,7 @@
                 (ExifParentTIFFTagSet.TAG_EXIF_IFD_POINTER);
             if(f != null && f.hasDirectory()) {
                 // Retrieve the Exif IFD.
-                exifIFD = (TIFFIFD)f.getDirectory();
+                exifIFD = TIFFIFD.getDirectoryAsIFD(f.getDirectory());
             } else if(isPrimaryIFD) {
                 // Create the Exif IFD.
                 List<TIFFTagSet> exifTagSets = new ArrayList<TIFFTagSet>(1);
@@ -3622,6 +3622,8 @@
         streamMetadata = null;
         imageMetadata = null;
 
+        isRescaling = false;
+
         isWritingSequence = false;
         isWritingEmpty = false;
         isInsertingEmpty = false;
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFMetadataFormat.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFMetadataFormat.java	Wed Jul 05 22:06:46 2017 +0200
@@ -49,7 +49,8 @@
         }
         try {
             ResourceBundle bundle =
-                ResourceBundle.getBundle(resourceBaseName, locale);
+                ResourceBundle.getBundle(resourceBaseName, locale,
+                                         this.getClass().getModule());
             return bundle.getString(key);
         } catch (MissingResourceException e) {
             return null;
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java	Wed Jul 05 22:06:46 2017 +0200
@@ -657,7 +657,6 @@
 
         protected void paintToImage(Component c, Image image, Graphics g,
                                     int w, int h, Object[] args) {
-            boolean accEnabled = false;
             Skin skin = (Skin)args[0];
             Part part = skin.part;
             State state = (State)args[1];
@@ -668,6 +667,8 @@
                 c = skin.component;
             }
             BufferedImage bi = (BufferedImage)image;
+            w = bi.getWidth();
+            h = bi.getHeight();
 
             WritableRaster raster = bi.getRaster();
             DataBufferInt dbi = (DataBufferInt)raster.getDataBuffer();
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractDataLine.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractDataLine.java	Wed Jul 05 22:06:46 2017 +0200
@@ -32,7 +32,6 @@
 import javax.sound.sampled.LineEvent;
 import javax.sound.sampled.LineUnavailableException;
 
-
 /**
  * AbstractDataLine
  *
@@ -147,36 +146,35 @@
         }
     }
 
-
     public final void open(AudioFormat format) throws LineUnavailableException {
         open(format, AudioSystem.NOT_SPECIFIED);
     }
 
-
     /**
      * This implementation always returns 0.
      */
+    @Override
     public int available() {
         return 0;
     }
 
-
     /**
      * This implementation does nothing.
      */
+    @Override
     public void drain() {
         if (Printer.trace) Printer.trace("AbstractDataLine: drain");
     }
 
-
     /**
      * This implementation does nothing.
      */
+    @Override
     public void flush() {
         if (Printer.trace) Printer.trace("AbstractDataLine: flush");
     }
 
-
+    @Override
     public final void start() {
         //$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
         synchronized(mixer) {
@@ -200,7 +198,7 @@
         if (Printer.trace) Printer.trace("< "+getClass().getName()+".start() - AbstractDataLine");
     }
 
-
+    @Override
     public final void stop() {
 
         //$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
@@ -245,15 +243,17 @@
     // in MixerSourceLine and MixerClip, and I want to touch as little
     // code as possible to change isStarted() back to isRunning().
 
+    @Override
     public final boolean isRunning() {
         return started;
     }
 
+    @Override
     public final boolean isActive() {
         return active;
     }
 
-
+    @Override
     public final long getMicrosecondPosition() {
 
         long microseconds = getLongFramePosition();
@@ -263,12 +263,12 @@
         return microseconds;
     }
 
-
+    @Override
     public final AudioFormat getFormat() {
         return format;
     }
 
-
+    @Override
     public final int getBufferSize() {
         return bufferSize;
     }
@@ -283,11 +283,11 @@
     /**
      * This implementation returns AudioSystem.NOT_SPECIFIED.
      */
+    @Override
     public final float getLevel() {
         return (float)AudioSystem.NOT_SPECIFIED;
     }
 
-
     // HELPER METHODS
 
     /**
@@ -317,19 +317,12 @@
 
         synchronized (this) {
 
-            //if (Printer.debug) Printer.debug("    AbstractDataLine: setActive: this.active: " + this.active);
-            //if (Printer.debug) Printer.debug("                                 active: " + active);
-
             if (this.active != active) {
                 this.active = active;
                 //sendEvents = true;
             }
         }
 
-        //if (Printer.debug) Printer.debug("                                 this.active: " + this.active);
-        //if (Printer.debug) Printer.debug("                                 sendEvents: " + sendEvents);
-
-
         // $$kk: 11.19.99: take ACTIVE / INACTIVE / EOM events out;
         // putting them in is technically an API change.
         // do not generate ACTIVE / INACTIVE events for now
@@ -356,18 +349,12 @@
 
         synchronized (this) {
 
-            //if (Printer.debug) Printer.debug("    AbstractDataLine: setStarted: this.started: " + this.started);
-            //if (Printer.debug) Printer.debug("                                  started: " + started);
-
             if (this.started != started) {
                 this.started = started;
                 sendEvents = true;
             }
         }
 
-        //if (Printer.debug) Printer.debug("                                  this.started: " + this.started);
-        //if (Printer.debug) Printer.debug("                                  sendEvents: " + sendEvents);
-
         if (sendEvents) {
 
             if (started) {
@@ -379,7 +366,6 @@
         if (Printer.trace) Printer.trace("< AbstractDataLine: setStarted completed");
     }
 
-
     /**
      * This method generates a STOP event and sets the started state to false.
      * It is here for historic reasons when an EOM event existed.
@@ -393,9 +379,6 @@
         if (Printer.trace) Printer.trace("< AbstractDataLine: setEOM() completed");
     }
 
-
-
-
     // OVERRIDES OF ABSTRACT LINE METHODS
 
     /**
@@ -404,6 +387,7 @@
      * line is open, this should return quietly because the values
      * requested will match the current ones.
      */
+    @Override
     public final void open() throws LineUnavailableException {
 
         if (Printer.trace) Printer.trace("> "+getClass().getName()+".open() - AbstractDataLine");
@@ -413,11 +397,11 @@
         if (Printer.trace) Printer.trace("< "+getClass().getName()+".open() - AbstractDataLine");
     }
 
-
     /**
      * This should also stop the line.  The closed line should not be running or active.
      * After we close the line, we reset the format and buffer size to the defaults.
      */
+    @Override
     public final void close() {
         //$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
         synchronized (mixer) {
@@ -445,12 +429,6 @@
         if (Printer.trace) Printer.trace("< "+getClass().getName()+".close() - in AbstractDataLine");
     }
 
-
-    // IMPLEMENTATIONS OF ABSTRACT LINE ABSTRACE METHODS
-
-
-    // ABSTRACT METHODS
-
     abstract void implOpen(AudioFormat format, int bufferSize) throws LineUnavailableException;
     abstract void implClose();
 
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractLine.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractLine.java	Wed Jul 05 22:06:46 2017 +0200
@@ -36,7 +36,6 @@
 import javax.sound.sampled.LineListener;
 import javax.sound.sampled.LineUnavailableException;
 
-
 /**
  * AbstractLine
  *
@@ -72,19 +71,19 @@
         this.controls = controls;
     }
 
-
     // LINE METHODS
 
+    @Override
     public final Line.Info getLineInfo() {
         return info;
     }
 
-
+    @Override
     public final boolean isOpen() {
         return open;
     }
 
-
+    @Override
     public final void addLineListener(LineListener listener) {
         synchronized(listeners) {
             if ( ! (listeners.contains(listener)) ) {
@@ -93,22 +92,22 @@
         }
     }
 
-
     /**
      * Removes an audio listener.
      * @param listener listener to remove
      */
+    @Override
     public final void removeLineListener(LineListener listener) {
         listeners.removeElement(listener);
     }
 
-
     /**
      * Obtains the set of controls supported by the
      * line.  If no controls are supported, returns an
      * array of length 0.
      * @return control set
      */
+    @Override
     public final Control[] getControls() {
         Control[] returnedArray = new Control[controls.length];
 
@@ -119,7 +118,7 @@
         return returnedArray;
     }
 
-
+    @Override
     public final boolean isControlSupported(Control.Type controlType) {
         // protect against a NullPointerException
         if (controlType == null) {
@@ -135,7 +134,7 @@
         return false;
     }
 
-
+    @Override
     public final Control getControl(Control.Type controlType) {
         // protect against a NullPointerException
         if (controlType != null) {
@@ -150,10 +149,8 @@
         throw new IllegalArgumentException("Unsupported control type: " + controlType);
     }
 
-
     // HELPER METHODS
 
-
     /**
      * This method sets the open state and generates
      * events if it changes.
@@ -182,7 +179,6 @@
         if (Printer.trace) Printer.trace("< "+getClass().getName()+" (AbstractLine): setOpen(" + open + ")  this.open: " + this.open);
     }
 
-
     /**
      * Send line events.
      */
@@ -190,7 +186,6 @@
         getEventDispatcher().sendAudioEvents(event, listeners);
     }
 
-
     /**
      * This is an error in the API: getFramePosition
      * should return a long value. At CD quality,
@@ -200,7 +195,6 @@
         return (int) getLongFramePosition();
     }
 
-
     /**
      * Return the frame position in a long value
      * This implementation returns AudioSystem.NOT_SPECIFIED.
@@ -209,7 +203,6 @@
         return AudioSystem.NOT_SPECIFIED;
     }
 
-
     // $$kk: 06.03.99: returns the mixer used in construction.
     // this is a hold-over from when there was a public method like
     // this on line and should be fixed!!
@@ -232,8 +225,8 @@
         }
     }
 
-    // ABSTRACT METHODS
-
+    @Override
     public abstract void open() throws LineUnavailableException;
+    @Override
     public abstract void close();
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Wed Jul 05 22:06:46 2017 +0200
@@ -26,10 +26,17 @@
 package com.sun.media.sound;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
-import java.util.Collections;
 
-import javax.sound.midi.*;
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiDeviceReceiver;
+import javax.sound.midi.MidiDeviceTransmitter;
+import javax.sound.midi.MidiMessage;
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.Transmitter;
 
 
 /**
@@ -43,11 +50,8 @@
  */
 abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice {
 
-    // STATIC VARIABLES
     private static final boolean TRACE_TRANSMITTER = false;
 
-    // INSTANCE VARIABLES
-
     private ArrayList<Receiver> receiverList;
 
     private TransmitterList transmitterList;
@@ -62,7 +66,6 @@
 
     private final MidiDevice.Info info;
 
-
     // DEVICE STATE
 
     private volatile boolean open;
@@ -73,15 +76,10 @@
     private List<Object> openKeepingObjects;
 
     /**
-     * This is the device handle returned from native code
+     * This is the device handle returned from native code.
      */
     protected volatile long id;
 
-
-
-    // CONSTRUCTOR
-
-
     /**
      * Constructs an AbstractMidiDevice with the specified info object.
      * @param info the description of the device
@@ -99,9 +97,9 @@
         if(Printer.trace) Printer.trace("<< AbstractMidiDevice CONSTRUCTOR completed");
     }
 
-
     // MIDI DEVICE METHODS
 
+    @Override
     public final MidiDevice.Info getDeviceInfo() {
         return info;
     }
@@ -111,6 +109,7 @@
      * opened the device implicitly from closing it. The only way to close the device after
      * this call is a call to close().
      */
+    @Override
     public final void open() throws MidiUnavailableException {
         if (Printer.trace) Printer.trace("> AbstractMidiDevice: open()");
         synchronized(this) {
@@ -120,8 +119,6 @@
         if (Printer.trace) Printer.trace("< AbstractMidiDevice: open() completed");
     }
 
-
-
     /** Open the device implicitly.
      * This method is intended to be used by AbstractReceiver
      * and BasicTransmitter. Actually, it is called by getReceiverReferenceCounting() and
@@ -146,7 +143,6 @@
         if (Printer.trace) Printer.trace("< AbstractMidiDevice: openInternal() completed");
     }
 
-
     private void doOpen() throws MidiUnavailableException {
         if (Printer.trace) Printer.trace("> AbstractMidiDevice: doOpen()");
         synchronized(this) {
@@ -158,7 +154,7 @@
         if (Printer.trace) Printer.trace("< AbstractMidiDevice: doOpen() completed");
     }
 
-
+    @Override
     public final void close() {
         if (Printer.trace) Printer.trace("> AbstractMidiDevice: close()");
         synchronized (this) {
@@ -168,7 +164,6 @@
         if (Printer.trace) Printer.trace("< AbstractMidiDevice: close() completed");
     }
 
-
     /** Close the device for an object that implicitely opened it.
      * This method is intended to be used by Transmitter.close() and Receiver.close().
      * Those methods should pass this for the object parameter. Since Transmitters or Receivers
@@ -196,7 +191,6 @@
         if (Printer.trace) Printer.trace("< AbstractMidiDevice: closeInternal() completed");
     }
 
-
     public final void doClose() {
         if (Printer.trace) Printer.trace("> AbstractMidiDevice: doClose()");
         synchronized(this) {
@@ -208,12 +202,11 @@
         if (Printer.trace) Printer.trace("< AbstractMidiDevice: doClose() completed");
     }
 
-
+    @Override
     public final boolean isOpen() {
         return open;
     }
 
-
     protected void implClose() {
         synchronized (traRecLock) {
             if (receiverList != null) {
@@ -230,21 +223,21 @@
         }
     }
 
-
     /**
      * This implementation always returns -1.
      * Devices that actually provide this should over-ride
      * this method.
      */
+    @Override
     public long getMicrosecondPosition() {
         return -1;
     }
 
-
     /** Return the maximum number of Receivers supported by this device.
         Depending on the return value of hasReceivers(), this method returns either 0 or -1.
         Subclasses should rather override hasReceivers() than override this method.
      */
+    @Override
     public final int getMaxReceivers() {
         if (hasReceivers()) {
             return -1;
@@ -253,11 +246,11 @@
         }
     }
 
-
     /** Return the maximum number of Transmitters supported by this device.
         Depending on the return value of hasTransmitters(), this method returns either 0 or -1.
         Subclasses should override hasTransmitters().
      */
+    @Override
     public final int getMaxTransmitters() {
         if (hasTransmitters()) {
             return -1;
@@ -266,7 +259,6 @@
         }
     }
 
-
     /** Retrieve a Receiver for this device.
         This method returns the value returned by createReceiver(), if it doesn't throw
         an exception. Subclasses should rather override createReceiver() than override
@@ -274,6 +266,7 @@
         If createReceiver returns a Receiver, it is added to the internal list
         of Receivers (see getReceiversList)
      */
+    @Override
     public final Receiver getReceiver() throws MidiUnavailableException {
         Receiver receiver;
         synchronized (traRecLock) {
@@ -283,7 +276,7 @@
         return receiver;
     }
 
-
+    @Override
     @SuppressWarnings("unchecked") // Cast of result of clone
     public final List<Receiver> getReceivers() {
         List<Receiver> recs;
@@ -298,12 +291,12 @@
         return recs;
     }
 
-
     /**
      * This implementation uses createTransmitter, which may throw an exception.
      * If a transmitter is returned in createTransmitter, it is added to the internal
      * TransmitterList
      */
+    @Override
     public final Transmitter getTransmitter() throws MidiUnavailableException {
         Transmitter transmitter;
         synchronized (traRecLock) {
@@ -313,7 +306,7 @@
         return transmitter;
     }
 
-
+    @Override
     @SuppressWarnings("unchecked") // Cast of result of clone
     public final List<Transmitter> getTransmitters() {
         List<Transmitter> tras;
@@ -328,19 +321,16 @@
         return tras;
     }
 
-
-    // HELPER METHODS
-
     final long getId() {
         return id;
     }
 
-
     // REFERENCE COUNTING
 
     /** Retrieve a Receiver and open the device implicitly.
         This method is called by MidiSystem.getReceiver().
      */
+    @Override
     public final Receiver getReceiverReferenceCounting()
             throws MidiUnavailableException {
         /* Keep this order of commands! If getReceiver() throws an exception,
@@ -354,10 +344,10 @@
         return receiver;
     }
 
-
     /** Retrieve a Transmitter and open the device implicitly.
         This method is called by MidiSystem.getTransmitter().
      */
+    @Override
     public final Transmitter getTransmitterReferenceCounting()
             throws MidiUnavailableException {
         /* Keep this order of commands! If getTransmitter() throws an exception,
@@ -371,7 +361,6 @@
         return transmitter;
     }
 
-
     /** Return the list of objects that have opened the device implicitely.
      */
     private synchronized List<Object> getOpenKeepingObjects() {
@@ -381,23 +370,19 @@
         return openKeepingObjects;
     }
 
-
-
     // RECEIVER HANDLING METHODS
 
-
     /** Return the internal list of Receivers, possibly creating it first.
      */
     private List<Receiver> getReceiverList() {
         synchronized (traRecLock) {
             if (receiverList == null) {
-                receiverList = new ArrayList<Receiver>();
+                receiverList = new ArrayList<>();
             }
         }
         return receiverList;
     }
 
-
     /** Returns if this device supports Receivers.
         Subclasses that use Receivers should override this method to
         return true. They also should override createReceiver().
@@ -408,7 +393,6 @@
         return false;
     }
 
-
     /** Create a Receiver object.
         throwing an exception here means that Receivers aren't enabled.
         Subclasses that use Receivers should override this method with
@@ -420,8 +404,6 @@
         throw new MidiUnavailableException("MIDI IN receiver not available");
     }
 
-
-
     // TRANSMITTER HANDLING
 
     /** Return the internal list of Transmitters, possibly creating it first.
@@ -435,7 +417,6 @@
         return transmitterList;
     }
 
-
     /** Returns if this device supports Transmitters.
         Subclasses that use Transmitters should override this method to
         return true. They also should override createTransmitter().
@@ -446,7 +427,6 @@
         return false;
     }
 
-
     /** Create a Transmitter object.
         throwing an exception here means that Transmitters aren't enabled.
         Subclasses that use Transmitters should override this method with
@@ -458,20 +438,16 @@
         throw new MidiUnavailableException("MIDI OUT transmitter not available");
     }
 
-    // ABSTRACT METHODS
-
     protected abstract void implOpen() throws MidiUnavailableException;
 
-
     /**
-     * close this device if discarded by the garbage collector
+     * close this device if discarded by the garbage collector.
      */
+    @Override
     protected final void finalize() {
         close();
     }
 
-    // INNER CLASSES
-
     /** Base class for Receivers.
         Subclasses that use Receivers must use this base class, since it
         contains magic necessary to manage implicit closing the device.
@@ -550,6 +526,7 @@
             this.tlist = tlist;
         }
 
+        @Override
         public final void setReceiver(Receiver receiver) {
             if (tlist != null && this.receiver != receiver) {
                 if (Printer.debug) Printer.debug("Transmitter "+toString()+": set receiver "+receiver);
@@ -558,16 +535,17 @@
             }
         }
 
+        @Override
         public final Receiver getReceiver() {
             return receiver;
         }
 
-
         /** Close the Transmitter.
          * Here, the call to the magic method closeInternal() takes place.
          * Therefore, subclasses that override this method must call
          * 'super.close()'.
          */
+        @Override
         public final void close() {
             AbstractMidiDevice.this.closeInternal(this);
             if (tlist != null) {
@@ -577,19 +555,19 @@
             }
         }
 
+        @Override
         public final MidiDevice getMidiDevice() {
             return AbstractMidiDevice.this;
         }
 
     } // class BasicTransmitter
 
-
     /**
-     * a class to manage a list of transmitters
+     * a class to manage a list of transmitters.
      */
     final class TransmitterList {
 
-        private final ArrayList<Transmitter> transmitters = new ArrayList<Transmitter>();
+        private final ArrayList<Transmitter> transmitters = new ArrayList<>();
         private MidiOutDevice.MidiOutReceiver midiOutReceiver;
 
         // how many transmitters must be present for optimized
@@ -712,9 +690,8 @@
             }
         }
 
-
         /**
-        * Send this message to all transmitters
+        * Send this message to all transmitters.
         */
         void sendMessage(MidiMessage message, long timeStamp) {
             if (message instanceof FastShortMessage) {
@@ -746,8 +723,5 @@
                 }
             }
         }
-
-
     } // TransmitterList
-
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -52,7 +52,6 @@
         // also for memory's sake, do not initialize the arrays here
     }
 
-
     final synchronized void readDeviceInfos() {
         Info[] infos = getInfoCache();
         MidiDevice[] devices = getDeviceCache();
@@ -148,10 +147,6 @@
         throw MidiUtils.unsupportedDevice(info);
     }
 
-
-    // INNER CLASSES
-
-
     /**
      * Info class for MidiDevices.  Adds an index value for
      * making native references to a particular device.
@@ -182,9 +177,6 @@
 
     } // class Info
 
-
-    // ABSTRACT METHODS
-
     abstract int getNumDevices();
     abstract MidiDevice[] getDeviceCache();
     abstract void setDeviceCache(MidiDevice[] devices);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMixer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMixer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -28,9 +28,9 @@
 import java.util.Vector;
 
 import javax.sound.sampled.Control;
-import javax.sound.sampled.Mixer;
 import javax.sound.sampled.Line;
 import javax.sound.sampled.LineUnavailableException;
+import javax.sound.sampled.Mixer;
 
 /**
  * Abstract Mixer.  Implements Mixer (with abstract methods) and specifies
@@ -76,29 +76,18 @@
      */
     private boolean manuallyOpened = false;
 
+    // STATE VARIABLES
 
     /**
-     * Supported formats for the mixer.
-     */
-    //$$fb DELETE
-    //protected Vector formats = new Vector();
-
-
-    // STATE VARIABLES
-
-
-    /**
-     * Source lines (ports) currently open
+     * Source lines (ports) currently open.
      */
     private final Vector<Line> sourceLines = new Vector<>();
 
-
     /**
      * Target lines currently open.
      */
     private final Vector<Line> targetLines = new Vector<>();
 
-
     /**
      * Constructs a new AbstractMixer.
      * @param mixer the mixer with which this line is associated
@@ -124,30 +113,28 @@
         this.targetLineInfo = targetLineInfo;
     }
 
-
     // MIXER METHODS
 
-
+    @Override
     public final Mixer.Info getMixerInfo() {
         return mixerInfo;
     }
 
-
+    @Override
     public final Line.Info[] getSourceLineInfo() {
         Line.Info[] localArray = new Line.Info[sourceLineInfo.length];
         System.arraycopy(sourceLineInfo, 0, localArray, 0, sourceLineInfo.length);
         return localArray;
     }
 
-
+    @Override
     public final Line.Info[] getTargetLineInfo() {
-
         Line.Info[] localArray = new Line.Info[targetLineInfo.length];
         System.arraycopy(targetLineInfo, 0, localArray, 0, targetLineInfo.length);
         return localArray;
     }
 
-
+    @Override
     public final Line.Info[] getSourceLineInfo(Line.Info info) {
 
         int i;
@@ -168,7 +155,7 @@
         return returnedArray;
     }
 
-
+    @Override
     public final Line.Info[] getTargetLineInfo(Line.Info info) {
 
         int i;
@@ -189,7 +176,7 @@
         return returnedArray;
     }
 
-
+    @Override
     public final boolean isLineSupported(Line.Info info) {
 
         int i;
@@ -211,9 +198,10 @@
         return false;
     }
 
-
+    @Override
     public abstract Line getLine(Line.Info info) throws LineUnavailableException;
 
+    @Override
     public abstract int getMaxLines(Line.Info info);
 
     protected abstract void implOpen() throws LineUnavailableException;
@@ -221,7 +209,7 @@
     protected abstract void implStop();
     protected abstract void implClose();
 
-
+    @Override
     public final Line[] getSourceLines() {
 
         Line[] localLines;
@@ -238,7 +226,7 @@
         return localLines;
     }
 
-
+    @Override
     public final Line[] getTargetLines() {
 
         Line[] localLines;
@@ -255,37 +243,37 @@
         return localLines;
     }
 
-
     /**
      * Default implementation always throws an exception.
      */
+    @Override
     public final void synchronize(Line[] lines, boolean maintainSync) {
         throw new IllegalArgumentException("Synchronization not supported by this mixer.");
     }
 
-
     /**
      * Default implementation always throws an exception.
      */
+    @Override
     public final void unsynchronize(Line[] lines) {
         throw new IllegalArgumentException("Synchronization not supported by this mixer.");
     }
 
-
     /**
      * Default implementation always returns false.
      */
+    @Override
     public final boolean isSynchronizationSupported(Line[] lines,
                                                     boolean maintainSync) {
         return false;
     }
 
-
     // OVERRIDES OF ABSTRACT DATA LINE METHODS
 
     /**
      * This implementation tries to open the mixer with its current format and buffer size settings.
      */
+    @Override
     public final synchronized void open() throws LineUnavailableException {
         open(true);
     }
@@ -307,10 +295,8 @@
         if (Printer.trace) Printer.trace("<< AbstractMixer: open() succeeded");
     }
 
-
     // METHOD FOR INTERNAL IMPLEMENTATION USE
 
-
     /**
      * The default implementation of this method just determines whether
      * this line is a source or target line, calls open(no-arg) on the
@@ -357,7 +343,6 @@
         if (Printer.trace) Printer.trace("<< AbstractMixer: open(" + line + ") completed");
     }
 
-
     /**
      * Removes this line from the list of open source lines and
      * open target lines, if it exists in either.
@@ -388,10 +373,10 @@
         if (Printer.trace) Printer.trace("<< AbstractMixer: close(" + line + ") succeeded");
     }
 
-
     /**
      * Close all lines and then close this mixer.
      */
+    @Override
     public final synchronized void close() {
         if (Printer.trace) Printer.trace(">> AbstractMixer: close()");
         if (isOpen()) {
@@ -439,7 +424,6 @@
         if (Printer.trace) Printer.trace("<< AbstractMixer: start(" + line + ") succeeded");
     }
 
-
     /**
      * Stops the mixer if this was the last running line.
      */
@@ -492,8 +476,6 @@
         if (Printer.trace) Printer.trace("<< AbstractMixer: stop(" + line + ") succeeded");
     }
 
-
-
     /**
      * Determines whether this is a source line for this mixer.
      * Right now this just checks whether it's supported, but should
@@ -510,7 +492,6 @@
         return false;
     }
 
-
     /**
      * Determines whether this is a target line for this mixer.
      * Right now this just checks whether it's supported, but should
@@ -527,7 +508,6 @@
         return false;
     }
 
-
     /**
      * Returns the first complete Line.Info object it finds that
      * matches the one specified, or null if no matching Line.Info
@@ -551,8 +531,6 @@
                 return targetLineInfo[i];
             }
         }
-
         return null;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileFormat.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileFormat.java	Wed Jul 05 22:06:46 2017 +0200
@@ -87,5 +87,4 @@
     int getSsndChunkOffset() {
         return getHeaderSize()-16;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java	Wed Jul 05 22:06:46 2017 +0200
@@ -29,7 +29,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 
-import javax.sound.sampled.AudioFileFormat;
 import javax.sound.sampled.AudioFileFormat.Type;
 import javax.sound.sampled.AudioFormat;
 import javax.sound.sampled.AudioSystem;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AlawCodec.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AlawCodec.java	Wed Jul 05 22:06:46 2017 +0200
@@ -33,7 +33,6 @@
 import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
 
-
 /**
  * A-law encodes linear data, and decodes a-law data to linear data.
  *
@@ -52,7 +51,7 @@
                                              0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF};
 
     /**
-     * Initializes the decode tables
+     * Initializes the decode tables.
      */
     static {
         for (int i=0;i<256;i++) {
@@ -83,10 +82,7 @@
         super(alawEncodings, alawEncodings);
     }
 
-    // NEW CODE
-
-    /**
-     */
+    @Override
     public AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat){
 
         if( sourceFormat.getEncoding().equals( AudioFormat.Encoding.PCM_SIGNED )) {
@@ -117,8 +113,7 @@
         }
     }
 
-    /**
-     */
+    @Override
     public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){
         Objects.requireNonNull(sourceFormat);
         if( (targetEncoding.equals( AudioFormat.Encoding.PCM_SIGNED ) && sourceFormat.getEncoding().equals( AudioFormat.Encoding.ALAW)) ||
@@ -129,8 +124,7 @@
             }
     }
 
-    /**
-     */
+    @Override
     public AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream){
         AudioFormat sourceFormat = sourceStream.getFormat();
         AudioFormat.Encoding sourceEncoding = sourceFormat.getEncoding();
@@ -169,9 +163,7 @@
         return getConvertedStream(targetFormat, sourceStream);
     }
 
-    /**
-     * use old code...
-     */
+    @Override
     public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream){
         if (!isConversionSupported(targetFormat, sourceStream.getFormat()))
             throw new IllegalArgumentException("Unsupported conversion: "
@@ -180,10 +172,6 @@
         return getConvertedStream( targetFormat, sourceStream );
     }
 
-
-    // OLD CODE
-
-
     /**
      * Opens the codec with the specified parameters.
      * @param stream stream from which data to be processed should be read
@@ -192,7 +180,6 @@
      * @throws IllegalArgumentException if the format combination supplied is
      * not supported.
      */
-    /*  public AudioInputStream getConvertedStream(AudioFormat outputFormat, AudioInputStream stream) { */
     private AudioInputStream getConvertedStream(AudioFormat outputFormat, AudioInputStream stream) {
 
         AudioInputStream cs = null;
@@ -201,7 +188,7 @@
         if( inputFormat.matches(outputFormat) ) {
             cs = stream;
         } else {
-            cs = (AudioInputStream) (new AlawCodecStream(stream, outputFormat));
+            cs = new AlawCodecStream(stream, outputFormat);
         }
 
         return cs;
@@ -214,7 +201,6 @@
      * returns an array of length 0.
      * @return array of supported output formats.
      */
-    /*  public AudioFormat[] getOutputFormats(AudioFormat inputFormat) { */
     private AudioFormat[] getOutputFormats(AudioFormat inputFormat) {
 
 
@@ -343,18 +329,20 @@
          * Note that this won't actually read anything; must read in
          * two-byte units.
          */
+        @Override
         public int read() throws IOException {
 
             byte[] b = new byte[1];
             return read(b, 0, b.length);
         }
 
-
+        @Override
         public int read(byte[] b) throws IOException {
 
             return read(b, 0, b.length);
         }
 
+        @Override
         public int read(byte[] b, int off, int len) throws IOException {
 
             // don't read fractional frames
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java	Wed Jul 05 22:06:46 2017 +0200
@@ -45,6 +45,7 @@
  */
 public final class AudioFileSoundbankReader extends SoundbankReader {
 
+    @Override
     public Soundbank getSoundbank(URL url)
             throws InvalidMidiDataException, IOException {
         try {
@@ -59,6 +60,7 @@
         }
     }
 
+    @Override
     public Soundbank getSoundbank(InputStream stream)
             throws InvalidMidiDataException, IOException {
         stream.mark(512);
@@ -108,6 +110,7 @@
         }
     }
 
+    @Override
     public Soundbank getSoundbank(File file)
             throws InvalidMidiDataException, IOException {
         try {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatConverter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatConverter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -89,8 +89,9 @@
                 mask = (byte) 0xFF;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             byte[] ret = converter.toByteArray(in_buff, in_offset, in_len,
                     out_buff, out_offset);
 
@@ -102,8 +103,9 @@
             return ret;
         }
 
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             if (mask_buffer == null || mask_buffer.length < in_buff.length)
                 mask_buffer = new byte[in_buff.length];
             System.arraycopy(in_buff, 0, mask_buffer, 0, in_buff.length);
@@ -132,8 +134,9 @@
 
         double[] double_buff = null;
 
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int in_len = out_len * 8;
             if (bytebuffer == null || bytebuffer.capacity() < in_len) {
                 bytebuffer = ByteBuffer.allocate(in_len).order(
@@ -154,8 +157,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int out_len = in_len * 8;
             if (bytebuffer == null || bytebuffer.capacity() < out_len) {
                 bytebuffer = ByteBuffer.allocate(out_len).order(
@@ -184,8 +188,9 @@
 
         double[] double_buff = null;
 
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int in_len = out_len * 8;
             if (bytebuffer == null || bytebuffer.capacity() < in_len) {
                 bytebuffer = ByteBuffer.allocate(in_len).order(
@@ -206,8 +211,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int out_len = in_len * 8;
             if (bytebuffer == null || bytebuffer.capacity() < out_len) {
                 bytebuffer = ByteBuffer.allocate(out_len).order(
@@ -240,8 +246,9 @@
 
         FloatBuffer floatbuffer = null;
 
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int in_len = out_len * 4;
             if (bytebuffer == null || bytebuffer.capacity() < in_len) {
                 bytebuffer = ByteBuffer.allocate(in_len).order(
@@ -255,8 +262,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int out_len = in_len * 4;
             if (bytebuffer == null || bytebuffer.capacity() < out_len) {
                 bytebuffer = ByteBuffer.allocate(out_len).order(
@@ -277,8 +285,9 @@
 
         FloatBuffer floatbuffer = null;
 
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int in_len = out_len * 4;
             if (bytebuffer == null || bytebuffer.capacity() < in_len) {
                 bytebuffer = ByteBuffer.allocate(in_len).order(
@@ -292,8 +301,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int out_len = in_len * 4;
             if (bytebuffer == null || bytebuffer.capacity() < out_len) {
                 bytebuffer = ByteBuffer.allocate(out_len).order(
@@ -316,8 +326,9 @@
 
     // PCM 8 bit, signed
     private static class AudioFloatConversion8S extends AudioFloatConverter {
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -327,8 +338,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -341,8 +353,9 @@
 
     // PCM 8 bit, unsigned
     private static class AudioFloatConversion8U extends AudioFloatConverter {
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -352,8 +365,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -372,8 +386,9 @@
 
     // PCM 16 bit, signed, little-endian
     private static class AudioFloatConversion16SL extends AudioFloatConverter {
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int len = out_offset + out_len;
             for (int ox = out_offset; ox < len; ox++) {
@@ -383,8 +398,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ox = out_offset;
             int len = in_offset + in_len;
             for (int ix = in_offset; ix < len; ix++) {
@@ -399,8 +415,9 @@
 
     // PCM 16 bit, signed, big-endian
     private static class AudioFloatConversion16SB extends AudioFloatConverter {
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -410,8 +427,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -426,8 +444,9 @@
 
     // PCM 16 bit, unsigned, little-endian
     private static class AudioFloatConversion16UL extends AudioFloatConverter {
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -438,8 +457,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -454,8 +474,9 @@
 
     // PCM 16 bit, unsigned, big-endian
     private static class AudioFloatConversion16UB extends AudioFloatConverter {
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -466,8 +487,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -488,8 +510,9 @@
 
     // PCM 24 bit, signed, little-endian
     private static class AudioFloatConversion24SL extends AudioFloatConverter {
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -502,8 +525,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -521,8 +545,9 @@
 
     // PCM 24 bit, signed, big-endian
     private static class AudioFloatConversion24SB extends AudioFloatConverter {
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -535,8 +560,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -554,8 +580,9 @@
 
     // PCM 24 bit, unsigned, little-endian
     private static class AudioFloatConversion24UL extends AudioFloatConverter {
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -567,8 +594,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -585,8 +613,9 @@
 
     // PCM 24 bit, unsigned, big-endian
     private static class AudioFloatConversion24UB extends AudioFloatConverter {
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -598,8 +627,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -622,8 +652,9 @@
 
     // PCM 32 bit, signed, little-endian
     private static class AudioFloatConversion32SL extends AudioFloatConverter {
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -635,8 +666,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -652,8 +684,9 @@
 
     // PCM 32 bit, signed, big-endian
     private static class AudioFloatConversion32SB extends AudioFloatConverter {
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -665,8 +698,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -682,8 +716,9 @@
 
     // PCM 32 bit, unsigned, little-endian
     private static class AudioFloatConversion32UL extends AudioFloatConverter {
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -696,8 +731,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -715,8 +751,9 @@
     // PCM 32 bit, unsigned, big-endian
     private static class AudioFloatConversion32UB extends AudioFloatConverter {
 
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -729,8 +766,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -760,8 +798,9 @@
             this.xbytes = xbytes;
         }
 
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -774,8 +813,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -801,8 +841,9 @@
             this.xbytes = xbytes;
         }
 
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -816,8 +857,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -843,8 +885,9 @@
             this.xbytes = xbytes;
         }
 
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -858,8 +901,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
@@ -886,8 +930,9 @@
             this.xbytes = xbytes;
         }
 
+        @Override
         public float[] toFloatArray(byte[] in_buff, int in_offset,
-                float[] out_buff, int out_offset, int out_len) {
+                                    float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
@@ -901,8 +946,9 @@
             return out_buff;
         }
 
+        @Override
         public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
-                byte[] out_buff, int out_offset) {
+                                  byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -32,9 +32,9 @@
 import java.util.Objects;
 
 import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioFormat.Encoding;
 import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.AudioFormat.Encoding;
 import javax.sound.sampled.spi.FormatConversionProvider;
 
 /**
@@ -63,6 +63,7 @@
             fsize = ((targetFormat.getSampleSizeInBits() + 7) / 8);
         }
 
+        @Override
         public int read() throws IOException {
             byte[] b = new byte[1];
             int ret = read(b);
@@ -71,6 +72,7 @@
             return b[0] & 0xFF;
         }
 
+        @Override
         public int read(byte[] b, int off, int len) throws IOException {
 
             int flen = len / fsize;
@@ -83,6 +85,7 @@
             return ret * fsize;
         }
 
+        @Override
         public int available() throws IOException {
             int ret = stream.available();
             if (ret < 0)
@@ -90,22 +93,27 @@
             return ret * fsize;
         }
 
+        @Override
         public void close() throws IOException {
             stream.close();
         }
 
+        @Override
         public synchronized void mark(int readlimit) {
             stream.mark(readlimit * fsize);
         }
 
+        @Override
         public boolean markSupported() {
             return stream.markSupported();
         }
 
+        @Override
         public synchronized void reset() throws IOException {
             stream.reset();
         }
 
+        @Override
         public long skip(long n) throws IOException {
             long ret = stream.skip(n / fsize);
             if (ret < 0)
@@ -141,30 +149,37 @@
                             .isBigEndian());
         }
 
+        @Override
         public int available() throws IOException {
             return (ais.available() / sourceChannels) * targetChannels;
         }
 
+        @Override
         public void close() throws IOException {
             ais.close();
         }
 
+        @Override
         public AudioFormat getFormat() {
             return targetFormat;
         }
 
+        @Override
         public long getFrameLength() {
             return ais.getFrameLength();
         }
 
+        @Override
         public void mark(int readlimit) {
             ais.mark((readlimit / targetChannels) * sourceChannels);
         }
 
+        @Override
         public boolean markSupported() {
             return ais.markSupported();
         }
 
+        @Override
         public int read(float[] b, int off, int len) throws IOException {
             int len2 = (len / targetChannels) * sourceChannels;
             if (conversion_buffer == null || conversion_buffer.length < len2)
@@ -212,10 +227,12 @@
             return (ret / sourceChannels) * targetChannels;
         }
 
+        @Override
         public void reset() throws IOException {
             ais.reset();
         }
 
+        @Override
         public long skip(long len) throws IOException {
             long ret = ais.skip((len / targetChannels) * sourceChannels);
             if (ret < 0)
@@ -305,22 +322,27 @@
             ibuffer_len = buffer_len;
         }
 
+        @Override
         public int available() throws IOException {
             return 0;
         }
 
+        @Override
         public void close() throws IOException {
             ais.close();
         }
 
+        @Override
         public AudioFormat getFormat() {
             return targetFormat;
         }
 
+        @Override
         public long getFrameLength() {
             return AudioSystem.NOT_SPECIFIED; // ais.getFrameLength();
         }
 
+        @Override
         public void mark(int readlimit) {
             ais.mark((int) (readlimit * pitch[0]));
             mark_ibuffer_index = ibuffer_index;
@@ -337,6 +359,7 @@
             }
         }
 
+        @Override
         public boolean markSupported() {
             return ais.markSupported();
         }
@@ -381,6 +404,7 @@
 
         }
 
+        @Override
         public int read(float[] b, int off, int len) throws IOException {
 
             if (cbuffer == null || cbuffer[0].length < len / nrofchannels) {
@@ -431,6 +455,7 @@
             return len - remain * nrofchannels;
         }
 
+        @Override
         public void reset() throws IOException {
             ais.reset();
             if (mark_ibuffer == null)
@@ -447,6 +472,7 @@
 
         }
 
+        @Override
         public long skip(long len) throws IOException {
             if (len < 0)
                 return 0;
@@ -474,8 +500,9 @@
                                         Encoding.PCM_UNSIGNED,
                                         Encoding.PCM_FLOAT};
 
+    @Override
     public AudioInputStream getAudioInputStream(Encoding targetEncoding,
-            AudioInputStream sourceStream) {
+                                                AudioInputStream sourceStream) {
         if (!isConversionSupported(targetEncoding, sourceStream.getFormat())) {
             throw new IllegalArgumentException(
                     "Unsupported conversion: " + sourceStream.getFormat()
@@ -496,8 +523,9 @@
         return getAudioInputStream(targetFormat, sourceStream);
     }
 
+    @Override
     public AudioInputStream getAudioInputStream(AudioFormat targetFormat,
-            AudioInputStream sourceStream) {
+                                                AudioInputStream sourceStream) {
         if (!isConversionSupported(targetFormat, sourceStream.getFormat()))
             throw new IllegalArgumentException("Unsupported conversion: "
                     + sourceStream.getFormat().toString() + " to "
@@ -526,16 +554,19 @@
                 .getFrameLength());
     }
 
+    @Override
     public Encoding[] getSourceEncodings() {
         return new Encoding[] { Encoding.PCM_SIGNED, Encoding.PCM_UNSIGNED,
                 Encoding.PCM_FLOAT };
     }
 
+    @Override
     public Encoding[] getTargetEncodings() {
         return new Encoding[] { Encoding.PCM_SIGNED, Encoding.PCM_UNSIGNED,
                 Encoding.PCM_FLOAT };
     }
 
+    @Override
     public Encoding[] getTargetEncodings(AudioFormat sourceFormat) {
         if (AudioFloatConverter.getConverter(sourceFormat) == null)
             return new Encoding[0];
@@ -543,14 +574,15 @@
                 Encoding.PCM_FLOAT };
     }
 
+    @Override
     public AudioFormat[] getTargetFormats(Encoding targetEncoding,
-            AudioFormat sourceFormat) {
+                                          AudioFormat sourceFormat) {
         Objects.requireNonNull(targetEncoding);
         if (AudioFloatConverter.getConverter(sourceFormat) == null)
             return new AudioFormat[0];
         int channels = sourceFormat.getChannels();
 
-        ArrayList<AudioFormat> formats = new ArrayList<AudioFormat>();
+        ArrayList<AudioFormat> formats = new ArrayList<>();
 
         if (targetEncoding.equals(Encoding.PCM_SIGNED))
             formats.add(new AudioFormat(Encoding.PCM_SIGNED,
@@ -598,8 +630,9 @@
         return formats.toArray(new AudioFormat[formats.size()]);
     }
 
+    @Override
     public boolean isConversionSupported(AudioFormat targetFormat,
-            AudioFormat sourceFormat) {
+                                         AudioFormat sourceFormat) {
         Objects.requireNonNull(targetFormat);
         if (AudioFloatConverter.getConverter(sourceFormat) == null)
             return false;
@@ -612,8 +645,9 @@
         return true;
     }
 
+    @Override
     public boolean isConversionSupported(Encoding targetEncoding,
-            AudioFormat sourceFormat) {
+                                         AudioFormat sourceFormat) {
         Objects.requireNonNull(targetEncoding);
         if (AudioFloatConverter.getConverter(sourceFormat) == null)
             return false;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatInputStream.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatInputStream.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.ByteArrayInputStream;
@@ -66,14 +67,17 @@
 
         }
 
+        @Override
         public AudioFormat getFormat() {
             return format;
         }
 
+        @Override
         public long getFrameLength() {
             return buffer_len;// / format.getFrameSize();
         }
 
+        @Override
         public int read(float[] b, int off, int len) throws IOException {
             if (b == null)
                 throw new NullPointerException();
@@ -91,6 +95,7 @@
             return len;
         }
 
+        @Override
         public long skip(long len) throws IOException {
             if (pos >= buffer_len)
                 return -1;
@@ -102,21 +107,26 @@
             return len;
         }
 
+        @Override
         public int available() throws IOException {
             return buffer_len - pos;
         }
 
+        @Override
         public void close() throws IOException {
         }
 
+        @Override
         public void mark(int readlimit) {
             markpos = pos;
         }
 
+        @Override
         public boolean markSupported() {
             return true;
         }
 
+        @Override
         public void reset() throws IOException {
             pos = markpos;
         }
@@ -163,14 +173,17 @@
             this.stream = stream;
         }
 
+        @Override
         public AudioFormat getFormat() {
             return stream.getFormat();
         }
 
+        @Override
         public long getFrameLength() {
             return stream.getFrameLength();
         }
 
+        @Override
         public int read(float[] b, int off, int len) throws IOException {
             int b_len = len * framesize_pc;
             if (buffer == null || buffer.length < b_len)
@@ -182,6 +195,7 @@
             return ret / framesize_pc;
         }
 
+        @Override
         public long skip(long len) throws IOException {
             long b_len = len * framesize_pc;
             long ret = stream.skip(b_len);
@@ -190,22 +204,27 @@
             return ret / framesize_pc;
         }
 
+        @Override
         public int available() throws IOException {
             return stream.available() / framesize_pc;
         }
 
+        @Override
         public void close() throws IOException {
             stream.close();
         }
 
+        @Override
         public void mark(int readlimit) {
             stream.mark(readlimit * framesize_pc);
         }
 
+        @Override
         public boolean markSupported() {
             return stream.markSupported();
         }
 
+        @Override
         public void reset() throws IOException {
             stream.reset();
         }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,9 +22,11 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.Map;
+
 import javax.sound.midi.MidiUnavailableException;
 import javax.sound.midi.Synthesizer;
 import javax.sound.sampled.AudioFormat;
@@ -53,7 +55,7 @@
      * @return current audio data format
      * @see AudioFormat
      */
-    public AudioFormat getFormat();
+    AudioFormat getFormat();
 
     /**
      * Gets information about the possible properties for the synthesizer.
@@ -63,8 +65,7 @@
      * describing possible properties. This array may be an empty array if
      * no properties are required.
      */
-    public AudioSynthesizerPropertyInfo[] getPropertyInfo(
-            Map<String, Object> info);
+    AudioSynthesizerPropertyInfo[] getPropertyInfo(Map<String, Object> info);
 
     /**
      * Opens the synthesizer and starts rendering audio into
@@ -93,7 +94,7 @@
      * @see #close
      * @see #isOpen
      */
-    public void open(SourceDataLine line, Map<String, Object> info)
+    void open(SourceDataLine line, Map<String, Object> info)
             throws MidiUnavailableException;
 
     /**
@@ -123,6 +124,7 @@
      * @see #close
      * @see #isOpen
      */
-    public AudioInputStream openStream(AudioFormat targetFormat,
-            Map<String, Object> info) throws MidiUnavailableException;
+    AudioInputStream openStream(AudioFormat targetFormat,
+                                Map<String, Object> info)
+            throws MidiUnavailableException;
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoClosingClip.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoClosingClip.java	Wed Jul 05 22:06:46 2017 +0200
@@ -28,7 +28,7 @@
 import javax.sound.sampled.Clip;
 
 /**
- * Interface for Clip objects that close themselves automatically
+ * Interface for Clip objects that close themselves automatically.
  *
  * @author Florian Bomers
  */
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoConnectSequencer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoConnectSequencer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -41,6 +41,5 @@
      * needs to re-connect itself to a suitable
      * device in open().
      */
-    public void setAutoConnect(Receiver autoConnectReceiver);
-
+    void setAutoConnect(Receiver autoConnectReceiver);
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInfo.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInfo.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInstrument.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInstrument.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.ArrayList;
@@ -47,8 +48,8 @@
     boolean druminstrument = false;
     byte[] guid = null;
     DLSInfo info = new DLSInfo();
-    List<DLSRegion> regions = new ArrayList<DLSRegion>();
-    List<DLSModulator> modulators = new ArrayList<DLSModulator>();
+    List<DLSRegion> regions = new ArrayList<>();
+    List<DLSModulator> modulators = new ArrayList<>();
 
     public DLSInstrument() {
         super(null, null, null, null);
@@ -62,6 +63,7 @@
         return info;
     }
 
+    @Override
     public String getName() {
         return info.name;
     }
@@ -70,6 +72,7 @@
         info.name = name;
     }
 
+    @Override
     public ModelPatch getPatch() {
         return new ModelPatch(bank, preset, druminstrument);
     }
@@ -86,6 +89,7 @@
         }
     }
 
+    @Override
     public Object getData() {
         return null;
     }
@@ -98,6 +102,7 @@
         return modulators;
     }
 
+    @Override
     public String toString() {
         if (druminstrument)
             return "Drumkit: " + info.name
@@ -362,17 +367,17 @@
         return null;
     }
 
+    @Override
     public ModelPerformer[] getPerformers() {
-        List<ModelPerformer> performers = new ArrayList<ModelPerformer>();
+        List<ModelPerformer> performers = new ArrayList<>();
 
-        Map<String, DLSModulator> modmap = new HashMap<String, DLSModulator>();
+        Map<String, DLSModulator> modmap = new HashMap<>();
         for (DLSModulator mod: getModulators()) {
             modmap.put(mod.getSource() + "x" + mod.getControl() + "=" +
                     mod.getDestination(), mod);
         }
 
-        Map<String, DLSModulator> insmodmap =
-                new HashMap<String, DLSModulator>();
+        Map<String, DLSModulator> insmodmap = new HashMap<>();
 
         for (DLSRegion zone: regions) {
             ModelPerformer performer = new ModelPerformer();
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSModulator.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSModulator.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSRegion.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSRegion.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.ArrayList;
@@ -39,7 +40,7 @@
 public final class DLSRegion {
 
     public static final int OPTION_SELFNONEXCLUSIVE = 0x0001;
-    List<DLSModulator> modulators = new ArrayList<DLSModulator>();
+    List<DLSModulator> modulators = new ArrayList<>();
     int keyfrom;
     int keyto;
     int velfrom;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSample.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSample.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,10 +22,12 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.InputStream;
 import java.util.Arrays;
+
 import javax.sound.midi.Soundbank;
 import javax.sound.midi.SoundbankResource;
 import javax.sound.sampled.AudioFormat;
@@ -60,6 +62,7 @@
         return info;
     }
 
+    @Override
     public Object getData() {
         AudioFormat format = getFormat();
 
@@ -93,6 +96,7 @@
         this.data = new ModelByteBuffer(data, offset, length);
     }
 
+    @Override
     public String getName() {
         return info.name;
     }
@@ -109,6 +113,7 @@
         this.sampleoptions = sampleOptions;
     }
 
+    @Override
     public String toString() {
         return "Sample: " + info.name;
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleLoop.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleLoop.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleOptions.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleOptions.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.ArrayList;
@@ -40,7 +41,7 @@
     short finetune;
     int attenuation;
     long options;
-    List<DLSSampleLoop> loops = new ArrayList<DLSSampleLoop>();
+    List<DLSSampleLoop> loops = new ArrayList<>();
 
     public int getAttenuation() {
         return attenuation;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbank.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbank.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.File;
@@ -42,9 +43,9 @@
 import javax.sound.midi.Soundbank;
 import javax.sound.midi.SoundbankResource;
 import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioFormat.Encoding;
 import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.AudioFormat.Encoding;
 
 /**
  * A DLS Level 1 and Level 2 soundbank reader (from files/url/streams).
@@ -100,10 +101,12 @@
             return d;
         }
 
+        @Override
         public int hashCode() {
             return (int)i1;
         }
 
+        @Override
         public boolean equals(Object obj) {
             if (!(obj instanceof DLSID)) {
                 return false;
@@ -176,8 +179,8 @@
 
     private final DLSInfo info = new DLSInfo();
 
-    private final List<DLSInstrument> instruments = new ArrayList<DLSInstrument>();
-    private final List<DLSSample> samples = new ArrayList<DLSSample>();
+    private final List<DLSInstrument> instruments = new ArrayList<>();
+    private final List<DLSSample> samples = new ArrayList<>();
 
     private boolean largeFormat = false;
     private File sampleFile;
@@ -300,7 +303,7 @@
         DLSID uuid;
         long x;
         long y;
-        Stack<Long> stack = new Stack<Long>();
+        Stack<Long> stack = new Stack<>();
 
         while (riff.available() != 0) {
             int opcode = riff.readUnsignedShort();
@@ -482,7 +485,7 @@
                     }
                 }
                 if (chunk.getType().equals("lart")) {
-                    List<DLSModulator> modlist = new ArrayList<DLSModulator>();
+                    List<DLSModulator> modlist = new ArrayList<>();
                     while (chunk.hasNextChunk()) {
                         RIFFReader subchunk = chunk.nextChunk();
                         if (chunk.getFormat().equals("cdl ")) {
@@ -498,7 +501,7 @@
                 }
                 if (chunk.getType().equals("lar2")) {
                     // support for DLS level 2 ART
-                    List<DLSModulator> modlist = new ArrayList<DLSModulator>();
+                    List<DLSModulator> modlist = new ArrayList<>();
                     while (chunk.hasNextChunk()) {
                         RIFFReader subchunk = chunk.nextChunk();
                         if (chunk.getFormat().equals("cdl ")) {
@@ -582,7 +585,7 @@
         }
     }
 
-    private Map<DLSRegion, Long> temp_rgnassign = new HashMap<DLSRegion, Long>();
+    private Map<DLSRegion, Long> temp_rgnassign = new HashMap<>();
 
     private boolean readRgnChunk(DLSRegion split, RIFFReader riff)
             throws IOException {
@@ -591,7 +594,7 @@
             String format = chunk.getFormat();
             if (format.equals("LIST")) {
                 if (chunk.getType().equals("lart")) {
-                    List<DLSModulator> modlist = new ArrayList<DLSModulator>();
+                    List<DLSModulator> modlist = new ArrayList<>();
                     while (chunk.hasNextChunk()) {
                         RIFFReader subchunk = chunk.nextChunk();
                         if (chunk.getFormat().equals("cdl ")) {
@@ -607,7 +610,7 @@
                 }
                 if (chunk.getType().equals("lar2")) {
                     // support for DLS level 2 ART
-                    List<DLSModulator> modlist = new ArrayList<DLSModulator>();
+                    List<DLSModulator> modlist = new ArrayList<>();
                     while (chunk.hasNextChunk()) {
                         RIFFReader subchunk = chunk.nextChunk();
                         if (chunk.getFormat().equals("cdl ")) {
@@ -902,7 +905,7 @@
 
         RIFFWriter wvpl = writer.writeList("wvpl");
         long off = wvpl.getFilePointer();
-        List<Long> offsettable = new ArrayList<Long>();
+        List<Long> offsettable = new ArrayList<>();
         for (DLSSample sample : samples) {
             offsettable.add(Long.valueOf(wvpl.getFilePointer() - off));
             writeSample(wvpl.writeList("wave"), sample);
@@ -1179,18 +1182,22 @@
         return info;
     }
 
+    @Override
     public String getName() {
         return info.name;
     }
 
+    @Override
     public String getVersion() {
         return major + "." + minor;
     }
 
+    @Override
     public String getVendor() {
         return info.engineers;
     }
 
+    @Override
     public String getDescription() {
         return info.comments;
     }
@@ -1207,6 +1214,7 @@
         info.comments = s;
     }
 
+    @Override
     public SoundbankResource[] getResources() {
         SoundbankResource[] resources = new SoundbankResource[samples.size()];
         int j = 0;
@@ -1215,6 +1223,7 @@
         return resources;
     }
 
+    @Override
     public DLSInstrument[] getInstruments() {
         DLSInstrument[] inslist_array =
                 instruments.toArray(new DLSInstrument[instruments.size()]);
@@ -1226,6 +1235,7 @@
         return samples.toArray(new DLSSample[samples.size()]);
     }
 
+    @Override
     public Instrument getInstrument(Patch patch) {
         int program = patch.getProgram();
         int bank = patch.getBank();
@@ -1256,9 +1266,9 @@
 
     public void removeResource(SoundbankResource resource) {
         if (resource instanceof DLSInstrument)
-            instruments.remove((DLSInstrument) resource);
+            instruments.remove(resource);
         if (resource instanceof DLSSample)
-            samples.remove((DLSSample) resource);
+            samples.remove(resource);
     }
 
     public void addInstrument(DLSInstrument resource) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbankReader.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbankReader.java	Wed Jul 05 22:06:46 2017 +0200
@@ -29,6 +29,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
+
 import javax.sound.midi.InvalidMidiDataException;
 import javax.sound.midi.Soundbank;
 import javax.sound.midi.spi.SoundbankReader;
@@ -41,6 +42,7 @@
  */
 public final class DLSSoundbankReader extends SoundbankReader {
 
+    @Override
     public Soundbank getSoundbank(URL url)
             throws InvalidMidiDataException, IOException {
         try {
@@ -52,6 +54,7 @@
         }
     }
 
+    @Override
     public Soundbank getSoundbank(InputStream stream)
             throws InvalidMidiDataException, IOException {
         try {
@@ -63,6 +66,7 @@
         }
     }
 
+    @Override
     public Soundbank getSoundbank(File file)
             throws InvalidMidiDataException, IOException {
         try {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DataPusher.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DataPusher.java	Wed Jul 05 22:06:46 2017 +0200
@@ -27,7 +27,9 @@
 
 import java.util.Arrays;
 
-import javax.sound.sampled.*;
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
+import javax.sound.sampled.SourceDataLine;
 
 /**
  * Class to write an AudioInputStream to a SourceDataLine.
@@ -125,7 +127,6 @@
         if (DEBUG || Printer.debug) Printer.debug("< DataPusher.start(loop="+loop+")");
     }
 
-
     public synchronized void stop() {
         if (DEBUG || Printer.debug) Printer.debug("> DataPusher.stop()");
         if (threadState == STATE_STOPPING
@@ -161,6 +162,7 @@
     /**
      * Write data to the source data line.
      */
+    @Override
     public void run() {
         byte[] buffer = null;
         boolean useStream = (ais != null);
@@ -242,5 +244,4 @@
         }
         if (DEBUG || Printer.debug)Printer.debug("DataPusher:end of thread");
     }
-
 } // class DataPusher
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java	Wed Jul 05 22:06:46 2017 +0200
@@ -29,35 +29,35 @@
 import java.io.IOException;
 import java.util.Vector;
 
-import javax.sound.sampled.*;
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.BooleanControl;
+import javax.sound.sampled.Clip;
+import javax.sound.sampled.Control;
+import javax.sound.sampled.DataLine;
+import javax.sound.sampled.FloatControl;
+import javax.sound.sampled.Line;
+import javax.sound.sampled.LineUnavailableException;
+import javax.sound.sampled.SourceDataLine;
+import javax.sound.sampled.TargetDataLine;
 
 // IDEA:
 // Use java.util.concurrent.Semaphore,
 // java.util.concurrent.locks.ReentrantLock and other new classes/methods
 // to improve this class's thread safety.
 
-
 /**
- * A Mixer which provides direct access to audio devices
+ * A Mixer which provides direct access to audio devices.
  *
  * @author Florian Bomers
  */
 final class DirectAudioDevice extends AbstractMixer {
 
-    // CONSTANTS
     private static final int CLIP_BUFFER_TIME = 1000; // in milliseconds
 
     private static final int DEFAULT_LINE_BUFFER_TIME = 500; // in milliseconds
 
-    // INSTANCE VARIABLES
-
-    /** number of opened lines */
-    private int deviceCountOpened = 0;
-
-    /** number of started lines */
-    private int deviceCountStarted = 0;
-
-    // CONSTRUCTOR
     DirectAudioDevice(DirectAudioDeviceProvider.DirectAudioDeviceInfo portMixerInfo) {
         // pass in Line.Info, mixer, controls
         super(portMixerInfo,              // Mixer.Info
@@ -168,6 +168,7 @@
 
     // ABSTRACT MIXER: ABSTRACT METHOD IMPLEMENTATIONS
 
+    @Override
     public Line getLine(Line.Info info) throws LineUnavailableException {
         Line.Info fullInfo = getLineInfo(info);
         if (fullInfo == null) {
@@ -216,7 +217,7 @@
         throw new IllegalArgumentException("Line unsupported: " + info);
     }
 
-
+    @Override
     public int getMaxLines(Line.Info info) {
         Line.Info fullInfo = getLineInfo(info);
 
@@ -233,26 +234,26 @@
         return 0;
     }
 
-
+    @Override
     protected void implOpen() throws LineUnavailableException {
         if (Printer.trace) Printer.trace("DirectAudioDevice: implOpen - void method");
     }
 
+    @Override
     protected void implClose() {
         if (Printer.trace) Printer.trace("DirectAudioDevice: implClose - void method");
     }
 
+    @Override
     protected void implStart() {
         if (Printer.trace) Printer.trace("DirectAudioDevice: implStart - void method");
     }
 
+    @Override
     protected void implStop() {
         if (Printer.trace) Printer.trace("DirectAudioDevice: implStop - void method");
     }
 
-
-    // IMPLEMENTATION HELPERS
-
     int getMixerIndex() {
         return ((DirectAudioDeviceProvider.DirectAudioDeviceInfo) getMixerInfo()).getIndex();
     }
@@ -319,12 +320,6 @@
         return null;
     }
 
-
-
-
-    // INNER CLASSES
-
-
     /**
      * Private inner class for the DataLine.Info objects
      * adds a little magic for the isFormatSupported so
@@ -367,7 +362,7 @@
     }
 
     /**
-     * Private inner class as base class for direct lines
+     * Private inner class as base class for direct lines.
      */
     private static class DirectDL extends AbstractDataLine implements EventDispatcher.LineMonitor {
         protected final int mixerIndex;
@@ -397,7 +392,6 @@
         // Guards all native calls.
         protected final Object lockNative = new Object();
 
-        // CONSTRUCTOR
         protected DirectDL(DataLine.Info info,
                            DirectAudioDevice mixer,
                            AudioFormat format,
@@ -414,11 +408,7 @@
 
         }
 
-
-        // ABSTRACT METHOD IMPLEMENTATIONS
-
-        // ABSTRACT LINE / DATALINE
-
+        @Override
         void implOpen(AudioFormat format, int bufferSize) throws LineUnavailableException {
             if (Printer.trace) Printer.trace(">> DirectDL: implOpen("+format+", "+bufferSize+" bytes)");
 
@@ -538,7 +528,7 @@
             if (Printer.trace) Printer.trace("<< DirectDL: implOpen() succeeded");
         }
 
-
+        @Override
         void implStart() {
             if (Printer.trace) Printer.trace(" >> DirectDL: implStart()");
 
@@ -570,6 +560,7 @@
             if (Printer.trace) Printer.trace("<< DirectDL: implStart() succeeded");
         }
 
+        @Override
         void implStop() {
             if (Printer.trace) Printer.trace(">> DirectDL: implStop()");
 
@@ -600,6 +591,7 @@
             if (Printer.trace) Printer.trace(" << DirectDL: implStop() succeeded");
         }
 
+        @Override
         void implClose() {
             if (Printer.trace) Printer.trace(">> DirectDL: implClose()");
 
@@ -625,8 +617,7 @@
             if (Printer.trace) Printer.trace("<< DirectDL: implClose() succeeded");
         }
 
-        // METHOD OVERRIDES
-
+        @Override
         public int available() {
             if (id == 0) {
                 return 0;
@@ -638,7 +629,7 @@
             return a;
         }
 
-
+        @Override
         public void drain() {
             noService = true;
             // additional safeguard against draining forever
@@ -681,6 +672,7 @@
             noService = false;
         }
 
+        @Override
         public void flush() {
             if (id != 0) {
                 // first stop ongoing read/write method
@@ -699,6 +691,7 @@
         }
 
         // replacement for getFramePosition (see AbstractDataLine)
+        @Override
         public long getLongFramePosition() {
             long pos;
             synchronized (lockNative) {
@@ -713,7 +706,6 @@
             return (pos / getFormat().getFrameSize());
         }
 
-
         /*
          * write() belongs into SourceDataLine and Clip,
          * so define it here and make it accessible by
@@ -786,6 +778,7 @@
         }
 
         // called from event dispatcher for lines that need servicing
+        @Override
         public void checkLine() {
             synchronized (lockNative) {
                 if (monitoring
@@ -826,7 +819,6 @@
             }
         }
 
-
         /////////////////// CONTROLS /////////////////////////////
 
         protected final class Gain extends FloatControl {
@@ -844,6 +836,7 @@
                       "dB", "Minimum", "", "Maximum");
             }
 
+            @Override
             public void setValue(float newValue) {
                 // adjust value within range ?? spec says IllegalArgumentException
                 //newValue = Math.min(newValue, getMaximum());
@@ -861,13 +854,13 @@
             }
         } // class Gain
 
-
         private final class Mute extends BooleanControl {
 
             private Mute() {
                 super(BooleanControl.Type.MUTE, false, "True", "False");
             }
 
+            @Override
             public void setValue(boolean newValue) {
                 super.setValue(newValue);
                 calcVolume();
@@ -881,6 +874,7 @@
                       "", "Left", "Center", "Right");
             }
 
+            @Override
             public void setValue(float newValue) {
                 setValueImpl(newValue);
                 panControl.setValueImpl(newValue);
@@ -900,6 +894,7 @@
                       "", "Left", "Center", "Right");
             }
 
+            @Override
             public void setValue(float newValue) {
                 setValueImpl(newValue);
                 balanceControl.setValueImpl(newValue);
@@ -909,19 +904,14 @@
                 super.setValue(newValue);
             }
         } // class Pan
-
-
-
     } // class DirectDL
 
-
     /**
-     * Private inner class representing a SourceDataLine
+     * Private inner class representing a SourceDataLine.
      */
     private static final class DirectSDL extends DirectDL
             implements SourceDataLine {
 
-        // CONSTRUCTOR
         private DirectSDL(DataLine.Info info,
                           AudioFormat format,
                           int bufferSize,
@@ -933,12 +923,11 @@
     }
 
     /**
-     * Private inner class representing a TargetDataLine
+     * Private inner class representing a TargetDataLine.
      */
     private static final class DirectTDL extends DirectDL
             implements TargetDataLine {
 
-        // CONSTRUCTOR
         private DirectTDL(DataLine.Info info,
                           AudioFormat format,
                           int bufferSize,
@@ -947,8 +936,7 @@
             if (Printer.trace) Printer.trace("DirectTDL CONSTRUCTOR: completed");
         }
 
-        // METHOD OVERRIDES
-
+        @Override
         public int read(byte[] b, int off, int len) {
             flushing = false;
             if (len == 0) {
@@ -1030,7 +1018,6 @@
         // auto closing clip support
         private boolean autoclosing = false;
 
-        // CONSTRUCTOR
         private DirectClip(DataLine.Info info,
                            AudioFormat format,
                            int bufferSize,
@@ -1041,6 +1028,7 @@
 
         // CLIP METHODS
 
+        @Override
         public void open(AudioFormat format, byte[] data, int offset, int bufferSize)
             throws LineUnavailableException {
 
@@ -1111,7 +1099,7 @@
             if (Printer.trace) Printer.trace("< DirectClip.open completed");
         }
 
-
+        @Override
         public void open(AudioInputStream stream) throws LineUnavailableException, IOException {
 
             // $$fb part of fix for 4679187: Clip.open() throws unexpected Exceptions
@@ -1178,17 +1166,17 @@
             } // synchronized
         }
 
-
+        @Override
         public int getFrameLength() {
             return m_lengthInFrames;
         }
 
-
+        @Override
         public long getMicrosecondLength() {
             return Toolkit.frames2micros(getFormat(), getFrameLength());
         }
 
-
+        @Override
         public void setFramePosition(int frames) {
             if (Printer.trace) Printer.trace("> DirectClip: setFramePosition: " + frames);
 
@@ -1229,6 +1217,7 @@
         }
 
         // replacement for getFramePosition (see AbstractDataLine)
+        @Override
         public long getLongFramePosition() {
             /* $$fb
              * this would be intuitive, but the definition of getFramePosition
@@ -1243,7 +1232,7 @@
             return super.getLongFramePosition();
         }
 
-
+        @Override
         public synchronized void setMicrosecondPosition(long microseconds) {
             if (Printer.trace) Printer.trace("> DirectClip: setMicrosecondPosition: " + microseconds);
 
@@ -1253,6 +1242,7 @@
             if (Printer.trace) Printer.trace("< DirectClip: setMicrosecondPosition succeeded");
         }
 
+        @Override
         public void setLoopPoints(int start, int end) {
             if (Printer.trace) Printer.trace("> DirectClip: setLoopPoints: start: " + start + " end: " + end);
 
@@ -1283,7 +1273,7 @@
             if (Printer.trace) Printer.trace("< DirectClip: setLoopPoints completed");
         }
 
-
+        @Override
         public void loop(int count) {
             // note: when count reaches 0, it means that the entire clip
             // will be played, i.e. it will play past the loop end point
@@ -1291,10 +1281,7 @@
             start();
         }
 
-        // ABSTRACT METHOD IMPLEMENTATIONS
-
-        // ABSTRACT LINE
-
+        @Override
         void implOpen(AudioFormat format, int bufferSize) throws LineUnavailableException {
             // only if audioData wasn't set in a calling open(format, byte[], frameSize)
             // this call is allowed.
@@ -1304,6 +1291,7 @@
             super.implOpen(format, bufferSize);
         }
 
+        @Override
         void implClose() {
             if (Printer.trace) Printer.trace(">> DirectClip: implClose()");
 
@@ -1333,13 +1321,14 @@
             if (Printer.trace) Printer.trace("<< DirectClip: implClose() succeeded");
         }
 
-
+        @Override
         void implStart() {
             if (Printer.trace) Printer.trace("> DirectClip: implStart()");
             super.implStart();
             if (Printer.trace) Printer.trace("< DirectClip: implStart() succeeded");
         }
 
+        @Override
         void implStop() {
             if (Printer.trace) Printer.trace(">> DirectClip: implStop()");
 
@@ -1351,8 +1340,8 @@
             if (Printer.trace) Printer.trace("<< DirectClip: implStop() succeeded");
         }
 
-
         // main playback loop
+        @Override
         public void run() {
             if (Printer.trace) Printer.trace(">>> DirectClip: run() threadID="+Thread.currentThread().getId());
             while (thread != null) {
@@ -1418,10 +1407,12 @@
            MixerClip. They should be moved to a base class, together
            with the instance variable 'autoclosing'. */
 
+        @Override
         public boolean isAutoClosing() {
             return autoclosing;
         }
 
+        @Override
         public void setAutoClosing(boolean value) {
             if (value != autoclosing) {
                 if (isOpen()) {
@@ -1435,6 +1426,7 @@
             }
         }
 
+        @Override
         protected boolean requiresServicing() {
             // no need for servicing for Clips
             return false;
@@ -1488,5 +1480,4 @@
     private static native boolean nRequiresServicing(long id, boolean isSource);
     // called in irregular intervals
     private static native void nService(long id, boolean isSource);
-
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -28,7 +28,6 @@
 import javax.sound.sampled.Mixer;
 import javax.sound.sampled.spi.MixerProvider;
 
-
 /**
  * DirectAudioDevice provider.
  *
@@ -36,8 +35,6 @@
  */
 public final class DirectAudioDeviceProvider extends MixerProvider {
 
-    // STATIC VARIABLES
-
     /**
      * Set of info objects for all port input devices on the system.
      */
@@ -48,18 +45,11 @@
      */
     private static DirectAudioDevice[] devices;
 
-
-    // STATIC
-
     static {
         // initialize
         Platform.initialize();
     }
 
-
-    // CONSTRUCTOR
-
-
     /**
      * Required public no-arg constructor.
      */
@@ -92,6 +82,7 @@
         }
     }
 
+    @Override
     public Mixer.Info[] getMixerInfo() {
         synchronized (DirectAudioDeviceProvider.class) {
             Mixer.Info[] localArray = new Mixer.Info[infos.length];
@@ -100,7 +91,7 @@
         }
     }
 
-
+    @Override
     public Mixer getMixer(Mixer.Info info) {
         synchronized (DirectAudioDeviceProvider.class) {
             // if the default device is asked, we provide the mixer
@@ -125,7 +116,6 @@
                 String.format("Mixer %s not supported by this provider", info));
     }
 
-
     private static Mixer getDevice(DirectAudioDeviceInfo info) {
         int index = info.getIndex();
         if (devices[index] == null) {
@@ -134,9 +124,6 @@
         return devices[index];
     }
 
-    // INNER CLASSES
-
-
     /**
      * Info class for DirectAudioDevices.  Adds an index value and a string for
      * making native references to a particular device.
@@ -171,7 +158,6 @@
         }
     } // class DirectAudioDeviceInfo
 
-    // NATIVE METHODS
     private static native int nGetNumDevices();
     // index: [0..nGetNumDevices()-1]
     private static native DirectAudioDeviceInfo nNewDirectAudioDeviceInfo(int deviceIndex);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/EmergencySoundbank.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/EmergencySoundbank.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.Random;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/EventDispatcher.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/EventDispatcher.java	Wed Jul 05 22:06:46 2017 +0200
@@ -35,8 +35,6 @@
 import javax.sound.sampled.LineEvent;
 import javax.sound.sampled.LineListener;
 
-
-
 /**
  * EventDispatcher.  Used by various classes in the Java Sound implementation
  * to send events.
@@ -49,39 +47,35 @@
 
     /**
      * time of inactivity until the auto closing clips
-     * are closed
+     * are closed.
      */
     private static final int AUTO_CLOSE_TIME = 5000;
 
-
     /**
-     * List of events
+     * List of events.
      */
     private final ArrayList<EventInfo> eventQueue = new ArrayList<>();
 
-
     /**
-     * Thread object for this EventDispatcher instance
+     * Thread object for this EventDispatcher instance.
      */
     private Thread thread = null;
 
-
     /*
      * support for auto-closing Clips
      */
-    private final ArrayList<ClipInfo> autoClosingClips = new ArrayList<ClipInfo>();
+    private final ArrayList<ClipInfo> autoClosingClips = new ArrayList<>();
 
     /*
      * support for monitoring data lines
      */
-    private final ArrayList<LineMonitor> lineMonitors = new ArrayList<LineMonitor>();
+    private final ArrayList<LineMonitor> lineMonitors = new ArrayList<>();
 
     /**
      * Approximate interval between calls to LineMonitor.checkLine
      */
     static final int LINE_MONITOR_TIME = 400;
 
-
     /**
      * This start() method starts an event thread if one is not already active.
      */
@@ -96,7 +90,6 @@
         }
     }
 
-
     /**
      * Invoked when there is at least one event in the queue.
      * Implement this as a callback to process one event.
@@ -153,7 +146,6 @@
         Printer.err("Unknown event type: " + eventInfo.getEvent());
     }
 
-
     /**
      * Wait until there is something in the event queue to process.  Then
      * dispatch the event to the listeners.The entire method does not
@@ -202,7 +194,6 @@
         }
     }
 
-
     /**
      * Queue the given event in the event queue.
      */
@@ -211,10 +202,10 @@
         notifyAll();
     }
 
-
     /**
      * A loop to dispatch events.
      */
+    @Override
     public void run() {
 
         while (true) {
@@ -226,7 +217,6 @@
         }
     }
 
-
     /**
      * Send audio and MIDI events.
      */
@@ -243,7 +233,6 @@
         postEvent(eventInfo);
     }
 
-
     /*
      * go through the list of registered auto-closing
      * Clip instances and close them, if appropriate
@@ -291,7 +280,7 @@
     }
 
     /**
-     * called from auto-closing clips when one of their open() method is called
+     * called from auto-closing clips when one of their open() method is called.
      */
     void autoClosingClipOpened(AutoClosingClip clip) {
         if (Printer.debug)Printer.debug("> EventDispatcher.autoClosingClipOpened ");
@@ -316,7 +305,7 @@
     }
 
     /**
-     * called from auto-closing clips when their closed() method is called
+     * called from auto-closing clips when their closed() method is called.
      */
     void autoClosingClipClosed(AutoClosingClip clip) {
         // nothing to do -- is removed from arraylist above
@@ -340,9 +329,8 @@
         if (Printer.debug)Printer.debug("< EventDispatcher.monitorLines("+lineMonitors.size()+" monitors)");
     }
 
-
     /**
-     * Add this LineMonitor instance to the list of monitors
+     * Add this LineMonitor instance to the list of monitors.
      */
     void addLineMonitor(LineMonitor lm) {
         if (Printer.trace)Printer.trace("> EventDispatcher.addLineMonitor("+lm+")");
@@ -362,7 +350,7 @@
     }
 
     /**
-     * Remove this LineMonitor instance from the list of monitors
+     * Remove this LineMonitor instance from the list of monitors.
      */
     void removeLineMonitor(LineMonitor lm) {
         if (Printer.trace)Printer.trace("> EventDispatcher.removeLineMonitor("+lm+")");
@@ -377,8 +365,6 @@
         if (Printer.debug)Printer.debug("< EventDispatcher.removeLineMonitor finished -- now ("+lineMonitors.size()+" monitors)");
     }
 
-    // /////////////////////////////////// INNER CLASSES ////////////////////////////////////////// //
-
     /**
      * Container for an event and a set of listeners to deliver it to.
      */
@@ -413,7 +399,7 @@
 
 
     /**
-     * Container for a clip with its expiration time
+     * Container for a clip with its expiration time.
      */
     private class ClipInfo {
 
@@ -421,7 +407,7 @@
         private final long expiration;
 
         /**
-         * Create a new instance of this clip Info class
+         * Create a new instance of this clip Info class.
          */
         ClipInfo(AutoClosingClip clip) {
             this.clip = clip;
@@ -440,13 +426,13 @@
 
     /**
      * Interface that a class that wants to get regular
-     * line monitor events implements
+     * line monitor events implements.
      */
     interface LineMonitor {
         /**
-         * Called by event dispatcher in regular intervals
+         * Called by event dispatcher in regular intervals.
          */
-        public void checkLine();
+        void checkLine();
     }
 
 } // class EventDispatcher
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/FFT.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/FFT.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -588,7 +589,6 @@
             i += jmax << 1;
 
         }
-
     }
 
     // Perform Factor-4 Decomposition with 3 * complex operators and 8 +/-
@@ -682,7 +682,6 @@
             i += jmax << 1;
 
         }
-
     }
 
     private void bitreversal(double[] data) {
@@ -743,6 +742,5 @@
             data[n] = data[m];
             data[m] = tempi;
         }
-
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastShortMessage.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastShortMessage.java	Wed Jul 05 22:06:46 2017 +0200
@@ -25,10 +25,11 @@
 
 package com.sun.media.sound;
 
-import javax.sound.midi.*;
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.ShortMessage;
 
 /**
- * an optimized ShortMessage that does not need an array
+ * an optimized ShortMessage that does not need an array.
  *
  * @author Florian Bomers
  */
@@ -51,6 +52,7 @@
         return packedMsg;
     }
 
+    @Override
     public byte[] getMessage() {
         int length = 0;
         try {
@@ -73,6 +75,7 @@
         return returnedArray;
     }
 
+    @Override
     public int getLength() {
         try {
             return getDataLength(packedMsg & 0xFF) + 1;
@@ -82,6 +85,7 @@
         return 0;
     }
 
+    @Override
     public void setMessage(int status) throws InvalidMidiDataException {
         // check for valid values
         int dataLength = getDataLength(status); // can throw InvalidMidiDataException
@@ -91,35 +95,39 @@
         packedMsg = (packedMsg & 0xFFFF00) | (status & 0xFF);
     }
 
-
+    @Override
     public void setMessage(int status, int data1, int data2) throws InvalidMidiDataException {
         getDataLength(status); // can throw InvalidMidiDataException
         packedMsg = (status & 0xFF) | ((data1 & 0xFF) << 8) | ((data2 & 0xFF) << 16);
     }
 
-
+    @Override
     public void setMessage(int command, int channel, int data1, int data2) throws InvalidMidiDataException {
         getDataLength(command); // can throw InvalidMidiDataException
         packedMsg = (command & 0xF0) | (channel & 0x0F) | ((data1 & 0xFF) << 8) | ((data2 & 0xFF) << 16);
     }
 
-
+    @Override
     public int getChannel() {
         return packedMsg & 0x0F;
     }
 
+    @Override
     public int getCommand() {
         return packedMsg & 0xF0;
     }
 
+    @Override
     public int getData1() {
         return (packedMsg & 0xFF00) >> 8;
     }
 
+    @Override
     public int getData2() {
         return (packedMsg & 0xFF0000) >> 16;
     }
 
+    @Override
     public int getStatus() {
         return packedMsg & 0xFF;
     }
@@ -129,6 +137,7 @@
      * as this object.
      * @return a clone of this instance.
      */
+    @Override
     public Object clone() {
         try {
             return new FastShortMessage(packedMsg);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastSysexMessage.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastSysexMessage.java	Wed Jul 05 22:06:46 2017 +0200
@@ -25,10 +25,11 @@
 
 package com.sun.media.sound;
 
-import javax.sound.midi.*;
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.SysexMessage;
 
 /**
- * optimized FastSysexMessage that doesn't copy the array upon instantiation
+ * optimized FastSysexMessage that doesn't copy the array upon instantiation.
  *
  * @author Florian Bomers
  */
@@ -51,6 +52,7 @@
 
     // overwrite this method so that the original data array,
     // which is shared among all transmitters, cannot be modified
+    @Override
     public void setMessage(byte[] data, int length) throws InvalidMidiDataException {
         if ((data.length == 0) || (((data[0] & 0xFF) != 0xF0) && ((data[0] & 0xFF) != 0xF7))) {
             super.setMessage(data, data.length); // will throw Exception
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidDataException.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidDataException.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.IOException;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidFormatException.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidFormatException.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java	Wed Jul 05 22:06:46 2017 +0200
@@ -69,11 +69,12 @@
         return ok;
     }
 
+    @Override
     public Soundbank getSoundbank(URL url)
             throws InvalidMidiDataException, IOException {
         if (!isZIP(url))
             return null;
-        ArrayList<Soundbank> soundbanks = new ArrayList<Soundbank>();
+        ArrayList<Soundbank> soundbanks = new ArrayList<>();
         URLClassLoader ucl = URLClassLoader.newInstance(new URL[]{url});
         InputStream stream = ucl.getResourceAsStream(
                 "META-INF/services/javax.sound.midi.Soundbank");
@@ -114,12 +115,14 @@
         return sbk;
     }
 
+    @Override
     public Soundbank getSoundbank(InputStream stream)
             throws InvalidMidiDataException, IOException {
         Objects.requireNonNull(stream);
         return null;
     }
 
+    @Override
     public Soundbank getSoundbank(File file)
             throws InvalidMidiDataException, IOException {
         return getSoundbank(file.toURI().toURL());
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JDK13Services.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JDK13Services.java	Wed Jul 05 22:06:46 2017 +0200
@@ -136,7 +136,6 @@
         return value;
     }
 
-
     /** Obtain the instance name part of a default provider property.
         @param typeClass The type of the default provider property. This
         should be one of Receiver.class, Transmitter.class, Sequencer.class,
@@ -158,7 +157,6 @@
         return value;
     }
 
-
     /** Obtain the value of a default provider property.
         @param typeClass The type of the default provider property. This
         should be one of Receiver.class, Transmitter.class, Sequencer.class,
@@ -190,7 +188,6 @@
         return value;
     }
 
-
     /** Obtain a properties bundle containing property values from the
         properties file. If the properties file could not be loaded,
         the properties bundle is empty.
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java	Wed Jul 05 22:06:46 2017 +0200
@@ -26,19 +26,17 @@
 package com.sun.media.sound;
 
 import java.io.BufferedInputStream;
-import java.io.InputStream;
 import java.io.File;
 import java.io.FileInputStream;
-
+import java.io.InputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
 import java.util.ServiceLoader;
 
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
 import javax.sound.sampled.AudioPermission;
 
 /** Managing security in the Java Sound implementation.
@@ -64,7 +62,6 @@
         return (System.getSecurityManager() != null);
     }
 
-
     static void checkRecordPermission() throws SecurityException {
         if(Printer.trace) Printer.trace("JSSecurityManager.checkRecordPermission()");
         SecurityManager sm = System.getSecurityManager();
@@ -90,6 +87,7 @@
             try {
                 // invoke the privileged action using 1.2 security
                 PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
+                        @Override
                         public Void run() {
                             loadPropertiesImpl(properties, filename);
                             return null;
@@ -108,7 +106,6 @@
         }
     }
 
-
     private static void loadPropertiesImpl(Properties properties,
                                            String filename) {
         if(Printer.trace)Printer.trace(">> JSSecurityManager: loadPropertiesImpl()");
@@ -176,6 +173,7 @@
         // the iterator's hasNext() method looks through classpath for
         // the provider class names, so it requires read permissions
         PrivilegedAction<Boolean> hasNextAction = new PrivilegedAction<Boolean>() {
+            @Override
             public Boolean run() {
                 return ps.hasNext();
             }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java	Wed Jul 05 22:06:46 2017 +0200
@@ -25,38 +25,36 @@
 
 package com.sun.media.sound;
 
+import java.applet.AudioClip;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.applet.AudioClip;
 
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.MetaEventListener;
+import javax.sound.midi.MetaMessage;
+import javax.sound.midi.MidiFileFormat;
+import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Sequence;
+import javax.sound.midi.Sequencer;
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.Clip;
-import javax.sound.sampled.AudioInputStream;
-import javax.sound.sampled.AudioFormat;
 import javax.sound.sampled.DataLine;
-import javax.sound.sampled.SourceDataLine;
 import javax.sound.sampled.LineEvent;
 import javax.sound.sampled.LineListener;
+import javax.sound.sampled.SourceDataLine;
 import javax.sound.sampled.UnsupportedAudioFileException;
 
-import javax.sound.midi.MidiSystem;
-import javax.sound.midi.MidiFileFormat;
-import javax.sound.midi.MetaMessage;
-import javax.sound.midi.Sequence;
-import javax.sound.midi.Sequencer;
-import javax.sound.midi.InvalidMidiDataException;
-import javax.sound.midi.MidiUnavailableException;
-import javax.sound.midi.MetaEventListener;
-
 /**
  * Java Sound audio clip;
  *
  * @author Arthur van Hoff, Kara Kytle, Jan Borgersen
  * @author Florian Bomers
  */
-
 public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, LineListener {
 
     private static final boolean DEBUG = false;
@@ -126,12 +124,12 @@
         }
     }
 
-
+    @Override
     public synchronized void play() {
         startImpl(false);
     }
 
-
+    @Override
     public synchronized void loop() {
         startImpl(true);
     }
@@ -205,6 +203,7 @@
         }
     }
 
+    @Override
     public synchronized void stop() {
 
         if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip->stop()");
@@ -248,13 +247,15 @@
 
     // Event handlers (for debugging)
 
+    @Override
     public synchronized void update(LineEvent event) {
         if (DEBUG || Printer.debug) Printer.debug("line event received: "+event);
     }
 
     // handle MIDI track end meta events for looping
 
-    public synchronized void meta( MetaMessage message ) {
+    @Override
+    public synchronized void meta(MetaMessage message) {
 
         if (DEBUG || Printer.debug)Printer.debug("META EVENT RECEIVED!!!!! ");
 
@@ -269,12 +270,12 @@
         }
     }
 
-
+    @Override
     public String toString() {
         return getClass().toString();
     }
 
-
+    @Override
     protected void finalize() {
 
         if (clip != null) {
@@ -326,8 +327,6 @@
         return true;
     }
 
-
-
     private void readStream(AudioInputStream as, long byteLen) throws IOException {
         // arrays "only" max. 2GB
         int intLen;
@@ -371,7 +370,6 @@
         loadedAudioByteLength = totalBytesRead;
     }
 
-
     // METHODS FOR CREATING THE DEVICE
 
     private boolean createClip() {
@@ -464,7 +462,6 @@
         return true;
     }
 
-
     /*
      * private inner class representing a ByteArrayOutputStream
      * which allows retrieval of the internal array
@@ -479,5 +476,4 @@
         }
 
     } // class DirectBAOS
-
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceReceiverEnvelope.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceReceiverEnvelope.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,10 +22,13 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
-import javax.sound.midi.*;
-
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiDeviceReceiver;
+import javax.sound.midi.MidiMessage;
+import javax.sound.midi.Receiver;
 
 /**
  * Helper class which allows to convert {@code Receiver}
@@ -55,15 +58,18 @@
     }
 
     // Receiver implementation
+    @Override
     public void close() {
         receiver.close();
     }
 
+    @Override
     public void send(MidiMessage message, long timeStamp) {
         receiver.send(message, timeStamp);
     }
 
     // MidiDeviceReceiver implementation
+    @Override
     public MidiDevice getMidiDevice() {
         return device;
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,10 +22,13 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
-import javax.sound.midi.*;
-
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiDeviceTransmitter;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.Transmitter;
 
 /**
  * Helper class which allows to convert {@code Transmitter}
@@ -55,20 +58,23 @@
     }
 
     // Transmitter implementation
+    @Override
     public void setReceiver(Receiver receiver) {
         transmitter.setReceiver(receiver);
     }
 
+    @Override
     public Receiver getReceiver() {
         return transmitter.getReceiver();
     }
 
+    @Override
     public void close() {
         transmitter.close();
     }
 
-
     // MidiDeviceReceiver implementation
+    @Override
     public MidiDevice getMidiDevice() {
         return device;
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDevice.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDevice.java	Wed Jul 05 22:06:46 2017 +0200
@@ -25,9 +25,8 @@
 
 package com.sun.media.sound;
 
-import javax.sound.midi.*;
-
-
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Transmitter;
 
 /**
  * MidiInDevice class representing functionality of MidiIn devices.
@@ -40,18 +39,14 @@
 
     private volatile Thread midiInThread;
 
-    // CONSTRUCTOR
-
     MidiInDevice(AbstractMidiDeviceProvider.Info info) {
         super(info);
         if(Printer.trace) Printer.trace("MidiInDevice CONSTRUCTOR");
     }
 
-
-    // IMPLEMENTATION OF ABSTRACT MIDI DEVICE METHODS
-
     // $$kk: 06.24.99: i have this both opening and starting the midi in device.
     // may want to separate these??
+    @Override
     protected synchronized void implOpen() throws MidiUnavailableException {
         if (Printer.trace) Printer.trace("> MidiInDevice: implOpen()");
 
@@ -75,9 +70,9 @@
         if (Printer.trace) Printer.trace("< MidiInDevice: implOpen() completed");
     }
 
-
     // $$kk: 06.24.99: i have this both stopping and closing the midi in device.
     // may want to separate these??
+    @Override
     protected synchronized void implClose() {
         if (Printer.trace) Printer.trace("> MidiInDevice: implClose()");
         long oldId = id;
@@ -98,7 +93,7 @@
         if (Printer.trace) Printer.trace("< MidiInDevice: implClose() completed");
     }
 
-
+    @Override
     public long getMicrosecondPosition() {
         long timestamp = -1;
         if (isOpen()) {
@@ -107,22 +102,21 @@
         return timestamp;
     }
 
-
     // OVERRIDES OF ABSTRACT MIDI DEVICE METHODS
 
-
+    @Override
     protected boolean hasTransmitters() {
         return true;
     }
 
-
+    @Override
     protected Transmitter createTransmitter() {
         return new MidiInTransmitter();
     }
 
     /**
       * An own class to distinguish the class name from
-      * the transmitter of other devices
+      * the transmitter of other devices.
       */
     private final class MidiInTransmitter extends BasicTransmitter {
         private MidiInTransmitter() {
@@ -130,8 +124,7 @@
         }
     }
 
-    // RUNNABLE METHOD
-
+    @Override
     public void run() {
         // while the device is started, keep trying to get messages.
         // this thread returns from native code whenever stop() or close() is called
@@ -149,9 +142,6 @@
         midiInThread = null;
     }
 
-
-    // CALLBACKS FROM NATIVE
-
     /**
      * Callback from native code when a short MIDI event is received from hardware.
      * @param packedMsg: status | data1 << 8 | data2 << 8
@@ -179,8 +169,6 @@
         getTransmitterList().sendMessage(data, timeStamp);
     }
 
-    // NATIVE METHODS
-
     private native long nOpen(int index) throws MidiUnavailableException;
     private native void nClose(long id);
 
@@ -190,6 +178,4 @@
 
     // go into native code and get messages. May be blocking
     private native void nGetMessages(long id);
-
-
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDeviceProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDeviceProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -27,7 +27,6 @@
 
 import javax.sound.midi.MidiDevice;
 
-
 /**
  * MIDI input device provider.
  *
@@ -44,16 +43,12 @@
 
     private static final boolean enabled;
 
-    // STATIC
-
     static {
         // initialize
         Platform.initialize();
         enabled = Platform.isMidiIOEnabled();
     }
 
-    // CONSTRUCTOR
-
     /**
      * Required public no-arg constructor.
      */
@@ -63,6 +58,7 @@
 
     // implementation of abstract methods in AbstractMidiDeviceProvider
 
+    @Override
     AbstractMidiDeviceProvider.Info createInfo(int index) {
         if (!enabled) {
             return null;
@@ -70,6 +66,7 @@
         return new MidiInDeviceInfo(index, MidiInDeviceProvider.class);
     }
 
+    @Override
     MidiDevice createDevice(AbstractMidiDeviceProvider.Info info) {
         if (enabled && (info instanceof MidiInDeviceInfo)) {
             return new MidiInDevice(info);
@@ -77,6 +74,7 @@
         return null;
     }
 
+    @Override
     int getNumDevices() {
         if (!enabled) {
             if (Printer.debug)Printer.debug("MidiInDevice not enabled, returning 0 devices");
@@ -87,14 +85,15 @@
         return numDevices;
     }
 
+    @Override
     MidiDevice[] getDeviceCache() { return devices; }
+    @Override
     void setDeviceCache(MidiDevice[] devices) { MidiInDeviceProvider.devices = devices; }
+    @Override
     Info[] getInfoCache() { return infos; }
+    @Override
     void setInfoCache(Info[] infos) { MidiInDeviceProvider.infos = infos; }
 
-
-    // INNER CLASSES
-
     /**
      * Info class for MidiInDevices.  Adds the
      * provider's Class to keep the provider class from being
@@ -115,9 +114,6 @@
 
     } // class MidiInDeviceInfo
 
-
-    // NATIVE METHODS
-
     private static native int nGetNumDevices();
     private static native String nGetName(int index);
     private static native String nGetVendor(int index);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDevice.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDevice.java	Wed Jul 05 22:06:46 2017 +0200
@@ -25,9 +25,10 @@
 
 package com.sun.media.sound;
 
-import javax.sound.midi.*;
-
-
+import javax.sound.midi.MidiMessage;
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.ShortMessage;
 
 /**
  * MidiOutDevice class representing functionality of MidiOut devices.
@@ -38,16 +39,12 @@
  */
 final class MidiOutDevice extends AbstractMidiDevice {
 
-    // CONSTRUCTOR
-
     MidiOutDevice(AbstractMidiDeviceProvider.Info info) {
                 super(info);
                 if(Printer.trace) Printer.trace("MidiOutDevice CONSTRUCTOR");
     }
 
-
-    // IMPLEMENTATION OF ABSTRACT MIDI DEVICE METHODS
-
+    @Override
     protected synchronized void implOpen() throws MidiUnavailableException {
         if (Printer.trace) Printer.trace("> MidiOutDevice: implOpen()");
         int index = ((AbstractMidiDeviceProvider.Info)getDeviceInfo()).getIndex();
@@ -58,7 +55,7 @@
         if (Printer.trace) Printer.trace("< MidiOutDevice: implOpen(): completed.");
     }
 
-
+    @Override
     protected synchronized void implClose() {
         if (Printer.trace) Printer.trace("> MidiOutDevice: implClose()");
         // prevent further action
@@ -72,7 +69,7 @@
         if (Printer.trace) Printer.trace("< MidiOutDevice: implClose(): completed");
     }
 
-
+    @Override
     public long getMicrosecondPosition() {
         long timestamp = -1;
         if (isOpen()) {
@@ -81,28 +78,23 @@
         return timestamp;
     }
 
-
-
-    // OVERRIDES OF ABSTRACT MIDI DEVICE METHODS
-
     /** Returns if this device supports Receivers.
         This implementation always returns true.
         @return true, if the device supports Receivers, false otherwise.
     */
+    @Override
     protected boolean hasReceivers() {
         return true;
     }
 
-
+    @Override
     protected Receiver createReceiver() {
         return new MidiOutReceiver();
     }
 
-
-    // INNER CLASSES
-
     final class MidiOutReceiver extends AbstractReceiver {
 
+        @Override
         void implSend(final MidiMessage message, final long timeStamp) {
             final int length = message.getLength();
             final int status = message.getStatus();
@@ -159,13 +151,8 @@
                 nSendShortMessage(id, packedMsg, timeStamp);
             }
         }
-
-
     } // class MidiOutReceiver
 
-
-    // NATIVE METHODS
-
     private native long nOpen(int index) throws MidiUnavailableException;
     private native void nClose(long id);
 
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -27,7 +27,6 @@
 
 import javax.sound.midi.MidiDevice;
 
-
 /**
  * MIDI output device provider.
  *
@@ -44,16 +43,12 @@
 
     private static final boolean enabled;
 
-    // STATIC
-
     static {
         // initialize
         Platform.initialize();
         enabled = Platform.isMidiIOEnabled();
     }
 
-    // CONSTRUCTOR
-
     /**
      * Required public no-arg constructor.
      */
@@ -61,8 +56,7 @@
         if (Printer.trace) Printer.trace("MidiOutDeviceProvider: constructor");
     }
 
-    // implementation of abstract methods in AbstractMidiDeviceProvider
-
+    @Override
     AbstractMidiDeviceProvider.Info createInfo(int index) {
         if (!enabled) {
             return null;
@@ -70,6 +64,7 @@
         return new MidiOutDeviceInfo(index, MidiOutDeviceProvider.class);
     }
 
+    @Override
     MidiDevice createDevice(AbstractMidiDeviceProvider.Info info) {
         if (enabled && (info instanceof MidiOutDeviceInfo)) {
             return new MidiOutDevice(info);
@@ -77,6 +72,7 @@
         return null;
     }
 
+    @Override
     int getNumDevices() {
         if (!enabled) {
             if (Printer.debug)Printer.debug("MidiOutDevice not enabled, returning 0 devices");
@@ -85,14 +81,15 @@
         return nGetNumDevices();
     }
 
+    @Override
     MidiDevice[] getDeviceCache() { return devices; }
+    @Override
     void setDeviceCache(MidiDevice[] devices) { MidiOutDeviceProvider.devices = devices; }
+    @Override
     Info[] getInfoCache() { return infos; }
+    @Override
     void setInfoCache(Info[] infos) { MidiOutDeviceProvider.infos = infos; }
 
-
-    // INNER CLASSES
-
     /**
      * Info class for MidiOutDevices.  Adds the
      * provider's Class to keep the provider class from being
@@ -113,9 +110,6 @@
 
     } // class MidiOutDeviceInfo
 
-
-    // NATIVE METHODS
-
     private static native int nGetNumDevices();
     private static native String nGetName(int index);
     private static native String nGetVendor(int index);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiUtils.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiUtils.java	Wed Jul 05 22:06:46 2017 +0200
@@ -77,7 +77,6 @@
         return ((msg[1] & 0xFF) == META_END_OF_TRACK_TYPE) && (msg[2] == 0);
     }
 
-
     /** return if the given message is a meta tempo message */
     public static boolean isMetaTempo(MidiMessage midiMsg) {
         // first check if it is a META message at all
@@ -91,7 +90,6 @@
         return ((msg[1] & 0xFF) == META_TEMPO_TYPE) && (msg[2] == 3);
     }
 
-
     /** parses this message for a META tempo message and returns
      * the tempo in MPQ, or -1 if this isn't a tempo message
      */
@@ -111,7 +109,6 @@
         return tempo;
     }
 
-
     /**
      * converts<br>
      * 1 - MPQ-Tempo to BPM tempo<br>
@@ -124,7 +121,6 @@
         return ((double) 60000000l) / tempo;
     }
 
-
     /**
      * convert tick to microsecond with given tempo.
      * Does not take tempo changes into account.
@@ -145,7 +141,6 @@
         return (long) ((((double)us) * resolution) / tempoMPQ);
     }
 
-
     /**
      * Given a tick, convert to microsecond
      * @param cache tempo info and current tempo
@@ -246,7 +241,6 @@
         return tick;
     }
 
-
     /**
      * Binary search for the event indexes of the track
      *
@@ -283,7 +277,6 @@
         return ret;
     }
 
-
     public static final class TempoCache {
         long[] ticks;
         int[] tempos; // in MPQ
@@ -310,7 +303,6 @@
             refresh(seq);
         }
 
-
         public synchronized void refresh(Sequence seq) {
             ArrayList<MidiEvent> list = new ArrayList<>();
             Track[] tracks = seq.getTracks();
@@ -373,6 +365,5 @@
             }
             return tempos[tempos.length - 1];
         }
-
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractChannelMixer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractChannelMixer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -32,95 +33,123 @@
  */
 public abstract class ModelAbstractChannelMixer implements ModelChannelMixer {
 
+    @Override
     public abstract boolean process(float[][] buffer, int offset, int len);
 
+    @Override
     public abstract void stop();
 
+    @Override
     public void allNotesOff() {
     }
 
+    @Override
     public void allSoundOff() {
     }
 
+    @Override
     public void controlChange(int controller, int value) {
     }
 
+    @Override
     public int getChannelPressure() {
         return 0;
     }
 
+    @Override
     public int getController(int controller) {
         return 0;
     }
 
+    @Override
     public boolean getMono() {
         return false;
     }
 
+    @Override
     public boolean getMute() {
         return false;
     }
 
+    @Override
     public boolean getOmni() {
         return false;
     }
 
+    @Override
     public int getPitchBend() {
         return 0;
     }
 
+    @Override
     public int getPolyPressure(int noteNumber) {
         return 0;
     }
 
+    @Override
     public int getProgram() {
         return 0;
     }
 
+    @Override
     public boolean getSolo() {
         return false;
     }
 
+    @Override
     public boolean localControl(boolean on) {
         return false;
     }
 
+    @Override
     public void noteOff(int noteNumber) {
     }
 
+    @Override
     public void noteOff(int noteNumber, int velocity) {
     }
 
+    @Override
     public void noteOn(int noteNumber, int velocity) {
     }
 
+    @Override
     public void programChange(int program) {
     }
 
+    @Override
     public void programChange(int bank, int program) {
     }
 
+    @Override
     public void resetAllControllers() {
     }
 
+    @Override
     public void setChannelPressure(int pressure) {
     }
 
+    @Override
     public void setMono(boolean on) {
     }
 
+    @Override
     public void setMute(boolean mute) {
     }
 
+    @Override
     public void setOmni(boolean on) {
     }
 
+    @Override
     public void setPitchBend(int bend) {
     }
 
+    @Override
     public void setPolyPressure(int noteNumber, int pressure) {
     }
 
+    @Override
     public void setSolo(boolean soloState) {
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractOscillator.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractOscillator.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,9 +22,11 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.IOException;
+
 import javax.sound.midi.Instrument;
 import javax.sound.midi.MidiChannel;
 import javax.sound.midi.Patch;
@@ -51,15 +53,18 @@
     public void init() {
     }
 
+    @Override
     public void close() throws IOException {
     }
 
+    @Override
     public void noteOff(int velocity) {
         on = false;
     }
 
+    @Override
     public void noteOn(MidiChannel channel, VoiceStatus voice, int noteNumber,
-            int velocity) {
+                       int velocity) {
         this.channel = channel;
         this.voice = voice;
         this.noteNumber = noteNumber;
@@ -67,6 +72,7 @@
         on = true;
     }
 
+    @Override
     public int read(float[][] buffer, int offset, int len) throws IOException {
         return -1;
     }
@@ -91,6 +97,7 @@
         return on;
     }
 
+    @Override
     public void setPitch(float pitch) {
         this.pitch = pitch;
     }
@@ -107,14 +114,17 @@
         return samplerate;
     }
 
+    @Override
     public float getAttenuation() {
         return 0;
     }
 
+    @Override
     public int getChannels() {
         return 1;
     }
 
+    @Override
     public String getName() {
         return getClass().getName();
     }
@@ -123,6 +133,7 @@
         return new Patch(0, 0);
     }
 
+    @Override
     public ModelOscillatorStream open(float samplerate) {
         ModelAbstractOscillator oscs;
         try {
@@ -162,10 +173,12 @@
         return sbk;
     }
 
+    @Override
     public String getDescription() {
         return getName();
     }
 
+    @Override
     public Instrument getInstrument(Patch patch) {
         Instrument ins = getInstrument();
         Patch p = ins.getPatch();
@@ -182,18 +195,22 @@
         return ins;
     }
 
+    @Override
     public Instrument[] getInstruments() {
         return new Instrument[]{getInstrument()};
     }
 
+    @Override
     public SoundbankResource[] getResources() {
         return new SoundbankResource[0];
     }
 
+    @Override
     public String getVendor() {
         return null;
     }
 
+    @Override
     public String getVersion() {
         return null;
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.ByteArrayInputStream;
@@ -60,12 +61,14 @@
             left = capacity();
         }
 
+        @Override
         public int available() throws IOException {
             if (left > Integer.MAX_VALUE)
                 return Integer.MAX_VALUE;
             return (int)left;
         }
 
+        @Override
         public synchronized void mark(int readlimit) {
             try {
                 mark = raf.getFilePointer();
@@ -75,15 +78,18 @@
             }
         }
 
+        @Override
         public boolean markSupported() {
             return true;
         }
 
+        @Override
         public synchronized void reset() throws IOException {
             raf.seek(mark);
             left = markleft;
         }
 
+        @Override
         public long skip(long n) throws IOException {
             if( n < 0)
                 return 0;
@@ -95,6 +101,7 @@
             return n;
         }
 
+        @Override
         public int read(byte b[], int off, int len) throws IOException {
             if (len > left)
                 len = (int)left;
@@ -107,6 +114,7 @@
             return len;
         }
 
+        @Override
         public int read(byte[] b) throws IOException {
             int len = b.length;
             if (len > left)
@@ -120,6 +128,7 @@
             return len;
         }
 
+        @Override
         public int read() throws IOException {
             if (left == 0)
                 return -1;
@@ -130,6 +139,7 @@
             return b;
         }
 
+        @Override
         public void close() throws IOException {
             raf.close();
         }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,14 +22,16 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.IOException;
 import java.io.InputStream;
+
 import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioFormat.Encoding;
 import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.AudioFormat.Encoding;
 
 /**
  * Wavetable oscillator for pre-loaded data.
@@ -52,6 +54,7 @@
             bigendian = format.isBigEndian();
         }
 
+        @Override
         public int read(byte[] b, int off, int len) throws IOException {
             int avail = available();
             if (avail <= 0)
@@ -82,6 +85,7 @@
             return len;
         }
 
+        @Override
         public long skip(long n) throws IOException {
             int avail = available();
             if (avail <= 0)
@@ -93,10 +97,12 @@
             return super.skip(n);
         }
 
+        @Override
         public int read(byte[] b) throws IOException {
             return read(b, 0, b.length);
         }
 
+        @Override
         public int read() throws IOException {
             byte[] b = new byte[1];
             int ret = read(b, 0, 1);
@@ -105,19 +111,23 @@
             return 0 & 0xFF;
         }
 
+        @Override
         public boolean markSupported() {
             return true;
         }
 
+        @Override
         public int available() throws IOException {
             return (int)buffer.capacity() + (int)buffer8.capacity() - pos - pos2;
         }
 
+        @Override
         public synchronized void mark(int readlimit) {
             markpos = pos;
             markpos2 = pos2;
         }
 
+        @Override
         public synchronized void reset() throws IOException {
             pos = markpos;
             pos2 = markpos2;
@@ -189,6 +199,7 @@
         return format;
     }
 
+    @Override
     public AudioFloatInputStream openStream() {
         if (buffer == null)
             return null;
@@ -230,16 +241,19 @@
                 (int)buffer.arrayOffset(), (int)buffer.capacity());
     }
 
+    @Override
     public int getChannels() {
         return getFormat().getChannels();
     }
 
+    @Override
     public ModelOscillatorStream open(float samplerate) {
         // ModelWavetableOscillator doesn't support ModelOscillatorStream
         return null;
     }
 
     // attenuation is in cB
+    @Override
     public float getAttenuation() {
         return attenuation;
     }
@@ -248,6 +262,7 @@
         this.attenuation = attenuation;
     }
 
+    @Override
     public float getLoopLength() {
         return loopLength;
     }
@@ -256,6 +271,7 @@
         this.loopLength = loopLength;
     }
 
+    @Override
     public float getLoopStart() {
         return loopStart;
     }
@@ -268,10 +284,12 @@
         this.loopType = loopType;
     }
 
+    @Override
     public int getLoopType() {
         return loopType;
     }
 
+    @Override
     public float getPitchcorrection() {
         return pitchcorrection;
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelChannelMixer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelChannelMixer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import javax.sound.midi.MidiChannel;
@@ -42,9 +43,9 @@
 public interface ModelChannelMixer extends MidiChannel {
 
     // Used to process input audio from voices mix.
-    public boolean process(float[][] buffer, int offset, int len);
+    boolean process(float[][] buffer, int offset, int len);
 
     // Is used to trigger that this mixer is not be used
     // and it should fade out.
-    public void stop();
+    void stop();
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelConnectionBlock.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelConnectionBlock.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.Arrays;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDestination.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDestination.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirectedPlayer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirectedPlayer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -32,5 +33,5 @@
  */
 public interface ModelDirectedPlayer {
 
-    public void play(int performerIndex, ModelConnectionBlock[] connectionBlocks);
+    void play(int performerIndex, ModelConnectionBlock[] connectionBlocks);
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirector.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirector.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -38,9 +39,9 @@
  */
 public interface ModelDirector {
 
-    public void noteOn(int noteNumber, int velocity);
+    void noteOn(int noteNumber, int velocity);
 
-    public void noteOff(int noteNumber, int velocity);
+    void noteOff(int noteNumber, int velocity);
 
-    public void close();
+    void close();
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelIdentifier.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelIdentifier.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -134,6 +135,7 @@
         this.variable = variable;
     }
 
+    @Override
     public int hashCode() {
         int hashcode = instance;
         if(object != null) hashcode |= object.hashCode();
@@ -141,6 +143,7 @@
         return  hashcode;
     }
 
+    @Override
     public boolean equals(Object obj) {
         if (!(obj instanceof ModelIdentifier))
             return false;
@@ -159,6 +162,7 @@
         return true;
     }
 
+    @Override
     public String toString() {
         if (variable == null) {
             return object + "[" + instance + "]";
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrument.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrument.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import javax.sound.midi.Instrument;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrumentComparator.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrumentComparator.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,9 +22,11 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.Comparator;
+
 import javax.sound.midi.Instrument;
 import javax.sound.midi.Patch;
 
@@ -36,6 +38,7 @@
  */
 public final class ModelInstrumentComparator implements Comparator<Instrument> {
 
+    @Override
     public int compare(Instrument arg0, Instrument arg1) {
         Patch p0 = arg0.getPatch();
         Patch p1 = arg1.getPatch();
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelMappedInstrument.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelMappedInstrument.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import javax.sound.midi.MidiChannel;
@@ -42,21 +43,25 @@
         this.ins = ins;
     }
 
+    @Override
     public Object getData() {
         return ins.getData();
     }
 
+    @Override
     public ModelPerformer[] getPerformers() {
         return ins.getPerformers();
     }
 
+    @Override
     public ModelDirector getDirector(ModelPerformer[] performers,
-            MidiChannel channel, ModelDirectedPlayer player) {
+                                     MidiChannel channel, ModelDirectedPlayer player) {
         return ins.getDirector(performers, channel, player);
     }
 
+    @Override
     public ModelChannelMixer getChannelMixer(MidiChannel channel,
-            AudioFormat format) {
+                                             AudioFormat format) {
         return ins.getChannelMixer(channel, format);
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillator.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillator.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -32,13 +33,13 @@
  */
 public interface ModelOscillator {
 
-    public int getChannels();
+    int getChannels();
 
     /**
      * Attenuation is in cB.
      * @return
      */
-    public float getAttenuation();
+    float getAttenuation();
 
-    public ModelOscillatorStream open(float samplerate);
+    ModelOscillatorStream open(float samplerate);
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillatorStream.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillatorStream.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,9 +22,11 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.IOException;
+
 import javax.sound.midi.MidiChannel;
 import javax.sound.midi.VoiceStatus;
 
@@ -35,14 +37,14 @@
  */
 public interface ModelOscillatorStream {
 
-    public void setPitch(float pitch); // Pitch is in cents!
+    void setPitch(float pitch); // Pitch is in cents!
 
-    public void noteOn(MidiChannel channel, VoiceStatus voice, int noteNumber,
-            int velocity);
+    void noteOn(MidiChannel channel, VoiceStatus voice, int noteNumber,
+                int velocity);
 
-    public void noteOff(int velocity);
+    void noteOff(int velocity);
 
-    public int read(float[][] buffer, int offset, int len) throws IOException;
+    int read(float[][] buffer, int offset, int len) throws IOException;
 
-    public void close() throws IOException;
+    void close() throws IOException;
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPatch.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPatch.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import javax.sound.midi.Patch;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPerformer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPerformer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.ArrayList;
@@ -35,9 +36,9 @@
  */
 public final class ModelPerformer {
 
-    private final List<ModelOscillator> oscillators = new ArrayList<ModelOscillator>();
-    private List<ModelConnectionBlock> connectionBlocks
-            = new ArrayList<ModelConnectionBlock>();
+    private final List<ModelOscillator> oscillators = new ArrayList<>();
+    private List<ModelConnectionBlock> connectionBlocks = new ArrayList<>();
+
     private int keyFrom = 0;
     private int keyTo = 127;
     private int velFrom = 0;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelSource.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelSource.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardDirector.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardDirector.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.Arrays;
@@ -52,9 +53,11 @@
         }
     }
 
+    @Override
     public void close() {
     }
 
+    @Override
     public void noteOff(int noteNumber, int velocity) {
         if (!noteOffUsed)
             return;
@@ -70,6 +73,7 @@
         }
     }
 
+    @Override
     public void noteOn(int noteNumber, int velocity) {
         if (!noteOnUsed)
             return;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.Arrays;
@@ -156,9 +157,11 @@
         }
     }
 
+    @Override
     public void close() {
     }
 
+    @Override
     public void noteOff(int noteNumber, int velocity) {
         if (!noteOffUsed)
             return;
@@ -172,6 +175,7 @@
         }
     }
 
+    @Override
     public void noteOn(int noteNumber, int velocity) {
         if (!noteOnUsed)
             return;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardTransform.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardTransform.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -73,6 +74,7 @@
         this.transform = transform;
     }
 
+    @Override
     public double transform(double value) {
         double s;
         double a;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelTransform.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelTransform.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -31,5 +32,5 @@
  */
 public interface ModelTransform {
 
-    public abstract double transform(double value);
+    double transform(double value);
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelWavetable.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelWavetable.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -31,19 +32,19 @@
  */
 public interface ModelWavetable extends ModelOscillator {
 
-    public static final int LOOP_TYPE_OFF = 0;
-    public static final int LOOP_TYPE_FORWARD = 1;
-    public static final int LOOP_TYPE_RELEASE = 2;
-    public static final int LOOP_TYPE_PINGPONG = 4;
-    public static final int LOOP_TYPE_REVERSE = 8;
+    int LOOP_TYPE_OFF = 0;
+    int LOOP_TYPE_FORWARD = 1;
+    int LOOP_TYPE_RELEASE = 2;
+    int LOOP_TYPE_PINGPONG = 4;
+    int LOOP_TYPE_REVERSE = 8;
 
-    public AudioFloatInputStream openStream();
+    AudioFloatInputStream openStream();
 
-    public float getLoopLength();
+    float getLoopLength();
 
-    public float getLoopStart();
+    float getLoopStart();
 
-    public int getLoopType();
+    int getLoopType();
 
-    public float getPitchcorrection();
+    float getPitchcorrection();
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/PCMtoPCMCodec.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/PCMtoPCMCodec.java	Wed Jul 05 22:06:46 2017 +0200
@@ -40,7 +40,6 @@
  */
 public final class PCMtoPCMCodec extends SunCodec {
 
-
     private static final AudioFormat.Encoding[] inputEncodings = {
         AudioFormat.Encoding.PCM_SIGNED,
         AudioFormat.Encoding.PCM_UNSIGNED,
@@ -59,8 +58,7 @@
         super( inputEncodings, outputEncodings);
     }
 
-    // NEW CODE
-
+    @Override
     public AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat) {
 
         final int sampleSize = sourceFormat.getSampleSizeInBits();
@@ -88,9 +86,7 @@
         return new AudioFormat.Encoding[0];
     }
 
-
-    /**
-     */
+    @Override
     public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){
         Objects.requireNonNull(targetEncoding);
 
@@ -113,9 +109,7 @@
         return formatArray;
     }
 
-
-    /**
-     */
+    @Override
     public AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream) {
 
         if( isConversionSupported(targetEncoding, sourceStream.getFormat()) ) {
@@ -136,9 +130,8 @@
         }
 
     }
-    /**
-     * use old code
-     */
+
+    @Override
     public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream){
         if (!isConversionSupported(targetFormat, sourceStream.getFormat()))
             throw new IllegalArgumentException("Unsupported conversion: "
@@ -147,11 +140,6 @@
         return getConvertedStream( targetFormat, sourceStream );
     }
 
-
-
-
-    // OLD CODE
-
     /**
      * Opens the codec with the specified parameters.
      * @param stream stream from which data to be processed should be read
@@ -160,7 +148,6 @@
      * @throws IllegalArgumentException if the format combination supplied is
      * not supported.
      */
-    /*  public AudioInputStream getConvertedStream(AudioFormat outputFormat, AudioInputStream stream) {*/
     private AudioInputStream getConvertedStream(AudioFormat outputFormat, AudioInputStream stream) {
 
         AudioInputStream cs = null;
@@ -172,13 +159,11 @@
             cs = stream;
         } else {
 
-            cs = (AudioInputStream) (new PCMtoPCMCodecStream(stream, outputFormat));
+            cs = new PCMtoPCMCodecStream(stream, outputFormat);
         }
         return cs;
     }
 
-
-
     /**
      * Obtains the set of output formats supported by the codec
      * given a particular input format.
@@ -186,7 +171,6 @@
      * returns an array of length 0.
      * @return array of supported output formats.
      */
-    /*  public AudioFormat[] getOutputFormats(AudioFormat inputFormat) { */
     private AudioFormat[] getOutputFormats(AudioFormat inputFormat) {
 
         Vector<AudioFormat> formats = new Vector<>();
@@ -350,7 +334,6 @@
         return formatArray;
     }
 
-
     class PCMtoPCMCodecStream extends AudioInputStream {
 
         private final int PCM_SWITCH_SIGNED_8BIT                = 1;
@@ -460,7 +443,7 @@
          * Note that this only works for sign conversions.
          * Other conversions require a read of at least 2 bytes.
          */
-
+        @Override
         public int read() throws IOException {
 
             // $$jb: do we want to implement this function?
@@ -489,12 +472,13 @@
             }
         }
 
-
+        @Override
         public int read(byte[] b) throws IOException {
 
             return read(b, 0, b.length);
         }
 
+        @Override
         public int read(byte[] b, int off, int len) throws IOException {
 
 
@@ -589,9 +573,5 @@
                 }
             }
         }
-
-
-
     } // end class PCMtoPCMCodecStream
-
 } // end class PCMtoPCMCodec
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/Platform.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/Platform.java	Wed Jul 05 22:06:46 2017 +0200
@@ -29,8 +29,6 @@
 import java.security.PrivilegedAction;
 import java.util.StringTokenizer;
 
-
-
 /**
  * Audio configuration class for exposing attributes specific to the platform or system.
  *
@@ -39,9 +37,6 @@
  */
 final class Platform {
 
-
-    // STATIC FINAL CHARACTERISTICS
-
     // native library we need to load
     private static final String libNameMain     = "jsound";
     private static final String libNameALSA     = "jsoundalsa";
@@ -74,37 +69,26 @@
         readProperties();
     }
 
-
     /**
      * Private constructor.
      */
     private Platform() {
     }
 
-
-    // METHODS FOR INTERNAL IMPLEMENTATION USE
-
-
     /**
      * Dummy method for forcing initialization.
      */
     static void initialize() {
-
         if(Printer.trace)Printer.trace("Platform: initialize()");
     }
 
-
     /**
      * Determine whether the system is big-endian.
      */
     static boolean isBigEndian() {
-
         return bigEndian;
     }
 
-
-    // PRIVATE METHODS
-
     /**
      * Load the native library or libraries.
      */
@@ -147,7 +131,6 @@
         }
     }
 
-
     static boolean isMidiIOEnabled() {
         return isFeatureLibLoaded(FEATURE_MIDIIO);
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -27,14 +27,13 @@
 
 import java.util.Vector;
 
+import javax.sound.sampled.BooleanControl;
+import javax.sound.sampled.CompoundControl;
 import javax.sound.sampled.Control;
+import javax.sound.sampled.FloatControl;
 import javax.sound.sampled.Line;
 import javax.sound.sampled.LineUnavailableException;
 import javax.sound.sampled.Port;
-import javax.sound.sampled.BooleanControl;
-import javax.sound.sampled.CompoundControl;
-import javax.sound.sampled.FloatControl;
-
 
 /**
  * A Mixer which only provides Ports.
@@ -43,7 +42,6 @@
  */
 final class PortMixer extends AbstractMixer {
 
-    // CONSTANTS
     private static final int SRC_UNKNOWN      = 0x01;
     private static final int SRC_MICROPHONE   = 0x02;
     private static final int SRC_LINE_IN      = 0x03;
@@ -56,15 +54,13 @@
     private static final int DST_LINE_OUT     = 0x0400;
     private static final int DST_MASK         = 0xFF00;
 
-    // INSTANCE VARIABLES
-    private Port.Info[] portInfos;
+    private final Port.Info[] portInfos;
     // cache of instantiated ports
     private PortMixerPort[] ports;
 
     // instance ID of the native implementation
     private long id = 0;
 
-    // CONSTRUCTOR
     PortMixer(PortMixerProvider.PortMixerInfo portMixerInfo) {
         // pass in Line.Info, mixer, controls
         super(portMixerInfo,              // Mixer.Info
@@ -121,9 +117,7 @@
         if (Printer.trace) Printer.trace("<< PortMixer: constructor completed");
     }
 
-
-    // ABSTRACT MIXER: ABSTRACT METHOD IMPLEMENTATIONS
-
+    @Override
     public Line getLine(Line.Info info) throws LineUnavailableException {
         Line.Info fullInfo = getLineInfo(info);
 
@@ -137,7 +131,7 @@
         throw new IllegalArgumentException("Line unsupported: " + info);
     }
 
-
+    @Override
     public int getMaxLines(Line.Info info) {
         Line.Info fullInfo = getLineInfo(info);
 
@@ -153,7 +147,7 @@
         return 0;
     }
 
-
+    @Override
     protected void implOpen() throws LineUnavailableException {
         if (Printer.trace) Printer.trace(">> PortMixer: implOpen (id="+id+")");
 
@@ -163,6 +157,7 @@
         if (Printer.trace) Printer.trace("<< PortMixer: implOpen succeeded.");
     }
 
+    @Override
     protected void implClose() {
         if (Printer.trace) Printer.trace(">> PortMixer: implClose");
 
@@ -181,11 +176,11 @@
         if (Printer.trace) Printer.trace("<< PortMixer: implClose succeeded");
     }
 
+    @Override
     protected void implStart() {}
+    @Override
     protected void implStop() {}
 
-    // IMPLEMENTATION HELPERS
-
     private Port.Info getPortInfo(int portIndex, int type) {
         switch (type) {
         case SRC_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), true);
@@ -223,8 +218,6 @@
         return id;
     }
 
-    // INNER CLASSES
-
     /**
      * Private inner class representing a Port for the PortMixer.
      */
@@ -234,7 +227,6 @@
         private final int portIndex;
         private long id;
 
-        // CONSTRUCTOR
         private PortMixerPort(Port.Info info,
                               PortMixer mixer,
                               int portIndex) {
@@ -243,11 +235,6 @@
             this.portIndex = portIndex;
         }
 
-
-        // ABSTRACT METHOD IMPLEMENTATIONS
-
-        // ABSTRACT LINE
-
         void implOpen() throws LineUnavailableException {
             if (Printer.trace) Printer.trace(">> PortMixerPort: implOpen().");
             long newID = ((PortMixer) mixer).getID();
@@ -286,7 +273,6 @@
             controls = new Control[0];
         }
 
-
         void implClose() {
             if (Printer.trace) Printer.trace(">> PortMixerPort: implClose()");
             // get rid of controls
@@ -294,9 +280,8 @@
             if (Printer.trace) Printer.trace("<< PortMixerPort: implClose() succeeded");
         }
 
-        // METHOD OVERRIDES
-
         // this is very similar to open(AudioFormat, int) in AbstractDataLine...
+        @Override
         public void open() throws LineUnavailableException {
             synchronized (mixer) {
                 // if the line is not currently open, try to open it with this format and buffer size
@@ -321,6 +306,7 @@
         }
 
         // this is very similar to close() in AbstractDataLine...
+        @Override
         public void close() {
             synchronized (mixer) {
                 if (isOpen()) {
@@ -342,7 +328,7 @@
     } // class PortMixerPort
 
     /**
-     * Private inner class representing a BooleanControl for PortMixerPort
+     * Private inner class representing a BooleanControl for PortMixerPort.
      */
     private static final class BoolCtrl extends BooleanControl {
         // the handle to the native control function
@@ -360,7 +346,6 @@
             return new BCT(name);
         }
 
-
         private BoolCtrl(long controlID, String name) {
             this(controlID, createType(name));
         }
@@ -370,12 +355,14 @@
             this.controlID = controlID;
         }
 
+        @Override
         public void setValue(boolean value) {
             if (!closed) {
                 nControlSetIntValue(controlID, value?1:0);
             }
         }
 
+        @Override
         public boolean getValue() {
             if (!closed) {
                 // never use any cached values
@@ -386,7 +373,7 @@
         }
 
         /**
-         * inner class for custom types
+         * inner class for custom types.
          */
         private static final class BCT extends BooleanControl.Type {
             private BCT(String name) {
@@ -396,7 +383,7 @@
     }
 
     /**
-     * Private inner class representing a CompoundControl for PortMixerPort
+     * Private inner class representing a CompoundControl for PortMixerPort.
      */
     private static final class CompCtrl extends CompoundControl {
         private CompCtrl(String name, Control[] controls) {
@@ -404,7 +391,7 @@
         }
 
         /**
-         * inner class for custom compound control types
+         * inner class for custom compound control types.
          */
         private static final class CCT extends CompoundControl.Type {
             private CCT(String name) {
@@ -414,7 +401,7 @@
     }
 
     /**
-     * Private inner class representing a BooleanControl for PortMixerPort
+     * Private inner class representing a BooleanControl for PortMixerPort.
      */
     private static final class FloatCtrl extends FloatControl {
         // the handle to the native control function
@@ -446,12 +433,14 @@
             this.controlID = controlID;
         }
 
+        @Override
         public void setValue(float value) {
             if (!closed) {
                 nControlSetFloatValue(controlID, value);
             }
         }
 
+        @Override
         public float getValue() {
             if (!closed) {
                 // never use any cached values
@@ -462,7 +451,7 @@
         }
 
         /**
-         * inner class for custom types
+         * inner class for custom types.
          */
         private static final class FCT extends FloatControl.Type {
             private FCT(String name) {
@@ -472,7 +461,7 @@
     }
 
     /**
-     * Private inner class representing a port info
+     * Private inner class representing a port info.
      */
     private static final class PortInfo extends Port.Info {
         private PortInfo(String name, boolean isSource) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixerProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixerProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -28,7 +28,6 @@
 import javax.sound.sampled.Mixer;
 import javax.sound.sampled.spi.MixerProvider;
 
-
 /**
  * Port provider.
  *
@@ -36,8 +35,6 @@
  */
 public final class PortMixerProvider extends MixerProvider {
 
-    // STATIC VARIABLES
-
     /**
      * Set of info objects for all port input devices on the system.
      */
@@ -48,18 +45,11 @@
      */
     private static PortMixer[] devices;
 
-
-    // STATIC
-
     static {
         // initialize
         Platform.initialize();
     }
 
-
-    // CONSTRUCTOR
-
-
     /**
      * Required public no-arg constructor.
      */
@@ -93,6 +83,7 @@
         }
     }
 
+    @Override
     public Mixer.Info[] getMixerInfo() {
         synchronized (PortMixerProvider.class) {
             Mixer.Info[] localArray = new Mixer.Info[infos.length];
@@ -101,6 +92,7 @@
         }
     }
 
+    @Override
     public Mixer getMixer(Mixer.Info info) {
         synchronized (PortMixerProvider.class) {
             for (int i = 0; i < infos.length; i++) {
@@ -113,7 +105,6 @@
                 String.format("Mixer %s not supported by this provider", info));
     }
 
-
     private static Mixer getDevice(PortMixerInfo info) {
         int index = info.getIndex();
         if (devices[index] == null) {
@@ -122,9 +113,6 @@
         return devices[index];
     }
 
-    // INNER CLASSES
-
-
     /**
      * Info class for PortMixers.  Adds an index value for
      * making native references to a particular device.
@@ -144,7 +132,6 @@
 
     } // class PortMixerInfo
 
-    // NATIVE METHODS
     private static native int nGetNumDevices();
     private static native PortMixerInfo nNewPortMixerInfo(int mixerIndex);
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidDataException.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidDataException.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFReader.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFReader.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.EOFException;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFWriter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFWriter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.File;
@@ -39,21 +40,21 @@
 
     private interface RandomAccessWriter {
 
-        public void seek(long chunksizepointer) throws IOException;
+        void seek(long chunksizepointer) throws IOException;
 
-        public long getPointer() throws IOException;
+        long getPointer() throws IOException;
 
-        public void close() throws IOException;
+        void close() throws IOException;
 
-        public void write(int b) throws IOException;
+        void write(int b) throws IOException;
 
-        public void write(byte[] b, int off, int len) throws IOException;
+        void write(byte[] b, int off, int len) throws IOException;
 
-        public void write(byte[] bytes) throws IOException;
+        void write(byte[] bytes) throws IOException;
 
-        public long length() throws IOException;
+        long length() throws IOException;
 
-        public void setLength(long i) throws IOException;
+        void setLength(long i) throws IOException;
     }
 
     private static class RandomAccessFileWriter implements RandomAccessWriter {
@@ -68,34 +69,42 @@
             this.raf = new RandomAccessFile(name, "rw");
         }
 
+        @Override
         public void seek(long chunksizepointer) throws IOException {
             raf.seek(chunksizepointer);
         }
 
+        @Override
         public long getPointer() throws IOException {
             return raf.getFilePointer();
         }
 
+        @Override
         public void close() throws IOException {
             raf.close();
         }
 
+        @Override
         public void write(int b) throws IOException {
             raf.write(b);
         }
 
+        @Override
         public void write(byte[] b, int off, int len) throws IOException {
             raf.write(b, off, len);
         }
 
+        @Override
         public void write(byte[] bytes) throws IOException {
             raf.write(bytes);
         }
 
+        @Override
         public long length() throws IOException {
             return raf.length();
         }
 
+        @Override
         public void setLength(long i) throws IOException {
             raf.setLength(i);
         }
@@ -113,19 +122,23 @@
             this.stream = stream;
         }
 
+        @Override
         public void seek(long chunksizepointer) throws IOException {
             pos = (int) chunksizepointer;
         }
 
+        @Override
         public long getPointer() throws IOException {
             return pos;
         }
 
+        @Override
         public void close() throws IOException {
             stream.write(buff, 0, length);
             stream.close();
         }
 
+        @Override
         public void write(int b) throws IOException {
             if (s == null)
                 s = new byte[1];
@@ -133,6 +146,7 @@
             write(s, 0, 1);
         }
 
+        @Override
         public void write(byte[] b, int off, int len) throws IOException {
             int newsize = pos + len;
             if (newsize > length)
@@ -143,14 +157,17 @@
             }
         }
 
+        @Override
         public void write(byte[] bytes) throws IOException {
             write(bytes, 0, bytes.length);
         }
 
+        @Override
         public long length() throws IOException {
             return length;
         }
 
+        @Override
         public void setLength(long i) throws IOException {
             length = (int) i;
             if (length > buff.length) {
@@ -223,6 +240,7 @@
         return writeoverride;
     }
 
+    @Override
     public void close() throws IOException {
         if (!open)
             return;
@@ -245,6 +263,7 @@
         raf = null;
     }
 
+    @Override
     public void write(int b) throws IOException {
         if (!writeoverride) {
             if (chunktype != 2) {
@@ -259,6 +278,7 @@
         raf.write(b);
     }
 
+    @Override
     public void write(byte b[], int off, int len) throws IOException {
         if (!writeoverride) {
             if (chunktype != 2) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RealTimeSequencer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RealTimeSequencer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -27,14 +27,27 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.WeakHashMap;
 
-import javax.sound.midi.*;
-
+import javax.sound.midi.ControllerEventListener;
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.MetaEventListener;
+import javax.sound.midi.MetaMessage;
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiEvent;
+import javax.sound.midi.MidiMessage;
+import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.Sequence;
+import javax.sound.midi.Sequencer;
+import javax.sound.midi.ShortMessage;
+import javax.sound.midi.Synthesizer;
+import javax.sound.midi.Track;
+import javax.sound.midi.Transmitter;
 
 /**
  * A Real Time Sequencer
@@ -48,8 +61,6 @@
 final class RealTimeSequencer extends AbstractMidiDevice
         implements Sequencer, AutoConnectSequencer {
 
-    // STATIC VARIABLES
-
     /** debugging flags */
     private static final boolean DEBUG_PUMP = false;
     private static final boolean DEBUG_PUMP_ALL = false;
@@ -73,7 +84,6 @@
     private static final Sequencer.SyncMode masterSyncMode    = Sequencer.SyncMode.INTERNAL_CLOCK;
     private static final Sequencer.SyncMode slaveSyncMode     = Sequencer.SyncMode.NO_SYNC;
 
-
     /**
      * Sequence on which this sequencer is operating.
      */
@@ -87,14 +97,12 @@
      */
     private double cacheTempoMPQ = -1;
 
-
     /**
      * cache value for tempo factor until sequence is set
      * -1 means not set.
      */
     private float cacheTempoFactor = -1;
 
-
     /** if a particular track is muted */
     private boolean[] trackMuted = null;
     /** if a particular track is solo */
@@ -108,47 +116,48 @@
      */
     private volatile boolean running;
 
-
-    /** the thread for pushing out the MIDI messages */
+    /**
+     * the thread for pushing out the MIDI messages.
+     */
     private PlayThread playThread;
 
-
     /**
-     * True if we are recording
+     * True if we are recording.
      */
     private volatile boolean recording;
 
-
     /**
-     * List of tracks to which we're recording
+     * List of tracks to which we're recording.
      */
     private final List<RecordingTrack> recordingTracks = new ArrayList<>();
 
-
     private long loopStart = 0;
     private long loopEnd = -1;
     private int loopCount = 0;
 
-
     /**
-     * Meta event listeners
+     * Meta event listeners.
      */
     private final ArrayList<Object> metaEventListeners = new ArrayList<>();
 
-
     /**
-     * Control change listeners
+     * Control change listeners.
      */
     private final ArrayList<ControllerListElement> controllerEventListeners = new ArrayList<>();
 
-
-    /** automatic connection support */
+    /**
+     * automatic connection support.
+     */
     private boolean autoConnect = false;
 
-    /** if we need to autoconnect at next open */
+    /**
+     * if we need to autoconnect at next open.
+     */
     private boolean doAutoConnectAtNextOpen = false;
 
-    /** the receiver that this device is auto-connected to */
+    /**
+     * the receiver that this device is auto-connected to.
+     */
     Receiver autoConnectedReceiver = null;
 
 
@@ -161,9 +170,9 @@
         if (Printer.trace) Printer.trace("<< RealTimeSequencer CONSTRUCTOR completed");
     }
 
-
     /* ****************************** SEQUENCER METHODS ******************** */
 
+    @Override
     public synchronized void setSequence(Sequence sequence)
         throws InvalidMidiDataException {
 
@@ -211,7 +220,7 @@
         if (Printer.trace) Printer.trace("<< RealTimeSequencer: setSequence(" + sequence +") completed");
     }
 
-
+    @Override
     public synchronized void setSequence(InputStream stream) throws IOException, InvalidMidiDataException {
 
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: setSequence(" + stream +")");
@@ -229,12 +238,12 @@
 
     }
 
-
+    @Override
     public Sequence getSequence() {
         return sequence;
     }
 
-
+    @Override
     public synchronized void start() {
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: start()");
 
@@ -259,7 +268,7 @@
         if (Printer.trace) Printer.trace("<< RealTimeSequencer: start() completed");
     }
 
-
+    @Override
     public synchronized void stop() {
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: stop()");
 
@@ -280,12 +289,12 @@
         if (Printer.trace) Printer.trace("<< RealTimeSequencer: stop() completed");
     }
 
-
+    @Override
     public boolean isRunning() {
         return running;
     }
 
-
+    @Override
     public void startRecording() {
         if (!isOpen()) {
             throw new IllegalStateException("Sequencer not open");
@@ -295,7 +304,7 @@
         recording = true;
     }
 
-
+    @Override
     public void stopRecording() {
         if (!isOpen()) {
             throw new IllegalStateException("Sequencer not open");
@@ -303,12 +312,12 @@
         recording = false;
     }
 
-
+    @Override
     public boolean isRecording() {
         return recording;
     }
 
-
+    @Override
     public void recordEnable(Track track, int channel) {
         if (!findTrack(track)) {
             throw new IllegalArgumentException("Track does not exist in the current sequence");
@@ -325,7 +334,7 @@
 
     }
 
-
+    @Override
     public void recordDisable(Track track) {
         synchronized(recordingTracks) {
             RecordingTrack rc = RecordingTrack.get(recordingTracks, track);
@@ -336,7 +345,6 @@
 
     }
 
-
     private boolean findTrack(Track track) {
         boolean found = false;
         if (sequence != null) {
@@ -351,14 +359,14 @@
         return found;
     }
 
-
+    @Override
     public float getTempoInBPM() {
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: getTempoInBPM() ");
 
         return (float) MidiUtils.convertTempo(getTempoInMPQ());
     }
 
-
+    @Override
     public void setTempoInBPM(float bpm) {
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: setTempoInBPM() ");
         if (bpm <= 0) {
@@ -369,7 +377,7 @@
         setTempoInMPQ((float) MidiUtils.convertTempo((double) bpm));
     }
 
-
+    @Override
     public float getTempoInMPQ() {
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: getTempoInMPQ() ");
 
@@ -389,7 +397,7 @@
         return getDataPump().getTempoMPQ();
     }
 
-
+    @Override
     public void setTempoInMPQ(float mpq) {
         if (mpq <= 0) {
             // should throw IllegalArgumentException
@@ -410,7 +418,7 @@
         }
     }
 
-
+    @Override
     public void setTempoFactor(float factor) {
         if (factor <= 0) {
             // should throw IllegalArgumentException
@@ -428,7 +436,7 @@
         }
     }
 
-
+    @Override
     public float getTempoFactor() {
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: getTempoFactor() ");
 
@@ -441,7 +449,7 @@
         return getDataPump().getTempoFactor();
     }
 
-
+    @Override
     public long getTickLength() {
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: getTickLength() ");
 
@@ -452,7 +460,7 @@
         return sequence.getTickLength();
     }
 
-
+    @Override
     public synchronized long getTickPosition() {
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: getTickPosition() ");
 
@@ -463,7 +471,7 @@
         return getDataPump().getTickPos();
     }
 
-
+    @Override
     public synchronized void setTickPosition(long tick) {
         if (tick < 0) {
             // should throw IllegalArgumentException
@@ -486,7 +494,7 @@
         }
     }
 
-
+    @Override
     public long getMicrosecondLength() {
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: getMicrosecondLength() ");
 
@@ -497,7 +505,7 @@
         return sequence.getMicrosecondLength();
     }
 
-
+    @Override
     public long getMicrosecondPosition() {
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: getMicrosecondPosition() ");
 
@@ -509,7 +517,7 @@
         }
     }
 
-
+    @Override
     public void setMicrosecondPosition(long microseconds) {
         if (microseconds < 0) {
             // should throw IllegalArgumentException
@@ -534,34 +542,34 @@
         }
     }
 
-
+    @Override
     public void setMasterSyncMode(Sequencer.SyncMode sync) {
         // not supported
     }
 
-
+    @Override
     public Sequencer.SyncMode getMasterSyncMode() {
         return masterSyncMode;
     }
 
-
+    @Override
     public Sequencer.SyncMode[] getMasterSyncModes() {
         Sequencer.SyncMode[] returnedModes = new Sequencer.SyncMode[masterSyncModes.length];
         System.arraycopy(masterSyncModes, 0, returnedModes, 0, masterSyncModes.length);
         return returnedModes;
     }
 
-
+    @Override
     public void setSlaveSyncMode(Sequencer.SyncMode sync) {
         // not supported
     }
 
-
+    @Override
     public Sequencer.SyncMode getSlaveSyncMode() {
         return slaveSyncMode;
     }
 
-
+    @Override
     public Sequencer.SyncMode[] getSlaveSyncModes() {
         Sequencer.SyncMode[] returnedModes = new Sequencer.SyncMode[slaveSyncModes.length];
         System.arraycopy(slaveSyncModes, 0, returnedModes, 0, slaveSyncModes.length);
@@ -577,8 +585,7 @@
         return 0;
     }
 
-
-
+    @Override
     public synchronized void setTrackMute(int track, boolean mute) {
         int trackCount = getTrackCount();
         if (track < 0 || track >= getTrackCount()) return;
@@ -589,14 +596,14 @@
         }
     }
 
-
+    @Override
     public synchronized boolean getTrackMute(int track) {
         if (track < 0 || track >= getTrackCount()) return false;
         if (trackMuted == null || trackMuted.length <= track) return false;
         return trackMuted[track];
     }
 
-
+    @Override
     public synchronized void setTrackSolo(int track, boolean solo) {
         int trackCount = getTrackCount();
         if (track < 0 || track >= getTrackCount()) return;
@@ -607,14 +614,14 @@
         }
     }
 
-
+    @Override
     public synchronized boolean getTrackSolo(int track) {
         if (track < 0 || track >= getTrackCount()) return false;
         if (trackSolo == null || trackSolo.length <= track) return false;
         return trackSolo[track];
     }
 
-
+    @Override
     public boolean addMetaEventListener(MetaEventListener listener) {
         synchronized(metaEventListeners) {
             if (! metaEventListeners.contains(listener)) {
@@ -625,7 +632,7 @@
         }
     }
 
-
+    @Override
     public void removeMetaEventListener(MetaEventListener listener) {
         synchronized(metaEventListeners) {
             int index = metaEventListeners.indexOf(listener);
@@ -635,7 +642,7 @@
         }
     }
 
-
+    @Override
     public int[] addControllerEventListener(ControllerEventListener listener, int[] controllers) {
         synchronized(controllerEventListeners) {
 
@@ -663,7 +670,7 @@
         }
     }
 
-
+    @Override
     public int[] removeControllerEventListener(ControllerEventListener listener, int[] controllers) {
         synchronized(controllerEventListeners) {
             ControllerListElement cve = null;
@@ -690,9 +697,9 @@
         }
     }
 
-
     ////////////////// LOOPING (added in 1.5) ///////////////////////
 
+    @Override
     public void setLoopStartPoint(long tick) {
         if ((tick > getTickLength())
             || ((loopEnd != -1) && (tick > loopEnd))
@@ -702,10 +709,12 @@
         loopStart = tick;
     }
 
+    @Override
     public long getLoopStartPoint() {
         return loopStart;
     }
 
+    @Override
     public void setLoopEndPoint(long tick) {
         if ((tick > getTickLength())
             || ((loopStart > tick) && (tick != -1))
@@ -715,10 +724,12 @@
         loopEnd = tick;
     }
 
+    @Override
     public long getLoopEndPoint() {
         return loopEnd;
     }
 
+    @Override
     public void setLoopCount(int count) {
         if (count != LOOP_CONTINUOUSLY
             && count < 0) {
@@ -730,15 +741,14 @@
         }
     }
 
+    @Override
     public int getLoopCount() {
         return loopCount;
     }
 
-
     /* *********************************** play control ************************* */
 
-    /*
-     */
+    @Override
     protected void implOpen() throws MidiUnavailableException {
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: implOpen()");
 
@@ -820,14 +830,15 @@
         }
     }
 
-    /** populate the caches with the current values */
+    /**
+     * populate the caches with the current values.
+     */
     private synchronized void setCaches() {
         cacheTempoFactor = getTempoFactor();
         cacheTempoMPQ = getTempoInMPQ();
     }
 
-
-
+    @Override
     protected synchronized void implClose() {
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: implClose() ");
 
@@ -882,7 +893,6 @@
         if (Printer.trace) Printer.trace("<< RealTimeSequencer: implStart() completed");
     }
 
-
     void implStop() {
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: implStop()");
 
@@ -953,8 +963,6 @@
         getEventDispatcher().sendAudioEvents(message, sendToListeners);
     }
 
-
-
     private boolean needCaching() {
         return !isOpen() || (sequence == null) || (playThread == null);
     }
@@ -988,42 +996,39 @@
         return array;
     }
 
-
     // OVERRIDES OF ABSTRACT MIDI DEVICE METHODS
 
+    @Override
     protected boolean hasReceivers() {
         return true;
     }
 
     // for recording
+    @Override
     protected Receiver createReceiver() throws MidiUnavailableException {
         return new SequencerReceiver();
     }
 
-
+    @Override
     protected boolean hasTransmitters() {
         return true;
     }
 
-
+    @Override
     protected Transmitter createTransmitter() throws MidiUnavailableException {
         return new SequencerTransmitter();
     }
 
-
     // interface AutoConnectSequencer
+    @Override
     public void setAutoConnect(Receiver autoConnectedReceiver) {
         this.autoConnect = (autoConnectedReceiver != null);
         this.autoConnectedReceiver = autoConnectedReceiver;
     }
 
-
-
-    // INNER CLASSES
-
     /**
      * An own class to distinguish the class name from
-     * the transmitter of other devices
+     * the transmitter of other devices.
      */
     private class SequencerTransmitter extends BasicTransmitter {
         private SequencerTransmitter() {
@@ -1031,9 +1036,9 @@
         }
     }
 
-
     final class SequencerReceiver extends AbstractReceiver {
 
+        @Override
         void implSend(MidiMessage message, long timeStamp) {
             if (recording) {
                 long tickPos = 0;
@@ -1080,7 +1085,6 @@
         }
     }
 
-
     private static class RealTimeSequencerInfo extends MidiDevice.Info {
 
         private static final String name = "Real Time Sequencer";
@@ -1093,7 +1097,6 @@
         }
     } // class Info
 
-
     private class ControllerListElement {
 
         // $$jb: using an array for controllers b/c its
@@ -1202,7 +1205,6 @@
 
     } // class ControllerListElement
 
-
     static class RecordingTrack {
 
         private final Track track;
@@ -1244,7 +1246,6 @@
         }
     }
 
-
     final class PlayThread implements Runnable {
         private Thread thread;
         private final Object lock = new Object();
@@ -1351,13 +1352,13 @@
             }
         }
 
-
         /**
          * Main process loop driving the media flow.
          *
          * Make sure to NOT synchronize on RealTimeSequencer
          * anywhere here (even implicit). That is a sure deadlock!
          */
+        @Override
         public void run() {
 
             while (!interrupted) {
@@ -1409,10 +1410,9 @@
         }
     }
 
-
     /**
      * class that does the actual dispatching of events,
-     * used to be in native in MMAPI
+     * used to be in native in MMAPI.
      */
     private class DataPump {
         private float currTempo;         // MPQ tempo
@@ -1434,7 +1434,6 @@
         //private sun.misc.Perf perf = sun.misc.Perf.getPerf();
         //private long perfFreq = perf.highResFrequency();
 
-
         DataPump() {
             init();
         }
@@ -1516,8 +1515,6 @@
             trackDisabled = newDisabled;
         }
 
-
-
         synchronized void setSequence(Sequence seq) {
             if (seq == null) {
                 init();
@@ -1568,7 +1565,6 @@
             if (DEBUG_PUMP) Printer.println("  noteOff: sent "+done+" messages.");
         }
 
-
         private boolean[] makeDisabledArray() {
             if (tracks == null) {
                 return null;
@@ -1656,11 +1652,10 @@
             if (DEBUG_PUMP) Printer.println("  sendNoteOffIfOn: sent "+done+" messages.");
         }
 
-
         /**
          * Runtime application of mute/solo:
          * if a track is muted that was previously playing, send
-         *    note off events for all currently playing notes
+         *    note off events for all currently playing notes.
          */
         private void applyDisabledTracks(boolean[] oldDisabled, boolean[] newDisabled) {
             byte[][] tempArray = null;
@@ -1781,8 +1776,9 @@
             if (DEBUG_PUMP) Printer.println("  chaseTrackEvents track "+trackNum+": sent "+numControllersSent+" controllers.");
         }
 
-
-        /** chase controllers and program for all tracks */
+        /**
+         * chase controllers and program for all tracks.
+         */
         synchronized void chaseEvents(long startTick, long endTick) {
             if (DEBUG_PUMP) Printer.println(">> chaseEvents from tick "+startTick+".."+(endTick-1));
             byte[][] tempArray = new byte[128][16];
@@ -1797,7 +1793,6 @@
             if (DEBUG_PUMP) Printer.println("<< chaseEvents");
         }
 
-
         // playback related methods (pumping)
 
         private long getCurrentTimeMillis() {
@@ -1900,7 +1895,6 @@
             return changesPending;
         }
 
-
         /** the main pump method
          * @return true if end of sequence is reached
          */
@@ -2078,7 +2072,5 @@
 
             return EOM;
         }
-
     } // class DataPump
-
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ReferenceCountingDevice.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ReferenceCountingDevice.java	Wed Jul 05 22:06:46 2017 +0200
@@ -29,8 +29,6 @@
 import javax.sound.midi.Receiver;
 import javax.sound.midi.Transmitter;
 
-
-
 /** MidiDevice that can use reference counting for open/close.
  * This interface is intended to be used by MidiSystem.getTransmitter() and
  * MidiSystem.getReceiver().
@@ -42,11 +40,11 @@
      * This method is similar to MidiDevice.getReceiver(). However, by calling this one,
      * the device is opened implicitly. This is needed by MidiSystem.getReceiver().
      */
-    public Receiver getReceiverReferenceCounting() throws MidiUnavailableException;
+    Receiver getReceiverReferenceCounting() throws MidiUnavailableException;
 
     /** Retrieve a Transmitter that opens the device implicitly.
      * This method is similar to MidiDevice.getTransmitter(). However, by calling this one,
      * the device is opened implicitly. This is needed by MidiSystem.getTransmitter().
      */
-    public Transmitter getTransmitterReferenceCounting() throws MidiUnavailableException;
+    Transmitter getTransmitterReferenceCounting() throws MidiUnavailableException;
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2GlobalRegion.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2GlobalRegion.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Instrument.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Instrument.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.ArrayList;
@@ -45,8 +46,7 @@
     long genre = 0;
     long morphology = 0;
     SF2GlobalRegion globalregion = null;
-    List<SF2InstrumentRegion> regions
-            = new ArrayList<SF2InstrumentRegion>();
+    List<SF2InstrumentRegion> regions = new ArrayList<>();
 
     public SF2Instrument() {
         super(null, null, null, null);
@@ -56,6 +56,7 @@
         super(soundbank, null, null, null);
     }
 
+    @Override
     public String getName() {
         return name;
     }
@@ -64,6 +65,7 @@
         this.name = name;
     }
 
+    @Override
     public Patch getPatch() {
         if (bank == 128)
             return new ModelPatch(0, preset, true);
@@ -81,6 +83,7 @@
         }
     }
 
+    @Override
     public Object getData() {
         return null;
     }
@@ -121,6 +124,7 @@
         globalregion = zone;
     }
 
+    @Override
     public String toString() {
         if (bank == 128)
             return "Drumkit: " + name + " preset #" + preset;
@@ -129,6 +133,7 @@
                     + " preset #" + preset;
     }
 
+    @Override
     public ModelPerformer[] getPerformers() {
         int performercount = 0;
         for (SF2InstrumentRegion presetzone : regions)
@@ -138,7 +143,7 @@
 
         SF2GlobalRegion presetglobal = globalregion;
         for (SF2InstrumentRegion presetzone : regions) {
-            Map<Integer, Short> pgenerators = new HashMap<Integer, Short>();
+            Map<Integer, Short> pgenerators = new HashMap<>();
             pgenerators.putAll(presetzone.getGenerators());
             if (presetglobal != null)
                 pgenerators.putAll(presetglobal.getGenerators());
@@ -267,7 +272,7 @@
                 if (buff24 != null)
                     osc.set8BitExtensionBuffer(buff24);
 
-                Map<Integer, Short> generators = new HashMap<Integer, Short>();
+                Map<Integer, Short> generators = new HashMap<>();
                 if (layerglobal != null)
                     generators.putAll(layerglobal.getGenerators());
                 generators.putAll(layerzone.getGenerators());
@@ -608,6 +613,7 @@
                     new ModelConnectionBlock(
                         new ModelSource(ModelSource.SOURCE_NOTEON_VELOCITY,
                             new ModelTransform() {
+                                @Override
                                 public double transform(double value) {
                                     if (value < 0.5)
                                         return 1 - value * 2;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2InstrumentRegion.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2InstrumentRegion.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Layer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Layer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -38,7 +38,7 @@
 
     String name = "";
     SF2GlobalRegion globalregion = null;
-    List<SF2LayerRegion> regions = new ArrayList<SF2LayerRegion>();
+    List<SF2LayerRegion> regions = new ArrayList<>();
 
     public SF2Layer(SF2Soundbank soundBank) {
         super(soundBank, null, null);
@@ -48,10 +48,12 @@
         super(null, null, null);
     }
 
+    @Override
     public Object getData() {
         return null;
     }
 
+    @Override
     public String getName() {
         return name;
     }
@@ -72,6 +74,7 @@
         globalregion = zone;
     }
 
+    @Override
     public String toString() {
         return "Layer: " + name;
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2LayerRegion.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2LayerRegion.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Modulator.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Modulator.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Region.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Region.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.ArrayList;
@@ -97,8 +98,8 @@
     public static final int GENERATOR_OVERRIDINGROOTKEY = 58;
     public static final int GENERATOR_UNUSED5 = 59;
     public static final int GENERATOR_ENDOPR = 60;
-    protected Map<Integer, Short> generators = new HashMap<Integer, Short>();
-    protected List<SF2Modulator> modulators = new ArrayList<SF2Modulator>();
+    protected Map<Integer, Short> generators = new HashMap<>();
+    protected List<SF2Modulator> modulators = new ArrayList<>();
 
     public Map<Integer, Short> getGenerators() {
         return generators;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Sample.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Sample.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.InputStream;
@@ -57,6 +58,7 @@
         super(null, null, AudioInputStream.class);
     }
 
+    @Override
     public Object getData() {
 
         AudioFormat format = getFormat();
@@ -146,6 +148,7 @@
     }
     */
 
+    @Override
     public String getName() {
         return name;
     }
@@ -210,6 +213,7 @@
         this.startLoop = startLoop;
     }
 
+    @Override
     public String toString() {
         return "Sample: " + name;
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Soundbank.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Soundbank.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.File;
@@ -81,9 +82,9 @@
     private ModelByteBuffer sampleData24 = null;
     private File sampleFile = null;
     private boolean largeFormat = false;
-    private final List<SF2Instrument> instruments = new ArrayList<SF2Instrument>();
-    private final List<SF2Layer> layers = new ArrayList<SF2Layer>();
-    private final List<SF2Sample> samples = new ArrayList<SF2Sample>();
+    private final List<SF2Instrument> instruments = new ArrayList<>();
+    private final List<SF2Layer> layers = new ArrayList<>();
+    private final List<SF2Sample> samples = new ArrayList<>();
 
     public SF2Soundbank() {
     }
@@ -224,19 +225,15 @@
 
     private void readPdtaChunk(RIFFReader riff) throws IOException {
 
-        List<SF2Instrument> presets = new ArrayList<SF2Instrument>();
-        List<Integer> presets_bagNdx = new ArrayList<Integer>();
-        List<SF2InstrumentRegion> presets_splits_gen
-                = new ArrayList<SF2InstrumentRegion>();
-        List<SF2InstrumentRegion> presets_splits_mod
-                = new ArrayList<SF2InstrumentRegion>();
+        List<SF2Instrument> presets = new ArrayList<>();
+        List<Integer> presets_bagNdx = new ArrayList<>();
+        List<SF2InstrumentRegion> presets_splits_gen = new ArrayList<>();
+        List<SF2InstrumentRegion> presets_splits_mod = new ArrayList<>();
 
-        List<SF2Layer> instruments = new ArrayList<SF2Layer>();
-        List<Integer> instruments_bagNdx = new ArrayList<Integer>();
-        List<SF2LayerRegion> instruments_splits_gen
-                = new ArrayList<SF2LayerRegion>();
-        List<SF2LayerRegion> instruments_splits_mod
-                = new ArrayList<SF2LayerRegion>();
+        List<SF2Layer> instruments = new ArrayList<>();
+        List<Integer> instruments_bagNdx = new ArrayList<>();
+        List<SF2LayerRegion> instruments_splits_gen = new ArrayList<>();
+        List<SF2LayerRegion> instruments_splits_mod = new ArrayList<>();
 
         while (riff.hasNextChunk()) {
             RIFFReader chunk = riff.nextChunk();
@@ -830,18 +827,22 @@
 
     }
 
+    @Override
     public String getName() {
         return name;
     }
 
+    @Override
     public String getVersion() {
         return major + "." + minor;
     }
 
+    @Override
     public String getVendor() {
         return engineers;
     }
 
+    @Override
     public String getDescription() {
         return comments;
     }
@@ -858,6 +859,7 @@
         comments = s;
     }
 
+    @Override
     public SoundbankResource[] getResources() {
         SoundbankResource[] resources
                 = new SoundbankResource[layers.size() + samples.size()];
@@ -869,6 +871,7 @@
         return resources;
     }
 
+    @Override
     public SF2Instrument[] getInstruments() {
         SF2Instrument[] inslist_array
                 = instruments.toArray(new SF2Instrument[instruments.size()]);
@@ -884,6 +887,7 @@
         return samples.toArray(new SF2Sample[samples.size()]);
     }
 
+    @Override
     public Instrument getInstrument(Patch patch) {
         int program = patch.getProgram();
         int bank = patch.getBank();
@@ -972,11 +976,11 @@
 
     public void removeResource(SoundbankResource resource) {
         if (resource instanceof SF2Instrument)
-            instruments.remove((SF2Instrument)resource);
+            instruments.remove(resource);
         if (resource instanceof SF2Layer)
-            layers.remove((SF2Layer)resource);
+            layers.remove(resource);
         if (resource instanceof SF2Sample)
-            samples.remove((SF2Sample)resource);
+            samples.remove(resource);
     }
 
     public void addInstrument(SF2Instrument resource) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2SoundbankReader.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2SoundbankReader.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,12 +22,14 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
+
 import javax.sound.midi.InvalidMidiDataException;
 import javax.sound.midi.Soundbank;
 import javax.sound.midi.spi.SoundbankReader;
@@ -40,6 +42,7 @@
  */
 public final class SF2SoundbankReader extends SoundbankReader {
 
+    @Override
     public Soundbank getSoundbank(URL url)
             throws InvalidMidiDataException, IOException {
         try {
@@ -51,6 +54,7 @@
         }
     }
 
+    @Override
     public Soundbank getSoundbank(InputStream stream)
             throws InvalidMidiDataException, IOException {
         try {
@@ -62,6 +66,7 @@
         }
     }
 
+    @Override
     public Soundbank getSoundbank(File file)
             throws InvalidMidiDataException, IOException {
         try {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleInstrument.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleInstrument.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,10 +22,12 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.ArrayList;
 import java.util.List;
+
 import javax.sound.midi.Patch;
 
 /**
@@ -48,8 +50,7 @@
     protected int bank = 0;
     protected boolean percussion = false;
     protected String name = "";
-    protected List<SimpleInstrumentPart> parts
-            = new ArrayList<SimpleInstrumentPart>();
+    protected List<SimpleInstrumentPart> parts = new ArrayList<>();
 
     public SimpleInstrument() {
         super(null, null, null, null);
@@ -121,6 +122,7 @@
         add(ins.getPerformers());
     }
 
+    @Override
     public ModelPerformer[] getPerformers() {
 
         int percount = 0;
@@ -166,10 +168,12 @@
         return performers;
     }
 
+    @Override
     public Object getData() {
         return null;
     }
 
+    @Override
     public String getName() {
         return this.name;
     }
@@ -178,6 +182,7 @@
         this.name = name;
     }
 
+    @Override
     public ModelPatch getPatch() {
         return new ModelPatch(bank, preset, percussion);
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleSoundbank.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleSoundbank.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.ArrayList;
@@ -44,21 +45,25 @@
     String version = "";
     String vendor = "";
     String description = "";
-    List<SoundbankResource> resources = new ArrayList<SoundbankResource>();
-    List<Instrument> instruments = new ArrayList<Instrument>();
+    List<SoundbankResource> resources = new ArrayList<>();
+    List<Instrument> instruments = new ArrayList<>();
 
+    @Override
     public String getName() {
         return name;
     }
 
+    @Override
     public String getVersion() {
         return version;
     }
 
+    @Override
     public String getVendor() {
         return vendor;
     }
 
+    @Override
     public String getDescription() {
         return description;
     }
@@ -79,10 +84,12 @@
         this.version = version;
     }
 
+    @Override
     public SoundbankResource[] getResources() {
         return resources.toArray(new SoundbankResource[resources.size()]);
     }
 
+    @Override
     public Instrument[] getInstruments() {
         Instrument[] inslist_array
                 = instruments.toArray(new Instrument[resources.size()]);
@@ -90,6 +97,7 @@
         return inslist_array;
     }
 
+    @Override
     public Instrument getInstrument(Patch patch) {
         int program = patch.getProgram();
         int bank = patch.getBank();
@@ -120,7 +128,7 @@
 
     public void removeResource(SoundbankResource resource) {
         if (resource instanceof Instrument)
-            instruments.remove((Instrument) resource);
+            instruments.remove(resource);
         else
             resources.remove(resource);
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAbstractResampler.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAbstractResampler.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.IOException;
@@ -74,14 +75,17 @@
             ibuffer_order = true;
         }
 
+        @Override
         public void noteOn(MidiChannel channel, VoiceStatus voice,
-                int noteNumber, int velocity) {
+                           int noteNumber, int velocity) {
         }
 
+        @Override
         public void noteOff(int velocity) {
             noteOff_flag = true;
         }
 
+        @Override
         public void open(ModelWavetable osc, float outputsamplerate)
                 throws IOException {
 
@@ -135,6 +139,7 @@
             nextBuffer();
         }
 
+        @Override
         public void setPitch(float pitch) {
             /*
             this.pitch = (float) Math.pow(2f,
@@ -254,6 +259,7 @@
             }
         }
 
+        @Override
         public int read(float[][] buffer, int offset, int len)
                 throws IOException {
 
@@ -373,6 +379,7 @@
             return len;
         }
 
+        @Override
         public void close() throws IOException {
             stream.close();
         }
@@ -384,6 +391,7 @@
             float in_end, float[] pitch, float pitchstep, float[] out,
             int[] out_offset, int out_end);
 
+    @Override
     public final SoftResamplerStreamer openStreamer() {
         return new ModelAbstractResamplerStream();
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioBuffer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioBuffer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.Arrays;
@@ -123,6 +124,5 @@
                 }
             }
         }
-
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioProcessor.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioProcessor.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -31,18 +32,17 @@
  */
 public interface SoftAudioProcessor {
 
-    public void globalParameterControlChange(int[] slothpath, long param,
-            long value);
+    void globalParameterControlChange(int[] slothpath, long param, long value);
 
-    public void init(float samplerate, float controlrate);
+    void init(float samplerate, float controlrate);
 
-    public void setInput(int pin, SoftAudioBuffer input);
+    void setInput(int pin, SoftAudioBuffer input);
 
-    public void setOutput(int pin, SoftAudioBuffer output);
+    void setOutput(int pin, SoftAudioBuffer output);
 
-    public void setMixMode(boolean mix);
+    void setMixMode(boolean mix);
 
-    public void processAudio();
+    void processAudio();
 
-    public void processControlLogic();
+    void processControlLogic();
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.IOException;
@@ -70,6 +71,7 @@
         }
     }
 
+    @Override
     public void run() {
         byte[] buffer = SoftAudioPusher.this.buffer;
         AudioInputStream ais = SoftAudioPusher.this.ais;
@@ -87,6 +89,5 @@
             active = false;
             //e.printStackTrace();
         }
-
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannel.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannel.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.ArrayList;
@@ -41,7 +42,7 @@
  */
 public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
 
-    private static boolean[] dontResetControls = new boolean[128];
+    private static final boolean[] dontResetControls = new boolean[128];
     static {
         for (int i = 0; i < dontResetControls.length; i++)
             dontResetControls[i] = false;
@@ -99,18 +100,18 @@
     private boolean solo = false;
     private boolean solomute = false;
     private final Object control_mutex;
-    private int channel;
-    private SoftVoice[] voices;
+    private final int channel;
+    private final SoftVoice[] voices;
     private int bank;
     private int program;
-    private SoftSynthesizer synthesizer;
-    private SoftMainMixer mainmixer;
-    private int[] polypressure = new int[128];
+    private final SoftSynthesizer synthesizer;
+    private final SoftMainMixer mainmixer;
+    private final int[] polypressure = new int[128];
     private int channelpressure = 0;
-    private int[] controller = new int[128];
+    private final int[] controller = new int[128];
     private int pitchbend;
-    private double[] co_midi_pitch = new double[1];
-    private double[] co_midi_channel_pressure = new double[1];
+    private final double[] co_midi_pitch = new double[1];
+    private final double[] co_midi_channel_pressure = new double[1];
     SoftTuning tuning = new SoftTuning();
     int tuning_bank = 0;
     int tuning_program = 0;
@@ -132,6 +133,7 @@
         double[] channel_pressure = co_midi_channel_pressure;
         double[] poly_pressure = new double[1];
 
+        @Override
         public double[] get(int instance, String name) {
             if (name == null)
                 return null;
@@ -145,26 +147,28 @@
         }
     }
 
-    private SoftControl[] co_midi = new SoftControl[128];
+    private final SoftControl[] co_midi = new SoftControl[128];
     {
         for (int i = 0; i < co_midi.length; i++) {
             co_midi[i] = new MidiControlObject();
         }
     }
 
-    private double[][] co_midi_cc_cc = new double[128][1];
-    private SoftControl co_midi_cc = new SoftControl() {
+    private final double[][] co_midi_cc_cc = new double[128][1];
+    private final SoftControl co_midi_cc = new SoftControl() {
         double[][] cc = co_midi_cc_cc;
+        @Override
         public double[] get(int instance, String name) {
             if (name == null)
                 return null;
             return cc[Integer.parseInt(name)];
         }
     };
-    Map<Integer, int[]> co_midi_rpn_rpn_i = new HashMap<Integer, int[]>();
-    Map<Integer, double[]> co_midi_rpn_rpn = new HashMap<Integer, double[]>();
-    private SoftControl co_midi_rpn = new SoftControl() {
+    Map<Integer, int[]> co_midi_rpn_rpn_i = new HashMap<>();
+    Map<Integer, double[]> co_midi_rpn_rpn = new HashMap<>();
+    private final SoftControl co_midi_rpn = new SoftControl() {
         Map<Integer, double[]> rpn = co_midi_rpn_rpn;
+        @Override
         public double[] get(int instance, String name) {
             if (name == null)
                 return null;
@@ -177,10 +181,11 @@
             return v;
         }
     };
-    Map<Integer, int[]> co_midi_nrpn_nrpn_i = new HashMap<Integer, int[]>();
-    Map<Integer, double[]> co_midi_nrpn_nrpn = new HashMap<Integer, double[]>();
-    private SoftControl co_midi_nrpn = new SoftControl() {
+    Map<Integer, int[]> co_midi_nrpn_nrpn_i = new HashMap<>();
+    Map<Integer, double[]> co_midi_nrpn_nrpn = new HashMap<>();
+    private final SoftControl co_midi_nrpn = new SoftControl() {
         Map<Integer, double[]> nrpn = co_midi_nrpn_nrpn;
+        @Override
         public double[] get(int instance, String name) {
             if (name == null)
                 return null;
@@ -407,6 +412,7 @@
         }
     }
 
+    @Override
     public void noteOn(int noteNumber, int velocity) {
         noteOn(noteNumber, velocity, 0);
     }
@@ -544,6 +550,7 @@
         }
     }
 
+    @Override
     public void noteOff(int noteNumber, int velocity) {
         noteNumber = restrict7Bit(noteNumber);
         velocity = restrict7Bit(velocity);
@@ -616,7 +623,7 @@
 
         }
     }
-    private int[] lastVelocity = new int[128];
+    private final int[] lastVelocity = new int[128];
     private int prevVoiceID;
     private boolean firstVoice = true;
     private int voiceNo = 0;
@@ -625,6 +632,7 @@
     private int play_delay = 0;
     private boolean play_releasetriggered = false;
 
+    @Override
     public void play(int performerIndex, ModelConnectionBlock[] connectionBlocks) {
 
         int noteNumber = play_noteNumber;
@@ -657,11 +665,13 @@
                 connectionBlocks, current_mixer, releasetriggered);
     }
 
+    @Override
     public void noteOff(int noteNumber) {
         if(noteNumber < 0 || noteNumber > 127) return;
         noteOff_internal(noteNumber, 64);
     }
 
+    @Override
     public void setPolyPressure(int noteNumber, int pressure) {
         noteNumber = restrict7Bit(noteNumber);
         pressure = restrict7Bit(pressure);
@@ -680,12 +690,14 @@
         }
     }
 
+    @Override
     public int getPolyPressure(int noteNumber) {
         synchronized (control_mutex) {
             return polypressure[noteNumber];
         }
     }
 
+    @Override
     public void setChannelPressure(int pressure) {
         pressure = restrict7Bit(pressure);
         if (current_mixer != null)
@@ -701,6 +713,7 @@
         }
     }
 
+    @Override
     public int getChannelPressure() {
         synchronized (control_mutex) {
             return channelpressure;
@@ -823,7 +836,7 @@
         05 LFO Amplitude Depth   | 00H..7FH | 0..100 percent          |  0
         */
 
-        List<ModelConnectionBlock> conns = new ArrayList<ModelConnectionBlock>();
+        List<ModelConnectionBlock> conns = new ArrayList<>();
 
         for (int i = 0; i < destination.length; i++) {
             int d = destination[i];
@@ -869,6 +882,7 @@
                 final double scale = (r / 64.0);
                 ModelTransform mt = new ModelTransform() {
                     double s = scale;
+                    @Override
                     public double transform(double value) {
                         if (s < 1)
                             value = s + (value * (1.0 - s));
@@ -923,6 +937,7 @@
 
                 ModelTransform mt = new ModelTransform() {
                     double s = scale;
+                    @Override
                     public double transform(double value) {
                         return -((5.0 / 12.0) / Math.log(10))
                                 * Math.log(1 - value * s);
@@ -1055,6 +1070,7 @@
         return (int)(keybasedcontroller_value[noteNumber][controller] * 128);
     }
 
+    @Override
     public void controlChange(int controller, int value) {
         controller = restrict7Bit(controller);
         value = restrict7Bit(value);
@@ -1241,6 +1257,7 @@
         }
     }
 
+    @Override
     public int getController(int controller) {
         synchronized (control_mutex) {
             // Should only return lower 7 bits,
@@ -1259,10 +1276,12 @@
         }
     }
 
+    @Override
     public void programChange(int program) {
         programChange(bank, program);
     }
 
+    @Override
     public void programChange(int bank, int program) {
         bank = restrict14Bit(bank);
         program = restrict7Bit(program);
@@ -1277,12 +1296,14 @@
         }
     }
 
+    @Override
     public int getProgram() {
         synchronized (control_mutex) {
             return program;
         }
     }
 
+    @Override
     public void setPitchBend(int bend) {
         bend = restrict14Bit(bend);
         if (current_mixer != null)
@@ -1297,6 +1318,7 @@
         }
     }
 
+    @Override
     public int getPitchBend() {
         synchronized (control_mutex) {
             return pitchbend;
@@ -1398,6 +1420,7 @@
                 voices[i].rpnChange(controller, val_i[0]);
     }
 
+    @Override
     public void resetAllControllers() {
         resetAllControllers(false);
     }
@@ -1463,6 +1486,7 @@
         }
     }
 
+    @Override
     public void allNotesOff() {
         if (current_mixer != null)
             current_mixer.allNotesOff();
@@ -1475,6 +1499,7 @@
         }
     }
 
+    @Override
     public void allSoundOff() {
         if (current_mixer != null)
             current_mixer.allSoundOff();
@@ -1485,10 +1510,12 @@
         }
     }
 
+    @Override
     public boolean localControl(boolean on) {
         return false;
     }
 
+    @Override
     public void setMono(boolean on) {
         if (current_mixer != null)
             current_mixer.setMono(on);
@@ -1498,12 +1525,14 @@
         }
     }
 
+    @Override
     public boolean getMono() {
         synchronized (control_mutex) {
             return mono;
         }
     }
 
+    @Override
     public void setOmni(boolean on) {
         if (current_mixer != null)
             current_mixer.setOmni(on);
@@ -1511,10 +1540,12 @@
     // Omni is not supported by GM2
     }
 
+    @Override
     public boolean getOmni() {
         return false;
     }
 
+    @Override
     public void setMute(boolean mute) {
         if (current_mixer != null)
             current_mixer.setMute(mute);
@@ -1526,12 +1557,14 @@
         }
     }
 
+    @Override
     public boolean getMute() {
         synchronized (control_mutex) {
             return mute;
         }
     }
 
+    @Override
     public void setSolo(boolean soloState) {
         if (current_mixer != null)
             current_mixer.setSolo(soloState);
@@ -1571,6 +1604,7 @@
         }
     }
 
+    @Override
     public boolean getSolo() {
         synchronized (control_mutex) {
             return solo;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannelProxy.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannelProxy.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import javax.sound.midi.MidiChannel;
@@ -44,156 +45,182 @@
         this.channel = channel;
     }
 
+    @Override
     public void allNotesOff() {
         if (channel == null)
             return;
         channel.allNotesOff();
     }
 
+    @Override
     public void allSoundOff() {
         if (channel == null)
             return;
         channel.allSoundOff();
     }
 
+    @Override
     public void controlChange(int controller, int value) {
         if (channel == null)
             return;
         channel.controlChange(controller, value);
     }
 
+    @Override
     public int getChannelPressure() {
         if (channel == null)
             return 0;
         return channel.getChannelPressure();
     }
 
+    @Override
     public int getController(int controller) {
         if (channel == null)
             return 0;
         return channel.getController(controller);
     }
 
+    @Override
     public boolean getMono() {
         if (channel == null)
             return false;
         return channel.getMono();
     }
 
+    @Override
     public boolean getMute() {
         if (channel == null)
             return false;
         return channel.getMute();
     }
 
+    @Override
     public boolean getOmni() {
         if (channel == null)
             return false;
         return channel.getOmni();
     }
 
+    @Override
     public int getPitchBend() {
         if (channel == null)
             return 8192;
         return channel.getPitchBend();
     }
 
+    @Override
     public int getPolyPressure(int noteNumber) {
         if (channel == null)
             return 0;
         return channel.getPolyPressure(noteNumber);
     }
 
+    @Override
     public int getProgram() {
         if (channel == null)
             return 0;
         return channel.getProgram();
     }
 
+    @Override
     public boolean getSolo() {
         if (channel == null)
             return false;
         return channel.getSolo();
     }
 
+    @Override
     public boolean localControl(boolean on) {
         if (channel == null)
             return false;
         return channel.localControl(on);
     }
 
+    @Override
     public void noteOff(int noteNumber) {
         if (channel == null)
             return;
         channel.noteOff(noteNumber);
     }
 
+    @Override
     public void noteOff(int noteNumber, int velocity) {
         if (channel == null)
             return;
         channel.noteOff(noteNumber, velocity);
     }
 
+    @Override
     public void noteOn(int noteNumber, int velocity) {
         if (channel == null)
             return;
         channel.noteOn(noteNumber, velocity);
     }
 
+    @Override
     public void programChange(int program) {
         if (channel == null)
             return;
         channel.programChange(program);
     }
 
+    @Override
     public void programChange(int bank, int program) {
         if (channel == null)
             return;
         channel.programChange(bank, program);
     }
 
+    @Override
     public void resetAllControllers() {
         if (channel == null)
             return;
         channel.resetAllControllers();
     }
 
+    @Override
     public void setChannelPressure(int pressure) {
         if (channel == null)
             return;
         channel.setChannelPressure(pressure);
     }
 
+    @Override
     public void setMono(boolean on) {
         if (channel == null)
             return;
         channel.setMono(on);
     }
 
+    @Override
     public void setMute(boolean mute) {
         if (channel == null)
             return;
         channel.setMute(mute);
     }
 
+    @Override
     public void setOmni(boolean on) {
         if (channel == null)
             return;
         channel.setOmni(on);
     }
 
+    @Override
     public void setPitchBend(int bend) {
         if (channel == null)
             return;
         channel.setPitchBend(bend);
     }
 
+    @Override
     public void setPolyPressure(int noteNumber, int pressure) {
         if (channel == null)
             return;
         channel.setPolyPressure(noteNumber, pressure);
     }
 
+    @Override
     public void setSolo(boolean soloState) {
         if (channel == null)
             return;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChorus.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChorus.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.Arrays;
@@ -190,6 +191,7 @@
     private float dirty_vdelay1R_reverbsendgain;
     private float controlrate;
 
+    @Override
     public void init(float samplerate, float controlrate) {
         this.controlrate = controlrate;
         vdelay1L = new LFODelay(samplerate, controlrate);
@@ -202,8 +204,9 @@
         globalParameterControlChange(new int[]{0x01 * 128 + 0x02}, 0, 2);
     }
 
+    @Override
     public void globalParameterControlChange(int[] slothpath, long param,
-            long value) {
+                                             long value) {
         if (slothpath.length == 1) {
             if (slothpath[0] == 0x01 * 128 + 0x02) {
                 if (param == 0) { // Chorus Type
@@ -271,6 +274,7 @@
         }
     }
 
+    @Override
     public void processControlLogic() {
         if (dirty) {
             dirty = false;
@@ -286,6 +290,7 @@
     }
     double silentcounter = 1000;
 
+    @Override
     public void processAudio() {
 
         if (inputA.isSilent()) {
@@ -317,15 +322,18 @@
         }
     }
 
+    @Override
     public void setInput(int pin, SoftAudioBuffer input) {
         if (pin == 0)
             inputA = input;
     }
 
+    @Override
     public void setMixMode(boolean mix) {
         this.mix = mix;
     }
 
+    @Override
     public void setOutput(int pin, SoftAudioBuffer output) {
         if (pin == 0)
             left = output;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftControl.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftControl.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -32,5 +33,5 @@
  */
 public interface SoftControl {
 
-    public double[] get(int instance, String name);
+    double[] get(int instance, String name);
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftCubicResampler.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftCubicResampler.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -31,13 +32,15 @@
  */
 public final class SoftCubicResampler extends SoftAbstractResampler {
 
+    @Override
     public int getPadding() {
         return 3;
     }
 
+    @Override
     public void interpolate(float[] in, float[] in_offset, float in_end,
-            float[] startpitch, float pitchstep, float[] out, int[] out_offset,
-            int out_end) {
+                            float[] startpitch, float pitchstep, float[] out, int[] out_offset,
+                            int out_end) {
         float pitch = startpitch[0];
         float ix = in_offset[0];
         int ox = out_offset[0];
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -61,6 +62,7 @@
     private final double[][] decay2 = new double[max_count][1];
     private double control_time = 0;
 
+    @Override
     public void reset() {
         for (int i = 0; i < used_count; i++) {
             stage[i] = 0;
@@ -80,11 +82,13 @@
         used_count = 0;
     }
 
+    @Override
     public void init(SoftSynthesizer synth) {
         control_time = 1.0 / synth.getControlRate();
         processControlLogic();
     }
 
+    @Override
     public double[] get(int instance, String name) {
         if (instance >= used_count)
             used_count = instance + 1;
@@ -118,6 +122,7 @@
         return null;
     }
 
+    @Override
     @SuppressWarnings("fallthrough")
     public void processControlLogic() {
         for (int i = 0; i < used_count; i++) {
@@ -295,6 +300,5 @@
                 break;
             }
         }
-
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftFilter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftFilter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftInstrument.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftInstrument.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import javax.sound.midi.Instrument;
@@ -72,6 +73,7 @@
         return ins;
     }
 
+    @Override
     public Object getData() {
         return data;
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,13 +22,15 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+
 import javax.sound.sampled.AudioFormat;
 import javax.sound.sampled.AudioInputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
 
 /**
  * A jitter corrector to be used with SoftAudioPusher.
@@ -124,6 +126,7 @@
 
             Runnable runnable = new Runnable() {
 
+                @Override
                 public void run() {
                     AudioFormat format = stream.getFormat();
                     int bufflen = buffers[0].length;
@@ -220,6 +223,7 @@
             thread.start();
         }
 
+        @Override
         public void close() throws IOException {
             synchronized (this) {
                 active = false;
@@ -232,6 +236,7 @@
             stream.close();
         }
 
+        @Override
         public int read() throws IOException {
             byte[] b = new byte[1];
             if (read(b) == -1)
@@ -244,6 +249,7 @@
             bbuffer_pos = 0;
         }
 
+        @Override
         public int read(byte[] b, int off, int len) {
             if (bbuffer == null)
                 fillBuffer();
@@ -263,6 +269,7 @@
             return len;
         }
 
+        @Override
         public int available() {
             return bbuffer.length - bbuffer_pos;
         }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLanczosResampler.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLanczosResampler.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -69,14 +70,16 @@
         return w;
     }
 
+    @Override
     public int getPadding() // must be at least half of sinc_table_size
     {
         return sinc_table_size / 2 + 2;
     }
 
+    @Override
     public void interpolate(float[] in, float[] in_offset, float in_end,
-            float[] startpitch, float pitchstep, float[] out, int[] out_offset,
-            int out_end) {
+                            float[] startpitch, float pitchstep, float[] out, int[] out_offset,
+                            int out_end) {
         float pitch = startpitch[0];
         float ix = in_offset[0];
         int ox = out_offset[0];
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLimiter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLimiter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -43,10 +44,12 @@
     SoftAudioBuffer bufferRout;
     float controlrate;
 
+    @Override
     public void init(float samplerate, float controlrate) {
         this.controlrate = controlrate;
     }
 
+    @Override
     public void setInput(int pin, SoftAudioBuffer input) {
         if (pin == 0)
             bufferL = input;
@@ -54,6 +57,7 @@
             bufferR = input;
     }
 
+    @Override
     public void setOutput(int pin, SoftAudioBuffer output) {
         if (pin == 0)
             bufferLout = output;
@@ -61,16 +65,19 @@
             bufferRout = output;
     }
 
+    @Override
     public void setMixMode(boolean mix) {
         this.mix = mix;
     }
 
+    @Override
     public void globalParameterControlChange(int[] slothpath, long param,
-            long value) {
+                                             long value) {
     }
 
     double silentcounter = 0;
 
+    @Override
     public void processAudio() {
         if (this.bufferL.isSilent()
                 && (this.bufferR == null || this.bufferR.isSilent())) {
@@ -186,6 +193,7 @@
         gain = newgain;
     }
 
+    @Override
     public void processControlLogic() {
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -31,13 +32,15 @@
  */
 public final class SoftLinearResampler extends SoftAbstractResampler {
 
+    @Override
     public int getPadding() {
         return 2;
     }
 
+    @Override
     public void interpolate(float[] in, float[] in_offset, float in_end,
-            float[] startpitch, float pitchstep, float[] out, int[] out_offset,
-            int out_end) {
+                            float[] startpitch, float pitchstep, float[] out, int[] out_offset,
+                            int out_end) {
 
         float pitch = startpitch[0];
         float ix = in_offset[0];
@@ -65,6 +68,5 @@
         in_offset[0] = ix;
         out_offset[0] = ox;
         startpitch[0] = pitch;
-
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler2.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler2.java	Wed Jul 05 22:06:46 2017 +0200
@@ -33,13 +33,15 @@
  */
 public final class SoftLinearResampler2 extends SoftAbstractResampler {
 
+    @Override
     public int getPadding() {
         return 2;
     }
 
+    @Override
     public void interpolate(float[] in, float[] in_offset, float in_end,
-            float[] startpitch, float pitchstep, float[] out, int[] out_offset,
-            int out_end) {
+                            float[] startpitch, float pitchstep, float[] out, int[] out_offset,
+                            int out_end) {
 
         float pitch = startpitch[0];
         float ix = in_offset[0];
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -52,6 +53,7 @@
         }
     }
 
+    @Override
     public void reset() {
         for (int i = 0; i < used_count; i++) {
             out[i][0] = 0;
@@ -67,6 +69,7 @@
         used_count = 0;
     }
 
+    @Override
     public void init(SoftSynthesizer synth) {
         control_time = 1.0 / synth.getControlRate();
         sin_factor = control_time * 2 * Math.PI;
@@ -78,6 +81,7 @@
         processControlLogic();
     }
 
+    @Override
     public void processControlLogic() {
         for (int i = 0; i < used_count; i++) {
             if (delay_counter[i] > 0) {
@@ -114,6 +118,7 @@
         }
     }
 
+    @Override
     public double[] get(int instance, String name) {
         if (instance >= used_count)
             used_count = instance + 1;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMainMixer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMainMixer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,15 +22,16 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.Map.Entry;
 import java.util.Set;
 import java.util.TreeMap;
-import java.util.Map.Entry;
 
 import javax.sound.midi.MidiMessage;
 import javax.sound.midi.Patch;
@@ -74,26 +75,26 @@
     private long sample_pos = 0;
     boolean readfully = true;
     private final Object control_mutex;
-    private SoftSynthesizer synth;
+    private final SoftSynthesizer synth;
     private float samplerate = 44100;
     private int nrofchannels = 2;
     private SoftVoice[] voicestatus = null;
-    private SoftAudioBuffer[] buffers;
-    private SoftReverb reverb;
-    private SoftAudioProcessor chorus;
-    private SoftAudioProcessor agc;
+    private final SoftAudioBuffer[] buffers;
+    private final SoftReverb reverb;
+    private final SoftAudioProcessor chorus;
+    private final SoftAudioProcessor agc;
     private long msec_buffer_len = 0;
     private int buffer_len = 0;
-    TreeMap<Long, Object> midimessages = new TreeMap<Long, Object>();
+    TreeMap<Long, Object> midimessages = new TreeMap<>();
     private int delay_midievent = 0;
     private int max_delay_midievent = 0;
     double last_volume_left = 1.0;
     double last_volume_right = 1.0;
-    private double[] co_master_balance = new double[1];
-    private double[] co_master_volume = new double[1];
-    private double[] co_master_coarse_tuning = new double[1];
-    private double[] co_master_fine_tuning = new double[1];
-    private AudioInputStream ais;
+    private final double[] co_master_balance = new double[1];
+    private final double[] co_master_volume = new double[1];
+    private final double[] co_master_coarse_tuning = new double[1];
+    private final double[] co_master_fine_tuning = new double[1];
+    private final AudioInputStream ais;
     private Set<SoftChannelMixerContainer> registeredMixers = null;
     private Set<ModelChannelMixer> stoppedMixers = null;
     private SoftChannelMixerContainer[] cur_registeredMixers = null;
@@ -104,6 +105,7 @@
         double[] coarse_tuning = co_master_coarse_tuning;
         double[] fine_tuning = co_master_fine_tuning;
 
+        @Override
         public double[] get(int instance, String name) {
             if (name == null)
                 return null;
@@ -777,13 +779,13 @@
 
     public void stopMixer(ModelChannelMixer mixer) {
         if (stoppedMixers == null)
-            stoppedMixers = new HashSet<ModelChannelMixer>();
+            stoppedMixers = new HashSet<>();
         stoppedMixers.add(mixer);
     }
 
     public void registerMixer(ModelChannelMixer mixer) {
         if (registeredMixers == null)
-            registeredMixers = new HashSet<SoftChannelMixerContainer>();
+            registeredMixers = new HashSet<>();
         SoftChannelMixerContainer mixercontainer = new SoftChannelMixerContainer();
         mixercontainer.buffers = new SoftAudioBuffer[6];
         for (int i = 0; i < mixercontainer.buffers.length; i++) {
@@ -883,6 +885,7 @@
                 bbuffer_pos = 0;
             }
 
+            @Override
             public int read(byte[] b, int off, int len) {
                 int bbuffer_len = bbuffer.length;
                 int offlen = off + len;
@@ -903,6 +906,7 @@
                 return len;
             }
 
+            @Override
             public int read() throws IOException {
                 int ret = read(single);
                 if (ret == -1)
@@ -910,10 +914,12 @@
                 return single[0] & 0xFF;
             }
 
+            @Override
             public int available() {
                 return bbuffer.length - bbuffer_pos;
             }
 
+            @Override
             public void close() {
                 SoftMainMixer.this.synth.close();
             }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java	Wed Jul 05 22:06:46 2017 +0200
@@ -63,7 +63,7 @@
 
     private AudioInputStream getAudioInputStream(final Sequence seq)
             throws InvalidMidiDataException {
-        AudioSynthesizer synth = (AudioSynthesizer) new SoftSynthesizer();
+        AudioSynthesizer synth = new SoftSynthesizer();
         AudioInputStream stream;
         Receiver recv;
         try {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingClip.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingClip.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.ByteArrayOutputStream;
@@ -52,6 +53,7 @@
 
     private final InputStream datastream = new InputStream() {
 
+        @Override
         public int read() throws IOException {
             byte[] b = new byte[1];
             int ret = read(b);
@@ -60,6 +62,7 @@
             return b[0] & 0xFF;
         }
 
+        @Override
         public int read(byte[] b, int off, int len) throws IOException {
 
             if (_loopcount != 0) {
@@ -166,6 +169,7 @@
         super(mixer, info);
     }
 
+    @Override
     protected void processControlLogic() {
 
         _rightgain = rightgain;
@@ -203,6 +207,7 @@
 
     }
 
+    @Override
     protected void processAudioLogic(SoftAudioBuffer[] buffers) {
         if (_active) {
             float[] left = buffers[SoftMixingMainMixer.CHANNEL_LEFT].array();
@@ -273,15 +278,18 @@
         }
     }
 
+    @Override
     public int getFrameLength() {
         return bufferSize / format.getFrameSize();
     }
 
+    @Override
     public long getMicrosecondLength() {
         return (long) (getFrameLength() * (1000000.0 / (double) getFormat()
                 .getSampleRate()));
     }
 
+    @Override
     public void loop(int count) {
         LineEvent event = null;
 
@@ -302,8 +310,9 @@
 
     }
 
+    @Override
     public void open(AudioInputStream stream) throws LineUnavailableException,
-            IOException {
+                                                     IOException {
         if (isOpen()) {
             throw new IllegalStateException("Clip is already open with format "
                     + getFormat() + " and frame lengh of " + getFrameLength());
@@ -342,6 +351,7 @@
 
     }
 
+    @Override
     public void open(AudioFormat format, byte[] data, int offset, int bufferSize)
             throws LineUnavailableException {
         synchronized (control_mutex) {
@@ -385,6 +395,7 @@
 
     }
 
+    @Override
     public void setFramePosition(int frames) {
         synchronized (control_mutex) {
             frameposition_sg = true;
@@ -392,6 +403,7 @@
         }
     }
 
+    @Override
     public void setLoopPoints(int start, int end) {
         synchronized (control_mutex) {
             if (end != -1) {
@@ -414,60 +426,73 @@
         }
     }
 
+    @Override
     public void setMicrosecondPosition(long microseconds) {
         setFramePosition((int) (microseconds * (((double) getFormat()
                 .getSampleRate()) / 1000000.0)));
     }
 
+    @Override
     public int available() {
         return 0;
     }
 
+    @Override
     public void drain() {
     }
 
+    @Override
     public void flush() {
     }
 
+    @Override
     public int getBufferSize() {
         return bufferSize;
     }
 
+    @Override
     public AudioFormat getFormat() {
         return format;
     }
 
+    @Override
     public int getFramePosition() {
         synchronized (control_mutex) {
             return frameposition;
         }
     }
 
+    @Override
     public float getLevel() {
         return AudioSystem.NOT_SPECIFIED;
     }
 
+    @Override
     public long getLongFramePosition() {
         return getFramePosition();
     }
 
+    @Override
     public long getMicrosecondPosition() {
         return (long) (getFramePosition() * (1000000.0 / (double) getFormat()
                 .getSampleRate()));
     }
 
+    @Override
     public boolean isActive() {
         synchronized (control_mutex) {
             return active;
         }
     }
 
+    @Override
     public boolean isRunning() {
         synchronized (control_mutex) {
             return active;
         }
     }
 
+    @Override
     public void start() {
 
         LineEvent event = null;
@@ -488,6 +513,7 @@
             sendEvent(event);
     }
 
+    @Override
     public void stop() {
         LineEvent event = null;
 
@@ -506,6 +532,7 @@
             sendEvent(event);
     }
 
+    @Override
     public void close() {
         LineEvent event = null;
 
@@ -526,10 +553,12 @@
 
     }
 
+    @Override
     public boolean isOpen() {
         return open;
     }
 
+    @Override
     public void open() throws LineUnavailableException {
         if (data == null) {
             throw new IllegalArgumentException(
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingDataLine.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingDataLine.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.IOException;
@@ -33,11 +34,11 @@
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.BooleanControl;
 import javax.sound.sampled.Control;
+import javax.sound.sampled.Control.Type;
 import javax.sound.sampled.DataLine;
 import javax.sound.sampled.FloatControl;
 import javax.sound.sampled.LineEvent;
 import javax.sound.sampled.LineListener;
-import javax.sound.sampled.Control.Type;
 
 /**
  * General software mixing line.
@@ -130,22 +131,27 @@
             ibuffer_len = buffer_len;
         }
 
+        @Override
         public int available() throws IOException {
             return 0;
         }
 
+        @Override
         public void close() throws IOException {
             ais.close();
         }
 
+        @Override
         public AudioFormat getFormat() {
             return targetFormat;
         }
 
+        @Override
         public long getFrameLength() {
             return AudioSystem.NOT_SPECIFIED; // ais.getFrameLength();
         }
 
+        @Override
         public void mark(int readlimit) {
             ais.mark((int) (readlimit * pitch[0]));
             mark_ibuffer_index = ibuffer_index;
@@ -162,6 +168,7 @@
             }
         }
 
+        @Override
         public boolean markSupported() {
             return ais.markSupported();
         }
@@ -206,6 +213,7 @@
 
         }
 
+        @Override
         public int read(float[] b, int off, int len) throws IOException {
 
             if (cbuffer == null || cbuffer[0].length < len / nrofchannels) {
@@ -255,6 +263,7 @@
             return len - remain * nrofchannels;
         }
 
+        @Override
         public void reset() throws IOException {
             ais.reset();
             if (mark_ibuffer == null)
@@ -271,6 +280,7 @@
 
         }
 
+        @Override
         public long skip(long len) throws IOException {
             if (len > 0)
                 return 0;
@@ -302,6 +312,7 @@
                     -1, 0.0f, "dB", "Minimum", "", "Maximum");
         }
 
+        @Override
         public void setValue(float newValue) {
             super.setValue(newValue);
             calcVolume();
@@ -314,6 +325,7 @@
             super(BooleanControl.Type.MUTE, false, "True", "False");
         }
 
+        @Override
         public void setValue(boolean newValue) {
             super.setValue(newValue);
             calcVolume();
@@ -326,6 +338,7 @@
             super(BooleanControl.Type.APPLY_REVERB, false, "True", "False");
         }
 
+        @Override
         public void setValue(boolean newValue) {
             super.setValue(newValue);
             calcVolume();
@@ -340,6 +353,7 @@
                     0.0f, "", "Left", "Center", "Right");
         }
 
+        @Override
         public void setValue(float newValue) {
             super.setValue(newValue);
             calcVolume();
@@ -354,11 +368,13 @@
                     0.0f, "", "Left", "Center", "Right");
         }
 
+        @Override
         public void setValue(float newValue) {
             super.setValue(newValue);
             balance_control.setValue(newValue);
         }
 
+        @Override
         public float getValue() {
             return balance_control.getValue();
         }
@@ -372,6 +388,7 @@
                     -1, -80f, "dB", "Minimum", "", "Maximum");
         }
 
+        @Override
         public void setValue(float newValue) {
             super.setValue(newValue);
             balance_control.setValue(newValue);
@@ -386,6 +403,7 @@
                     "Minimum", "", "Maximum");
         }
 
+        @Override
         public void setValue(float newValue) {
             super.setValue(newValue);
             balance_control.setValue(newValue);
@@ -417,7 +435,7 @@
 
     float eff2gain = 0;
 
-    List<LineListener> listeners = new ArrayList<LineListener>();
+    List<LineListener> listeners = new ArrayList<>();
 
     final Object control_mutex;
 
@@ -476,22 +494,26 @@
         }
     }
 
+    @Override
     public final void addLineListener(LineListener listener) {
         synchronized (control_mutex) {
             listeners.add(listener);
         }
     }
 
+    @Override
     public final void removeLineListener(LineListener listener) {
         synchronized (control_mutex) {
             listeners.add(listener);
         }
     }
 
+    @Override
     public final javax.sound.sampled.Line.Info getLineInfo() {
         return info;
     }
 
+    @Override
     public final Control getControl(Type control) {
         if (control != null) {
             for (int i = 0; i < controls.length; i++) {
@@ -504,10 +526,12 @@
                 + control);
     }
 
+    @Override
     public final Control[] getControls() {
         return Arrays.copyOf(controls, controls.length);
     }
 
+    @Override
     public final boolean isControlSupported(Type control) {
         if (control != null) {
             for (int i = 0; i < controls.length; i++) {
@@ -518,5 +542,4 @@
         }
         return false;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMainMixer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMainMixer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.IOException;
@@ -79,7 +80,7 @@
 
     private final Object control_mutex;
 
-    private final List<SoftMixingDataLine> openLinesList = new ArrayList<SoftMixingDataLine>();
+    private final List<SoftMixingDataLine> openLinesList = new ArrayList<>();
 
     private SoftMixingDataLine[] openLines = new SoftMixingDataLine[0];
 
@@ -184,6 +185,7 @@
                 bbuffer_pos = 0;
             }
 
+            @Override
             public int read(byte[] b, int off, int len) {
                 int bbuffer_len = bbuffer.length;
                 int offlen = off + len;
@@ -200,6 +202,7 @@
                 return len;
             }
 
+            @Override
             public int read() throws IOException {
                 int ret = read(single);
                 if (ret == -1)
@@ -207,10 +210,12 @@
                 return single[0] & 0xFF;
             }
 
+            @Override
             public int available() {
                 return bbuffer.length - bbuffer_pos;
             }
 
+            @Override
             public void close() {
                 SoftMixingMainMixer.this.mixer.close();
             }
@@ -239,14 +244,12 @@
                 if (mixer.implicitOpen)
                     mixer.close();
         }
-
     }
 
     public SoftMixingDataLine[] getOpenLines() {
         synchronized (control_mutex) {
             return openLines;
         }
-
     }
 
     public void close() {
@@ -255,5 +258,4 @@
             openLines[i].close();
         }
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.IOException;
@@ -29,10 +30,12 @@
 import java.util.List;
 
 import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioFormat.Encoding;
 import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.Clip;
 import javax.sound.sampled.Control;
+import javax.sound.sampled.Control.Type;
 import javax.sound.sampled.DataLine;
 import javax.sound.sampled.Line;
 import javax.sound.sampled.LineEvent;
@@ -40,11 +43,9 @@
 import javax.sound.sampled.LineUnavailableException;
 import javax.sound.sampled.Mixer;
 import javax.sound.sampled.SourceDataLine;
-import javax.sound.sampled.AudioFormat.Encoding;
-import javax.sound.sampled.Control.Type;
 
 /**
- * Software audio mixer
+ * Software audio mixer.
  *
  * @author Karl Helgason
  */
@@ -88,7 +89,7 @@
 
     private final boolean jitter_correction = false;
 
-    private final List<LineListener> listeners = new ArrayList<LineListener>();
+    private final List<LineListener> listeners = new ArrayList<>();
 
     private final javax.sound.sampled.Line.Info[] sourceLineInfo;
 
@@ -96,7 +97,7 @@
 
         sourceLineInfo = new javax.sound.sampled.Line.Info[2];
 
-        ArrayList<AudioFormat> formats = new ArrayList<AudioFormat>();
+        ArrayList<AudioFormat> formats = new ArrayList<>();
         for (int channels = 1; channels <= 2; channels++) {
             formats.add(new AudioFormat(Encoding.PCM_SIGNED,
                     AudioSystem.NOT_SPECIFIED, 8, channels, channels,
@@ -140,6 +141,7 @@
                 AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED);
     }
 
+    @Override
     public Line getLine(Line.Info info) throws LineUnavailableException {
 
         if (!isLineSupported(info))
@@ -155,6 +157,7 @@
         throw new IllegalArgumentException("Line unsupported: " + info);
     }
 
+    @Override
     public int getMaxLines(Line.Info info) {
         if (info.getLineClass() == SourceDataLine.class)
             return AudioSystem.NOT_SPECIFIED;
@@ -163,10 +166,12 @@
         return 0;
     }
 
+    @Override
     public javax.sound.sampled.Mixer.Info getMixerInfo() {
         return info;
     }
 
+    @Override
     public javax.sound.sampled.Line.Info[] getSourceLineInfo() {
         Line.Info[] localArray = new Line.Info[sourceLineInfo.length];
         System.arraycopy(sourceLineInfo, 0, localArray, 0,
@@ -174,10 +179,11 @@
         return localArray;
     }
 
+    @Override
     public javax.sound.sampled.Line.Info[] getSourceLineInfo(
             javax.sound.sampled.Line.Info info) {
         int i;
-        ArrayList<javax.sound.sampled.Line.Info> infos = new ArrayList<javax.sound.sampled.Line.Info>();
+        ArrayList<javax.sound.sampled.Line.Info> infos = new ArrayList<>();
 
         for (i = 0; i < sourceLineInfo.length; i++) {
             if (info.matches(sourceLineInfo[i])) {
@@ -187,6 +193,7 @@
         return infos.toArray(new Line.Info[infos.size()]);
     }
 
+    @Override
     public Line[] getSourceLines() {
 
         Line[] localLines;
@@ -207,19 +214,23 @@
         return localLines;
     }
 
+    @Override
     public javax.sound.sampled.Line.Info[] getTargetLineInfo() {
         return new javax.sound.sampled.Line.Info[0];
     }
 
+    @Override
     public javax.sound.sampled.Line.Info[] getTargetLineInfo(
             javax.sound.sampled.Line.Info info) {
         return new javax.sound.sampled.Line.Info[0];
     }
 
+    @Override
     public Line[] getTargetLines() {
         return new Line[0];
     }
 
+    @Override
     public boolean isLineSupported(javax.sound.sampled.Line.Info info) {
         if (info != null) {
             for (int i = 0; i < sourceLineInfo.length; i++) {
@@ -231,20 +242,24 @@
         return false;
     }
 
+    @Override
     public boolean isSynchronizationSupported(Line[] lines, boolean maintainSync) {
         return false;
     }
 
+    @Override
     public void synchronize(Line[] lines, boolean maintainSync) {
         throw new IllegalArgumentException(
                 "Synchronization not supported by this mixer.");
     }
 
+    @Override
     public void unsynchronize(Line[] lines) {
         throw new IllegalArgumentException(
                 "Synchronization not supported by this mixer.");
     }
 
+    @Override
     public void addLineListener(LineListener listener) {
         synchronized (control_mutex) {
             listeners.add(listener);
@@ -261,6 +276,7 @@
         }
     }
 
+    @Override
     public void close() {
         if (!isOpen())
             return;
@@ -308,29 +324,35 @@
 
     }
 
+    @Override
     public Control getControl(Type control) {
         throw new IllegalArgumentException("Unsupported control type : "
                 + control);
     }
 
+    @Override
     public Control[] getControls() {
         return new Control[0];
     }
 
+    @Override
     public javax.sound.sampled.Line.Info getLineInfo() {
         return new Line.Info(Mixer.class);
     }
 
+    @Override
     public boolean isControlSupported(Type control) {
         return false;
     }
 
+    @Override
     public boolean isOpen() {
         synchronized (control_mutex) {
             return open;
         }
     }
 
+    @Override
     public void open() throws LineUnavailableException {
         if (isOpen()) {
             implicitOpen = false;
@@ -498,6 +520,7 @@
 
     }
 
+    @Override
     public void removeLineListener(LineListener listener) {
         synchronized (control_mutex) {
             listeners.remove(listener);
@@ -525,5 +548,4 @@
             return null;
         return mainmixer;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import javax.sound.sampled.Mixer;
@@ -29,7 +30,7 @@
 import javax.sound.sampled.spi.MixerProvider;
 
 /**
- * Provider for software audio mixer
+ * Provider for software audio mixer.
  *
  * @author Karl Helgason
  */
@@ -41,6 +42,7 @@
 
     static final Object mutex = new Object();
 
+    @Override
     public Mixer getMixer(Info info) {
         if (!(info == null || info == SoftMixingMixer.info)) {
             throw new IllegalArgumentException("Mixer " + info.toString()
@@ -56,11 +58,10 @@
                 globalmixer = new SoftMixingMixer();
             return globalmixer;
         }
-
     }
 
+    @Override
     public Info[] getMixerInfo() {
         return new Info[] { SoftMixingMixer.info };
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.IOException;
@@ -76,30 +77,37 @@
             this.ais = ais;
         }
 
+        @Override
         public int available() throws IOException {
             return ais.available();
         }
 
+        @Override
         public void close() throws IOException {
             ais.close();
         }
 
+        @Override
         public AudioFormat getFormat() {
             return ais.getFormat();
         }
 
+        @Override
         public long getFrameLength() {
             return ais.getFrameLength();
         }
 
+        @Override
         public void mark(int readlimit) {
             ais.mark(readlimit);
         }
 
+        @Override
         public boolean markSupported() {
             return ais.markSupported();
         }
 
+        @Override
         public int read(float[] b, int off, int len) throws IOException {
             int avail = available();
             if (len > avail) {
@@ -110,10 +118,12 @@
             return ais.read(b, off, len);
         }
 
+        @Override
         public void reset() throws IOException {
             ais.reset();
         }
 
+        @Override
         public long skip(long len) throws IOException {
             return ais.skip(len);
         }
@@ -124,6 +134,7 @@
         super(mixer, info);
     }
 
+    @Override
     public int write(byte[] b, int off, int len) {
         if (!isOpen())
             return 0;
@@ -202,6 +213,7 @@
 
     private float _eff2gain;
 
+    @Override
     protected void processControlLogic() {
         _active = active;
         _rightgain = rightgain;
@@ -210,6 +222,7 @@
         _eff2gain = eff2gain;
     }
 
+    @Override
     protected void processAudioLogic(SoftAudioBuffer[] buffers) {
         if (_active) {
             float[] left = buffers[SoftMixingMainMixer.CHANNEL_LEFT].array();
@@ -274,10 +287,12 @@
         }
     }
 
+    @Override
     public void open() throws LineUnavailableException {
         open(format);
     }
 
+    @Override
     public void open(AudioFormat format) throws LineUnavailableException {
         if (bufferSize == -1)
             bufferSize = ((int) (format.getFrameRate() / 2))
@@ -285,6 +300,7 @@
         open(format, bufferSize);
     }
 
+    @Override
     public void open(AudioFormat format, int bufferSize)
             throws LineUnavailableException {
 
@@ -323,6 +339,7 @@
 
                 InputStream cycling_inputstream = new InputStream() {
 
+                    @Override
                     public int read() throws IOException {
                         byte[] b = new byte[1];
                         int ret = read(b);
@@ -331,12 +348,14 @@
                         return b[0] & 0xFF;
                     }
 
+                    @Override
                     public int available() throws IOException {
                         synchronized (cycling_buffer) {
                             return cycling_avail;
                         }
                     }
 
+                    @Override
                     public int read(byte[] b, int off, int len)
                             throws IOException {
 
@@ -387,12 +406,14 @@
 
     }
 
+    @Override
     public int available() {
         synchronized (cycling_buffer) {
             return cycling_buffer.length - cycling_avail;
         }
     }
 
+    @Override
     public void drain() {
         while (true) {
             int avail;
@@ -409,6 +430,7 @@
         }
     }
 
+    @Override
     public void flush() {
         synchronized (cycling_buffer) {
             cycling_read_pos = 0;
@@ -417,49 +439,58 @@
         }
     }
 
+    @Override
     public int getBufferSize() {
         synchronized (control_mutex) {
             return bufferSize;
         }
     }
 
+    @Override
     public AudioFormat getFormat() {
         synchronized (control_mutex) {
             return format;
         }
     }
 
+    @Override
     public int getFramePosition() {
         return (int) getLongFramePosition();
     }
 
+    @Override
     public float getLevel() {
         return AudioSystem.NOT_SPECIFIED;
     }
 
+    @Override
     public long getLongFramePosition() {
         synchronized (cycling_buffer) {
             return cycling_framepos;
         }
     }
 
+    @Override
     public long getMicrosecondPosition() {
         return (long) (getLongFramePosition() * (1000000.0 / (double) getFormat()
                 .getSampleRate()));
     }
 
+    @Override
     public boolean isActive() {
         synchronized (control_mutex) {
             return active;
         }
     }
 
+    @Override
     public boolean isRunning() {
         synchronized (control_mutex) {
             return active;
         }
     }
 
+    @Override
     public void start() {
 
         LineEvent event = null;
@@ -478,6 +509,7 @@
             sendEvent(event);
     }
 
+    @Override
     public void stop() {
         LineEvent event = null;
 
@@ -495,6 +527,7 @@
             sendEvent(event);
     }
 
+    @Override
     public void close() {
 
         LineEvent event = null;
@@ -516,10 +549,10 @@
 
     }
 
+    @Override
     public boolean isOpen() {
         synchronized (control_mutex) {
             return open;
         }
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPerformer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPerformer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.ArrayList;
@@ -92,6 +93,7 @@
                 ModelStandardTransform.TRANSFORM_LINEAR),
             new ModelSource(new ModelIdentifier("midi_rpn", "0"),
                 new ModelTransform() {
+                    @Override
                     public double transform(double value) {
                         int v = (int) (value * 16384.0);
                         int msb = v >> 7;
@@ -309,21 +311,22 @@
     public ModelPerformer performer;
     public ModelConnectionBlock[] connections;
     public ModelOscillator[] oscillators;
-    public Map<Integer, int[]> midi_rpn_connections = new HashMap<Integer, int[]>();
-    public Map<Integer, int[]> midi_nrpn_connections = new HashMap<Integer, int[]>();
+    public Map<Integer, int[]> midi_rpn_connections = new HashMap<>();
+    public Map<Integer, int[]> midi_nrpn_connections = new HashMap<>();
     public int[][] midi_ctrl_connections;
     public int[][] midi_connections;
     public int[] ctrl_connections;
-    private List<Integer> ctrl_connections_list = new ArrayList<Integer>();
+    private final List<Integer> ctrl_connections_list = new ArrayList<>();
 
     private static class KeySortComparator implements Comparator<ModelSource> {
 
+        @Override
         public int compare(ModelSource o1, ModelSource o2) {
             return o1.getIdentifier().toString().compareTo(
                     o2.getIdentifier().toString());
         }
     }
-    private static KeySortComparator keySortComparator = new KeySortComparator();
+    private static final KeySortComparator keySortComparator = new KeySortComparator();
 
     private String extractKeys(ModelConnectionBlock conn) {
         StringBuilder sb = new StringBuilder();
@@ -474,9 +477,9 @@
         exclusiveClass = performer.getExclusiveClass();
         selfNonExclusive = performer.isSelfNonExclusive();
 
-        Map<String, ModelConnectionBlock> connmap = new HashMap<String, ModelConnectionBlock>();
+        Map<String, ModelConnectionBlock> connmap = new HashMap<>();
 
-        List<ModelConnectionBlock> performer_connections = new ArrayList<ModelConnectionBlock>();
+        List<ModelConnectionBlock> performer_connections = new ArrayList<>();
         performer_connections.addAll(performer.getConnectionBlocks());
 
         if (performer.isDefaultConnectionsEnabled()) {
@@ -649,6 +652,7 @@
                 new ModelSource(new ModelIdentifier("midi_cc", "77"),
                     new ModelTransform() {
                         double s = scale;
+                        @Override
                         public double transform(double value) {
                             value = value * 2 - 1;
                             value *= 600;
@@ -687,7 +691,7 @@
             connmap.put(extractKeys(connection), connection);
         // seperate connection blocks : Init time, Midi Time, Midi/Control Time,
         // Control Time
-        List<ModelConnectionBlock> connections = new ArrayList<ModelConnectionBlock>();
+        List<ModelConnectionBlock> connections = new ArrayList<>();
 
         midi_ctrl_connections = new int[128][];
         for (int i = 0; i < midi_ctrl_connections.length; i++) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPointResampler.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPointResampler.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -31,13 +32,15 @@
  */
 public final class SoftPointResampler extends SoftAbstractResampler {
 
+    @Override
     public int getPadding() {
         return 100;
     }
 
+    @Override
     public void interpolate(float[] in, float[] in_offset, float in_end,
-            float[] startpitch, float pitchstep, float[] out, int[] out_offset,
-            int out_end) {
+                            float[] startpitch, float pitchstep, float[] out, int[] out_offset,
+                            int out_end) {
         float pitch = startpitch[0];
         float ix = in_offset[0];
         int ox = out_offset[0];
@@ -58,6 +61,5 @@
         in_offset[0] = ix;
         out_offset[0] = ox;
         startpitch[0] = pitch;
-
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftProcess.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftProcess.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,20 +22,22 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
- * Control signal processor interface
+ * Control signal processor interface.
  *
  * @author Karl Helgason
  */
 public interface SoftProcess extends SoftControl {
 
-    public void init(SoftSynthesizer synth);
+    void init(SoftSynthesizer synth);
 
-    public double[] get(int instance, String name);
+    @Override
+    double[] get(int instance, String name);
 
-    public void processControlLogic();
+    void processControlLogic();
 
-    public void reset();
+    void reset();
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReceiver.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReceiver.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.TreeMap;
@@ -52,10 +53,12 @@
             this.midimessages = mainmixer.midimessages;
     }
 
+    @Override
     public MidiDevice getMidiDevice() {
         return synth;
     }
 
+    @Override
     public void send(MidiMessage message, long timeStamp) {
 
         synchronized (control_mutex) {
@@ -80,6 +83,7 @@
         }
     }
 
+    @Override
     public void close() {
         synchronized (control_mutex) {
             open = false;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResampler.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResampler.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -31,5 +32,5 @@
  */
 public interface SoftResampler {
 
-    public SoftResamplerStreamer openStreamer();
+    SoftResamplerStreamer openStreamer();
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResamplerStreamer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResamplerStreamer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.IOException;
@@ -33,6 +34,5 @@
  */
 public interface SoftResamplerStreamer extends ModelOscillatorStream {
 
-    public void open(ModelWavetable osc, float outputsamplerate)
-            throws IOException;
+    void open(ModelWavetable osc, float outputsamplerate) throws IOException;
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReverb.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReverb.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.util.Arrays;
@@ -210,6 +211,7 @@
     private float samplerate;
     private boolean light = true;
 
+    @Override
     public void init(float samplerate, float controlrate) {
         this.samplerate = samplerate;
 
@@ -260,11 +262,13 @@
 
     }
 
+    @Override
     public void setInput(int pin, SoftAudioBuffer input) {
         if (pin == 0)
             inputA = input;
     }
 
+    @Override
     public void setOutput(int pin, SoftAudioBuffer output) {
         if (pin == 0)
             left = output;
@@ -272,12 +276,14 @@
             right = output;
     }
 
+    @Override
     public void setMixMode(boolean mix) {
         this.mix = mix;
     }
 
     private boolean silent = true;
 
+    @Override
     public void processAudio() {
         boolean silent_input = this.inputA.isSilent();
         if(!silent_input)
@@ -330,7 +336,7 @@
             for (int i = 4; i < combL.length-2; i+=2)
                 combL[i].processMix(input, pre1);
 
-            combL[3].processReplace(input, pre2);;
+            combL[3].processReplace(input, pre2);
             for (int i = 5; i < combL.length-2; i+=2)
                 combL[i].processMix(input, pre2);
 
@@ -376,11 +382,6 @@
                 combL[i].processMix(out, left);
         }
 
-
-
-
-
-
         if (silent_input) {
             silent = true;
             for (int i = 0; i < numsamples; i++)
@@ -396,8 +397,9 @@
 
     }
 
+    @Override
     public void globalParameterControlChange(int[] slothpath, long param,
-            long value) {
+                                             long value) {
         if (slothpath.length == 1) {
             if (slothpath[0] == 0x01 * 128 + 0x01) {
 
@@ -463,6 +465,7 @@
         }
     }
 
+    @Override
     public void processControlLogic() {
         if (dirty) {
             dirty = false;
@@ -504,7 +507,6 @@
             combL[i].setDamp(damp);
             combR[i].setDamp(damp);
         }
-
     }
 
     public void setLightMode(boolean light)
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftShortMessage.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftShortMessage.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import javax.sound.midi.InvalidMidiDataException;
@@ -36,16 +37,19 @@
 
     int channel = 0;
 
+    @Override
     public int getChannel() {
         return channel;
     }
 
+    @Override
     public void setMessage(int command, int channel, int data1, int data2)
             throws InvalidMidiDataException {
         this.channel = channel;
         super.setMessage(command, channel & 0xF, data1, data2);
     }
 
+    @Override
     public Object clone() {
         SoftShortMessage clone = new SoftShortMessage();
         try {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSincResampler.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSincResampler.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 /**
@@ -76,14 +77,16 @@
         return w;
     }
 
+    @Override
     public int getPadding() // must be at least half of sinc_table_size
     {
         return sinc_table_size / 2 + 2;
     }
 
+    @Override
     public void interpolate(float[] in, float[] in_offset, float in_end,
-            float[] startpitch, float pitchstep, float[] out, int[] out_offset,
-            int out_end) {
+                            float[] startpitch, float pitchstep, float[] out, int[] out_offset,
+                            int out_end) {
         float pitch = startpitch[0];
         float ix = in_offset[0];
         int ox = out_offset[0];
@@ -134,6 +137,5 @@
         in_offset[0] = ix;
         out_offset[0] = ox;
         startpitch[0] = pitch;
-
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -78,16 +78,17 @@
         public SourceDataLine sourceDataLine = null;
         public volatile long silent_samples = 0;
         private int framesize = 0;
-        private WeakReference<AudioInputStream> weak_stream_link;
-        private AudioFloatConverter converter;
+        private final WeakReference<AudioInputStream> weak_stream_link;
+        private final AudioFloatConverter converter;
         private float[] silentbuffer = null;
-        private int samplesize;
+        private final int samplesize;
 
         public void setInputStream(AudioInputStream stream)
         {
             this.stream = stream;
         }
 
+        @Override
         public int available() throws IOException {
             AudioInputStream local_stream = stream;
             if(local_stream != null)
@@ -95,6 +96,7 @@
             return 0;
         }
 
+        @Override
         public int read() throws IOException {
              byte[] b = new byte[1];
              if (read(b) == -1)
@@ -102,6 +104,7 @@
              return b[0] & 0xFF;
         }
 
+        @Override
         public int read(byte[] b, int off, int len) throws IOException {
              AudioInputStream local_stream = stream;
              if(local_stream != null)
@@ -123,6 +126,7 @@
                          SoftAudioPusher _pusher = pusher;
                          AudioInputStream _jitter_stream = jitter_stream;
                          SourceDataLine _sourceDataLine = sourceDataLine;
+                         @Override
                          public void run()
                          {
                              _pusher.stop();
@@ -147,7 +151,7 @@
 
         public WeakAudioStream(AudioInputStream stream) {
             this.stream = stream;
-            weak_stream_link = new WeakReference<AudioInputStream>(stream);
+            weak_stream_link = new WeakReference<>(stream);
             converter = AudioFloatConverter.getConverter(stream.getFormat());
             samplesize = stream.getFormat().getFrameSize() / stream.getFormat().getChannels();
             framesize = stream.getFormat().getFrameSize();
@@ -158,6 +162,7 @@
             return new AudioInputStream(this, stream.getFormat(), AudioSystem.NOT_SPECIFIED);
         }
 
+        @Override
         public void close() throws IOException
         {
             AudioInputStream astream  = weak_stream_link.get();
@@ -233,14 +238,10 @@
     private SoftMainMixer mainmixer;
     private SoftVoice[] voices;
 
-    private Map<String, SoftTuning> tunings
-            = new HashMap<String, SoftTuning>();
-    private Map<String, SoftInstrument> inslist
-            = new HashMap<String, SoftInstrument>();
-    private Map<String, ModelInstrument> loadedlist
-            = new HashMap<String, ModelInstrument>();
-
-    private ArrayList<Receiver> recvslist = new ArrayList<Receiver>();
+    private final Map<String, SoftTuning> tunings = new HashMap<>();
+    private final Map<String, SoftInstrument> inslist = new HashMap<>();
+    private final Map<String, ModelInstrument> loadedlist = new HashMap<>();
+    private final ArrayList<Receiver> recvslist = new ArrayList<>();
 
     private void getBuffers(ModelInstrument instrument,
             List<ModelByteBuffer> buffers) {
@@ -264,7 +265,7 @@
     private boolean loadSamples(List<ModelInstrument> instruments) {
         if (largemode)
             return true;
-        List<ModelByteBuffer> buffers = new ArrayList<ModelByteBuffer>();
+        List<ModelByteBuffer> buffers = new ArrayList<>();
         for (ModelInstrument instrument : instruments)
             getBuffers(instrument, buffers);
         try {
@@ -485,24 +486,28 @@
         return tuning;
     }
 
+    @Override
     public long getLatency() {
         synchronized (control_mutex) {
             return latency;
         }
     }
 
+    @Override
     public AudioFormat getFormat() {
         synchronized (control_mutex) {
             return format;
         }
     }
 
+    @Override
     public int getMaxPolyphony() {
         synchronized (control_mutex) {
             return maxpoly;
         }
     }
 
+    @Override
     public MidiChannel[] getChannels() {
 
         synchronized (control_mutex) {
@@ -525,6 +530,7 @@
         }
     }
 
+    @Override
     public VoiceStatus[] getVoiceStatus() {
         if (!isOpen()) {
             VoiceStatus[] tempVoiceStatusArray
@@ -559,6 +565,7 @@
         }
     }
 
+    @Override
     public boolean isSoundbankSupported(Soundbank soundbank) {
         for (Instrument ins: soundbank.getInstruments())
             if (!(ins instanceof ModelInstrument))
@@ -566,16 +573,18 @@
         return true;
     }
 
+    @Override
     public boolean loadInstrument(Instrument instrument) {
         if (instrument == null || (!(instrument instanceof ModelInstrument))) {
             throw new IllegalArgumentException("Unsupported instrument: " +
                     instrument);
         }
-        List<ModelInstrument> instruments = new ArrayList<ModelInstrument>();
+        List<ModelInstrument> instruments = new ArrayList<>();
         instruments.add((ModelInstrument)instrument);
         return loadInstruments(instruments);
     }
 
+    @Override
     public void unloadInstrument(Instrument instrument) {
         if (instrument == null || (!(instrument instanceof ModelInstrument))) {
             throw new IllegalArgumentException("Unsupported instrument: " +
@@ -596,6 +605,7 @@
         }
     }
 
+    @Override
     public boolean remapInstrument(Instrument from, Instrument to) {
 
         if (from == null)
@@ -623,15 +633,16 @@
         }
     }
 
+    @Override
     public Soundbank getDefaultSoundbank() {
         synchronized (SoftSynthesizer.class) {
             if (defaultSoundBank != null)
                 return defaultSoundBank;
 
-            List<PrivilegedAction<InputStream>> actions =
-                new ArrayList<PrivilegedAction<InputStream>>();
+            List<PrivilegedAction<InputStream>> actions = new ArrayList<>();
 
             actions.add(new PrivilegedAction<InputStream>() {
+                @Override
                 public InputStream run() {
                     File javahome = new File(System.getProperties()
                             .getProperty("java.home"));
@@ -667,6 +678,7 @@
             });
 
             actions.add(new PrivilegedAction<InputStream>() {
+                @Override
                 public InputStream run() {
                     if (System.getProperties().getProperty("os.name")
                             .startsWith("Linux")) {
@@ -701,6 +713,7 @@
             });
 
             actions.add(new PrivilegedAction<InputStream>() {
+                @Override
                 public InputStream run() {
                     if (System.getProperties().getProperty("os.name")
                             .startsWith("Windows")) {
@@ -718,6 +731,7 @@
             });
 
             actions.add(new PrivilegedAction<InputStream>() {
+                @Override
                 public InputStream run() {
                     /*
                      * Try to load saved generated soundbank
@@ -798,6 +812,7 @@
         return defaultSoundBank;
     }
 
+    @Override
     public Instrument[] getAvailableInstruments() {
         Soundbank defsbk = getDefaultSoundbank();
         if (defsbk == null)
@@ -807,6 +822,7 @@
         return inslist_array;
     }
 
+    @Override
     public Instrument[] getLoadedInstruments() {
         if (!isOpen())
             return new Instrument[0];
@@ -820,8 +836,9 @@
         }
     }
 
+    @Override
     public boolean loadAllInstruments(Soundbank soundbank) {
-        List<ModelInstrument> instruments = new ArrayList<ModelInstrument>();
+        List<ModelInstrument> instruments = new ArrayList<>();
         for (Instrument ins: soundbank.getInstruments()) {
             if (ins == null || !(ins instanceof ModelInstrument)) {
                 throw new IllegalArgumentException(
@@ -832,6 +849,7 @@
         return loadInstruments(instruments);
     }
 
+    @Override
     public void unloadAllInstruments(Soundbank soundbank) {
         if (soundbank == null || !isSoundbankSupported(soundbank))
             throw new IllegalArgumentException("Unsupported soundbank: " + soundbank);
@@ -846,8 +864,9 @@
         }
     }
 
+    @Override
     public boolean loadInstruments(Soundbank soundbank, Patch[] patchList) {
-        List<ModelInstrument> instruments = new ArrayList<ModelInstrument>();
+        List<ModelInstrument> instruments = new ArrayList<>();
         for (Patch patch: patchList) {
             Instrument ins = soundbank.getInstrument(patch);
             if (ins == null || !(ins instanceof ModelInstrument)) {
@@ -859,6 +878,7 @@
         return loadInstruments(instruments);
     }
 
+    @Override
     public void unloadInstruments(Soundbank soundbank, Patch[] patchList) {
         if (soundbank == null || !isSoundbankSupported(soundbank))
             throw new IllegalArgumentException("Unsupported soundbank: " + soundbank);
@@ -874,6 +894,7 @@
         }
     }
 
+    @Override
     public MidiDevice.Info getDeviceInfo() {
         return info;
     }
@@ -901,9 +922,9 @@
                 });
     }
 
+    @Override
     public AudioSynthesizerPropertyInfo[] getPropertyInfo(Map<String, Object> info) {
-        List<AudioSynthesizerPropertyInfo> list =
-                new ArrayList<AudioSynthesizerPropertyInfo>();
+        List<AudioSynthesizerPropertyInfo> list = new ArrayList<>();
 
         AudioSynthesizerPropertyInfo item;
 
@@ -1058,6 +1079,7 @@
         return items;
     }
 
+    @Override
     public void open() throws MidiUnavailableException {
         if (isOpen()) {
             synchronized (control_mutex) {
@@ -1068,6 +1090,7 @@
         open(null, null);
     }
 
+    @Override
     public void open(SourceDataLine line, Map<String, Object> info) throws MidiUnavailableException {
         if (isOpen()) {
             synchronized (control_mutex) {
@@ -1162,8 +1185,9 @@
         }
     }
 
+    @Override
     public AudioInputStream openStream(AudioFormat targetFormat,
-            Map<String, Object> info) throws MidiUnavailableException {
+                                       Map<String, Object> info) throws MidiUnavailableException {
 
         if (isOpen())
             throw new MidiUnavailableException("Synthesizer is already open");
@@ -1243,6 +1267,7 @@
         }
     }
 
+    @Override
     public void close() {
 
         if (!isOpen())
@@ -1301,12 +1326,14 @@
         }
     }
 
+    @Override
     public boolean isOpen() {
         synchronized (control_mutex) {
             return open;
         }
     }
 
+    @Override
     public long getMicrosecondPosition() {
 
         if (!isOpen())
@@ -1317,14 +1344,17 @@
         }
     }
 
+    @Override
     public int getMaxReceivers() {
         return -1;
     }
 
+    @Override
     public int getMaxTransmitters() {
         return 0;
     }
 
+    @Override
     public Receiver getReceiver() throws MidiUnavailableException {
 
         synchronized (control_mutex) {
@@ -1335,25 +1365,29 @@
         }
     }
 
+    @Override
     public List<Receiver> getReceivers() {
 
         synchronized (control_mutex) {
-            ArrayList<Receiver> recvs = new ArrayList<Receiver>();
+            ArrayList<Receiver> recvs = new ArrayList<>();
             recvs.addAll(recvslist);
             return recvs;
         }
     }
 
+    @Override
     public Transmitter getTransmitter() throws MidiUnavailableException {
 
         throw new MidiUnavailableException("No transmitter available");
     }
 
+    @Override
     public List<Transmitter> getTransmitters() {
 
-        return new ArrayList<Transmitter>();
+        return new ArrayList<>();
     }
 
+    @Override
     public Receiver getReceiverReferenceCounting()
             throws MidiUnavailableException {
 
@@ -1367,6 +1401,7 @@
         return getReceiver();
     }
 
+    @Override
     public Transmitter getTransmitterReferenceCounting()
             throws MidiUnavailableException {
 
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftTuning.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftTuning.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.UnsupportedEncodingException;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftVoice.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftVoice.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.IOException;
@@ -63,8 +64,7 @@
     private final SoftFilter filter_right;
     private final SoftProcess eg = new SoftEnvelopeGenerator();
     private final SoftProcess lfo = new SoftLowFrequencyOscillator();
-    Map<String, SoftControl> objects =
-            new HashMap<String, SoftControl>();
+    final Map<String, SoftControl> objects = new HashMap<>();
     SoftSynthesizer synthesizer;
     SoftInstrument instrument;
     SoftPerformer performer;
@@ -107,6 +107,7 @@
         double[] keynumber = co_noteon_keynumber;
         double[] velocity = co_noteon_velocity;
         double[] on = co_noteon_on;
+        @Override
         public double[] get(int instance, String name) {
             if (name == null)
                 return null;
@@ -126,12 +127,13 @@
     private final double[] co_mixer_reverb = new double[1];
     private final double[] co_mixer_chorus = new double[1];
     private final SoftControl co_mixer = new SoftControl() {
-        double[] active = co_mixer_active;
-        double[] gain = co_mixer_gain;
-        double[] pan = co_mixer_pan;
-        double[] balance = co_mixer_balance;
-        double[] reverb = co_mixer_reverb;
-        double[] chorus = co_mixer_chorus;
+        final double[] active = co_mixer_active;
+        final double[] gain = co_mixer_gain;
+        final double[] pan = co_mixer_pan;
+        final double[] balance = co_mixer_balance;
+        final double[] reverb = co_mixer_reverb;
+        final double[] chorus = co_mixer_chorus;
+        @Override
         public double[] get(int instance, String name) {
             if (name == null)
                 return null;
@@ -152,7 +154,8 @@
     };
     private final double[] co_osc_pitch = new double[1];
     private final SoftControl co_osc = new SoftControl() {
-        double[] pitch = co_osc_pitch;
+        final double[] pitch = co_osc_pitch;
+        @Override
         public double[] get(int instance, String name) {
             if (name == null)
                 return null;
@@ -165,9 +168,10 @@
     private final double[] co_filter_type = new double[1];
     private final double[] co_filter_q = new double[1];
     private final SoftControl co_filter = new SoftControl() {
-        double[] freq = co_filter_freq;
-        double[] ftype = co_filter_type;
-        double[] q = co_filter_q;
+        final double[] freq = co_filter_freq;
+        final double[] ftype = co_filter_type;
+        final double[] q = co_filter_q;
+        @Override
         public double[] get(int instance, String name) {
             if (name == null)
                 return null;
@@ -913,6 +917,5 @@
         if (out_mixer_end) {
             stopping = true;
         }
-
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileReader.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileReader.java	Wed Jul 05 22:06:46 2017 +0200
@@ -57,6 +57,7 @@
 
     private static final int bisBufferSize = 1024; // buffer size in buffered input streams
 
+    @Override
     public MidiFileFormat getMidiFileFormat(InputStream stream)
             throws InvalidMidiDataException, IOException {
         return getMidiFileFormatFromStream(stream, MidiFileFormat.UNKNOWN_LENGTH, null);
@@ -143,7 +144,7 @@
         return format;
     }
 
-
+    @Override
     public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException {
         InputStream urlStream = url.openStream(); // throws IOException
         BufferedInputStream bis = new BufferedInputStream( urlStream, bisBufferSize );
@@ -156,7 +157,7 @@
         return fileFormat;
     }
 
-
+    @Override
     public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
         FileInputStream fis = new FileInputStream(file); // throws IOException
         BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize);
@@ -175,7 +176,7 @@
         return fileFormat;
     }
 
-
+    @Override
     public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
         SMFParser smfParser = new SMFParser();
         MidiFileFormat format = getMidiFileFormatFromStream(stream,
@@ -201,8 +202,7 @@
         return sequence;
     }
 
-
-
+    @Override
     public Sequence getSequence(URL url) throws InvalidMidiDataException, IOException {
         InputStream is = url.openStream();  // throws IOException
         is = new BufferedInputStream(is, bisBufferSize);
@@ -215,7 +215,7 @@
         return seq;
     }
 
-
+    @Override
     public Sequence getSequence(File file) throws InvalidMidiDataException, IOException {
         InputStream is = new FileInputStream(file); // throws IOException
         is = new BufferedInputStream(is, bisBufferSize);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileWriter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileWriter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -47,7 +47,6 @@
 import javax.sound.midi.Track;
 import javax.sound.midi.spi.MidiFileWriter;
 
-
 /**
  * MIDI file writer.
  *
@@ -72,20 +71,15 @@
     private static final int bufferSize = 16384;  // buffersize for write
     private DataOutputStream tddos;               // data output stream for track writing
 
-
-
     /**
-     * MIDI parser types
+     * MIDI parser types.
      */
     private static final int types[] = {
         MIDI_TYPE_0,
         MIDI_TYPE_1
     };
 
-
-    /**
-     * new
-     */
+    @Override
     public int[] getMidiFileTypes() {
         int[] localArray = new int[types.length];
         System.arraycopy(types, 0, localArray, 0, types.length);
@@ -100,6 +94,7 @@
      * @return array of file types.  If no file types are supported,
      * returns an array of length 0.
      */
+    @Override
     public int[] getMidiFileTypes(Sequence sequence){
         int typesArray[];
         Track tracks[] = sequence.getTracks();
@@ -116,6 +111,7 @@
         return typesArray;
     }
 
+    @Override
     public int write(Sequence in, int type, OutputStream out) throws IOException {
         Objects.requireNonNull(out);
         if (!isFileTypeSupported(type, in)) {
@@ -141,6 +137,7 @@
         return (int) bytesWritten;
     }
 
+    @Override
     public int write(Sequence in, int type, File out) throws IOException {
         Objects.requireNonNull(in);
         FileOutputStream fos = new FileOutputStream(out); // throws IOException
@@ -151,7 +148,6 @@
 
     //=================================================================================
 
-
     private InputStream getFileStream(int type, Sequence sequence) throws IOException {
         Track tracks[] = sequence.getTracks();
         int bytesBuilt = 0;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunCodec.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunCodec.java	Wed Jul 05 22:06:46 2017 +0200
@@ -55,16 +55,14 @@
         this.outputEncodings = outputEncodings;
     }
 
-
-    /**
-     */
+    @Override
     public final AudioFormat.Encoding[] getSourceEncodings() {
         AudioFormat.Encoding[] encodings = new AudioFormat.Encoding[inputEncodings.length];
         System.arraycopy(inputEncodings, 0, encodings, 0, inputEncodings.length);
         return encodings;
     }
-    /**
-     */
+
+    @Override
     public final AudioFormat.Encoding[] getTargetEncodings() {
         AudioFormat.Encoding[] encodings = new AudioFormat.Encoding[outputEncodings.length];
         System.arraycopy(outputEncodings, 0, encodings, 0, outputEncodings.length);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileWriter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileWriter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -39,17 +39,14 @@
  */
 abstract class SunFileWriter extends AudioFileWriter {
 
-
     // buffer size for write
     protected static final int bufferSize = 16384;
 
     // buffer size for temporary input streams
     protected static final int bisBufferSize = 4096;
 
-
     final AudioFileFormat.Type types[];
 
-
     /**
      * Constructs a new SunParser object.
      */
@@ -57,12 +54,9 @@
         this.types = types;
     }
 
-
-
     // METHODS TO IMPLEMENT AudioFileWriter
 
-    // new, 10.27.99
-
+    @Override
     public final AudioFileFormat.Type[] getAudioFileTypes(){
         AudioFileFormat.Type[] localArray = new AudioFileFormat.Type[types.length];
         System.arraycopy(types, 0, localArray, 0, types.length);
@@ -71,7 +65,6 @@
 
     // HELPER METHODS
 
-
     /**
      * rllong
      * Protected helper method to read 64 bits and changing the order of
@@ -213,6 +206,5 @@
         public boolean markSupported() {
             return in.markSupported();
         }
-
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/Toolkit.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/Toolkit.java	Wed Jul 05 22:06:46 2017 +0200
@@ -52,7 +52,6 @@
         }
     }
 
-
     /**
      * Swaps bytes.
      * @throws ArrayOutOfBoundsException if len is not a multiple of 2.
@@ -68,7 +67,6 @@
         }
     }
 
-
     /**
      * Linear to DB scale conversion.
      */
@@ -78,7 +76,6 @@
         return dB;
     }
 
-
     /**
      * DB to linear scale conversion.
      */
@@ -108,7 +105,6 @@
         return bytes - (bytes % blockSize);
     }
 
-
     /*
      * gets the number of bytes needed to play the specified number of milliseconds
      */
@@ -188,7 +184,6 @@
         }
     }
 
-
     static boolean isFullySpecifiedPCMFormat(AudioFormat format) {
         if (!format.getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED)
             && !format.getEncoding().equals(AudioFormat.Encoding.PCM_UNSIGNED)) {
@@ -204,7 +199,6 @@
         return true;
     }
 
-
     public static AudioInputStream getPCMConvertedAudioInputStream(AudioInputStream ais) {
         // we can't open the device for non-PCM playback, so we have
         // convert any other encodings to PCM here (at least we try!)
@@ -231,5 +225,4 @@
 
         return ais;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/UlawCodec.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/UlawCodec.java	Wed Jul 05 22:06:46 2017 +0200
@@ -33,7 +33,6 @@
 import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
 
-
 /**
  * U-law encodes linear data, and decodes u-law data to linear data.
  *
@@ -53,7 +52,7 @@
                                              0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF};
 
     /**
-     * Initializes the decode tables
+     * Initializes the decode tables.
      */
     static {
         for (int i=0;i<256;i++) {
@@ -70,7 +69,6 @@
         }
     }
 
-
     /**
      * Constructs a new ULAW codec object.
      */
@@ -78,8 +76,7 @@
         super(ulawEncodings, ulawEncodings);
     }
 
-    /**
-     */
+    @Override
     public AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat){
         if( AudioFormat.Encoding.PCM_SIGNED.equals(sourceFormat.getEncoding()) ) {
             if( sourceFormat.getSampleSizeInBits() == 16 ) {
@@ -102,9 +99,7 @@
         }
     }
 
-
-    /**
-     */
+    @Override
     public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){
         Objects.requireNonNull(targetEncoding);
         Objects.requireNonNull(sourceFormat);
@@ -119,8 +114,7 @@
             }
     }
 
-    /**
-     */
+    @Override
     public AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream){
         AudioFormat sourceFormat = sourceStream.getFormat();
         AudioFormat.Encoding sourceEncoding = sourceFormat.getEncoding();
@@ -157,9 +151,7 @@
         return getConvertedStream(targetFormat, sourceStream);
     }
 
-    /**
-     * use old code...
-     */
+    @Override
     public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream){
         if (!isConversionSupported(targetFormat, sourceStream.getFormat()))
             throw new IllegalArgumentException("Unsupported conversion: "
@@ -168,9 +160,6 @@
         return getConvertedStream(targetFormat, sourceStream);
     }
 
-
-    // OLD CODE
-
     /**
      * Opens the codec with the specified parameters.
      * @param stream stream from which data to be processed should be read
@@ -179,7 +168,6 @@
      * @throws IllegalArgumentException if the format combination supplied is
      * not supported.
      */
-    /*  public AudioInputStream getConvertedStream(AudioFormat outputFormat, AudioInputStream stream) { */
     private AudioInputStream getConvertedStream(AudioFormat outputFormat, AudioInputStream stream) {
         AudioInputStream cs = null;
 
@@ -188,7 +176,7 @@
         if( inputFormat.matches(outputFormat) ) {
             cs = stream;
         } else {
-            cs = (AudioInputStream) (new UlawCodecStream(stream, outputFormat));
+            cs = new UlawCodecStream(stream, outputFormat);
         }
         return cs;
     }
@@ -200,7 +188,6 @@
      * returns an array of length 0.
      * @return array of supported output formats.
      */
-    /*  public AudioFormat[] getOutputFormats(AudioFormat inputFormat) { */
     private AudioFormat[] getOutputFormats(AudioFormat inputFormat) {
 
         Vector<AudioFormat> formats = new Vector<>();
@@ -241,14 +228,13 @@
         return formatArray;
     }
 
-
     private final class UlawCodecStream extends AudioInputStream {
 
         private static final int tempBufferSize = 64;
         private byte tempBuffer [] = null;
 
         /**
-         * True to encode to u-law, false to decode to linear
+         * True to encode to u-law, false to decode to linear.
          */
         boolean encode = false;
 
@@ -312,7 +298,6 @@
             }
         }
 
-
         /*
          * $$jb 2/23/99
          * Used to determine segment number in uLaw encoding
@@ -328,6 +313,7 @@
          * Note that this won't actually read anything; must read in
          * two-byte units.
          */
+        @Override
         public int read() throws IOException {
             byte[] b = new byte[1];
             if (read(b, 0, b.length) == 1) {
@@ -336,10 +322,12 @@
             return -1;
         }
 
+        @Override
         public int read(byte[] b) throws IOException {
             return read(b, 0, b.length);
         }
 
+        @Override
         public int read(byte[] b, int off, int len) throws IOException {
             // don't read fractional frames
             if( len%frameSize != 0 ) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java	Wed Jul 05 22:06:46 2017 +0200
@@ -43,7 +43,7 @@
  */
 public final class WaveExtensibleFileReader extends SunFileReader {
 
-    private static class GUID {
+    private static final class GUID {
         private long i1;
         private int s1;
         private int s2;
@@ -222,7 +222,7 @@
         if (!fmt_found || !data_found) {
             throw new UnsupportedAudioFileException();
         }
-        Map<String, Object> p = new HashMap<String, Object>();
+        Map<String, Object> p = new HashMap<>();
         String s_channelmask = decodeChannelMask(channelMask);
         if (s_channelmask != null)
             p.put("channelOrder", s_channelmask);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileFormat.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileFormat.java	Wed Jul 05 22:06:46 2017 +0200
@@ -46,7 +46,7 @@
 
     //$$fb 2002-04-16: Fix for 4636355: RIFF audio headers could be _more_ spec compliant
     /**
-     * fmt_ chunk size in bytes
+     * fmt_ chunk size in bytes.
      */
     private static final int STANDARD_FMT_CHUNK_SIZE = 16;
 
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileWriter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileWriter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -80,7 +80,6 @@
         return new AudioFileFormat.Type[0];
     }
 
-
     @Override
     public int write(AudioInputStream stream, AudioFileFormat.Type fileType, OutputStream out) throws IOException {
         Objects.requireNonNull(stream);
@@ -104,7 +103,6 @@
         return writeWaveFile(stream, waveFileFormat, out);
     }
 
-
     @Override
     public int write(AudioInputStream stream, AudioFileFormat.Type fileType, File out) throws IOException {
         Objects.requireNonNull(stream);
@@ -257,7 +255,7 @@
         int sampleRate         = (int) audioFormat.getSampleRate();
         int frameSizeInBytes   = audioFormat.getFrameSize();
         int frameRate              = (int) audioFormat.getFrameRate();
-        int avgBytesPerSec     = channels * sampleSizeInBits * sampleRate / 8;;
+        int avgBytesPerSec     = channels * sampleSizeInBits * sampleRate / 8;
         short blockAlign       = (short) ((sampleSizeInBits / 8) * channels);
         int dataMagic              = WaveFileFormat.DATA_MAGIC;
         int dataLength             = waveFileFormat.getFrameLength() * frameSizeInBytes;
@@ -347,6 +345,6 @@
         waveStream = new SequenceInputStream(headerStream,
                             new NoCloseInputStream(codedAudioStream));
 
-        return (InputStream)waveStream;
+        return waveStream;
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFloatFileWriter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFloatFileWriter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -89,7 +89,7 @@
         data_chunk.close();
     }
 
-    private static class NoCloseOutputStream extends OutputStream {
+    private static final class NoCloseOutputStream extends OutputStream {
         final OutputStream out;
 
         NoCloseOutputStream(OutputStream out) {
--- a/jdk/src/java.desktop/share/classes/java/awt/Container.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/Container.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1109,17 +1109,18 @@
             }
             checkAddToSelf(comp);
             checkNotAWindow(comp);
+            /* Reparent the component and tidy up the tree's state. */
+            if (comp.parent != null) {
+                comp.parent.remove(comp);
+                if (index > component.size()) {
+                    throw new IllegalArgumentException("illegal component position");
+                }
+            }
             if (thisGC != null) {
                 comp.checkGD(thisGC.getDevice().getIDstring());
             }
 
-            /* Reparent the component and tidy up the tree's state. */
-            if (comp.parent != null) {
-                comp.parent.remove(comp);
-                    if (index > component.size()) {
-                        throw new IllegalArgumentException("illegal component position");
-                    }
-            }
+
 
             //index == -1 means add to the end.
             if (index == -1) {
--- a/jdk/src/java.desktop/share/classes/java/awt/TrayIcon.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/TrayIcon.java	Wed Jul 05 22:06:46 2017 +0200
@@ -703,6 +703,9 @@
         synchronized (this) {
             p = peer;
             peer = null;
+            if (popup != null) {
+                popup.removeNotify();
+            }
         }
         if (p != null) {
             p.dispose();
--- a/jdk/src/java.desktop/share/classes/java/beans/MethodRef.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/java/beans/MethodRef.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -64,10 +64,9 @@
                 this.signature = null;
                 this.methodRef = null;
                 this.typeRef = null;
+                return null;
             }
-            else {
-                this.methodRef = new SoftReference<>(method);
-            }
+            this.methodRef = new SoftReference<>(method);
         }
         return isPackageAccessible(method.getDeclaringClass()) ? method : null;
     }
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java	Wed Jul 05 22:06:46 2017 +0200
@@ -204,44 +204,6 @@
     }
 
     /**
-     * Converts a {@code TIFFDirectory} to a {@code TIFFIFD}.
-     */
-    private static TIFFIFD getDirectoryAsIFD(TIFFDirectory dir) {
-        if(dir instanceof TIFFIFD) {
-            return (TIFFIFD)dir;
-        }
-
-        TIFFIFD ifd = new TIFFIFD(Arrays.asList(dir.getTagSets()),
-                                  dir.getParentTag());
-        TIFFField[] fields = dir.getTIFFFields();
-        int numFields = fields.length;
-        for(int i = 0; i < numFields; i++) {
-            TIFFField f = fields[i];
-            TIFFTag tag = f.getTag();
-            if(tag.isIFDPointer()) {
-                TIFFDirectory subDir = null;
-                if (f.hasDirectory()) {
-                    subDir = f.getDirectory();
-                } else if (f.getData() instanceof TIFFDirectory) {
-                    subDir = (TIFFDirectory)f.getData();
-                }
-                if (subDir != null) {
-                    TIFFDirectory subIFD = getDirectoryAsIFD(subDir);
-                    f = new TIFFField(tag, f.getType(), (long)f.getCount(),
-                                      subIFD);
-                } else {
-                    f = null;
-                }
-            }
-            if (f != null) {
-                ifd.addTIFFField(f);
-            }
-        }
-
-        return ifd;
-    }
-
-    /**
      * Constructs a {@code TIFFDirectory} which is aware of a given
      * group of {@link TIFFTagSet}s. An optional parent {@link TIFFTag}
      * may also be specified.
@@ -459,7 +421,7 @@
      * {@code TIFFDirectory}.
      */
     public IIOMetadata getAsMetadata() {
-        return new TIFFImageMetadata(getDirectoryAsIFD(this));
+        return new TIFFImageMetadata(TIFFIFD.getDirectoryAsIFD(this));
     }
 
     /**
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java	Wed Jul 05 22:06:46 2017 +0200
@@ -195,6 +195,7 @@
      *
      * @return a clone of this instance
      */
+    @Override
     public Object clone() {
         byte[] newData = new byte[length];
         System.arraycopy(data, 0, newData, 0, newData.length);
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDevice.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDevice.java	Wed Jul 05 22:06:46 2017 +0200
@@ -134,6 +134,7 @@
      * @see #open
      * @see #isOpen
      */
+    @Override
     void close();
 
     /**
@@ -252,22 +253,22 @@
         /**
          * The device's name.
          */
-        private String name;
+        private final String name;
 
         /**
          * The name of the company who provides the device.
          */
-        private String vendor;
+        private final String vendor;
 
         /**
          * A description of the device.
          */
-        private String description;
+        private final String description;
 
         /**
          * Device version.
          */
-        private String version;
+        private final String version;
 
         /**
          * Constructs a device info object.
@@ -294,6 +295,7 @@
          * @return {@code true} if this object is the same as the {@code obj}
          *         argument; {@code false} otherwise
          */
+        @Override
         public final boolean equals(Object obj) {
             return super.equals(obj);
         }
@@ -301,6 +303,7 @@
         /**
          * Finalizes the hashcode method.
          */
+        @Override
         public final int hashCode() {
             return super.hashCode();
         }
@@ -346,6 +349,7 @@
          *
          * @return a description of the info object
          */
+        @Override
         public final String toString() {
             return name;
         }
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiFileFormat.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiFileFormat.java	Wed Jul 05 22:06:46 2017 +0200
@@ -180,7 +180,7 @@
                           int resolution, int bytes,
                           long microseconds, Map<String, Object> properties) {
         this(type, divisionType, resolution, bytes, microseconds);
-        this.properties = new HashMap<String, Object>(properties);
+        this.properties = new HashMap<>(properties);
     }
 
     /**
@@ -257,7 +257,7 @@
     public Map<String,Object> properties() {
         Map<String,Object> ret;
         if (properties == null) {
-            ret = new HashMap<String,Object>(0);
+            ret = new HashMap<>(0);
         } else {
             ret = (Map<String,Object>) (properties.clone());
         }
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java	Wed Jul 05 22:06:46 2017 +0200
@@ -177,5 +177,6 @@
      *
      * @return a clone of this instance
      */
+    @Override
     public abstract Object clone();
 }
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Receiver.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Receiver.java	Wed Jul 05 22:06:46 2017 +0200
@@ -66,5 +66,6 @@
      *
      * @see javax.sound.midi.MidiSystem#getReceiver
      */
+    @Override
     void close();
 }
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequence.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequence.java	Wed Jul 05 22:06:46 2017 +0200
@@ -118,7 +118,7 @@
      *
      * @see #getTracks
      */
-    protected Vector<Track> tracks = new Vector<Track>();
+    protected Vector<Track> tracks = new Vector<>();
 
     /**
      * Constructs a new MIDI sequence with the specified timing division type
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -324,6 +324,7 @@
      * @return the current position in microseconds
      * @see #setMicrosecondPosition
      */
+    @Override
     long getMicrosecondPosition();
 
     /**
@@ -680,7 +681,7 @@
         /**
          * Synchronization mode name.
          */
-        private String name;
+        private final String name;
 
         /**
          * Constructs a synchronization mode.
@@ -700,6 +701,7 @@
          * @return {@code true} if this object is the same as the {@code obj}
          *         argument, {@code false} otherwise
          */
+        @Override
         public final boolean equals(Object obj) {
 
             return super.equals(obj);
@@ -708,6 +710,7 @@
         /**
          * Finalizes the hashcode method.
          */
+        @Override
         public final int hashCode() {
 
             return super.hashCode();
@@ -719,6 +722,7 @@
          *
          * @return the name of this synchronization mode
          */
+        @Override
         public final String toString() {
 
             return name;
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java	Wed Jul 05 22:06:46 2017 +0200
@@ -429,6 +429,7 @@
      *
      * @return a clone of this instance
      */
+    @Override
     public Object clone() {
         byte[] newData = new byte[length];
         System.arraycopy(data, 0, newData, 0, newData.length);
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java	Wed Jul 05 22:06:46 2017 +0200
@@ -179,6 +179,7 @@
      * @param  length the length of the valid message data in the array,
      *         including the status byte
      */
+    @Override
     public void setMessage(byte[] data, int length) throws InvalidMidiDataException {
         int status = (data[0] & 0xFF);
         if ((status != 0xF0) && (status != 0xF7)) {
@@ -233,6 +234,7 @@
      *
      * @return a clone of this instance
      */
+    @Override
     public Object clone() {
         byte[] newData = new byte[length];
         System.arraycopy(data, 0, newData, 0, newData.length);
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Track.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Track.java	Wed Jul 05 22:06:46 2017 +0200
@@ -65,12 +65,12 @@
     // TODO: use arrays for faster access
 
     // the list containing the events
-    private ArrayList<MidiEvent> eventsList = new ArrayList<>();
+    private final ArrayList<MidiEvent> eventsList = new ArrayList<>();
 
     // use a hashset to detect duplicate events in add(MidiEvent)
-    private HashSet<MidiEvent> set = new HashSet<>();
+    private final HashSet<MidiEvent> set = new HashSet<>();
 
-    private MidiEvent eotEvent;
+    private final MidiEvent eotEvent;
 
     /**
      * Package-private constructor. Constructs a new, empty Track object, which
@@ -264,6 +264,7 @@
             data[2] = 0;
         }
 
+        @Override
         public void setMessage(int type, byte[] data, int length) throws InvalidMidiDataException {
             throw new InvalidMidiDataException("cannot modify end of track message");
         }
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Transmitter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Transmitter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -69,5 +69,6 @@
      *
      * @see javax.sound.midi.MidiSystem#getTransmitter
      */
+    @Override
     void close();
 }
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFileFormat.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFileFormat.java	Wed Jul 05 22:06:46 2017 +0200
@@ -100,22 +100,22 @@
     /**
      * File type.
      */
-    private Type type;
+    private final Type type;
 
     /**
      * File length in bytes.
      */
-    private int byteLength;
+    private final int byteLength;
 
     /**
      * Format of the audio data contained in the file.
      */
-    private AudioFormat format;
+    private final AudioFormat format;
 
     /**
      * Audio data length in sample frames.
      */
-    private int frameLength;
+    private final int frameLength;
 
     /**
      * The set of properties.
@@ -176,7 +176,7 @@
     public AudioFileFormat(Type type, AudioFormat format,
                            int frameLength, Map<String, Object> properties) {
         this(type,AudioSystem.NOT_SPECIFIED,format,frameLength);
-        this.properties = new HashMap<String, Object>(properties);
+        this.properties = new HashMap<>(properties);
     }
 
     /**
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFormat.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFormat.java	Wed Jul 05 22:06:46 2017 +0200
@@ -223,7 +223,7 @@
                        boolean bigEndian, Map<String, Object> properties) {
         this(encoding, sampleRate, sampleSizeInBits, channels,
              frameSize, frameRate, bigEndian);
-        this.properties = new HashMap<String, Object>(properties);
+        this.properties = new HashMap<>(properties);
     }
 
     /**
@@ -592,7 +592,7 @@
         /**
          * Encoding name.
          */
-        private String name;
+        private final String name;
 
         /**
          * Constructs a new encoding.
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioInputStream.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioInputStream.java	Wed Jul 05 22:06:46 2017 +0200
@@ -60,7 +60,7 @@
      * The {@code InputStream} from which this {@code AudioInputStream} object
      * was constructed.
      */
-    private InputStream stream;
+    private final InputStream stream;
 
     /**
      * The format of the audio data contained in the stream.
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/CompoundControl.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/CompoundControl.java	Wed Jul 05 22:06:46 2017 +0200
@@ -38,7 +38,7 @@
     /**
      * The set of member controls.
      */
-    private Control[] controls;
+    private final Control[] controls;
 
     /**
      * Constructs a new compound control object with the given parameters.
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/Control.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/Control.java	Wed Jul 05 22:06:46 2017 +0200
@@ -84,7 +84,7 @@
         /**
          * Type name.
          */
-        private String name;
+        private final String name;
 
         /**
          * Constructs a new control type with the name specified. The name
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/EnumControl.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/EnumControl.java	Wed Jul 05 22:06:46 2017 +0200
@@ -53,7 +53,7 @@
     /**
      * The set of possible values.
      */
-    private Object[] values;
+    private final Object[] values;
 
     /**
      * The current value.
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java	Wed Jul 05 22:06:46 2017 +0200
@@ -54,23 +54,23 @@
     /**
      * The minimum supported value.
      */
-    private float minimum;
+    private final float minimum;
 
     /**
      * The maximum supported value.
      */
-    private float maximum;
+    private final float maximum;
 
     /**
      * The control's precision.
      */
-    private float precision;
+    private final float precision;
 
     /**
      * The smallest time increment in which a value change can be effected
      * during a value shift, in microseconds.
      */
-    private int updatePeriod;
+    private final int updatePeriod;
 
     /**
      * A label for the units in which the control values are expressed, such as
@@ -334,6 +334,7 @@
      *
      * @return a string description
      */
+    @Override
     public String toString() {
         return new String(getType() + " with current value: " + getValue() + " " + units +
                           " (range: " + minimum + " - " + maximum + ")");
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java	Wed Jul 05 22:06:46 2017 +0200
@@ -169,8 +169,7 @@
         /**
          * Type name.
          */
-        // $$kk: 03.25.99: why can't this be final??
-        private /*final*/ String name;
+        private final String name;
 
         /**
          * Constructs a new event type.
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/Port.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/Port.java	Wed Jul 05 22:06:46 2017 +0200
@@ -56,10 +56,8 @@
      */
     class Info extends Line.Info {
 
-
         // AUDIO PORT TYPE DEFINES
 
-
         // SOURCE PORTS
 
         /**
@@ -78,7 +76,6 @@
          */
         public static final Info COMPACT_DISC = new Info(Port.class,"COMPACT_DISC", true);
 
-
         // TARGET PORTS
 
         /**
@@ -97,18 +94,14 @@
          */
         public static final Info LINE_OUT = new Info(Port.class,"LINE_OUT", false);
 
-
         // FUTURE DIRECTIONS...
 
         // telephone
         // DAT
         // DVD
 
-
-        // INSTANCE VARIABLES
-
-        private String name;
-        private boolean isSource;
+        private final String name;
+        private final boolean isSource;
 
         /**
          * Constructs a port's info object from the information given. This
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/ReverbType.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/ReverbType.java	Wed Jul 05 22:06:46 2017 +0200
@@ -139,32 +139,32 @@
     /**
      * Descriptive name of the reverb type.
      */
-    private String name;
+    private final String name;
 
     /**
      * Early reflection delay in microseconds.
      */
-    private int earlyReflectionDelay;
+    private final int earlyReflectionDelay;
 
     /**
      * Early reflection intensity.
      */
-    private float earlyReflectionIntensity;
+    private final float earlyReflectionIntensity;
 
     /**
      * Late reflection delay in microseconds.
      */
-    private int lateReflectionDelay;
+    private final int lateReflectionDelay;
 
     /**
      * Late reflection intensity.
      */
-    private float lateReflectionIntensity;
+    private final float lateReflectionIntensity;
 
     /**
      * Total decay time.
      */
-    private int decayTime;
+    private final int decayTime;
 
     /**
      * Constructs a new reverb type that has the specified reverberation
--- a/jdk/src/java.desktop/share/classes/javax/swing/DefaultRowSorter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/DefaultRowSorter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -81,11 +81,6 @@
  * sort order is unsorted (the same as the model), and columns are
  * sortable by default.
  * <p>
- * If the underlying model structure changes (the
- * <code>modelStructureChanged</code> method is invoked) the following
- * are reset to their default values: <code>Comparator</code>s by column,
- * current sort order and whether a column is sortable.
- * <p>
  * <code>DefaultRowSorter</code> is an abstract class.  Concrete
  * subclasses must provide access to the underlying data by invoking
  * {@code setModelWrapper}. The {@code setModelWrapper} method
--- a/jdk/src/java.desktop/share/classes/javax/swing/JList.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JList.java	Wed Jul 05 22:06:46 2017 +0200
@@ -3058,7 +3058,7 @@
         public Accessible getAccessibleAt(Point p) {
             int i = locationToIndex(p);
             if (i >= 0) {
-                return new ActionableAccessibleJListChild(JList.this, i);
+                return new AccessibleJListChild(JList.this, i);
             } else {
                 return null;
             }
@@ -3085,7 +3085,7 @@
             if (i >= getModel().getSize()) {
                 return null;
             } else {
-                return new ActionableAccessibleJListChild(JList.this, i);
+                return new AccessibleJListChild(JList.this, i);
             }
         }
 
@@ -3188,7 +3188,7 @@
            * for list children.
            */
         protected class AccessibleJListChild extends AccessibleContext
-                implements Accessible, AccessibleComponent {
+                implements Accessible, AccessibleComponent, AccessibleAction {
             private JList<E>     parent = null;
             int indexInParent;
             private Component component = null;
@@ -3743,16 +3743,17 @@
                 }
             }
 
-        } // inner class AccessibleJListChild
-
-        private class ActionableAccessibleJListChild
-            extends AccessibleJListChild
-            implements AccessibleAction {
-
-            ActionableAccessibleJListChild(JList<E> parent, int indexInParent) {
-                super(parent, indexInParent);
-            }
-
+            /**
+             * {@inheritDoc}
+             * @implSpec Returns the AccessibleAction for this AccessibleJListChild
+             * as follows:  First getListCellRendererComponent of the ListCellRenderer
+             * for the component at the "index in parent" of this child is called.
+             * Then its AccessibleContext is fetched and that AccessibleContext's
+             * AccessibleAction is returned.  Note that if an AccessibleAction
+             * is not found using this process then this object with its implementation
+             * of the AccessibleAction interface is returned.
+             * @since 9
+             */
             @Override
             public AccessibleAction getAccessibleAction() {
                 AccessibleContext ac = getCurrentAccessibleContext();
@@ -3768,6 +3769,13 @@
                 }
             }
 
+            /**
+             * {@inheritDoc}
+             * @implSpec If i == 0 selects this AccessibleJListChild by calling
+             * JList.this.setSelectedIndex(indexInParent) and then returns true;
+             * otherwise returns false.
+             * @since 9
+             */
             @Override
             public boolean doAccessibleAction(int i) {
                 if (i == 0) {
@@ -3778,6 +3786,13 @@
                 }
             }
 
+            /**
+             * {@inheritDoc}
+             * @implSpec If i == 0 returns the action description fetched from
+             * UIManager.getString("AbstractButton.clickText");
+             * otherwise returns null.
+             * @since 9
+             */
             @Override
             public String getAccessibleActionDescription(int i) {
                 if (i == 0) {
@@ -3787,12 +3802,17 @@
                 }
             }
 
+            /**
+             * {@inheritDoc}
+             * @implSpec Returns 1, i.e. there is only one action.
+             * @since 9
+             */
             @Override
             public int getAccessibleActionCount() {
                 return 1;
             }
 
-        } // inner class ActionableAccessibleJListChild
+        } // inner class AccessibleJListChild
 
     } // inner class AccessibleJList
 }
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalComboBoxIcon.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalComboBoxIcon.java	Wed Jul 05 22:06:46 2017 +0200
@@ -52,13 +52,11 @@
 
         g.translate( x, y );
 
-        g.setColor( component.isEnabled() ? MetalLookAndFeel.getControlInfo() : MetalLookAndFeel.getControlShadow() );
-        g.drawLine( 0, 0, iconWidth - 1, 0 );
-        g.drawLine( 1, 1, 1 + (iconWidth - 3), 1 );
-        g.drawLine( 2, 2, 2 + (iconWidth - 5), 2 );
-        g.drawLine( 3, 3, 3 + (iconWidth - 7), 3 );
-        g.drawLine( 4, 4, 4 + (iconWidth - 9), 4 );
-
+        g.setColor(component.isEnabled()
+                   ? MetalLookAndFeel.getControlInfo()
+                   : MetalLookAndFeel.getControlShadow());
+        g.fillPolygon(new int[]{0, 5, iconWidth - 5, iconWidth},
+                      new int[]{0, 5, 5, 0}, 4);
         g.translate( -x, -y );
     }
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalIconFactory.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalIconFactory.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1289,11 +1289,7 @@
                 else {
                     g.setColor(MetalLookAndFeel.getControl());
                 }
-                g.fillRect(2, 2, 8, 8);
-                g.fillRect(4, 1, 4, 1);
-                g.fillRect(4, 10, 4, 1);
-                g.fillRect(1, 4, 1, 4);
-                g.fillRect(10, 4, 1, 4);
+                g.fillOval(1, 1, 9, 9);
             }
 
             // draw Dark Circle (start at top, go clockwise)
@@ -1303,35 +1299,14 @@
             else {
                 g.setColor(MetalLookAndFeel.getControlDarkShadow());
             }
-            g.drawLine( 4, 0,  7, 0);
-            g.drawLine( 8, 1,  9, 1);
-            g.drawLine(10, 2, 10, 3);
-            g.drawLine(11, 4, 11, 7);
-            g.drawLine(10, 8, 10, 9);
-            g.drawLine( 9,10,  8,10);
-            g.drawLine( 7,11,  4,11);
-            g.drawLine( 3,10,  2,10);
-            g.drawLine( 1, 9,  1, 8);
-            g.drawLine( 0, 7,  0, 4);
-            g.drawLine( 1, 3,  1, 2);
-            g.drawLine( 2, 1,  3, 1);
+            g.drawOval(0, 0, 11, 11);
 
             if (pressed) {
-                g.fillRect(1, 4, 1, 4);
-                g.fillRect(2, 2, 1, 2);
-                g.fillRect(3, 2, 1, 1);
-                g.fillRect(4, 1, 4, 1);
+                g.drawArc(1, 1, 10, 10, 60, 160);
             }
             else if (rollover) {
                 g.setColor(MetalLookAndFeel.getPrimaryControl());
-                g.fillRect(4, 1, 4, 2);
-                g.fillRect(8, 2, 2, 2);
-                g.fillRect(9, 4, 2, 4);
-                g.fillRect(8, 8, 2, 2);
-                g.fillRect(4, 9, 4, 2);
-                g.fillRect(2, 8, 2, 2);
-                g.fillRect(1, 4, 2, 4);
-                g.fillRect(2, 2, 2, 2);
+                g.drawOval(2, 2, 7, 7);
             }
 
             // selected dot
@@ -1341,11 +1316,7 @@
                 } else {
                     g.setColor(MetalLookAndFeel.getControlDarkShadow());
                 }
-                g.fillRect( 4, 4,  4, 4);
-                g.drawLine( 4, 3,  7, 3);
-                g.drawLine( 8, 4,  8, 7);
-                g.drawLine( 7, 8,  4, 8);
-                g.drawLine( 3, 7,  3, 4);
+                g.fillOval(2, 2, 7, 7);
             }
 
             g.translate(-x, -y);
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalScrollButton.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalScrollButton.java	Wed Jul 05 22:06:46 2017 +0200
@@ -128,9 +128,10 @@
                 int startY = ((h+1) - arrowHeight) / 2;
                 int startX = (w / 2);
 
-                for (int line = 0; line < arrowHeight; line++) {
-                    g.drawLine( startX-line, startY+line, startX +line+1, startY+line);
-                }
+                g.translate(startX, startY);
+                g.fillPolygon(new int[]{0, 1, arrowHeight + 1, -arrowHeight},
+                              new int[]{0, 0, arrowHeight, arrowHeight}, 4);
+                g.translate(-startX, -startY);
 
                 if (isEnabled) {
                     g.setColor( highlightColor );
@@ -174,10 +175,10 @@
 
                 int startY = (((h+1) - arrowHeight) / 2)+ arrowHeight-1;
                 int startX = (w / 2);
-
-                for (int line = 0; line < arrowHeight; line++) {
-                    g.drawLine( startX-line, startY-line, startX +line+1, startY-line);
-                }
+                g.translate(startX, startY);
+                g.fillPolygon(new int[]{0, 1, arrowHeight + 1, -arrowHeight},
+                              new int[]{0, 0, -arrowHeight, -arrowHeight}, 4);
+                g.translate(-startX, -startY);
 
                 if (isEnabled) {
                     g.setColor( highlightColor );
@@ -220,9 +221,10 @@
                 int startX = (((w+1) - arrowHeight) / 2) + arrowHeight-1;
                 int startY = (h / 2);
 
-                for (int line = 0; line < arrowHeight; line++) {
-                    g.drawLine( startX-line, startY-line, startX -line, startY+line+1);
-                }
+                g.translate(startX, startY);
+                g.fillPolygon(new int[]{0, 0, -arrowHeight, -arrowHeight},
+                              new int[]{0, 1, arrowHeight + 1, -arrowHeight}, 4);
+                g.translate(-startX, -startY);
 
                 if (isEnabled) {
                     g.setColor( highlightColor );
@@ -262,10 +264,10 @@
                 int startX = (((w+1) - arrowHeight) / 2);
                 int startY = (h / 2);
 
-
-                for (int line = 0; line < arrowHeight; line++) {
-                    g.drawLine( startX+line, startY-line, startX +line, startY+line+1);
-                }
+                g.translate(startX, startY);
+                g.fillPolygon(new int[]{0, 0, arrowHeight, arrowHeight},
+                              new int[]{0, 1, arrowHeight + 1, -arrowHeight}, 4);
+                g.translate(-startX, -startY);
 
                 if (isEnabled) {
                     g.setColor( highlightColor );
--- a/jdk/src/java.desktop/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -24,9 +24,9 @@
  */
 
 /**
-  * java.desktop defines and exports the user interface, graphics
-  * and imaging APIs of the Java SE platform.
-  */
+ * Defines the AWT and Swing user interface toolkits, plus APIs for
+ * accessibility, audio, imaging, printing, and JavaBeans.
+ */
 module java.desktop {
     requires public java.datatransfer;
     requires public java.xml;
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/ArrayCache.java	Thu Aug 18 21:34:24 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,232 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.
- */
-
-package sun.java2d.marlin;
-
-import java.util.Arrays;
-import static sun.java2d.marlin.MarlinUtils.logInfo;
-
-public final class ArrayCache implements MarlinConst {
-
-    static final int BUCKETS = 4;
-    static final int MIN_ARRAY_SIZE = 4096;
-    static final int MAX_ARRAY_SIZE;
-    static final int MASK_CLR_1 = ~1;
-    // threshold to grow arrays only by (3/2) instead of 2
-    static final int THRESHOLD_ARRAY_SIZE;
-    static final int[] ARRAY_SIZES = new int[BUCKETS];
-    // dirty byte array sizes
-    static final int MIN_DIRTY_BYTE_ARRAY_SIZE = 32 * 2048; // 32px x 2048px
-    static final int MAX_DIRTY_BYTE_ARRAY_SIZE;
-    static final int[] DIRTY_BYTE_ARRAY_SIZES = new int[BUCKETS];
-    // large array thresholds:
-    static final long THRESHOLD_LARGE_ARRAY_SIZE;
-    static final long THRESHOLD_HUGE_ARRAY_SIZE;
-    // stats
-    private static int resizeInt = 0;
-    private static int resizeDirtyInt = 0;
-    private static int resizeDirtyFloat = 0;
-    private static int resizeDirtyByte = 0;
-    private static int oversize = 0;
-
-    static {
-        // initialize buckets for int/float arrays
-        int arraySize = MIN_ARRAY_SIZE;
-
-        for (int i = 0; i < BUCKETS; i++, arraySize <<= 2) {
-            ARRAY_SIZES[i] = arraySize;
-
-            if (DO_TRACE) {
-                logInfo("arraySize[" + i + "]: " + arraySize);
-            }
-        }
-        MAX_ARRAY_SIZE = arraySize >> 2;
-
-        /* initialize buckets for dirty byte arrays
-         (large AA chunk = 32 x 2048 pixels) */
-        arraySize = MIN_DIRTY_BYTE_ARRAY_SIZE;
-
-        for (int i = 0; i < BUCKETS; i++, arraySize <<= 1) {
-            DIRTY_BYTE_ARRAY_SIZES[i] = arraySize;
-
-            if (DO_TRACE) {
-                logInfo("dirty arraySize[" + i + "]: " + arraySize);
-            }
-        }
-        MAX_DIRTY_BYTE_ARRAY_SIZE = arraySize >> 1;
-
-        // threshold to grow arrays only by (3/2) instead of 2
-        THRESHOLD_ARRAY_SIZE = Math.max(2 * 1024 * 1024, MAX_ARRAY_SIZE); // 2M
-
-        THRESHOLD_LARGE_ARRAY_SIZE = 8L * THRESHOLD_ARRAY_SIZE; // 16M
-        THRESHOLD_HUGE_ARRAY_SIZE  = 8L * THRESHOLD_LARGE_ARRAY_SIZE; // 128M
-
-        if (DO_STATS || DO_MONITORS) {
-            logInfo("ArrayCache.BUCKETS        = " + BUCKETS);
-            logInfo("ArrayCache.MIN_ARRAY_SIZE = " + MIN_ARRAY_SIZE);
-            logInfo("ArrayCache.MAX_ARRAY_SIZE = " + MAX_ARRAY_SIZE);
-            logInfo("ArrayCache.ARRAY_SIZES = "
-                    + Arrays.toString(ARRAY_SIZES));
-            logInfo("ArrayCache.MIN_DIRTY_BYTE_ARRAY_SIZE = "
-                    + MIN_DIRTY_BYTE_ARRAY_SIZE);
-            logInfo("ArrayCache.MAX_DIRTY_BYTE_ARRAY_SIZE = "
-                    + MAX_DIRTY_BYTE_ARRAY_SIZE);
-            logInfo("ArrayCache.ARRAY_SIZES = "
-                    + Arrays.toString(DIRTY_BYTE_ARRAY_SIZES));
-            logInfo("ArrayCache.THRESHOLD_ARRAY_SIZE = "
-                    + THRESHOLD_ARRAY_SIZE);
-            logInfo("ArrayCache.THRESHOLD_LARGE_ARRAY_SIZE = "
-                    + THRESHOLD_LARGE_ARRAY_SIZE);
-            logInfo("ArrayCache.THRESHOLD_HUGE_ARRAY_SIZE = "
-                    + THRESHOLD_HUGE_ARRAY_SIZE);
-        }
-    }
-
-    private ArrayCache() {
-        // Utility class
-    }
-
-    static synchronized void incResizeInt() {
-        resizeInt++;
-    }
-
-    static synchronized void incResizeDirtyInt() {
-        resizeDirtyInt++;
-    }
-
-    static synchronized void incResizeDirtyFloat() {
-        resizeDirtyFloat++;
-    }
-
-    static synchronized void incResizeDirtyByte() {
-        resizeDirtyByte++;
-    }
-
-    static synchronized void incOversize() {
-        oversize++;
-    }
-
-    static void dumpStats() {
-        if (resizeInt != 0 || resizeDirtyInt != 0 || resizeDirtyFloat != 0
-                || resizeDirtyByte != 0 || oversize != 0) {
-            logInfo("ArrayCache: int resize: " + resizeInt
-                    + " - dirty int resize: " + resizeDirtyInt
-                    + " - dirty float resize: " + resizeDirtyFloat
-                    + " - dirty byte resize: " + resizeDirtyByte
-                    + " - oversize: " + oversize);
-        }
-    }
-
-    // small methods used a lot (to be inlined / optimized by hotspot)
-
-    static int getBucket(final int length) {
-        for (int i = 0; i < ARRAY_SIZES.length; i++) {
-            if (length <= ARRAY_SIZES[i]) {
-                return i;
-            }
-        }
-        return -1;
-    }
-
-    static int getBucketDirtyBytes(final int length) {
-        for (int i = 0; i < DIRTY_BYTE_ARRAY_SIZES.length; i++) {
-            if (length <= DIRTY_BYTE_ARRAY_SIZES[i]) {
-                return i;
-            }
-        }
-        return -1;
-    }
-
-    /**
-     * Return the new array size (~ x2)
-     * @param curSize current used size
-     * @param needSize needed size
-     * @return new array size
-     */
-    public static int getNewSize(final int curSize, final int needSize) {
-        // check if needSize is negative or integer overflow:
-        if (needSize < 0) {
-            // hard overflow failure - we can't even accommodate
-            // new items without overflowing
-            throw new ArrayIndexOutOfBoundsException(
-                          "array exceeds maximum capacity !");
-        }
-        assert curSize >= 0;
-        final int initial = (curSize & MASK_CLR_1);
-        int size;
-        if (initial > THRESHOLD_ARRAY_SIZE) {
-            size = initial + (initial >> 1); // x(3/2)
-        } else {
-            size = (initial << 1); // x2
-        }
-        // ensure the new size is >= needed size:
-        if (size < needSize) {
-            // align to 4096 (may overflow):
-            size = ((needSize >> 12) + 1) << 12;
-        }
-        // check integer overflow:
-        if (size < 0) {
-            // resize to maximum capacity:
-            size = Integer.MAX_VALUE;
-        }
-        return size;
-    }
-
-    /**
-     * Return the new array size (~ x2)
-     * @param curSize current used size
-     * @param needSize needed size
-     * @return new array size
-     */
-    public static long getNewLargeSize(final long curSize, final long needSize) {
-        // check if needSize is negative or integer overflow:
-        if ((needSize >> 31L) != 0L) {
-            // hard overflow failure - we can't even accommodate
-            // new items without overflowing
-            throw new ArrayIndexOutOfBoundsException(
-                          "array exceeds maximum capacity !");
-        }
-        assert curSize >= 0L;
-        long size;
-        if (curSize > THRESHOLD_HUGE_ARRAY_SIZE) {
-            size = curSize + (curSize >> 2L); // x(5/4)
-        } else  if (curSize > THRESHOLD_LARGE_ARRAY_SIZE) {
-            size = curSize + (curSize >> 1L); // x(3/2)
-        } else {
-            size = (curSize << 1L); // x2
-        }
-        // ensure the new size is >= needed size:
-        if (size < needSize) {
-            // align to 4096:
-            size = ((needSize >> 12L) + 1L) << 12L;
-        }
-        // check integer overflow:
-        if (size > Integer.MAX_VALUE) {
-            // resize to maximum capacity:
-            size = Integer.MAX_VALUE;
-        }
-        return size;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/ArrayCacheConst.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,273 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.java2d.marlin;
+
+import java.util.Arrays;
+import static sun.java2d.marlin.MarlinUtils.logInfo;
+
+public final class ArrayCacheConst implements MarlinConst {
+
+    static final int BUCKETS = 8;
+    static final int MIN_ARRAY_SIZE = 4096;
+    // maximum array size
+    static final int MAX_ARRAY_SIZE;
+    // threshold below to grow arrays by 4
+    static final int THRESHOLD_SMALL_ARRAY_SIZE = 4 * 1024 * 1024;
+    // threshold to grow arrays only by (3/2) instead of 2
+    static final int THRESHOLD_ARRAY_SIZE;
+    // threshold to grow arrays only by (5/4) instead of (3/2)
+    static final long THRESHOLD_HUGE_ARRAY_SIZE;
+    static final int[] ARRAY_SIZES = new int[BUCKETS];
+
+    static {
+        // initialize buckets for int/float arrays
+        int arraySize = MIN_ARRAY_SIZE;
+
+        int inc_lg = 2; // x4
+
+        for (int i = 0; i < BUCKETS; i++, arraySize <<= inc_lg) {
+            ARRAY_SIZES[i] = arraySize;
+
+            if (DO_TRACE) {
+                logInfo("arraySize[" + i + "]: " + arraySize);
+            }
+
+            if (arraySize >= THRESHOLD_SMALL_ARRAY_SIZE) {
+                inc_lg = 1; // x2
+            }
+        }
+        MAX_ARRAY_SIZE = arraySize >> inc_lg;
+
+        if (MAX_ARRAY_SIZE <= 0) {
+            throw new IllegalStateException("Invalid max array size !");
+        }
+
+        THRESHOLD_ARRAY_SIZE       =  16  * 1024 * 1024; // >16M
+        THRESHOLD_HUGE_ARRAY_SIZE  =  48L * 1024 * 1024; // >48M
+
+        if (DO_STATS || DO_MONITORS) {
+            logInfo("ArrayCache.BUCKETS        = " + BUCKETS);
+            logInfo("ArrayCache.MIN_ARRAY_SIZE = " + MIN_ARRAY_SIZE);
+            logInfo("ArrayCache.MAX_ARRAY_SIZE = " + MAX_ARRAY_SIZE);
+            logInfo("ArrayCache.ARRAY_SIZES = "
+                    + Arrays.toString(ARRAY_SIZES));
+            logInfo("ArrayCache.THRESHOLD_ARRAY_SIZE = "
+                    + THRESHOLD_ARRAY_SIZE);
+            logInfo("ArrayCache.THRESHOLD_HUGE_ARRAY_SIZE = "
+                    + THRESHOLD_HUGE_ARRAY_SIZE);
+        }
+    }
+
+    private ArrayCacheConst() {
+        // Utility class
+    }
+
+    // small methods used a lot (to be inlined / optimized by hotspot)
+
+    static int getBucket(final int length) {
+        for (int i = 0; i < ARRAY_SIZES.length; i++) {
+            if (length <= ARRAY_SIZES[i]) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Return the new array size (~ x2)
+     * @param curSize current used size
+     * @param needSize needed size
+     * @return new array size
+     */
+    public static int getNewSize(final int curSize, final int needSize) {
+        // check if needSize is negative or integer overflow:
+        if (needSize < 0) {
+            // hard overflow failure - we can't even accommodate
+            // new items without overflowing
+            throw new ArrayIndexOutOfBoundsException(
+                          "array exceeds maximum capacity !");
+        }
+        assert curSize >= 0;
+        final int initial = curSize;
+        int size;
+        if (initial > THRESHOLD_ARRAY_SIZE) {
+            size = initial + (initial >> 1); // x(3/2)
+        } else {
+            size = (initial << 1); // x2
+        }
+        // ensure the new size is >= needed size:
+        if (size < needSize) {
+            // align to 4096 (may overflow):
+            size = ((needSize >> 12) + 1) << 12;
+        }
+        // check integer overflow:
+        if (size < 0) {
+            // resize to maximum capacity:
+            size = Integer.MAX_VALUE;
+        }
+        return size;
+    }
+
+    /**
+     * Return the new array size (~ x2)
+     * @param curSize current used size
+     * @param needSize needed size
+     * @return new array size
+     */
+    public static long getNewLargeSize(final long curSize, final long needSize) {
+        // check if needSize is negative or integer overflow:
+        if ((needSize >> 31L) != 0L) {
+            // hard overflow failure - we can't even accommodate
+            // new items without overflowing
+            throw new ArrayIndexOutOfBoundsException(
+                          "array exceeds maximum capacity !");
+        }
+        assert curSize >= 0L;
+        long size;
+        if (curSize > THRESHOLD_HUGE_ARRAY_SIZE) {
+            size = curSize + (curSize >> 2L); // x(5/4)
+        } else if (curSize > THRESHOLD_ARRAY_SIZE) {
+            size = curSize + (curSize >> 1L); // x(3/2)
+        } else if (curSize > THRESHOLD_SMALL_ARRAY_SIZE) {
+            size = (curSize << 1L); // x2
+        } else {
+            size = (curSize << 2L); // x4
+        }
+        // ensure the new size is >= needed size:
+        if (size < needSize) {
+            // align to 4096:
+            size = ((needSize >> 12L) + 1L) << 12L;
+        }
+        // check integer overflow:
+        if (size > Integer.MAX_VALUE) {
+            // resize to maximum capacity:
+            size = Integer.MAX_VALUE;
+        }
+        return size;
+    }
+
+    static final class CacheStats {
+        final String name;
+        final BucketStats[] bucketStats;
+        int resize = 0;
+        int oversize = 0;
+        long totalInitial = 0L;
+
+        CacheStats(final String name) {
+            this.name = name;
+
+            bucketStats = new BucketStats[BUCKETS];
+            for (int i = 0; i < BUCKETS; i++) {
+                bucketStats[i] = new BucketStats();
+            }
+        }
+
+        void reset() {
+            resize = 0;
+            oversize = 0;
+
+            for (int i = 0; i < BUCKETS; i++) {
+                bucketStats[i].reset();
+            }
+        }
+
+        long dumpStats() {
+            long totalCacheBytes = 0L;
+
+            if (DO_STATS) {
+                for (int i = 0; i < BUCKETS; i++) {
+                    final BucketStats s = bucketStats[i];
+
+                    if (s.maxSize != 0) {
+                        totalCacheBytes += getByteFactor()
+                                           * (s.maxSize * ARRAY_SIZES[i]);
+                    }
+                }
+
+                if (totalInitial != 0L || totalCacheBytes != 0L
+                    || resize != 0 || oversize != 0)
+                {
+                    logInfo(name + ": resize: " + resize
+                            + " - oversize: " + oversize
+                            + " - initial: " + getTotalInitialBytes()
+                            + " bytes (" + totalInitial + " elements)"
+                            + " - cache: " + totalCacheBytes + " bytes"
+                    );
+                }
+
+                if (totalCacheBytes != 0L) {
+                    logInfo(name + ": usage stats:");
+
+                    for (int i = 0; i < BUCKETS; i++) {
+                        final BucketStats s = bucketStats[i];
+
+                        if (s.getOp != 0) {
+                            logInfo("  Bucket[" + ARRAY_SIZES[i] + "]: "
+                                    + "get: " + s.getOp
+                                    + " - put: " + s.returnOp
+                                    + " - create: " + s.createOp
+                                    + " :: max size: " + s.maxSize
+                            );
+                        }
+                    }
+                }
+            }
+            return totalCacheBytes;
+        }
+
+        private int getByteFactor() {
+            int factor = 1;
+            if (name.contains("Int") || name.contains("Float")) {
+                factor = 4;
+            }
+            return factor;
+        }
+
+        long getTotalInitialBytes() {
+            return getByteFactor() * totalInitial;
+        }
+    }
+
+    static final class BucketStats {
+        int getOp = 0;
+        int createOp = 0;
+        int returnOp = 0;
+        int maxSize = 0;
+
+        void reset() {
+            getOp = 0;
+            createOp = 0;
+            returnOp = 0;
+            maxSize = 0;
+        }
+
+        void updateMaxSize(final int size) {
+            if (size > maxSize) {
+                maxSize = size;
+            }
+        }
+    }
+}
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/ByteArrayCache.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/ByteArrayCache.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,109 +22,224 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package sun.java2d.marlin;
 
-import java.util.ArrayDeque;
+import static sun.java2d.marlin.ArrayCacheConst.ARRAY_SIZES;
+import static sun.java2d.marlin.ArrayCacheConst.BUCKETS;
+import static sun.java2d.marlin.ArrayCacheConst.MAX_ARRAY_SIZE;
+import static sun.java2d.marlin.MarlinUtils.logInfo;
+import static sun.java2d.marlin.MarlinUtils.logException;
+
+import java.lang.ref.WeakReference;
 import java.util.Arrays;
-import static sun.java2d.marlin.MarlinUtils.logException;
-import static sun.java2d.marlin.MarlinUtils.logInfo;
+
+import sun.java2d.marlin.ArrayCacheConst.BucketStats;
+import sun.java2d.marlin.ArrayCacheConst.CacheStats;
+
+/*
+ * Note that the [BYTE/INT/FLOAT]ArrayCache files are nearly identical except
+ * for a few type and name differences. Typically, the [BYTE]ArrayCache.java file
+ * is edited manually and then [INT]ArrayCache.java and [FLOAT]ArrayCache.java
+ * files are generated with the following command lines:
+ */
+// % sed -e 's/(b\yte)[ ]*//g' -e 's/b\yte/int/g' -e 's/B\yte/Int/g' < B\yteArrayCache.java > IntArrayCache.java
+// % sed -e 's/(b\yte)[ ]*/(float) /g' -e 's/b\yte/float/g' -e 's/B\yte/Float/g' < B\yteArrayCache.java > FloatArrayCache.java
 
 final class ByteArrayCache implements MarlinConst {
 
-    private final int arraySize;
-    private final ArrayDeque<byte[]> byteArrays;
-    // stats
-    private int getOp = 0;
-    private int createOp = 0;
-    private int returnOp = 0;
+    final boolean clean;
+    private final int bucketCapacity;
+    private WeakReference<Bucket[]> refBuckets = null;
+    final CacheStats stats;
+
+    ByteArrayCache(final boolean clean, final int bucketCapacity) {
+        this.clean = clean;
+        this.bucketCapacity = bucketCapacity;
+        this.stats = (DO_STATS) ?
+            new CacheStats(getLogPrefix(clean) + "ByteArrayCache") : null;
+    }
+
+    Bucket getCacheBucket(final int length) {
+        final int bucket = ArrayCacheConst.getBucket(length);
+        return getBuckets()[bucket];
+    }
+
+    private Bucket[] getBuckets() {
+        // resolve reference:
+        Bucket[] buckets = (refBuckets != null) ? refBuckets.get() : null;
+
+        // create a new buckets ?
+        if (buckets == null) {
+            buckets = new Bucket[BUCKETS];
+
+            for (int i = 0; i < BUCKETS; i++) {
+                buckets[i] = new Bucket(clean, ARRAY_SIZES[i], bucketCapacity,
+                        (DO_STATS) ? stats.bucketStats[i] : null);
+            }
+
+            // update weak reference:
+            refBuckets = new WeakReference<Bucket[]>(buckets);
+        }
+        return buckets;
+    }
+
+    Reference createRef(final int initialSize) {
+        return new Reference(this, initialSize);
+    }
+
+    static final class Reference {
+
+        // initial array reference (direct access)
+        final byte[] initial;
+        private final boolean clean;
+        private final ByteArrayCache cache;
+
+        Reference(final ByteArrayCache cache, final int initialSize) {
+            this.cache = cache;
+            this.clean = cache.clean;
+            this.initial = createArray(initialSize, clean);
+            if (DO_STATS) {
+                cache.stats.totalInitial += initialSize;
+            }
+        }
 
-    void dumpStats() {
-        if (getOp > 0) {
-            logInfo("ByteArrayCache[" + arraySize + "]: get: " + getOp
-                    + " created: " + createOp + " - returned: " + returnOp
-                    + " :: cache size: " + byteArrays.size());
+        byte[] getArray(final int length) {
+            if (length <= MAX_ARRAY_SIZE) {
+                return cache.getCacheBucket(length).getArray();
+            }
+            if (DO_STATS) {
+                cache.stats.oversize++;
+            }
+            if (DO_LOG_OVERSIZE) {
+                logInfo(getLogPrefix(clean) + "ByteArrayCache: "
+                        + "getArray[oversize]: length=\t" + length);
+            }
+            return createArray(length, clean);
+        }
+
+        byte[] widenArray(final byte[] array, final int usedSize,
+                          final int needSize)
+        {
+            final int length = array.length;
+            if (DO_CHECKS && length >= needSize) {
+                return array;
+            }
+            if (DO_STATS) {
+                cache.stats.resize++;
+            }
+
+            // maybe change bucket:
+            // ensure getNewSize() > newSize:
+            final byte[] res = getArray(ArrayCacheConst.getNewSize(usedSize, needSize));
+
+            // use wrapper to ensure proper copy:
+            System.arraycopy(array, 0, res, 0, usedSize); // copy only used elements
+
+            // maybe return current array:
+            putArray(array, 0, usedSize); // ensure array is cleared
+
+            if (DO_LOG_WIDEN_ARRAY) {
+                logInfo(getLogPrefix(clean) + "ByteArrayCache: "
+                        + "widenArray[" + res.length
+                        + "]: usedSize=\t" + usedSize + "\tlength=\t" + length
+                        + "\tneeded length=\t" + needSize);
+            }
+            return res;
+        }
+
+        byte[] putArray(final byte[] array)
+        {
+            // dirty array helper:
+            return putArray(array, 0, array.length);
+        }
+
+        byte[] putArray(final byte[] array, final int fromIndex,
+                        final int toIndex)
+        {
+            if (array.length <= MAX_ARRAY_SIZE) {
+                if ((clean || DO_CLEAN_DIRTY) && (toIndex != 0)) {
+                    // clean-up array of dirty part[fromIndex; toIndex[
+                    fill(array, fromIndex, toIndex, (byte)0);
+                }
+                // ensure to never store initial arrays in cache:
+                if (array != initial) {
+                    cache.getCacheBucket(array.length).putArray(array);
+                }
+            }
+            return initial;
         }
     }
 
-    ByteArrayCache(final int arraySize) {
-        this.arraySize = arraySize;
-        // small but enough: almost 1 cache line
-        this.byteArrays = new ArrayDeque<byte[]>(6);
-    }
+    static final class Bucket {
+
+        private int tail = 0;
+        private final int arraySize;
+        private final boolean clean;
+        private final byte[][] arrays;
+        private final BucketStats stats;
 
-    byte[] getArray() {
-        if (DO_STATS) {
-            getOp++;
+        Bucket(final boolean clean, final int arraySize,
+               final int capacity, final BucketStats stats)
+        {
+            this.arraySize = arraySize;
+            this.clean = clean;
+            this.stats = stats;
+            this.arrays = new byte[capacity][];
         }
 
-        // use cache:
-        final byte[] array = byteArrays.pollLast();
-        if (array != null) {
-            return array;
+        byte[] getArray() {
+            if (DO_STATS) {
+                stats.getOp++;
+            }
+            // use cache:
+            if (tail != 0) {
+                final byte[] array = arrays[--tail];
+                arrays[tail] = null;
+                return array;
+            }
+            if (DO_STATS) {
+                stats.createOp++;
+            }
+            return createArray(arraySize, clean);
         }
 
-        if (DO_STATS) {
-            createOp++;
+        void putArray(final byte[] array)
+        {
+            if (DO_CHECKS && (array.length != arraySize)) {
+                logInfo(getLogPrefix(clean) + "ByteArrayCache: "
+                        + "bad length = " + array.length);
+                return;
+            }
+            if (DO_STATS) {
+                stats.returnOp++;
+            }
+            // fill cache:
+            if (arrays.length > tail) {
+                arrays[tail++] = array;
+
+                if (DO_STATS) {
+                    stats.updateMaxSize(tail);
+                }
+            } else if (DO_CHECKS) {
+                logInfo(getLogPrefix(clean) + "ByteArrayCache: "
+                        + "array capacity exceeded !");
+            }
         }
-
-        return new byte[arraySize];
     }
 
-    void putDirtyArray(final byte[] array, final int length) {
-        if (length != arraySize) {
-            if (DO_CHECKS) {
-                MarlinUtils.logInfo("ArrayCache: bad length = " + length);
-            }
-            return;
-        }
-        if (DO_STATS) {
-            returnOp++;
-        }
-
-        // NO clean-up of array data = DIRTY ARRAY
-
-        if (DO_CLEAN_DIRTY) {
-            // Force zero-fill dirty arrays:
-            Arrays.fill(array, 0, array.length, BYTE_0);
+    static byte[] createArray(final int length, final boolean clean) {
+        if (clean) {
+            return new byte[length];
         }
-
-        // fill cache:
-        byteArrays.addLast(array);
-    }
-
-    void putArray(final byte[] array, final int length,
-                  final int fromIndex, final int toIndex)
-    {
-        if (length != arraySize) {
-            if (DO_CHECKS) {
-                MarlinUtils.logInfo("ArrayCache: bad length = " + length);
-            }
-            return;
-        }
-        if (DO_STATS) {
-            returnOp++;
-        }
-
-        // clean-up array of dirty part[fromIndex; toIndex[
-        fill(array, fromIndex, toIndex, BYTE_0);
-
-        // fill cache:
-        byteArrays.addLast(array);
+       // use JDK9 Unsafe.allocateUninitializedArray(class, length):
+       return (byte[]) OffHeapArray.UNSAFE.allocateUninitializedArray(byte.class, length);
     }
 
     static void fill(final byte[] array, final int fromIndex,
                      final int toIndex, final byte value)
     {
         // clear array data:
-        /*
-         * Arrays.fill is faster than System.arraycopy(empty array)
-         * or Unsafe.setMemory(byte 0)
-         */
-        if (toIndex != 0) {
-            Arrays.fill(array, fromIndex, toIndex, value);
-        }
-
+        Arrays.fill(array, fromIndex, toIndex, value);
         if (DO_CHECKS) {
             check(array, fromIndex, toIndex, value);
         }
@@ -149,4 +264,8 @@
             }
         }
     }
+
+    static String getLogPrefix(final boolean clean) {
+        return (clean) ? "Clean" : "Dirty";
+    }
 }
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Dasher.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Dasher.java	Wed Jul 05 22:06:46 2017 +0200
@@ -68,15 +68,13 @@
     // per-thread renderer context
     final RendererContext rdrCtx;
 
-    // dashes array (dirty)
-    final float[] dashes_initial = new float[INITIAL_ARRAY];
-
     // flag to recycle dash array copy
     boolean recycleDashes;
 
-    // per-thread initial arrays (large enough to satisfy most usages
-    // +1 to avoid recycling in Helpers.widenArray()
-    private final float[] firstSegmentsBuffer_initial = new float[INITIAL_ARRAY + 1];
+    // dashes ref (dirty)
+    final FloatArrayCache.Reference dashes_ref;
+    // firstSegmentsBuffer ref (dirty)
+    final FloatArrayCache.Reference firstSegmentsBuffer_ref;
 
     /**
      * Constructs a <code>Dasher</code>.
@@ -85,7 +83,10 @@
     Dasher(final RendererContext rdrCtx) {
         this.rdrCtx = rdrCtx;
 
-        firstSegmentsBuffer = firstSegmentsBuffer_initial;
+        dashes_ref = rdrCtx.newDirtyFloatArrayRef(INITIAL_ARRAY); // 1K
+
+        firstSegmentsBuffer_ref = rdrCtx.newDirtyFloatArrayRef(INITIAL_ARRAY); // 1K
+        firstSegmentsBuffer     = firstSegmentsBuffer_ref.initial;
 
         // we need curCurvepts to be able to contain 2 curves because when
         // dashing curves, we need to subdivide it
@@ -142,18 +143,12 @@
         if (DO_CLEAN_DIRTY) {
             // Force zero-fill dirty arrays:
             Arrays.fill(curCurvepts, 0f);
-            Arrays.fill(firstSegmentsBuffer, 0f);
         }
         // Return arrays:
-        if (recycleDashes && dash != dashes_initial) {
-            rdrCtx.putDirtyFloatArray(dash);
-            dash = null;
+        if (recycleDashes) {
+            dash = dashes_ref.putArray(dash);
         }
-
-        if (firstSegmentsBuffer != firstSegmentsBuffer_initial) {
-            rdrCtx.putDirtyFloatArray(firstSegmentsBuffer);
-            firstSegmentsBuffer = firstSegmentsBuffer_initial;
-        }
+        firstSegmentsBuffer = firstSegmentsBuffer_ref.putArray(firstSegmentsBuffer);
     }
 
     @Override
@@ -222,7 +217,8 @@
                             .add(segIdx + len);
                     }
                     firstSegmentsBuffer = buf
-                        = rdrCtx.widenDirtyFloatArray(buf, segIdx, segIdx + len);
+                        = firstSegmentsBuffer_ref.widenArray(buf, segIdx,
+                                                             segIdx + len);
                 }
                 buf[segIdx++] = type;
                 len--;
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/FloatArrayCache.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/FloatArrayCache.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,110 +22,224 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package sun.java2d.marlin;
 
-import java.util.ArrayDeque;
+import static sun.java2d.marlin.ArrayCacheConst.ARRAY_SIZES;
+import static sun.java2d.marlin.ArrayCacheConst.BUCKETS;
+import static sun.java2d.marlin.ArrayCacheConst.MAX_ARRAY_SIZE;
+import static sun.java2d.marlin.MarlinUtils.logInfo;
+import static sun.java2d.marlin.MarlinUtils.logException;
+
+import java.lang.ref.WeakReference;
 import java.util.Arrays;
-import static sun.java2d.marlin.MarlinUtils.logException;
-import static sun.java2d.marlin.MarlinUtils.logInfo;
+
+import sun.java2d.marlin.ArrayCacheConst.BucketStats;
+import sun.java2d.marlin.ArrayCacheConst.CacheStats;
+
+/*
+ * Note that the [BYTE/INT/FLOAT]ArrayCache files are nearly identical except
+ * for a few type and name differences. Typically, the [BYTE]ArrayCache.java file
+ * is edited manually and then [INT]ArrayCache.java and [FLOAT]ArrayCache.java
+ * files are generated with the following command lines:
+ */
+// % sed -e 's/(b\yte)[ ]*//g' -e 's/b\yte/int/g' -e 's/B\yte/Int/g' < B\yteArrayCache.java > IntArrayCache.java
+// % sed -e 's/(b\yte)[ ]*/(float) /g' -e 's/b\yte/float/g' -e 's/B\yte/Float/g' < B\yteArrayCache.java > FloatArrayCache.java
 
 final class FloatArrayCache implements MarlinConst {
 
-    private final int arraySize;
-    private final ArrayDeque<float[]> floatArrays;
-    // stats
-    private int getOp = 0;
-    private int createOp = 0;
-    private int returnOp = 0;
+    final boolean clean;
+    private final int bucketCapacity;
+    private WeakReference<Bucket[]> refBuckets = null;
+    final CacheStats stats;
+
+    FloatArrayCache(final boolean clean, final int bucketCapacity) {
+        this.clean = clean;
+        this.bucketCapacity = bucketCapacity;
+        this.stats = (DO_STATS) ?
+            new CacheStats(getLogPrefix(clean) + "FloatArrayCache") : null;
+    }
+
+    Bucket getCacheBucket(final int length) {
+        final int bucket = ArrayCacheConst.getBucket(length);
+        return getBuckets()[bucket];
+    }
+
+    private Bucket[] getBuckets() {
+        // resolve reference:
+        Bucket[] buckets = (refBuckets != null) ? refBuckets.get() : null;
+
+        // create a new buckets ?
+        if (buckets == null) {
+            buckets = new Bucket[BUCKETS];
+
+            for (int i = 0; i < BUCKETS; i++) {
+                buckets[i] = new Bucket(clean, ARRAY_SIZES[i], bucketCapacity,
+                        (DO_STATS) ? stats.bucketStats[i] : null);
+            }
+
+            // update weak reference:
+            refBuckets = new WeakReference<Bucket[]>(buckets);
+        }
+        return buckets;
+    }
+
+    Reference createRef(final int initialSize) {
+        return new Reference(this, initialSize);
+    }
+
+    static final class Reference {
+
+        // initial array reference (direct access)
+        final float[] initial;
+        private final boolean clean;
+        private final FloatArrayCache cache;
+
+        Reference(final FloatArrayCache cache, final int initialSize) {
+            this.cache = cache;
+            this.clean = cache.clean;
+            this.initial = createArray(initialSize, clean);
+            if (DO_STATS) {
+                cache.stats.totalInitial += initialSize;
+            }
+        }
 
-    void dumpStats() {
-        if (getOp > 0) {
-            logInfo("FloatArrayCache[" + arraySize + "]: get: " + getOp
-                    + " created: " + createOp + " - returned: " + returnOp
-                    + " :: cache size: " + floatArrays.size());
+        float[] getArray(final int length) {
+            if (length <= MAX_ARRAY_SIZE) {
+                return cache.getCacheBucket(length).getArray();
+            }
+            if (DO_STATS) {
+                cache.stats.oversize++;
+            }
+            if (DO_LOG_OVERSIZE) {
+                logInfo(getLogPrefix(clean) + "FloatArrayCache: "
+                        + "getArray[oversize]: length=\t" + length);
+            }
+            return createArray(length, clean);
+        }
+
+        float[] widenArray(final float[] array, final int usedSize,
+                          final int needSize)
+        {
+            final int length = array.length;
+            if (DO_CHECKS && length >= needSize) {
+                return array;
+            }
+            if (DO_STATS) {
+                cache.stats.resize++;
+            }
+
+            // maybe change bucket:
+            // ensure getNewSize() > newSize:
+            final float[] res = getArray(ArrayCacheConst.getNewSize(usedSize, needSize));
+
+            // use wrapper to ensure proper copy:
+            System.arraycopy(array, 0, res, 0, usedSize); // copy only used elements
+
+            // maybe return current array:
+            putArray(array, 0, usedSize); // ensure array is cleared
+
+            if (DO_LOG_WIDEN_ARRAY) {
+                logInfo(getLogPrefix(clean) + "FloatArrayCache: "
+                        + "widenArray[" + res.length
+                        + "]: usedSize=\t" + usedSize + "\tlength=\t" + length
+                        + "\tneeded length=\t" + needSize);
+            }
+            return res;
+        }
+
+        float[] putArray(final float[] array)
+        {
+            // dirty array helper:
+            return putArray(array, 0, array.length);
+        }
+
+        float[] putArray(final float[] array, final int fromIndex,
+                        final int toIndex)
+        {
+            if (array.length <= MAX_ARRAY_SIZE) {
+                if ((clean || DO_CLEAN_DIRTY) && (toIndex != 0)) {
+                    // clean-up array of dirty part[fromIndex; toIndex[
+                    fill(array, fromIndex, toIndex, (float) 0);
+                }
+                // ensure to never store initial arrays in cache:
+                if (array != initial) {
+                    cache.getCacheBucket(array.length).putArray(array);
+                }
+            }
+            return initial;
         }
     }
 
-    FloatArrayCache(final int arraySize) {
-        this.arraySize = arraySize;
-        // small but enough: almost 1 cache line
-        this.floatArrays = new ArrayDeque<float[]>(6);
-    }
+    static final class Bucket {
+
+        private int tail = 0;
+        private final int arraySize;
+        private final boolean clean;
+        private final float[][] arrays;
+        private final BucketStats stats;
 
-    float[] getArray() {
-        if (DO_STATS) {
-            getOp++;
+        Bucket(final boolean clean, final int arraySize,
+               final int capacity, final BucketStats stats)
+        {
+            this.arraySize = arraySize;
+            this.clean = clean;
+            this.stats = stats;
+            this.arrays = new float[capacity][];
         }
 
-        // use cache
-        final float[] array = floatArrays.pollLast();
-
-        if (array != null) {
-            return array;
+        float[] getArray() {
+            if (DO_STATS) {
+                stats.getOp++;
+            }
+            // use cache:
+            if (tail != 0) {
+                final float[] array = arrays[--tail];
+                arrays[tail] = null;
+                return array;
+            }
+            if (DO_STATS) {
+                stats.createOp++;
+            }
+            return createArray(arraySize, clean);
         }
 
-        if (DO_STATS) {
-            createOp++;
+        void putArray(final float[] array)
+        {
+            if (DO_CHECKS && (array.length != arraySize)) {
+                logInfo(getLogPrefix(clean) + "FloatArrayCache: "
+                        + "bad length = " + array.length);
+                return;
+            }
+            if (DO_STATS) {
+                stats.returnOp++;
+            }
+            // fill cache:
+            if (arrays.length > tail) {
+                arrays[tail++] = array;
+
+                if (DO_STATS) {
+                    stats.updateMaxSize(tail);
+                }
+            } else if (DO_CHECKS) {
+                logInfo(getLogPrefix(clean) + "FloatArrayCache: "
+                        + "array capacity exceeded !");
+            }
         }
-
-        return new float[arraySize];
     }
 
-    void putDirtyArray(final float[] array, final int length) {
-        if (length != arraySize) {
-            if (DO_CHECKS) {
-                MarlinUtils.logInfo("ArrayCache: bad length = " + length);
-            }
-            return;
-        }
-        if (DO_STATS) {
-            returnOp++;
-        }
-
-        // NO clean-up of array data = DIRTY ARRAY
-
-        if (DO_CLEAN_DIRTY) {
-            // Force zero-fill dirty arrays:
-            Arrays.fill(array, 0, array.length, 0f);
+    static float[] createArray(final int length, final boolean clean) {
+        if (clean) {
+            return new float[length];
         }
-
-        // fill cache:
-        floatArrays.addLast(array);
-    }
-
-    void putArray(final float[] array, final int length,
-                  final int fromIndex, final int toIndex)
-    {
-        if (length != arraySize) {
-            if (DO_CHECKS) {
-                MarlinUtils.logInfo("ArrayCache: bad length = " + length);
-            }
-            return;
-        }
-        if (DO_STATS) {
-            returnOp++;
-        }
-
-        // clean-up array of dirty part[fromIndex; toIndex[
-        fill(array, fromIndex, toIndex, 0f);
-
-        // fill cache:
-        floatArrays.addLast(array);
+       // use JDK9 Unsafe.allocateUninitializedArray(class, length):
+       return (float[]) OffHeapArray.UNSAFE.allocateUninitializedArray(float.class, length);
     }
 
     static void fill(final float[] array, final int fromIndex,
                      final int toIndex, final float value)
     {
         // clear array data:
-        /*
-         * Arrays.fill is faster than System.arraycopy(empty array)
-         * or Unsafe.setMemory(byte 0)
-         */
-        if (toIndex != 0) {
-            Arrays.fill(array, fromIndex, toIndex, value);
-        }
-
+        Arrays.fill(array, fromIndex, toIndex, value);
         if (DO_CHECKS) {
             check(array, fromIndex, toIndex, value);
         }
@@ -150,4 +264,8 @@
             }
         }
     }
+
+    static String getLogPrefix(final boolean clean) {
+        return (clean) ? "Clean" : "Dirty";
+    }
 }
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/IntArrayCache.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/IntArrayCache.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,109 +22,224 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package sun.java2d.marlin;
 
-import java.util.ArrayDeque;
+import static sun.java2d.marlin.ArrayCacheConst.ARRAY_SIZES;
+import static sun.java2d.marlin.ArrayCacheConst.BUCKETS;
+import static sun.java2d.marlin.ArrayCacheConst.MAX_ARRAY_SIZE;
+import static sun.java2d.marlin.MarlinUtils.logInfo;
+import static sun.java2d.marlin.MarlinUtils.logException;
+
+import java.lang.ref.WeakReference;
 import java.util.Arrays;
-import static sun.java2d.marlin.MarlinUtils.logException;
-import static sun.java2d.marlin.MarlinUtils.logInfo;
+
+import sun.java2d.marlin.ArrayCacheConst.BucketStats;
+import sun.java2d.marlin.ArrayCacheConst.CacheStats;
+
+/*
+ * Note that the [BYTE/INT/FLOAT]ArrayCache files are nearly identical except
+ * for a few type and name differences. Typically, the [BYTE]ArrayCache.java file
+ * is edited manually and then [INT]ArrayCache.java and [FLOAT]ArrayCache.java
+ * files are generated with the following command lines:
+ */
+// % sed -e 's/(b\yte)[ ]*//g' -e 's/b\yte/int/g' -e 's/B\yte/Int/g' < B\yteArrayCache.java > IntArrayCache.java
+// % sed -e 's/(b\yte)[ ]*/(float) /g' -e 's/b\yte/float/g' -e 's/B\yte/Float/g' < B\yteArrayCache.java > FloatArrayCache.java
 
 final class IntArrayCache implements MarlinConst {
 
-    private final int arraySize;
-    private final ArrayDeque<int[]> intArrays;
-    // stats
-    private int getOp = 0;
-    private int createOp = 0;
-    private int returnOp = 0;
+    final boolean clean;
+    private final int bucketCapacity;
+    private WeakReference<Bucket[]> refBuckets = null;
+    final CacheStats stats;
+
+    IntArrayCache(final boolean clean, final int bucketCapacity) {
+        this.clean = clean;
+        this.bucketCapacity = bucketCapacity;
+        this.stats = (DO_STATS) ?
+            new CacheStats(getLogPrefix(clean) + "IntArrayCache") : null;
+    }
+
+    Bucket getCacheBucket(final int length) {
+        final int bucket = ArrayCacheConst.getBucket(length);
+        return getBuckets()[bucket];
+    }
+
+    private Bucket[] getBuckets() {
+        // resolve reference:
+        Bucket[] buckets = (refBuckets != null) ? refBuckets.get() : null;
+
+        // create a new buckets ?
+        if (buckets == null) {
+            buckets = new Bucket[BUCKETS];
+
+            for (int i = 0; i < BUCKETS; i++) {
+                buckets[i] = new Bucket(clean, ARRAY_SIZES[i], bucketCapacity,
+                        (DO_STATS) ? stats.bucketStats[i] : null);
+            }
+
+            // update weak reference:
+            refBuckets = new WeakReference<Bucket[]>(buckets);
+        }
+        return buckets;
+    }
+
+    Reference createRef(final int initialSize) {
+        return new Reference(this, initialSize);
+    }
+
+    static final class Reference {
+
+        // initial array reference (direct access)
+        final int[] initial;
+        private final boolean clean;
+        private final IntArrayCache cache;
+
+        Reference(final IntArrayCache cache, final int initialSize) {
+            this.cache = cache;
+            this.clean = cache.clean;
+            this.initial = createArray(initialSize, clean);
+            if (DO_STATS) {
+                cache.stats.totalInitial += initialSize;
+            }
+        }
 
-    void dumpStats() {
-        if (getOp > 0) {
-            logInfo("IntArrayCache[" + arraySize + "]: get: " + getOp
-                    + " created: " + createOp + " - returned: " + returnOp
-                    + " :: cache size: " + intArrays.size());
+        int[] getArray(final int length) {
+            if (length <= MAX_ARRAY_SIZE) {
+                return cache.getCacheBucket(length).getArray();
+            }
+            if (DO_STATS) {
+                cache.stats.oversize++;
+            }
+            if (DO_LOG_OVERSIZE) {
+                logInfo(getLogPrefix(clean) + "IntArrayCache: "
+                        + "getArray[oversize]: length=\t" + length);
+            }
+            return createArray(length, clean);
+        }
+
+        int[] widenArray(final int[] array, final int usedSize,
+                          final int needSize)
+        {
+            final int length = array.length;
+            if (DO_CHECKS && length >= needSize) {
+                return array;
+            }
+            if (DO_STATS) {
+                cache.stats.resize++;
+            }
+
+            // maybe change bucket:
+            // ensure getNewSize() > newSize:
+            final int[] res = getArray(ArrayCacheConst.getNewSize(usedSize, needSize));
+
+            // use wrapper to ensure proper copy:
+            System.arraycopy(array, 0, res, 0, usedSize); // copy only used elements
+
+            // maybe return current array:
+            putArray(array, 0, usedSize); // ensure array is cleared
+
+            if (DO_LOG_WIDEN_ARRAY) {
+                logInfo(getLogPrefix(clean) + "IntArrayCache: "
+                        + "widenArray[" + res.length
+                        + "]: usedSize=\t" + usedSize + "\tlength=\t" + length
+                        + "\tneeded length=\t" + needSize);
+            }
+            return res;
+        }
+
+        int[] putArray(final int[] array)
+        {
+            // dirty array helper:
+            return putArray(array, 0, array.length);
+        }
+
+        int[] putArray(final int[] array, final int fromIndex,
+                        final int toIndex)
+        {
+            if (array.length <= MAX_ARRAY_SIZE) {
+                if ((clean || DO_CLEAN_DIRTY) && (toIndex != 0)) {
+                    // clean-up array of dirty part[fromIndex; toIndex[
+                    fill(array, fromIndex, toIndex, 0);
+                }
+                // ensure to never store initial arrays in cache:
+                if (array != initial) {
+                    cache.getCacheBucket(array.length).putArray(array);
+                }
+            }
+            return initial;
         }
     }
 
-    IntArrayCache(final int arraySize) {
-        this.arraySize = arraySize;
-        // small but enough: almost 1 cache line
-        this.intArrays = new ArrayDeque<int[]>(6);
-    }
+    static final class Bucket {
+
+        private int tail = 0;
+        private final int arraySize;
+        private final boolean clean;
+        private final int[][] arrays;
+        private final BucketStats stats;
 
-    int[] getArray() {
-        if (DO_STATS) {
-            getOp++;
+        Bucket(final boolean clean, final int arraySize,
+               final int capacity, final BucketStats stats)
+        {
+            this.arraySize = arraySize;
+            this.clean = clean;
+            this.stats = stats;
+            this.arrays = new int[capacity][];
         }
 
-        // use cache:
-        final int[] array = intArrays.pollLast();
-        if (array != null) {
-            return array;
+        int[] getArray() {
+            if (DO_STATS) {
+                stats.getOp++;
+            }
+            // use cache:
+            if (tail != 0) {
+                final int[] array = arrays[--tail];
+                arrays[tail] = null;
+                return array;
+            }
+            if (DO_STATS) {
+                stats.createOp++;
+            }
+            return createArray(arraySize, clean);
         }
 
-        if (DO_STATS) {
-            createOp++;
+        void putArray(final int[] array)
+        {
+            if (DO_CHECKS && (array.length != arraySize)) {
+                logInfo(getLogPrefix(clean) + "IntArrayCache: "
+                        + "bad length = " + array.length);
+                return;
+            }
+            if (DO_STATS) {
+                stats.returnOp++;
+            }
+            // fill cache:
+            if (arrays.length > tail) {
+                arrays[tail++] = array;
+
+                if (DO_STATS) {
+                    stats.updateMaxSize(tail);
+                }
+            } else if (DO_CHECKS) {
+                logInfo(getLogPrefix(clean) + "IntArrayCache: "
+                        + "array capacity exceeded !");
+            }
         }
-
-        return new int[arraySize];
     }
 
-    void putDirtyArray(final int[] array, final int length) {
-        if (length != arraySize) {
-            if (DO_CHECKS) {
-                MarlinUtils.logInfo("ArrayCache: bad length = " + length);
-            }
-            return;
-        }
-        if (DO_STATS) {
-            returnOp++;
-        }
-
-        // NO clean-up of array data = DIRTY ARRAY
-
-        if (DO_CLEAN_DIRTY) {
-            // Force zero-fill dirty arrays:
-            Arrays.fill(array, 0, array.length, 0);
+    static int[] createArray(final int length, final boolean clean) {
+        if (clean) {
+            return new int[length];
         }
-
-        // fill cache:
-        intArrays.addLast(array);
-    }
-
-    void putArray(final int[] array, final int length,
-                  final int fromIndex, final int toIndex)
-    {
-        if (length != arraySize) {
-            if (DO_CHECKS) {
-                MarlinUtils.logInfo("ArrayCache: bad length = " + length);
-            }
-            return;
-        }
-        if (DO_STATS) {
-            returnOp++;
-        }
-
-        // clean-up array of dirty part[fromIndex; toIndex[
-        fill(array, fromIndex, toIndex, 0);
-
-        // fill cache:
-        intArrays.addLast(array);
+       // use JDK9 Unsafe.allocateUninitializedArray(class, length):
+       return (int[]) OffHeapArray.UNSAFE.allocateUninitializedArray(int.class, length);
     }
 
     static void fill(final int[] array, final int fromIndex,
                      final int toIndex, final int value)
     {
         // clear array data:
-        /*
-         * Arrays.fill is faster than System.arraycopy(empty array)
-         * or Unsafe.setMemory(byte 0)
-         */
-        if (toIndex != 0) {
-            Arrays.fill(array, fromIndex, toIndex, value);
-        }
-
+        Arrays.fill(array, fromIndex, toIndex, value);
         if (DO_CHECKS) {
             check(array, fromIndex, toIndex, value);
         }
@@ -149,4 +264,8 @@
             }
         }
     }
+
+    static String getLogPrefix(final boolean clean) {
+        return (clean) ? "Clean" : "Dirty";
+    }
 }
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinCache.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinCache.java	Wed Jul 05 22:06:46 2017 +0200
@@ -100,8 +100,8 @@
     // per-thread renderer context
     final RendererContext rdrCtx;
 
-    // large cached touchedTile (dirty)
-    final int[] touchedTile_initial = new int[INITIAL_ARRAY]; // 1 tile line
+    // touchedTile ref (clean)
+    private final IntArrayCache.Reference touchedTile_ref;
 
     int tileMin, tileMax;
 
@@ -110,9 +110,10 @@
     MarlinCache(final RendererContext rdrCtx) {
         this.rdrCtx = rdrCtx;
 
-        rowAAChunk = new OffHeapArray(rdrCtx.cleanerObj, INITIAL_CHUNK_ARRAY); // 64K
+        rowAAChunk = rdrCtx.newOffHeapArray(INITIAL_CHUNK_ARRAY); // 64K
 
-        touchedTile = touchedTile_initial;
+        touchedTile_ref = rdrCtx.newCleanIntArrayRef(INITIAL_ARRAY); // 1K = 1 tile line
+        touchedTile     = touchedTile_ref.initial;
 
         // tile used marks:
         tileMin = Integer.MAX_VALUE;
@@ -181,10 +182,9 @@
 
         if (nxTiles > INITIAL_ARRAY) {
             if (DO_STATS) {
-                rdrCtx.stats.stat_array_marlincache_touchedTile
-                    .add(nxTiles);
+                rdrCtx.stats.stat_array_marlincache_touchedTile.add(nxTiles);
             }
-            touchedTile = rdrCtx.getIntArray(nxTiles);
+            touchedTile = touchedTile_ref.getArray(nxTiles);
         }
     }
 
@@ -196,11 +196,13 @@
         // Reset touchedTile if needed:
         resetTileLine(0);
 
+        if (DO_STATS) {
+            rdrCtx.stats.totalOffHeap += rowAAChunk.length;
+        }
+
         // Return arrays:
-        if (touchedTile != touchedTile_initial) {
-            rdrCtx.putIntArray(touchedTile, 0, 0); // already zero filled
-            touchedTile = touchedTile_initial;
-        }
+        touchedTile = touchedTile_ref.putArray(touchedTile, 0, 0); // already zero filled
+
         // At last: resize back off-heap rowAA to initial size
         if (rowAAChunk.length != INITIAL_CHUNK_ARRAY) {
             // note: may throw OOME:
@@ -554,8 +556,7 @@
         addr_off += SIZE_INT;
 
         if (DO_STATS) {
-            rdrCtx.stats.hist_tile_generator_encoding_runLen
-                .add(runLen);
+            rdrCtx.stats.hist_tile_generator_encoding_runLen.add(runLen);
         }
 
         long len = (addr_off - _rowAAChunk.address);
@@ -612,12 +613,12 @@
 
     private void expandRowAAChunk(final long needSize) {
         if (DO_STATS) {
-            rdrCtx.stats.stat_array_marlincache_rowAAChunk
-                .add(needSize);
+            rdrCtx.stats.stat_array_marlincache_rowAAChunk.add(needSize);
         }
 
         // note: throw IOOB if neededSize > 2Gb:
-        final long newSize = ArrayCache.getNewLargeSize(rowAAChunk.length, needSize);
+        final long newSize = ArrayCacheConst.getNewLargeSize(rowAAChunk.length,
+                                                             needSize);
 
         rowAAChunk.resize(newSize);
     }
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinConst.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinConst.java	Wed Jul 05 22:06:46 2017 +0200
@@ -62,6 +62,8 @@
     // enable traces
     static final boolean DO_TRACE = ENABLE_LOGS && false;
 
+    // do flush stats
+    static final boolean DO_FLUSH_STATS = true;
     // do flush monitors
     static final boolean DO_FLUSH_MONITORS = true;
     // use one polling thread to dump statistics/monitors
@@ -78,7 +80,7 @@
     // flag to enable logs related bounds checks
     static final boolean DO_LOG_BOUNDS = ENABLE_LOGS && false;
 
-    // Initial Array sizing (initial context capacity) ~ 350K
+    // Initial Array sizing (initial context capacity) ~ 450K
 
     // 2048 pixel (width x height) for initial capacity
     static final int INITIAL_PIXEL_DIM
@@ -86,14 +88,17 @@
 
     // typical array sizes: only odd numbers allowed below
     static final int INITIAL_ARRAY        = 256;
-    static final int INITIAL_SMALL_ARRAY  = 1024;
-    static final int INITIAL_MEDIUM_ARRAY = 4096;
-    static final int INITIAL_LARGE_ARRAY  = 8192;
+
     // alpha row dimension
     static final int INITIAL_AA_ARRAY     = INITIAL_PIXEL_DIM;
 
-    // initial edges (24 bytes) = 24K [ints] = 96K
-    static final int INITIAL_EDGES_CAPACITY = 4096 * 24; // 6 ints per edges
+    // 4096 edges for initial capacity
+    static final int INITIAL_EDGES_COUNT = MarlinProperties.getInitialEdges();
+
+    // initial edges = 3/4 * edges count (4096)
+    // 6 ints per edges = 24 bytes
+    // edges capacity = 24 x initial edges = 18 * edges count (4096) = 72K
+    static final int INITIAL_EDGES_CAPACITY = INITIAL_EDGES_COUNT * 18;
 
     // zero value as byte
     static final byte BYTE_0 = (byte) 0;
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinProperties.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinProperties.java	Wed Jul 05 22:06:46 2017 +0200
@@ -42,13 +42,27 @@
     }
 
     /**
+     * Return the initial edge capacity used to define initial arrays
+     * (edges, polystack, crossings)
+     *
+     * @return 256 < initial edges < 65536 (4096 by default)
+     */
+    public static int getInitialEdges() {
+        return align(
+            getInteger("sun.java2d.renderer.edges", 4096, 64, 64 * 1024),
+            64);
+    }
+
+    /**
      * Return the initial pixel size used to define initial arrays
      * (tile AA chunk, alpha line, buckets)
      *
      * @return 64 < initial pixel size < 32768 (2048 by default)
      */
     public static int getInitialImageSize() {
-        return getInteger("sun.java2d.renderer.pixelsize", 2048, 64, 32 * 1024);
+        return align(
+            getInteger("sun.java2d.renderer.pixelsize", 2048, 64, 32 * 1024),
+            64);
     }
 
     /**
@@ -182,4 +196,8 @@
         return value;
     }
 
+    static int align(final int val, final int norm) {
+        final int ceil = FloatMath.ceil_int( ((float)val) / norm);
+        return ceil * norm;
+    }
 }
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java	Wed Jul 05 22:06:46 2017 +0200
@@ -47,7 +47,38 @@
 public class MarlinRenderingEngine extends RenderingEngine
                                    implements MarlinConst
 {
-    private static enum NormMode {ON_WITH_AA, ON_NO_AA, OFF}
+    private static enum NormMode {
+        ON_WITH_AA {
+            @Override
+            PathIterator getNormalizingPathIterator(final RendererContext rdrCtx,
+                                                    final PathIterator src)
+            {
+                // NormalizingPathIterator NearestPixelCenter:
+                return rdrCtx.nPCPathIterator.init(src);
+            }
+        },
+        ON_NO_AA{
+            @Override
+            PathIterator getNormalizingPathIterator(final RendererContext rdrCtx,
+                                                    final PathIterator src)
+            {
+                // NearestPixel NormalizingPathIterator:
+                return rdrCtx.nPQPathIterator.init(src);
+            }
+        },
+        OFF{
+            @Override
+            PathIterator getNormalizingPathIterator(final RendererContext rdrCtx,
+                                                    final PathIterator src)
+            {
+                // return original path iterator if normalization is disabled:
+                return src;
+            }
+        };
+
+        abstract PathIterator getNormalizingPathIterator(RendererContext rdrCtx,
+                                                         PathIterator src);
+    }
 
     private static final float MIN_PEN_SIZE = 1f / NORM_SUBPIXELS;
 
@@ -91,13 +122,7 @@
         final RendererContext rdrCtx = getRendererContext();
         try {
             // initialize a large copyable Path2D to avoid a lot of array growing:
-            final Path2D.Float p2d =
-                    (rdrCtx.p2d == null) ?
-                    (rdrCtx.p2d = new Path2D.Float(Path2D.WIND_NON_ZERO,
-                                                   INITIAL_MEDIUM_ARRAY))
-                    : rdrCtx.p2d;
-            // reset
-            p2d.reset();
+            final Path2D.Float p2d = rdrCtx.getPath2D();
 
             strokeTo(rdrCtx,
                      src,
@@ -274,7 +299,7 @@
                         Shape src,
                         AffineTransform at,
                         float width,
-                        NormMode normalize,
+                        NormMode norm,
                         int caps,
                         int join,
                         float miterlimit,
@@ -338,13 +363,12 @@
                     dashLen = dashes.length;
                     final float[] newDashes;
                     if (dashLen <= INITIAL_ARRAY) {
-                        newDashes = rdrCtx.dasher.dashes_initial;
+                        newDashes = rdrCtx.dasher.dashes_ref.initial;
                     } else {
                         if (DO_STATS) {
-                            rdrCtx.stats.stat_array_dasher_dasher
-                                .add(dashLen);
+                            rdrCtx.stats.stat_array_dasher_dasher.add(dashLen);
                         }
-                        newDashes = rdrCtx.getDirtyFloatArray(dashLen);
+                        newDashes = rdrCtx.dasher.dashes_ref.getArray(dashLen);
                     }
                     System.arraycopy(dashes, 0, newDashes, 0, dashLen);
                     dashes = newDashes;
@@ -400,8 +424,8 @@
         }
         pc2d = transformerPC2D.inverseDeltaTransformConsumer(pc2d, strokerat);
 
-        final PathIterator pi = getNormalizingPathIterator(rdrCtx, normalize,
-                                    src.getPathIterator(at));
+        final PathIterator pi = norm.getNormalizingPathIterator(rdrCtx,
+                                         src.getPathIterator(at));
 
         pathTo(rdrCtx, pi, pc2d);
 
@@ -424,25 +448,6 @@
         return Math.abs(num) < 2.0 * Math.ulp(num);
     }
 
-    PathIterator getNormalizingPathIterator(final RendererContext rdrCtx,
-                                            final NormMode mode,
-                                            final PathIterator src)
-    {
-        switch (mode) {
-            case ON_WITH_AA:
-                // NormalizingPathIterator NearestPixelCenter:
-                return rdrCtx.nPCPathIterator.init(src);
-            case ON_NO_AA:
-                // NearestPixel NormalizingPathIterator:
-                return rdrCtx.nPQPathIterator.init(src);
-            case OFF:
-                // return original path iterator if normalization is disabled:
-                return src;
-            default:
-                throw new InternalError("Unrecognized normalization mode");
-        }
-    }
-
     abstract static class NormalizingPathIterator implements PathIterator {
 
         private PathIterator src;
@@ -792,8 +797,8 @@
 
             if (bs == null) {
                 // fill shape:
-                final PathIterator pi = getNormalizingPathIterator(rdrCtx, norm,
-                                            s.getPathIterator(_at));
+                final PathIterator pi = norm.getNormalizingPathIterator(rdrCtx,
+                                                 s.getPathIterator(_at));
 
                 // note: Winding rule may be EvenOdd ONLY for fill operations !
                 r = rdrCtx.renderer.init(clip.getLoX(), clip.getLoY(),
@@ -1021,8 +1026,11 @@
         logInfo("sun.java2d.renderer.useRef           = "
                 + refType);
 
+        logInfo("sun.java2d.renderer.edges            = "
+                + MarlinConst.INITIAL_EDGES_COUNT);
         logInfo("sun.java2d.renderer.pixelsize        = "
                 + MarlinConst.INITIAL_PIXEL_DIM);
+
         logInfo("sun.java2d.renderer.subPixel_log2_X  = "
                 + MarlinConst.SUBPIXEL_LG_POSITIONS_X);
         logInfo("sun.java2d.renderer.subPixel_log2_Y  = "
@@ -1076,6 +1084,11 @@
         logInfo("CUB_INC_BND  = " + Renderer.CUB_INC_BND);
         logInfo("QUAD_DEC_BND = " + Renderer.QUAD_DEC_BND);
 
+        logInfo("INITIAL_EDGES_CAPACITY               = "
+                + MarlinConst.INITIAL_EDGES_CAPACITY);
+        logInfo("INITIAL_CROSSING_COUNT               = "
+                + Renderer.INITIAL_CROSSING_COUNT);
+
         logInfo("=========================================================="
                 + "=====================");
     }
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Renderer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Renderer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -43,9 +43,9 @@
     private static final double POWER_2_TO_32 = 0x1.0p32;
 
     // use float to make tosubpix methods faster (no int to float conversion)
-    public static final float f_SUBPIXEL_POSITIONS_X
+    public static final float F_SUBPIXEL_POSITIONS_X
         = (float) SUBPIXEL_POSITIONS_X;
-    public static final float f_SUBPIXEL_POSITIONS_Y
+    public static final float F_SUBPIXEL_POSITIONS_Y
         = (float) SUBPIXEL_POSITIONS_Y;
     public static final int SUBPIXEL_MASK_X = SUBPIXEL_POSITIONS_X - 1;
     public static final int SUBPIXEL_MASK_Y = SUBPIXEL_POSITIONS_Y - 1;
@@ -58,6 +58,9 @@
     static final int INITIAL_BUCKET_ARRAY
         = INITIAL_PIXEL_DIM * SUBPIXEL_POSITIONS_Y;
 
+    // crossing capacity = edges count / 8 ~ 512
+    static final int INITIAL_CROSSING_COUNT = INITIAL_EDGES_COUNT >> 3;
+
     public static final int WIND_EVEN_ODD = 0;
     public static final int WIND_NON_ZERO = 1;
 
@@ -136,14 +139,15 @@
     // max used for both edgePtrs and crossings (stats only)
     private int activeEdgeMaxUsed;
 
-    // per-thread initial arrays (large enough to satisfy most usages) (1024)
-    private final int[] crossings_initial = new int[INITIAL_SMALL_ARRAY]; // 4K
-    // +1 to avoid recycling in Helpers.widenArray()
-    private final int[] edgePtrs_initial  = new int[INITIAL_SMALL_ARRAY + 1]; // 4K
+    // crossings ref (dirty)
+    private final IntArrayCache.Reference crossings_ref;
+    // edgePtrs ref (dirty)
+    private final IntArrayCache.Reference edgePtrs_ref;
     // merge sort initial arrays (large enough to satisfy most usages) (1024)
-    private final int[] aux_crossings_initial = new int[INITIAL_SMALL_ARRAY]; // 4K
-    // +1 to avoid recycling in Helpers.widenArray()
-    private final int[] aux_edgePtrs_initial  = new int[INITIAL_SMALL_ARRAY + 1]; // 4K
+    // aux_crossings ref (dirty)
+    private final IntArrayCache.Reference aux_crossings_ref;
+    // aux_edgePtrs ref (dirty)
+    private final IntArrayCache.Reference aux_edgePtrs_ref;
 
 //////////////////////////////////////////////////////////////////////////////
 //  EDGE LIST
@@ -164,11 +168,10 @@
     // sum of each edge delta Y (subpixels)
     private int edgeSumDeltaY;
 
-    // +1 to avoid recycling in Helpers.widenArray()
-    private final int[] edgeBuckets_initial
-        = new int[INITIAL_BUCKET_ARRAY + 1]; // 64K
-    private final int[] edgeBucketCounts_initial
-        = new int[INITIAL_BUCKET_ARRAY + 1]; // 64K
+    // edgeBuckets ref (clean)
+    private final IntArrayCache.Reference edgeBuckets_ref;
+    // edgeBucketCounts ref (clean)
+    private final IntArrayCache.Reference edgeBucketCounts_ref;
 
     // Flattens using adaptive forward differencing. This only carries out
     // one iteration of the AFD loop. All it does is update AFD variables (i.e.
@@ -402,7 +405,8 @@
             // suppose _edges.length > _SIZEOF_EDGE_BYTES
             // so doubling size is enough to add needed bytes
             // note: throw IOOB if neededSize > 2Gb:
-            final long edgeNewSize = ArrayCache.getNewLargeSize(_edges.length,
+            final long edgeNewSize = ArrayCacheConst.getNewLargeSize(
+                                        _edges.length,
                                         edgePtr + _SIZEOF_EDGE_BYTES);
 
             if (DO_STATS) {
@@ -514,28 +518,52 @@
     // dirty curve
     private final Curve curve;
 
+    // clean alpha array (zero filled)
+    private int[] alphaLine;
+
+    // alphaLine ref (clean)
+    private final IntArrayCache.Reference alphaLine_ref;
+
+    private boolean enableBlkFlags = false;
+    private boolean prevUseBlkFlags = false;
+
+    /* block flags (0|1) */
+    private int[] blkFlags;
+
+    // blkFlags ref (clean)
+    private final IntArrayCache.Reference blkFlags_ref;
+
     Renderer(final RendererContext rdrCtx) {
         this.rdrCtx = rdrCtx;
 
-        this.edges = new OffHeapArray(rdrCtx.cleanerObj, INITIAL_EDGES_CAPACITY); // 96K
+        this.edges = rdrCtx.newOffHeapArray(INITIAL_EDGES_CAPACITY); // 96K
 
         this.curve = rdrCtx.curve;
 
-        edgeBuckets = edgeBuckets_initial;
-        edgeBucketCounts = edgeBucketCounts_initial;
+        edgeBuckets_ref      = rdrCtx.newCleanIntArrayRef(INITIAL_BUCKET_ARRAY); // 64K
+        edgeBucketCounts_ref = rdrCtx.newCleanIntArrayRef(INITIAL_BUCKET_ARRAY); // 64K
 
-        alphaLine  = alphaLine_initial;
+        edgeBuckets      = edgeBuckets_ref.initial;
+        edgeBucketCounts = edgeBucketCounts_ref.initial;
+
+        // 2048 (pixelsize) pixel large
+        alphaLine_ref = rdrCtx.newCleanIntArrayRef(INITIAL_AA_ARRAY); // 8K
+        alphaLine     = alphaLine_ref.initial;
 
         this.cache = rdrCtx.cache;
 
-        // ScanLine:
-        crossings     = crossings_initial;
-        aux_crossings = aux_crossings_initial;
-        edgePtrs      = edgePtrs_initial;
-        aux_edgePtrs  = aux_edgePtrs_initial;
+        crossings_ref     = rdrCtx.newDirtyIntArrayRef(INITIAL_CROSSING_COUNT); // 2K
+        aux_crossings_ref = rdrCtx.newDirtyIntArrayRef(INITIAL_CROSSING_COUNT); // 2K
+        edgePtrs_ref      = rdrCtx.newDirtyIntArrayRef(INITIAL_CROSSING_COUNT); // 2K
+        aux_edgePtrs_ref  = rdrCtx.newDirtyIntArrayRef(INITIAL_CROSSING_COUNT); // 2K
 
-        edgeCount = 0;
-        activeEdgeMaxUsed = 0;
+        crossings     = crossings_ref.initial;
+        aux_crossings = aux_crossings_ref.initial;
+        edgePtrs      = edgePtrs_ref.initial;
+        aux_edgePtrs  = aux_edgePtrs_ref.initial;
+
+        blkFlags_ref = rdrCtx.newCleanIntArrayRef(INITIAL_ARRAY); // 1K = 1 tile line
+        blkFlags     = blkFlags_ref.initial;
     }
 
     Renderer init(final int pix_boundsX, final int pix_boundsY,
@@ -569,8 +597,8 @@
                 rdrCtx.stats.stat_array_renderer_edgeBucketCounts
                     .add(edgeBucketsLength);
             }
-            edgeBuckets = rdrCtx.getIntArray(edgeBucketsLength);
-            edgeBucketCounts = rdrCtx.getIntArray(edgeBucketsLength);
+            edgeBuckets = edgeBuckets_ref.getArray(edgeBucketsLength);
+            edgeBucketCounts = edgeBucketCounts_ref.getArray(edgeBucketsLength);
         }
 
         edgeMinY = Integer.MAX_VALUE;
@@ -595,41 +623,19 @@
         if (DO_STATS) {
             rdrCtx.stats.stat_rdr_activeEdges.add(activeEdgeMaxUsed);
             rdrCtx.stats.stat_rdr_edges.add(edges.used);
-            rdrCtx.stats.stat_rdr_edges_count
-                .add(edges.used / SIZEOF_EDGE_BYTES);
-        }
-        if (DO_CLEAN_DIRTY) {
-            // Force zero-fill dirty arrays:
-            Arrays.fill(crossings,     0);
-            Arrays.fill(aux_crossings, 0);
-            Arrays.fill(edgePtrs,      0);
-            Arrays.fill(aux_edgePtrs,  0);
+            rdrCtx.stats.stat_rdr_edges_count.add(edges.used / SIZEOF_EDGE_BYTES);
+            rdrCtx.stats.hist_rdr_edges_count.add(edges.used / SIZEOF_EDGE_BYTES);
+            rdrCtx.stats.totalOffHeap += edges.length;
         }
         // Return arrays:
-        if (crossings != crossings_initial) {
-            rdrCtx.putDirtyIntArray(crossings);
-            crossings = crossings_initial;
-            if (aux_crossings != aux_crossings_initial) {
-                rdrCtx.putDirtyIntArray(aux_crossings);
-                aux_crossings = aux_crossings_initial;
-            }
-        }
-        if (edgePtrs != edgePtrs_initial) {
-            rdrCtx.putDirtyIntArray(edgePtrs);
-            edgePtrs = edgePtrs_initial;
-            if (aux_edgePtrs != aux_edgePtrs_initial) {
-                rdrCtx.putDirtyIntArray(aux_edgePtrs);
-                aux_edgePtrs = aux_edgePtrs_initial;
-            }
-        }
-        if (alphaLine != alphaLine_initial) {
-            rdrCtx.putIntArray(alphaLine, 0, 0); // already zero filled
-            alphaLine = alphaLine_initial;
-        }
-        if (blkFlags != blkFlags_initial) {
-            rdrCtx.putIntArray(blkFlags, 0, 0); // already zero filled
-            blkFlags = blkFlags_initial;
-        }
+        crossings = crossings_ref.putArray(crossings);
+        aux_crossings = aux_crossings_ref.putArray(aux_crossings);
+
+        edgePtrs = edgePtrs_ref.putArray(edgePtrs);
+        aux_edgePtrs = aux_edgePtrs_ref.putArray(aux_edgePtrs);
+
+        alphaLine = alphaLine_ref.putArray(alphaLine, 0, 0); // already zero filled
+        blkFlags  = blkFlags_ref.putArray(blkFlags, 0, 0); // already zero filled
 
         if (edgeMinY != Integer.MAX_VALUE) {
             // if context is maked as DIRTY:
@@ -639,30 +645,16 @@
                 buckets_minY = 0;
                 buckets_maxY = boundsMaxY - boundsMinY;
             }
-            // clear used part
-            if (edgeBuckets == edgeBuckets_initial) {
-                // fill only used part
-                IntArrayCache.fill(edgeBuckets,      buckets_minY,
-                                                     buckets_maxY,     0);
-                IntArrayCache.fill(edgeBucketCounts, buckets_minY,
-                                                     buckets_maxY + 1, 0);
-            } else {
-                 // clear only used part
-                rdrCtx.putIntArray(edgeBuckets,      buckets_minY,
-                                                     buckets_maxY);
-                edgeBuckets = edgeBuckets_initial;
-
-                rdrCtx.putIntArray(edgeBucketCounts, buckets_minY,
-                                                     buckets_maxY + 1);
-                edgeBucketCounts = edgeBucketCounts_initial;
-            }
-        } else if (edgeBuckets != edgeBuckets_initial) {
+            // clear only used part
+            edgeBuckets = edgeBuckets_ref.putArray(edgeBuckets, buckets_minY,
+                                                                buckets_maxY);
+            edgeBucketCounts = edgeBucketCounts_ref.putArray(edgeBucketCounts,
+                                                             buckets_minY,
+                                                             buckets_maxY + 1);
+        } else {
             // unused arrays
-            rdrCtx.putIntArray(edgeBuckets, 0, 0);
-            edgeBuckets = edgeBuckets_initial;
-
-            rdrCtx.putIntArray(edgeBucketCounts, 0, 0);
-            edgeBucketCounts = edgeBucketCounts_initial;
+            edgeBuckets = edgeBuckets_ref.putArray(edgeBuckets, 0, 0);
+            edgeBucketCounts = edgeBucketCounts_ref.putArray(edgeBucketCounts, 0, 0);
         }
 
         // At last: resize back off-heap edges to initial size
@@ -680,12 +672,12 @@
     }
 
     private static float tosubpixx(final float pix_x) {
-        return f_SUBPIXEL_POSITIONS_X * pix_x;
+        return F_SUBPIXEL_POSITIONS_X * pix_x;
     }
 
     private static float tosubpixy(final float pix_y) {
         // shift y by -0.5 for fast ceil(y - 0.5):
-        return f_SUBPIXEL_POSITIONS_Y * pix_y - 0.5f;
+        return F_SUBPIXEL_POSITIONS_Y * pix_y - 0.5f;
     }
 
     @Override
@@ -749,11 +741,6 @@
         throw new InternalError("Renderer does not use a native consumer.");
     }
 
-    // clean alpha array (zero filled)
-    private int[] alphaLine;
-    // 2048 (pixelsize) pixel large
-    private final int[] alphaLine_initial = new int[INITIAL_AA_ARRAY]; // 8K
-
     private void _endRendering(final int ymin, final int ymax) {
         if (DISABLE_RENDER) {
             return;
@@ -857,8 +844,7 @@
             // bucketCount indicates new edge / edge end:
             if (bucketcount != 0) {
                 if (DO_STATS) {
-                    rdrCtx.stats.stat_rdr_activeEdges_updates
-                        .add(numCrossings);
+                    rdrCtx.stats.stat_rdr_activeEdges_updates.add(numCrossings);
                 }
 
                 // last bit set to 1 means that edges ends
@@ -883,38 +869,33 @@
 
                 if (ptrLen != 0) {
                     if (DO_STATS) {
-                        rdrCtx.stats.stat_rdr_activeEdges_adds
-                            .add(ptrLen);
+                        rdrCtx.stats.stat_rdr_activeEdges_adds.add(ptrLen);
                         if (ptrLen > 10) {
-                            rdrCtx.stats.stat_rdr_activeEdges_adds_high
-                                .add(ptrLen);
+                            rdrCtx.stats.stat_rdr_activeEdges_adds_high.add(ptrLen);
                         }
                     }
                     ptrEnd = numCrossings + ptrLen;
 
                     if (edgePtrsLen < ptrEnd) {
                         if (DO_STATS) {
-                            rdrCtx.stats.stat_array_renderer_edgePtrs
-                                .add(ptrEnd);
+                            rdrCtx.stats.stat_array_renderer_edgePtrs.add(ptrEnd);
                         }
                         this.edgePtrs = _edgePtrs
-                            = rdrCtx.widenDirtyIntArray(_edgePtrs, numCrossings,
-                                                        ptrEnd);
+                            = edgePtrs_ref.widenArray(_edgePtrs, numCrossings,
+                                                      ptrEnd);
 
                         edgePtrsLen = _edgePtrs.length;
                         // Get larger auxiliary storage:
-                        if (_aux_edgePtrs != aux_edgePtrs_initial) {
-                            rdrCtx.putDirtyIntArray(_aux_edgePtrs);
-                        }
+                        aux_edgePtrs_ref.putArray(_aux_edgePtrs);
+
                         // use ArrayCache.getNewSize() to use the same growing
-                        // factor than widenDirtyIntArray():
+                        // factor than widenArray():
                         if (DO_STATS) {
-                            rdrCtx.stats.stat_array_renderer_aux_edgePtrs
-                                .add(ptrEnd);
+                            rdrCtx.stats.stat_array_renderer_aux_edgePtrs.add(ptrEnd);
                         }
                         this.aux_edgePtrs = _aux_edgePtrs
-                            = rdrCtx.getDirtyIntArray(
-                                ArrayCache.getNewSize(numCrossings, ptrEnd)
+                            = aux_edgePtrs_ref.getArray(
+                                ArrayCacheConst.getNewSize(numCrossings, ptrEnd)
                             );
                     }
 
@@ -933,26 +914,24 @@
 
                     if (crossingsLen < numCrossings) {
                         // Get larger array:
-                        if (_crossings != crossings_initial) {
-                            rdrCtx.putDirtyIntArray(_crossings);
-                        }
+                        crossings_ref.putArray(_crossings);
+
                         if (DO_STATS) {
                             rdrCtx.stats.stat_array_renderer_crossings
                                 .add(numCrossings);
                         }
                         this.crossings = _crossings
-                            = rdrCtx.getDirtyIntArray(numCrossings);
+                            = crossings_ref.getArray(numCrossings);
 
                         // Get larger auxiliary storage:
-                        if (_aux_crossings != aux_crossings_initial) {
-                            rdrCtx.putDirtyIntArray(_aux_crossings);
-                        }
+                        aux_crossings_ref.putArray(_aux_crossings);
+
                         if (DO_STATS) {
                             rdrCtx.stats.stat_array_renderer_aux_crossings
                                 .add(numCrossings);
                         }
                         this.aux_crossings = _aux_crossings
-                            = rdrCtx.getDirtyIntArray(numCrossings);
+                            = aux_crossings_ref.getArray(numCrossings);
 
                         crossingsLen = _crossings.length;
                     }
@@ -973,10 +952,8 @@
                  */
                 if ((ptrLen < 10) || (numCrossings < 40)) {
                     if (DO_STATS) {
-                        rdrCtx.stats.hist_rdr_crossings
-                            .add(numCrossings);
-                        rdrCtx.stats.hist_rdr_crossings_adds
-                            .add(ptrLen);
+                        rdrCtx.stats.hist_rdr_crossings.add(numCrossings);
+                        rdrCtx.stats.hist_rdr_crossings_adds.add(ptrLen);
                     }
 
                     /*
@@ -1019,23 +996,20 @@
                         _unsafe.putInt(addr + _OFF_ERROR, (err & _ERR_STEP_MAX));
 
                         if (DO_STATS) {
-                            rdrCtx.stats.stat_rdr_crossings_updates
-                                .add(numCrossings);
+                            rdrCtx.stats.stat_rdr_crossings_updates.add(numCrossings);
                         }
 
                         // insertion sort of crossings:
                         if (cross < lastCross) {
                             if (DO_STATS) {
-                                rdrCtx.stats.stat_rdr_crossings_sorts
-                                    .add(i);
+                                rdrCtx.stats.stat_rdr_crossings_sorts.add(i);
                             }
 
                             /* use binary search for newly added edges
                                in crossings if arrays are large enough */
                             if (useBinarySearch && (i >= prevNumCrossings)) {
                                 if (DO_STATS) {
-                                    rdrCtx.stats.
-                                        stat_rdr_crossings_bsearch.add(i);
+                                    rdrCtx.stats.stat_rdr_crossings_bsearch.add(i);
                                 }
                                 low = 0;
                                 high = i - 1;
@@ -1078,14 +1052,11 @@
                     }
                 } else {
                     if (DO_STATS) {
-                        rdrCtx.stats.stat_rdr_crossings_msorts
-                            .add(numCrossings);
+                        rdrCtx.stats.stat_rdr_crossings_msorts.add(numCrossings);
                         rdrCtx.stats.hist_rdr_crossings_ratio
                             .add((1000 * ptrLen) / numCrossings);
-                        rdrCtx.stats.hist_rdr_crossings_msorts
-                            .add(numCrossings);
-                        rdrCtx.stats.hist_rdr_crossings_msorts_adds
-                            .add(ptrLen);
+                        rdrCtx.stats.hist_rdr_crossings_msorts.add(numCrossings);
+                        rdrCtx.stats.hist_rdr_crossings_msorts_adds.add(ptrLen);
                     }
 
                     // Copy sorted data in auxiliary arrays
@@ -1125,8 +1096,7 @@
                         _unsafe.putInt(addr + _OFF_ERROR, (err & _ERR_STEP_MAX));
 
                         if (DO_STATS) {
-                            rdrCtx.stats.stat_rdr_crossings_updates
-                                .add(numCrossings);
+                            rdrCtx.stats.stat_rdr_crossings_updates.add(numCrossings);
                         }
 
                         if (i >= prevNumCrossings) {
@@ -1136,8 +1106,7 @@
 
                         } else if (cross < lastCross) {
                             if (DO_STATS) {
-                                rdrCtx.stats.stat_rdr_crossings_sorts
-                                    .add(i);
+                                rdrCtx.stats.stat_rdr_crossings_sorts.add(i);
                             }
 
                             // (straight) insertion sort of crossings:
@@ -1462,7 +1431,7 @@
                 // note: +2 to ensure enough space left at end
                 final int nxTiles = ((pmaxX - pminX) >> TILE_SIZE_LG) + 2;
                 if (nxTiles > INITIAL_ARRAY) {
-                    blkFlags = rdrCtx.getIntArray(nxTiles);
+                    blkFlags = blkFlags_ref.getArray(nxTiles);
                 }
             }
         }
@@ -1494,10 +1463,9 @@
         // Useful when processing tile line by tile line
         if (width > INITIAL_AA_ARRAY) {
             if (DO_STATS) {
-                rdrCtx.stats.stat_array_renderer_alphaline
-                    .add(width);
+                rdrCtx.stats.stat_array_renderer_alphaline.add(width);
             }
-            alphaLine = rdrCtx.getIntArray(width);
+            alphaLine = alphaLine_ref.getArray(width);
         }
 
         // process first tile line:
@@ -1532,13 +1500,6 @@
         }
     }
 
-    private boolean enableBlkFlags = false;
-    private boolean prevUseBlkFlags = false;
-
-    private final int[] blkFlags_initial = new int[INITIAL_ARRAY]; // 1 tile line
-    /* block flags (0|1) */
-    private int[] blkFlags = blkFlags_initial;
-
     void copyAARow(final int[] alphaRow,
                    final int pix_y, final int pix_from, final int pix_to,
                    final boolean useBlockFlags)
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/RendererContext.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/RendererContext.java	Wed Jul 05 22:06:46 2017 +0200
@@ -29,10 +29,8 @@
 import java.lang.ref.WeakReference;
 import java.util.concurrent.atomic.AtomicInteger;
 import sun.java2d.ReentrantContext;
-import sun.java2d.ReentrantContextProvider;
-import static sun.java2d.marlin.ArrayCache.*;
+import sun.java2d.marlin.ArrayCacheConst.CacheStats;
 import sun.java2d.marlin.MarlinRenderingEngine.NormalizingPathIterator;
-import static sun.java2d.marlin.MarlinUtils.logInfo;
 
 /**
  * This class is a renderer context dedicated to a single thread
@@ -41,12 +39,6 @@
 
     // RendererContext creation counter
     private static final AtomicInteger CTX_COUNT = new AtomicInteger(1);
-    // RendererContext statistics
-    final RendererStats stats = (DO_STATS || DO_MONITORS)
-                                       ? RendererStats.getInstance(): null;
-
-    private static final boolean USE_CACHE_HARD_REF = DO_STATS
-        || (MarlinRenderingEngine.REF_TYPE == ReentrantContextProvider.REF_WEAK);
 
     /**
      * Create a new renderer context
@@ -54,25 +46,14 @@
      * @return new RendererContext instance
      */
     static RendererContext createContext() {
-        final RendererContext newCtx = new RendererContext("ctx"
-                    + Integer.toString(CTX_COUNT.getAndIncrement()));
-
-        if (DO_STATS || DO_MONITORS) {
-            RendererStats.ALL_CONTEXTS.add(newCtx);
-        }
-        return newCtx;
+        return new RendererContext("ctx"
+                       + Integer.toString(CTX_COUNT.getAndIncrement()));
     }
 
-    // context name (debugging purposes)
-    final String name;
     // Smallest object used as Cleaner's parent reference
-    final Object cleanerObj = new Object();
+    private final Object cleanerObj;
     // dirty flag indicating an exception occured during pipeline in pathTo()
     boolean dirty = false;
-    // dynamic array caches kept using weak reference (low memory footprint)
-    WeakReference<ArrayCachesHolder> refArrayCaches = null;
-    // hard reference to array caches (for statistics)
-    ArrayCachesHolder hardRefArrayCaches = null;
     // shared data
     final float[] float6 = new float[6];
     // shared curve (dirty) (Renderer / Stroker)
@@ -83,8 +64,8 @@
     final NormalizingPathIterator nPQPathIterator;
     // MarlinRenderingEngine.TransformingPathConsumer2D
     final TransformingPathConsumer2D transformerPC2D;
-    // recycled Path2D instance
-    Path2D.Float p2d = null;
+    // recycled Path2D instance (weak)
+    private WeakReference<Path2D.Float> refPath2D = null;
     final Renderer renderer;
     final Stroker stroker;
     // Simplifies out collinear lines
@@ -95,6 +76,19 @@
     // flag indicating the shape is stroked (1) or filled (0)
     int stroking = 0;
 
+    // Array caches:
+    /* clean int[] cache (zero-filled) = 5 refs */
+    private final IntArrayCache cleanIntCache = new IntArrayCache(true, 5);
+    /* dirty int[] cache = 4 refs */
+    private final IntArrayCache dirtyIntCache = new IntArrayCache(false, 4);
+    /* dirty float[] cache = 3 refs */
+    private final FloatArrayCache dirtyFloatCache = new FloatArrayCache(false, 3);
+    /* dirty byte[] cache = 1 ref */
+    private final ByteArrayCache dirtyByteCache = new ByteArrayCache(false, 1);
+
+    // RendererContext statistics
+    final RendererStats stats;
+
     /**
      * Constructor
      *
@@ -104,8 +98,18 @@
         if (LOG_CREATE_CONTEXT) {
             MarlinUtils.logInfo("new RendererContext = " + name);
         }
+        this.cleanerObj = new Object();
 
-        this.name = name;
+        // create first stats (needed by newOffHeapArray):
+        if (DO_STATS || DO_MONITORS) {
+            stats = RendererStats.createInstance(cleanerObj, name);
+            // push cache stats:
+            stats.cacheStats = new CacheStats[] { cleanIntCache.stats,
+                dirtyIntCache.stats, dirtyFloatCache.stats, dirtyByteCache.stats
+            };
+        } else {
+            stats = null;
+        }
 
         // NormalizingPathIterator instances:
         nPCPathIterator = new NormalizingPathIterator.NearestPixelCenter(float6);
@@ -128,11 +132,13 @@
      * clean up before reusing this context
      */
     void dispose() {
+        if (DO_STATS) {
+            if (stats.totalOffHeap > stats.totalOffHeapMax) {
+                stats.totalOffHeapMax = stats.totalOffHeap;
+            }
+            stats.totalOffHeap = 0L;
+        }
         stroking = 0;
-        // reset hard reference to array caches if needed:
-        if (!USE_CACHE_HARD_REF) {
-            hardRefArrayCaches = null;
-        }
         // if context is maked as DIRTY:
         if (dirty) {
             // may happen if an exception if thrown in the pipeline processing:
@@ -151,300 +157,43 @@
         }
     }
 
-    // Array caches
-    ArrayCachesHolder getArrayCachesHolder() {
-        // Use hard reference first (cached resolved weak reference):
-        ArrayCachesHolder holder = hardRefArrayCaches;
-        if (holder == null) {
-            // resolve reference:
-            holder = (refArrayCaches != null)
-                     ? refArrayCaches.get()
-                     : null;
-            // create a new ArrayCachesHolder if none is available
-            if (holder == null) {
-                if (LOG_CREATE_CONTEXT) {
-                    MarlinUtils.logInfo("new ArrayCachesHolder for "
-                                        + "RendererContext = " + name);
-                }
-
-                holder = new ArrayCachesHolder();
-
-                if (USE_CACHE_HARD_REF) {
-                    // update hard reference:
-                    hardRefArrayCaches = holder;
-                } else {
-                    // update weak reference:
-                    refArrayCaches = new WeakReference<ArrayCachesHolder>(holder);
-                }
-            }
-        }
-        return holder;
-    }
+    Path2D.Float getPath2D() {
+        // resolve reference:
+        Path2D.Float p2d
+            = (refPath2D != null) ? refPath2D.get() : null;
 
-    // dirty byte array cache
-    ByteArrayCache getDirtyByteArrayCache(final int length) {
-        final int bucket = ArrayCache.getBucketDirtyBytes(length);
-        return getArrayCachesHolder().dirtyByteArrayCaches[bucket];
-    }
-
-    byte[] getDirtyByteArray(final int length) {
-        if (length <= MAX_DIRTY_BYTE_ARRAY_SIZE) {
-            return getDirtyByteArrayCache(length).getArray();
-        }
-
-        if (DO_STATS) {
-            incOversize();
-        }
-
-        if (DO_LOG_OVERSIZE) {
-            logInfo("getDirtyByteArray[oversize]: length=\t" + length);
-        }
+        // create a new Path2D ?
+        if (p2d == null) {
+            p2d = new Path2D.Float(Path2D.WIND_NON_ZERO, INITIAL_EDGES_COUNT); // 32K
 
-        return new byte[length];
-    }
-
-    void putDirtyByteArray(final byte[] array) {
-        final int length = array.length;
-        // odd sized array are non-cached arrays (initial arrays)
-        // ensure to never store initial arrays in cache:
-        if (((length & 0x1) == 0) && (length <= MAX_DIRTY_BYTE_ARRAY_SIZE)) {
-            getDirtyByteArrayCache(length).putDirtyArray(array, length);
-        }
-    }
-
-    byte[] widenDirtyByteArray(final byte[] in,
-                               final int usedSize, final int needSize)
-    {
-        final int length = in.length;
-        if (DO_CHECKS && length >= needSize) {
-            return in;
+            // update weak reference:
+            refPath2D = new WeakReference<Path2D.Float>(p2d);
         }
-        if (DO_STATS) {
-            incResizeDirtyByte();
-        }
-
-        // maybe change bucket:
-        // ensure getNewSize() > newSize:
-        final byte[] res = getDirtyByteArray(getNewSize(usedSize, needSize));
-
-        System.arraycopy(in, 0, res, 0, usedSize); // copy only used elements
-
-        // maybe return current array:
-        // NO clean-up of array data = DIRTY ARRAY
-        putDirtyByteArray(in);
-
-        if (DO_LOG_WIDEN_ARRAY) {
-            logInfo("widenDirtyByteArray[" + res.length + "]: usedSize=\t"
-                    + usedSize + "\tlength=\t" + length + "\tneeded length=\t"
-                    + needSize);
-        }
-        return res;
-    }
-
-    // int array cache
-    IntArrayCache getIntArrayCache(final int length) {
-        final int bucket = ArrayCache.getBucket(length);
-        return getArrayCachesHolder().intArrayCaches[bucket];
-    }
-
-    int[] getIntArray(final int length) {
-        if (length <= MAX_ARRAY_SIZE) {
-            return getIntArrayCache(length).getArray();
-        }
-
-        if (DO_STATS) {
-            incOversize();
-        }
-
-        if (DO_LOG_OVERSIZE) {
-            logInfo("getIntArray[oversize]: length=\t" + length);
-        }
-
-        return new int[length];
-    }
-
-    // unused
-    int[] widenIntArray(final int[] in, final int usedSize,
-                        final int needSize, final int clearTo)
-    {
-        final int length = in.length;
-        if (DO_CHECKS && length >= needSize) {
-            return in;
-        }
-        if (DO_STATS) {
-            incResizeInt();
-        }
-
-        // maybe change bucket:
-        // ensure getNewSize() > newSize:
-        final int[] res = getIntArray(getNewSize(usedSize, needSize));
-
-        System.arraycopy(in, 0, res, 0, usedSize); // copy only used elements
-
-        // maybe return current array:
-        putIntArray(in, 0, clearTo); // ensure all array is cleared (grow-reduce algo)
-
-        if (DO_LOG_WIDEN_ARRAY) {
-            logInfo("widenIntArray[" + res.length + "]: usedSize=\t"
-                    + usedSize + "\tlength=\t" + length + "\tneeded length=\t"
-                    + needSize);
-        }
-        return res;
+        // reset the path anyway:
+        p2d.reset();
+        return p2d;
     }
 
-    void putIntArray(final int[] array, final int fromIndex,
-                     final int toIndex)
-    {
-        final int length = array.length;
-        // odd sized array are non-cached arrays (initial arrays)
-        // ensure to never store initial arrays in cache:
-        if (((length & 0x1) == 0) && (length <= MAX_ARRAY_SIZE)) {
-            getIntArrayCache(length).putArray(array, length, fromIndex, toIndex);
+    OffHeapArray newOffHeapArray(final long initialSize) {
+        if (DO_STATS) {
+            stats.totalOffHeapInitial += initialSize;
         }
-    }
-
-    // dirty int array cache
-    IntArrayCache getDirtyIntArrayCache(final int length) {
-        final int bucket = ArrayCache.getBucket(length);
-        return getArrayCachesHolder().dirtyIntArrayCaches[bucket];
-    }
-
-    int[] getDirtyIntArray(final int length) {
-        if (length <= MAX_ARRAY_SIZE) {
-            return getDirtyIntArrayCache(length).getArray();
-        }
-
-        if (DO_STATS) {
-            incOversize();
-        }
-
-        if (DO_LOG_OVERSIZE) {
-            logInfo("getDirtyIntArray[oversize]: length=\t" + length);
-        }
-
-        return new int[length];
+        return new OffHeapArray(cleanerObj, initialSize);
     }
 
-    int[] widenDirtyIntArray(final int[] in,
-                             final int usedSize, final int needSize)
-    {
-        final int length = in.length;
-        if (DO_CHECKS && length >= needSize) {
-            return in;
-        }
-        if (DO_STATS) {
-            incResizeDirtyInt();
-        }
-
-        // maybe change bucket:
-        // ensure getNewSize() > newSize:
-        final int[] res = getDirtyIntArray(getNewSize(usedSize, needSize));
-
-        System.arraycopy(in, 0, res, 0, usedSize); // copy only used elements
-
-        // maybe return current array:
-        // NO clean-up of array data = DIRTY ARRAY
-        putDirtyIntArray(in);
-
-        if (DO_LOG_WIDEN_ARRAY) {
-            logInfo("widenDirtyIntArray[" + res.length + "]: usedSize=\t"
-                    + usedSize + "\tlength=\t" + length + "\tneeded length=\t"
-                    + needSize);
-        }
-        return res;
-    }
-
-    void putDirtyIntArray(final int[] array) {
-        final int length = array.length;
-        // odd sized array are non-cached arrays (initial arrays)
-        // ensure to never store initial arrays in cache:
-        if (((length & 0x1) == 0) && (length <= MAX_ARRAY_SIZE)) {
-            getDirtyIntArrayCache(length).putDirtyArray(array, length);
-        }
-    }
-
-    // dirty float array cache
-    FloatArrayCache getDirtyFloatArrayCache(final int length) {
-        final int bucket = ArrayCache.getBucket(length);
-        return getArrayCachesHolder().dirtyFloatArrayCaches[bucket];
+    IntArrayCache.Reference newCleanIntArrayRef(final int initialSize) {
+        return cleanIntCache.createRef(initialSize);
     }
 
-    float[] getDirtyFloatArray(final int length) {
-        if (length <= MAX_ARRAY_SIZE) {
-            return getDirtyFloatArrayCache(length).getArray();
-        }
-
-        if (DO_STATS) {
-            incOversize();
-        }
-
-        if (DO_LOG_OVERSIZE) {
-            logInfo("getDirtyFloatArray[oversize]: length=\t" + length);
-        }
-
-        return new float[length];
+    IntArrayCache.Reference newDirtyIntArrayRef(final int initialSize) {
+        return dirtyIntCache.createRef(initialSize);
     }
 
-    float[] widenDirtyFloatArray(final float[] in,
-                                 final int usedSize, final int needSize)
-    {
-        final int length = in.length;
-        if (DO_CHECKS && length >= needSize) {
-            return in;
-        }
-        if (DO_STATS) {
-            incResizeDirtyFloat();
-        }
-
-        // maybe change bucket:
-        // ensure getNewSize() > newSize:
-        final float[] res = getDirtyFloatArray(getNewSize(usedSize, needSize));
-
-        System.arraycopy(in, 0, res, 0, usedSize); // copy only used elements
-
-        // maybe return current array:
-        // NO clean-up of array data = DIRTY ARRAY
-        putDirtyFloatArray(in);
-
-        if (DO_LOG_WIDEN_ARRAY) {
-            logInfo("widenDirtyFloatArray[" + res.length + "]: usedSize=\t"
-                    + usedSize + "\tlength=\t" + length + "\tneeded length=\t"
-                    + needSize);
-        }
-        return res;
+    FloatArrayCache.Reference newDirtyFloatArrayRef(final int initialSize) {
+        return dirtyFloatCache.createRef(initialSize);
     }
 
-    void putDirtyFloatArray(final float[] array) {
-        final int length = array.length;
-        // odd sized array are non-cached arrays (initial arrays)
-        // ensure to never store initial arrays in cache:
-        if (((length & 0x1) == 0) && (length <= MAX_ARRAY_SIZE)) {
-            getDirtyFloatArrayCache(length).putDirtyArray(array, length);
-        }
-    }
-
-    /* class holding all array cache instances */
-    static final class ArrayCachesHolder {
-        // zero-filled int array cache:
-        final IntArrayCache[] intArrayCaches;
-        // dirty array caches:
-        final IntArrayCache[] dirtyIntArrayCaches;
-        final FloatArrayCache[] dirtyFloatArrayCaches;
-        final ByteArrayCache[] dirtyByteArrayCaches;
-
-        ArrayCachesHolder() {
-            intArrayCaches = new IntArrayCache[BUCKETS];
-            dirtyIntArrayCaches = new IntArrayCache[BUCKETS];
-            dirtyFloatArrayCaches = new FloatArrayCache[BUCKETS];
-            dirtyByteArrayCaches = new ByteArrayCache[BUCKETS];
-
-            for (int i = 0; i < BUCKETS; i++) {
-                intArrayCaches[i] = new IntArrayCache(ARRAY_SIZES[i]);
-                // dirty array caches:
-                dirtyIntArrayCaches[i] = new IntArrayCache(ARRAY_SIZES[i]);
-                dirtyFloatArrayCaches[i] = new FloatArrayCache(ARRAY_SIZES[i]);
-                dirtyByteArrayCaches[i] = new ByteArrayCache(DIRTY_BYTE_ARRAY_SIZES[i]);
-            }
-        }
+    ByteArrayCache.Reference newDirtyByteArrayRef(final int initialSize) {
+        return dirtyByteCache.createRef(initialSize);
     }
 }
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/RendererStats.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/RendererStats.java	Wed Jul 05 22:06:46 2017 +0200
@@ -30,6 +30,8 @@
 import java.util.Timer;
 import java.util.TimerTask;
 import java.util.concurrent.ConcurrentLinkedQueue;
+import jdk.internal.ref.CleanerFactory;
+import sun.java2d.marlin.ArrayCacheConst.CacheStats;
 import static sun.java2d.marlin.MarlinUtils.logInfo;
 import sun.java2d.marlin.stats.Histogram;
 import sun.java2d.marlin.stats.Monitor;
@@ -41,26 +43,22 @@
  */
 public final class RendererStats implements MarlinConst {
 
-    // singleton
-    private static volatile RendererStats SINGLETON = null;
+    static RendererStats createInstance(final Object parent, final String name)
+    {
+        final RendererStats stats = new RendererStats(name);
 
-    static RendererStats getInstance() {
-        if (SINGLETON == null) {
-            SINGLETON = new RendererStats();
-        }
-        return SINGLETON;
+        // Keep a strong reference to dump it later:
+        RendererStatsHolder.getInstance().add(parent, stats);
+
+        return stats;
     }
 
     public static void dumpStats() {
-        if (SINGLETON != null) {
-            SINGLETON.dump();
-        }
+        RendererStatsHolder.dumpStats();
     }
 
-    /* RendererContext collection as hard references
-       (only used for debugging purposes) */
-    static final ConcurrentLinkedQueue<RendererContext> ALL_CONTEXTS
-        = new ConcurrentLinkedQueue<RendererContext>();
+    // context name (debugging purposes)
+    final String name;
     // stats
     final StatLong stat_cache_rowAA
         = new StatLong("cache.rowAA");
@@ -118,7 +116,7 @@
     final StatLong stat_array_stroker_polystack_curveTypes
         = new StatLong("array.stroker.polystack.curveTypes.d_byte");
     final StatLong stat_array_marlincache_rowAAChunk
-        = new StatLong("array.marlincache.rowAAChunk.d_byte");
+        = new StatLong("array.marlincache.rowAAChunk.resize");
     final StatLong stat_array_marlincache_touchedTile
         = new StatLong("array.marlincache.touchedTile.int");
     final StatLong stat_array_renderer_alphaline
@@ -136,6 +134,10 @@
     final StatLong stat_array_renderer_aux_edgePtrs
         = new StatLong("array.renderer.aux_edgePtrs.int");
     // histograms
+    final Histogram hist_rdr_edges_count
+        = new Histogram("renderer.edges.count");
+    final Histogram hist_rdr_poly_stack_curves
+        = new Histogram("renderer.polystack.curves");
     final Histogram hist_rdr_crossings
         = new Histogram("renderer.crossings");
     final Histogram hist_rdr_crossings_ratio
@@ -181,6 +183,8 @@
         stat_rdr_crossings_sorts,
         stat_rdr_crossings_bsearch,
         stat_rdr_crossings_msorts,
+        hist_rdr_edges_count,
+        hist_rdr_poly_stack_curves,
         hist_rdr_crossings,
         hist_rdr_crossings_ratio,
         hist_rdr_crossings_adds,
@@ -233,95 +237,145 @@
         mon_ptg_getAlpha,
         mon_debug
     };
-
-    private RendererStats() {
-        super();
+    // offheap stats
+    long totalOffHeapInitial = 0L;
+     // live accumulator
+    long totalOffHeap = 0L;
+    long totalOffHeapMax = 0L;
+    // cache stats
+    CacheStats[] cacheStats = null;
 
-        AccessController.doPrivileged(
-            (PrivilegedAction<Void>) () -> {
-                final Thread hook = new Thread(
-                    ThreadGroupUtils.getRootThreadGroup(),
-                    new Runnable() {
-                        @Override
-                        public void run() {
-                            dump();
-                        }
-                    },
-                    "MarlinStatsHook"
-                );
-                hook.setContextClassLoader(null);
-                Runtime.getRuntime().addShutdownHook(hook);
-
-                if (USE_DUMP_THREAD) {
-                    final Timer statTimer = new Timer("RendererStats");
-                    statTimer.scheduleAtFixedRate(new TimerTask() {
-                        @Override
-                        public void run() {
-                            dump();
-                        }
-                    }, DUMP_INTERVAL, DUMP_INTERVAL);
-                }
-                return null;
-            }
-        );
+    private RendererStats(final String name) {
+        this.name = name;
     }
 
     void dump() {
-        if (DO_STATS) {
-            ArrayCache.dumpStats();
-        }
-        for (RendererContext rdrCtx : ALL_CONTEXTS) {
-            logInfo("RendererContext: " + rdrCtx.name);
+        logInfo("RendererContext: " + name);
 
-            if (DO_MONITORS) {
+        if (DO_MONITORS) {
+            for (Monitor monitor : monitors) {
+                if (monitor.count != 0) {
+                    logInfo(monitor.toString());
+                }
+            }
+            // As getAATileGenerator percents:
+            final long total = mon_pre_getAATileGenerator.sum;
+            if (total != 0L) {
                 for (Monitor monitor : monitors) {
-                    if (monitor.count != 0) {
-                        logInfo(monitor.toString());
-                    }
+                    logInfo(monitor.name + " : "
+                            + ((100d * monitor.sum) / total) + " %");
                 }
-                // As getAATileGenerator percents:
-                final long total = mon_pre_getAATileGenerator.sum;
-                if (total != 0L) {
-                    for (Monitor monitor : monitors) {
-                        logInfo(monitor.name + " : "
-                                + ((100d * monitor.sum) / total) + " %");
-                    }
+            }
+            if (DO_FLUSH_MONITORS) {
+                for (Monitor m : monitors) {
+                    m.reset();
                 }
-                if (DO_FLUSH_MONITORS) {
-                    for (Monitor m : monitors) {
-                        m.reset();
+            }
+        }
+
+        if (DO_STATS) {
+            for (StatLong stat : statistics) {
+                if (stat.count != 0) {
+                    logInfo(stat.toString());
+                    if (DO_FLUSH_STATS) {
+                        stat.reset();
                     }
                 }
             }
 
-            if (DO_STATS) {
-                for (StatLong stat : statistics) {
-                    if (stat.count != 0) {
-                        logInfo(stat.toString());
+            logInfo("OffHeap footprint: initial: " + totalOffHeapInitial
+                + " bytes - max: " + totalOffHeapMax + " bytes");
+            if (DO_FLUSH_STATS) {
+                totalOffHeapMax = 0L;
+            }
+
+            logInfo("Array caches for RendererContext: " + name);
+
+            long totalInitialBytes = totalOffHeapInitial;
+            long totalCacheBytes   = 0L;
+
+            if (cacheStats != null) {
+                for (CacheStats stat : cacheStats) {
+                    totalCacheBytes   += stat.dumpStats();
+                    totalInitialBytes += stat.getTotalInitialBytes();
+                    if (DO_FLUSH_STATS) {
                         stat.reset();
                     }
                 }
-                // IntArrayCaches stats:
-                final RendererContext.ArrayCachesHolder holder
-                    = rdrCtx.getArrayCachesHolder();
+            }
+            logInfo("Heap footprint: initial: " + totalInitialBytes
+                    + " bytes - cache: " + totalCacheBytes + " bytes");
+        }
+    }
+
+    static final class RendererStatsHolder {
+
+        // singleton
+        private static volatile RendererStatsHolder SINGLETON = null;
 
-                logInfo("Array caches for thread: " + rdrCtx.name);
+        static synchronized RendererStatsHolder getInstance() {
+            if (SINGLETON == null) {
+                SINGLETON = new RendererStatsHolder();
+            }
+            return SINGLETON;
+        }
 
-                for (IntArrayCache cache : holder.intArrayCaches) {
-                    cache.dumpStats();
-                }
+        static void dumpStats() {
+            if (SINGLETON != null) {
+                SINGLETON.dump();
+            }
+        }
+
+        /* RendererStats collection as hard references
+           (only used for debugging purposes) */
+        private final ConcurrentLinkedQueue<RendererStats> allStats
+            = new ConcurrentLinkedQueue<RendererStats>();
 
-                logInfo("Dirty Array caches for thread: " + rdrCtx.name);
+        private RendererStatsHolder() {
+            AccessController.doPrivileged(
+                (PrivilegedAction<Void>) () -> {
+                    final Thread hook = new Thread(
+                        ThreadGroupUtils.getRootThreadGroup(),
+                        new Runnable() {
+                            @Override
+                            public void run() {
+                                dump();
+                            }
+                        },
+                        "MarlinStatsHook"
+                    );
+                    hook.setContextClassLoader(null);
+                    Runtime.getRuntime().addShutdownHook(hook);
 
-                for (IntArrayCache cache : holder.dirtyIntArrayCaches) {
-                    cache.dumpStats();
+                    if (USE_DUMP_THREAD) {
+                        final Timer statTimer = new Timer("RendererStats");
+                        statTimer.scheduleAtFixedRate(new TimerTask() {
+                            @Override
+                            public void run() {
+                                dump();
+                            }
+                        }, DUMP_INTERVAL, DUMP_INTERVAL);
+                    }
+                    return null;
                 }
-                for (FloatArrayCache cache : holder.dirtyFloatArrayCaches) {
-                    cache.dumpStats();
-                }
-                for (ByteArrayCache cache : holder.dirtyByteArrayCaches) {
-                    cache.dumpStats();
-                }
+            );
+        }
+
+        void add(final Object parent, final RendererStats stats) {
+            allStats.add(stats);
+
+            // Register a cleaning function to ensure removing dead entries:
+            CleanerFactory.cleaner().register(parent, () -> remove(stats));
+        }
+
+        void remove(final RendererStats stats) {
+            stats.dump(); // dump anyway
+            allStats.remove(stats);
+        }
+
+        void dump() {
+            for (RendererStats stats : allStats) {
+                stats.dump();
             }
         }
     }
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Stroker.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Stroker.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1205,6 +1205,12 @@
         private static final byte TYPE_QUADTO  = (byte) 1;
         private static final byte TYPE_CUBICTO = (byte) 2;
 
+        // curves capacity = edges count (4096) = half edges x 2 (coords)
+        private static final int INITIAL_CURVES_COUNT = INITIAL_EDGES_COUNT;
+
+        // types capacity = half edges count (2048)
+        private static final int INITIAL_TYPES_COUNT = INITIAL_EDGES_COUNT >> 1;
+
         float[] curves;
         int end;
         byte[] curveTypes;
@@ -1213,10 +1219,10 @@
         // per-thread renderer context
         final RendererContext rdrCtx;
 
-        // per-thread initial arrays (large enough to satisfy most usages: 8192)
-        // +1 to avoid recycling in Helpers.widenArray()
-        private final float[] curves_initial = new float[INITIAL_LARGE_ARRAY + 1]; // 32K
-        private final byte[] curveTypes_initial = new byte[INITIAL_LARGE_ARRAY + 1]; // 8K
+        // curves ref (dirty)
+        final FloatArrayCache.Reference curves_ref;
+        // curveTypes ref (dirty)
+        final ByteArrayCache.Reference curveTypes_ref;
 
         // used marks (stats only)
         int curveTypesUseMark;
@@ -1229,10 +1235,13 @@
         PolyStack(final RendererContext rdrCtx) {
             this.rdrCtx = rdrCtx;
 
-            curves = curves_initial;
-            curveTypes = curveTypes_initial;
+            curves_ref = rdrCtx.newDirtyFloatArrayRef(INITIAL_CURVES_COUNT); // 16K
+            curves     = curves_ref.initial;
+
+            curveTypes_ref = rdrCtx.newDirtyByteArrayRef(INITIAL_TYPES_COUNT); // 2K
+            curveTypes     = curveTypes_ref.initial;
+            numCurves = 0;
             end = 0;
-            numCurves = 0;
 
             if (DO_STATS) {
                 curveTypesUseMark = 0;
@@ -1249,10 +1258,10 @@
             numCurves = 0;
 
             if (DO_STATS) {
-                rdrCtx.stats.stat_rdr_poly_stack_types
-                    .add(curveTypesUseMark);
-                rdrCtx.stats.stat_rdr_poly_stack_curves
-                    .add(curvesUseMark);
+                rdrCtx.stats.stat_rdr_poly_stack_types.add(curveTypesUseMark);
+                rdrCtx.stats.stat_rdr_poly_stack_curves.add(curvesUseMark);
+                rdrCtx.stats.hist_rdr_poly_stack_curves.add(curvesUseMark);
+
                 // reset marks
                 curveTypesUseMark = 0;
                 curvesUseMark = 0;
@@ -1260,15 +1269,8 @@
 
             // Return arrays:
             // curves and curveTypes are kept dirty
-            if (curves != curves_initial) {
-                rdrCtx.putDirtyFloatArray(curves);
-                curves = curves_initial;
-            }
-
-            if (curveTypes != curveTypes_initial) {
-                rdrCtx.putDirtyByteArray(curveTypes);
-                curveTypes = curveTypes_initial;
-            }
+            curves     = curves_ref.putArray(curves);
+            curveTypes = curveTypes_ref.putArray(curveTypes);
         }
 
         private void ensureSpace(final int n) {
@@ -1278,16 +1280,16 @@
                     rdrCtx.stats.stat_array_stroker_polystack_curves
                         .add(end + n);
                 }
-                curves = rdrCtx.widenDirtyFloatArray(curves, end, end + n);
+                curves = curves_ref.widenArray(curves, end, end + n);
             }
             if (curveTypes.length <= numCurves) {
                 if (DO_STATS) {
                     rdrCtx.stats.stat_array_stroker_polystack_curveTypes
                         .add(numCurves + 1);
                 }
-                curveTypes = rdrCtx.widenDirtyByteArray(curveTypes,
-                                                        numCurves,
-                                                        numCurves + 1);
+                curveTypes = curveTypes_ref.widenArray(curveTypes,
+                                                       numCurves,
+                                                       numCurves + 1);
             }
         }
 
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Version.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Version.java	Wed Jul 05 22:06:46 2017 +0200
@@ -27,7 +27,7 @@
 
 public final class Version {
 
-    private static final String VERSION = "marlin-0.7.3.4-Unsafe-OpenJDK";
+    private static final String VERSION = "marlin-0.7.4-Unsafe-OpenJDK";
 
     public static String getVersion() {
         return VERSION;
--- a/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java	Wed Jul 05 22:06:46 2017 +0200
@@ -977,6 +977,7 @@
         private JFormattedTextField tfRangeFrom, tfRangeTo;
         private JLabel lblRangeTo;
         private boolean prSupported;
+        private boolean prPgRngSupported;
 
         public PrintRangePanel() {
             super();
@@ -1090,7 +1091,7 @@
         public void focusGained(FocusEvent e) {}
 
         private void setupRangeWidgets() {
-            boolean rangeEnabled = (rbPages.isSelected() && prSupported);
+            boolean rangeEnabled = (rbPages.isSelected() && prPgRngSupported);
             tfRangeFrom.setEnabled(rangeEnabled);
             tfRangeTo.setEnabled(rangeEnabled);
             lblRangeTo.setEnabled(rangeEnabled);
@@ -1136,6 +1137,9 @@
             if (psCurrent.isAttributeCategorySupported(prCategory) ||
                    isAWT) {
                 prSupported = true;
+                prPgRngSupported = psCurrent.isAttributeValueSupported(prAll,
+                                                                     docFlavor,
+                                                                     asCurrent);
             }
 
             SunPageSelection select = SunPageSelection.ALL;
@@ -1175,7 +1179,7 @@
             tfRangeFrom.setValue(min);
             tfRangeTo.setValue(max);
             rbAll.setEnabled(prSupported);
-            rbPages.setEnabled(prSupported);
+            rbPages.setEnabled(prPgRngSupported);
             setupRangeWidgets();
         }
     }
--- a/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -100,7 +100,9 @@
         }
     }
 
-    private Image getImage(Object key, Component c, int w, int h, Object... args) {
+    private Image getImage(Object key, Component c,
+                           int baseWidth, int baseHeight,
+                           int w, int h, Object... args) {
         GraphicsConfiguration config = getGraphicsConfiguration(c);
         ImageCache cache = getCache(key);
         Image image = cache.getImage(key, config, w, h, args);
@@ -127,8 +129,11 @@
             }
             if (draw) {
                 // Render to the Image
-                Graphics g2 = image.getGraphics();
-                paintToImage(c, image, g2, w, h, args);
+                Graphics2D g2 = (Graphics2D) image.getGraphics();
+                if (w != baseWidth || h != baseHeight) {
+                    g2.scale((double) w / baseWidth, (double) h / baseHeight);
+                }
+                paintToImage(c, image, g2, baseWidth, baseHeight, args);
                 g2.dispose();
             }
 
@@ -149,14 +154,7 @@
         Image image = cache.getImage(key, config, w, h, args);
 
         if (image == null) {
-            double sx = 1;
-            double sy = 1;
-            if (g instanceof Graphics2D) {
-                AffineTransform tx = ((Graphics2D) g).getTransform();
-                sx = tx.getScaleX();
-                sy = tx.getScaleY();
-            }
-            image = new PainterMultiResolutionCachedImage(sx, sy, w, h);
+            image = new PainterMultiResolutionCachedImage(w, h);
             cache.setImage(key, config, w, h, args, image);
         }
 
@@ -238,17 +236,12 @@
 
     class PainterMultiResolutionCachedImage extends AbstractMultiResolutionImage {
 
-        private final double scaleX;
-        private final double scaleY;
         private final int baseWidth;
         private final int baseHeight;
         private Component c;
         private Object[] args;
 
-        public PainterMultiResolutionCachedImage(double scaleX, double scaleY,
-                                                 int baseWidth, int baseHeight) {
-            this.scaleX = scaleX;
-            this.scaleY = scaleY;
+        public PainterMultiResolutionCachedImage(int baseWidth, int baseHeight) {
             this.baseWidth = baseWidth;
             this.baseHeight = baseHeight;
         }
@@ -272,7 +265,7 @@
         public Image getResolutionVariant(double destWidth, double destHeight) {
             int w = (int) Math.ceil(destWidth);
             int h = (int) Math.ceil(destHeight);
-            return getImage(this, c, w, h, args);
+            return getImage(this, c, baseWidth, baseHeight, w, h, args);
         }
 
         @Override
@@ -282,15 +275,7 @@
 
         @Override
         public java.util.List<Image> getResolutionVariants() {
-
-            if (scaleX == 1 && scaleY == 1) {
-                return Arrays.asList(getResolutionVariant(baseWidth, baseHeight));
-            }
-
-            return Arrays.asList(
-                    getResolutionVariant(baseWidth, baseHeight),
-                    getResolutionVariant(scaleX * baseWidth, scaleY * baseHeight)
-            );
+            return Arrays.asList(getResolutionVariant(baseWidth, baseHeight));
         }
     }
 }
\ No newline at end of file
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-blob.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-blob.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -104,7 +104,6 @@
 
   if (!length ||
       length >= 1u << 31 ||
-      data + length < data /* overflows */ ||
       !(blob = hb_object_create<hb_blob_t> ())) {
     if (destroy)
       destroy (user_data);
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-blob.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-blob.h	Wed Jul 05 22:06:46 2017 +0200
@@ -64,7 +64,7 @@
 
 typedef struct hb_blob_t hb_blob_t;
 
-hb_blob_t *
+HB_EXTERN hb_blob_t *
 hb_blob_create (const char        *data,
                 unsigned int       length,
                 hb_memory_mode_t   mode,
@@ -77,21 +77,21 @@
  * modify the parent data as that data may be
  * shared among multiple sub-blobs.
  */
-hb_blob_t *
+HB_EXTERN hb_blob_t *
 hb_blob_create_sub_blob (hb_blob_t    *parent,
                          unsigned int  offset,
                          unsigned int  length);
 
-hb_blob_t *
+HB_EXTERN hb_blob_t *
 hb_blob_get_empty (void);
 
-hb_blob_t *
+HB_EXTERN hb_blob_t *
 hb_blob_reference (hb_blob_t *blob);
 
-void
+HB_EXTERN void
 hb_blob_destroy (hb_blob_t *blob);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_blob_set_user_data (hb_blob_t          *blob,
                        hb_user_data_key_t *key,
                        void *              data,
@@ -99,25 +99,25 @@
                        hb_bool_t           replace);
 
 
-void *
+HB_EXTERN void *
 hb_blob_get_user_data (hb_blob_t          *blob,
                        hb_user_data_key_t *key);
 
 
-void
+HB_EXTERN void
 hb_blob_make_immutable (hb_blob_t *blob);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_blob_is_immutable (hb_blob_t *blob);
 
 
-unsigned int
+HB_EXTERN unsigned int
 hb_blob_get_length (hb_blob_t *blob);
 
-const char *
+HB_EXTERN const char *
 hb_blob_get_data (hb_blob_t *blob, unsigned int *length);
 
-char *
+HB_EXTERN char *
 hb_blob_get_data_writable (hb_blob_t *blob, unsigned int *length);
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-private.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-private.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -35,9 +35,36 @@
 #include "hb-unicode-private.hh"
 
 
+#ifndef HB_BUFFER_MAX_EXPANSION_FACTOR
+#define HB_BUFFER_MAX_EXPANSION_FACTOR 32
+#endif
+#ifndef HB_BUFFER_MAX_LEN_MIN
+#define HB_BUFFER_MAX_LEN_MIN 8192
+#endif
+#ifndef HB_BUFFER_MAX_LEN_DEFAULT
+#define HB_BUFFER_MAX_LEN_DEFAULT 0x3FFFFFFF /* Shaping more than a billion chars? Let us know! */
+#endif
+
 ASSERT_STATIC (sizeof (hb_glyph_info_t) == 20);
 ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
 
+HB_MARK_AS_FLAG_T (hb_buffer_flags_t);
+HB_MARK_AS_FLAG_T (hb_buffer_serialize_flags_t);
+
+enum hb_buffer_scratch_flags_t {
+  HB_BUFFER_SCRATCH_FLAG_DEFAULT                        = 0x00000000u,
+  HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII                  = 0x00000001u,
+  HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES         = 0x00000002u,
+  HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK             = 0x00000004u,
+  HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT            = 0x00000008u,
+  /* Reserved for complex shapers' internal use. */
+  HB_BUFFER_SCRATCH_FLAG_COMPLEX0                       = 0x01000000u,
+  HB_BUFFER_SCRATCH_FLAG_COMPLEX1                       = 0x02000000u,
+  HB_BUFFER_SCRATCH_FLAG_COMPLEX2                       = 0x04000000u,
+  HB_BUFFER_SCRATCH_FLAG_COMPLEX3                       = 0x08000000u,
+};
+HB_MARK_AS_FLAG_T (hb_buffer_scratch_flags_t);
+
 
 /*
  * hb_buffer_t
@@ -52,6 +79,8 @@
   hb_buffer_flags_t flags; /* BOT / EOT / etc. */
   hb_buffer_cluster_level_t cluster_level;
   hb_codepoint_t replacement; /* U+FFFD or something else. */
+  hb_buffer_scratch_flags_t scratch_flags; /* Have space-flallback, etc. */
+  unsigned int max_len; /* Maximum allowed len. */
 
   /* Buffer contents */
   hb_buffer_content_type_t content_type;
@@ -76,17 +105,13 @@
   inline hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]; }
   inline hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx + i]; }
 
-  inline hb_glyph_info_t &prev (void) { return out_info[out_len - 1]; }
-  inline hb_glyph_info_t prev (void) const { return info[out_len - 1]; }
+  inline hb_glyph_info_t &prev (void) { return out_info[out_len ? out_len - 1 : 0]; }
+  inline hb_glyph_info_t prev (void) const { return out_info[out_len ? out_len - 1 : 0]; }
 
   inline bool has_separate_output (void) const { return info != out_info; }
 
   unsigned int serial;
 
-  /* These reflect current allocations of the bytes in glyph_info_t's var1 and var2. */
-  uint8_t allocated_var_bytes[8];
-  const char *allocated_var_owner[8];
-
   /* Text before / after the main buffer contents.
    * Always in Unicode, and ordered outward.
    * Index 0 is for "pre-context", 1 for "post-context". */
@@ -94,6 +119,52 @@
   hb_codepoint_t context[2][CONTEXT_LENGTH];
   unsigned int context_len[2];
 
+  /* Debugging API */
+  hb_buffer_message_func_t message_func;
+  void *message_data;
+  hb_destroy_func_t message_destroy;
+
+  /* Internal debugging. */
+  /* The bits here reflect current allocations of the bytes in glyph_info_t's var1 and var2. */
+#ifndef HB_NDEBUG
+  uint8_t allocated_var_bits;
+#endif
+  inline void allocate_var (unsigned int start, unsigned int count)
+  {
+#ifndef HB_NDEBUG
+    unsigned int end = start + count;
+    assert (end <= 8);
+    unsigned int bits = (1<<end) - (1<<start);
+    assert (0 == (allocated_var_bits & bits));
+    allocated_var_bits |= bits;
+#endif
+  }
+  inline void deallocate_var (unsigned int start, unsigned int count)
+  {
+#ifndef HB_NDEBUG
+    unsigned int end = start + count;
+    assert (end <= 8);
+    unsigned int bits = (1<<end) - (1<<start);
+    assert (bits == (allocated_var_bits & bits));
+    allocated_var_bits &= ~bits;
+#endif
+  }
+  inline void assert_var (unsigned int start, unsigned int count)
+  {
+#ifndef HB_NDEBUG
+    unsigned int end = start + count;
+    assert (end <= 8);
+    unsigned int bits = (1<<end) - (1<<start);
+    assert (bits == (allocated_var_bits & bits));
+#endif
+  }
+  inline void deallocate_var_all (void)
+  {
+#ifndef HB_NDEBUG
+    allocated_var_bits = 0;
+#endif
+  }
+
 
   /* Methods */
 
@@ -106,11 +177,6 @@
   { return len - idx; }
   inline unsigned int next_serial (void) { return serial++; }
 
-  HB_INTERNAL void allocate_var (unsigned int byte_i, unsigned int count, const char *owner);
-  HB_INTERNAL void deallocate_var (unsigned int byte_i, unsigned int count, const char *owner);
-  HB_INTERNAL void assert_var (unsigned int byte_i, unsigned int count, const char *owner);
-  HB_INTERNAL void deallocate_var_all (void);
-
   HB_INTERNAL void add (hb_codepoint_t  codepoint,
                         unsigned int    cluster);
   HB_INTERNAL void add_info (const hb_glyph_info_t &glyph_info);
@@ -203,18 +269,28 @@
   inline void clear_context (unsigned int side) { context_len[side] = 0; }
 
   HB_INTERNAL void sort (unsigned int start, unsigned int end, int(*compar)(const hb_glyph_info_t *, const hb_glyph_info_t *));
+
+  inline bool messaging (void) { return unlikely (message_func); }
+  inline bool message (hb_font_t *font, const char *fmt, ...) HB_PRINTF_FUNC(3, 4)
+  {
+    if (!messaging ())
+      return true;
+    va_list ap;
+    va_start (ap, fmt);
+    bool ret = message_impl (font, fmt, ap);
+    va_end (ap);
+    return ret;
+  }
+  HB_INTERNAL bool message_impl (hb_font_t *font, const char *fmt, va_list ap) HB_PRINTF_FUNC(3, 0);
 };
 
 
-#define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \
+#define HB_BUFFER_XALLOCATE_VAR(b, func, var) \
   b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \
-           sizeof (b->info[0].var), owner)
-#define HB_BUFFER_ALLOCATE_VAR(b, var) \
-        HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var)
-#define HB_BUFFER_DEALLOCATE_VAR(b, var) \
-        HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var)
-#define HB_BUFFER_ASSERT_VAR(b, var) \
-        HB_BUFFER_XALLOCATE_VAR (b, assert_var, var (), #var)
+           sizeof (b->info[0].var))
+#define HB_BUFFER_ALLOCATE_VAR(b, var)          HB_BUFFER_XALLOCATE_VAR (b, allocate_var,   var ())
+#define HB_BUFFER_DEALLOCATE_VAR(b, var)        HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var ())
+#define HB_BUFFER_ASSERT_VAR(b, var)            HB_BUFFER_XALLOCATE_VAR (b, assert_var,     var ())
 
 
 #endif /* HB_BUFFER_PRIVATE_HH */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-serialize.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-serialize.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -36,11 +36,12 @@
 /**
  * hb_buffer_serialize_list_formats:
  *
- *
+ * Returns a list of supported buffer serialization formats.
  *
  * Return value: (transfer none):
+ * A string array of buffer serialization formats. Should not be freed.
  *
- * Since: 0.9.2
+ * Since: 0.9.7
  **/
 const char **
 hb_buffer_serialize_list_formats (void)
@@ -50,14 +51,17 @@
 
 /**
  * hb_buffer_serialize_format_from_string:
- * @str:
- * @len:
+ * @str: (array length=len) (element-type uint8_t): a string to parse
+ * @len: length of @str, or -1 if string is %NULL terminated
  *
- *
+ * Parses a string into an #hb_buffer_serialize_format_t. Does not check if
+ * @str is a valid buffer serialization format, use
+ * hb_buffer_serialize_list_formats() to get the list of supported formats.
  *
  * Return value:
+ * The parsed #hb_buffer_serialize_format_t.
  *
- * Since: 0.9.2
+ * Since: 0.9.7
  **/
 hb_buffer_serialize_format_t
 hb_buffer_serialize_format_from_string (const char *str, int len)
@@ -68,13 +72,15 @@
 
 /**
  * hb_buffer_serialize_format_to_string:
- * @format:
+ * @format: an #hb_buffer_serialize_format_t to convert.
  *
- *
+ * Converts @format to the string corresponding it, or %NULL if it is not a valid
+ * #hb_buffer_serialize_format_t.
  *
- * Return value:
+ * Return value: (transfer none):
+ * A %NULL terminated string corresponding to @format. Should not be freed.
  *
- * Since: 0.9.2
+ * Since: 0.9.7
  **/
 const char *
 hb_buffer_serialize_format_to_string (hb_buffer_serialize_format_t format)
@@ -242,24 +248,51 @@
   return end - start;
 }
 
-/* Returns number of items, starting at start, that were serialized. */
 /**
  * hb_buffer_serialize_glyphs:
- * @buffer: a buffer.
- * @start:
- * @end:
- * @buf: (array length=buf_size):
- * @buf_size:
- * @buf_consumed: (out):
- * @font:
- * @format:
- * @flags:
+ * @buffer: an #hb_buffer_t buffer.
+ * @start: the first item in @buffer to serialize.
+ * @end: the last item in @buffer to serialize.
+ * @buf: (out) (array length=buf_size) (element-type uint8_t): output string to
+ *       write serialized buffer into.
+ * @buf_size: the size of @buf.
+ * @buf_consumed: (out) (allow-none): if not %NULL, will be set to the number of byes written into @buf.
+ * @font: (allow-none): the #hb_font_t used to shape this buffer, needed to
+ *        read glyph names and extents. If %NULL, and empty font will be used.
+ * @format: the #hb_buffer_serialize_format_t to use for formatting the output.
+ * @flags: the #hb_buffer_serialize_flags_t that control what glyph properties
+ *         to serialize.
+ *
+ * Serializes @buffer into a textual representation of its glyph content,
+ * useful for showing the contents of the buffer, for example during debugging.
+ * There are currently two supported serialization formats:
  *
+ * ## text
+ * A human-readable, plain text format.
+ * The serialized glyphs will look something like:
  *
+ * ```
+ * [uni0651=0@518,0+0|uni0628=0+1897]
+ * ```
+ * - The serialized glyphs are delimited with `[` and `]`.
+ * - Glyphs are separated with `|`
+ * - Each glyph starts with glyph name, or glyph index if
+ *   #HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES flag is set. Then,
+ *   - If #HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS is not set, `=` then #hb_glyph_info_t.cluster.
+ *   - If #HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS is not set, the #hb_glyph_position_t in the format:
+ *     - If both #hb_glyph_position_t.x_offset and #hb_glyph_position_t.y_offset are not 0, `@x_offset,y_offset`. Then,
+ *     - `+x_advance`, then `,y_advance` if #hb_glyph_position_t.y_advance is not 0. Then,
+ *   - If #HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS is set, the
+ *     #hb_glyph_extents_t in the format
+ *     `&lt;x_bearing,y_bearing,width,height&gt;`
+ *
+ * ## json
+ * TODO.
  *
  * Return value:
+ * The number of serialized items.
  *
- * Since: 0.9.2
+ * Since: 0.9.7
  **/
 unsigned int
 hb_buffer_serialize_glyphs (hb_buffer_t *buffer,
@@ -267,8 +300,8 @@
                             unsigned int end,
                             char *buf,
                             unsigned int buf_size,
-                            unsigned int *buf_consumed, /* May be NULL */
-                            hb_font_t *font, /* May be NULL */
+                            unsigned int *buf_consumed,
+                            hb_font_t *font,
                             hb_buffer_serialize_format_t format,
                             hb_buffer_serialize_flags_t flags)
 {
@@ -282,6 +315,9 @@
   assert ((!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID) ||
           buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS);
 
+  if (!buffer->have_positions)
+    flags |= HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS;
+
   if (unlikely (start == end))
     return 0;
 
@@ -355,7 +391,7 @@
 
 /**
  * hb_buffer_deserialize_glyphs:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t buffer.
  * @buf: (array length=buf_len):
  * @buf_len:
  * @end_ptr: (out):
@@ -366,7 +402,7 @@
  *
  * Return value:
  *
- * Since: 0.9.2
+ * Since: 0.9.7
  **/
 hb_bool_t
 hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -35,8 +35,26 @@
 #define HB_DEBUG_BUFFER (HB_DEBUG+0)
 #endif
 
+/**
+ * SECTION: hb-buffer
+ * @title: Buffers
+ * @short_description: Input and output buffers
+ * @include: hb.h
+ *
+ * Buffers serve dual role in HarfBuzz; they hold the input characters that are
+ * passed hb_shape(), and after shaping they hold the output glyphs.
+ **/
 
 /**
+ * hb_segment_properties_equal:
+ * @a: first #hb_segment_properties_t to compare.
+ * @b: second #hb_segment_properties_t to compare.
+ *
+ * Checks the equality of two #hb_segment_properties_t's.
+ *
+ * Return value:
+ * %true if all properties of @a equal those of @b, false otherwise.
+ *
  * Since: 0.9.7
  **/
 hb_bool_t
@@ -52,6 +70,14 @@
 }
 
 /**
+ * hb_segment_properties_hash:
+ * @p: #hb_segment_properties_t to hash.
+ *
+ * Creates a hash representing @p.
+ *
+ * Return value:
+ * A hash of @p.
+ *
  * Since: 0.9.7
  **/
 unsigned int
@@ -91,6 +117,11 @@
 {
   if (unlikely (in_error))
     return false;
+  if (unlikely (size > max_len))
+  {
+    in_error = true;
+    return false;
+  }
 
   unsigned int new_allocated = allocated;
   hb_glyph_position_t *new_pos = NULL;
@@ -152,6 +183,12 @@
   if (unlikely (!ensure (len + count))) return false;
 
   memmove (info + idx + count, info + idx, (len - idx) * sizeof (info[0]));
+  if (idx + count > len)
+  {
+    /* Under memory failure we might expose this area.  At least
+     * clean it up.  Oh well... */
+    memset (info + len, 0, (idx + count - len) * sizeof (info[0]));
+  }
   len += count;
   idx += count;
 
@@ -198,6 +235,7 @@
 
   hb_segment_properties_t default_props = HB_SEGMENT_PROPERTIES_DEFAULT;
   props = default_props;
+  scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT;
 
   content_type = HB_BUFFER_CONTENT_TYPE_INVALID;
   in_error = false;
@@ -210,11 +248,11 @@
   out_info = info;
 
   serial = 0;
-  memset (allocated_var_bytes, 0, sizeof allocated_var_bytes);
-  memset (allocated_var_owner, 0, sizeof allocated_var_owner);
 
   memset (context, 0, sizeof context);
   memset (context_len, 0, sizeof context_len);
+
+  deallocate_var_all ();
 }
 
 void
@@ -375,6 +413,8 @@
     idx = i;
     return true;
   }
+  if (unlikely (in_error))
+    return false;
 
   assert (i <= out_len + (len - idx));
 
@@ -392,6 +432,8 @@
     /* Tricky part: rewinding... */
     unsigned int count = out_len - i;
 
+    /* This will blow in our face if memory allocation fails later
+     * in this same lookup... */
     if (unlikely (idx < count && !shift_forward (count + 32))) return false;
 
     assert (idx >= count);
@@ -627,82 +669,19 @@
 }
 
 
-static inline void
-dump_var_allocation (const hb_buffer_t *buffer)
-{
-  char buf[80];
-  for (unsigned int i = 0; i < 8; i++)
-    buf[i] = '0' + buffer->allocated_var_bytes[7 - i];
-  buf[8] = '\0';
-  DEBUG_MSG (BUFFER, buffer,
-             "Current var allocation: %s",
-             buf);
-}
-
-void hb_buffer_t::allocate_var (unsigned int byte_i, unsigned int count, const char *owner)
-{
-  assert (byte_i < 8 && byte_i + count <= 8);
-
-  if (DEBUG_ENABLED (BUFFER))
-    dump_var_allocation (this);
-  DEBUG_MSG (BUFFER, this,
-             "Allocating var bytes %d..%d for %s",
-             byte_i, byte_i + count - 1, owner);
-
-  for (unsigned int i = byte_i; i < byte_i + count; i++) {
-    assert (!allocated_var_bytes[i]);
-    allocated_var_bytes[i]++;
-    allocated_var_owner[i] = owner;
-  }
-}
-
-void hb_buffer_t::deallocate_var (unsigned int byte_i, unsigned int count, const char *owner)
-{
-  if (DEBUG_ENABLED (BUFFER))
-    dump_var_allocation (this);
-
-  DEBUG_MSG (BUFFER, this,
-             "Deallocating var bytes %d..%d for %s",
-             byte_i, byte_i + count - 1, owner);
-
-  assert (byte_i < 8 && byte_i + count <= 8);
-  for (unsigned int i = byte_i; i < byte_i + count; i++) {
-    assert (allocated_var_bytes[i]);
-    assert (0 == strcmp (allocated_var_owner[i], owner));
-    allocated_var_bytes[i]--;
-  }
-}
-
-void hb_buffer_t::assert_var (unsigned int byte_i, unsigned int count, const char *owner)
-{
-  if (DEBUG_ENABLED (BUFFER))
-    dump_var_allocation (this);
-
-  DEBUG_MSG (BUFFER, this,
-             "Asserting var bytes %d..%d for %s",
-             byte_i, byte_i + count - 1, owner);
-
-  assert (byte_i < 8 && byte_i + count <= 8);
-  for (unsigned int i = byte_i; i < byte_i + count; i++) {
-    assert (allocated_var_bytes[i]);
-    assert (0 == strcmp (allocated_var_owner[i], owner));
-  }
-}
-
-void hb_buffer_t::deallocate_var_all (void)
-{
-  memset (allocated_var_bytes, 0, sizeof (allocated_var_bytes));
-  memset (allocated_var_owner, 0, sizeof (allocated_var_owner));
-}
-
 /* Public API */
 
 /**
  * hb_buffer_create: (Xconstructor)
  *
- *
+ * Creates a new #hb_buffer_t with all properties to defaults.
  *
- * Return value: (transfer full)
+ * Return value: (transfer full):
+ * A newly allocated #hb_buffer_t with a reference count of 1. The initial
+ * reference count should be released with hb_buffer_destroy() when you are done
+ * using the #hb_buffer_t. This function never returns %NULL. If memory cannot
+ * be allocated, a special #hb_buffer_t object will be returned on which
+ * hb_buffer_allocation_successful() returns %false.
  *
  * Since: 0.9.2
  **/
@@ -714,6 +693,8 @@
   if (!(buffer = hb_object_create<hb_buffer_t> ()))
     return hb_buffer_get_empty ();
 
+  buffer->max_len = HB_BUFFER_MAX_LEN_DEFAULT;
+
   buffer->reset ();
 
   return buffer;
@@ -738,6 +719,8 @@
     HB_BUFFER_FLAG_DEFAULT,
     HB_BUFFER_CLUSTER_LEVEL_DEFAULT,
     HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT,
+    HB_BUFFER_SCRATCH_FLAG_DEFAULT,
+    HB_BUFFER_MAX_LEN_DEFAULT,
 
     HB_BUFFER_CONTENT_TYPE_INVALID,
     HB_SEGMENT_PROPERTIES_DEFAULT,
@@ -753,11 +736,13 @@
 
 /**
  * hb_buffer_reference: (skip)
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * Increases the reference count on @buffer by one. This prevents @buffer from
+ * being destroyed until a matching call to hb_buffer_destroy() is made.
  *
  * Return value: (transfer full):
+ * The referenced #hb_buffer_t.
  *
  * Since: 0.9.2
  **/
@@ -769,9 +754,11 @@
 
 /**
  * hb_buffer_destroy: (skip)
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * Deallocate the @buffer.
+ * Decreases the reference count on @buffer by one. If the result is zero, then
+ * @buffer and all associated resources are freed. See hb_buffer_reference().
  *
  * Since: 0.9.2
  **/
@@ -784,13 +771,15 @@
 
   free (buffer->info);
   free (buffer->pos);
+  if (buffer->message_destroy)
+    buffer->message_destroy (buffer->message_data);
 
   free (buffer);
 }
 
 /**
  * hb_buffer_set_user_data: (skip)
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  * @key:
  * @data:
  * @destroy:
@@ -814,7 +803,7 @@
 
 /**
  * hb_buffer_get_user_data: (skip)
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  * @key:
  *
  *
@@ -833,10 +822,11 @@
 
 /**
  * hb_buffer_set_content_type:
- * @buffer: a buffer.
- * @content_type:
+ * @buffer: an #hb_buffer_t.
+ * @content_type: the type of buffer contents to set
  *
- *
+ * Sets the type of @buffer contents, buffers are either empty, contain
+ * characters (before shaping) or glyphs (the result of shaping).
  *
  * Since: 0.9.5
  **/
@@ -849,11 +839,12 @@
 
 /**
  * hb_buffer_get_content_type:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * see hb_buffer_set_content_type().
  *
  * Return value:
+ * The type of @buffer contents.
  *
  * Since: 0.9.5
  **/
@@ -866,7 +857,7 @@
 
 /**
  * hb_buffer_set_unicode_funcs:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  * @unicode_funcs:
  *
  *
@@ -891,7 +882,7 @@
 
 /**
  * hb_buffer_get_unicode_funcs:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
  *
  *
@@ -907,10 +898,16 @@
 
 /**
  * hb_buffer_set_direction:
- * @buffer: a buffer.
- * @direction:
+ * @buffer: an #hb_buffer_t.
+ * @direction: the #hb_direction_t of the @buffer
  *
- *
+ * Set the text flow direction of the buffer. No shaping can happen without
+ * setting @buffer direction, and it controls the visual direction for the
+ * output glyphs; for RTL direction the glyphs will be reversed. Many layout
+ * features depend on the proper setting of the direction, for example,
+ * reversing RTL text before shaping, then shaping with LTR direction is not
+ * the same as keeping the text in logical order and shaping with RTL
+ * direction.
  *
  * Since: 0.9.2
  **/
@@ -927,11 +924,12 @@
 
 /**
  * hb_buffer_get_direction:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * See hb_buffer_set_direction()
  *
  * Return value:
+ * The direction of the @buffer.
  *
  * Since: 0.9.2
  **/
@@ -943,10 +941,18 @@
 
 /**
  * hb_buffer_set_script:
- * @buffer: a buffer.
- * @script:
+ * @buffer: an #hb_buffer_t.
+ * @script: an #hb_script_t to set.
+ *
+ * Sets the script of @buffer to @script.
  *
+ * Script is crucial for choosing the proper shaping behaviour for scripts that
+ * require it (e.g. Arabic) and the which OpenType features defined in the font
+ * to be applied.
  *
+ * You can pass one of the predefined #hb_script_t values, or use
+ * hb_script_from_string() or hb_script_from_iso15924_tag() to get the
+ * corresponding script from an ISO 15924 script tag.
  *
  * Since: 0.9.2
  **/
@@ -962,11 +968,12 @@
 
 /**
  * hb_buffer_get_script:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * See hb_buffer_set_script().
  *
  * Return value:
+ * The #hb_script_t of the @buffer.
  *
  * Since: 0.9.2
  **/
@@ -978,10 +985,18 @@
 
 /**
  * hb_buffer_set_language:
- * @buffer: a buffer.
- * @language:
+ * @buffer: an #hb_buffer_t.
+ * @language: an hb_language_t to set.
+ *
+ * Sets the language of @buffer to @language.
  *
+ * Languages are crucial for selecting which OpenType feature to apply to the
+ * buffer which can result in applying language-specific behaviour. Languages
+ * are orthogonal to the scripts, and though they are related, they are
+ * different concepts and should not be confused with each other.
  *
+ * Use hb_language_from_string() to convert from ISO 639 language codes to
+ * #hb_language_t.
  *
  * Since: 0.9.2
  **/
@@ -997,11 +1012,12 @@
 
 /**
  * hb_buffer_get_language:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * See hb_buffer_set_language().
  *
  * Return value: (transfer none):
+ * The #hb_language_t of the buffer. Must not be freed by the caller.
  *
  * Since: 0.9.2
  **/
@@ -1013,10 +1029,12 @@
 
 /**
  * hb_buffer_set_segment_properties:
- * @buffer: a buffer.
- * @props:
+ * @buffer: an #hb_buffer_t.
+ * @props: an #hb_segment_properties_t to use.
  *
- *
+ * Sets the segment properties of the buffer, a shortcut for calling
+ * hb_buffer_set_direction(), hb_buffer_set_script() and
+ * hb_buffer_set_language() individually.
  *
  * Since: 0.9.7
  **/
@@ -1032,10 +1050,10 @@
 
 /**
  * hb_buffer_get_segment_properties:
- * @buffer: a buffer.
- * @props: (out):
+ * @buffer: an #hb_buffer_t.
+ * @props: (out): the output #hb_segment_properties_t.
  *
- *
+ * Sets @props to the #hb_segment_properties_t of @buffer.
  *
  * Since: 0.9.7
  **/
@@ -1049,10 +1067,10 @@
 
 /**
  * hb_buffer_set_flags:
- * @buffer: a buffer.
- * @flags:
+ * @buffer: an #hb_buffer_t.
+ * @flags: the buffer flags to set.
  *
- *
+ * Sets @buffer flags to @flags. See #hb_buffer_flags_t.
  *
  * Since: 0.9.7
  **/
@@ -1068,11 +1086,12 @@
 
 /**
  * hb_buffer_get_flags:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * See hb_buffer_set_flags().
  *
  * Return value:
+ * The @buffer flags.
  *
  * Since: 0.9.7
  **/
@@ -1084,7 +1103,7 @@
 
 /**
  * hb_buffer_set_cluster_level:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  * @cluster_level:
  *
  *
@@ -1103,7 +1122,7 @@
 
 /**
  * hb_buffer_get_cluster_level:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
  *
  *
@@ -1120,10 +1139,13 @@
 
 /**
  * hb_buffer_set_replacement_codepoint:
- * @buffer: a buffer.
- * @replacement:
+ * @buffer: an #hb_buffer_t.
+ * @replacement: the replacement #hb_codepoint_t
  *
+ * Sets the #hb_codepoint_t that replaces invalid entries for a given encoding
+ * when adding text to @buffer.
  *
+ * Default is %HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT.
  *
  * Since: 0.9.31
  **/
@@ -1139,11 +1161,12 @@
 
 /**
  * hb_buffer_get_replacement_codepoint:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * See hb_buffer_set_replacement_codepoint().
  *
  * Return value:
+ * The @buffer replacement #hb_codepoint_t.
  *
  * Since: 0.9.31
  **/
@@ -1156,9 +1179,10 @@
 
 /**
  * hb_buffer_reset:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * Resets the buffer to its initial status, as if it was just newly created
+ * with hb_buffer_create().
  *
  * Since: 0.9.2
  **/
@@ -1170,9 +1194,10 @@
 
 /**
  * hb_buffer_clear_contents:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * Similar to hb_buffer_reset(), but does not clear the Unicode functions and
+ * the replacement code point.
  *
  * Since: 0.9.11
  **/
@@ -1184,12 +1209,13 @@
 
 /**
  * hb_buffer_pre_allocate:
- * @buffer: a buffer.
- * @size:
+ * @buffer: an #hb_buffer_t.
+ * @size: number of items to pre allocate.
  *
- *
+ * Pre allocates memory for @buffer to fit at least @size number of items.
  *
  * Return value:
+ * %true if @buffer memory allocation succeeded, %false otherwise.
  *
  * Since: 0.9.2
  **/
@@ -1201,11 +1227,12 @@
 
 /**
  * hb_buffer_allocation_successful:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * Check if allocating memory for the buffer succeeded.
  *
  * Return value:
+ * %true if @buffer memory allocation succeeded, %false otherwise.
  *
  * Since: 0.9.2
  **/
@@ -1217,11 +1244,18 @@
 
 /**
  * hb_buffer_add:
- * @buffer: a buffer.
- * @codepoint:
- * @cluster:
+ * @buffer: an #hb_buffer_t.
+ * @codepoint: a Unicode code point.
+ * @cluster: the cluster value of @codepoint.
  *
+ * Appends a character with the Unicode value of @codepoint to @buffer, and
+ * gives it the initial cluster value of @cluster. Clusters can be any thing
+ * the client wants, they are usually used to refer to the index of the
+ * character in the input text stream and are output in
+ * #hb_glyph_info_t.cluster field.
  *
+ * This function does not check the validity of @codepoint, it is up to the
+ * caller to ensure it is a valid Unicode code point.
  *
  * Since: 0.9.7
  **/
@@ -1236,12 +1270,14 @@
 
 /**
  * hb_buffer_set_length:
- * @buffer: a buffer.
- * @length:
+ * @buffer: an #hb_buffer_t.
+ * @length: the new length of @buffer.
  *
- *
+ * Similar to hb_buffer_pre_allocate(), but clears any new items added at the
+ * end.
  *
  * Return value:
+ * %true if @buffer memory allocation succeeded, %false otherwise.
  *
  * Since: 0.9.2
  **/
@@ -1276,11 +1312,13 @@
 
 /**
  * hb_buffer_get_length:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
  * Returns the number of items in the buffer.
  *
- * Return value: buffer length.
+ * Return value:
+ * The @buffer length.
+ * The value valid as long as buffer has not been modified.
  *
  * Since: 0.9.2
  **/
@@ -1292,13 +1330,15 @@
 
 /**
  * hb_buffer_get_glyph_infos:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  * @length: (out): output array length.
  *
- * Returns buffer glyph information array.  Returned pointer
- * is valid as long as buffer contents are not modified.
+ * Returns @buffer glyph information array.  Returned pointer
+ * is valid as long as @buffer contents are not modified.
  *
- * Return value: (transfer none) (array length=length): buffer glyph information array.
+ * Return value: (transfer none) (array length=length):
+ * The @buffer glyph information array.
+ * The value valid as long as buffer has not been modified.
  *
  * Since: 0.9.2
  **/
@@ -1314,13 +1354,15 @@
 
 /**
  * hb_buffer_get_glyph_positions:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  * @length: (out): output length.
  *
- * Returns buffer glyph position array.  Returned pointer
- * is valid as long as buffer contents are not modified.
+ * Returns @buffer glyph position array.  Returned pointer
+ * is valid as long as @buffer contents are not modified.
  *
- * Return value: (transfer none) (array length=length): buffer glyph position array.
+ * Return value: (transfer none) (array length=length):
+ * The @buffer glyph position array.
+ * The value valid as long as buffer has not been modified.
  *
  * Since: 0.9.2
  **/
@@ -1339,7 +1381,7 @@
 
 /**
  * hb_buffer_reverse:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
  * Reverses buffer contents.
  *
@@ -1353,7 +1395,7 @@
 
 /**
  * hb_buffer_reverse_range:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  * @start: start index.
  * @end: end index.
  *
@@ -1370,7 +1412,7 @@
 
 /**
  * hb_buffer_reverse_clusters:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
  * Reverses buffer clusters.  That is, the buffer contents are
  * reversed, then each cluster (consecutive items having the
@@ -1386,7 +1428,7 @@
 
 /**
  * hb_buffer_guess_segment_properties:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
  * Sets unset buffer segment properties based on buffer Unicode
  * contents.  If buffer is not empty, it must have content type
@@ -1485,13 +1527,18 @@
 
 /**
  * hb_buffer_add_utf8:
- * @buffer: a buffer.
- * @text: (array length=text_length) (element-type uint8_t):
- * @text_length:
- * @item_offset:
- * @item_length:
+ * @buffer: an #hb_buffer_t.
+ * @text: (array length=text_length) (element-type uint8_t): an array of UTF-8
+ *               characters to append.
+ * @text_length: the length of the @text, or -1 if it is %NULL terminated.
+ * @item_offset: the offset of the first character to add to the @buffer.
+ * @item_length: the number of characters to add to the @buffer, or -1 for the
+ *               end of @text (assuming it is %NULL terminated).
  *
+ * See hb_buffer_add_codepoints().
  *
+ * Replaces invalid UTF-8 characters with the @buffer replacement code point,
+ * see hb_buffer_set_replacement_codepoint().
  *
  * Since: 0.9.2
  **/
@@ -1507,13 +1554,17 @@
 
 /**
  * hb_buffer_add_utf16:
- * @buffer: a buffer.
- * @text: (array length=text_length):
- * @text_length:
- * @item_offset:
- * @item_length:
+ * @buffer: an #hb_buffer_t.
+ * @text: (array length=text_length): an array of UTF-16 characters to append.
+ * @text_length: the length of the @text, or -1 if it is %NULL terminated.
+ * @item_offset: the offset of the first character to add to the @buffer.
+ * @item_length: the number of characters to add to the @buffer, or -1 for the
+ *               end of @text (assuming it is %NULL terminated).
  *
+ * See hb_buffer_add_codepoints().
  *
+ * Replaces invalid UTF-16 characters with the @buffer replacement code point,
+ * see hb_buffer_set_replacement_codepoint().
  *
  * Since: 0.9.2
  **/
@@ -1529,13 +1580,17 @@
 
 /**
  * hb_buffer_add_utf32:
- * @buffer: a buffer.
- * @text: (array length=text_length):
- * @text_length:
- * @item_offset:
- * @item_length:
+ * @buffer: an #hb_buffer_t.
+ * @text: (array length=text_length): an array of UTF-32 characters to append.
+ * @text_length: the length of the @text, or -1 if it is %NULL terminated.
+ * @item_offset: the offset of the first character to add to the @buffer.
+ * @item_length: the number of characters to add to the @buffer, or -1 for the
+ *               end of @text (assuming it is %NULL terminated).
  *
+ * See hb_buffer_add_codepoints().
  *
+ * Replaces invalid UTF-32 characters with the @buffer replacement code point,
+ * see hb_buffer_set_replacement_codepoint().
  *
  * Since: 0.9.2
  **/
@@ -1551,13 +1606,18 @@
 
 /**
  * hb_buffer_add_latin1:
- * @buffer: a buffer.
- * @text: (array length=text_length) (element-type uint8_t):
- * @text_length:
- * @item_offset:
- * @item_length:
+ * @buffer: an #hb_buffer_t.
+ * @text: (array length=text_length) (element-type uint8_t): an array of UTF-8
+ *               characters to append.
+ * @text_length: the length of the @text, or -1 if it is %NULL terminated.
+ * @item_offset: the offset of the first character to add to the @buffer.
+ * @item_length: the number of characters to add to the @buffer, or -1 for the
+ *               end of @text (assuming it is %NULL terminated).
  *
+ * Similar to hb_buffer_add_codepoints(), but allows only access to first 256
+ * Unicode code points that can fit in 8-bit strings.
  *
+ * <note>Has nothing to do with non-Unicode Latin-1 encoding.</note>
  *
  * Since: 0.9.39
  **/
@@ -1573,13 +1633,25 @@
 
 /**
  * hb_buffer_add_codepoints:
- * @buffer: a buffer.
- * @text: (array length=text_length):
- * @text_length:
- * @item_offset:
- * @item_length:
+ * @buffer: a #hb_buffer_t to append characters to.
+ * @text: (array length=text_length): an array of Unicode code points to append.
+ * @text_length: the length of the @text, or -1 if it is %NULL terminated.
+ * @item_offset: the offset of the first code point to add to the @buffer.
+ * @item_length: the number of code points to add to the @buffer, or -1 for the
+ *               end of @text (assuming it is %NULL terminated).
  *
+ * Appends characters from @text array to @buffer. The @item_offset is the
+ * position of the first character from @text that will be appended, and
+ * @item_length is the number of character. When shaping part of a larger text
+ * (e.g. a run of text from a paragraph), instead of passing just the substring
+ * corresponding to the run, it is preferable to pass the whole
+ * paragraph and specify the run start and length as @item_offset and
+ * @item_length, respectively, to give HarfBuzz the full context to be able,
+ * for example, to do cross-run Arabic shaping or properly handle combining
+ * marks at stat of run.
  *
+ * This function does not check the validity of @text, it is up to the caller
+ * to ensure it contains a valid Unicode code points.
  *
  * Since: 0.9.31
  **/
@@ -1651,9 +1723,12 @@
 
 /**
  * hb_buffer_normalize_glyphs:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
+ * Reorders a glyph buffer to have canonical in-cluster glyph order / position.
+ * The resulting clusters should behave identical to pre-reordering clusters.
  *
+ * <note>This has nothing to do with Unicode normalization.</note>
  *
  * Since: 0.9.2
  **/
@@ -1699,3 +1774,45 @@
     }
   }
 }
+
+/*
+ * Debugging.
+ */
+
+/**
+ * hb_buffer_set_message_func:
+ * @buffer: an #hb_buffer_t.
+ * @func: (closure user_data) (destroy destroy) (scope notified):
+ * @user_data:
+ * @destroy:
+ *
+ *
+ *
+ * Since: 1.1.3
+ **/
+void
+hb_buffer_set_message_func (hb_buffer_t *buffer,
+                            hb_buffer_message_func_t func,
+                            void *user_data, hb_destroy_func_t destroy)
+{
+  if (buffer->message_destroy)
+    buffer->message_destroy (buffer->message_data);
+
+  if (func) {
+    buffer->message_func = func;
+    buffer->message_data = user_data;
+    buffer->message_destroy = destroy;
+  } else {
+    buffer->message_func = NULL;
+    buffer->message_data = NULL;
+    buffer->message_destroy = NULL;
+  }
+}
+
+bool
+hb_buffer_t::message_impl (hb_font_t *font, const char *fmt, va_list ap)
+{
+  char buf[100];
+  vsnprintf (buf, sizeof (buf),  fmt, ap);
+  return (bool) this->message_func (this, font, buf, this->message_data);
+}
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer.h	Wed Jul 05 22:06:46 2017 +0200
@@ -40,7 +40,27 @@
 
 HB_BEGIN_DECLS
 
-
+/**
+ * hb_glyph_info_t:
+ * @codepoint: either a Unicode code point (before shaping) or a glyph index
+ *             (after shaping).
+ * @mask:
+ * @cluster: the index of the character in the original text that corresponds
+ *           to this #hb_glyph_info_t, or whatever the client passes to
+ *           hb_buffer_add(). More than one #hb_glyph_info_t can have the same
+ *           @cluster value, if they resulted from the same character (e.g. one
+ *           to many glyph substitution), and when more than one character gets
+ *           merged in the same glyph (e.g. many to one glyph substitution) the
+ *           #hb_glyph_info_t will have the smallest cluster value of them.
+ *           By default some characters are merged into the same cluster
+ *           (e.g. combining marks have the same cluster as their bases)
+ *           even if they are separate glyphs, hb_buffer_set_cluster_level()
+ *           allow selecting more fine-grained cluster handling.
+ *
+ * The #hb_glyph_info_t is the structure that holds information about the
+ * glyphs and their relation to input text.
+ *
+ */
 typedef struct hb_glyph_info_t {
   hb_codepoint_t codepoint;
   hb_mask_t      mask;
@@ -51,6 +71,22 @@
   hb_var_int_t   var2;
 } hb_glyph_info_t;
 
+/**
+ * hb_glyph_position_t:
+ * @x_advance: how much the line advances after drawing this glyph when setting
+ *             text in horizontal direction.
+ * @y_advance: how much the line advances after drawing this glyph when setting
+ *             text in vertical direction.
+ * @x_offset: how much the glyph moves on the X-axis before drawing it, this
+ *            should not affect how much the line advances.
+ * @y_offset: how much the glyph moves on the Y-axis before drawing it, this
+ *            should not affect how much the line advances.
+ *
+ * The #hb_glyph_position_t is the structure that holds the positions of the
+ * glyph in both horizontal and vertical directions. All positions in
+ * #hb_glyph_position_t are relative to the current point.
+ *
+ */
 typedef struct hb_glyph_position_t {
   hb_position_t  x_advance;
   hb_position_t  y_advance;
@@ -61,7 +97,16 @@
   hb_var_int_t   var;
 } hb_glyph_position_t;
 
-
+/**
+ * hb_segment_properties_t:
+ * @direction: the #hb_direction_t of the buffer, see hb_buffer_set_direction().
+ * @script: the #hb_script_t of the buffer, see hb_buffer_set_script().
+ * @language: the #hb_language_t of the buffer, see hb_buffer_set_language().
+ *
+ * The structure that holds various text properties of an #hb_buffer_t. Can be
+ * set and retrieved using hb_buffer_set_segment_properties() and
+ * hb_buffer_get_segment_properties(), respectively.
+ */
 typedef struct hb_segment_properties_t {
   hb_direction_t  direction;
   hb_script_t     script;
@@ -77,101 +122,125 @@
                                        NULL, \
                                        NULL}
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_segment_properties_equal (const hb_segment_properties_t *a,
                              const hb_segment_properties_t *b);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_segment_properties_hash (const hb_segment_properties_t *p);
 
 
 
-/*
- * hb_buffer_t
+/**
+ * hb_buffer_t:
+ *
+ * The main structure holding the input text and its properties before shaping,
+ * and output glyphs and their information after shaping.
  */
 
 typedef struct hb_buffer_t hb_buffer_t;
 
-hb_buffer_t *
+HB_EXTERN hb_buffer_t *
 hb_buffer_create (void);
 
-hb_buffer_t *
+HB_EXTERN hb_buffer_t *
 hb_buffer_get_empty (void);
 
-hb_buffer_t *
+HB_EXTERN hb_buffer_t *
 hb_buffer_reference (hb_buffer_t *buffer);
 
-void
+HB_EXTERN void
 hb_buffer_destroy (hb_buffer_t *buffer);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_buffer_set_user_data (hb_buffer_t        *buffer,
                          hb_user_data_key_t *key,
                          void *              data,
                          hb_destroy_func_t   destroy,
                          hb_bool_t           replace);
 
-void *
+HB_EXTERN void *
 hb_buffer_get_user_data (hb_buffer_t        *buffer,
                          hb_user_data_key_t *key);
 
-
+/**
+ * hb_buffer_content_type_t:
+ * @HB_BUFFER_CONTENT_TYPE_INVALID: Initial value for new buffer.
+ * @HB_BUFFER_CONTENT_TYPE_UNICODE: The buffer contains input characters (before shaping).
+ * @HB_BUFFER_CONTENT_TYPE_GLYPHS: The buffer contains output glyphs (after shaping).
+ */
 typedef enum {
   HB_BUFFER_CONTENT_TYPE_INVALID = 0,
   HB_BUFFER_CONTENT_TYPE_UNICODE,
   HB_BUFFER_CONTENT_TYPE_GLYPHS
 } hb_buffer_content_type_t;
 
-void
+HB_EXTERN void
 hb_buffer_set_content_type (hb_buffer_t              *buffer,
                             hb_buffer_content_type_t  content_type);
 
-hb_buffer_content_type_t
+HB_EXTERN hb_buffer_content_type_t
 hb_buffer_get_content_type (hb_buffer_t *buffer);
 
 
-void
+HB_EXTERN void
 hb_buffer_set_unicode_funcs (hb_buffer_t        *buffer,
                              hb_unicode_funcs_t *unicode_funcs);
 
-hb_unicode_funcs_t *
+HB_EXTERN hb_unicode_funcs_t *
 hb_buffer_get_unicode_funcs (hb_buffer_t        *buffer);
 
-void
+HB_EXTERN void
 hb_buffer_set_direction (hb_buffer_t    *buffer,
                          hb_direction_t  direction);
 
-hb_direction_t
+HB_EXTERN hb_direction_t
 hb_buffer_get_direction (hb_buffer_t *buffer);
 
-void
+HB_EXTERN void
 hb_buffer_set_script (hb_buffer_t *buffer,
                       hb_script_t  script);
 
-hb_script_t
+HB_EXTERN hb_script_t
 hb_buffer_get_script (hb_buffer_t *buffer);
 
-void
+HB_EXTERN void
 hb_buffer_set_language (hb_buffer_t   *buffer,
                         hb_language_t  language);
 
 
-hb_language_t
+HB_EXTERN hb_language_t
 hb_buffer_get_language (hb_buffer_t *buffer);
 
-void
+HB_EXTERN void
 hb_buffer_set_segment_properties (hb_buffer_t *buffer,
                                   const hb_segment_properties_t *props);
 
-void
+HB_EXTERN void
 hb_buffer_get_segment_properties (hb_buffer_t *buffer,
                                   hb_segment_properties_t *props);
 
-void
+HB_EXTERN void
 hb_buffer_guess_segment_properties (hb_buffer_t *buffer);
 
 
-/*
+/**
+ * hb_buffer_flags_t:
+ * @HB_BUFFER_FLAG_DEFAULT: the default buffer flag.
+ * @HB_BUFFER_FLAG_BOT: flag indicating that special handling of the beginning
+ *                      of text paragraph can be applied to this buffer. Should usually
+ *                      be set, unless you are passing to the buffer only part
+ *                      of the text without the full context.
+ * @HB_BUFFER_FLAG_EOT: flag indicating that special handling of the end of text
+ *                      paragraph can be applied to this buffer, similar to
+ *                      @HB_BUFFER_FLAG_EOT.
+ * @HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES:
+ *                      flag indication that character with Default_Ignorable
+ *                      Unicode property should use the corresponding glyph
+ *                      from the font, instead of hiding them (currently done
+ *                      by replacing them with the space glyph and zeroing the
+ *                      advance width.)
+ *
  * Since: 0.9.20
  */
 typedef enum { /*< flags >*/
@@ -181,11 +250,11 @@
   HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES    = 0x00000004u
 } hb_buffer_flags_t;
 
-void
+HB_EXTERN void
 hb_buffer_set_flags (hb_buffer_t       *buffer,
                      hb_buffer_flags_t  flags);
 
-hb_buffer_flags_t
+HB_EXTERN hb_buffer_flags_t
 hb_buffer_get_flags (hb_buffer_t *buffer);
 
 /*
@@ -198,93 +267,92 @@
   HB_BUFFER_CLUSTER_LEVEL_DEFAULT = HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES
 } hb_buffer_cluster_level_t;
 
-void
+HB_EXTERN void
 hb_buffer_set_cluster_level (hb_buffer_t               *buffer,
                              hb_buffer_cluster_level_t  cluster_level);
 
-hb_buffer_cluster_level_t
+HB_EXTERN hb_buffer_cluster_level_t
 hb_buffer_get_cluster_level (hb_buffer_t *buffer);
 
+/**
+ * HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT:
+ *
+ * The default code point for replacing invalid characters in a given encoding.
+ * Set to U+FFFD REPLACEMENT CHARACTER.
+ *
+ * Since: 0.9.31
+ */
 #define HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT 0xFFFDu
 
-/* Sets codepoint used to replace invalid UTF-8/16/32 entries.
- * Default is 0xFFFDu. */
-void
+HB_EXTERN void
 hb_buffer_set_replacement_codepoint (hb_buffer_t    *buffer,
                                      hb_codepoint_t  replacement);
 
-hb_codepoint_t
+HB_EXTERN hb_codepoint_t
 hb_buffer_get_replacement_codepoint (hb_buffer_t    *buffer);
 
 
-/* Resets the buffer.  Afterwards it's as if it was just created,
- * except that it has a larger buffer allocated perhaps... */
-void
+HB_EXTERN void
 hb_buffer_reset (hb_buffer_t *buffer);
 
-/* Like reset, but does NOT clear unicode_funcs and replacement_codepoint. */
-void
+HB_EXTERN void
 hb_buffer_clear_contents (hb_buffer_t *buffer);
 
-/* Returns false if allocation failed */
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_buffer_pre_allocate (hb_buffer_t  *buffer,
                         unsigned int  size);
 
 
-/* Returns false if allocation has failed before */
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_buffer_allocation_successful (hb_buffer_t  *buffer);
 
-void
+HB_EXTERN void
 hb_buffer_reverse (hb_buffer_t *buffer);
 
-void
+HB_EXTERN void
 hb_buffer_reverse_range (hb_buffer_t *buffer,
                          unsigned int start, unsigned int end);
 
-void
+HB_EXTERN void
 hb_buffer_reverse_clusters (hb_buffer_t *buffer);
 
 
 /* Filling the buffer in */
 
-void
+HB_EXTERN void
 hb_buffer_add (hb_buffer_t    *buffer,
                hb_codepoint_t  codepoint,
                unsigned int    cluster);
 
-void
+HB_EXTERN void
 hb_buffer_add_utf8 (hb_buffer_t  *buffer,
                     const char   *text,
                     int           text_length,
                     unsigned int  item_offset,
                     int           item_length);
 
-void
+HB_EXTERN void
 hb_buffer_add_utf16 (hb_buffer_t    *buffer,
                      const uint16_t *text,
                      int             text_length,
                      unsigned int    item_offset,
                      int             item_length);
 
-void
+HB_EXTERN void
 hb_buffer_add_utf32 (hb_buffer_t    *buffer,
                      const uint32_t *text,
                      int             text_length,
                      unsigned int    item_offset,
                      int             item_length);
 
-/* Allows only access to first 256 Unicode codepoints. */
-void
+HB_EXTERN void
 hb_buffer_add_latin1 (hb_buffer_t   *buffer,
                       const uint8_t *text,
                       int            text_length,
                       unsigned int   item_offset,
                       int            item_length);
 
-/* Like add_utf32 but does NOT check for invalid Unicode codepoints. */
-void
+HB_EXTERN void
 hb_buffer_add_codepoints (hb_buffer_t          *buffer,
                           const hb_codepoint_t *text,
                           int                   text_length,
@@ -292,32 +360,25 @@
                           int                   item_length);
 
 
-/* Clears any new items added at the end */
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_buffer_set_length (hb_buffer_t  *buffer,
                       unsigned int  length);
 
-/* Return value valid as long as buffer not modified */
-unsigned int
+HB_EXTERN unsigned int
 hb_buffer_get_length (hb_buffer_t *buffer);
 
 /* Getting glyphs out of the buffer */
 
-/* Return value valid as long as buffer not modified */
-hb_glyph_info_t *
+HB_EXTERN hb_glyph_info_t *
 hb_buffer_get_glyph_infos (hb_buffer_t  *buffer,
                            unsigned int *length);
 
-/* Return value valid as long as buffer not modified */
-hb_glyph_position_t *
+HB_EXTERN hb_glyph_position_t *
 hb_buffer_get_glyph_positions (hb_buffer_t  *buffer,
                                unsigned int *length);
 
 
-/* Reorders a glyph buffer to have canonical in-cluster glyph order / position.
- * The resulting clusters should behave identical to pre-reordering clusters.
- * NOTE: This has nothing to do with Unicode normalization. */
-void
+HB_EXTERN void
 hb_buffer_normalize_glyphs (hb_buffer_t *buffer);
 
 
@@ -325,7 +386,16 @@
  * Serialize
  */
 
-/*
+/**
+ * hb_buffer_serialize_flags_t:
+ * @HB_BUFFER_SERIALIZE_FLAG_DEFAULT: serialize glyph names, clusters and positions.
+ * @HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS: do not serialize glyph cluster.
+ * @HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS: do not serialize glyph position information.
+ * @HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES: do no serialize glyph name.
+ * @HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS: serialize glyph extents.
+ *
+ * Flags that control what glyph information are serialized in hb_buffer_serialize_glyphs().
+ *
  * Since: 0.9.20
  */
 typedef enum { /*< flags >*/
@@ -336,43 +406,67 @@
   HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS        = 0x00000008u
 } hb_buffer_serialize_flags_t;
 
+/**
+ * hb_buffer_serialize_format_t:
+ * @HB_BUFFER_SERIALIZE_FORMAT_TEXT: a human-readable, plain text format.
+ * @HB_BUFFER_SERIALIZE_FORMAT_JSON: a machine-readable JSON format.
+ * @HB_BUFFER_SERIALIZE_FORMAT_INVALID: invalid format.
+ *
+ * The buffer serialization and de-serialization format used in
+ * hb_buffer_serialize_glyphs() and hb_buffer_deserialize_glyphs().
+ *
+ * Since: 0.9.2
+ */
 typedef enum {
   HB_BUFFER_SERIALIZE_FORMAT_TEXT       = HB_TAG('T','E','X','T'),
   HB_BUFFER_SERIALIZE_FORMAT_JSON       = HB_TAG('J','S','O','N'),
   HB_BUFFER_SERIALIZE_FORMAT_INVALID    = HB_TAG_NONE
 } hb_buffer_serialize_format_t;
 
-/* len=-1 means str is NUL-terminated. */
-hb_buffer_serialize_format_t
+HB_EXTERN hb_buffer_serialize_format_t
 hb_buffer_serialize_format_from_string (const char *str, int len);
 
-const char *
+HB_EXTERN const char *
 hb_buffer_serialize_format_to_string (hb_buffer_serialize_format_t format);
 
-const char **
+HB_EXTERN const char **
 hb_buffer_serialize_list_formats (void);
 
-/* Returns number of items, starting at start, that were serialized. */
-unsigned int
+HB_EXTERN unsigned int
 hb_buffer_serialize_glyphs (hb_buffer_t *buffer,
                             unsigned int start,
                             unsigned int end,
                             char *buf,
                             unsigned int buf_size,
-                            unsigned int *buf_consumed, /* May be NULL */
-                            hb_font_t *font, /* May be NULL */
+                            unsigned int *buf_consumed,
+                            hb_font_t *font,
                             hb_buffer_serialize_format_t format,
                             hb_buffer_serialize_flags_t flags);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
                               const char *buf,
-                              int buf_len, /* -1 means nul-terminated */
-                              const char **end_ptr, /* May be NULL */
-                              hb_font_t *font, /* May be NULL */
+                              int buf_len,
+                              const char **end_ptr,
+                              hb_font_t *font,
                               hb_buffer_serialize_format_t format);
 
 
+/*
+ * Debugging.
+ */
+
+typedef hb_bool_t       (*hb_buffer_message_func_t)     (hb_buffer_t *buffer,
+                                                         hb_font_t   *font,
+                                                         const char  *message,
+                                                         void        *user_data);
+
+HB_EXTERN void
+hb_buffer_set_message_func (hb_buffer_t *buffer,
+                            hb_buffer_message_func_t func,
+                            void *user_data, hb_destroy_func_t destroy);
+
+
 HB_END_DECLS
 
 #endif /* HB_BUFFER_H */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -88,7 +88,7 @@
 /**
  * hb_tag_to_string:
  * @tag:
- * @buf: (array fixed-size=4):
+ * @buf: (out caller-allocates) (array fixed-size=4) (element-type uint8_t):
  *
  *
  *
@@ -281,12 +281,15 @@
 
 /**
  * hb_language_from_string:
- * @str: (array length=len) (element-type uint8_t):
- * @len:
+ * @str: (array length=len) (element-type uint8_t): a string representing
+ *       ISO 639 language code
+ * @len: length of the @str, or -1 if it is %NULL-terminated.
  *
- *
+ * Converts @str representing an ISO 639 language code to the corresponding
+ * #hb_language_t.
  *
  * Return value: (transfer none):
+ * The #hb_language_t corresponding to the ISO 639 language code.
  *
  * Since: 0.9.2
  **/
@@ -314,11 +317,13 @@
 
 /**
  * hb_language_to_string:
- * @language:
+ * @language: an #hb_language_t to convert.
  *
- *
+ * See hb_language_from_string().
  *
  * Return value: (transfer none):
+ * A %NULL-terminated string representing the @language. Must not be freed by
+ * the caller.
  *
  * Since: 0.9.2
  **/
@@ -357,11 +362,12 @@
 
 /**
  * hb_script_from_iso15924_tag:
- * @tag:
+ * @tag: an #hb_tag_t representing an ISO 15924 tag.
  *
- *
+ * Converts an ISO 15924 script tag to a corresponding #hb_script_t.
  *
  * Return value:
+ * An #hb_script_t corresponding to the ISO 15924 tag.
  *
  * Since: 0.9.2
  **/
@@ -401,28 +407,33 @@
 
 /**
  * hb_script_from_string:
- * @s: (array length=len) (element-type uint8_t):
- * @len:
+ * @str: (array length=len) (element-type uint8_t): a string representing an
+ *       ISO 15924 tag.
+ * @len: length of the @str, or -1 if it is %NULL-terminated.
  *
- *
+ * Converts a string @str representing an ISO 15924 script tag to a
+ * corresponding #hb_script_t. Shorthand for hb_tag_from_string() then
+ * hb_script_from_iso15924_tag().
  *
  * Return value:
+ * An #hb_script_t corresponding to the ISO 15924 tag.
  *
  * Since: 0.9.2
  **/
 hb_script_t
-hb_script_from_string (const char *s, int len)
+hb_script_from_string (const char *str, int len)
 {
-  return hb_script_from_iso15924_tag (hb_tag_from_string (s, len));
+  return hb_script_from_iso15924_tag (hb_tag_from_string (str, len));
 }
 
 /**
  * hb_script_to_iso15924_tag:
- * @script:
+ * @script: an #hb_script_ to convert.
  *
- *
+ * See hb_script_from_iso15924_tag().
  *
  * Return value:
+ * An #hb_tag_t representing an ISO 15924 script tag.
  *
  * Since: 0.9.2
  **/
@@ -496,6 +507,9 @@
     /* Unicode-8.0 additions */
     case HB_SCRIPT_OLD_HUNGARIAN:
 
+    /* Unicode-9.0 additions */
+    case HB_SCRIPT_ADLAM:
+
       return HB_DIRECTION_RTL;
   }
 
@@ -521,7 +535,7 @@
     }
   }
   hb_user_data_item_t item = {key, data, destroy};
-  bool ret = !!items.replace_or_insert (item, lock, replace);
+  bool ret = !!items.replace_or_insert (item, lock, (bool) replace);
 
   return ret;
 }
@@ -529,7 +543,7 @@
 void *
 hb_user_data_array_t::get (hb_user_data_key_t *key)
 {
-  hb_user_data_item_t item = {NULL };
+  hb_user_data_item_t item = {NULL, NULL, NULL};
 
   return items.find (key, &item, lock) ? item.data : NULL;
 }
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.h	Wed Jul 05 22:06:46 2017 +0200
@@ -98,16 +98,22 @@
 #define HB_TAG_MAX_SIGNED HB_TAG(0x7f,0xff,0xff,0xff)
 
 /* len=-1 means str is NUL-terminated. */
-hb_tag_t
+HB_EXTERN hb_tag_t
 hb_tag_from_string (const char *str, int len);
 
 /* buf should have 4 bytes. */
-void
+HB_EXTERN void
 hb_tag_to_string (hb_tag_t tag, char *buf);
 
 
-/* hb_direction_t */
-
+/**
+ * hb_direction_t:
+ * @HB_DIRECTION_INVALID: Initial, unset direction.
+ * @HB_DIRECTION_LTR: Text is set horizontally from left to right.
+ * @HB_DIRECTION_RTL: Text is set horizontally from right to left.
+ * @HB_DIRECTION_TTB: Text is set vertically from top to bottom.
+ * @HB_DIRECTION_BTT: Text is set vertically from bottom to top.
+ */
 typedef enum {
   HB_DIRECTION_INVALID = 0,
   HB_DIRECTION_LTR = 4,
@@ -117,10 +123,10 @@
 } hb_direction_t;
 
 /* len=-1 means str is NUL-terminated */
-hb_direction_t
+HB_EXTERN hb_direction_t
 hb_direction_from_string (const char *str, int len);
 
-const char *
+HB_EXTERN const char *
 hb_direction_to_string (hb_direction_t direction);
 
 #define HB_DIRECTION_IS_VALID(dir)      ((((unsigned int) (dir)) & ~3U) == 4)
@@ -136,16 +142,15 @@
 
 typedef const struct hb_language_impl_t *hb_language_t;
 
-/* len=-1 means str is NUL-terminated */
-hb_language_t
+HB_EXTERN hb_language_t
 hb_language_from_string (const char *str, int len);
 
-const char *
+HB_EXTERN const char *
 hb_language_to_string (hb_language_t language);
 
 #define HB_LANGUAGE_INVALID ((hb_language_t) NULL)
 
-hb_language_t
+HB_EXTERN hb_language_t
 hb_language_get_default (void);
 
 
@@ -306,6 +311,16 @@
   /*8.0*/ HB_SCRIPT_OLD_HUNGARIAN               = HB_TAG ('H','u','n','g'),
   /*8.0*/ HB_SCRIPT_SIGNWRITING                 = HB_TAG ('S','g','n','w'),
 
+  /*
+   * Since 1.3.0
+   */
+  /*9.0*/ HB_SCRIPT_ADLAM                       = HB_TAG ('A','d','l','m'),
+  /*9.0*/ HB_SCRIPT_BHAIKSUKI                   = HB_TAG ('B','h','k','s'),
+  /*9.0*/ HB_SCRIPT_MARCHEN                     = HB_TAG ('M','a','r','c'),
+  /*9.0*/ HB_SCRIPT_OSAGE                       = HB_TAG ('O','s','g','e'),
+  /*9.0*/ HB_SCRIPT_TANGUT                      = HB_TAG ('T','a','n','g'),
+  /*9.0*/ HB_SCRIPT_NEWA                        = HB_TAG ('N','e','w','a'),
+
   /* No script set. */
   HB_SCRIPT_INVALID                             = HB_TAG_NONE,
 
@@ -324,18 +339,16 @@
 
 /* Script functions */
 
-hb_script_t
+HB_EXTERN hb_script_t
 hb_script_from_iso15924_tag (hb_tag_t tag);
 
-/* sugar for tag_from_string() then script_from_iso15924_tag */
-/* len=-1 means s is NUL-terminated */
-hb_script_t
-hb_script_from_string (const char *s, int len);
+HB_EXTERN hb_script_t
+hb_script_from_string (const char *str, int len);
 
-hb_tag_t
+HB_EXTERN hb_tag_t
 hb_script_to_iso15924_tag (hb_script_t script);
 
-hb_direction_t
+HB_EXTERN hb_direction_t
 hb_script_get_horizontal_direction (hb_script_t script);
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-coretext.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-coretext.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -27,7 +27,6 @@
  */
 
 #define HB_SHAPER coretext
-#define hb_coretext_shaper_face_data_t CGFont
 #include "hb-shaper-impl-private.hh"
 
 #include "hb-coretext.h"
@@ -78,6 +77,29 @@
  * shaper face data
  */
 
+static CTFontDescriptorRef
+get_last_resort_font_desc (void)
+{
+  // TODO Handle allocation failures?
+  CTFontDescriptorRef last_resort = CTFontDescriptorCreateWithNameAndSize (CFSTR("LastResort"), 0);
+  CFArrayRef cascade_list = CFArrayCreate (kCFAllocatorDefault,
+                                           (const void **) &last_resort,
+                                           1,
+                                           &kCFTypeArrayCallBacks);
+  CFRelease (last_resort);
+  CFDictionaryRef attributes = CFDictionaryCreate (kCFAllocatorDefault,
+                                                   (const void **) &kCTFontCascadeListAttribute,
+                                                   (const void **) &cascade_list,
+                                                   1,
+                                                   &kCFTypeDictionaryKeyCallBacks,
+                                                   &kCFTypeDictionaryValueCallBacks);
+  CFRelease (cascade_list);
+
+  CTFontDescriptorRef font_desc = CTFontDescriptorCreateWithAttributes (attributes);
+  CFRelease (attributes);
+  return font_desc;
+}
+
 static void
 release_data (void *info, const void *data, size_t size)
 {
@@ -87,14 +109,13 @@
   hb_blob_destroy ((hb_blob_t *) info);
 }
 
-hb_coretext_shaper_face_data_t *
-_hb_coretext_shaper_face_data_create (hb_face_t *face)
+static CGFontRef
+create_cg_font (hb_face_t *face)
 {
-  hb_coretext_shaper_face_data_t *data = NULL;
-
+  CGFontRef cg_font = NULL;
   if (face->destroy == (hb_destroy_func_t) CGFontRelease)
   {
-    data = CGFontRetain ((CGFontRef) face->user_data);
+    cg_font = CGFontRetain ((CGFontRef) face->user_data);
   }
   else
   {
@@ -107,13 +128,98 @@
     CGDataProviderRef provider = CGDataProviderCreateWithData (blob, blob_data, blob_length, &release_data);
     if (likely (provider))
     {
-      data = CGFontCreateWithDataProvider (provider);
+      cg_font = CGFontCreateWithDataProvider (provider);
+      if (unlikely (!cg_font))
+        DEBUG_MSG (CORETEXT, face, "Face CGFontCreateWithDataProvider() failed");
       CGDataProviderRelease (provider);
     }
   }
+  return cg_font;
+}
 
-  if (unlikely (!data)) {
-    DEBUG_MSG (CORETEXT, face, "Face CGFontCreateWithDataProvider() failed");
+static CTFontRef
+create_ct_font (CGFontRef cg_font, CGFloat font_size)
+{
+  CTFontRef ct_font = CTFontCreateWithGraphicsFont (cg_font, font_size, NULL, NULL);
+  if (unlikely (!ct_font)) {
+    DEBUG_MSG (CORETEXT, cg_font, "Font CTFontCreateWithGraphicsFont() failed");
+    return NULL;
+  }
+  CFURLRef original_url = (CFURLRef)CTFontCopyAttribute(ct_font, kCTFontURLAttribute);
+
+  /* Create font copy with cascade list that has LastResort first; this speeds up CoreText
+   * font fallback which we don't need anyway. */
+  {
+    CTFontDescriptorRef last_resort_font_desc = get_last_resort_font_desc ();
+    CTFontRef new_ct_font = CTFontCreateCopyWithAttributes (ct_font, 0.0, NULL, last_resort_font_desc);
+    CFRelease (last_resort_font_desc);
+    if (new_ct_font)
+    {
+      /* The CTFontCreateCopyWithAttributes call fails to stay on the same font
+       * when reconfiguring the cascade list and may switch to a different font
+       * when there are fonts that go by the same name, since the descriptor is
+       * just name and size.
+       *
+       * Avoid reconfiguring the cascade lists if the new font is outside the
+       * system locations that we cannot access from the sandboxed renderer
+       * process in Blink. This can be detected by the new file URL location
+       * that the newly found font points to. */
+      CFURLRef new_url = (CFURLRef) CTFontCopyAttribute (new_ct_font, kCTFontURLAttribute);
+      // Keep reconfigured font if URL cannot be retrieved (seems to be the case
+      // on Mac OS 10.12 Sierra), speculative fix for crbug.com/625606
+      if (!original_url || !new_url || CFEqual (original_url, new_url)) {
+        CFRelease (ct_font);
+        ct_font = new_ct_font;
+      } else {
+        CFRelease (new_ct_font);
+        DEBUG_MSG (CORETEXT, ct_font, "Discarding reconfigured CTFont, location changed.");
+      }
+      if (new_url)
+        CFRelease (new_url);
+    }
+    else
+      DEBUG_MSG (CORETEXT, ct_font, "Font copy with empty cascade list failed");
+  }
+
+  if (original_url)
+    CFRelease (original_url);
+  return ct_font;
+}
+
+struct hb_coretext_shaper_face_data_t {
+  CGFontRef cg_font;
+  CTFontRef ct_font;
+};
+
+hb_coretext_shaper_face_data_t *
+_hb_coretext_shaper_face_data_create (hb_face_t *face)
+{
+  hb_coretext_shaper_face_data_t *data = (hb_coretext_shaper_face_data_t *) calloc (1, sizeof (hb_coretext_shaper_face_data_t));
+  if (unlikely (!data))
+    return NULL;
+
+  data->cg_font = create_cg_font (face);
+  if (unlikely (!data->cg_font))
+  {
+    DEBUG_MSG (CORETEXT, face, "CGFont creation failed..");
+    free (data);
+    return NULL;
+  }
+
+  /* We use 36pt size instead of UPEM, because CoreText implements the 'trak' table,
+   * which can make the font too tight at large sizes.  36pt should be a good semi-neutral
+   * size.
+   *
+   * Since we always create CTFont at a fixed size, our CTFont lives in face_data
+   * instead of font_data.  Which is good, because when people change scale on
+   * hb_font_t, we won't need to update our CTFont. */
+  data->ct_font = create_ct_font (data->cg_font, 36.);
+  if (unlikely (!data->ct_font))
+  {
+    DEBUG_MSG (CORETEXT, face, "CTFont creation failed.");
+    CFRelease (data->cg_font);
+    free (data);
+    return NULL;
   }
 
   return data;
@@ -122,7 +228,9 @@
 void
 _hb_coretext_shaper_face_data_destroy (hb_coretext_shaper_face_data_t *data)
 {
-  CFRelease (data);
+  CFRelease (data->ct_font);
+  CFRelease (data->cg_font);
+  free (data);
 }
 
 /*
@@ -133,7 +241,7 @@
 {
   if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL;
   hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
-  return face_data;
+  return face_data->cg_font;
 }
 
 
@@ -141,49 +249,17 @@
  * shaper font data
  */
 
-struct hb_coretext_shaper_font_data_t {
-  CTFontRef ct_font;
-  CGFloat x_mult, y_mult; /* From CT space to HB space. */
-};
+struct hb_coretext_shaper_font_data_t {};
 
 hb_coretext_shaper_font_data_t *
-_hb_coretext_shaper_font_data_create (hb_font_t *font)
+_hb_coretext_shaper_font_data_create (hb_font_t *font HB_UNUSED)
 {
-  if (unlikely (!hb_coretext_shaper_face_data_ensure (font->face))) return NULL;
-
-  hb_coretext_shaper_font_data_t *data = (hb_coretext_shaper_font_data_t *) calloc (1, sizeof (hb_coretext_shaper_font_data_t));
-  if (unlikely (!data))
-    return NULL;
-
-  hb_face_t *face = font->face;
-  hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
-
-  /* Choose a CoreText font size and calculate multipliers to convert to HarfBuzz space. */
-  /* TODO: use upem instead of 36? */
-  CGFloat font_size = 36.; /* Default... */
-  /* No idea if the following is even a good idea. */
-  if (font->y_ppem)
-    font_size = font->y_ppem;
-
-  if (font_size < 0)
-    font_size = -font_size;
-  data->x_mult = (CGFloat) font->x_scale / font_size;
-  data->y_mult = (CGFloat) font->y_scale / font_size;
-  data->ct_font = CTFontCreateWithGraphicsFont (face_data, font_size, NULL, NULL);
-  if (unlikely (!data->ct_font)) {
-    DEBUG_MSG (CORETEXT, font, "Font CTFontCreateWithGraphicsFont() failed");
-    free (data);
-    return NULL;
-  }
-
-  return data;
+  return (hb_coretext_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED;
 }
 
 void
 _hb_coretext_shaper_font_data_destroy (hb_coretext_shaper_font_data_t *data)
 {
-  CFRelease (data->ct_font);
-  free (data);
 }
 
 
@@ -209,9 +285,10 @@
 CTFontRef
 hb_coretext_font_get_ct_font (hb_font_t *font)
 {
-  if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return NULL;
-  hb_coretext_shaper_font_data_t *font_data = HB_SHAPER_DATA_GET (font);
-  return font_data->ct_font;
+  hb_face_t *face = font->face;
+  if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL;
+  hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
+  return face_data->ct_font;
 }
 
 
@@ -444,7 +521,10 @@
 {
   hb_face_t *face = font->face;
   hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
-  hb_coretext_shaper_font_data_t *font_data = HB_SHAPER_DATA_GET (font);
+
+  CGFloat ct_font_size = CTFontGetSize (face_data->ct_font);
+  CGFloat x_mult = (CGFloat) font->x_scale / ct_font_size;
+  CGFloat y_mult = (CGFloat) font->y_scale / ct_font_size;
 
   /* Attach marks to their bases, to match the 'ot' shaper.
    * Adapted from hb-ot-shape:hb_form_clusters().
@@ -453,6 +533,7 @@
    * B1 M1 B2 M2, and B1-B2 form a ligature, M2's cluster will
    * continue pointing to B2 even though B2 was merged into B1's
    * cluster... */
+  if (buffer->cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES)
   {
     hb_unicode_funcs_t *unicode = buffer->unicode;
     unsigned int count = buffer->len;
@@ -575,7 +656,7 @@
           CTFontDescriptorRef font_desc = CTFontDescriptorCreateWithAttributes (attributes);
           CFRelease (attributes);
 
-          range->font = CTFontCreateCopyWithAttributes (font_data->ct_font, 0.0, NULL, font_desc);
+          range->font = CTFontCreateCopyWithAttributes (face_data->ct_font, 0.0, NULL, font_desc);
           CFRelease (font_desc);
         }
         else
@@ -693,7 +774,6 @@
     scratch += old_scratch_used;
     scratch_size -= old_scratch_used;
   }
-retry:
   {
     string_ref = CFStringCreateWithCharactersNoCopy (NULL,
                                                      pchars, chars_len,
@@ -733,7 +813,7 @@
         CFRelease (lang);
       }
       CFAttributedStringSetAttribute (attr_string, CFRangeMake (0, chars_len),
-                                      kCTFontAttributeName, font_data->ct_font);
+                                      kCTFontAttributeName, face_data->ct_font);
 
       if (num_features)
       {
@@ -826,7 +906,7 @@
        */
       CFDictionaryRef attributes = CTRunGetAttributes (run);
       CTFontRef run_ct_font = static_cast<CTFontRef>(CFDictionaryGetValue (attributes, kCTFontAttributeName));
-      if (!CFEqual (run_ct_font, font_data->ct_font))
+      if (!CFEqual (run_ct_font, face_data->ct_font))
       {
         /* The run doesn't use our main font instance.  We have to figure out
          * whether font fallback happened, or this is just CoreText giving us
@@ -846,15 +926,11 @@
          * backend.
          *
          * However, even that wouldn't work if we were passed in the CGFont to
-         * begin with.
-         *
-         * Webkit uses a slightly different approach: it installs LastResort
-         * as fallback chain, and then checks PS name of used font against
-         * LastResort.  That one is safe for any font except for LastResort,
-         * as opposed to ours, which can fail if we are using any uninstalled
-         * font that has the same name as an installed font.
+         * construct a hb_face to begin with.
          *
          * See: http://github.com/behdad/harfbuzz/pull/36
+         *
+         * Also see: https://bugs.chromium.org/p/chromium/issues/detail?id=597098
          */
         bool matched = false;
         for (unsigned int i = 0; i < range_records.len; i++)
@@ -868,13 +944,13 @@
           CGFontRef run_cg_font = CTFontCopyGraphicsFont (run_ct_font, 0);
           if (run_cg_font)
           {
-            matched = CFEqual (run_cg_font, face_data);
+            matched = CFEqual (run_cg_font, face_data->cg_font);
             CFRelease (run_cg_font);
           }
         }
         if (!matched)
         {
-          CFStringRef font_ps_name = CTFontCopyName (font_data->ct_font, kCTFontPostScriptNameKey);
+          CFStringRef font_ps_name = CTFontCopyName (face_data->ct_font, kCTFontPostScriptNameKey);
           CFStringRef run_ps_name = CTFontCopyName (run_ct_font, kCTFontPostScriptNameKey);
           CFComparisonResult result = CFStringCompare (run_ps_name, font_ps_name, 0);
           CFRelease (run_ps_name);
@@ -994,7 +1070,6 @@
           positions = position_buf;
         }
         hb_glyph_info_t *info = run_info;
-        CGFloat x_mult = font_data->x_mult, y_mult = font_data->y_mult;
         if (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction))
         {
           hb_position_t x_offset = (positions[0].x - advances_so_far) * x_mult;
@@ -1129,10 +1204,6 @@
  * AAT shaper
  */
 
-HB_SHAPER_DATA_ENSURE_DECLARE(coretext_aat, face)
-HB_SHAPER_DATA_ENSURE_DECLARE(coretext_aat, font)
-
-
 /*
  * shaper face data
  */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-coretext.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-coretext.h	Wed Jul 05 22:06:46 2017 +0200
@@ -44,14 +44,14 @@
 #define HB_CORETEXT_TAG_MORX HB_TAG('m','o','r','x')
 
 
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_coretext_face_create (CGFontRef cg_font);
 
 
-CGFontRef
+HB_EXTERN CGFontRef
 hb_coretext_face_get_cg_font (hb_face_t *face);
 
-CTFontRef
+HB_EXTERN CTFontRef
 hb_coretext_font_get_ct_font (hb_font_t *font);
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-deprecated.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-deprecated.h	Wed Jul 05 22:06:46 2017 +0200
@@ -44,6 +44,16 @@
 #define HB_BUFFER_FLAGS_DEFAULT                 HB_BUFFER_FLAG_DEFAULT
 #define HB_BUFFER_SERIALIZE_FLAGS_DEFAULT       HB_BUFFER_SERIALIZE_FLAG_DEFAULT
 
+typedef hb_bool_t (*hb_font_get_glyph_func_t) (hb_font_t *font, void *font_data,
+                                               hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+                                               hb_codepoint_t *glyph,
+                                               void *user_data);
+
+HB_EXTERN void
+hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
+                              hb_font_get_glyph_func_t func,
+                              void *user_data, hb_destroy_func_t destroy);
+
 #endif
 
 HB_END_DECLS
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-face.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-face.h	Wed Jul 05 22:06:46 2017 +0200
@@ -43,28 +43,28 @@
 
 typedef struct hb_face_t hb_face_t;
 
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_face_create (hb_blob_t    *blob,
                 unsigned int  index);
 
 typedef hb_blob_t * (*hb_reference_table_func_t)  (hb_face_t *face, hb_tag_t tag, void *user_data);
 
 /* calls destroy() when not needing user_data anymore */
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_face_create_for_tables (hb_reference_table_func_t  reference_table_func,
                            void                      *user_data,
                            hb_destroy_func_t          destroy);
 
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_face_get_empty (void);
 
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_face_reference (hb_face_t *face);
 
-void
+HB_EXTERN void
 hb_face_destroy (hb_face_t *face);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_face_set_user_data (hb_face_t          *face,
                        hb_user_data_key_t *key,
                        void *              data,
@@ -72,43 +72,43 @@
                        hb_bool_t           replace);
 
 
-void *
+HB_EXTERN void *
 hb_face_get_user_data (hb_face_t          *face,
                        hb_user_data_key_t *key);
 
-void
+HB_EXTERN void
 hb_face_make_immutable (hb_face_t *face);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_face_is_immutable (hb_face_t *face);
 
 
-hb_blob_t *
+HB_EXTERN hb_blob_t *
 hb_face_reference_table (hb_face_t *face,
                          hb_tag_t   tag);
 
-hb_blob_t *
+HB_EXTERN hb_blob_t *
 hb_face_reference_blob (hb_face_t *face);
 
-void
+HB_EXTERN void
 hb_face_set_index (hb_face_t    *face,
                    unsigned int  index);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_face_get_index (hb_face_t    *face);
 
-void
+HB_EXTERN void
 hb_face_set_upem (hb_face_t    *face,
                   unsigned int  upem);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_face_get_upem (hb_face_t *face);
 
-void
+HB_EXTERN void
 hb_face_set_glyph_count (hb_face_t    *face,
                          unsigned int  glyph_count);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_face_get_glyph_count (hb_face_t *face);
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-fallback-shape.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-fallback-shape.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -106,7 +106,7 @@
    */
 
   hb_codepoint_t space;
-  bool has_space = font->get_glyph (' ', 0, &space);
+  bool has_space = (bool) font->get_nominal_glyph (' ', &space);
 
   buffer->clear_positions ();
 
@@ -123,7 +123,7 @@
       pos[i].y_advance = 0;
       continue;
     }
-    font->get_glyph (info[i].codepoint, 0, &info[i].codepoint);
+    font->get_nominal_glyph (info[i].codepoint, &info[i].codepoint);
     font->get_glyph_advance_for_direction (info[i].codepoint,
                                            direction,
                                            &pos[i].x_advance,
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font-private.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font-private.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -42,7 +42,10 @@
  */
 
 #define HB_FONT_FUNCS_IMPLEMENT_CALLBACKS \
-  HB_FONT_FUNC_IMPLEMENT (glyph) \
+  HB_FONT_FUNC_IMPLEMENT (font_h_extents) \
+  HB_FONT_FUNC_IMPLEMENT (font_v_extents) \
+  HB_FONT_FUNC_IMPLEMENT (nominal_glyph) \
+  HB_FONT_FUNC_IMPLEMENT (variation_glyph) \
   HB_FONT_FUNC_IMPLEMENT (glyph_h_advance) \
   HB_FONT_FUNC_IMPLEMENT (glyph_v_advance) \
   HB_FONT_FUNC_IMPLEMENT (glyph_h_origin) \
@@ -61,14 +64,6 @@
 
   hb_bool_t immutable;
 
-  /* Don't access these directly.  Call hb_font_get_*() instead. */
-
-  struct {
-#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_func_t name;
-    HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
-#undef HB_FONT_FUNC_IMPLEMENT
-  } get;
-
   struct {
 #define HB_FONT_FUNC_IMPLEMENT(name) void *name;
     HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
@@ -80,6 +75,16 @@
     HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
 #undef HB_FONT_FUNC_IMPLEMENT
   } destroy;
+
+  /* Don't access these directly.  Call font->get_*() instead. */
+  union get_t {
+    struct get_funcs_t {
+#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_func_t name;
+      HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+    } f;
+    void (*array[VAR]) (void);
+  } get;
 };
 
 
@@ -144,95 +149,133 @@
 
   /* Public getters */
 
-  inline hb_bool_t has_glyph (hb_codepoint_t unicode)
+  HB_INTERNAL bool has_func (unsigned int i);
+
+  /* has_* ... */
+#define HB_FONT_FUNC_IMPLEMENT(name) \
+  bool \
+  has_##name##_func (void) \
+  { \
+    hb_font_funcs_t *funcs = this->klass; \
+    unsigned int i = offsetof (hb_font_funcs_t::get_t::get_funcs_t, name) / sizeof (funcs->get.array[0]); \
+    return has_func (i); \
+  }
+  HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+
+  inline hb_bool_t get_font_h_extents (hb_font_extents_t *extents)
   {
-    hb_codepoint_t glyph;
-    return get_glyph (unicode, 0, &glyph);
+    memset (extents, 0, sizeof (*extents));
+    return klass->get.f.font_h_extents (this, user_data,
+                                        extents,
+                                        klass->user_data.font_h_extents);
+  }
+  inline hb_bool_t get_font_v_extents (hb_font_extents_t *extents)
+  {
+    memset (extents, 0, sizeof (*extents));
+    return klass->get.f.font_v_extents (this, user_data,
+                                        extents,
+                                        klass->user_data.font_v_extents);
   }
 
-  inline hb_bool_t get_glyph (hb_codepoint_t unicode, hb_codepoint_t variation_selector,
-                              hb_codepoint_t *glyph)
+  inline bool has_glyph (hb_codepoint_t unicode)
+  {
+    hb_codepoint_t glyph;
+    return get_nominal_glyph (unicode, &glyph);
+  }
+
+  inline hb_bool_t get_nominal_glyph (hb_codepoint_t unicode,
+                                      hb_codepoint_t *glyph)
   {
     *glyph = 0;
-    return klass->get.glyph (this, user_data,
-                             unicode, variation_selector, glyph,
-                             klass->user_data.glyph);
+    return klass->get.f.nominal_glyph (this, user_data,
+                                       unicode, glyph,
+                                       klass->user_data.nominal_glyph);
+  }
+
+  inline hb_bool_t get_variation_glyph (hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+                                        hb_codepoint_t *glyph)
+  {
+    *glyph = 0;
+    return klass->get.f.variation_glyph (this, user_data,
+                                         unicode, variation_selector, glyph,
+                                         klass->user_data.variation_glyph);
   }
 
   inline hb_position_t get_glyph_h_advance (hb_codepoint_t glyph)
   {
-    return klass->get.glyph_h_advance (this, user_data,
-                                       glyph,
-                                       klass->user_data.glyph_h_advance);
+    return klass->get.f.glyph_h_advance (this, user_data,
+                                         glyph,
+                                         klass->user_data.glyph_h_advance);
   }
 
   inline hb_position_t get_glyph_v_advance (hb_codepoint_t glyph)
   {
-    return klass->get.glyph_v_advance (this, user_data,
-                                       glyph,
-                                       klass->user_data.glyph_v_advance);
+    return klass->get.f.glyph_v_advance (this, user_data,
+                                         glyph,
+                                         klass->user_data.glyph_v_advance);
   }
 
   inline hb_bool_t get_glyph_h_origin (hb_codepoint_t glyph,
                                        hb_position_t *x, hb_position_t *y)
   {
     *x = *y = 0;
-    return klass->get.glyph_h_origin (this, user_data,
-                                      glyph, x, y,
-                                      klass->user_data.glyph_h_origin);
+    return klass->get.f.glyph_h_origin (this, user_data,
+                                        glyph, x, y,
+                                        klass->user_data.glyph_h_origin);
   }
 
   inline hb_bool_t get_glyph_v_origin (hb_codepoint_t glyph,
                                        hb_position_t *x, hb_position_t *y)
   {
     *x = *y = 0;
-    return klass->get.glyph_v_origin (this, user_data,
-                                      glyph, x, y,
-                                      klass->user_data.glyph_v_origin);
+    return klass->get.f.glyph_v_origin (this, user_data,
+                                        glyph, x, y,
+                                        klass->user_data.glyph_v_origin);
   }
 
   inline hb_position_t get_glyph_h_kerning (hb_codepoint_t left_glyph, hb_codepoint_t right_glyph)
   {
-    return klass->get.glyph_h_kerning (this, user_data,
-                                       left_glyph, right_glyph,
-                                       klass->user_data.glyph_h_kerning);
+    return klass->get.f.glyph_h_kerning (this, user_data,
+                                         left_glyph, right_glyph,
+                                         klass->user_data.glyph_h_kerning);
   }
 
   inline hb_position_t get_glyph_v_kerning (hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph)
   {
-    return klass->get.glyph_v_kerning (this, user_data,
-                                       top_glyph, bottom_glyph,
-                                       klass->user_data.glyph_v_kerning);
+    return klass->get.f.glyph_v_kerning (this, user_data,
+                                         top_glyph, bottom_glyph,
+                                         klass->user_data.glyph_v_kerning);
   }
 
   inline hb_bool_t get_glyph_extents (hb_codepoint_t glyph,
                                       hb_glyph_extents_t *extents)
   {
     memset (extents, 0, sizeof (*extents));
-    return klass->get.glyph_extents (this, user_data,
-                                     glyph,
-                                     extents,
-                                     klass->user_data.glyph_extents);
+    return klass->get.f.glyph_extents (this, user_data,
+                                       glyph,
+                                       extents,
+                                       klass->user_data.glyph_extents);
   }
 
   inline hb_bool_t get_glyph_contour_point (hb_codepoint_t glyph, unsigned int point_index,
                                             hb_position_t *x, hb_position_t *y)
   {
     *x = *y = 0;
-    return klass->get.glyph_contour_point (this, user_data,
-                                           glyph, point_index,
-                                           x, y,
-                                           klass->user_data.glyph_contour_point);
+    return klass->get.f.glyph_contour_point (this, user_data,
+                                             glyph, point_index,
+                                             x, y,
+                                             klass->user_data.glyph_contour_point);
   }
 
   inline hb_bool_t get_glyph_name (hb_codepoint_t glyph,
                                    char *name, unsigned int size)
   {
     if (size) *name = '\0';
-    return klass->get.glyph_name (this, user_data,
-                                  glyph,
-                                  name, size,
-                                  klass->user_data.glyph_name);
+    return klass->get.f.glyph_name (this, user_data,
+                                    glyph,
+                                    name, size,
+                                    klass->user_data.glyph_name);
   }
 
   inline hb_bool_t get_glyph_from_name (const char *name, int len, /* -1 means nul-terminated */
@@ -240,15 +283,35 @@
   {
     *glyph = 0;
     if (len == -1) len = strlen (name);
-    return klass->get.glyph_from_name (this, user_data,
-                                       name, len,
-                                       glyph,
-                                       klass->user_data.glyph_from_name);
+    return klass->get.f.glyph_from_name (this, user_data,
+                                         name, len,
+                                         glyph,
+                                         klass->user_data.glyph_from_name);
   }
 
 
   /* A bit higher-level, and with fallback */
 
+  inline void get_extents_for_direction (hb_direction_t direction,
+                                         hb_font_extents_t *extents)
+  {
+    if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) {
+      if (!get_font_h_extents (extents))
+      {
+        extents->ascender = y_scale * .8;
+        extents->descender = y_scale - extents->ascender;
+        extents->line_gap = 0;
+      }
+    } else {
+      if (!get_font_v_extents (extents))
+      {
+        extents->ascender = x_scale / 2;
+        extents->descender = x_scale - extents->ascender;
+        extents->line_gap = 0;
+      }
+    }
+  }
+
   inline void get_glyph_advance_for_direction (hb_codepoint_t glyph,
                                                hb_direction_t direction,
                                                hb_position_t *x, hb_position_t *y)
@@ -268,7 +331,7 @@
   {
     *x = get_glyph_h_advance (glyph) / 2;
 
-    /* TODO use font_metrics.ascent */
+    /* TODO use font_extents.ascender */
     *y = y_scale;
   }
 
@@ -298,6 +361,26 @@
     }
   }
 
+  inline void add_glyph_h_origin (hb_codepoint_t glyph,
+                                  hb_position_t *x, hb_position_t *y)
+  {
+    hb_position_t origin_x, origin_y;
+
+    get_glyph_h_origin (glyph, &origin_x, &origin_y);
+
+    *x += origin_x;
+    *y += origin_y;
+  }
+  inline void add_glyph_v_origin (hb_codepoint_t glyph,
+                                  hb_position_t *x, hb_position_t *y)
+  {
+    hb_position_t origin_x, origin_y;
+
+    get_glyph_v_origin (glyph, &origin_x, &origin_y);
+
+    *x += origin_x;
+    *y += origin_y;
+  }
   inline void add_glyph_origin_for_direction (hb_codepoint_t glyph,
                                               hb_direction_t direction,
                                               hb_position_t *x, hb_position_t *y)
@@ -310,6 +393,26 @@
     *y += origin_y;
   }
 
+  inline void subtract_glyph_h_origin (hb_codepoint_t glyph,
+                                       hb_position_t *x, hb_position_t *y)
+  {
+    hb_position_t origin_x, origin_y;
+
+    get_glyph_h_origin (glyph, &origin_x, &origin_y);
+
+    *x -= origin_x;
+    *y -= origin_y;
+  }
+  inline void subtract_glyph_v_origin (hb_codepoint_t glyph,
+                                       hb_position_t *x, hb_position_t *y)
+  {
+    hb_position_t origin_x, origin_y;
+
+    get_glyph_v_origin (glyph, &origin_x, &origin_y);
+
+    *x -= origin_x;
+    *y -= origin_y;
+  }
   inline void subtract_glyph_origin_for_direction (hb_codepoint_t glyph,
                                                    hb_direction_t direction,
                                                    hb_position_t *x, hb_position_t *y)
@@ -394,7 +497,7 @@
       hb_codepoint_t unichar;
       if (0 == strncmp (s, "uni", 3) &&
           hb_codepoint_parse (s + 3, len - 3, 16, &unichar) &&
-          get_glyph (unichar, 0, glyph))
+          get_nominal_glyph (unichar, glyph))
         return true;
     }
 
@@ -402,7 +505,13 @@
   }
 
   private:
-  inline hb_position_t em_scale (int16_t v, int scale) { return (hb_position_t) (v * (int64_t) scale / face->get_upem ()); }
+  inline hb_position_t em_scale (int16_t v, int scale)
+  {
+    int upem = face->get_upem ();
+    int64_t scaled = v * (int64_t) scale;
+    scaled += scaled >= 0 ? upem/2 : -upem/2; /* Round. */
+    return (hb_position_t) (scaled / upem);
+  }
 };
 
 #define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -45,130 +45,246 @@
  */
 
 static hb_bool_t
-hb_font_get_glyph_nil (hb_font_t *font,
-                       void *font_data HB_UNUSED,
-                       hb_codepoint_t unicode,
-                       hb_codepoint_t variation_selector,
-                       hb_codepoint_t *glyph,
-                       void *user_data HB_UNUSED)
+hb_font_get_font_h_extents_nil (hb_font_t *font,
+                                void *font_data HB_UNUSED,
+                                hb_font_extents_t *metrics,
+                                void *user_data HB_UNUSED)
+{
+  memset (metrics, 0, sizeof (*metrics));
+  return false;
+}
+static hb_bool_t
+hb_font_get_font_h_extents_parent (hb_font_t *font,
+                                   void *font_data HB_UNUSED,
+                                   hb_font_extents_t *metrics,
+                                   void *user_data HB_UNUSED)
 {
-  if (font->parent)
-    return font->parent->get_glyph (unicode, variation_selector, glyph);
+  hb_bool_t ret = font->parent->get_font_h_extents (metrics);
+  if (ret) {
+    metrics->ascender = font->parent_scale_y_distance (metrics->ascender);
+    metrics->descender = font->parent_scale_y_distance (metrics->descender);
+    metrics->line_gap = font->parent_scale_y_distance (metrics->line_gap);
+  }
+  return ret;
+}
 
+static hb_bool_t
+hb_font_get_font_v_extents_nil (hb_font_t *font,
+                                void *font_data HB_UNUSED,
+                                hb_font_extents_t *metrics,
+                                void *user_data HB_UNUSED)
+{
+  memset (metrics, 0, sizeof (*metrics));
+  return false;
+}
+static hb_bool_t
+hb_font_get_font_v_extents_parent (hb_font_t *font,
+                                   void *font_data HB_UNUSED,
+                                   hb_font_extents_t *metrics,
+                                   void *user_data HB_UNUSED)
+{
+  hb_bool_t ret = font->parent->get_font_v_extents (metrics);
+  if (ret) {
+    metrics->ascender = font->parent_scale_x_distance (metrics->ascender);
+    metrics->descender = font->parent_scale_x_distance (metrics->descender);
+    metrics->line_gap = font->parent_scale_x_distance (metrics->line_gap);
+  }
+  return ret;
+}
+
+static hb_bool_t
+hb_font_get_nominal_glyph_nil (hb_font_t *font HB_UNUSED,
+                               void *font_data HB_UNUSED,
+                               hb_codepoint_t unicode,
+                               hb_codepoint_t *glyph,
+                               void *user_data HB_UNUSED)
+{
   *glyph = 0;
   return false;
 }
+static hb_bool_t
+hb_font_get_nominal_glyph_parent (hb_font_t *font,
+                                  void *font_data HB_UNUSED,
+                                  hb_codepoint_t unicode,
+                                  hb_codepoint_t *glyph,
+                                  void *user_data HB_UNUSED)
+{
+  return font->parent->get_nominal_glyph (unicode, glyph);
+}
+
+static hb_bool_t
+hb_font_get_variation_glyph_nil (hb_font_t *font HB_UNUSED,
+                                 void *font_data HB_UNUSED,
+                                 hb_codepoint_t unicode,
+                                 hb_codepoint_t variation_selector,
+                                 hb_codepoint_t *glyph,
+                                 void *user_data HB_UNUSED)
+{
+  *glyph = 0;
+  return false;
+}
+static hb_bool_t
+hb_font_get_variation_glyph_parent (hb_font_t *font,
+                                    void *font_data HB_UNUSED,
+                                    hb_codepoint_t unicode,
+                                    hb_codepoint_t variation_selector,
+                                    hb_codepoint_t *glyph,
+                                    void *user_data HB_UNUSED)
+{
+  return font->parent->get_variation_glyph (unicode, variation_selector, glyph);
+}
+
 
 static hb_position_t
-hb_font_get_glyph_h_advance_nil (hb_font_t *font,
+hb_font_get_glyph_h_advance_nil (hb_font_t *font HB_UNUSED,
                                  void *font_data HB_UNUSED,
                                  hb_codepoint_t glyph,
                                  void *user_data HB_UNUSED)
 {
-  if (font->parent)
-    return font->parent_scale_x_distance (font->parent->get_glyph_h_advance (glyph));
-
   return font->x_scale;
 }
+static hb_position_t
+hb_font_get_glyph_h_advance_parent (hb_font_t *font,
+                                    void *font_data HB_UNUSED,
+                                    hb_codepoint_t glyph,
+                                    void *user_data HB_UNUSED)
+{
+  return font->parent_scale_x_distance (font->parent->get_glyph_h_advance (glyph));
+}
 
 static hb_position_t
-hb_font_get_glyph_v_advance_nil (hb_font_t *font,
+hb_font_get_glyph_v_advance_nil (hb_font_t *font HB_UNUSED,
                                  void *font_data HB_UNUSED,
                                  hb_codepoint_t glyph,
                                  void *user_data HB_UNUSED)
 {
-  if (font->parent)
-    return font->parent_scale_y_distance (font->parent->get_glyph_v_advance (glyph));
-
+  /* TODO use font_extents.ascender+descender */
   return font->y_scale;
 }
+static hb_position_t
+hb_font_get_glyph_v_advance_parent (hb_font_t *font,
+                                    void *font_data HB_UNUSED,
+                                    hb_codepoint_t glyph,
+                                    void *user_data HB_UNUSED)
+{
+  return font->parent_scale_y_distance (font->parent->get_glyph_v_advance (glyph));
+}
 
 static hb_bool_t
-hb_font_get_glyph_h_origin_nil (hb_font_t *font,
+hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED,
                                 void *font_data HB_UNUSED,
                                 hb_codepoint_t glyph,
                                 hb_position_t *x,
                                 hb_position_t *y,
                                 void *user_data HB_UNUSED)
 {
-  if (font->parent) {
-    hb_bool_t ret = font->parent->get_glyph_h_origin (glyph, x, y);
-    if (ret)
-      font->parent_scale_position (x, y);
-    return ret;
-  }
-
   *x = *y = 0;
-  return false;
+  return true;
+}
+static hb_bool_t
+hb_font_get_glyph_h_origin_parent (hb_font_t *font,
+                                   void *font_data HB_UNUSED,
+                                   hb_codepoint_t glyph,
+                                   hb_position_t *x,
+                                   hb_position_t *y,
+                                   void *user_data HB_UNUSED)
+{
+  hb_bool_t ret = font->parent->get_glyph_h_origin (glyph, x, y);
+  if (ret)
+    font->parent_scale_position (x, y);
+  return ret;
 }
 
 static hb_bool_t
-hb_font_get_glyph_v_origin_nil (hb_font_t *font,
+hb_font_get_glyph_v_origin_nil (hb_font_t *font HB_UNUSED,
                                 void *font_data HB_UNUSED,
                                 hb_codepoint_t glyph,
                                 hb_position_t *x,
                                 hb_position_t *y,
                                 void *user_data HB_UNUSED)
 {
-  if (font->parent) {
-    hb_bool_t ret = font->parent->get_glyph_v_origin (glyph, x, y);
-    if (ret)
-      font->parent_scale_position (x, y);
-    return ret;
-  }
-
   *x = *y = 0;
   return false;
 }
+static hb_bool_t
+hb_font_get_glyph_v_origin_parent (hb_font_t *font,
+                                   void *font_data HB_UNUSED,
+                                   hb_codepoint_t glyph,
+                                   hb_position_t *x,
+                                   hb_position_t *y,
+                                   void *user_data HB_UNUSED)
+{
+  hb_bool_t ret = font->parent->get_glyph_v_origin (glyph, x, y);
+  if (ret)
+    font->parent_scale_position (x, y);
+  return ret;
+}
 
 static hb_position_t
-hb_font_get_glyph_h_kerning_nil (hb_font_t *font,
+hb_font_get_glyph_h_kerning_nil (hb_font_t *font HB_UNUSED,
                                  void *font_data HB_UNUSED,
                                  hb_codepoint_t left_glyph,
                                  hb_codepoint_t right_glyph,
                                  void *user_data HB_UNUSED)
 {
-  if (font->parent)
-    return font->parent_scale_x_distance (font->parent->get_glyph_h_kerning (left_glyph, right_glyph));
-
   return 0;
 }
+static hb_position_t
+hb_font_get_glyph_h_kerning_parent (hb_font_t *font,
+                                    void *font_data HB_UNUSED,
+                                    hb_codepoint_t left_glyph,
+                                    hb_codepoint_t right_glyph,
+                                    void *user_data HB_UNUSED)
+{
+  return font->parent_scale_x_distance (font->parent->get_glyph_h_kerning (left_glyph, right_glyph));
+}
 
 static hb_position_t
-hb_font_get_glyph_v_kerning_nil (hb_font_t *font,
+hb_font_get_glyph_v_kerning_nil (hb_font_t *font HB_UNUSED,
                                  void *font_data HB_UNUSED,
                                  hb_codepoint_t top_glyph,
                                  hb_codepoint_t bottom_glyph,
                                  void *user_data HB_UNUSED)
 {
-  if (font->parent)
-    return font->parent_scale_y_distance (font->parent->get_glyph_v_kerning (top_glyph, bottom_glyph));
-
   return 0;
 }
+static hb_position_t
+hb_font_get_glyph_v_kerning_parent (hb_font_t *font,
+                                    void *font_data HB_UNUSED,
+                                    hb_codepoint_t top_glyph,
+                                    hb_codepoint_t bottom_glyph,
+                                    void *user_data HB_UNUSED)
+{
+  return font->parent_scale_y_distance (font->parent->get_glyph_v_kerning (top_glyph, bottom_glyph));
+}
 
 static hb_bool_t
-hb_font_get_glyph_extents_nil (hb_font_t *font,
+hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
                                void *font_data HB_UNUSED,
                                hb_codepoint_t glyph,
                                hb_glyph_extents_t *extents,
                                void *user_data HB_UNUSED)
 {
-  if (font->parent) {
-    hb_bool_t ret = font->parent->get_glyph_extents (glyph, extents);
-    if (ret) {
-      font->parent_scale_position (&extents->x_bearing, &extents->y_bearing);
-      font->parent_scale_distance (&extents->width, &extents->height);
-    }
-    return ret;
-  }
-
   memset (extents, 0, sizeof (*extents));
   return false;
 }
+static hb_bool_t
+hb_font_get_glyph_extents_parent (hb_font_t *font,
+                                  void *font_data HB_UNUSED,
+                                  hb_codepoint_t glyph,
+                                  hb_glyph_extents_t *extents,
+                                  void *user_data HB_UNUSED)
+{
+  hb_bool_t ret = font->parent->get_glyph_extents (glyph, extents);
+  if (ret) {
+    font->parent_scale_position (&extents->x_bearing, &extents->y_bearing);
+    font->parent_scale_distance (&extents->width, &extents->height);
+  }
+  return ret;
+}
 
 static hb_bool_t
-hb_font_get_glyph_contour_point_nil (hb_font_t *font,
+hb_font_get_glyph_contour_point_nil (hb_font_t *font HB_UNUSED,
                                      void *font_data HB_UNUSED,
                                      hb_codepoint_t glyph,
                                      unsigned int point_index,
@@ -176,45 +292,63 @@
                                      hb_position_t *y,
                                      void *user_data HB_UNUSED)
 {
-  if (font->parent) {
-    hb_bool_t ret = font->parent->get_glyph_contour_point (glyph, point_index, x, y);
-    if (ret)
-      font->parent_scale_position (x, y);
-    return ret;
-  }
-
   *x = *y = 0;
   return false;
 }
+static hb_bool_t
+hb_font_get_glyph_contour_point_parent (hb_font_t *font,
+                                        void *font_data HB_UNUSED,
+                                        hb_codepoint_t glyph,
+                                        unsigned int point_index,
+                                        hb_position_t *x,
+                                        hb_position_t *y,
+                                        void *user_data HB_UNUSED)
+{
+  hb_bool_t ret = font->parent->get_glyph_contour_point (glyph, point_index, x, y);
+  if (ret)
+    font->parent_scale_position (x, y);
+  return ret;
+}
 
 static hb_bool_t
-hb_font_get_glyph_name_nil (hb_font_t *font,
+hb_font_get_glyph_name_nil (hb_font_t *font HB_UNUSED,
                             void *font_data HB_UNUSED,
                             hb_codepoint_t glyph,
                             char *name, unsigned int size,
                             void *user_data HB_UNUSED)
 {
-  if (font->parent)
-    return font->parent->get_glyph_name (glyph, name, size);
-
   if (size) *name = '\0';
   return false;
 }
+static hb_bool_t
+hb_font_get_glyph_name_parent (hb_font_t *font,
+                               void *font_data HB_UNUSED,
+                               hb_codepoint_t glyph,
+                               char *name, unsigned int size,
+                               void *user_data HB_UNUSED)
+{
+  return font->parent->get_glyph_name (glyph, name, size);
+}
 
 static hb_bool_t
-hb_font_get_glyph_from_name_nil (hb_font_t *font,
+hb_font_get_glyph_from_name_nil (hb_font_t *font HB_UNUSED,
                                  void *font_data HB_UNUSED,
                                  const char *name, int len, /* -1 means nul-terminated */
                                  hb_codepoint_t *glyph,
                                  void *user_data HB_UNUSED)
 {
-  if (font->parent)
-    return font->parent->get_glyph_from_name (name, len, glyph);
-
   *glyph = 0;
   return false;
 }
-
+static hb_bool_t
+hb_font_get_glyph_from_name_parent (hb_font_t *font,
+                                    void *font_data HB_UNUSED,
+                                    const char *name, int len, /* -1 means nul-terminated */
+                                    hb_codepoint_t *glyph,
+                                    void *user_data HB_UNUSED)
+{
+  return font->parent->get_glyph_from_name (name, len, glyph);
+}
 
 static const hb_font_funcs_t _hb_font_funcs_nil = {
   HB_OBJECT_HEADER_STATIC,
@@ -222,9 +356,44 @@
   true, /* immutable */
 
   {
-#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_nil,
+#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+    HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+  },
+  {
+#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
     HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
 #undef HB_FONT_FUNC_IMPLEMENT
+  },
+  {
+    {
+#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_nil,
+      HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+    }
+  }
+};
+static const hb_font_funcs_t _hb_font_funcs_parent = {
+  HB_OBJECT_HEADER_STATIC,
+
+  true, /* immutable */
+
+  {
+#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+    HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+  },
+  {
+#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+    HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+  },
+  {
+    {
+#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_parent,
+      HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+    }
   }
 };
 
@@ -246,7 +415,7 @@
   if (!(ffuncs = hb_object_create<hb_font_funcs_t> ()))
     return hb_font_funcs_get_empty ();
 
-  ffuncs->get = _hb_font_funcs_nil.get;
+  ffuncs->get = _hb_font_funcs_parent.get;
 
   return ffuncs;
 }
@@ -263,7 +432,7 @@
 hb_font_funcs_t *
 hb_font_funcs_get_empty (void)
 {
-  return const_cast<hb_font_funcs_t *> (&_hb_font_funcs_nil);
+  return const_cast<hb_font_funcs_t *> (&_hb_font_funcs_parent);
 }
 
 /**
@@ -398,11 +567,11 @@
     ffuncs->destroy.name (ffuncs->user_data.name);                       \
                                                                          \
   if (func) {                                                            \
-    ffuncs->get.name = func;                                             \
+    ffuncs->get.f.name = func;                                           \
     ffuncs->user_data.name = user_data;                                  \
     ffuncs->destroy.name = destroy;                                      \
   } else {                                                               \
-    ffuncs->get.name = hb_font_get_##name##_nil;                         \
+    ffuncs->get.f.name = hb_font_get_##name##_parent;                    \
     ffuncs->user_data.name = NULL;                                       \
     ffuncs->destroy.name = NULL;                                         \
   }                                                                      \
@@ -411,10 +580,53 @@
 HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
 #undef HB_FONT_FUNC_IMPLEMENT
 
+bool
+hb_font_t::has_func (unsigned int i)
+{
+  if (parent && parent != hb_font_get_empty () && parent->has_func (i))
+    return true;
+  return this->klass->get.array[i] != _hb_font_funcs_parent.get.array[i];
+}
 
 /* Public getters */
 
 /**
+ * hb_font_get_h_extents:
+ * @font: a font.
+ * @extents: (out):
+ *
+ *
+ *
+ * Return value:
+ *
+ * Since: 1.1.3
+ **/
+hb_bool_t
+hb_font_get_h_extents (hb_font_t *font,
+                       hb_font_extents_t *extents)
+{
+  return font->get_font_h_extents (extents);
+}
+
+/**
+ * hb_font_get_v_extents:
+ * @font: a font.
+ * @extents: (out):
+ *
+ *
+ *
+ * Return value:
+ *
+ * Since: 1.1.3
+ **/
+hb_bool_t
+hb_font_get_v_extents (hb_font_t *font,
+                       hb_font_extents_t *extents)
+{
+  return font->get_font_v_extents (extents);
+}
+
+/**
  * hb_font_get_glyph:
  * @font: a font.
  * @unicode:
@@ -432,7 +644,50 @@
                    hb_codepoint_t unicode, hb_codepoint_t variation_selector,
                    hb_codepoint_t *glyph)
 {
-  return font->get_glyph (unicode, variation_selector, glyph);
+  if (unlikely (variation_selector))
+    return font->get_variation_glyph (unicode, variation_selector, glyph);
+  return font->get_nominal_glyph (unicode, glyph);
+}
+
+/**
+ * hb_font_get_nominal_glyph:
+ * @font: a font.
+ * @unicode:
+ * @glyph: (out):
+ *
+ *
+ *
+ * Return value:
+ *
+ * Since: 1.2.3
+ **/
+hb_bool_t
+hb_font_get_nominal_glyph (hb_font_t *font,
+                           hb_codepoint_t unicode,
+                           hb_codepoint_t *glyph)
+{
+  return font->get_nominal_glyph (unicode, glyph);
+}
+
+/**
+ * hb_font_get_variation_glyph:
+ * @font: a font.
+ * @unicode:
+ * @variation_selector:
+ * @glyph: (out):
+ *
+ *
+ *
+ * Return value:
+ *
+ * Since: 1.2.3
+ **/
+hb_bool_t
+hb_font_get_variation_glyph (hb_font_t *font,
+                             hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+                             hb_codepoint_t *glyph)
+{
+  return font->get_variation_glyph (unicode, variation_selector, glyph);
 }
 
 /**
@@ -639,6 +894,23 @@
 /* A bit higher-level, and with fallback */
 
 /**
+ * hb_font_get_extents_for_direction:
+ * @font: a font.
+ * @direction:
+ * @extents:
+ *
+ *
+ *
+ * Since: 1.1.3
+ **/
+void
+hb_font_get_extents_for_direction (hb_font_t *font,
+                                   hb_direction_t direction,
+                                   hb_font_extents_t *extents)
+{
+  return font->get_extents_for_direction (direction, extents);
+}
+/**
  * hb_font_get_glyph_advance_for_direction:
  * @font: a font.
  * @glyph:
@@ -858,6 +1130,7 @@
     return hb_font_get_empty ();
 
   hb_face_make_immutable (face);
+  font->parent = hb_font_get_empty ();
   font->face = hb_face_reference (face);
   font->klass = hb_font_funcs_get_empty ();
 
@@ -917,8 +1190,8 @@
     NULL, /* parent */
     const_cast<hb_face_t *> (&_hb_face_nil),
 
-    0, /* x_scale */
-    0, /* y_scale */
+    1000, /* x_scale */
+    1000, /* y_scale */
 
     0, /* x_ppem */
     0, /* y_ppem */
@@ -1264,3 +1537,131 @@
   if (x_ppem) *x_ppem = font->x_ppem;
   if (y_ppem) *y_ppem = font->y_ppem;
 }
+
+
+#ifndef HB_DISABLE_DEPRECATED
+
+/*
+ * Deprecated get_glyph_func():
+ */
+
+struct hb_trampoline_closure_t
+{
+  void *user_data;
+  hb_destroy_func_t destroy;
+  unsigned int ref_count;
+};
+
+template <typename FuncType>
+struct hb_trampoline_t
+{
+  hb_trampoline_closure_t closure; /* Must be first. */
+  FuncType func;
+};
+
+template <typename FuncType>
+static hb_trampoline_t<FuncType> *
+trampoline_create (FuncType           func,
+                   void              *user_data,
+                   hb_destroy_func_t  destroy)
+{
+  typedef hb_trampoline_t<FuncType> trampoline_t;
+
+  trampoline_t *trampoline = (trampoline_t *) calloc (1, sizeof (trampoline_t));
+
+  if (unlikely (!trampoline))
+    return NULL;
+
+  trampoline->closure.user_data = user_data;
+  trampoline->closure.destroy = destroy;
+  trampoline->closure.ref_count = 1;
+  trampoline->func = func;
+
+  return trampoline;
+}
+
+static void
+trampoline_reference (hb_trampoline_closure_t *closure)
+{
+  closure->ref_count++;
+}
+
+static void
+trampoline_destroy (void *user_data)
+{
+  hb_trampoline_closure_t *closure = (hb_trampoline_closure_t *) user_data;
+
+  if (--closure->ref_count)
+    return;
+
+  if (closure->destroy)
+    closure->destroy (closure->user_data);
+  free (closure);
+}
+
+typedef hb_trampoline_t<hb_font_get_glyph_func_t> hb_font_get_glyph_trampoline_t;
+
+static hb_bool_t
+hb_font_get_nominal_glyph_trampoline (hb_font_t *font,
+                                      void *font_data,
+                                      hb_codepoint_t unicode,
+                                      hb_codepoint_t *glyph,
+                                      void *user_data)
+{
+  hb_font_get_glyph_trampoline_t *trampoline = (hb_font_get_glyph_trampoline_t *) user_data;
+  return trampoline->func (font, font_data, unicode, 0, glyph, trampoline->closure.user_data);
+}
+
+static hb_bool_t
+hb_font_get_variation_glyph_trampoline (hb_font_t *font,
+                                        void *font_data,
+                                        hb_codepoint_t unicode,
+                                        hb_codepoint_t variation_selector,
+                                        hb_codepoint_t *glyph,
+                                        void *user_data)
+{
+  hb_font_get_glyph_trampoline_t *trampoline = (hb_font_get_glyph_trampoline_t *) user_data;
+  return trampoline->func (font, font_data, unicode, variation_selector, glyph, trampoline->closure.user_data);
+}
+
+/**
+ * hb_font_funcs_set_glyph_func:
+ * @ffuncs: font functions.
+ * @func: (closure user_data) (destroy destroy) (scope notified):
+ * @user_data:
+ * @destroy:
+ *
+ * Deprecated.  Use hb_font_funcs_set_nominal_glyph_func() and
+ * hb_font_funcs_set_variation_glyph_func() instead.
+ *
+ * Since: 0.9.2
+ * Deprecated: 1.2.3
+ **/
+void
+hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
+                              hb_font_get_glyph_func_t func,
+                              void *user_data, hb_destroy_func_t destroy)
+{
+  hb_font_get_glyph_trampoline_t *trampoline;
+
+  trampoline = trampoline_create (func, user_data, destroy);
+  if (unlikely (!trampoline))
+  {
+    if (destroy)
+      destroy (user_data);
+    return;
+  }
+
+  hb_font_funcs_set_nominal_glyph_func (ffuncs,
+                                        hb_font_get_nominal_glyph_trampoline,
+                                        trampoline,
+                                        trampoline_destroy);
+
+  trampoline_reference (&trampoline->closure);
+  hb_font_funcs_set_variation_glyph_func (ffuncs,
+                                          hb_font_get_variation_glyph_trampoline,
+                                          trampoline,
+                                          trampoline_destroy);
+}
+
+#endif /* HB_DISABLE_DEPRECATED */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.h	Wed Jul 05 22:06:46 2017 +0200
@@ -46,19 +46,19 @@
 
 typedef struct hb_font_funcs_t hb_font_funcs_t;
 
-hb_font_funcs_t *
+HB_EXTERN hb_font_funcs_t *
 hb_font_funcs_create (void);
 
-hb_font_funcs_t *
+HB_EXTERN hb_font_funcs_t *
 hb_font_funcs_get_empty (void);
 
-hb_font_funcs_t *
+HB_EXTERN hb_font_funcs_t *
 hb_font_funcs_reference (hb_font_funcs_t *ffuncs);
 
-void
+HB_EXTERN void
 hb_font_funcs_destroy (hb_font_funcs_t *ffuncs);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_funcs_set_user_data (hb_font_funcs_t    *ffuncs,
                              hb_user_data_key_t *key,
                              void *              data,
@@ -66,19 +66,37 @@
                              hb_bool_t           replace);
 
 
-void *
+HB_EXTERN void *
 hb_font_funcs_get_user_data (hb_font_funcs_t    *ffuncs,
                              hb_user_data_key_t *key);
 
 
-void
+HB_EXTERN void
 hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs);
 
 
-/* glyph extents */
+/* font and glyph extents */
+
+/* Note that typically ascender is positive and descender negative in coordinate systems that grow up. */
+typedef struct hb_font_extents_t
+{
+  hb_position_t ascender; /* typographic ascender. */
+  hb_position_t descender; /* typographic descender. */
+  hb_position_t line_gap; /* suggested line spacing gap. */
+  /*< private >*/
+  hb_position_t reserved9;
+  hb_position_t reserved8;
+  hb_position_t reserved7;
+  hb_position_t reserved6;
+  hb_position_t reserved5;
+  hb_position_t reserved4;
+  hb_position_t reserved3;
+  hb_position_t reserved2;
+  hb_position_t reserved1;
+} hb_font_extents_t;
 
 /* Note that height is negative in coordinate systems that grow up. */
 typedef struct hb_glyph_extents_t
@@ -89,13 +107,23 @@
   hb_position_t height; /* distance from top to bottom side. */
 } hb_glyph_extents_t;
 
-
 /* func types */
 
-typedef hb_bool_t (*hb_font_get_glyph_func_t) (hb_font_t *font, void *font_data,
-                                               hb_codepoint_t unicode, hb_codepoint_t variation_selector,
-                                               hb_codepoint_t *glyph,
-                                               void *user_data);
+typedef hb_bool_t (*hb_font_get_font_extents_func_t) (hb_font_t *font, void *font_data,
+                                                       hb_font_extents_t *metrics,
+                                                       void *user_data);
+typedef hb_font_get_font_extents_func_t hb_font_get_font_h_extents_func_t;
+typedef hb_font_get_font_extents_func_t hb_font_get_font_v_extents_func_t;
+
+
+typedef hb_bool_t (*hb_font_get_nominal_glyph_func_t) (hb_font_t *font, void *font_data,
+                                                       hb_codepoint_t unicode,
+                                                       hb_codepoint_t *glyph,
+                                                       void *user_data);
+typedef hb_bool_t (*hb_font_get_variation_glyph_func_t) (hb_font_t *font, void *font_data,
+                                                         hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+                                                         hb_codepoint_t *glyph,
+                                                         void *user_data);
 
 
 typedef hb_position_t (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void *font_data,
@@ -141,7 +169,23 @@
 /* func setters */
 
 /**
- * hb_font_funcs_set_glyph_func:
+ * hb_font_funcs_set_font_h_extents_func:
+ * @ffuncs: font functions.
+ * @func: (closure user_data) (destroy destroy) (scope notified):
+ * @user_data:
+ * @destroy:
+ *
+ *
+ *
+ * Since: 1.1.2
+ **/
+HB_EXTERN void
+hb_font_funcs_set_font_h_extents_func (hb_font_funcs_t *ffuncs,
+                                       hb_font_get_font_h_extents_func_t func,
+                                       void *user_data, hb_destroy_func_t destroy);
+
+/**
+ * hb_font_funcs_set_font_v_extents_func:
  * @ffuncs: font functions.
  * @func: (closure user_data) (destroy destroy) (scope notified):
  * @user_data:
@@ -149,12 +193,44 @@
  *
  *
  *
- * Since: 0.9.2
+ * Since: 1.1.2
+ **/
+HB_EXTERN void
+hb_font_funcs_set_font_v_extents_func (hb_font_funcs_t *ffuncs,
+                                       hb_font_get_font_v_extents_func_t func,
+                                       void *user_data, hb_destroy_func_t destroy);
+
+/**
+ * hb_font_funcs_set_nominal_glyph_func:
+ * @ffuncs: font functions.
+ * @func: (closure user_data) (destroy destroy) (scope notified):
+ * @user_data:
+ * @destroy:
+ *
+ *
+ *
+ * Since: 1.2.3
  **/
-void
-hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
-                              hb_font_get_glyph_func_t func,
-                              void *user_data, hb_destroy_func_t destroy);
+HB_EXTERN void
+hb_font_funcs_set_nominal_glyph_func (hb_font_funcs_t *ffuncs,
+                                      hb_font_get_nominal_glyph_func_t func,
+                                      void *user_data, hb_destroy_func_t destroy);
+
+/**
+ * hb_font_funcs_set_variation_glyph_func:
+ * @ffuncs: font functions.
+ * @func: (closure user_data) (destroy destroy) (scope notified):
+ * @user_data:
+ * @destroy:
+ *
+ *
+ *
+ * Since: 1.2.3
+ **/
+HB_EXTERN void
+hb_font_funcs_set_variation_glyph_func (hb_font_funcs_t *ffuncs,
+                                        hb_font_get_variation_glyph_func_t func,
+                                        void *user_data, hb_destroy_func_t destroy);
 
 /**
  * hb_font_funcs_set_glyph_h_advance_func:
@@ -167,7 +243,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_h_advance_func (hb_font_funcs_t *ffuncs,
                                         hb_font_get_glyph_h_advance_func_t func,
                                         void *user_data, hb_destroy_func_t destroy);
@@ -183,7 +259,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_v_advance_func (hb_font_funcs_t *ffuncs,
                                         hb_font_get_glyph_v_advance_func_t func,
                                         void *user_data, hb_destroy_func_t destroy);
@@ -199,7 +275,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_h_origin_func (hb_font_funcs_t *ffuncs,
                                        hb_font_get_glyph_h_origin_func_t func,
                                        void *user_data, hb_destroy_func_t destroy);
@@ -215,7 +291,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_v_origin_func (hb_font_funcs_t *ffuncs,
                                        hb_font_get_glyph_v_origin_func_t func,
                                        void *user_data, hb_destroy_func_t destroy);
@@ -231,7 +307,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs,
                                         hb_font_get_glyph_h_kerning_func_t func,
                                         void *user_data, hb_destroy_func_t destroy);
@@ -247,7 +323,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_v_kerning_func (hb_font_funcs_t *ffuncs,
                                         hb_font_get_glyph_v_kerning_func_t func,
                                         void *user_data, hb_destroy_func_t destroy);
@@ -263,7 +339,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs,
                                       hb_font_get_glyph_extents_func_t func,
                                       void *user_data, hb_destroy_func_t destroy);
@@ -279,7 +355,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_contour_point_func (hb_font_funcs_t *ffuncs,
                                             hb_font_get_glyph_contour_point_func_t func,
                                             void *user_data, hb_destroy_func_t destroy);
@@ -295,7 +371,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_name_func (hb_font_funcs_t *ffuncs,
                                    hb_font_get_glyph_name_func_t func,
                                    void *user_data, hb_destroy_func_t destroy);
@@ -311,57 +387,67 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_from_name_func (hb_font_funcs_t *ffuncs,
                                         hb_font_get_glyph_from_name_func_t func,
                                         void *user_data, hb_destroy_func_t destroy);
 
-
 /* func dispatch */
 
-hb_bool_t
-hb_font_get_glyph (hb_font_t *font,
-                   hb_codepoint_t unicode, hb_codepoint_t variation_selector,
-                   hb_codepoint_t *glyph);
+HB_EXTERN hb_bool_t
+hb_font_get_h_extents (hb_font_t *font,
+                       hb_font_extents_t *extents);
+HB_EXTERN hb_bool_t
+hb_font_get_v_extents (hb_font_t *font,
+                       hb_font_extents_t *extents);
 
-hb_position_t
+HB_EXTERN hb_bool_t
+hb_font_get_nominal_glyph (hb_font_t *font,
+                           hb_codepoint_t unicode,
+                           hb_codepoint_t *glyph);
+HB_EXTERN hb_bool_t
+hb_font_get_variation_glyph (hb_font_t *font,
+                             hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+                             hb_codepoint_t *glyph);
+
+HB_EXTERN hb_position_t
 hb_font_get_glyph_h_advance (hb_font_t *font,
                              hb_codepoint_t glyph);
-hb_position_t
+HB_EXTERN hb_position_t
 hb_font_get_glyph_v_advance (hb_font_t *font,
                              hb_codepoint_t glyph);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_get_glyph_h_origin (hb_font_t *font,
                             hb_codepoint_t glyph,
                             hb_position_t *x, hb_position_t *y);
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_get_glyph_v_origin (hb_font_t *font,
                             hb_codepoint_t glyph,
                             hb_position_t *x, hb_position_t *y);
 
-hb_position_t
+HB_EXTERN hb_position_t
 hb_font_get_glyph_h_kerning (hb_font_t *font,
                              hb_codepoint_t left_glyph, hb_codepoint_t right_glyph);
-hb_position_t
+HB_EXTERN hb_position_t
 hb_font_get_glyph_v_kerning (hb_font_t *font,
                              hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_get_glyph_extents (hb_font_t *font,
                            hb_codepoint_t glyph,
                            hb_glyph_extents_t *extents);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_get_glyph_contour_point (hb_font_t *font,
                                  hb_codepoint_t glyph, unsigned int point_index,
                                  hb_position_t *x, hb_position_t *y);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_get_glyph_name (hb_font_t *font,
                         hb_codepoint_t glyph,
                         char *name, unsigned int size);
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_get_glyph_from_name (hb_font_t *font,
                              const char *name, int len, /* -1 means nul-terminated */
                              hb_codepoint_t *glyph);
@@ -369,52 +455,63 @@
 
 /* high-level funcs, with fallback */
 
-void
+/* Calls either hb_font_get_nominal_glyph() if variation_selector is 0,
+ * otherwise callse hb_font_get_variation_glyph(). */
+HB_EXTERN hb_bool_t
+hb_font_get_glyph (hb_font_t *font,
+                   hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+                   hb_codepoint_t *glyph);
+
+HB_EXTERN void
+hb_font_get_extents_for_direction (hb_font_t *font,
+                                   hb_direction_t direction,
+                                   hb_font_extents_t *extents);
+HB_EXTERN void
 hb_font_get_glyph_advance_for_direction (hb_font_t *font,
                                          hb_codepoint_t glyph,
                                          hb_direction_t direction,
                                          hb_position_t *x, hb_position_t *y);
-void
+HB_EXTERN void
 hb_font_get_glyph_origin_for_direction (hb_font_t *font,
                                         hb_codepoint_t glyph,
                                         hb_direction_t direction,
                                         hb_position_t *x, hb_position_t *y);
-void
+HB_EXTERN void
 hb_font_add_glyph_origin_for_direction (hb_font_t *font,
                                         hb_codepoint_t glyph,
                                         hb_direction_t direction,
                                         hb_position_t *x, hb_position_t *y);
-void
+HB_EXTERN void
 hb_font_subtract_glyph_origin_for_direction (hb_font_t *font,
                                              hb_codepoint_t glyph,
                                              hb_direction_t direction,
                                              hb_position_t *x, hb_position_t *y);
 
-void
+HB_EXTERN void
 hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
                                          hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
                                          hb_direction_t direction,
                                          hb_position_t *x, hb_position_t *y);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_get_glyph_extents_for_origin (hb_font_t *font,
                                       hb_codepoint_t glyph,
                                       hb_direction_t direction,
                                       hb_glyph_extents_t *extents);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_get_glyph_contour_point_for_origin (hb_font_t *font,
                                             hb_codepoint_t glyph, unsigned int point_index,
                                             hb_direction_t direction,
                                             hb_position_t *x, hb_position_t *y);
 
 /* Generates gidDDD if glyph has no name. */
-void
+HB_EXTERN void
 hb_font_glyph_to_string (hb_font_t *font,
                          hb_codepoint_t glyph,
                          char *s, unsigned int size);
 /* Parses gidDDD and uniUUUU strings automatically. */
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_glyph_from_string (hb_font_t *font,
                            const char *s, int len, /* -1 means nul-terminated */
                            hb_codepoint_t *glyph);
@@ -426,22 +523,22 @@
 
 /* Fonts are very light-weight objects */
 
-hb_font_t *
+HB_EXTERN hb_font_t *
 hb_font_create (hb_face_t *face);
 
-hb_font_t *
+HB_EXTERN hb_font_t *
 hb_font_create_sub_font (hb_font_t *parent);
 
-hb_font_t *
+HB_EXTERN hb_font_t *
 hb_font_get_empty (void);
 
-hb_font_t *
+HB_EXTERN hb_font_t *
 hb_font_reference (hb_font_t *font);
 
-void
+HB_EXTERN void
 hb_font_destroy (hb_font_t *font);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_set_user_data (hb_font_t          *font,
                        hb_user_data_key_t *key,
                        void *              data,
@@ -449,46 +546,46 @@
                        hb_bool_t           replace);
 
 
-void *
+HB_EXTERN void *
 hb_font_get_user_data (hb_font_t          *font,
                        hb_user_data_key_t *key);
 
-void
+HB_EXTERN void
 hb_font_make_immutable (hb_font_t *font);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_is_immutable (hb_font_t *font);
 
-void
+HB_EXTERN void
 hb_font_set_parent (hb_font_t *font,
                     hb_font_t *parent);
 
-hb_font_t *
+HB_EXTERN hb_font_t *
 hb_font_get_parent (hb_font_t *font);
 
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_font_get_face (hb_font_t *font);
 
 
-void
+HB_EXTERN void
 hb_font_set_funcs (hb_font_t         *font,
                    hb_font_funcs_t   *klass,
                    void              *font_data,
                    hb_destroy_func_t  destroy);
 
 /* Be *very* careful with this function! */
-void
+HB_EXTERN void
 hb_font_set_funcs_data (hb_font_t         *font,
                         void              *font_data,
                         hb_destroy_func_t  destroy);
 
 
-void
+HB_EXTERN void
 hb_font_set_scale (hb_font_t *font,
                    int x_scale,
                    int y_scale);
 
-void
+HB_EXTERN void
 hb_font_get_scale (hb_font_t *font,
                    int *x_scale,
                    int *y_scale);
@@ -496,12 +593,12 @@
 /*
  * A zero value means "no hinting in that direction"
  */
-void
+HB_EXTERN void
 hb_font_set_ppem (hb_font_t *font,
                   unsigned int x_ppem,
                   unsigned int y_ppem);
 
-void
+HB_EXTERN void
 hb_font_get_ppem (hb_font_t *font,
                   unsigned int *x_ppem,
                   unsigned int *y_ppem);
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ft.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ft.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -70,11 +70,12 @@
 {
   FT_Face ft_face;
   int load_flags;
+  bool symbol; /* Whether selected cmap is symbol cmap. */
   bool unref; /* Whether to destroy ft_face when done. */
 };
 
 static hb_ft_font_t *
-_hb_ft_font_create (FT_Face ft_face, bool unref)
+_hb_ft_font_create (FT_Face ft_face, bool symbol, bool unref)
 {
   hb_ft_font_t *ft_font = (hb_ft_font_t *) calloc (1, sizeof (hb_ft_font_t));
 
@@ -82,6 +83,7 @@
     return NULL;
 
   ft_font->ft_face = ft_face;
+  ft_font->symbol = symbol;
   ft_font->unref = unref;
 
   ft_font->load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING;
@@ -90,10 +92,16 @@
 }
 
 static void
+_hb_ft_face_destroy (FT_Face ft_face)
+{
+  FT_Done_Face (ft_face);
+}
+
+static void
 _hb_ft_font_destroy (hb_ft_font_t *ft_font)
 {
   if (ft_font->unref)
-    FT_Done_Face (ft_font->ft_face);
+    _hb_ft_face_destroy (ft_font->ft_face);
 
   free (ft_font);
 }
@@ -155,21 +163,46 @@
 
 
 static hb_bool_t
-hb_ft_get_glyph (hb_font_t *font HB_UNUSED,
-                 void *font_data,
-                 hb_codepoint_t unicode,
-                 hb_codepoint_t variation_selector,
-                 hb_codepoint_t *glyph,
-                 void *user_data HB_UNUSED)
-
+hb_ft_get_nominal_glyph (hb_font_t *font HB_UNUSED,
+                         void *font_data,
+                         hb_codepoint_t unicode,
+                         hb_codepoint_t *glyph,
+                         void *user_data HB_UNUSED)
 {
   const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
-  unsigned int g;
+  unsigned int g = FT_Get_Char_Index (ft_font->ft_face, unicode);
 
-  if (likely (!variation_selector))
-    g = FT_Get_Char_Index (ft_font->ft_face, unicode);
-  else
-    g = FT_Face_GetCharVariantIndex (ft_font->ft_face, unicode, variation_selector);
+  if (unlikely (!g))
+  {
+    if (unlikely (ft_font->symbol) && unicode <= 0x00FFu)
+    {
+      /* For symbol-encoded OpenType fonts, we duplicate the
+       * U+F000..F0FF range at U+0000..U+00FF.  That's what
+       * Windows seems to do, and that's hinted about at:
+       * http://www.microsoft.com/typography/otspec/recom.htm
+       * under "Non-Standard (Symbol) Fonts". */
+      g = FT_Get_Char_Index (ft_font->ft_face, 0xF000u + unicode);
+      if (!g)
+        return false;
+    }
+    else
+      return false;
+  }
+
+  *glyph = g;
+  return true;
+}
+
+static hb_bool_t
+hb_ft_get_variation_glyph (hb_font_t *font HB_UNUSED,
+                           void *font_data,
+                           hb_codepoint_t unicode,
+                           hb_codepoint_t variation_selector,
+                           hb_codepoint_t *glyph,
+                           void *user_data HB_UNUSED)
+{
+  const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
+  unsigned int g = FT_Face_GetCharVariantIndex (ft_font->ft_face, unicode, variation_selector);
 
   if (unlikely (!g))
     return false;
@@ -217,18 +250,6 @@
 }
 
 static hb_bool_t
-hb_ft_get_glyph_h_origin (hb_font_t *font HB_UNUSED,
-                          void *font_data HB_UNUSED,
-                          hb_codepoint_t glyph HB_UNUSED,
-                          hb_position_t *x HB_UNUSED,
-                          hb_position_t *y HB_UNUSED,
-                          void *user_data HB_UNUSED)
-{
-  /* We always work in the horizontal coordinates. */
-  return true;
-}
-
-static hb_bool_t
 hb_ft_get_glyph_v_origin (hb_font_t *font HB_UNUSED,
                           void *font_data,
                           hb_codepoint_t glyph,
@@ -272,17 +293,6 @@
   return kerningv.x;
 }
 
-static hb_position_t
-hb_ft_get_glyph_v_kerning (hb_font_t *font HB_UNUSED,
-                           void *font_data HB_UNUSED,
-                           hb_codepoint_t top_glyph HB_UNUSED,
-                           hb_codepoint_t bottom_glyph HB_UNUSED,
-                           void *user_data HB_UNUSED)
-{
-  /* FreeType API doesn't support vertical kerning */
-  return 0;
-}
-
 static hb_bool_t
 hb_ft_get_glyph_extents (hb_font_t *font HB_UNUSED,
                          void *font_data,
@@ -300,6 +310,16 @@
   extents->y_bearing = ft_face->glyph->metrics.horiBearingY;
   extents->width = ft_face->glyph->metrics.width;
   extents->height = -ft_face->glyph->metrics.height;
+  if (font->x_scale < 0)
+  {
+    extents->x_bearing = -extents->x_bearing;
+    extents->width = -extents->width;
+  }
+  if (font->y_scale < 0)
+  {
+    extents->y_bearing = -extents->y_bearing;
+    extents->height = -extents->height;
+  }
   return true;
 }
 
@@ -379,25 +399,78 @@
   return *glyph != 0;
 }
 
+static hb_bool_t
+hb_ft_get_font_h_extents (hb_font_t *font HB_UNUSED,
+                          void *font_data,
+                          hb_font_extents_t *metrics,
+                          void *user_data HB_UNUSED)
+{
+  const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
+  FT_Face ft_face = ft_font->ft_face;
+  metrics->ascender = ft_face->size->metrics.ascender;
+  metrics->descender = ft_face->size->metrics.descender;
+  metrics->line_gap = ft_face->size->metrics.height - (ft_face->size->metrics.ascender - ft_face->size->metrics.descender);
+  if (font->y_scale < 0)
+  {
+    metrics->ascender = -metrics->ascender;
+    metrics->descender = -metrics->descender;
+    metrics->line_gap = -metrics->line_gap;
+  }
+  return true;
+}
+
+static hb_font_funcs_t *static_ft_funcs = NULL;
+
+#ifdef HB_USE_ATEXIT
+static
+void free_static_ft_funcs (void)
+{
+  hb_font_funcs_destroy (static_ft_funcs);
+}
+#endif
 
 static void
 _hb_ft_font_set_funcs (hb_font_t *font, FT_Face ft_face, bool unref)
 {
-  static const hb_font_funcs_t ft_ffuncs = {
-    HB_OBJECT_HEADER_STATIC,
+retry:
+  hb_font_funcs_t *funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ft_funcs);
 
-    true, /* immutable */
+  if (unlikely (!funcs))
+  {
+    funcs = hb_font_funcs_create ();
 
-    {
-#define HB_FONT_FUNC_IMPLEMENT(name) hb_ft_get_##name,
-      HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
-#undef HB_FONT_FUNC_IMPLEMENT
+    hb_font_funcs_set_font_h_extents_func (funcs, hb_ft_get_font_h_extents, NULL, NULL);
+    //hb_font_funcs_set_font_v_extents_func (funcs, hb_ft_get_font_v_extents, NULL, NULL);
+    hb_font_funcs_set_nominal_glyph_func (funcs, hb_ft_get_nominal_glyph, NULL, NULL);
+    hb_font_funcs_set_variation_glyph_func (funcs, hb_ft_get_variation_glyph, NULL, NULL);
+    hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ft_get_glyph_h_advance, NULL, NULL);
+    hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ft_get_glyph_v_advance, NULL, NULL);
+    //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ft_get_glyph_h_origin, NULL, NULL);
+    hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ft_get_glyph_v_origin, NULL, NULL);
+    hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ft_get_glyph_h_kerning, NULL, NULL);
+    //hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ft_get_glyph_v_kerning, NULL, NULL);
+    hb_font_funcs_set_glyph_extents_func (funcs, hb_ft_get_glyph_extents, NULL, NULL);
+    hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ft_get_glyph_contour_point, NULL, NULL);
+    hb_font_funcs_set_glyph_name_func (funcs, hb_ft_get_glyph_name, NULL, NULL);
+    hb_font_funcs_set_glyph_from_name_func (funcs, hb_ft_get_glyph_from_name, NULL, NULL);
+
+    hb_font_funcs_make_immutable (funcs);
+
+    if (!hb_atomic_ptr_cmpexch (&static_ft_funcs, NULL, funcs)) {
+      hb_font_funcs_destroy (funcs);
+      goto retry;
     }
+
+#ifdef HB_USE_ATEXIT
+    atexit (free_static_ft_funcs); /* First person registers atexit() callback. */
+#endif
   };
 
+  bool symbol = ft_face->charmap && ft_face->charmap->encoding == FT_ENCODING_MS_SYMBOL;
+
   hb_font_set_funcs (font,
-                     const_cast<hb_font_funcs_t *> (&ft_ffuncs),
-                     _hb_ft_font_create (ft_face, unref),
+                     funcs,
+                     _hb_ft_font_create (ft_face, symbol, unref),
                      (hb_destroy_func_t) _hb_ft_font_destroy);
 }
 
@@ -477,7 +550,7 @@
 hb_ft_face_create_referenced (FT_Face ft_face)
 {
   FT_Reference_Face (ft_face);
-  return hb_ft_face_create (ft_face, (hb_destroy_func_t) FT_Done_Face);
+  return hb_ft_face_create (ft_face, (hb_destroy_func_t) _hb_ft_face_destroy);
 }
 
 static void
@@ -557,7 +630,7 @@
 hb_ft_font_create_referenced (FT_Face ft_face)
 {
   FT_Reference_Face (ft_face);
-  return hb_ft_font_create (ft_face, (hb_destroy_func_t) FT_Done_Face);
+  return hb_ft_font_create (ft_face, (hb_destroy_func_t) _hb_ft_face_destroy);
 }
 
 
@@ -626,7 +699,8 @@
     return;
   }
 
-  FT_Select_Charmap (ft_face, FT_ENCODING_UNICODE);
+  if (FT_Select_Charmap (ft_face, FT_ENCODING_UNICODE))
+    FT_Select_Charmap (ft_face, FT_ENCODING_MS_SYMBOL);
 
   FT_Set_Char_Size (ft_face,
                     abs (font->x_scale), abs (font->y_scale),
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ft.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ft.h	Wed Jul 05 22:06:46 2017 +0200
@@ -59,7 +59,7 @@
  * probably should use (the more recent) hb_ft_face_create_referenced()
  * instead.
  */
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_ft_face_create (FT_Face           ft_face,
                    hb_destroy_func_t destroy);
 
@@ -71,7 +71,7 @@
  * Client is still responsible for making sure that ft-face is destroyed
  * after hb-face is.
  */
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_ft_face_create_cached (FT_Face ft_face);
 
 /* This version is like hb_ft_face_create(), except that it calls
@@ -81,7 +81,7 @@
  * This is the most convenient version to use.  Use it unless you have
  * very good reasons not to.
  */
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_ft_face_create_referenced (FT_Face ft_face);
 
 
@@ -98,26 +98,26 @@
 
 /* See notes on hb_ft_face_create().  Same issues re lifecycle-management
  * apply here.  Use hb_ft_font_create_referenced() if you can. */
-hb_font_t *
+HB_EXTERN hb_font_t *
 hb_ft_font_create (FT_Face           ft_face,
                    hb_destroy_func_t destroy);
 
 /* See notes on hb_ft_face_create_referenced() re lifecycle-management
  * issues. */
-hb_font_t *
+HB_EXTERN hb_font_t *
 hb_ft_font_create_referenced (FT_Face ft_face);
 
-FT_Face
+HB_EXTERN FT_Face
 hb_ft_font_get_face (hb_font_t *font);
 
-void
+HB_EXTERN void
 hb_ft_font_set_load_flags (hb_font_t *font, int load_flags);
 
-int
+HB_EXTERN int
 hb_ft_font_get_load_flags (hb_font_t *font);
 
 /* Makes an hb_font_t use FreeType internally to implement font functions. */
-void
+HB_EXTERN void
 hb_ft_font_set_funcs (hb_font_t *font);
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-open-file-private.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-open-file-private.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -140,7 +140,7 @@
 
   protected:
   Tag           ttcTag;         /* TrueType Collection ID string: 'ttcf' */
-  FixedVersion  version;        /* Version of the TTC Header (1.0),
+  FixedVersion<>version;        /* Version of the TTC Header (1.0),
                                  * 0x00010000u */
   ArrayOf<OffsetTo<OffsetTable, ULONG>, ULONG>
                 table;          /* Array of offsets to the OffsetTable for each font
@@ -187,7 +187,7 @@
   union {
   struct {
   Tag           ttcTag;         /* TrueType Collection ID string: 'ttcf' */
-  FixedVersion  version;        /* Version of the TTC Header (1.0 or 2.0),
+  FixedVersion<>version;        /* Version of the TTC Header (1.0 or 2.0),
                                  * 0x00010000u or 0x00020000u */
   }                     header;
   TTCHeaderVersion1     version1;
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-open-type-private.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-open-type-private.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -101,10 +101,8 @@
 #define DEFINE_SIZE_STATIC(size) \
   DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)); \
   static const unsigned int static_size = (size); \
-  static const unsigned int min_size = (size)
-
-/* Size signifying variable-sized array */
-#define VAR 1
+  static const unsigned int min_size = (size); \
+  inline unsigned int get_size (void) const { return (size); }
 
 #define DEFINE_SIZE_UNION(size, _member) \
   DEFINE_INSTANCE_ASSERTION (this->u._member.static_size == (size)); \
@@ -185,7 +183,7 @@
 
 /* This limits sanitizing time on really broken fonts. */
 #ifndef HB_SANITIZE_MAX_EDITS
-#define HB_SANITIZE_MAX_EDITS 100
+#define HB_SANITIZE_MAX_EDITS 32
 #endif
 
 struct hb_sanitize_context_t :
@@ -399,9 +397,9 @@
 
 struct hb_serialize_context_t
 {
-  inline hb_serialize_context_t (void *start, unsigned int size)
+  inline hb_serialize_context_t (void *start_, unsigned int size)
   {
-    this->start = (char *) start;
+    this->start = (char *) start_;
     this->end = this->start + size;
 
     this->ran_out_of_room = false;
@@ -495,10 +493,10 @@
     return reinterpret_cast<Type *> (&obj);
   }
 
-  inline void truncate (void *head)
+  inline void truncate (void *new_head)
   {
-    assert (this->start < head && head <= this->head);
-    this->head = (char *) head;
+    assert (this->start < new_head && new_head <= this->head);
+    this->head = (char *) new_head;
   }
 
   unsigned int debug_depth;
@@ -665,6 +663,24 @@
 /* 16-bit unsigned integer (USHORT) that describes a quantity in FUnits. */
 typedef USHORT UFWORD;
 
+/* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */
+struct F2DOT14 : SHORT
+{
+  //inline float to_float (void) const { return ???; }
+  //inline void set_float (float f) { v.set (f * ???); }
+  public:
+  DEFINE_SIZE_STATIC (2);
+};
+
+/* 32-bit signed fixed-point number (16.16). */
+struct Fixed: LONG
+{
+  //inline float to_float (void) const { return ???; }
+  //inline void set_float (float f) { v.set (f * ???); }
+  public:
+  DEFINE_SIZE_STATIC (4);
+};
+
 /* Date represented in number of seconds since 12:00 midnight, January 1,
  * 1904. The value is represented as a signed 64-bit integer. */
 struct LONGDATETIME
@@ -742,9 +758,10 @@
  * Version Numbers
  */
 
+template <typename FixedType=USHORT>
 struct FixedVersion
 {
-  inline uint32_t to_int (void) const { return (major << 16) + minor; }
+  inline uint32_t to_int (void) const { return (major << (sizeof(FixedType) * 8)) + minor; }
 
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
@@ -752,10 +769,10 @@
     return_trace (c->check_struct (this));
   }
 
-  USHORT major;
-  USHORT minor;
+  FixedType major;
+  FixedType minor;
   public:
-  DEFINE_SIZE_STATIC (4);
+  DEFINE_SIZE_STATIC (2 * sizeof(FixedType));
 };
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-cmap-table.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-cmap-table.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -69,61 +69,78 @@
 
 struct CmapSubtableFormat4
 {
-  inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
+  struct accelerator_t
   {
-    unsigned int segCount;
+    inline void init (const CmapSubtableFormat4 *subtable)
+    {
+      segCount = subtable->segCountX2 / 2;
+      endCount = subtable->values;
+      startCount = endCount + segCount + 1;
+      idDelta = startCount + segCount;
+      idRangeOffset = idDelta + segCount;
+      glyphIdArray = idRangeOffset + segCount;
+      glyphIdArrayLength = (subtable->length - 16 - 8 * segCount) / 2;
+    }
+
+    static inline bool get_glyph_func (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph)
+    {
+      const accelerator_t *thiz = (const accelerator_t *) obj;
+
+      /* Custom two-array bsearch. */
+      int min = 0, max = (int) thiz->segCount - 1;
+      const USHORT *startCount = thiz->startCount;
+      const USHORT *endCount = thiz->endCount;
+      unsigned int i;
+      while (min <= max)
+      {
+        int mid = (min + max) / 2;
+        if (codepoint < startCount[mid])
+          max = mid - 1;
+        else if (codepoint > endCount[mid])
+          min = mid + 1;
+        else
+        {
+          i = mid;
+          goto found;
+        }
+      }
+      return false;
+
+    found:
+      hb_codepoint_t gid;
+      unsigned int rangeOffset = thiz->idRangeOffset[i];
+      if (rangeOffset == 0)
+        gid = codepoint + thiz->idDelta[i];
+      else
+      {
+        /* Somebody has been smoking... */
+        unsigned int index = rangeOffset / 2 + (codepoint - thiz->startCount[i]) + i - thiz->segCount;
+        if (unlikely (index >= thiz->glyphIdArrayLength))
+          return false;
+        gid = thiz->glyphIdArray[index];
+        if (unlikely (!gid))
+          return false;
+        gid += thiz->idDelta[i];
+      }
+
+      *glyph = gid & 0xFFFFu;
+      return true;
+    }
+
     const USHORT *endCount;
     const USHORT *startCount;
     const USHORT *idDelta;
     const USHORT *idRangeOffset;
     const USHORT *glyphIdArray;
+    unsigned int segCount;
     unsigned int glyphIdArrayLength;
-
-    segCount = this->segCountX2 / 2;
-    endCount = this->values;
-    startCount = endCount + segCount + 1;
-    idDelta = startCount + segCount;
-    idRangeOffset = idDelta + segCount;
-    glyphIdArray = idRangeOffset + segCount;
-    glyphIdArrayLength = (this->length - 16 - 8 * segCount) / 2;
+  };
 
-    /* Custom two-array bsearch. */
-    int min = 0, max = (int) segCount - 1;
-    unsigned int i;
-    while (min <= max)
-    {
-      int mid = (min + max) / 2;
-      if (codepoint < startCount[mid])
-        max = mid - 1;
-      else if (codepoint > endCount[mid])
-        min = mid + 1;
-      else
-      {
-        i = mid;
-        goto found;
-      }
-    }
-    return false;
-
-  found:
-    hb_codepoint_t gid;
-    unsigned int rangeOffset = idRangeOffset[i];
-    if (rangeOffset == 0)
-      gid = codepoint + idDelta[i];
-    else
-    {
-      /* Somebody has been smoking... */
-      unsigned int index = rangeOffset / 2 + (codepoint - startCount[i]) + i - segCount;
-      if (unlikely (index >= glyphIdArrayLength))
-        return false;
-      gid = glyphIdArray[index];
-      if (unlikely (!gid))
-        return false;
-      gid += idDelta[i];
-    }
-
-    *glyph = gid & 0xFFFFu;
-    return true;
+  inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
+  {
+    accelerator_t accel;
+    accel.init (this);
+    return accel.get_glyph_func (&accel, codepoint, glyph);
   }
 
   inline bool sanitize (hb_sanitize_context_t *c) const
@@ -388,7 +405,7 @@
   }
 
   protected:
-  USHORT        format;         /* Format number is set to 0. */
+  USHORT        format;         /* Format number is set to 14. */
   ULONG         lengthZ;        /* Byte length of this subtable. */
   SortedArrayOf<VariationSelectorRecord, ULONG>
                 record;         /* Variation selector records; sorted
@@ -416,16 +433,6 @@
     }
   }
 
-  inline glyph_variant_t get_glyph_variant (hb_codepoint_t codepoint,
-                                            hb_codepoint_t variation_selector,
-                                            hb_codepoint_t *glyph) const
-  {
-    switch (u.format) {
-    case 14: return u.format14.get_glyph_variant(codepoint, variation_selector, glyph);
-    default: return GLYPH_VARIANT_NOT_FOUND;
-    }
-  }
-
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -442,7 +449,7 @@
     }
   }
 
-  protected:
+  public:
   union {
   USHORT                format;         /* Format identifier */
   CmapSubtableFormat0   format0;
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-font.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-font.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -35,6 +35,8 @@
 #include "hb-ot-head-table.hh"
 #include "hb-ot-hhea-table.hh"
 #include "hb-ot-hmtx-table.hh"
+#include "hb-ot-os2-table.hh"
+//#include "hb-ot-post-table.hh"
 
 
 struct hb_ot_face_metrics_accelerator_t
@@ -42,24 +44,58 @@
   unsigned int num_metrics;
   unsigned int num_advances;
   unsigned int default_advance;
+  unsigned short ascender;
+  unsigned short descender;
+  unsigned short line_gap;
+
   const OT::_mtx *table;
   hb_blob_t *blob;
 
   inline void init (hb_face_t *face,
-                    hb_tag_t _hea_tag, hb_tag_t _mtx_tag,
-                    unsigned int default_advance_)
+                    hb_tag_t _hea_tag,
+                    hb_tag_t _mtx_tag,
+                    hb_tag_t os2_tag)
   {
-    this->default_advance = default_advance_;
-    this->num_metrics = face->get_num_glyphs ();
+    this->default_advance = face->get_upem ();
+
+    bool got_font_extents = false;
+    if (os2_tag)
+    {
+      hb_blob_t *os2_blob = OT::Sanitizer<OT::os2>::sanitize (face->reference_table (os2_tag));
+      const OT::os2 *os2 = OT::Sanitizer<OT::os2>::lock_instance (os2_blob);
+#define USE_TYPO_METRICS (1u<<7)
+      if (0 != (os2->fsSelection & USE_TYPO_METRICS))
+      {
+        this->ascender = os2->sTypoAscender;
+        this->descender = os2->sTypoDescender;
+        this->line_gap = os2->sTypoLineGap;
+        got_font_extents = (this->ascender | this->descender) != 0;
+      }
+      hb_blob_destroy (os2_blob);
+    }
 
     hb_blob_t *_hea_blob = OT::Sanitizer<OT::_hea>::sanitize (face->reference_table (_hea_tag));
     const OT::_hea *_hea = OT::Sanitizer<OT::_hea>::lock_instance (_hea_blob);
     this->num_advances = _hea->numberOfLongMetrics;
+    if (!got_font_extents)
+    {
+      this->ascender = _hea->ascender;
+      this->descender = _hea->descender;
+      this->line_gap = _hea->lineGap;
+    }
     hb_blob_destroy (_hea_blob);
 
     this->blob = OT::Sanitizer<OT::_mtx>::sanitize (face->reference_table (_mtx_tag));
-    if (unlikely (!this->num_advances ||
-                  2 * (this->num_advances + this->num_metrics) > hb_blob_get_length (this->blob)))
+
+    /* Cap num_metrics() and num_advances() based on table length. */
+    unsigned int len = hb_blob_get_length (this->blob);
+    if (unlikely (this->num_advances * 4 > len))
+      this->num_advances = len / 4;
+    this->num_metrics = this->num_advances + (len - 4 * this->num_advances) / 2;
+
+    /* We MUST set num_metrics to zero if num_advances is zero.
+     * Our get_advance() depends on that. */
+    if (unlikely (!this->num_advances))
     {
       this->num_metrics = this->num_advances = 0;
       hb_blob_destroy (this->blob);
@@ -166,10 +202,48 @@
   }
 };
 
+typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj,
+                                          hb_codepoint_t codepoint,
+                                          hb_codepoint_t *glyph);
+
+template <typename Type>
+static inline bool get_glyph_from (const void *obj,
+                                   hb_codepoint_t codepoint,
+                                   hb_codepoint_t *glyph)
+{
+  const Type *typed_obj = (const Type *) obj;
+  return typed_obj->get_glyph (codepoint, glyph);
+}
+
+template <typename Type>
+static inline bool get_glyph_from_symbol (const void *obj,
+                                          hb_codepoint_t codepoint,
+                                          hb_codepoint_t *glyph)
+{
+  const Type *typed_obj = (const Type *) obj;
+  if (likely (typed_obj->get_glyph (codepoint, glyph)))
+    return true;
+
+  if (codepoint <= 0x00FFu)
+  {
+    /* For symbol-encoded OpenType fonts, we duplicate the
+     * U+F000..F0FF range at U+0000..U+00FF.  That's what
+     * Windows seems to do, and that's hinted about at:
+     * http://www.microsoft.com/typography/otspec/recom.htm
+     * under "Non-Standard (Symbol) Fonts". */
+    return typed_obj->get_glyph (0xF000u + codepoint, glyph);
+  }
+
+  return false;
+}
+
 struct hb_ot_face_cmap_accelerator_t
 {
-  const OT::CmapSubtable *table;
-  const OT::CmapSubtable *uvs_table;
+  hb_cmap_get_glyph_func_t get_glyph_func;
+  const void *get_glyph_data;
+  OT::CmapSubtableFormat4::accelerator_t format4_accel;
+
+  const OT::CmapSubtableFormat14 *uvs_table;
   hb_blob_t *blob;
 
   inline void init (hb_face_t *face)
@@ -177,8 +251,9 @@
     this->blob = OT::Sanitizer<OT::cmap>::sanitize (face->reference_table (HB_OT_TAG_cmap));
     const OT::cmap *cmap = OT::Sanitizer<OT::cmap>::lock_instance (this->blob);
     const OT::CmapSubtable *subtable = NULL;
-    const OT::CmapSubtable *subtable_uvs = NULL;
+    const OT::CmapSubtableFormat14 *subtable_uvs = NULL;
 
+    bool symbol = false;
     /* 32-bit subtables. */
     if (!subtable) subtable = cmap->find_subtable (3, 10);
     if (!subtable) subtable = cmap->find_subtable (0, 6);
@@ -189,17 +264,38 @@
     if (!subtable) subtable = cmap->find_subtable (0, 2);
     if (!subtable) subtable = cmap->find_subtable (0, 1);
     if (!subtable) subtable = cmap->find_subtable (0, 0);
-    if (!subtable) subtable = cmap->find_subtable (3, 0);
+    if (!subtable)(subtable = cmap->find_subtable (3, 0)) && (symbol = true);
     /* Meh. */
     if (!subtable) subtable = &OT::Null(OT::CmapSubtable);
 
     /* UVS subtable. */
-    if (!subtable_uvs) subtable_uvs = cmap->find_subtable (0, 5);
+    if (!subtable_uvs)
+    {
+      const OT::CmapSubtable *st = cmap->find_subtable (0, 5);
+      if (st && st->u.format == 14)
+        subtable_uvs = &st->u.format14;
+    }
     /* Meh. */
-    if (!subtable_uvs) subtable_uvs = &OT::Null(OT::CmapSubtable);
+    if (!subtable_uvs) subtable_uvs = &OT::Null(OT::CmapSubtableFormat14);
+
+    this->uvs_table = subtable_uvs;
 
-    this->table = subtable;
-    this->uvs_table = subtable_uvs;
+    this->get_glyph_data = subtable;
+    if (unlikely (symbol))
+      this->get_glyph_func = get_glyph_from_symbol<OT::CmapSubtable>;
+    else
+      switch (subtable->u.format) {
+      /* Accelerate format 4 and format 12. */
+      default: this->get_glyph_func = get_glyph_from<OT::CmapSubtable>;         break;
+      case 12: this->get_glyph_func = get_glyph_from<OT::CmapSubtableFormat12>; break;
+      case  4:
+        {
+          this->format4_accel.init (&subtable->u.format4);
+          this->get_glyph_data = &this->format4_accel;
+          this->get_glyph_func = this->format4_accel.get_glyph_func;
+        }
+        break;
+      }
   }
 
   inline void fini (void)
@@ -207,33 +303,77 @@
     hb_blob_destroy (this->blob);
   }
 
-  inline bool get_glyph (hb_codepoint_t  unicode,
-                         hb_codepoint_t  variation_selector,
-                         hb_codepoint_t *glyph) const
+  inline bool get_nominal_glyph (hb_codepoint_t  unicode,
+                                 hb_codepoint_t *glyph) const
   {
-    if (unlikely (variation_selector))
+    return this->get_glyph_func (this->get_glyph_data, unicode, glyph);
+  }
+
+  inline bool get_variation_glyph (hb_codepoint_t  unicode,
+                                   hb_codepoint_t  variation_selector,
+                                   hb_codepoint_t *glyph) const
+  {
+    switch (this->uvs_table->get_glyph_variant (unicode,
+                                                variation_selector,
+                                                glyph))
     {
-      switch (this->uvs_table->get_glyph_variant (unicode,
-                                                  variation_selector,
-                                                  glyph))
-      {
-        case OT::GLYPH_VARIANT_NOT_FOUND:       return false;
-        case OT::GLYPH_VARIANT_FOUND:           return true;
-        case OT::GLYPH_VARIANT_USE_DEFAULT:     break;
-      }
+      case OT::GLYPH_VARIANT_NOT_FOUND:         return false;
+      case OT::GLYPH_VARIANT_FOUND:             return true;
+      case OT::GLYPH_VARIANT_USE_DEFAULT:       break;
     }
 
-    return this->table->get_glyph (unicode, glyph);
+    return get_nominal_glyph (unicode, glyph);
   }
 };
 
+template <typename T>
+struct hb_lazy_loader_t
+{
+  inline void init (hb_face_t *face_)
+  {
+    face = face_;
+    instance = NULL;
+  }
+
+  inline void fini (void)
+  {
+    if (instance && instance != &OT::Null(T))
+    {
+      instance->fini();
+      free (instance);
+    }
+  }
+
+  inline const T* operator-> (void) const
+  {
+  retry:
+    T *p = (T *) hb_atomic_ptr_get (&instance);
+    if (unlikely (!p))
+    {
+      p = (T *) calloc (1, sizeof (T));
+      if (unlikely (!p))
+        return &OT::Null(T);
+      p->init (face);
+      if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<T **>(&instance), NULL, p)))
+      {
+        p->fini ();
+        goto retry;
+      }
+    }
+    return p;
+  }
+
+  private:
+  hb_face_t *face;
+  T *instance;
+};
 
 struct hb_ot_font_t
 {
   hb_ot_face_cmap_accelerator_t cmap;
   hb_ot_face_metrics_accelerator_t h_metrics;
   hb_ot_face_metrics_accelerator_t v_metrics;
-  hb_ot_face_glyf_accelerator_t glyf;
+  hb_lazy_loader_t<hb_ot_face_glyf_accelerator_t> glyf;
 };
 
 
@@ -245,11 +385,9 @@
   if (unlikely (!ot_font))
     return NULL;
 
-  unsigned int upem = face->get_upem ();
-
   ot_font->cmap.init (face);
-  ot_font->h_metrics.init (face, HB_OT_TAG_hhea, HB_OT_TAG_hmtx, upem>>1);
-  ot_font->v_metrics.init (face, HB_OT_TAG_vhea, HB_OT_TAG_vmtx, upem); /* TODO Can we do this lazily? */
+  ot_font->h_metrics.init (face, HB_OT_TAG_hhea, HB_OT_TAG_hmtx, HB_OT_TAG_os2);
+  ot_font->v_metrics.init (face, HB_OT_TAG_vhea, HB_OT_TAG_vmtx, HB_TAG_NONE); /* TODO Can we do this lazily? */
   ot_font->glyf.init (face);
 
   return ot_font;
@@ -268,16 +406,27 @@
 
 
 static hb_bool_t
-hb_ot_get_glyph (hb_font_t *font HB_UNUSED,
-                 void *font_data,
-                 hb_codepoint_t unicode,
-                 hb_codepoint_t variation_selector,
-                 hb_codepoint_t *glyph,
-                 void *user_data HB_UNUSED)
+hb_ot_get_nominal_glyph (hb_font_t *font HB_UNUSED,
+                         void *font_data,
+                         hb_codepoint_t unicode,
+                         hb_codepoint_t *glyph,
+                         void *user_data HB_UNUSED)
 
 {
   const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
-  return ot_font->cmap.get_glyph (unicode, variation_selector, glyph);
+  return ot_font->cmap.get_nominal_glyph (unicode, glyph);
+}
+
+static hb_bool_t
+hb_ot_get_variation_glyph (hb_font_t *font HB_UNUSED,
+                           void *font_data,
+                           hb_codepoint_t unicode,
+                           hb_codepoint_t variation_selector,
+                           hb_codepoint_t *glyph,
+                           void *user_data HB_UNUSED)
+{
+  const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+  return ot_font->cmap.get_variation_glyph (unicode, variation_selector, glyph);
 }
 
 static hb_position_t
@@ -301,52 +450,6 @@
 }
 
 static hb_bool_t
-hb_ot_get_glyph_h_origin (hb_font_t *font HB_UNUSED,
-                          void *font_data HB_UNUSED,
-                          hb_codepoint_t glyph HB_UNUSED,
-                          hb_position_t *x HB_UNUSED,
-                          hb_position_t *y HB_UNUSED,
-                          void *user_data HB_UNUSED)
-{
-  /* We always work in the horizontal coordinates. */
-  return true;
-}
-
-static hb_bool_t
-hb_ot_get_glyph_v_origin (hb_font_t *font HB_UNUSED,
-                          void *font_data,
-                          hb_codepoint_t glyph,
-                          hb_position_t *x,
-                          hb_position_t *y,
-                          void *user_data HB_UNUSED)
-{
-  /* TODO */
-  return false;
-}
-
-static hb_position_t
-hb_ot_get_glyph_h_kerning (hb_font_t *font,
-                           void *font_data,
-                           hb_codepoint_t left_glyph,
-                           hb_codepoint_t right_glyph,
-                           void *user_data HB_UNUSED)
-{
-  /* TODO */
-  return 0;
-}
-
-static hb_position_t
-hb_ot_get_glyph_v_kerning (hb_font_t *font HB_UNUSED,
-                           void *font_data HB_UNUSED,
-                           hb_codepoint_t top_glyph HB_UNUSED,
-                           hb_codepoint_t bottom_glyph HB_UNUSED,
-                           void *user_data HB_UNUSED)
-{
-  /* OpenType doesn't have vertical-kerning other than GPOS. */
-  return 0;
-}
-
-static hb_bool_t
 hb_ot_get_glyph_extents (hb_font_t *font HB_UNUSED,
                          void *font_data,
                          hb_codepoint_t glyph,
@@ -354,7 +457,7 @@
                          void *user_data HB_UNUSED)
 {
   const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
-  bool ret = ot_font->glyf.get_extents (glyph, extents);
+  bool ret = ot_font->glyf->get_extents (glyph, extents);
   extents->x_bearing = font->em_scale_x (extents->x_bearing);
   extents->y_bearing = font->em_scale_y (extents->y_bearing);
   extents->width     = font->em_scale_x (extents->width);
@@ -363,61 +466,85 @@
 }
 
 static hb_bool_t
-hb_ot_get_glyph_contour_point (hb_font_t *font HB_UNUSED,
-                               void *font_data,
-                               hb_codepoint_t glyph,
-                               unsigned int point_index,
-                               hb_position_t *x,
-                               hb_position_t *y,
-                               void *user_data HB_UNUSED)
+hb_ot_get_font_h_extents (hb_font_t *font HB_UNUSED,
+                          void *font_data,
+                          hb_font_extents_t *metrics,
+                          void *user_data HB_UNUSED)
 {
-  /* TODO */
-  return false;
+  const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+  metrics->ascender = font->em_scale_y (ot_font->h_metrics.ascender);
+  metrics->descender = font->em_scale_y (ot_font->h_metrics.descender);
+  metrics->line_gap = font->em_scale_y (ot_font->h_metrics.line_gap);
+  return true;
 }
 
 static hb_bool_t
-hb_ot_get_glyph_name (hb_font_t *font HB_UNUSED,
-                      void *font_data,
-                      hb_codepoint_t glyph,
-                      char *name, unsigned int size,
-                      void *user_data HB_UNUSED)
+hb_ot_get_font_v_extents (hb_font_t *font HB_UNUSED,
+                          void *font_data,
+                          hb_font_extents_t *metrics,
+                          void *user_data HB_UNUSED)
 {
-  /* TODO */
-  return false;
+  const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+  metrics->ascender = font->em_scale_x (ot_font->v_metrics.ascender);
+  metrics->descender = font->em_scale_x (ot_font->v_metrics.descender);
+  metrics->line_gap = font->em_scale_x (ot_font->v_metrics.line_gap);
+  return true;
 }
 
-static hb_bool_t
-hb_ot_get_glyph_from_name (hb_font_t *font HB_UNUSED,
-                           void *font_data,
-                           const char *name, int len, /* -1 means nul-terminated */
-                           hb_codepoint_t *glyph,
-                           void *user_data HB_UNUSED)
+static hb_font_funcs_t *static_ot_funcs = NULL;
+
+#ifdef HB_USE_ATEXIT
+static
+void free_static_ot_funcs (void)
 {
-  /* TODO */
-  return false;
+  hb_font_funcs_destroy (static_ot_funcs);
 }
-
+#endif
 
 static hb_font_funcs_t *
 _hb_ot_get_font_funcs (void)
 {
-  static const hb_font_funcs_t ot_ffuncs = {
-    HB_OBJECT_HEADER_STATIC,
+retry:
+  hb_font_funcs_t *funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ot_funcs);
 
-    true, /* immutable */
+  if (unlikely (!funcs))
+  {
+    funcs = hb_font_funcs_create ();
 
-    {
-#define HB_FONT_FUNC_IMPLEMENT(name) hb_ot_get_##name,
-      HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
-#undef HB_FONT_FUNC_IMPLEMENT
+    hb_font_funcs_set_font_h_extents_func (funcs, hb_ot_get_font_h_extents, NULL, NULL);
+    hb_font_funcs_set_font_v_extents_func (funcs, hb_ot_get_font_v_extents, NULL, NULL);
+    hb_font_funcs_set_nominal_glyph_func (funcs, hb_ot_get_nominal_glyph, NULL, NULL);
+    hb_font_funcs_set_variation_glyph_func (funcs, hb_ot_get_variation_glyph, NULL, NULL);
+    hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ot_get_glyph_h_advance, NULL, NULL);
+    hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ot_get_glyph_v_advance, NULL, NULL);
+    //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ot_get_glyph_h_origin, NULL, NULL);
+    //hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ot_get_glyph_v_origin, NULL, NULL);
+    //hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ot_get_glyph_h_kerning, NULL, NULL); TODO
+    //hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ot_get_glyph_v_kerning, NULL, NULL);
+    hb_font_funcs_set_glyph_extents_func (funcs, hb_ot_get_glyph_extents, NULL, NULL);
+    //hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ot_get_glyph_contour_point, NULL, NULL); TODO
+    //hb_font_funcs_set_glyph_name_func (funcs, hb_ot_get_glyph_name, NULL, NULL); TODO
+    //hb_font_funcs_set_glyph_from_name_func (funcs, hb_ot_get_glyph_from_name, NULL, NULL); TODO
+
+    hb_font_funcs_make_immutable (funcs);
+
+    if (!hb_atomic_ptr_cmpexch (&static_ot_funcs, NULL, funcs)) {
+      hb_font_funcs_destroy (funcs);
+      goto retry;
     }
+
+#ifdef HB_USE_ATEXIT
+    atexit (free_static_ot_funcs); /* First person registers atexit() callback. */
+#endif
   };
 
-  return const_cast<hb_font_funcs_t *> (&ot_ffuncs);
+  return funcs;
 }
 
 
 /**
+ * hb_ot_font_set_funcs:
+ *
  * Since: 0.9.28
  **/
 void
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-font.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-font.h	Wed Jul 05 22:06:46 2017 +0200
@@ -36,7 +36,7 @@
 HB_BEGIN_DECLS
 
 
-void
+HB_EXTERN void
 hb_ot_font_set_funcs (hb_font_t *font);
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-glyf-table.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-glyf-table.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -90,10 +90,10 @@
                                          * greater than or equal to zero,
                                          * this is a simple glyph; if negative,
                                          * this is a composite glyph. */
-  SHORT         xMin;                   /* Minimum x for coordinate data. */
-  SHORT         yMin;                   /* Minimum y for coordinate data. */
-  SHORT         xMax;                   /* Maximum x for coordinate data. */
-  SHORT         yMax;                   /* Maximum y for coordinate data. */
+  FWORD         xMin;                   /* Minimum x for coordinate data. */
+  FWORD         yMin;                   /* Minimum y for coordinate data. */
+  FWORD         xMax;                   /* Maximum x for coordinate data. */
+  FWORD         yMax;                   /* Maximum y for coordinate data. */
 
   DEFINE_SIZE_STATIC (10);
 };
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-head-table.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-head-table.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -55,13 +55,15 @@
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
-    return_trace (c->check_struct (this) && likely (version.major == 1));
+    return_trace (c->check_struct (this) &&
+                  version.major == 1 &&
+                  magicNumber == 0x5F0F3CF5u);
   }
 
   protected:
-  FixedVersion  version;                /* Version of the head table--currently
+  FixedVersion<>version;                /* Version of the head table--currently
                                          * 0x00010000u for version 1.0. */
-  FixedVersion  fontRevision;           /* Set by font manufacturer. */
+  FixedVersion<>fontRevision;           /* Set by font manufacturer. */
   ULONG         checkSumAdjustment;     /* To compute: set it to 0, sum the
                                          * entire font as ULONG, then store
                                          * 0xB1B0AFBAu - sum. */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-hhea-table.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-hhea-table.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -56,7 +56,7 @@
   }
 
   public:
-  FixedVersion  version;                /* 0x00010000u for version 1.0. */
+  FixedVersion<>version;                /* 0x00010000u for version 1.0. */
   FWORD         ascender;               /* Typographic ascent. */
   FWORD         descender;              /* Typographic descent. */
   FWORD         lineGap;                /* Typographic line gap. */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-hmtx-table.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-hmtx-table.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -44,8 +44,8 @@
 
 struct LongMetric
 {
-  USHORT        advance; /* Advance width/height. */
-  SHORT         lsb; /* Leading (left/top) side bearing. */
+  UFWORD        advance; /* Advance width/height. */
+  FWORD         lsb; /* Leading (left/top) side bearing. */
   public:
   DEFINE_SIZE_STATIC (4);
 };
@@ -74,7 +74,7 @@
                                          * be in the array, but that entry is
                                          * required. The last entry applies to
                                          * all subsequent glyphs. */
-  SHORT         leadingBearingX[VAR];   /* Here the advance is assumed
+  FWORD         leadingBearingX[VAR];   /* Here the advance is assumed
                                          * to be the same as the advance
                                          * for the last entry above. The
                                          * number of entries in this array is
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-common-private.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-common-private.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -34,6 +34,14 @@
 #include "hb-set-private.hh"
 
 
+#ifndef HB_MAX_NESTING_LEVEL
+#define HB_MAX_NESTING_LEVEL    6
+#endif
+#ifndef HB_MAX_CONTEXT_LENGTH
+#define HB_MAX_CONTEXT_LENGTH   64
+#endif
+
+
 namespace OT {
 
 
@@ -44,8 +52,6 @@
 
 
 #define NOT_COVERED             ((unsigned int) -1)
-#define MAX_NESTING_LEVEL       6
-#define MAX_CONTEXT_LENGTH      64
 
 
 
@@ -539,6 +545,9 @@
           c->try_set (&featureParams, new_offset) &&
           !featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE))
         return_trace (false);
+
+      if (c->edit_count > 1)
+        c->edit_count--; /* This was a "legitimate" edit; don't contribute to error count. */
     }
 
     return_trace (true);
@@ -573,6 +582,11 @@
   DEFINE_SIZE_STATIC (2);
 };
 
+} /* namespace OT */
+/* This has to be outside the namespace. */
+HB_MARK_AS_FLAG_T (OT::LookupFlag::Flags);
+namespace OT {
+
 struct Lookup
 {
   inline unsigned int get_subtable_count (void) const { return subTable.len; }
@@ -756,7 +770,11 @@
     TRACE_SERIALIZE (this);
     if (unlikely (!c->extend_min (*this))) return_trace (false);
 
-    if (unlikely (!num_glyphs)) return_trace (true);
+    if (unlikely (!num_glyphs))
+    {
+      rangeRecord.len.set (0);
+      return_trace (true);
+    }
 
     unsigned int num_ranges = 1;
     for (unsigned int i = 1; i < num_glyphs; i++)
@@ -1156,6 +1174,21 @@
   inline hb_position_t get_y_delta (hb_font_t *font) const
   { return get_delta (font->y_ppem, font->y_scale); }
 
+  inline unsigned int get_size (void) const
+  {
+    unsigned int f = deltaFormat;
+    if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * USHORT::static_size;
+    return USHORT::static_size * (4 + ((endSize - startSize) >> (4 - f)));
+  }
+
+  inline bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (c->check_struct (this) && c->check_range (this, this->get_size ()));
+  }
+
+  private:
+
   inline int get_delta (unsigned int ppem, int scale) const
   {
     if (!ppem) return 0;
@@ -1166,8 +1199,6 @@
 
     return (int) (pixels * (int64_t) scale / ppem);
   }
-
-
   inline int get_delta_pixels (unsigned int ppem_size) const
   {
     unsigned int f = deltaFormat;
@@ -1191,19 +1222,6 @@
     return delta;
   }
 
-  inline unsigned int get_size (void) const
-  {
-    unsigned int f = deltaFormat;
-    if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * USHORT::static_size;
-    return USHORT::static_size * (4 + ((endSize - startSize) >> (4 - f)));
-  }
-
-  inline bool sanitize (hb_sanitize_context_t *c) const
-  {
-    TRACE_SANITIZE (this);
-    return_trace (c->check_struct (this) && c->check_range (this, this->get_size ()));
-  }
-
   protected:
   USHORT        startSize;              /* Smallest size to correct--in ppem */
   USHORT        endSize;                /* Largest size to correct--in ppem */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gdef-table.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gdef-table.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -409,7 +409,7 @@
 
 
   protected:
-  FixedVersion  version;                /* Version of the GDEF table--currently
+  FixedVersion<>version;                /* Version of the GDEF table--currently
                                          * 0x00010002u */
   OffsetTo<ClassDef>
                 glyphClassDef;          /* Offset to class definition table
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gpos-table.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gpos-table.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -36,8 +36,17 @@
 
 
 /* buffer **position** var allocations */
-#define attach_lookback() var.u16[0] /* number of glyphs to go back to attach this glyph to its base */
-#define cursive_chain() var.i16[1] /* character to which this connects, may be positive or negative */
+#define attach_chain() var.i16[0] /* glyph to which this attaches to, relative to current glyphs; negative for going back, positive for forward. */
+#define attach_type() var.u8[2] /* attachment type */
+/* Note! if attach_chain() is zero, the value of attach_type() is irrelevant. */
+
+enum attach_type_t {
+  ATTACH_TYPE_NONE      = 0X00,
+
+  /* Each attachment should be either a mark or a cursive; can't be both. */
+  ATTACH_TYPE_MARK      = 0X01,
+  ATTACH_TYPE_CURSIVE   = 0X02,
+};
 
 
 /* Shared Tables: ValueRecord, Anchor Table, and MarkArray */
@@ -425,7 +434,9 @@
     hb_glyph_position_t &o = buffer->cur_pos();
     o.x_offset = base_x - mark_x;
     o.y_offset = base_y - mark_y;
-    o.attach_lookback() = buffer->idx - glyph_pos;
+    o.attach_type() = ATTACH_TYPE_MARK;
+    o.attach_chain() = (int) glyph_pos - (int) buffer->idx;
+    buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT;
 
     buffer->idx++;
     return_trace (true);
@@ -741,7 +752,7 @@
   inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
   {
     TRACE_COLLECT_GLYPHS (this);
-    /* (this+coverage).add_coverage (c->input); // Don't need this. */
+    (this+coverage).add_coverage (c->input);
 
     unsigned int count1 = class1Count;
     const ClassDef &klass1 = this+classDef1;
@@ -906,9 +917,6 @@
     TRACE_APPLY (this);
     hb_buffer_t *buffer = c->buffer;
 
-    /* We don't handle mark glyphs here. */
-    if (unlikely (_hb_glyph_info_is_mark (&buffer->cur()))) return_trace (false);
-
     const EntryExitRecord &this_record = entryExitRecord[(this+coverage).get_coverage  (buffer->cur().codepoint)];
     if (!this_record.exitAnchor) return_trace (false);
 
@@ -992,7 +1000,9 @@
      */
     reverse_cursive_minor_offset (pos, child, c->direction, parent);
 
-    pos[child].cursive_chain() = parent - child;
+    pos[child].attach_type() = ATTACH_TYPE_CURSIVE;
+    pos[child].attach_chain() = (int) parent - (int) child;
+    buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT;
     if (likely (HB_DIRECTION_IS_HORIZONTAL (c->direction)))
       pos[child].y_offset = y_offset;
     else
@@ -1067,7 +1077,7 @@
     unsigned int mark_index = (this+markCoverage).get_coverage  (buffer->cur().codepoint);
     if (likely (mark_index == NOT_COVERED)) return_trace (false);
 
-    /* now we search backwards for a non-mark glyph */
+    /* Now we search backwards for a non-mark glyph */
     hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
     skippy_iter.reset (buffer->idx, 1);
     skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
@@ -1079,7 +1089,7 @@
     } while (1);
 
     /* Checking that matched glyph is actually a base glyph by GDEF is too strong; disabled */
-    if (!_hb_glyph_info_is_base_glyph (&buffer->info[skippy_iter.idx])) { /*return_trace (false);*/ }
+    //if (!_hb_glyph_info_is_base_glyph (&buffer->info[skippy_iter.idx])) { return_trace (false); }
 
     unsigned int base_index = (this+baseCoverage).get_coverage  (buffer->info[skippy_iter.idx].codepoint);
     if (base_index == NOT_COVERED) return_trace (false);
@@ -1168,14 +1178,14 @@
     unsigned int mark_index = (this+markCoverage).get_coverage  (buffer->cur().codepoint);
     if (likely (mark_index == NOT_COVERED)) return_trace (false);
 
-    /* now we search backwards for a non-mark glyph */
+    /* Now we search backwards for a non-mark glyph */
     hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
     skippy_iter.reset (buffer->idx, 1);
     skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
     if (!skippy_iter.prev ()) return_trace (false);
 
     /* Checking that matched glyph is actually a ligature by GDEF is too strong; disabled */
-    if (!_hb_glyph_info_is_ligature (&buffer->info[skippy_iter.idx])) { /*return_trace (false);*/ }
+    //if (!_hb_glyph_info_is_ligature (&buffer->info[skippy_iter.idx])) { return_trace (false); }
 
     unsigned int j = skippy_iter.idx;
     unsigned int lig_index = (this+ligatureCoverage).get_coverage  (buffer->info[j].codepoint);
@@ -1499,7 +1509,8 @@
   { return CastR<PosLookup> (GSUBGPOS::get_lookup (i)); }
 
   static inline void position_start (hb_font_t *font, hb_buffer_t *buffer);
-  static inline void position_finish (hb_font_t *font, hb_buffer_t *buffer);
+  static inline void position_finish_advances (hb_font_t *font, hb_buffer_t *buffer);
+  static inline void position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer);
 
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
@@ -1516,13 +1527,13 @@
 static void
 reverse_cursive_minor_offset (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction, unsigned int new_parent)
 {
-  unsigned int j = pos[i].cursive_chain();
-  if (likely (!j))
+  int chain = pos[i].attach_chain(), type = pos[i].attach_type();
+  if (likely (!chain || 0 == (type & ATTACH_TYPE_CURSIVE)))
     return;
 
-  j += i;
+  pos[i].attach_chain() = 0;
 
-  pos[i].cursive_chain() = 0;
+  unsigned int j = (int) i + chain;
 
   /* Stop if we see new parent in the chain. */
   if (j == new_parent)
@@ -1535,62 +1546,68 @@
   else
     pos[j].x_offset = -pos[i].x_offset;
 
-  pos[j].cursive_chain() = i - j;
+  pos[j].attach_chain() = -chain;
+  pos[j].attach_type() = type;
 }
 static void
-fix_cursive_minor_offset (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction)
+propagate_attachment_offsets (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction)
 {
-  unsigned int j = pos[i].cursive_chain();
-  if (likely (!j))
+  /* Adjusts offsets of attached glyphs (both cursive and mark) to accumulate
+   * offset of glyph they are attached to. */
+  int chain = pos[i].attach_chain(), type = pos[i].attach_type();
+  if (likely (!chain))
     return;
 
-  j += i;
+  unsigned int j = (int) i + chain;
 
-  pos[i].cursive_chain() = 0;
-
-  fix_cursive_minor_offset (pos, j, direction);
+  pos[i].attach_chain() = 0;
 
-  if (HB_DIRECTION_IS_HORIZONTAL (direction))
-    pos[i].y_offset += pos[j].y_offset;
-  else
-    pos[i].x_offset += pos[j].x_offset;
-}
+  propagate_attachment_offsets (pos, j, direction);
+
+  assert (!!(type & ATTACH_TYPE_MARK) ^ !!(type & ATTACH_TYPE_CURSIVE));
 
-static void
-fix_mark_attachment (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction)
-{
-  if (likely (!(pos[i].attach_lookback())))
-    return;
-
-  unsigned int j = i - pos[i].attach_lookback();
-
-  pos[i].x_offset += pos[j].x_offset;
-  pos[i].y_offset += pos[j].y_offset;
+  if (type & ATTACH_TYPE_CURSIVE)
+  {
+    if (HB_DIRECTION_IS_HORIZONTAL (direction))
+      pos[i].y_offset += pos[j].y_offset;
+    else
+      pos[i].x_offset += pos[j].x_offset;
+  }
+  else /*if (type & ATTACH_TYPE_MARK)*/
+  {
+    pos[i].x_offset += pos[j].x_offset;
+    pos[i].y_offset += pos[j].y_offset;
 
-  if (HB_DIRECTION_IS_FORWARD (direction))
-    for (unsigned int k = j; k < i; k++) {
-      pos[i].x_offset -= pos[k].x_advance;
-      pos[i].y_offset -= pos[k].y_advance;
-    }
-  else
-    for (unsigned int k = j + 1; k < i + 1; k++) {
-      pos[i].x_offset += pos[k].x_advance;
-      pos[i].y_offset += pos[k].y_advance;
-    }
+    assert (j < i);
+    if (HB_DIRECTION_IS_FORWARD (direction))
+      for (unsigned int k = j; k < i; k++) {
+        pos[i].x_offset -= pos[k].x_advance;
+        pos[i].y_offset -= pos[k].y_advance;
+      }
+    else
+      for (unsigned int k = j + 1; k < i + 1; k++) {
+        pos[i].x_offset += pos[k].x_advance;
+        pos[i].y_offset += pos[k].y_advance;
+      }
+  }
 }
 
 void
 GPOS::position_start (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
 {
-  buffer->clear_positions ();
-
   unsigned int count = buffer->len;
   for (unsigned int i = 0; i < count; i++)
-    buffer->pos[i].attach_lookback() = buffer->pos[i].cursive_chain() = 0;
+    buffer->pos[i].attach_chain() = buffer->pos[i].attach_type() = 0;
 }
 
 void
-GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
+GPOS::position_finish_advances (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
+{
+  //_hb_buffer_assert_gsubgpos_vars (buffer);
+}
+
+void
+GPOS::position_finish_offsets (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
 {
   _hb_buffer_assert_gsubgpos_vars (buffer);
 
@@ -1598,13 +1615,10 @@
   hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer, &len);
   hb_direction_t direction = buffer->props.direction;
 
-  /* Handle cursive connections */
-  for (unsigned int i = 0; i < len; i++)
-    fix_cursive_minor_offset (pos, i, direction);
-
   /* Handle attachments */
-  for (unsigned int i = 0; i < len; i++)
-    fix_mark_attachment (pos, i, direction);
+  if (buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT)
+    for (unsigned int i = 0; i < len; i++)
+      propagate_attachment_offsets (pos, i, direction);
 }
 
 
@@ -1633,8 +1647,8 @@
 }
 
 
-#undef attach_lookback
-#undef cursive_chain
+#undef attach_chain
+#undef attach_type
 
 
 } /* namespace OT */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsub-table.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsub-table.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -265,16 +265,6 @@
     TRACE_APPLY (this);
     unsigned int count = substitute.len;
 
-    /* TODO:
-     * Testing shows that Uniscribe actually allows zero-len susbstitute,
-     * which essentially deletes a glyph.  We don't allow for now.  It
-     * can be confusing to the client since the cluster from the deleted
-     * glyph won't be merged with any output cluster...  Also, currently
-     * buffer->move_to() makes assumptions about this too.  Perhaps fix
-     * in the future after figuring out what to do with the clusters.
-     */
-    if (unlikely (!count)) return_trace (false);
-
     /* Special-case to make it in-place and not consider this
      * as a "multiplied" substitution. */
     if (unlikely (count == 1))
@@ -282,6 +272,13 @@
       c->replace_glyph (substitute.array[0]);
       return_trace (true);
     }
+    /* Spec disallows this, but Uniscribe allows it.
+     * https://github.com/behdad/harfbuzz/issues/253 */
+    else if (unlikely (count == 0))
+    {
+      c->buffer->delete_glyph ();
+      return_trace (true);
+    }
 
     unsigned int klass = _hb_glyph_info_is_ligature (&c->buffer->cur()) ?
                          HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH : 0;
@@ -630,7 +627,7 @@
     unsigned int total_component_count = 0;
 
     unsigned int match_length = 0;
-    unsigned int match_positions[MAX_CONTEXT_LENGTH];
+    unsigned int match_positions[HB_MAX_CONTEXT_LENGTH];
 
     if (likely (!match_input (c, count,
                               &component[1],
@@ -970,7 +967,7 @@
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY (this);
-    if (unlikely (c->nesting_level_left != MAX_NESTING_LEVEL))
+    if (unlikely (c->nesting_level_left != HB_MAX_NESTING_LEVEL))
       return_trace (false); /* No chaining to this type */
 
     unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
@@ -1268,7 +1265,6 @@
   { return CastR<SubstLookup> (GSUBGPOS::get_lookup (i)); }
 
   static inline void substitute_start (hb_font_t *font, hb_buffer_t *buffer);
-  static inline void substitute_finish (hb_font_t *font, hb_buffer_t *buffer);
 
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
@@ -1289,19 +1285,32 @@
 
   const GDEF &gdef = *hb_ot_layout_from_face (font->face)->gdef;
   unsigned int count = buffer->len;
+  hb_glyph_info_t *info = buffer->info;
   for (unsigned int i = 0; i < count; i++)
   {
-    _hb_glyph_info_set_glyph_props (&buffer->info[i], gdef.get_glyph_props (buffer->info[i].codepoint));
-    _hb_glyph_info_clear_lig_props (&buffer->info[i]);
+    unsigned int props = gdef.get_glyph_props (info[i].codepoint);
+    if (!props)
+    {
+      /* Never mark default-ignorables as marks.
+       * They won't get in the way of lookups anyway,
+       * but having them as mark will cause them to be skipped
+       * over if the lookup-flag says so, but at least for the
+       * Mongolian variation selectors, looks like Uniscribe
+       * marks them as non-mark.  Some Mongolian fonts without
+       * GDEF rely on this.  Another notable character that
+       * this applies to is COMBINING GRAPHEME JOINER. */
+      props = (_hb_glyph_info_get_general_category (&info[i]) !=
+               HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK ||
+               _hb_glyph_info_is_default_ignorable (&info[i])) ?
+              HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH :
+              HB_OT_LAYOUT_GLYPH_PROPS_MARK;
+    }
+    _hb_glyph_info_set_glyph_props (&info[i], props);
+    _hb_glyph_info_clear_lig_props (&info[i]);
     buffer->info[i].syllable() = 0;
   }
 }
 
-void
-GSUB::substitute_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer HB_UNUSED)
-{
-}
-
 
 /* Out-of-class implementation for methods recursing */
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsubgpos-private.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsubgpos-private.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -74,7 +74,7 @@
 
   hb_closure_context_t (hb_face_t *face_,
                         hb_set_t *glyphs_,
-                        unsigned int nesting_level_left_ = MAX_NESTING_LEVEL) :
+                        unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
                           face (face_),
                           glyphs (glyphs_),
                           recurse_func (NULL),
@@ -196,7 +196,7 @@
                                hb_set_t  *glyphs_input,  /* OUT. May be NULL */
                                hb_set_t  *glyphs_after,  /* OUT. May be NULL */
                                hb_set_t  *glyphs_output, /* OUT. May be NULL */
-                               unsigned int nesting_level_left_ = MAX_NESTING_LEVEL) :
+                               unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
                               face (face_),
                               before (glyphs_before ? glyphs_before : hb_set_get_empty ()),
                               input  (glyphs_input  ? glyphs_input  : hb_set_get_empty ()),
@@ -319,7 +319,7 @@
       if (!c->check_glyph_property (&info, lookup_props))
         return SKIP_YES;
 
-      if (unlikely (_hb_glyph_info_is_default_ignorable (&info) &&
+      if (unlikely (_hb_glyph_info_is_default_ignorable_and_not_fvs (&info) &&
                     (ignore_zwnj || !_hb_glyph_info_is_zwnj (&info)) &&
                     (ignore_zwj || !_hb_glyph_info_is_zwj (&info))))
         return SKIP_MAYBE;
@@ -355,11 +355,11 @@
     {
       matcher.set_lookup_props (lookup_props);
     }
-    inline void set_match_func (matcher_t::match_func_t match_func,
-                                const void *match_data,
+    inline void set_match_func (matcher_t::match_func_t match_func_,
+                                const void *match_data_,
                                 const USHORT glyph_data[])
     {
-      matcher.set_match_func (match_func, match_data);
+      matcher.set_match_func (match_func_, match_data_);
       match_glyph_data = glyph_data;
     }
 
@@ -483,7 +483,7 @@
                         lookup_mask (1),
                         auto_zwj (true),
                         recurse_func (NULL),
-                        nesting_level_left (MAX_NESTING_LEVEL),
+                        nesting_level_left (HB_MAX_NESTING_LEVEL),
                         lookup_props (0),
                         gdef (*hb_ot_layout_from_face (face)->gdef),
                         has_glyph_classes (gdef.has_glyph_classes ()),
@@ -704,13 +704,13 @@
                                 match_func_t match_func,
                                 const void *match_data,
                                 unsigned int *end_offset,
-                                unsigned int match_positions[MAX_CONTEXT_LENGTH],
+                                unsigned int match_positions[HB_MAX_CONTEXT_LENGTH],
                                 bool *p_is_mark_ligature = NULL,
                                 unsigned int *p_total_component_count = NULL)
 {
   TRACE_APPLY (NULL);
 
-  if (unlikely (count > MAX_CONTEXT_LENGTH)) return_trace (false);
+  if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return_trace (false);
 
   hb_buffer_t *buffer = c->buffer;
 
@@ -784,7 +784,7 @@
 }
 static inline bool ligate_input (hb_apply_context_t *c,
                                  unsigned int count, /* Including the first glyph */
-                                 unsigned int match_positions[MAX_CONTEXT_LENGTH], /* Including the first glyph */
+                                 unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */
                                  unsigned int match_length,
                                  hb_codepoint_t lig_glyph,
                                  bool is_mark_ligature,
@@ -836,19 +836,21 @@
     if (_hb_glyph_info_get_general_category (&buffer->cur()) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
     {
       _hb_glyph_info_set_general_category (&buffer->cur(), HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER);
-      _hb_glyph_info_set_modified_combining_class (&buffer->cur(), 0);
     }
   }
   c->replace_glyph_with_ligature (lig_glyph, klass);
 
   for (unsigned int i = 1; i < count; i++)
   {
-    while (buffer->idx < match_positions[i])
+    while (buffer->idx < match_positions[i] && !buffer->in_error)
     {
       if (!is_mark_ligature) {
+        unsigned int this_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
+        if (this_comp == 0)
+          this_comp = last_num_components;
         unsigned int new_lig_comp = components_so_far - last_num_components +
-                                    MIN (MAX (_hb_glyph_info_get_lig_comp (&buffer->cur()), 1u), last_num_components);
-        _hb_glyph_info_set_lig_props_for_mark (&buffer->cur(), lig_id, new_lig_comp);
+                                    MIN (this_comp, last_num_components);
+          _hb_glyph_info_set_lig_props_for_mark (&buffer->cur(), lig_id, new_lig_comp);
       }
       buffer->next_glyph ();
     }
@@ -865,8 +867,11 @@
     /* Re-adjust components for any marks following. */
     for (unsigned int i = buffer->idx; i < buffer->len; i++) {
       if (last_lig_id == _hb_glyph_info_get_lig_id (&buffer->info[i])) {
+        unsigned int this_comp = _hb_glyph_info_get_lig_comp (&buffer->info[i]);
+        if (!this_comp)
+          break;
         unsigned int new_lig_comp = components_so_far - last_num_components +
-                                    MIN (MAX (_hb_glyph_info_get_lig_comp (&buffer->info[i]), 1u), last_num_components);
+                                    MIN (this_comp, last_num_components);
         _hb_glyph_info_set_lig_props_for_mark (&buffer->info[i], lig_id, new_lig_comp);
       } else
         break;
@@ -944,7 +949,7 @@
 
 static inline bool apply_lookup (hb_apply_context_t *c,
                                  unsigned int count, /* Including the first glyph */
-                                 unsigned int match_positions[MAX_CONTEXT_LENGTH], /* Including the first glyph */
+                                 unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */
                                  unsigned int lookupCount,
                                  const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
                                  unsigned int match_length)
@@ -966,12 +971,17 @@
       match_positions[j] += delta;
   }
 
-  for (unsigned int i = 0; i < lookupCount; i++)
+  for (unsigned int i = 0; i < lookupCount && !buffer->in_error; i++)
   {
     unsigned int idx = lookupRecord[i].sequenceIndex;
     if (idx >= count)
       continue;
 
+    /* Don't recurse to ourself at same position.
+     * Note that this test is too naive, it doesn't catch longer loops. */
+    if (idx == 0 && lookupRecord[i].lookupListIndex == c->lookup_index)
+      continue;
+
     buffer->move_to (match_positions[idx]);
 
     unsigned int orig_len = buffer->backtrack_len () + buffer->lookahead_len ();
@@ -986,16 +996,19 @@
 
     /* Recursed lookup changed buffer len.  Adjust. */
 
-    /* end can't go back past the current match position.
-     * Note: this is only true because we do NOT allow MultipleSubst
-     * with zero sequence len. */
-    end = MAX ((int) match_positions[idx] + 1, int (end) + delta);
+    end = int (end) + delta;
+    if (end <= match_positions[idx])
+    {
+      /* There can't be any further changes. */
+      assert (end == match_positions[idx]);
+      break;
+    }
 
     unsigned int next = idx + 1; /* next now is the position after the recursed lookup. */
 
     if (delta > 0)
     {
-      if (unlikely (delta + count > MAX_CONTEXT_LENGTH))
+      if (unlikely (delta + count > HB_MAX_CONTEXT_LENGTH))
         break;
     }
     else
@@ -1094,7 +1107,7 @@
                                          ContextApplyLookupContext &lookup_context)
 {
   unsigned int match_length = 0;
-  unsigned int match_positions[MAX_CONTEXT_LENGTH];
+  unsigned int match_positions[HB_MAX_CONTEXT_LENGTH];
   return match_input (c,
                       inputCount, input,
                       lookup_context.funcs.match, lookup_context.match_data,
@@ -1621,7 +1634,7 @@
                                                ChainContextApplyLookupContext &lookup_context)
 {
   unsigned int match_length = 0;
-  unsigned int match_positions[MAX_CONTEXT_LENGTH];
+  unsigned int match_positions[HB_MAX_CONTEXT_LENGTH];
   return match_input (c,
                       inputCount, input,
                       lookup_context.funcs.match, lookup_context.match_data[1],
@@ -2267,7 +2280,7 @@
   }
 
   protected:
-  FixedVersion  version;        /* Version of the GSUB/GPOS table--initially set
+  FixedVersion<>version;        /* Version of the GSUB/GPOS table--initially set
                                  * to 0x00010000u */
   OffsetTo<ScriptList>
                 scriptList;     /* ScriptList table */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-jstf-table.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-jstf-table.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -218,7 +218,7 @@
   }
 
   protected:
-  FixedVersion  version;        /* Version of the JSTF table--initially set
+  FixedVersion<>version;        /* Version of the JSTF table--initially set
                                  * to 0x00010000u */
   RecordArrayOf<JstfScript>
                 scriptList;     /* Array of JstfScripts--listed
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-private.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-private.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -49,7 +49,7 @@
  * GDEF
  */
 
-typedef enum
+enum hb_ot_layout_glyph_props_flags_t
 {
   /* The following three match LookupFlags::Ignore* numbers. */
   HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH   = 0x02u,
@@ -64,7 +64,8 @@
   HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE     = HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED |
                                           HB_OT_LAYOUT_GLYPH_PROPS_LIGATED |
                                           HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED
-} hb_ot_layout_glyph_class_mask_t;
+};
+HB_MARK_AS_FLAG_T (hb_ot_layout_glyph_props_flags_t);
 
 
 /*
@@ -98,21 +99,20 @@
                                 const hb_ot_layout_lookup_accelerator_t &accel);
 
 
-/* Should be called after all the substitute_lookup's are done */
-HB_INTERNAL void
-hb_ot_layout_substitute_finish (hb_font_t    *font,
-                                hb_buffer_t  *buffer);
-
-
-/* Should be called before all the position_lookup's are done.  Resets positions to zero. */
+/* Should be called before all the position_lookup's are done. */
 HB_INTERNAL void
 hb_ot_layout_position_start (hb_font_t    *font,
                              hb_buffer_t  *buffer);
 
-/* Should be called after all the position_lookup's are done */
+/* Should be called after all the position_lookup's are done, to finish advances. */
 HB_INTERNAL void
-hb_ot_layout_position_finish (hb_font_t    *font,
-                              hb_buffer_t  *buffer);
+hb_ot_layout_position_finish_advances (hb_font_t    *font,
+                                       hb_buffer_t  *buffer);
+
+/* Should be called after hb_ot_layout_position_finish_advances, to finish offsets. */
+HB_INTERNAL void
+hb_ot_layout_position_finish_offsets (hb_font_t    *font,
+                                      hb_buffer_t  *buffer);
 
 
 
@@ -180,8 +180,7 @@
  */
 
 /* buffer var allocations, used during the entire shaping process */
-#define unicode_props0()        var2.u8[0]
-#define unicode_props1()        var2.u8[1]
+#define unicode_props()         var2.u16[0]
 
 /* buffer var allocations, used during the GSUB/GPOS processing */
 #define glyph_props()           var1.u16[0] /* GDEF glyph properties */
@@ -214,48 +213,146 @@
 
 /* unicode_props */
 
-enum {
-  MASK0_ZWJ       = 0x20u,
-  MASK0_ZWNJ      = 0x40u,
-  MASK0_IGNORABLE = 0x80u,
-  MASK0_GEN_CAT   = 0x1Fu
+/* Design:
+ * unicode_props() is a two-byte number.  The low byte includes:
+ * - General_Category: 5 bits.
+ * - A bit each for:
+ *   * Is it Default_Ignorable(); we have a modified Default_Ignorable().
+ *   * Whether it's one of the three Mongolian Free Variation Selectors.
+ *   * One free bit right now.
+ *
+ * The high-byte has different meanings, switched by the Gen-Cat:
+ * - For Mn,Mc,Me: the modified Combining_Class.
+ * - For Cf: whether it's ZWJ, ZWNJ, or something else.
+ * - For Ws: index of which space character this is, if space fallback
+ *   is needed, ie. we don't set this by default, only if asked to.
+ */
+
+enum hb_unicode_props_flags_t {
+  UPROPS_MASK_GEN_CAT   = 0x001Fu,
+  UPROPS_MASK_IGNORABLE = 0x0020u,
+  UPROPS_MASK_FVS       = 0x0040u, /* MONGOLIAN FREE VARIATION SELECTOR 1..3 */
+
+  /* If GEN_CAT=FORMAT, top byte masks: */
+  UPROPS_MASK_Cf_ZWJ    = 0x0100u,
+  UPROPS_MASK_Cf_ZWNJ   = 0x0200u
 };
+HB_MARK_AS_FLAG_T (hb_unicode_props_flags_t);
 
 static inline void
-_hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unicode)
+_hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer)
 {
-  /* XXX This shouldn't be inlined, or at least not while is_default_ignorable() is inline. */
-  info->unicode_props0() = ((unsigned int) unicode->general_category (info->codepoint)) |
-                           (unicode->is_default_ignorable (info->codepoint) ? MASK0_IGNORABLE : 0) |
-                           (info->codepoint == 0x200Cu ? MASK0_ZWNJ : 0) |
-                           (info->codepoint == 0x200Du ? MASK0_ZWJ : 0);
-  info->unicode_props1() = unicode->modified_combining_class (info->codepoint);
+  hb_unicode_funcs_t *unicode = buffer->unicode;
+  unsigned int u = info->codepoint;
+  unsigned int gen_cat = (unsigned int) unicode->general_category (u);
+  unsigned int props = gen_cat;
+
+  if (u >= 0x80)
+  {
+    buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII;
+    if (unlikely (unicode->is_default_ignorable (u)))
+    {
+      buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES;
+      props |=  UPROPS_MASK_IGNORABLE;
+      if (u == 0x200Cu) props |= UPROPS_MASK_Cf_ZWNJ;
+      if (u == 0x200Du) props |= UPROPS_MASK_Cf_ZWJ;
+      /* Mongolian Free Variation Selectors need to be remembered
+       * because although we need to hide them like default-ignorables,
+       * they need to non-ignorable during shaping.  This is similar to
+       * what we do for joiners in Indic-like shapers, but since the
+       * FVSes are GC=Mn, we have use a separate bit to remember them.
+       * Fixes:
+       * https://github.com/behdad/harfbuzz/issues/234
+       */
+      if (unlikely (hb_in_range (u, 0x180Bu, 0x180Du))) props |= UPROPS_MASK_FVS;
+    }
+    else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL (gen_cat)))
+    {
+      /* The above check is just an optimization to let in only things we need further
+       * processing on. */
+
+      /* Only Mn and Mc can have non-zero ccc:
+       * http://www.unicode.org/policies/stability_policy.html#Property_Value
+       * """
+       * Canonical_Combining_Class, General_Category
+       * All characters other than those with General_Category property values
+       * Spacing_Mark (Mc) and Nonspacing_Mark (Mn) have the Canonical_Combining_Class
+       * property value 0.
+       * 1.1.5+
+       * """
+       *
+       * Also, all Mn's that are Default_Ignorable, have ccc=0, hence
+       * the "else if".
+       */
+      props |= unicode->modified_combining_class (info->codepoint)<<8;
+
+      /* Recategorize emoji skin-tone modifiers as Unicode mark, so they
+       * behave correctly in non-native directionality.  They originally
+       * are MODIFIER_SYMBOL.  Fixes:
+       * https://github.com/behdad/harfbuzz/issues/169
+       */
+      if (unlikely (hb_in_range (u, 0x1F3FBu, 0x1F3FFu)))
+      {
+        props = gen_cat = HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK;
+      }
+    }
+  }
+
+  info->unicode_props() = props;
 }
 
 static inline void
 _hb_glyph_info_set_general_category (hb_glyph_info_t *info,
                                      hb_unicode_general_category_t gen_cat)
 {
-  info->unicode_props0() = (unsigned int) gen_cat | ((info->unicode_props0()) & ~MASK0_GEN_CAT);
+  /* Clears top-byte. */
+  info->unicode_props() = (unsigned int) gen_cat | (info->unicode_props() & (0xFF & ~UPROPS_MASK_GEN_CAT));
 }
 
 static inline hb_unicode_general_category_t
 _hb_glyph_info_get_general_category (const hb_glyph_info_t *info)
 {
-  return (hb_unicode_general_category_t) (info->unicode_props0() & MASK0_GEN_CAT);
+  return (hb_unicode_general_category_t) (info->unicode_props() & UPROPS_MASK_GEN_CAT);
 }
 
+static inline bool
+_hb_glyph_info_is_unicode_mark (const hb_glyph_info_t *info)
+{
+  return HB_UNICODE_GENERAL_CATEGORY_IS_MARK (info->unicode_props() & UPROPS_MASK_GEN_CAT);
+}
 static inline void
 _hb_glyph_info_set_modified_combining_class (hb_glyph_info_t *info,
                                              unsigned int modified_class)
 {
-  info->unicode_props1() = modified_class;
+  if (unlikely (!_hb_glyph_info_is_unicode_mark (info)))
+    return;
+  info->unicode_props() = (modified_class<<8) | (info->unicode_props() & 0xFF);
 }
-
 static inline unsigned int
 _hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info)
 {
-  return info->unicode_props1();
+  return _hb_glyph_info_is_unicode_mark (info) ? info->unicode_props()>>8 : 0;
+}
+
+static inline bool
+_hb_glyph_info_is_unicode_space (const hb_glyph_info_t *info)
+{
+  return _hb_glyph_info_get_general_category (info) ==
+         HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR;
+}
+static inline void
+_hb_glyph_info_set_unicode_space_fallback_type (hb_glyph_info_t *info, hb_unicode_funcs_t::space_t s)
+{
+  if (unlikely (!_hb_glyph_info_is_unicode_space (info)))
+    return;
+  info->unicode_props() = (((unsigned int) s)<<8) | (info->unicode_props() & 0xFF);
+}
+static inline hb_unicode_funcs_t::space_t
+_hb_glyph_info_get_unicode_space_fallback_type (const hb_glyph_info_t *info)
+{
+  return _hb_glyph_info_is_unicode_space (info) ?
+         (hb_unicode_funcs_t::space_t) (info->unicode_props()>>8) :
+         hb_unicode_funcs_t::NOT_SPACE;
 }
 
 static inline bool _hb_glyph_info_ligated (const hb_glyph_info_t *info);
@@ -263,25 +360,44 @@
 static inline hb_bool_t
 _hb_glyph_info_is_default_ignorable (const hb_glyph_info_t *info)
 {
-  return (info->unicode_props0() & MASK0_IGNORABLE) && !_hb_glyph_info_ligated (info);
+  return (info->unicode_props() & UPROPS_MASK_IGNORABLE) &&
+         !_hb_glyph_info_ligated (info);
+}
+static inline hb_bool_t
+_hb_glyph_info_is_default_ignorable_and_not_fvs (const hb_glyph_info_t *info)
+{
+  return ((info->unicode_props() & (UPROPS_MASK_IGNORABLE|UPROPS_MASK_FVS))
+          == UPROPS_MASK_IGNORABLE) &&
+         !_hb_glyph_info_ligated (info);
 }
 
+static inline bool
+_hb_glyph_info_is_unicode_format (const hb_glyph_info_t *info)
+{
+  return _hb_glyph_info_get_general_category (info) ==
+         HB_UNICODE_GENERAL_CATEGORY_FORMAT;
+}
 static inline hb_bool_t
 _hb_glyph_info_is_zwnj (const hb_glyph_info_t *info)
 {
-  return !!(info->unicode_props0() & MASK0_ZWNJ);
+  return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & UPROPS_MASK_Cf_ZWNJ);
 }
-
 static inline hb_bool_t
 _hb_glyph_info_is_zwj (const hb_glyph_info_t *info)
 {
-  return !!(info->unicode_props0() & MASK0_ZWJ);
+  return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & UPROPS_MASK_Cf_ZWJ);
 }
-
+static inline hb_bool_t
+_hb_glyph_info_is_joiner (const hb_glyph_info_t *info)
+{
+  return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & (UPROPS_MASK_Cf_ZWNJ|UPROPS_MASK_Cf_ZWJ));
+}
 static inline void
 _hb_glyph_info_flip_joiners (hb_glyph_info_t *info)
 {
-  info->unicode_props0() ^= MASK0_ZWNJ | MASK0_ZWJ;
+  if (!_hb_glyph_info_is_unicode_format (info))
+    return;
+  info->unicode_props() ^= UPROPS_MASK_Cf_ZWNJ | UPROPS_MASK_Cf_ZWJ;
 }
 
 /* lig_props: aka lig_id / lig_comp
@@ -442,11 +558,9 @@
 }
 
 static inline void
-_hb_glyph_info_clear_substituted_and_ligated_and_multiplied (hb_glyph_info_t *info)
+_hb_glyph_info_clear_substituted (hb_glyph_info_t *info)
 {
-  info->glyph_props() &= ~(HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED |
-                           HB_OT_LAYOUT_GLYPH_PROPS_LIGATED |
-                           HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED);
+  info->glyph_props() &= ~(HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED);
 }
 
 
@@ -455,22 +569,19 @@
 static inline void
 _hb_buffer_allocate_unicode_vars (hb_buffer_t *buffer)
 {
-  HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props0);
-  HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props1);
+  HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props);
 }
 
 static inline void
 _hb_buffer_deallocate_unicode_vars (hb_buffer_t *buffer)
 {
-  HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props0);
-  HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props1);
+  HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props);
 }
 
 static inline void
 _hb_buffer_assert_unicode_vars (hb_buffer_t *buffer)
 {
-  HB_BUFFER_ASSERT_VAR (buffer, unicode_props0);
-  HB_BUFFER_ASSERT_VAR (buffer, unicode_props1);
+  HB_BUFFER_ASSERT_VAR (buffer, unicode_props);
 }
 
 static inline void
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -60,6 +60,80 @@
   layout->gpos_blob = OT::Sanitizer<OT::GPOS>::sanitize (face->reference_table (HB_OT_TAG_GPOS));
   layout->gpos = OT::Sanitizer<OT::GPOS>::lock_instance (layout->gpos_blob);
 
+  {
+    /*
+     * The ugly business of blacklisting individual fonts' tables happen here!
+     * See this thread for why we finally had to bend in and do this:
+     * https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html
+     */
+    unsigned int gdef_len = hb_blob_get_length (layout->gdef_blob);
+    unsigned int gsub_len = hb_blob_get_length (layout->gsub_blob);
+    unsigned int gpos_len = hb_blob_get_length (layout->gpos_blob);
+    if (0
+      /* sha1sum:c5ee92f0bca4bfb7d06c4d03e8cf9f9cf75d2e8a Windows 7? timesi.ttf */
+      || (442 == gdef_len && 42038 == gpos_len && 2874 == gsub_len)
+      /* sha1sum:37fc8c16a0894ab7b749e35579856c73c840867b Windows 7? timesbi.ttf */
+      || (430 == gdef_len && 40662 == gpos_len && 2874 == gsub_len)
+      /* sha1sum:19fc45110ea6cd3cdd0a5faca256a3797a069a80 Windows 7 timesi.ttf */
+      || (442 == gdef_len && 39116 == gpos_len && 2874 == gsub_len)
+      /* sha1sum:6d2d3c9ed5b7de87bc84eae0df95ee5232ecde26 Windows 7 timesbi.ttf */
+      || (430 == gdef_len && 39374 == gpos_len && 2874 == gsub_len)
+      /* sha1sum:8583225a8b49667c077b3525333f84af08c6bcd8 OS X 10.11.3 Times New Roman Italic.ttf */
+      || (490 == gdef_len && 41638 == gpos_len && 3046 == gsub_len)
+      /* sha1sum:ec0f5a8751845355b7c3271d11f9918a966cb8c9 OS X 10.11.3 Times New Roman Bold Italic.ttf */
+      || (478 == gdef_len && 41902 == gpos_len && 3046 == gsub_len)
+    )
+    {
+      /* In certain versions of Times New Roman Italic and Bold Italic,
+       * ASCII double quotation mark U+0022, mapped to glyph 5, has wrong
+       * glyph class 3 (mark) in GDEF.  Nuke the GDEF to avoid zero-width
+       * double-quote.  See:
+       * https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html
+       */
+     if (3 == layout->gdef->get_glyph_class (5))
+       layout->gdef = &OT::Null(OT::GDEF);
+    }
+    else if (0
+      /* sha1sum:96eda93f7d33e79962451c6c39a6b51ee893ce8c  tahoma.ttf from Windows 8 */
+      || (898 == gdef_len && 46470 == gpos_len && 12554 == gsub_len)
+      /* sha1sum:20928dc06014e0cd120b6fc942d0c3b1a46ac2bc  tahomabd.ttf from Windows 8 */
+      || (910 == gdef_len && 47732 == gpos_len && 12566 == gsub_len)
+      /* sha1sum:4f95b7e4878f60fa3a39ca269618dfde9721a79e  tahoma.ttf from Windows 8.1 */
+      || (928 == gdef_len && 59332 == gpos_len && 23298 == gsub_len)
+      /* sha1sum:6d400781948517c3c0441ba42acb309584b73033  tahomabd.ttf from Windows 8.1 */
+      || (940 == gdef_len && 60732 == gpos_len && 23310 == gsub_len)
+      /* sha1sum:e55fa2dfe957a9f7ec26be516a0e30b0c925f846  tahoma.ttf from Windows 10 */
+      || (994 == gdef_len && 60336 == gpos_len && 24474 == gsub_len)
+      /* sha1sum:7199385abb4c2cc81c83a151a7599b6368e92343  tahomabd.ttf from Windows 10 */
+      || (1006 == gdef_len && 61740 == gpos_len && 24470 == gsub_len)
+      /* sha1sum:b0d36cf5a2fbe746a3dd277bffc6756a820807a7  Tahoma.ttf from Mac OS X 10.9 */
+      || (832 == gdef_len && 47162 == gpos_len && 7324 == gsub_len)
+      /* sha1sum:12fc4538e84d461771b30c18b5eb6bd434e30fba  Tahoma Bold.ttf from Mac OS X 10.9 */
+      || (844 == gdef_len && 45474 == gpos_len && 7302 == gsub_len)
+      /* sha1sum:73da7f025b238a3f737aa1fde22577a6370f77b0  himalaya.ttf from Windows 8 */
+      || (192 == gdef_len && 7254 == gpos_len && 12638 == gsub_len)
+      /* sha1sum:6e80fd1c0b059bbee49272401583160dc1e6a427  himalaya.ttf from Windows 8.1 */
+      || (192 == gdef_len && 7254 == gpos_len && 12690 == gsub_len)
+      /* 8d9267aea9cd2c852ecfb9f12a6e834bfaeafe44  cantarell-fonts-0.0.21/otf/Cantarell-Regular.otf */
+      /* 983988ff7b47439ab79aeaf9a45bd4a2c5b9d371  cantarell-fonts-0.0.21/otf/Cantarell-Oblique.otf */
+      || (188 == gdef_len && 3852 == gpos_len && 248 == gsub_len)
+      /* 2c0c90c6f6087ffbfea76589c93113a9cbb0e75f  cantarell-fonts-0.0.21/otf/Cantarell-Bold.otf */
+      /* 55461f5b853c6da88069ffcdf7f4dd3f8d7e3e6b  cantarell-fonts-0.0.21/otf/Cantarell-Bold-Oblique.otf */
+      || (188 == gdef_len && 3426 == gpos_len && 264 == gsub_len)
+    )
+    {
+      /* Many versions of Tahoma have bad GDEF tables that incorrectly classify some spacing marks
+       * such as certain IPA symbols as glyph class 3. So do older versions of Microsoft Himalaya,
+       * and the version of Cantarell shipped by Ubuntu 16.04.
+       * Nuke the GDEF tables of these fonts to avoid unwanted width-zeroing.
+       * See https://bugzilla.mozilla.org/show_bug.cgi?id=1279925
+       *     https://bugzilla.mozilla.org/show_bug.cgi?id=1279693
+       *     https://bugzilla.mozilla.org/show_bug.cgi?id=1279875
+       */
+      layout->gdef = &OT::Null(OT::GDEF);
+    }
+  }
+
   layout->gsub_lookup_count = layout->gsub->get_lookup_count ();
   layout->gpos_lookup_count = layout->gpos->get_lookup_count ();
 
@@ -130,6 +204,8 @@
 }
 
 /**
+ * hb_ot_layout_get_glyph_class:
+ *
  * Since: 0.9.7
  **/
 hb_ot_layout_glyph_class_t
@@ -140,6 +216,8 @@
 }
 
 /**
+ * hb_ot_layout_get_glyphs_in_class:
+ *
  * Since: 0.9.7
  **/
 void
@@ -365,6 +443,8 @@
 }
 
 /**
+ * hb_ot_layout_language_get_required_feature:
+ *
  * Since: 0.9.30
  **/
 hb_bool_t
@@ -452,6 +532,8 @@
 }
 
 /**
+ * hb_ot_layout_feature_get_lookups:
+ *
  * Since: 0.9.7
  **/
 unsigned int
@@ -469,6 +551,8 @@
 }
 
 /**
+ * hb_ot_layout_table_get_lookup_count:
+ *
  * Since: 0.9.22
  **/
 unsigned int
@@ -629,6 +713,8 @@
 }
 
 /**
+ * hb_ot_layout_collect_lookups:
+ *
  * Since: 0.9.8
  **/
 void
@@ -673,6 +759,8 @@
 }
 
 /**
+ * hb_ot_layout_lookup_collect_glyphs:
+ *
  * Since: 0.9.7
  **/
 void
@@ -721,6 +809,8 @@
 }
 
 /**
+ * hb_ot_layout_lookup_would_substitute:
+ *
  * Since: 0.9.7
  **/
 hb_bool_t
@@ -742,7 +832,7 @@
                                            hb_bool_t             zero_context)
 {
   if (unlikely (lookup_index >= hb_ot_layout_from_face (face)->gsub_lookup_count)) return false;
-  OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, zero_context);
+  OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, (bool) zero_context);
 
   const OT::SubstLookup& l = hb_ot_layout_from_face (face)->gsub->get_lookup (lookup_index);
 
@@ -755,13 +845,9 @@
   OT::GSUB::substitute_start (font, buffer);
 }
 
-void
-hb_ot_layout_substitute_finish (hb_font_t *font, hb_buffer_t *buffer)
-{
-  OT::GSUB::substitute_finish (font, buffer);
-}
-
 /**
+ * hb_ot_layout_lookup_substitute_closure:
+ *
  * Since: 0.9.7
  **/
 void
@@ -793,12 +879,20 @@
 }
 
 void
-hb_ot_layout_position_finish (hb_font_t *font, hb_buffer_t *buffer)
+hb_ot_layout_position_finish_advances (hb_font_t *font, hb_buffer_t *buffer)
 {
-  OT::GPOS::position_finish (font, buffer);
+  OT::GPOS::position_finish_advances (font, buffer);
+}
+
+void
+hb_ot_layout_position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer)
+{
+  OT::GPOS::position_finish_offsets (font, buffer);
 }
 
 /**
+ * hb_ot_layout_get_size_params:
+ *
  * Since: 0.9.10
  **/
 hb_bool_t
@@ -882,20 +976,79 @@
 };
 
 
-template <typename Obj>
+struct hb_get_subtables_context_t :
+       OT::hb_dispatch_context_t<hb_get_subtables_context_t, hb_void_t, HB_DEBUG_APPLY>
+{
+  template <typename Type>
+  static inline bool apply_to (const void *obj, OT::hb_apply_context_t *c)
+  {
+    const Type *typed_obj = (const Type *) obj;
+    return typed_obj->apply (c);
+  }
+
+  typedef bool (*hb_apply_func_t) (const void *obj, OT::hb_apply_context_t *c);
+
+  struct hb_applicable_t
+  {
+    inline void init (const void *obj_, hb_apply_func_t apply_func_)
+    {
+      obj = obj_;
+      apply_func = apply_func_;
+    }
+
+    inline bool apply (OT::hb_apply_context_t *c) const { return apply_func (obj, c); }
+
+    private:
+    const void *obj;
+    hb_apply_func_t apply_func;
+  };
+
+  typedef hb_auto_array_t<hb_applicable_t> array_t;
+
+  /* Dispatch interface. */
+  inline const char *get_name (void) { return "GET_SUBTABLES"; }
+  template <typename T>
+  inline return_t dispatch (const T &obj)
+  {
+    hb_applicable_t *entry = array.push();
+    if (likely (entry))
+      entry->init (&obj, apply_to<T>);
+    return HB_VOID;
+  }
+  static return_t default_return_value (void) { return HB_VOID; }
+  bool stop_sublookup_iteration (return_t r HB_UNUSED) const { return false; }
+
+  hb_get_subtables_context_t (array_t &array_) :
+                              array (array_),
+                              debug_depth (0) {}
+
+  array_t &array;
+  unsigned int debug_depth;
+};
+
 static inline bool
 apply_forward (OT::hb_apply_context_t *c,
-               const Obj &obj,
-               const hb_ot_layout_lookup_accelerator_t &accel)
+               const hb_ot_layout_lookup_accelerator_t &accel,
+               const hb_get_subtables_context_t::array_t &subtables)
 {
   bool ret = false;
   hb_buffer_t *buffer = c->buffer;
-  while (buffer->idx < buffer->len)
+  while (buffer->idx < buffer->len && !buffer->in_error)
   {
+    bool applied = false;
     if (accel.may_have (buffer->cur().codepoint) &&
         (buffer->cur().mask & c->lookup_mask) &&
-        c->check_glyph_property (&buffer->cur(), c->lookup_props) &&
-        obj.apply (c))
+        c->check_glyph_property (&buffer->cur(), c->lookup_props))
+     {
+       for (unsigned int i = 0; i < subtables.len; i++)
+         if (subtables[i].apply (c))
+         {
+           applied = true;
+           break;
+         }
+     }
+
+    if (applied)
       ret = true;
     else
       buffer->next_glyph ();
@@ -903,11 +1056,10 @@
   return ret;
 }
 
-template <typename Obj>
 static inline bool
 apply_backward (OT::hb_apply_context_t *c,
-                const Obj &obj,
-                const hb_ot_layout_lookup_accelerator_t &accel)
+               const hb_ot_layout_lookup_accelerator_t &accel,
+               const hb_get_subtables_context_t::array_t &subtables)
 {
   bool ret = false;
   hb_buffer_t *buffer = c->buffer;
@@ -915,9 +1067,15 @@
   {
     if (accel.may_have (buffer->cur().codepoint) &&
         (buffer->cur().mask & c->lookup_mask) &&
-        c->check_glyph_property (&buffer->cur(), c->lookup_props) &&
-        obj.apply (c))
-      ret = true;
+        c->check_glyph_property (&buffer->cur(), c->lookup_props))
+    {
+     for (unsigned int i = 0; i < subtables.len; i++)
+       if (subtables[i].apply (c))
+       {
+         ret = true;
+         break;
+       }
+    }
     /* The reverse lookup doesn't "advance" cursor (for good reason). */
     buffer->idx--;
 
@@ -926,26 +1084,6 @@
   return ret;
 }
 
-struct hb_apply_forward_context_t :
-       OT::hb_dispatch_context_t<hb_apply_forward_context_t, bool, HB_DEBUG_APPLY>
-{
-  inline const char *get_name (void) { return "APPLY_FWD"; }
-  template <typename T>
-  inline return_t dispatch (const T &obj) { return apply_forward (c, obj, accel); }
-  static return_t default_return_value (void) { return false; }
-  bool stop_sublookup_iteration (return_t r HB_UNUSED) const { return true; }
-
-  hb_apply_forward_context_t (OT::hb_apply_context_t *c_,
-                              const hb_ot_layout_lookup_accelerator_t &accel_) :
-                                c (c_),
-                                accel (accel_),
-                                debug_depth (0) {}
-
-  OT::hb_apply_context_t *c;
-  const hb_ot_layout_lookup_accelerator_t &accel;
-  unsigned int debug_depth;
-};
-
 template <typename Proxy>
 static inline void
 apply_string (OT::hb_apply_context_t *c,
@@ -959,6 +1097,10 @@
 
   c->set_lookup_props (lookup.get_props ());
 
+  hb_get_subtables_context_t::array_t subtables;
+  hb_get_subtables_context_t c_get_subtables (subtables);
+  lookup.dispatch (&c_get_subtables);
+
   if (likely (!lookup.is_reverse ()))
   {
     /* in/out forward substitution/positioning */
@@ -967,13 +1109,7 @@
     buffer->idx = 0;
 
     bool ret;
-    if (lookup.get_subtable_count () == 1)
-    {
-      hb_apply_forward_context_t c_forward (c, accel);
-      ret = lookup.dispatch (&c_forward);
-    }
-    else
-      ret = apply_forward (c, lookup, accel);
+    ret = apply_forward (c, accel, subtables);
     if (ret)
     {
       if (!Proxy::inplace)
@@ -989,7 +1125,7 @@
       buffer->remove_output ();
     buffer->idx = buffer->len - 1;
 
-    apply_backward (c, lookup, accel);
+    apply_backward (c, accel, subtables);
   }
 }
 
@@ -1008,25 +1144,15 @@
     const stage_map_t *stage = &stages[table_index][stage_index];
     for (; i < stage->last_lookup; i++)
     {
-#if 0
-      char buf[4096];
-      hb_buffer_serialize_glyphs (buffer, 0, buffer->len,
-                                  buf, sizeof (buf), NULL,
-                                  font,
-                                  HB_BUFFER_SERIALIZE_FORMAT_TEXT,
-                                  Proxy::table_index == 0 ?
-                                  HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS :
-                                  HB_BUFFER_SERIALIZE_FLAG_DEFAULT);
-      printf ("buf: [%s]\n", buf);
-#endif
-
       unsigned int lookup_index = lookups[table_index][i].index;
+      if (!buffer->message (font, "start lookup %d", lookup_index)) continue;
       c.set_lookup_index (lookup_index);
       c.set_lookup_mask (lookups[table_index][i].mask);
       c.set_auto_zwj (lookups[table_index][i].auto_zwj);
       apply_string<Proxy> (&c,
                            proxy.table.get_lookup (lookup_index),
                            proxy.accels[lookup_index]);
+      (void) buffer->message (font, "end lookup %d", lookup_index);
     }
 
     if (stage->pause_func)
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.h	Wed Jul 05 22:06:46 2017 +0200
@@ -48,7 +48,7 @@
  * GDEF
  */
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_has_glyph_classes (hb_face_t *face);
 
 typedef enum {
@@ -59,11 +59,11 @@
   HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT    = 4
 } hb_ot_layout_glyph_class_t;
 
-hb_ot_layout_glyph_class_t
+HB_EXTERN hb_ot_layout_glyph_class_t
 hb_ot_layout_get_glyph_class (hb_face_t      *face,
                               hb_codepoint_t  glyph);
 
-void
+HB_EXTERN void
 hb_ot_layout_get_glyphs_in_class (hb_face_t                  *face,
                                   hb_ot_layout_glyph_class_t  klass,
                                   hb_set_t                   *glyphs /* OUT */);
@@ -71,7 +71,7 @@
 
 /* Not that useful.  Provides list of attach points for a glyph that a
  * client may want to cache */
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_get_attach_points (hb_face_t      *face,
                                 hb_codepoint_t  glyph,
                                 unsigned int    start_offset,
@@ -79,7 +79,7 @@
                                 unsigned int   *point_array /* OUT */);
 
 /* Ligature caret positions */
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_get_ligature_carets (hb_font_t      *font,
                                   hb_direction_t  direction,
                                   hb_codepoint_t  glyph,
@@ -96,35 +96,35 @@
 #define HB_OT_LAYOUT_NO_FEATURE_INDEX           0xFFFFu
 #define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX     0xFFFFu
 
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_table_get_script_tags (hb_face_t    *face,
                                     hb_tag_t      table_tag,
                                     unsigned int  start_offset,
                                     unsigned int *script_count /* IN/OUT */,
                                     hb_tag_t     *script_tags /* OUT */);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_table_find_script (hb_face_t    *face,
                                 hb_tag_t      table_tag,
                                 hb_tag_t      script_tag,
                                 unsigned int *script_index);
 
 /* Like find_script, but takes zero-terminated array of scripts to test */
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_table_choose_script (hb_face_t      *face,
                                   hb_tag_t        table_tag,
                                   const hb_tag_t *script_tags,
                                   unsigned int   *script_index,
                                   hb_tag_t       *chosen_script);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_table_get_feature_tags (hb_face_t    *face,
                                      hb_tag_t      table_tag,
                                      unsigned int  start_offset,
                                      unsigned int *feature_count /* IN/OUT */,
                                      hb_tag_t     *feature_tags /* OUT */);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_script_get_language_tags (hb_face_t    *face,
                                        hb_tag_t      table_tag,
                                        unsigned int  script_index,
@@ -132,21 +132,21 @@
                                        unsigned int *language_count /* IN/OUT */,
                                        hb_tag_t     *language_tags /* OUT */);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_script_find_language (hb_face_t    *face,
                                    hb_tag_t      table_tag,
                                    unsigned int  script_index,
                                    hb_tag_t      language_tag,
                                    unsigned int *language_index);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_language_get_required_feature_index (hb_face_t    *face,
                                                   hb_tag_t      table_tag,
                                                   unsigned int  script_index,
                                                   unsigned int  language_index,
                                                   unsigned int *feature_index);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_language_get_required_feature (hb_face_t    *face,
                                             hb_tag_t      table_tag,
                                             unsigned int  script_index,
@@ -154,7 +154,7 @@
                                             unsigned int *feature_index,
                                             hb_tag_t     *feature_tag);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_language_get_feature_indexes (hb_face_t    *face,
                                            hb_tag_t      table_tag,
                                            unsigned int  script_index,
@@ -163,7 +163,7 @@
                                            unsigned int *feature_count /* IN/OUT */,
                                            unsigned int *feature_indexes /* OUT */);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_language_get_feature_tags (hb_face_t    *face,
                                         hb_tag_t      table_tag,
                                         unsigned int  script_index,
@@ -172,7 +172,7 @@
                                         unsigned int *feature_count /* IN/OUT */,
                                         hb_tag_t     *feature_tags /* OUT */);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_language_find_feature (hb_face_t    *face,
                                     hb_tag_t      table_tag,
                                     unsigned int  script_index,
@@ -180,7 +180,7 @@
                                     hb_tag_t      feature_tag,
                                     unsigned int *feature_index);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_feature_get_lookups (hb_face_t    *face,
                                   hb_tag_t      table_tag,
                                   unsigned int  feature_index,
@@ -188,12 +188,12 @@
                                   unsigned int *lookup_count /* IN/OUT */,
                                   unsigned int *lookup_indexes /* OUT */);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_table_get_lookup_count (hb_face_t    *face,
                                      hb_tag_t      table_tag);
 
 
-void
+HB_EXTERN void
 hb_ot_layout_collect_lookups (hb_face_t      *face,
                               hb_tag_t        table_tag,
                               const hb_tag_t *scripts,
@@ -201,7 +201,7 @@
                               const hb_tag_t *features,
                               hb_set_t       *lookup_indexes /* OUT */);
 
-void
+HB_EXTERN void
 hb_ot_layout_lookup_collect_glyphs (hb_face_t    *face,
                                     hb_tag_t      table_tag,
                                     unsigned int  lookup_index,
@@ -228,7 +228,7 @@
                                        const hb_ot_layout_glyph_sequence_t *sequence,
                                        void         *user_data);
 
-void
+HB_EXTERN void
 Xhb_ot_layout_lookup_enumerate_sequences (hb_face_t    *face,
                                          hb_tag_t      table_tag,
                                          unsigned int  lookup_index,
@@ -241,17 +241,17 @@
  * GSUB
  */
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_has_substitution (hb_face_t *face);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_lookup_would_substitute (hb_face_t            *face,
                                       unsigned int          lookup_index,
                                       const hb_codepoint_t *glyphs,
                                       unsigned int          glyphs_length,
                                       hb_bool_t             zero_context);
 
-void
+HB_EXTERN void
 hb_ot_layout_lookup_substitute_closure (hb_face_t    *face,
                                         unsigned int  lookup_index,
                                         hb_set_t     *glyphs
@@ -259,7 +259,7 @@
 
 #ifdef HB_NOT_IMPLEMENTED
 /* Note: You better have GDEF when using this API, or marks won't do much. */
-hb_bool_t
+HB_EXTERN hb_bool_t
 Xhb_ot_layout_lookup_substitute (hb_font_t            *font,
                                 unsigned int          lookup_index,
                                 const hb_ot_layout_glyph_sequence_t *sequence,
@@ -274,12 +274,12 @@
  * GPOS
  */
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_has_positioning (hb_face_t *face);
 
 #ifdef HB_NOT_IMPLEMENTED
 /* Note: You better have GDEF when using this API, or marks won't do much. */
-hb_bool_t
+HB_EXTERN hb_bool_t
 Xhb_ot_layout_lookup_position (hb_font_t            *font,
                               unsigned int          lookup_index,
                               const hb_ot_layout_glyph_sequence_t *sequence,
@@ -288,7 +288,7 @@
 
 /* Optical 'size' feature info.  Returns true if found.
  * http://www.microsoft.com/typography/otspec/features_pt.htm#size */
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_get_size_params (hb_face_t    *face,
                               unsigned int *design_size,       /* OUT.  May be NULL */
                               unsigned int *subfamily_id,      /* OUT.  May be NULL */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map-private.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map-private.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -159,23 +159,9 @@
   F_MANUAL_ZWJ          = 0x0004u, /* Don't skip over ZWJ when matching. */
   F_GLOBAL_SEARCH       = 0x0008u  /* If feature not found in LangSys, look for it in global feature list and pick one. */
 };
+HB_MARK_AS_FLAG_T (hb_ot_map_feature_flags_t);
 /* Macro version for where const is desired. */
 #define F_COMBINE(l,r) (hb_ot_map_feature_flags_t ((unsigned int) (l) | (unsigned int) (r)))
-static inline hb_ot_map_feature_flags_t
-operator | (hb_ot_map_feature_flags_t l, hb_ot_map_feature_flags_t r)
-{ return hb_ot_map_feature_flags_t ((unsigned int) l | (unsigned int) r); }
-static inline hb_ot_map_feature_flags_t
-operator & (hb_ot_map_feature_flags_t l, hb_ot_map_feature_flags_t r)
-{ return hb_ot_map_feature_flags_t ((unsigned int) l & (unsigned int) r); }
-static inline hb_ot_map_feature_flags_t
-operator ~ (hb_ot_map_feature_flags_t r)
-{ return hb_ot_map_feature_flags_t (~(unsigned int) r); }
-static inline hb_ot_map_feature_flags_t&
-operator |= (hb_ot_map_feature_flags_t &l, hb_ot_map_feature_flags_t r)
-{ l = l | r; return l; }
-static inline hb_ot_map_feature_flags_t&
-operator &= (hb_ot_map_feature_flags_t& l, hb_ot_map_feature_flags_t r)
-{ l = l & r; return l; }
 
 
 struct hb_ot_map_builder_t
@@ -217,7 +203,8 @@
     unsigned int stage[2]; /* GSUB/GPOS */
 
     static int cmp (const feature_info_t *a, const feature_info_t *b)
-    { return (a->tag != b->tag) ?  (a->tag < b->tag ? -1 : 1) : (a->seq < b->seq ? -1 : 1); }
+    { return (a->tag != b->tag) ?  (a->tag < b->tag ? -1 : 1) :
+             (a->seq < b->seq ? -1 : a->seq > b->seq ? 1 : 0); }
   };
 
   struct stage_info_t {
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -89,7 +89,7 @@
 
   for (unsigned int table_index = 0; table_index < 2; table_index++) {
     hb_tag_t table_tag = table_tags[table_index];
-    found_script[table_index] = hb_ot_layout_table_choose_script (face, table_tag, script_tags, &script_index[table_index], &chosen_script[table_index]);
+    found_script[table_index] = (bool) hb_ot_layout_table_choose_script (face, table_tag, script_tags, &script_index[table_index], &chosen_script[table_index]);
     hb_ot_layout_script_find_language (face, table_tag, script_index[table_index], language_tag, &language_index[table_index]);
   }
 }
@@ -204,11 +204,8 @@
     for (unsigned int table_index = 0; table_index < 2; table_index++)
     {
       if (required_feature_tag[table_index] == info->tag)
-      {
         required_feature_stage[table_index] = info->stage[table_index];
-        found = true;
-        continue;
-      }
+
       found |= hb_ot_layout_language_find_feature (face,
                                                    table_tags[table_index],
                                                    script_index[table_index],
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-maxp-table.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-maxp-table.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -58,7 +58,7 @@
 
   /* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */
   protected:
-  FixedVersion  version;                /* Version of the maxp table (0.5 or 1.0),
+  FixedVersion<>version;                /* Version of the maxp table (0.5 or 1.0),
                                          * 0x00005000u or 0x00010000u. */
   USHORT        numGlyphs;              /* The number of glyphs in the font. */
   public:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-os2-table.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,105 @@
+/*
+ * Copyright © 2011,2012  Google, Inc.
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_OS2_TABLE_HH
+#define HB_OT_OS2_TABLE_HH
+
+#include "hb-open-type-private.hh"
+
+
+namespace OT {
+
+/*
+ * OS/2 and Windows Metrics
+ * http://www.microsoft.com/typography/otspec/os2.htm
+ */
+
+#define HB_OT_TAG_os2 HB_TAG('O','S','/','2')
+
+struct os2
+{
+  static const hb_tag_t tableTag = HB_OT_TAG_os2;
+
+  inline bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (c->check_struct (this));
+  }
+
+  public:
+  USHORT        version;
+
+  /* Version 0 */
+  SHORT         xAvgCharWidth;
+  USHORT        usWeightClass;
+  USHORT        usWidthClass;
+  USHORT        fsType;
+  SHORT         ySubscriptXSize;
+  SHORT         ySubscriptYSize;
+  SHORT         ySubscriptXOffset;
+  SHORT         ySubscriptYOffset;
+  SHORT         ySuperscriptXSize;
+  SHORT         ySuperscriptYSize;
+  SHORT         ySuperscriptXOffset;
+  SHORT         ySuperscriptYOffset;
+  SHORT         yStrikeoutSize;
+  SHORT         yStrikeoutPosition;
+  SHORT         sFamilyClass;
+  BYTE          panose[10];
+  ULONG         ulUnicodeRange[4];
+  Tag           achVendID;
+  USHORT        fsSelection;
+  USHORT        usFirstCharIndex;
+  USHORT        usLastCharIndex;
+  SHORT         sTypoAscender;
+  SHORT         sTypoDescender;
+  SHORT         sTypoLineGap;
+  USHORT        usWinAscent;
+  USHORT        usWinDescent;
+
+  /* Version 1 */
+  //ULONG ulCodePageRange1;
+  //ULONG ulCodePageRange2;
+
+  /* Version 2 */
+  //SHORT sxHeight;
+  //SHORT sCapHeight;
+  //USHORT  usDefaultChar;
+  //USHORT  usBreakChar;
+  //USHORT  usMaxContext;
+
+  /* Version 5 */
+  //USHORT  usLowerOpticalPointSize;
+  //USHORT  usUpperOpticalPointSize;
+
+  public:
+  DEFINE_SIZE_STATIC (78);
+};
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_OS2_TABLE_HH */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic-table.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic-table.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -6,10 +6,10 @@
  *
  * on files with these headers:
  *
- * # ArabicShaping-8.0.0.txt
- * # Date: 2015-02-17, 23:33:00 GMT [RP]
- * # Blocks-8.0.0.txt
- * # Date: 2014-11-10, 23:04:00 GMT [KW]
+ * # ArabicShaping-9.0.0.txt
+ * # Date: 2016-02-24, 22:25:00 GMT [RP]
+ * # Blocks-9.0.0.txt
+ * # Date: 2016-02-05, 23:48:00 GMT [KW]
  * UnicodeData.txt does not have a header.
  */
 
@@ -19,6 +19,7 @@
 
 #define X       JOINING_TYPE_X
 #define R       JOINING_TYPE_R
+#define T       JOINING_TYPE_T
 #define U       JOINING_TYPE_U
 #define A       JOINING_GROUP_ALAPH
 #define DR      JOINING_GROUP_DALATH_RISH
@@ -76,9 +77,11 @@
 
   /* Arabic Extended-A */
 
-  /* 08A0 */ D,D,D,D,D,D,D,D,D,D,R,R,R,U,R,D,D,R,R,D,D,
+  /* 08A0 */ D,D,D,D,D,D,D,D,D,D,R,R,R,U,R,D,D,R,R,D,D,X,D,D,D,R,D,D,D,D,X,X,
+  /* 08C0 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
+  /* 08E0 */ X,X,U,
 
-#define joining_offset_0x1806u 693
+#define joining_offset_0x1806u 739
 
   /* Mongolian */
 
@@ -86,43 +89,48 @@
   /* 1820 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
   /* 1840 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
   /* 1860 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,X,X,X,X,X,X,X,X,
-  /* 1880 */ U,U,U,U,U,U,U,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
+  /* 1880 */ U,U,U,U,U,T,T,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
   /* 18A0 */ D,D,D,D,D,D,D,D,D,X,D,
 
-#define joining_offset_0x200cu 858
+#define joining_offset_0x200cu 904
 
   /* General Punctuation */
 
-  /* 2000 */                         U,C,
-
-#define joining_offset_0x2066u 860
+  /* 2000 */                         U,C,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
+  /* 2020 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,U,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
+  /* 2040 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
+  /* 2060 */ X,X,X,X,X,X,U,U,U,U,
 
-  /* General Punctuation */
-
-  /* 2060 */             U,U,U,U,
-
-#define joining_offset_0xa840u 864
+#define joining_offset_0xa840u 998
 
   /* Phags-pa */
 
   /* A840 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
   /* A860 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,L,U,
 
-#define joining_offset_0x10ac0u 916
+#define joining_offset_0x10ac0u 1050
 
   /* Manichaean */
 
   /* 10AC0 */ D,D,D,D,D,R,U,R,U,R,R,U,U,L,R,R,R,R,R,D,D,D,D,L,D,D,D,D,D,R,D,D,
   /* 10AE0 */ D,R,U,U,R,X,X,X,X,X,X,D,D,D,D,R,
 
-#define joining_offset_0x10b80u 964
+#define joining_offset_0x10b80u 1098
 
   /* Psalter Pahlavi */
 
   /* 10B80 */ D,R,D,R,R,R,D,D,D,R,D,D,R,D,R,R,D,R,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
   /* 10BA0 */ X,X,X,X,X,X,X,X,X,R,R,R,R,D,D,U,
 
-}; /* Table items: 1012; occupancy: 57% */
+#define joining_offset_0x1e900u 1146
+
+  /* Adlam */
+
+  /* 1E900 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
+  /* 1E920 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
+  /* 1E940 */ D,D,D,D,
+
+}; /* Table items: 1214; occupancy: 54% */
 
 
 static unsigned int
@@ -131,7 +139,7 @@
   switch (u >> 12)
   {
     case 0x0u:
-      if (hb_in_range (u, 0x0600u, 0x08B4u)) return joining_table[u - 0x0600u + joining_offset_0x0600u];
+      if (hb_in_range (u, 0x0600u, 0x08E2u)) return joining_table[u - 0x0600u + joining_offset_0x0600u];
       break;
 
     case 0x1u:
@@ -139,8 +147,7 @@
       break;
 
     case 0x2u:
-      if (hb_in_range (u, 0x200Cu, 0x200Du)) return joining_table[u - 0x200Cu + joining_offset_0x200cu];
-      if (hb_in_range (u, 0x2066u, 0x2069u)) return joining_table[u - 0x2066u + joining_offset_0x2066u];
+      if (hb_in_range (u, 0x200Cu, 0x2069u)) return joining_table[u - 0x200Cu + joining_offset_0x200cu];
       break;
 
     case 0xAu:
@@ -152,6 +159,10 @@
       if (hb_in_range (u, 0x10B80u, 0x10BAFu)) return joining_table[u - 0x10B80u + joining_offset_0x10b80u];
       break;
 
+    case 0x1Eu:
+      if (hb_in_range (u, 0x1E900u, 0x1E943u)) return joining_table[u - 0x1E900u + joining_offset_0x1e900u];
+      break;
+
     default:
       break;
   }
@@ -160,6 +171,7 @@
 
 #undef X
 #undef R
+#undef T
 #undef U
 #undef A
 #undef DR
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -28,9 +28,38 @@
 #include "hb-ot-shape-private.hh"
 
 
+#ifndef HB_DEBUG_ARABIC
+#define HB_DEBUG_ARABIC (HB_DEBUG+0)
+#endif
+
+
 /* buffer var allocations */
 #define arabic_shaping_action() complex_var_u8_0() /* arabic shaping action */
 
+#define HB_BUFFER_SCRATCH_FLAG_ARABIC_HAS_STCH HB_BUFFER_SCRATCH_FLAG_COMPLEX0
+
+/* See:
+ * https://github.com/behdad/harfbuzz/commit/6e6f82b6f3dde0fc6c3c7d991d9ec6cfff57823d#commitcomment-14248516 */
+#define HB_ARABIC_GENERAL_CATEGORY_IS_WORD(gen_cat) \
+        (FLAG_SAFE (gen_cat) & \
+         (FLAG (HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_PRIVATE_USE) | \
+          /*FLAG (HB_UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER) |*/ \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_MODIFIER_LETTER) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER) | \
+          /*FLAG (HB_UNICODE_GENERAL_CATEGORY_TITLECASE_LETTER) |*/ \
+          /*FLAG (HB_UNICODE_GENERAL_CATEGORY_UPPERCASE_LETTER) |*/ \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_LETTER_NUMBER) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_OTHER_NUMBER) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_CURRENCY_SYMBOL) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_MATH_SYMBOL) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL)))
+
 
 /*
  * Joining types:
@@ -84,7 +113,7 @@
 
 
 /* Same order as the feature array */
-enum {
+enum arabic_action_t {
   ISOL,
   FINA,
   FIN2,
@@ -95,7 +124,11 @@
 
   NONE,
 
-  ARABIC_NUM_FEATURES = NONE
+  ARABIC_NUM_FEATURES = NONE,
+
+  /* We abuse the same byte for other things... */
+  STCH_FIXED,
+  STCH_REPEATING,
 };
 
 static const struct arabic_state_table_entry {
@@ -140,6 +173,11 @@
                        hb_buffer_t *buffer);
 
 static void
+record_stch (const hb_ot_shape_plan_t *plan,
+             hb_font_t *font,
+             hb_buffer_t *buffer);
+
+static void
 collect_features_arabic (hb_ot_shape_planner_t *plan)
 {
   hb_ot_map_builder_t *map = &plan->map;
@@ -165,6 +203,9 @@
 
   map->add_gsub_pause (nuke_joiners);
 
+  map->add_global_bool_feature (HB_TAG('s','t','c','h'));
+  map->add_gsub_pause (record_stch);
+
   map->add_global_bool_feature (HB_TAG('c','c','m','p'));
   map->add_global_bool_feature (HB_TAG('l','o','c','l'));
 
@@ -182,7 +223,6 @@
     map->add_gsub_pause (arabic_fallback_shape);
 
   map->add_global_bool_feature (HB_TAG('c','a','l','t'));
-  map->add_gsub_pause (NULL);
 
   /* The spec includes 'cswh'.  Earlier versions of Windows
    * used to enable this by default, but testing suggests
@@ -192,6 +232,7 @@
    * Note that IranNastaliq uses this feature extensively
    * to fixup broken glyph sequences.  Oh well...
    * Test case: U+0643,U+0640,U+0631. */
+  //map->add_gsub_pause (NULL);
   //map->add_global_bool_feature (HB_TAG('c','s','w','h'));
   map->add_global_bool_feature (HB_TAG('m','s','e','t'));
 }
@@ -208,8 +249,10 @@
    * mask_array[NONE] == 0. */
   hb_mask_t mask_array[ARABIC_NUM_FEATURES + 1];
 
-  bool do_fallback;
   arabic_fallback_plan_t *fallback_plan;
+
+  unsigned int do_fallback : 1;
+  unsigned int has_stch : 1;
 };
 
 void *
@@ -220,6 +263,7 @@
     return NULL;
 
   arabic_plan->do_fallback = plan->props.script == HB_SCRIPT_ARABIC;
+  arabic_plan->has_stch = !!plan->map.get_1_mask (HB_TAG ('s','t','c','h'));
   for (unsigned int i = 0; i < ARABIC_NUM_FEATURES; i++) {
     arabic_plan->mask_array[i] = plan->map.get_1_mask (arabic_features[i]);
     arabic_plan->do_fallback = arabic_plan->do_fallback &&
@@ -320,8 +364,6 @@
   hb_glyph_info_t *info = buffer->info;
   for (unsigned int i = 0; i < count; i++)
     info[i].mask |= arabic_plan->mask_array[info[i].arabic_shaping_action()];
-
-  HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
 }
 
 static void
@@ -371,6 +413,197 @@
   arabic_fallback_plan_shape (fallback_plan, font, buffer);
 }
 
+/*
+ * Stretch feature: "stch".
+ * See example here:
+ * https://www.microsoft.com/typography/OpenTypeDev/syriac/intro.htm
+ * We implement this in a generic way, such that the Arabic subtending
+ * marks can use it as well.
+ */
+
+static void
+record_stch (const hb_ot_shape_plan_t *plan,
+             hb_font_t *font,
+             hb_buffer_t *buffer)
+{
+  const arabic_shape_plan_t *arabic_plan = (const arabic_shape_plan_t *) plan->data;
+  if (!arabic_plan->has_stch)
+    return;
+
+  /* 'stch' feature was just applied.  Look for anything that multiplied,
+   * and record it for stch treatment later.  Note that rtlm, frac, etc
+   * are applied before stch, but we assume that they didn't result in
+   * anything multiplying into 5 pieces, so it's safe-ish... */
+
+  unsigned int count = buffer->len;
+  hb_glyph_info_t *info = buffer->info;
+  for (unsigned int i = 0; i < count; i++)
+    if (unlikely (_hb_glyph_info_multiplied (&info[i])))
+    {
+      unsigned int comp = _hb_glyph_info_get_lig_comp (&info[i]);
+      info[i].arabic_shaping_action() = comp % 2 ? STCH_REPEATING : STCH_FIXED;
+      buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_ARABIC_HAS_STCH;
+    }
+}
+
+static void
+apply_stch (const hb_ot_shape_plan_t *plan,
+            hb_buffer_t              *buffer,
+            hb_font_t                *font)
+{
+  if (likely (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_ARABIC_HAS_STCH)))
+    return;
+
+  /* The Arabic shaper currently always processes in RTL mode, so we should
+   * stretch / position the stretched pieces to the left / preceding glyphs. */
+
+  /* We do a two pass implementation:
+   * First pass calculates the exact number of extra glyphs we need,
+   * We then enlarge buffer to have that much room,
+   * Second pass applies the stretch, copying things to the end of buffer.
+   */
+
+  int sign = font->x_scale < 0 ? -1 : +1;
+  unsigned int extra_glyphs_needed = 0; // Set during MEASURE, used during CUT
+  typedef enum { MEASURE, CUT } step_t;
+
+  for (step_t step = MEASURE; step <= CUT; step = (step_t) (step + 1))
+  {
+    unsigned int count = buffer->len;
+    hb_glyph_info_t *info = buffer->info;
+    hb_glyph_position_t *pos = buffer->pos;
+    unsigned int new_len = count + extra_glyphs_needed; // write head during CUT
+    unsigned int j = new_len;
+    for (unsigned int i = count; i; i--)
+    {
+      if (!hb_in_range<unsigned> (info[i - 1].arabic_shaping_action(), STCH_FIXED, STCH_REPEATING))
+      {
+        if (step == CUT)
+        {
+          --j;
+          info[j] = info[i - 1];
+          pos[j] = pos[i - 1];
+        }
+        continue;
+      }
+
+      /* Yay, justification! */
+
+      hb_position_t w_total = 0; // Total to be filled
+      hb_position_t w_fixed = 0; // Sum of fixed tiles
+      hb_position_t w_repeating = 0; // Sum of repeating tiles
+      int n_fixed = 0;
+      int n_repeating = 0;
+
+      unsigned int end = i;
+      while (i &&
+             hb_in_range<unsigned> (info[i - 1].arabic_shaping_action(), STCH_FIXED, STCH_REPEATING))
+      {
+        i--;
+        hb_position_t width = font->get_glyph_h_advance (info[i].codepoint);
+        if (info[i].arabic_shaping_action() == STCH_FIXED)
+        {
+          w_fixed += width;
+          n_fixed++;
+        }
+        else
+        {
+          w_repeating += width;
+          n_repeating++;
+        }
+      }
+      unsigned int start = i;
+      unsigned int context = i;
+      while (context &&
+             !hb_in_range<unsigned> (info[context - 1].arabic_shaping_action(), STCH_FIXED, STCH_REPEATING) &&
+             (_hb_glyph_info_is_default_ignorable (&info[context - 1]) ||
+              HB_ARABIC_GENERAL_CATEGORY_IS_WORD (_hb_glyph_info_get_general_category (&info[context - 1]))))
+      {
+        context--;
+        w_total += pos[context].x_advance;
+      }
+      i++; // Don't touch i again.
+
+      DEBUG_MSG (ARABIC, NULL, "%s stretch at (%d,%d,%d)",
+                 step == MEASURE ? "measuring" : "cutting", context, start, end);
+      DEBUG_MSG (ARABIC, NULL, "rest of word:    count=%d width %d", start - context, w_total);
+      DEBUG_MSG (ARABIC, NULL, "fixed tiles:     count=%d width=%d", n_fixed, w_fixed);
+      DEBUG_MSG (ARABIC, NULL, "repeating tiles: count=%d width=%d", n_repeating, w_repeating);
+
+      /* Number of additional times to repeat each repeating tile. */
+      int n_copies = 0;
+
+      hb_position_t w_remaining = w_total - w_fixed;
+      if (sign * w_remaining > sign * w_repeating && sign * w_repeating > 0)
+        n_copies = (sign * w_remaining) / (sign * w_repeating) - 1;
+
+      /* See if we can improve the fit by adding an extra repeat and squeezing them together a bit. */
+      hb_position_t extra_repeat_overlap = 0;
+      hb_position_t shortfall = sign * w_remaining - sign * w_repeating * (n_copies + 1);
+      if (shortfall > 0)
+      {
+        ++n_copies;
+        hb_position_t excess = (n_copies + 1) * sign * w_repeating - sign * w_remaining;
+        if (excess > 0)
+          extra_repeat_overlap = excess / (n_copies * n_repeating);
+      }
+
+      if (step == MEASURE)
+      {
+        extra_glyphs_needed += n_copies * n_repeating;
+        DEBUG_MSG (ARABIC, NULL, "will add extra %d copies of repeating tiles", n_copies);
+      }
+      else
+      {
+        hb_position_t x_offset = 0;
+        for (unsigned int k = end; k > start; k--)
+        {
+          hb_position_t width = font->get_glyph_h_advance (info[k - 1].codepoint);
+
+          unsigned int repeat = 1;
+          if (info[k - 1].arabic_shaping_action() == STCH_REPEATING)
+            repeat += n_copies;
+
+          DEBUG_MSG (ARABIC, NULL, "appending %d copies of glyph %d; j=%d",
+                     repeat, info[k - 1].codepoint, j);
+          for (unsigned int n = 0; n < repeat; n++)
+          {
+            x_offset -= width;
+            if (n > 0)
+              x_offset += extra_repeat_overlap;
+            pos[k - 1].x_offset = x_offset;
+            /* Append copy. */
+            --j;
+            info[j] = info[k - 1];
+            pos[j] = pos[k - 1];
+          }
+        }
+      }
+    }
+
+    if (step == MEASURE)
+    {
+      if (unlikely (!buffer->ensure (count + extra_glyphs_needed)))
+        break;
+    }
+    else
+    {
+      assert (j == 0);
+      buffer->len = new_len;
+    }
+  }
+}
+
+
+static void
+postprocess_glyphs_arabic (const hb_ot_shape_plan_t *plan,
+                           hb_buffer_t              *buffer,
+                           hb_font_t                *font)
+{
+  apply_stch (plan, buffer, font);
+
+  HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
+}
 
 const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic =
 {
@@ -379,7 +612,8 @@
   NULL, /* override_features */
   data_create_arabic,
   data_destroy_arabic,
-  NULL, /* preprocess_text_arabic */
+  NULL, /* preprocess_text */
+  postprocess_glyphs_arabic,
   HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
   NULL, /* decompose */
   NULL, /* compose */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-default.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-default.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -35,10 +35,11 @@
   NULL, /* data_create */
   NULL, /* data_destroy */
   NULL, /* preprocess_text */
+  NULL, /* postprocess_glyphs */
   HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
   NULL, /* decompose */
   NULL, /* compose */
   NULL, /* setup_masks */
-  HB_OT_SHAPE_ZERO_WIDTH_MARKS_DEFAULT,
+  HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
   true, /* fallback_position */
 };
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hangul.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hangul.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -188,7 +188,7 @@
                                     */
   unsigned int count = buffer->len;
 
-  for (buffer->idx = 0; buffer->idx < count;)
+  for (buffer->idx = 0; buffer->idx < count && !buffer->in_error;)
   {
     hb_codepoint_t u = buffer->cur().codepoint;
 
@@ -411,13 +411,14 @@
   "hangul",
   collect_features_hangul,
   override_features_hangul,
-  data_create_hangul, /* data_create */
-  data_destroy_hangul, /* data_destroy */
+  data_create_hangul,
+  data_destroy_hangul,
   preprocess_text_hangul,
+  NULL, /* postprocess_glyphs */
   HB_OT_SHAPE_NORMALIZATION_MODE_NONE,
   NULL, /* decompose */
   NULL, /* compose */
-  setup_masks_hangul, /* setup_masks */
+  setup_masks_hangul,
   HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
   false, /* fallback_position */
 };
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hebrew.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hebrew.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -68,7 +68,7 @@
     0xFB4Au /* TAV */
   };
 
-  bool found = c->unicode->compose (a, b, ab);
+  bool found = (bool) c->unicode->compose (a, b, ab);
 
   if (!found && !c->plan->has_mark)
   {
@@ -163,6 +163,7 @@
   NULL, /* data_create */
   NULL, /* data_destroy */
   NULL, /* preprocess_text */
+  NULL, /* postprocess_glyphs */
   HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
   NULL, /* decompose */
   compose_hebrew,
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-machine.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-machine.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -56,52 +56,52 @@
         5u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u,
         5u, 7u, 7u, 7u, 8u, 8u, 1u, 16u, 8u, 13u, 4u, 8u, 6u, 6u, 16u, 16u,
         4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u,
-        16u, 16u, 8u, 8u, 1u, 31u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
-        3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
-        3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 5u, 14u, 5u, 14u,
-        5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u,
-        3u, 10u, 5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
-        3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u,
-        5u, 14u, 3u, 14u, 1u, 16u, 4u, 31u, 4u, 14u, 3u, 31u, 3u, 31u, 1u, 16u,
-        1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
-        1u, 16u, 3u, 31u, 3u, 31u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
-        3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
-        3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 5u, 14u, 5u, 14u,
+        16u, 16u, 8u, 8u, 1u, 18u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u,
+        3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u,
+        3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u,
         5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u,
         3u, 10u, 5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
         3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u,
-        5u, 14u, 3u, 14u, 1u, 16u, 4u, 31u, 4u, 14u, 3u, 31u, 3u, 31u, 1u, 16u,
-        1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
-        4u, 14u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u,
-        4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u,
-        4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 5u, 14u, 5u, 14u, 5u, 10u,
+        5u, 14u, 3u, 14u, 1u, 16u, 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u,
+        1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u,
+        1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+        1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+        3u, 17u, 3u, 17u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u,
+        4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u,
+        4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u,
         9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u,
         5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u,
         4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
-        3u, 14u, 1u, 16u, 4u, 31u, 4u, 14u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
-        1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
-        4u, 14u, 3u, 31u, 4u, 14u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
-        3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
-        3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 5u, 14u, 5u, 14u,
-        5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u,
-        3u, 10u, 5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
+        3u, 14u, 1u, 16u, 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u,
+        1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+        1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+        3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 4u, 14u, 1u, 16u,
+        3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u,
+        3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u,
+        3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u, 9u, 10u, 9u, 9u,
+        9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u,
+        3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
+        3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 1u, 16u,
+        4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+        3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u,
+        3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u,
+        1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 4u, 14u, 3u, 17u, 4u, 14u,
+        3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u,
+        3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u,
+        3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u, 9u, 10u, 9u, 9u,
+        9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u,
+        3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
+        3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 1u, 16u,
+        4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+        3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u,
+        3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u,
+        1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 1u, 17u, 3u, 17u,
+        1u, 17u, 4u, 14u, 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u,
+        5u, 10u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 3u, 17u, 3u, 17u, 1u, 16u,
         3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u,
-        5u, 14u, 3u, 14u, 1u, 16u, 4u, 31u, 4u, 14u, 3u, 31u, 3u, 31u, 1u, 16u,
-        1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
-        1u, 16u, 3u, 31u, 1u, 31u, 3u, 31u, 1u, 31u, 4u, 14u, 5u, 10u, 9u, 10u,
-        9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 1u, 16u, 3u, 31u, 3u, 31u,
-        4u, 31u, 3u, 31u, 3u, 31u, 1u, 16u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u,
-        4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
-        3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u, 3u, 13u, 1u, 16u, 3u, 10u, 5u, 10u,
-        5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 0
+        5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u,
+        3u, 13u, 1u, 16u, 3u, 10u, 5u, 10u, 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u,
+        9u, 10u, 9u, 9u, 5u, 10u, 0
 };
 
 static const char _indic_syllable_machine_key_spans[] = {
@@ -127,52 +127,52 @@
         3, 4, 3, 1, 4, 3, 1, 4,
         3, 1, 1, 16, 6, 5, 1, 1,
         5, 1, 1, 5, 1, 1, 5, 1,
-        1, 1, 31, 29, 29, 28, 16, 29,
-        29, 28, 16, 29, 29, 28, 16, 29,
-        29, 28, 16, 29, 29, 28, 10, 10,
-        6, 2, 1, 2, 2, 1, 6, 11,
-        8, 6, 8, 11, 12, 12, 11, 10,
-        12, 11, 10, 12, 11, 10, 12, 11,
-        10, 12, 16, 28, 11, 29, 29, 16,
-        16, 16, 16, 16, 29, 29, 16, 16,
-        16, 16, 16, 29, 29, 16, 16, 16,
-        16, 16, 29, 29, 16, 16, 16, 16,
-        16, 29, 29, 29, 29, 28, 16, 29,
-        29, 28, 16, 29, 29, 28, 16, 29,
-        29, 28, 16, 29, 29, 28, 10, 10,
+        1, 1, 18, 15, 15, 14, 16, 15,
+        15, 14, 16, 15, 15, 14, 16, 15,
+        15, 14, 16, 15, 15, 14, 10, 10,
         6, 2, 1, 2, 2, 1, 6, 11,
         8, 6, 8, 11, 12, 12, 11, 10,
         12, 11, 10, 12, 11, 10, 12, 11,
-        10, 12, 16, 28, 11, 29, 29, 16,
-        16, 16, 16, 16, 29, 29, 16, 16,
-        16, 16, 16, 29, 29, 16, 16, 16,
-        16, 16, 29, 29, 16, 16, 16, 16,
-        11, 16, 29, 29, 28, 16, 29, 29,
-        28, 16, 29, 29, 28, 16, 29, 29,
-        28, 16, 29, 29, 28, 10, 10, 6,
+        10, 12, 16, 11, 15, 15, 16, 16,
+        16, 16, 16, 15, 15, 16, 16, 16,
+        16, 16, 15, 15, 16, 16, 16, 16,
+        16, 15, 15, 16, 16, 16, 16, 16,
+        15, 15, 15, 15, 14, 16, 15, 15,
+        14, 16, 15, 15, 14, 16, 15, 15,
+        14, 16, 15, 15, 14, 10, 10, 6,
         2, 1, 2, 2, 1, 6, 11, 8,
         6, 8, 11, 12, 12, 11, 10, 12,
         11, 10, 12, 11, 10, 12, 11, 10,
-        12, 16, 28, 11, 29, 29, 16, 16,
-        16, 16, 16, 29, 29, 16, 16, 16,
-        16, 16, 29, 29, 16, 16, 16, 16,
-        16, 29, 29, 16, 16, 16, 16, 16,
-        11, 29, 11, 29, 29, 28, 16, 29,
-        29, 28, 16, 29, 29, 28, 16, 29,
-        29, 28, 16, 29, 29, 28, 10, 10,
-        6, 2, 1, 2, 2, 1, 6, 11,
-        8, 6, 8, 11, 12, 12, 11, 10,
+        12, 16, 11, 15, 15, 16, 16, 16,
+        16, 16, 15, 15, 16, 16, 16, 16,
+        16, 15, 15, 16, 16, 16, 16, 16,
+        15, 15, 16, 16, 16, 16, 11, 16,
+        15, 15, 14, 16, 15, 15, 14, 16,
+        15, 15, 14, 16, 15, 15, 14, 16,
+        15, 15, 14, 10, 10, 6, 2, 1,
+        2, 2, 1, 6, 11, 8, 6, 8,
+        11, 12, 12, 11, 10, 12, 11, 10,
+        12, 11, 10, 12, 11, 10, 12, 16,
+        11, 15, 15, 16, 16, 16, 16, 16,
+        15, 15, 16, 16, 16, 16, 16, 15,
+        15, 16, 16, 16, 16, 16, 15, 15,
+        16, 16, 16, 16, 16, 11, 15, 11,
+        15, 15, 14, 16, 15, 15, 14, 16,
+        15, 15, 14, 16, 15, 15, 14, 16,
+        15, 15, 14, 10, 10, 6, 2, 1,
+        2, 2, 1, 6, 11, 8, 6, 8,
+        11, 12, 12, 11, 10, 12, 11, 10,
+        12, 11, 10, 12, 11, 10, 12, 16,
+        11, 15, 15, 16, 16, 16, 16, 16,
+        15, 15, 16, 16, 16, 16, 16, 15,
+        15, 16, 16, 16, 16, 16, 15, 15,
+        16, 16, 16, 16, 16, 15, 17, 15,
+        17, 11, 6, 2, 1, 2, 2, 1,
+        6, 16, 15, 15, 14, 15, 15, 16,
         12, 11, 10, 12, 11, 10, 12, 11,
-        10, 12, 16, 28, 11, 29, 29, 16,
-        16, 16, 16, 16, 29, 29, 16, 16,
-        16, 16, 16, 29, 29, 16, 16, 16,
-        16, 16, 29, 29, 16, 16, 16, 16,
-        16, 29, 31, 29, 31, 11, 6, 2,
-        1, 2, 2, 1, 6, 16, 29, 29,
-        28, 29, 29, 16, 12, 11, 10, 12,
-        11, 10, 12, 11, 10, 12, 11, 10,
-        11, 8, 6, 8, 11, 16, 8, 6,
-        6, 2, 1, 2, 2, 1, 6
+        10, 12, 11, 10, 11, 8, 6, 8,
+        11, 16, 8, 6, 6, 2, 1, 2,
+        2, 1, 6
 };
 
 static const short _indic_syllable_machine_index_offsets[] = {
@@ -198,52 +198,52 @@
         954, 958, 963, 967, 969, 974, 978, 980,
         985, 989, 991, 993, 1010, 1017, 1023, 1025,
         1027, 1033, 1035, 1037, 1043, 1045, 1047, 1053,
-        1055, 1057, 1059, 1091, 1121, 1151, 1180, 1197,
-        1227, 1257, 1286, 1303, 1333, 1363, 1392, 1409,
-        1439, 1469, 1498, 1515, 1545, 1575, 1604, 1615,
-        1626, 1633, 1636, 1638, 1641, 1644, 1646, 1653,
-        1665, 1674, 1681, 1690, 1702, 1715, 1728, 1740,
-        1751, 1764, 1776, 1787, 1800, 1812, 1823, 1836,
-        1848, 1859, 1872, 1889, 1918, 1930, 1960, 1990,
-        2007, 2024, 2041, 2058, 2075, 2105, 2135, 2152,
-        2169, 2186, 2203, 2220, 2250, 2280, 2297, 2314,
-        2331, 2348, 2365, 2395, 2425, 2442, 2459, 2476,
-        2493, 2510, 2540, 2570, 2600, 2630, 2659, 2676,
-        2706, 2736, 2765, 2782, 2812, 2842, 2871, 2888,
-        2918, 2948, 2977, 2994, 3024, 3054, 3083, 3094,
-        3105, 3112, 3115, 3117, 3120, 3123, 3125, 3132,
-        3144, 3153, 3160, 3169, 3181, 3194, 3207, 3219,
-        3230, 3243, 3255, 3266, 3279, 3291, 3302, 3315,
-        3327, 3338, 3351, 3368, 3397, 3409, 3439, 3469,
-        3486, 3503, 3520, 3537, 3554, 3584, 3614, 3631,
-        3648, 3665, 3682, 3699, 3729, 3759, 3776, 3793,
-        3810, 3827, 3844, 3874, 3904, 3921, 3938, 3955,
-        3972, 3984, 4001, 4031, 4061, 4090, 4107, 4137,
-        4167, 4196, 4213, 4243, 4273, 4302, 4319, 4349,
-        4379, 4408, 4425, 4455, 4485, 4514, 4525, 4536,
-        4543, 4546, 4548, 4551, 4554, 4556, 4563, 4575,
-        4584, 4591, 4600, 4612, 4625, 4638, 4650, 4661,
-        4674, 4686, 4697, 4710, 4722, 4733, 4746, 4758,
-        4769, 4782, 4799, 4828, 4840, 4870, 4900, 4917,
-        4934, 4951, 4968, 4985, 5015, 5045, 5062, 5079,
-        5096, 5113, 5130, 5160, 5190, 5207, 5224, 5241,
-        5258, 5275, 5305, 5335, 5352, 5369, 5386, 5403,
-        5420, 5432, 5462, 5474, 5504, 5534, 5563, 5580,
-        5610, 5640, 5669, 5686, 5716, 5746, 5775, 5792,
-        5822, 5852, 5881, 5898, 5928, 5958, 5987, 5998,
-        6009, 6016, 6019, 6021, 6024, 6027, 6029, 6036,
-        6048, 6057, 6064, 6073, 6085, 6098, 6111, 6123,
-        6134, 6147, 6159, 6170, 6183, 6195, 6206, 6219,
-        6231, 6242, 6255, 6272, 6301, 6313, 6343, 6373,
-        6390, 6407, 6424, 6441, 6458, 6488, 6518, 6535,
-        6552, 6569, 6586, 6603, 6633, 6663, 6680, 6697,
-        6714, 6731, 6748, 6778, 6808, 6825, 6842, 6859,
-        6876, 6893, 6923, 6955, 6985, 7017, 7029, 7036,
-        7039, 7041, 7044, 7047, 7049, 7056, 7073, 7103,
-        7133, 7162, 7192, 7222, 7239, 7252, 7264, 7275,
-        7288, 7300, 7311, 7324, 7336, 7347, 7360, 7372,
-        7383, 7395, 7404, 7411, 7420, 7432, 7449, 7458,
-        7465, 7472, 7475, 7477, 7480, 7483, 7485
+        1055, 1057, 1059, 1078, 1094, 1110, 1125, 1142,
+        1158, 1174, 1189, 1206, 1222, 1238, 1253, 1270,
+        1286, 1302, 1317, 1334, 1350, 1366, 1381, 1392,
+        1403, 1410, 1413, 1415, 1418, 1421, 1423, 1430,
+        1442, 1451, 1458, 1467, 1479, 1492, 1505, 1517,
+        1528, 1541, 1553, 1564, 1577, 1589, 1600, 1613,
+        1625, 1636, 1649, 1666, 1678, 1694, 1710, 1727,
+        1744, 1761, 1778, 1795, 1811, 1827, 1844, 1861,
+        1878, 1895, 1912, 1928, 1944, 1961, 1978, 1995,
+        2012, 2029, 2045, 2061, 2078, 2095, 2112, 2129,
+        2146, 2162, 2178, 2194, 2210, 2225, 2242, 2258,
+        2274, 2289, 2306, 2322, 2338, 2353, 2370, 2386,
+        2402, 2417, 2434, 2450, 2466, 2481, 2492, 2503,
+        2510, 2513, 2515, 2518, 2521, 2523, 2530, 2542,
+        2551, 2558, 2567, 2579, 2592, 2605, 2617, 2628,
+        2641, 2653, 2664, 2677, 2689, 2700, 2713, 2725,
+        2736, 2749, 2766, 2778, 2794, 2810, 2827, 2844,
+        2861, 2878, 2895, 2911, 2927, 2944, 2961, 2978,
+        2995, 3012, 3028, 3044, 3061, 3078, 3095, 3112,
+        3129, 3145, 3161, 3178, 3195, 3212, 3229, 3241,
+        3258, 3274, 3290, 3305, 3322, 3338, 3354, 3369,
+        3386, 3402, 3418, 3433, 3450, 3466, 3482, 3497,
+        3514, 3530, 3546, 3561, 3572, 3583, 3590, 3593,
+        3595, 3598, 3601, 3603, 3610, 3622, 3631, 3638,
+        3647, 3659, 3672, 3685, 3697, 3708, 3721, 3733,
+        3744, 3757, 3769, 3780, 3793, 3805, 3816, 3829,
+        3846, 3858, 3874, 3890, 3907, 3924, 3941, 3958,
+        3975, 3991, 4007, 4024, 4041, 4058, 4075, 4092,
+        4108, 4124, 4141, 4158, 4175, 4192, 4209, 4225,
+        4241, 4258, 4275, 4292, 4309, 4326, 4338, 4354,
+        4366, 4382, 4398, 4413, 4430, 4446, 4462, 4477,
+        4494, 4510, 4526, 4541, 4558, 4574, 4590, 4605,
+        4622, 4638, 4654, 4669, 4680, 4691, 4698, 4701,
+        4703, 4706, 4709, 4711, 4718, 4730, 4739, 4746,
+        4755, 4767, 4780, 4793, 4805, 4816, 4829, 4841,
+        4852, 4865, 4877, 4888, 4901, 4913, 4924, 4937,
+        4954, 4966, 4982, 4998, 5015, 5032, 5049, 5066,
+        5083, 5099, 5115, 5132, 5149, 5166, 5183, 5200,
+        5216, 5232, 5249, 5266, 5283, 5300, 5317, 5333,
+        5349, 5366, 5383, 5400, 5417, 5434, 5450, 5468,
+        5484, 5502, 5514, 5521, 5524, 5526, 5529, 5532,
+        5534, 5541, 5558, 5574, 5590, 5605, 5621, 5637,
+        5654, 5667, 5679, 5690, 5703, 5715, 5726, 5739,
+        5751, 5762, 5775, 5787, 5798, 5810, 5819, 5826,
+        5835, 5847, 5864, 5873, 5880, 5887, 5890, 5892,
+        5895, 5898, 5900
 };
 
 static const short _indic_syllable_machine_indicies[] = {
@@ -381,882 +381,684 @@
         161, 161, 162, 157, 0, 183, 0, 184,
         0, 186, 185, 188, 189, 190, 191, 192,
         193, 84, 79, 194, 195, 196, 196, 156,
-        197, 198, 199, 200, 201, 187, 187, 187,
-        187, 187, 187, 187, 187, 187, 187, 187,
-        187, 202, 187, 204, 205, 206, 207, 6,
-        1, 208, 209, 203, 203, 38, 210, 203,
-        203, 211, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 212,
-        203, 213, 205, 214, 214, 6, 1, 208,
-        209, 203, 203, 203, 210, 203, 203, 211,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 212, 203, 205,
-        214, 214, 6, 1, 208, 209, 203, 203,
-        203, 210, 203, 203, 211, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 212, 203, 215, 203, 203, 203,
-        19, 216, 203, 1, 208, 209, 203, 203,
-        203, 217, 203, 215, 203, 218, 219, 220,
-        221, 6, 1, 208, 209, 203, 203, 36,
-        222, 203, 203, 211, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 212, 203, 223, 219, 224, 224, 6,
-        1, 208, 209, 203, 203, 203, 222, 203,
-        203, 211, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 212,
-        203, 219, 224, 224, 6, 1, 208, 209,
-        203, 203, 203, 222, 203, 203, 211, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 212, 203, 225, 203,
-        203, 203, 19, 226, 203, 1, 208, 209,
-        203, 203, 203, 217, 203, 225, 203, 227,
-        228, 229, 230, 6, 1, 208, 209, 203,
-        203, 34, 231, 203, 203, 211, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 212, 203, 232, 228, 233,
-        233, 6, 1, 208, 209, 203, 203, 203,
-        231, 203, 203, 211, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 212, 203, 228, 233, 233, 6, 1,
-        208, 209, 203, 203, 203, 231, 203, 203,
-        211, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 212, 203,
-        234, 203, 203, 203, 19, 235, 203, 1,
-        208, 209, 203, 203, 203, 217, 203, 234,
-        203, 236, 237, 238, 239, 6, 1, 208,
-        209, 203, 203, 32, 240, 203, 203, 211,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 212, 203, 241,
-        237, 242, 242, 6, 1, 208, 209, 203,
-        203, 203, 240, 203, 203, 211, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 212, 203, 237, 242, 242,
-        6, 1, 208, 209, 203, 203, 203, 240,
-        203, 203, 211, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        212, 203, 243, 203, 203, 203, 19, 244,
-        203, 1, 208, 209, 203, 203, 203, 217,
-        203, 243, 203, 245, 246, 247, 248, 6,
-        1, 208, 209, 203, 203, 30, 249, 203,
-        203, 211, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 212,
-        203, 250, 246, 251, 251, 6, 1, 208,
-        209, 203, 203, 203, 249, 203, 203, 211,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 212, 203, 246,
-        251, 251, 6, 1, 208, 209, 203, 203,
-        203, 249, 203, 203, 211, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 212, 203, 19, 252, 203, 1,
-        208, 209, 203, 203, 203, 217, 203, 253,
-        253, 203, 1, 208, 209, 203, 203, 203,
-        217, 203, 254, 203, 203, 255, 208, 209,
-        203, 208, 209, 203, 256, 203, 208, 257,
-        203, 208, 258, 203, 208, 203, 254, 203,
-        203, 203, 208, 209, 203, 259, 203, 260,
-        261, 203, 1, 208, 209, 203, 203, 4,
-        203, 3, 203, 253, 253, 203, 1, 208,
-        209, 203, 253, 253, 203, 1, 208, 209,
-        203, 259, 203, 253, 253, 203, 1, 208,
-        209, 203, 259, 203, 260, 253, 203, 1,
-        208, 209, 203, 203, 4, 203, 19, 203,
-        262, 262, 6, 1, 208, 209, 203, 203,
-        203, 217, 203, 263, 28, 264, 265, 9,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        28, 264, 265, 9, 1, 208, 209, 203,
-        203, 203, 217, 203, 264, 264, 9, 1,
-        208, 209, 203, 203, 203, 217, 203, 266,
-        25, 267, 268, 12, 1, 208, 209, 203,
-        203, 203, 217, 203, 25, 267, 268, 12,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        267, 267, 12, 1, 208, 209, 203, 203,
-        203, 217, 203, 269, 22, 270, 271, 15,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        22, 270, 271, 15, 1, 208, 209, 203,
-        203, 203, 217, 203, 270, 270, 15, 1,
-        208, 209, 203, 203, 203, 217, 203, 272,
-        19, 253, 273, 203, 1, 208, 209, 203,
-        203, 203, 217, 203, 19, 253, 273, 203,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        253, 274, 203, 1, 208, 209, 203, 203,
-        203, 217, 203, 19, 203, 253, 253, 203,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        2, 3, 203, 203, 19, 252, 203, 1,
-        208, 209, 203, 203, 203, 217, 203, 2,
-        203, 246, 251, 251, 6, 1, 208, 209,
-        203, 203, 203, 249, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 212, 203, 246, 251,
-        251, 6, 1, 208, 209, 203, 203, 203,
-        249, 203, 245, 246, 251, 251, 6, 1,
-        208, 209, 203, 203, 203, 249, 203, 203,
-        211, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 212, 203,
-        245, 246, 247, 251, 6, 1, 208, 209,
-        203, 203, 30, 249, 203, 203, 211, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 212, 203, 243, 203,
-        275, 203, 262, 262, 6, 1, 208, 209,
-        203, 203, 203, 217, 203, 243, 203, 243,
-        203, 203, 203, 253, 253, 203, 1, 208,
-        209, 203, 203, 203, 217, 203, 243, 203,
-        243, 203, 203, 203, 253, 276, 203, 1,
-        208, 209, 203, 203, 203, 217, 203, 243,
-        203, 243, 203, 275, 203, 253, 253, 203,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        243, 203, 243, 3, 203, 203, 19, 244,
-        203, 1, 208, 209, 203, 203, 203, 217,
-        203, 243, 203, 236, 237, 242, 242, 6,
-        1, 208, 209, 203, 203, 203, 240, 203,
-        203, 211, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 212,
-        203, 236, 237, 238, 242, 6, 1, 208,
-        209, 203, 203, 32, 240, 203, 203, 211,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 212, 203, 234,
-        203, 277, 203, 262, 262, 6, 1, 208,
-        209, 203, 203, 203, 217, 203, 234, 203,
-        234, 203, 203, 203, 253, 253, 203, 1,
-        208, 209, 203, 203, 203, 217, 203, 234,
-        203, 234, 203, 203, 203, 253, 278, 203,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        234, 203, 234, 203, 277, 203, 253, 253,
-        203, 1, 208, 209, 203, 203, 203, 217,
-        203, 234, 203, 234, 3, 203, 203, 19,
-        235, 203, 1, 208, 209, 203, 203, 203,
-        217, 203, 234, 203, 227, 228, 233, 233,
-        6, 1, 208, 209, 203, 203, 203, 231,
-        203, 203, 211, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        212, 203, 227, 228, 229, 233, 6, 1,
-        208, 209, 203, 203, 34, 231, 203, 203,
-        211, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 212, 203,
-        225, 203, 279, 203, 262, 262, 6, 1,
-        208, 209, 203, 203, 203, 217, 203, 225,
-        203, 225, 203, 203, 203, 253, 253, 203,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        225, 203, 225, 203, 203, 203, 253, 280,
-        203, 1, 208, 209, 203, 203, 203, 217,
-        203, 225, 203, 225, 203, 279, 203, 253,
-        253, 203, 1, 208, 209, 203, 203, 203,
-        217, 203, 225, 203, 225, 3, 203, 203,
-        19, 226, 203, 1, 208, 209, 203, 203,
-        203, 217, 203, 225, 203, 218, 219, 224,
-        224, 6, 1, 208, 209, 203, 203, 203,
-        222, 203, 203, 211, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 212, 203, 218, 219, 220, 224, 6,
-        1, 208, 209, 203, 203, 36, 222, 203,
-        203, 211, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 212,
-        203, 215, 203, 281, 203, 262, 262, 6,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        215, 203, 215, 203, 203, 203, 253, 253,
-        203, 1, 208, 209, 203, 203, 203, 217,
-        203, 215, 203, 215, 203, 203, 203, 253,
-        282, 203, 1, 208, 209, 203, 203, 203,
-        217, 203, 215, 203, 215, 203, 281, 203,
-        253, 253, 203, 1, 208, 209, 203, 203,
-        203, 217, 203, 215, 203, 215, 3, 203,
-        203, 19, 216, 203, 1, 208, 209, 203,
-        203, 203, 217, 203, 215, 203, 204, 205,
-        214, 214, 6, 1, 208, 209, 203, 203,
-        203, 210, 203, 203, 211, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 212, 203, 204, 205, 206, 214,
-        6, 1, 208, 209, 203, 203, 38, 210,
-        203, 203, 211, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        212, 203, 284, 285, 286, 287, 45, 40,
-        288, 289, 283, 283, 77, 290, 283, 283,
-        291, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 292, 283,
-        293, 285, 294, 287, 45, 40, 288, 289,
-        283, 283, 283, 290, 283, 283, 291, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 292, 283, 285, 294,
-        287, 45, 40, 288, 289, 283, 283, 283,
-        290, 283, 283, 291, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 292, 283, 295, 283, 283, 283, 58,
-        296, 283, 40, 288, 289, 283, 283, 283,
-        297, 283, 295, 283, 298, 299, 300, 301,
-        45, 40, 288, 289, 283, 283, 75, 302,
-        283, 283, 291, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        292, 283, 303, 299, 304, 304, 45, 40,
-        288, 289, 283, 283, 283, 302, 283, 283,
-        291, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 292, 283,
-        299, 304, 304, 45, 40, 288, 289, 283,
-        283, 283, 302, 283, 283, 291, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 292, 283, 305, 283, 283,
-        283, 58, 306, 283, 40, 288, 289, 283,
-        283, 283, 297, 283, 305, 283, 307, 308,
-        309, 310, 45, 40, 288, 289, 283, 283,
-        73, 311, 283, 283, 291, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 292, 283, 312, 308, 313, 313,
-        45, 40, 288, 289, 283, 283, 283, 311,
-        283, 283, 291, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        292, 283, 308, 313, 313, 45, 40, 288,
-        289, 283, 283, 283, 311, 283, 283, 291,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 292, 283, 314,
-        283, 283, 283, 58, 315, 283, 40, 288,
-        289, 283, 283, 283, 297, 283, 314, 283,
-        316, 317, 318, 319, 45, 40, 288, 289,
-        283, 283, 71, 320, 283, 283, 291, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 292, 283, 321, 317,
-        322, 322, 45, 40, 288, 289, 283, 283,
-        283, 320, 283, 283, 291, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 292, 283, 317, 322, 322, 45,
-        40, 288, 289, 283, 283, 283, 320, 283,
-        283, 291, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 292,
-        283, 323, 283, 283, 283, 58, 324, 283,
-        40, 288, 289, 283, 283, 283, 297, 283,
-        323, 283, 325, 326, 327, 328, 45, 40,
-        288, 289, 283, 283, 69, 329, 283, 283,
-        291, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 292, 283,
-        330, 326, 331, 331, 45, 40, 288, 289,
-        283, 283, 283, 329, 283, 283, 291, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 292, 283, 326, 331,
-        331, 45, 40, 288, 289, 283, 283, 283,
-        329, 283, 283, 291, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 292, 283, 58, 332, 283, 40, 288,
-        289, 283, 283, 283, 297, 283, 333, 333,
-        283, 40, 288, 289, 283, 283, 283, 297,
-        283, 334, 283, 283, 335, 288, 289, 283,
-        288, 289, 283, 336, 283, 288, 337, 283,
-        288, 338, 283, 288, 283, 334, 283, 283,
-        283, 288, 289, 283, 339, 283, 340, 341,
-        283, 40, 288, 289, 283, 283, 43, 283,
-        42, 283, 333, 333, 283, 40, 288, 289,
-        283, 333, 333, 283, 40, 288, 289, 283,
-        339, 283, 333, 333, 283, 40, 288, 289,
-        283, 339, 283, 340, 333, 283, 40, 288,
-        289, 283, 283, 43, 283, 58, 283, 342,
-        342, 45, 40, 288, 289, 283, 283, 283,
-        297, 283, 343, 67, 344, 345, 48, 40,
-        288, 289, 283, 283, 283, 297, 283, 67,
-        344, 345, 48, 40, 288, 289, 283, 283,
-        283, 297, 283, 344, 344, 48, 40, 288,
-        289, 283, 283, 283, 297, 283, 346, 64,
-        347, 348, 51, 40, 288, 289, 283, 283,
-        283, 297, 283, 64, 347, 348, 51, 40,
-        288, 289, 283, 283, 283, 297, 283, 347,
-        347, 51, 40, 288, 289, 283, 283, 283,
-        297, 283, 349, 61, 350, 351, 54, 40,
-        288, 289, 283, 283, 283, 297, 283, 61,
-        350, 351, 54, 40, 288, 289, 283, 283,
-        283, 297, 283, 350, 350, 54, 40, 288,
-        289, 283, 283, 283, 297, 283, 352, 58,
-        333, 353, 283, 40, 288, 289, 283, 283,
-        283, 297, 283, 58, 333, 353, 283, 40,
-        288, 289, 283, 283, 283, 297, 283, 333,
-        354, 283, 40, 288, 289, 283, 283, 283,
-        297, 283, 58, 283, 333, 333, 283, 40,
-        288, 289, 283, 283, 283, 297, 283, 41,
-        42, 283, 283, 58, 332, 283, 40, 288,
-        289, 283, 283, 283, 297, 283, 41, 283,
-        326, 331, 331, 45, 40, 288, 289, 283,
-        283, 283, 329, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 292, 283, 326, 331, 331,
-        45, 40, 288, 289, 283, 283, 283, 329,
-        283, 325, 326, 331, 331, 45, 40, 288,
-        289, 283, 283, 283, 329, 283, 283, 291,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 292, 283, 325,
-        326, 327, 331, 45, 40, 288, 289, 283,
-        283, 69, 329, 283, 283, 291, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 292, 283, 323, 283, 355,
-        283, 342, 342, 45, 40, 288, 289, 283,
-        283, 283, 297, 283, 323, 283, 323, 283,
-        283, 283, 333, 333, 283, 40, 288, 289,
-        283, 283, 283, 297, 283, 323, 283, 323,
-        283, 283, 283, 333, 356, 283, 40, 288,
-        289, 283, 283, 283, 297, 283, 323, 283,
-        323, 283, 355, 283, 333, 333, 283, 40,
-        288, 289, 283, 283, 283, 297, 283, 323,
-        283, 323, 42, 283, 283, 58, 324, 283,
-        40, 288, 289, 283, 283, 283, 297, 283,
-        323, 283, 316, 317, 322, 322, 45, 40,
-        288, 289, 283, 283, 283, 320, 283, 283,
-        291, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 292, 283,
-        316, 317, 318, 322, 45, 40, 288, 289,
-        283, 283, 71, 320, 283, 283, 291, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 292, 283, 314, 283,
-        357, 283, 342, 342, 45, 40, 288, 289,
-        283, 283, 283, 297, 283, 314, 283, 314,
-        283, 283, 283, 333, 333, 283, 40, 288,
-        289, 283, 283, 283, 297, 283, 314, 283,
-        314, 283, 283, 283, 333, 358, 283, 40,
-        288, 289, 283, 283, 283, 297, 283, 314,
-        283, 314, 283, 357, 283, 333, 333, 283,
-        40, 288, 289, 283, 283, 283, 297, 283,
-        314, 283, 314, 42, 283, 283, 58, 315,
-        283, 40, 288, 289, 283, 283, 283, 297,
-        283, 314, 283, 307, 308, 313, 313, 45,
-        40, 288, 289, 283, 283, 283, 311, 283,
-        283, 291, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 292,
-        283, 307, 308, 309, 313, 45, 40, 288,
-        289, 283, 283, 73, 311, 283, 283, 291,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 292, 283, 305,
-        283, 359, 283, 342, 342, 45, 40, 288,
-        289, 283, 283, 283, 297, 283, 305, 283,
-        305, 283, 283, 283, 333, 333, 283, 40,
-        288, 289, 283, 283, 283, 297, 283, 305,
-        283, 305, 283, 283, 283, 333, 360, 283,
-        40, 288, 289, 283, 283, 283, 297, 283,
-        305, 283, 305, 283, 359, 283, 333, 333,
-        283, 40, 288, 289, 283, 283, 283, 297,
-        283, 305, 283, 305, 42, 283, 283, 58,
-        306, 283, 40, 288, 289, 283, 283, 283,
-        297, 283, 305, 283, 298, 299, 304, 304,
-        45, 40, 288, 289, 283, 283, 283, 302,
-        283, 283, 291, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        292, 283, 298, 299, 300, 304, 45, 40,
-        288, 289, 283, 283, 75, 302, 283, 283,
-        291, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 292, 283,
-        295, 283, 361, 283, 342, 342, 45, 40,
-        288, 289, 283, 283, 283, 297, 283, 295,
-        283, 295, 283, 283, 283, 333, 333, 283,
-        40, 288, 289, 283, 283, 283, 297, 283,
-        295, 283, 295, 283, 283, 283, 333, 362,
-        283, 40, 288, 289, 283, 283, 283, 297,
-        283, 295, 283, 295, 283, 361, 283, 333,
-        333, 283, 40, 288, 289, 283, 283, 283,
-        297, 283, 295, 283, 76, 44, 44, 45,
-        40, 283, 283, 283, 283, 283, 76, 283,
-        295, 42, 283, 283, 58, 296, 283, 40,
-        288, 289, 283, 283, 283, 297, 283, 295,
-        283, 284, 285, 294, 287, 45, 40, 288,
-        289, 283, 283, 283, 290, 283, 283, 291,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 292, 283, 364,
-        191, 365, 365, 84, 79, 194, 195, 363,
-        363, 363, 197, 363, 363, 200, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 202, 363, 191, 365, 365,
-        84, 79, 194, 195, 363, 363, 363, 197,
-        363, 363, 200, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        202, 363, 366, 363, 363, 363, 98, 367,
-        363, 79, 194, 195, 363, 363, 363, 368,
-        363, 366, 363, 369, 370, 371, 372, 84,
-        79, 194, 195, 363, 363, 115, 373, 363,
-        363, 200, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 202,
-        363, 374, 370, 375, 375, 84, 79, 194,
-        195, 363, 363, 363, 373, 363, 363, 200,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 202, 363, 370,
-        375, 375, 84, 79, 194, 195, 363, 363,
-        363, 373, 363, 363, 200, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 202, 363, 376, 363, 363, 363,
-        98, 377, 363, 79, 194, 195, 363, 363,
-        363, 368, 363, 376, 363, 378, 379, 380,
-        381, 84, 79, 194, 195, 363, 363, 113,
-        382, 363, 363, 200, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 202, 363, 383, 379, 384, 384, 84,
-        79, 194, 195, 363, 363, 363, 382, 363,
-        363, 200, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 202,
-        363, 379, 384, 384, 84, 79, 194, 195,
-        363, 363, 363, 382, 363, 363, 200, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 202, 363, 385, 363,
-        363, 363, 98, 386, 363, 79, 194, 195,
-        363, 363, 363, 368, 363, 385, 363, 387,
-        388, 389, 390, 84, 79, 194, 195, 363,
-        363, 111, 391, 363, 363, 200, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 202, 363, 392, 388, 393,
-        393, 84, 79, 194, 195, 363, 363, 363,
-        391, 363, 363, 200, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 202, 363, 388, 393, 393, 84, 79,
-        194, 195, 363, 363, 363, 391, 363, 363,
-        200, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 202, 363,
-        394, 363, 363, 363, 98, 395, 363, 79,
-        194, 195, 363, 363, 363, 368, 363, 394,
-        363, 396, 397, 398, 399, 84, 79, 194,
-        195, 363, 363, 109, 400, 363, 363, 200,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 202, 363, 401,
-        397, 402, 402, 84, 79, 194, 195, 363,
-        363, 363, 400, 363, 363, 200, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 202, 363, 397, 402, 402,
-        84, 79, 194, 195, 363, 363, 363, 400,
-        363, 363, 200, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        202, 363, 98, 403, 363, 79, 194, 195,
-        363, 363, 363, 368, 363, 404, 404, 363,
-        79, 194, 195, 363, 363, 363, 368, 363,
-        405, 363, 363, 406, 194, 195, 363, 194,
-        195, 363, 407, 363, 194, 408, 363, 194,
-        409, 363, 194, 363, 405, 363, 363, 363,
-        194, 195, 363, 410, 363, 411, 412, 363,
-        79, 194, 195, 363, 363, 82, 363, 81,
-        363, 404, 404, 363, 79, 194, 195, 363,
-        404, 404, 363, 79, 194, 195, 363, 410,
-        363, 404, 404, 363, 79, 194, 195, 363,
-        410, 363, 411, 404, 363, 79, 194, 195,
-        363, 363, 82, 363, 98, 363, 413, 413,
-        84, 79, 194, 195, 363, 363, 363, 368,
-        363, 414, 107, 415, 416, 88, 79, 194,
-        195, 363, 363, 363, 368, 363, 107, 415,
-        416, 88, 79, 194, 195, 363, 363, 363,
-        368, 363, 415, 415, 88, 79, 194, 195,
-        363, 363, 363, 368, 363, 417, 104, 418,
-        419, 91, 79, 194, 195, 363, 363, 363,
-        368, 363, 104, 418, 419, 91, 79, 194,
-        195, 363, 363, 363, 368, 363, 418, 418,
-        91, 79, 194, 195, 363, 363, 363, 368,
-        363, 420, 101, 421, 422, 94, 79, 194,
-        195, 363, 363, 363, 368, 363, 101, 421,
-        422, 94, 79, 194, 195, 363, 363, 363,
-        368, 363, 421, 421, 94, 79, 194, 195,
-        363, 363, 363, 368, 363, 423, 98, 404,
-        424, 363, 79, 194, 195, 363, 363, 363,
-        368, 363, 98, 404, 424, 363, 79, 194,
-        195, 363, 363, 363, 368, 363, 404, 425,
-        363, 79, 194, 195, 363, 363, 363, 368,
-        363, 98, 363, 404, 404, 363, 79, 194,
-        195, 363, 363, 363, 368, 363, 80, 81,
-        363, 363, 98, 403, 363, 79, 194, 195,
-        363, 363, 363, 368, 363, 80, 363, 397,
-        402, 402, 84, 79, 194, 195, 363, 363,
-        363, 400, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 202, 363, 397, 402, 402, 84,
-        79, 194, 195, 363, 363, 363, 400, 363,
-        396, 397, 402, 402, 84, 79, 194, 195,
-        363, 363, 363, 400, 363, 363, 200, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 202, 363, 396, 397,
-        398, 402, 84, 79, 194, 195, 363, 363,
-        109, 400, 363, 363, 200, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 202, 363, 394, 363, 426, 363,
-        413, 413, 84, 79, 194, 195, 363, 363,
-        363, 368, 363, 394, 363, 394, 363, 363,
-        363, 404, 404, 363, 79, 194, 195, 363,
-        363, 363, 368, 363, 394, 363, 394, 363,
-        363, 363, 404, 427, 363, 79, 194, 195,
-        363, 363, 363, 368, 363, 394, 363, 394,
-        363, 426, 363, 404, 404, 363, 79, 194,
-        195, 363, 363, 363, 368, 363, 394, 363,
-        394, 81, 363, 363, 98, 395, 363, 79,
-        194, 195, 363, 363, 363, 368, 363, 394,
-        363, 387, 388, 393, 393, 84, 79, 194,
-        195, 363, 363, 363, 391, 363, 363, 200,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 202, 363, 387,
-        388, 389, 393, 84, 79, 194, 195, 363,
-        363, 111, 391, 363, 363, 200, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 202, 363, 385, 363, 428,
-        363, 413, 413, 84, 79, 194, 195, 363,
-        363, 363, 368, 363, 385, 363, 385, 363,
-        363, 363, 404, 404, 363, 79, 194, 195,
-        363, 363, 363, 368, 363, 385, 363, 385,
-        363, 363, 363, 404, 429, 363, 79, 194,
-        195, 363, 363, 363, 368, 363, 385, 363,
-        385, 363, 428, 363, 404, 404, 363, 79,
-        194, 195, 363, 363, 363, 368, 363, 385,
-        363, 385, 81, 363, 363, 98, 386, 363,
-        79, 194, 195, 363, 363, 363, 368, 363,
-        385, 363, 378, 379, 384, 384, 84, 79,
-        194, 195, 363, 363, 363, 382, 363, 363,
-        200, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 202, 363,
-        378, 379, 380, 384, 84, 79, 194, 195,
-        363, 363, 113, 382, 363, 363, 200, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 202, 363, 376, 363,
-        430, 363, 413, 413, 84, 79, 194, 195,
-        363, 363, 363, 368, 363, 376, 363, 376,
-        363, 363, 363, 404, 404, 363, 79, 194,
-        195, 363, 363, 363, 368, 363, 376, 363,
-        376, 363, 363, 363, 404, 431, 363, 79,
-        194, 195, 363, 363, 363, 368, 363, 376,
-        363, 376, 363, 430, 363, 404, 404, 363,
-        79, 194, 195, 363, 363, 363, 368, 363,
-        376, 363, 376, 81, 363, 363, 98, 377,
-        363, 79, 194, 195, 363, 363, 363, 368,
-        363, 376, 363, 369, 370, 375, 375, 84,
-        79, 194, 195, 363, 363, 363, 373, 363,
-        363, 200, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 202,
-        363, 369, 370, 371, 375, 84, 79, 194,
-        195, 363, 363, 115, 373, 363, 363, 200,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 202, 363, 366,
-        363, 432, 363, 413, 413, 84, 79, 194,
-        195, 363, 363, 363, 368, 363, 366, 363,
-        366, 363, 363, 363, 404, 404, 363, 79,
-        194, 195, 363, 363, 363, 368, 363, 366,
-        363, 366, 363, 363, 363, 404, 433, 363,
-        79, 194, 195, 363, 363, 363, 368, 363,
-        366, 363, 366, 363, 432, 363, 404, 404,
-        363, 79, 194, 195, 363, 363, 363, 368,
-        363, 366, 363, 366, 81, 363, 363, 98,
-        367, 363, 79, 194, 195, 363, 363, 363,
-        368, 363, 366, 363, 116, 83, 83, 84,
-        79, 434, 434, 434, 434, 156, 116, 434,
-        190, 191, 365, 365, 84, 79, 194, 195,
-        363, 363, 363, 197, 363, 363, 200, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 202, 363, 116, 83,
-        83, 84, 79, 434, 434, 434, 434, 434,
-        116, 434, 436, 437, 438, 439, 123, 118,
-        440, 441, 435, 435, 155, 442, 435, 435,
-        443, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 444, 435,
-        445, 437, 439, 439, 123, 118, 440, 441,
-        435, 435, 435, 442, 435, 435, 443, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 444, 435, 437, 439,
-        439, 123, 118, 440, 441, 435, 435, 435,
-        442, 435, 435, 443, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 444, 435, 446, 435, 435, 435, 136,
-        447, 435, 118, 440, 441, 435, 435, 435,
-        448, 435, 446, 435, 449, 450, 451, 452,
-        123, 118, 440, 441, 435, 435, 153, 453,
-        435, 435, 443, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        444, 435, 454, 450, 455, 455, 123, 118,
-        440, 441, 435, 435, 435, 453, 435, 435,
-        443, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 444, 435,
-        450, 455, 455, 123, 118, 440, 441, 435,
-        435, 435, 453, 435, 435, 443, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 444, 435, 456, 435, 435,
-        435, 136, 457, 435, 118, 440, 441, 435,
-        435, 435, 448, 435, 456, 435, 458, 459,
-        460, 461, 123, 118, 440, 441, 435, 435,
-        151, 462, 435, 435, 443, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 444, 435, 463, 459, 464, 464,
-        123, 118, 440, 441, 435, 435, 435, 462,
-        435, 435, 443, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        444, 435, 459, 464, 464, 123, 118, 440,
-        441, 435, 435, 435, 462, 435, 435, 443,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 444, 435, 465,
-        435, 435, 435, 136, 466, 435, 118, 440,
-        441, 435, 435, 435, 448, 435, 465, 435,
-        467, 468, 469, 470, 123, 118, 440, 441,
-        435, 435, 149, 471, 435, 435, 443, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 444, 435, 472, 468,
-        473, 473, 123, 118, 440, 441, 435, 435,
-        435, 471, 435, 435, 443, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 444, 435, 468, 473, 473, 123,
-        118, 440, 441, 435, 435, 435, 471, 435,
-        435, 443, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 444,
-        435, 474, 435, 435, 435, 136, 475, 435,
-        118, 440, 441, 435, 435, 435, 448, 435,
-        474, 435, 476, 477, 478, 479, 123, 118,
-        440, 441, 435, 435, 147, 480, 435, 435,
-        443, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 444, 435,
-        481, 477, 482, 482, 123, 118, 440, 441,
-        435, 435, 435, 480, 435, 435, 443, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 444, 435, 477, 482,
-        482, 123, 118, 440, 441, 435, 435, 435,
-        480, 435, 435, 443, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 444, 435, 136, 483, 435, 118, 440,
-        441, 435, 435, 435, 448, 435, 484, 484,
-        435, 118, 440, 441, 435, 435, 435, 448,
-        435, 485, 435, 435, 486, 440, 441, 435,
-        440, 441, 435, 487, 435, 440, 488, 435,
-        440, 489, 435, 440, 435, 485, 435, 435,
-        435, 440, 441, 435, 490, 435, 491, 492,
-        435, 118, 440, 441, 435, 435, 121, 435,
-        120, 435, 484, 484, 435, 118, 440, 441,
-        435, 484, 484, 435, 118, 440, 441, 435,
-        490, 435, 484, 484, 435, 118, 440, 441,
-        435, 490, 435, 491, 484, 435, 118, 440,
-        441, 435, 435, 121, 435, 136, 435, 493,
-        493, 123, 118, 440, 441, 435, 435, 435,
-        448, 435, 494, 145, 495, 496, 126, 118,
-        440, 441, 435, 435, 435, 448, 435, 145,
-        495, 496, 126, 118, 440, 441, 435, 435,
-        435, 448, 435, 495, 495, 126, 118, 440,
-        441, 435, 435, 435, 448, 435, 497, 142,
-        498, 499, 129, 118, 440, 441, 435, 435,
-        435, 448, 435, 142, 498, 499, 129, 118,
-        440, 441, 435, 435, 435, 448, 435, 498,
-        498, 129, 118, 440, 441, 435, 435, 435,
-        448, 435, 500, 139, 501, 502, 132, 118,
-        440, 441, 435, 435, 435, 448, 435, 139,
-        501, 502, 132, 118, 440, 441, 435, 435,
-        435, 448, 435, 501, 501, 132, 118, 440,
-        441, 435, 435, 435, 448, 435, 503, 136,
-        484, 504, 435, 118, 440, 441, 435, 435,
-        435, 448, 435, 136, 484, 504, 435, 118,
-        440, 441, 435, 435, 435, 448, 435, 484,
-        505, 435, 118, 440, 441, 435, 435, 435,
-        448, 435, 136, 435, 484, 484, 435, 118,
-        440, 441, 435, 435, 435, 448, 435, 119,
-        120, 435, 435, 136, 483, 435, 118, 440,
-        441, 435, 435, 435, 448, 435, 119, 435,
-        477, 482, 482, 123, 118, 440, 441, 435,
-        435, 435, 480, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 444, 435, 477, 482, 482,
-        123, 118, 440, 441, 435, 435, 435, 480,
-        435, 476, 477, 482, 482, 123, 118, 440,
-        441, 435, 435, 435, 480, 435, 435, 443,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 444, 435, 476,
-        477, 478, 482, 123, 118, 440, 441, 435,
-        435, 147, 480, 435, 435, 443, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 444, 435, 474, 435, 506,
-        435, 493, 493, 123, 118, 440, 441, 435,
-        435, 435, 448, 435, 474, 435, 474, 435,
-        435, 435, 484, 484, 435, 118, 440, 441,
-        435, 435, 435, 448, 435, 474, 435, 474,
-        435, 435, 435, 484, 507, 435, 118, 440,
-        441, 435, 435, 435, 448, 435, 474, 435,
-        474, 435, 506, 435, 484, 484, 435, 118,
-        440, 441, 435, 435, 435, 448, 435, 474,
-        435, 474, 120, 435, 435, 136, 475, 435,
-        118, 440, 441, 435, 435, 435, 448, 435,
-        474, 435, 467, 468, 473, 473, 123, 118,
-        440, 441, 435, 435, 435, 471, 435, 435,
-        443, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 444, 435,
-        467, 468, 469, 473, 123, 118, 440, 441,
-        435, 435, 149, 471, 435, 435, 443, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 444, 435, 465, 435,
-        508, 435, 493, 493, 123, 118, 440, 441,
-        435, 435, 435, 448, 435, 465, 435, 465,
-        435, 435, 435, 484, 484, 435, 118, 440,
-        441, 435, 435, 435, 448, 435, 465, 435,
-        465, 435, 435, 435, 484, 509, 435, 118,
-        440, 441, 435, 435, 435, 448, 435, 465,
-        435, 465, 435, 508, 435, 484, 484, 435,
-        118, 440, 441, 435, 435, 435, 448, 435,
-        465, 435, 465, 120, 435, 435, 136, 466,
-        435, 118, 440, 441, 435, 435, 435, 448,
-        435, 465, 435, 458, 459, 464, 464, 123,
-        118, 440, 441, 435, 435, 435, 462, 435,
-        435, 443, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 444,
-        435, 458, 459, 460, 464, 123, 118, 440,
-        441, 435, 435, 151, 462, 435, 435, 443,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 444, 435, 456,
-        435, 510, 435, 493, 493, 123, 118, 440,
-        441, 435, 435, 435, 448, 435, 456, 435,
-        456, 435, 435, 435, 484, 484, 435, 118,
-        440, 441, 435, 435, 435, 448, 435, 456,
-        435, 456, 435, 435, 435, 484, 511, 435,
-        118, 440, 441, 435, 435, 435, 448, 435,
-        456, 435, 456, 435, 510, 435, 484, 484,
-        435, 118, 440, 441, 435, 435, 435, 448,
-        435, 456, 435, 456, 120, 435, 435, 136,
-        457, 435, 118, 440, 441, 435, 435, 435,
-        448, 435, 456, 435, 449, 450, 455, 455,
-        123, 118, 440, 441, 435, 435, 435, 453,
-        435, 435, 443, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        444, 435, 449, 450, 451, 455, 123, 118,
-        440, 441, 435, 435, 153, 453, 435, 435,
-        443, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 444, 435,
-        446, 435, 512, 435, 493, 493, 123, 118,
-        440, 441, 435, 435, 435, 448, 435, 446,
-        435, 446, 435, 435, 435, 484, 484, 435,
-        118, 440, 441, 435, 435, 435, 448, 435,
-        446, 435, 446, 435, 435, 435, 484, 513,
-        435, 118, 440, 441, 435, 435, 435, 448,
-        435, 446, 435, 446, 435, 512, 435, 484,
-        484, 435, 118, 440, 441, 435, 435, 435,
-        448, 435, 446, 435, 446, 120, 435, 435,
-        136, 447, 435, 118, 440, 441, 435, 435,
-        435, 448, 435, 446, 435, 436, 437, 439,
-        439, 123, 118, 440, 441, 435, 435, 435,
-        442, 435, 435, 443, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 444, 435, 188, 189, 190, 191, 514,
-        365, 84, 79, 194, 195, 196, 196, 156,
-        197, 363, 188, 200, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 202, 363, 204, 515, 206, 207, 6,
-        1, 208, 209, 203, 203, 38, 210, 203,
-        203, 211, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 212,
-        203, 215, 189, 190, 191, 516, 517, 84,
-        157, 518, 519, 203, 196, 156, 520, 203,
-        215, 200, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 202,
-        203, 116, 521, 521, 84, 157, 208, 209,
-        203, 203, 156, 522, 203, 523, 203, 203,
-        524, 518, 519, 203, 518, 519, 203, 256,
-        203, 518, 525, 203, 518, 526, 203, 518,
-        203, 523, 203, 203, 203, 518, 519, 203,
-        527, 3, 363, 363, 404, 433, 363, 79,
-        194, 195, 363, 363, 363, 368, 363, 527,
-        363, 528, 370, 529, 530, 84, 157, 518,
-        519, 203, 203, 158, 373, 203, 203, 200,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 202, 203, 531,
-        370, 532, 532, 84, 157, 518, 519, 203,
-        203, 203, 373, 203, 203, 200, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 202, 203, 370, 532, 532,
-        84, 157, 518, 519, 203, 203, 203, 373,
-        203, 203, 200, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        202, 203, 528, 370, 532, 532, 84, 157,
-        518, 519, 203, 203, 203, 373, 203, 203,
-        200, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 202, 203,
-        528, 370, 529, 532, 84, 157, 518, 519,
-        203, 203, 158, 373, 203, 203, 200, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 202, 203, 215, 203,
-        281, 116, 533, 533, 160, 157, 208, 209,
-        203, 203, 203, 522, 203, 215, 203, 534,
-        184, 535, 536, 162, 157, 518, 519, 203,
-        203, 203, 537, 203, 184, 535, 536, 162,
-        157, 518, 519, 203, 203, 203, 537, 203,
-        535, 535, 162, 157, 518, 519, 203, 203,
-        203, 537, 203, 538, 181, 539, 540, 165,
-        157, 518, 519, 203, 203, 203, 537, 203,
-        181, 539, 540, 165, 157, 518, 519, 203,
-        203, 203, 537, 203, 539, 539, 165, 157,
-        518, 519, 203, 203, 203, 537, 203, 541,
-        178, 542, 543, 168, 157, 518, 519, 203,
-        203, 203, 537, 203, 178, 542, 543, 168,
-        157, 518, 519, 203, 203, 203, 537, 203,
-        542, 542, 168, 157, 518, 519, 203, 203,
-        203, 537, 203, 544, 175, 545, 546, 203,
-        157, 518, 519, 203, 203, 203, 537, 203,
-        175, 545, 546, 203, 157, 518, 519, 203,
-        203, 203, 537, 203, 545, 545, 203, 157,
-        518, 519, 203, 203, 203, 537, 203, 547,
-        203, 548, 549, 203, 157, 518, 519, 203,
-        203, 172, 203, 171, 203, 545, 545, 203,
-        157, 518, 519, 203, 545, 545, 203, 157,
-        518, 519, 203, 547, 203, 545, 545, 203,
-        157, 518, 519, 203, 547, 203, 548, 545,
-        203, 157, 518, 519, 203, 203, 172, 203,
-        527, 171, 363, 363, 98, 367, 363, 79,
-        194, 195, 363, 363, 363, 368, 363, 527,
-        363, 551, 550, 552, 552, 550, 186, 553,
-        554, 550, 552, 552, 550, 186, 553, 554,
-        550, 555, 550, 550, 556, 553, 554, 550,
-        553, 554, 550, 557, 550, 553, 558, 550,
-        553, 559, 550, 553, 550, 555, 550, 550,
-        550, 553, 554, 550, 0
+        197, 198, 199, 200, 201, 187, 203, 204,
+        205, 206, 6, 1, 207, 208, 202, 202,
+        38, 209, 202, 202, 210, 202, 211, 204,
+        212, 212, 6, 1, 207, 208, 202, 202,
+        202, 209, 202, 202, 210, 202, 204, 212,
+        212, 6, 1, 207, 208, 202, 202, 202,
+        209, 202, 202, 210, 202, 213, 202, 202,
+        202, 19, 214, 202, 1, 207, 208, 202,
+        202, 202, 215, 202, 213, 202, 216, 217,
+        218, 219, 6, 1, 207, 208, 202, 202,
+        36, 220, 202, 202, 210, 202, 221, 217,
+        222, 222, 6, 1, 207, 208, 202, 202,
+        202, 220, 202, 202, 210, 202, 217, 222,
+        222, 6, 1, 207, 208, 202, 202, 202,
+        220, 202, 202, 210, 202, 223, 202, 202,
+        202, 19, 224, 202, 1, 207, 208, 202,
+        202, 202, 215, 202, 223, 202, 225, 226,
+        227, 228, 6, 1, 207, 208, 202, 202,
+        34, 229, 202, 202, 210, 202, 230, 226,
+        231, 231, 6, 1, 207, 208, 202, 202,
+        202, 229, 202, 202, 210, 202, 226, 231,
+        231, 6, 1, 207, 208, 202, 202, 202,
+        229, 202, 202, 210, 202, 232, 202, 202,
+        202, 19, 233, 202, 1, 207, 208, 202,
+        202, 202, 215, 202, 232, 202, 234, 235,
+        236, 237, 6, 1, 207, 208, 202, 202,
+        32, 238, 202, 202, 210, 202, 239, 235,
+        240, 240, 6, 1, 207, 208, 202, 202,
+        202, 238, 202, 202, 210, 202, 235, 240,
+        240, 6, 1, 207, 208, 202, 202, 202,
+        238, 202, 202, 210, 202, 241, 202, 202,
+        202, 19, 242, 202, 1, 207, 208, 202,
+        202, 202, 215, 202, 241, 202, 243, 244,
+        245, 246, 6, 1, 207, 208, 202, 202,
+        30, 247, 202, 202, 210, 202, 248, 244,
+        249, 249, 6, 1, 207, 208, 202, 202,
+        202, 247, 202, 202, 210, 202, 244, 249,
+        249, 6, 1, 207, 208, 202, 202, 202,
+        247, 202, 202, 210, 202, 19, 250, 202,
+        1, 207, 208, 202, 202, 202, 215, 202,
+        251, 251, 202, 1, 207, 208, 202, 202,
+        202, 215, 202, 252, 202, 202, 253, 207,
+        208, 202, 207, 208, 202, 254, 202, 207,
+        255, 202, 207, 256, 202, 207, 202, 252,
+        202, 202, 202, 207, 208, 202, 257, 202,
+        258, 259, 202, 1, 207, 208, 202, 202,
+        4, 202, 3, 202, 251, 251, 202, 1,
+        207, 208, 202, 251, 251, 202, 1, 207,
+        208, 202, 257, 202, 251, 251, 202, 1,
+        207, 208, 202, 257, 202, 258, 251, 202,
+        1, 207, 208, 202, 202, 4, 202, 19,
+        202, 260, 260, 6, 1, 207, 208, 202,
+        202, 202, 215, 202, 261, 28, 262, 263,
+        9, 1, 207, 208, 202, 202, 202, 215,
+        202, 28, 262, 263, 9, 1, 207, 208,
+        202, 202, 202, 215, 202, 262, 262, 9,
+        1, 207, 208, 202, 202, 202, 215, 202,
+        264, 25, 265, 266, 12, 1, 207, 208,
+        202, 202, 202, 215, 202, 25, 265, 266,
+        12, 1, 207, 208, 202, 202, 202, 215,
+        202, 265, 265, 12, 1, 207, 208, 202,
+        202, 202, 215, 202, 267, 22, 268, 269,
+        15, 1, 207, 208, 202, 202, 202, 215,
+        202, 22, 268, 269, 15, 1, 207, 208,
+        202, 202, 202, 215, 202, 268, 268, 15,
+        1, 207, 208, 202, 202, 202, 215, 202,
+        270, 19, 251, 271, 202, 1, 207, 208,
+        202, 202, 202, 215, 202, 19, 251, 271,
+        202, 1, 207, 208, 202, 202, 202, 215,
+        202, 251, 272, 202, 1, 207, 208, 202,
+        202, 202, 215, 202, 19, 202, 251, 251,
+        202, 1, 207, 208, 202, 202, 202, 215,
+        202, 2, 3, 202, 202, 19, 250, 202,
+        1, 207, 208, 202, 202, 202, 215, 202,
+        2, 202, 244, 249, 249, 6, 1, 207,
+        208, 202, 202, 202, 247, 202, 243, 244,
+        249, 249, 6, 1, 207, 208, 202, 202,
+        202, 247, 202, 202, 210, 202, 243, 244,
+        245, 249, 6, 1, 207, 208, 202, 202,
+        30, 247, 202, 202, 210, 202, 241, 202,
+        273, 202, 260, 260, 6, 1, 207, 208,
+        202, 202, 202, 215, 202, 241, 202, 241,
+        202, 202, 202, 251, 251, 202, 1, 207,
+        208, 202, 202, 202, 215, 202, 241, 202,
+        241, 202, 202, 202, 251, 274, 202, 1,
+        207, 208, 202, 202, 202, 215, 202, 241,
+        202, 241, 202, 273, 202, 251, 251, 202,
+        1, 207, 208, 202, 202, 202, 215, 202,
+        241, 202, 241, 3, 202, 202, 19, 242,
+        202, 1, 207, 208, 202, 202, 202, 215,
+        202, 241, 202, 234, 235, 240, 240, 6,
+        1, 207, 208, 202, 202, 202, 238, 202,
+        202, 210, 202, 234, 235, 236, 240, 6,
+        1, 207, 208, 202, 202, 32, 238, 202,
+        202, 210, 202, 232, 202, 275, 202, 260,
+        260, 6, 1, 207, 208, 202, 202, 202,
+        215, 202, 232, 202, 232, 202, 202, 202,
+        251, 251, 202, 1, 207, 208, 202, 202,
+        202, 215, 202, 232, 202, 232, 202, 202,
+        202, 251, 276, 202, 1, 207, 208, 202,
+        202, 202, 215, 202, 232, 202, 232, 202,
+        275, 202, 251, 251, 202, 1, 207, 208,
+        202, 202, 202, 215, 202, 232, 202, 232,
+        3, 202, 202, 19, 233, 202, 1, 207,
+        208, 202, 202, 202, 215, 202, 232, 202,
+        225, 226, 231, 231, 6, 1, 207, 208,
+        202, 202, 202, 229, 202, 202, 210, 202,
+        225, 226, 227, 231, 6, 1, 207, 208,
+        202, 202, 34, 229, 202, 202, 210, 202,
+        223, 202, 277, 202, 260, 260, 6, 1,
+        207, 208, 202, 202, 202, 215, 202, 223,
+        202, 223, 202, 202, 202, 251, 251, 202,
+        1, 207, 208, 202, 202, 202, 215, 202,
+        223, 202, 223, 202, 202, 202, 251, 278,
+        202, 1, 207, 208, 202, 202, 202, 215,
+        202, 223, 202, 223, 202, 277, 202, 251,
+        251, 202, 1, 207, 208, 202, 202, 202,
+        215, 202, 223, 202, 223, 3, 202, 202,
+        19, 224, 202, 1, 207, 208, 202, 202,
+        202, 215, 202, 223, 202, 216, 217, 222,
+        222, 6, 1, 207, 208, 202, 202, 202,
+        220, 202, 202, 210, 202, 216, 217, 218,
+        222, 6, 1, 207, 208, 202, 202, 36,
+        220, 202, 202, 210, 202, 213, 202, 279,
+        202, 260, 260, 6, 1, 207, 208, 202,
+        202, 202, 215, 202, 213, 202, 213, 202,
+        202, 202, 251, 251, 202, 1, 207, 208,
+        202, 202, 202, 215, 202, 213, 202, 213,
+        202, 202, 202, 251, 280, 202, 1, 207,
+        208, 202, 202, 202, 215, 202, 213, 202,
+        213, 202, 279, 202, 251, 251, 202, 1,
+        207, 208, 202, 202, 202, 215, 202, 213,
+        202, 213, 3, 202, 202, 19, 214, 202,
+        1, 207, 208, 202, 202, 202, 215, 202,
+        213, 202, 203, 204, 212, 212, 6, 1,
+        207, 208, 202, 202, 202, 209, 202, 202,
+        210, 202, 203, 204, 205, 212, 6, 1,
+        207, 208, 202, 202, 38, 209, 202, 202,
+        210, 202, 282, 283, 284, 285, 45, 40,
+        286, 287, 281, 281, 77, 288, 281, 281,
+        289, 281, 290, 283, 291, 285, 45, 40,
+        286, 287, 281, 281, 281, 288, 281, 281,
+        289, 281, 283, 291, 285, 45, 40, 286,
+        287, 281, 281, 281, 288, 281, 281, 289,
+        281, 292, 281, 281, 281, 58, 293, 281,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        292, 281, 295, 296, 297, 298, 45, 40,
+        286, 287, 281, 281, 75, 299, 281, 281,
+        289, 281, 300, 296, 301, 301, 45, 40,
+        286, 287, 281, 281, 281, 299, 281, 281,
+        289, 281, 296, 301, 301, 45, 40, 286,
+        287, 281, 281, 281, 299, 281, 281, 289,
+        281, 302, 281, 281, 281, 58, 303, 281,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        302, 281, 304, 305, 306, 307, 45, 40,
+        286, 287, 281, 281, 73, 308, 281, 281,
+        289, 281, 309, 305, 310, 310, 45, 40,
+        286, 287, 281, 281, 281, 308, 281, 281,
+        289, 281, 305, 310, 310, 45, 40, 286,
+        287, 281, 281, 281, 308, 281, 281, 289,
+        281, 311, 281, 281, 281, 58, 312, 281,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        311, 281, 313, 314, 315, 316, 45, 40,
+        286, 287, 281, 281, 71, 317, 281, 281,
+        289, 281, 318, 314, 319, 319, 45, 40,
+        286, 287, 281, 281, 281, 317, 281, 281,
+        289, 281, 314, 319, 319, 45, 40, 286,
+        287, 281, 281, 281, 317, 281, 281, 289,
+        281, 320, 281, 281, 281, 58, 321, 281,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        320, 281, 322, 323, 324, 325, 45, 40,
+        286, 287, 281, 281, 69, 326, 281, 281,
+        289, 281, 327, 323, 328, 328, 45, 40,
+        286, 287, 281, 281, 281, 326, 281, 281,
+        289, 281, 323, 328, 328, 45, 40, 286,
+        287, 281, 281, 281, 326, 281, 281, 289,
+        281, 58, 329, 281, 40, 286, 287, 281,
+        281, 281, 294, 281, 330, 330, 281, 40,
+        286, 287, 281, 281, 281, 294, 281, 331,
+        281, 281, 332, 286, 287, 281, 286, 287,
+        281, 333, 281, 286, 334, 281, 286, 335,
+        281, 286, 281, 331, 281, 281, 281, 286,
+        287, 281, 336, 281, 337, 338, 281, 40,
+        286, 287, 281, 281, 43, 281, 42, 281,
+        330, 330, 281, 40, 286, 287, 281, 330,
+        330, 281, 40, 286, 287, 281, 336, 281,
+        330, 330, 281, 40, 286, 287, 281, 336,
+        281, 337, 330, 281, 40, 286, 287, 281,
+        281, 43, 281, 58, 281, 339, 339, 45,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        340, 67, 341, 342, 48, 40, 286, 287,
+        281, 281, 281, 294, 281, 67, 341, 342,
+        48, 40, 286, 287, 281, 281, 281, 294,
+        281, 341, 341, 48, 40, 286, 287, 281,
+        281, 281, 294, 281, 343, 64, 344, 345,
+        51, 40, 286, 287, 281, 281, 281, 294,
+        281, 64, 344, 345, 51, 40, 286, 287,
+        281, 281, 281, 294, 281, 344, 344, 51,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        346, 61, 347, 348, 54, 40, 286, 287,
+        281, 281, 281, 294, 281, 61, 347, 348,
+        54, 40, 286, 287, 281, 281, 281, 294,
+        281, 347, 347, 54, 40, 286, 287, 281,
+        281, 281, 294, 281, 349, 58, 330, 350,
+        281, 40, 286, 287, 281, 281, 281, 294,
+        281, 58, 330, 350, 281, 40, 286, 287,
+        281, 281, 281, 294, 281, 330, 351, 281,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        58, 281, 330, 330, 281, 40, 286, 287,
+        281, 281, 281, 294, 281, 41, 42, 281,
+        281, 58, 329, 281, 40, 286, 287, 281,
+        281, 281, 294, 281, 41, 281, 323, 328,
+        328, 45, 40, 286, 287, 281, 281, 281,
+        326, 281, 322, 323, 328, 328, 45, 40,
+        286, 287, 281, 281, 281, 326, 281, 281,
+        289, 281, 322, 323, 324, 328, 45, 40,
+        286, 287, 281, 281, 69, 326, 281, 281,
+        289, 281, 320, 281, 352, 281, 339, 339,
+        45, 40, 286, 287, 281, 281, 281, 294,
+        281, 320, 281, 320, 281, 281, 281, 330,
+        330, 281, 40, 286, 287, 281, 281, 281,
+        294, 281, 320, 281, 320, 281, 281, 281,
+        330, 353, 281, 40, 286, 287, 281, 281,
+        281, 294, 281, 320, 281, 320, 281, 352,
+        281, 330, 330, 281, 40, 286, 287, 281,
+        281, 281, 294, 281, 320, 281, 320, 42,
+        281, 281, 58, 321, 281, 40, 286, 287,
+        281, 281, 281, 294, 281, 320, 281, 313,
+        314, 319, 319, 45, 40, 286, 287, 281,
+        281, 281, 317, 281, 281, 289, 281, 313,
+        314, 315, 319, 45, 40, 286, 287, 281,
+        281, 71, 317, 281, 281, 289, 281, 311,
+        281, 354, 281, 339, 339, 45, 40, 286,
+        287, 281, 281, 281, 294, 281, 311, 281,
+        311, 281, 281, 281, 330, 330, 281, 40,
+        286, 287, 281, 281, 281, 294, 281, 311,
+        281, 311, 281, 281, 281, 330, 355, 281,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        311, 281, 311, 281, 354, 281, 330, 330,
+        281, 40, 286, 287, 281, 281, 281, 294,
+        281, 311, 281, 311, 42, 281, 281, 58,
+        312, 281, 40, 286, 287, 281, 281, 281,
+        294, 281, 311, 281, 304, 305, 310, 310,
+        45, 40, 286, 287, 281, 281, 281, 308,
+        281, 281, 289, 281, 304, 305, 306, 310,
+        45, 40, 286, 287, 281, 281, 73, 308,
+        281, 281, 289, 281, 302, 281, 356, 281,
+        339, 339, 45, 40, 286, 287, 281, 281,
+        281, 294, 281, 302, 281, 302, 281, 281,
+        281, 330, 330, 281, 40, 286, 287, 281,
+        281, 281, 294, 281, 302, 281, 302, 281,
+        281, 281, 330, 357, 281, 40, 286, 287,
+        281, 281, 281, 294, 281, 302, 281, 302,
+        281, 356, 281, 330, 330, 281, 40, 286,
+        287, 281, 281, 281, 294, 281, 302, 281,
+        302, 42, 281, 281, 58, 303, 281, 40,
+        286, 287, 281, 281, 281, 294, 281, 302,
+        281, 295, 296, 301, 301, 45, 40, 286,
+        287, 281, 281, 281, 299, 281, 281, 289,
+        281, 295, 296, 297, 301, 45, 40, 286,
+        287, 281, 281, 75, 299, 281, 281, 289,
+        281, 292, 281, 358, 281, 339, 339, 45,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        292, 281, 292, 281, 281, 281, 330, 330,
+        281, 40, 286, 287, 281, 281, 281, 294,
+        281, 292, 281, 292, 281, 281, 281, 330,
+        359, 281, 40, 286, 287, 281, 281, 281,
+        294, 281, 292, 281, 292, 281, 358, 281,
+        330, 330, 281, 40, 286, 287, 281, 281,
+        281, 294, 281, 292, 281, 76, 44, 44,
+        45, 40, 281, 281, 281, 281, 281, 76,
+        281, 292, 42, 281, 281, 58, 293, 281,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        292, 281, 282, 283, 291, 285, 45, 40,
+        286, 287, 281, 281, 281, 288, 281, 281,
+        289, 281, 361, 191, 362, 362, 84, 79,
+        194, 195, 360, 360, 360, 197, 360, 360,
+        200, 360, 191, 362, 362, 84, 79, 194,
+        195, 360, 360, 360, 197, 360, 360, 200,
+        360, 363, 360, 360, 360, 98, 364, 360,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        363, 360, 366, 367, 368, 369, 84, 79,
+        194, 195, 360, 360, 115, 370, 360, 360,
+        200, 360, 371, 367, 372, 372, 84, 79,
+        194, 195, 360, 360, 360, 370, 360, 360,
+        200, 360, 367, 372, 372, 84, 79, 194,
+        195, 360, 360, 360, 370, 360, 360, 200,
+        360, 373, 360, 360, 360, 98, 374, 360,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        373, 360, 375, 376, 377, 378, 84, 79,
+        194, 195, 360, 360, 113, 379, 360, 360,
+        200, 360, 380, 376, 381, 381, 84, 79,
+        194, 195, 360, 360, 360, 379, 360, 360,
+        200, 360, 376, 381, 381, 84, 79, 194,
+        195, 360, 360, 360, 379, 360, 360, 200,
+        360, 382, 360, 360, 360, 98, 383, 360,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        382, 360, 384, 385, 386, 387, 84, 79,
+        194, 195, 360, 360, 111, 388, 360, 360,
+        200, 360, 389, 385, 390, 390, 84, 79,
+        194, 195, 360, 360, 360, 388, 360, 360,
+        200, 360, 385, 390, 390, 84, 79, 194,
+        195, 360, 360, 360, 388, 360, 360, 200,
+        360, 391, 360, 360, 360, 98, 392, 360,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        391, 360, 393, 394, 395, 396, 84, 79,
+        194, 195, 360, 360, 109, 397, 360, 360,
+        200, 360, 398, 394, 399, 399, 84, 79,
+        194, 195, 360, 360, 360, 397, 360, 360,
+        200, 360, 394, 399, 399, 84, 79, 194,
+        195, 360, 360, 360, 397, 360, 360, 200,
+        360, 98, 400, 360, 79, 194, 195, 360,
+        360, 360, 365, 360, 401, 401, 360, 79,
+        194, 195, 360, 360, 360, 365, 360, 402,
+        360, 360, 403, 194, 195, 360, 194, 195,
+        360, 404, 360, 194, 405, 360, 194, 406,
+        360, 194, 360, 402, 360, 360, 360, 194,
+        195, 360, 407, 360, 408, 409, 360, 79,
+        194, 195, 360, 360, 82, 360, 81, 360,
+        401, 401, 360, 79, 194, 195, 360, 401,
+        401, 360, 79, 194, 195, 360, 407, 360,
+        401, 401, 360, 79, 194, 195, 360, 407,
+        360, 408, 401, 360, 79, 194, 195, 360,
+        360, 82, 360, 98, 360, 410, 410, 84,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        411, 107, 412, 413, 88, 79, 194, 195,
+        360, 360, 360, 365, 360, 107, 412, 413,
+        88, 79, 194, 195, 360, 360, 360, 365,
+        360, 412, 412, 88, 79, 194, 195, 360,
+        360, 360, 365, 360, 414, 104, 415, 416,
+        91, 79, 194, 195, 360, 360, 360, 365,
+        360, 104, 415, 416, 91, 79, 194, 195,
+        360, 360, 360, 365, 360, 415, 415, 91,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        417, 101, 418, 419, 94, 79, 194, 195,
+        360, 360, 360, 365, 360, 101, 418, 419,
+        94, 79, 194, 195, 360, 360, 360, 365,
+        360, 418, 418, 94, 79, 194, 195, 360,
+        360, 360, 365, 360, 420, 98, 401, 421,
+        360, 79, 194, 195, 360, 360, 360, 365,
+        360, 98, 401, 421, 360, 79, 194, 195,
+        360, 360, 360, 365, 360, 401, 422, 360,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        98, 360, 401, 401, 360, 79, 194, 195,
+        360, 360, 360, 365, 360, 80, 81, 360,
+        360, 98, 400, 360, 79, 194, 195, 360,
+        360, 360, 365, 360, 80, 360, 394, 399,
+        399, 84, 79, 194, 195, 360, 360, 360,
+        397, 360, 393, 394, 399, 399, 84, 79,
+        194, 195, 360, 360, 360, 397, 360, 360,
+        200, 360, 393, 394, 395, 399, 84, 79,
+        194, 195, 360, 360, 109, 397, 360, 360,
+        200, 360, 391, 360, 423, 360, 410, 410,
+        84, 79, 194, 195, 360, 360, 360, 365,
+        360, 391, 360, 391, 360, 360, 360, 401,
+        401, 360, 79, 194, 195, 360, 360, 360,
+        365, 360, 391, 360, 391, 360, 360, 360,
+        401, 424, 360, 79, 194, 195, 360, 360,
+        360, 365, 360, 391, 360, 391, 360, 423,
+        360, 401, 401, 360, 79, 194, 195, 360,
+        360, 360, 365, 360, 391, 360, 391, 81,
+        360, 360, 98, 392, 360, 79, 194, 195,
+        360, 360, 360, 365, 360, 391, 360, 384,
+        385, 390, 390, 84, 79, 194, 195, 360,
+        360, 360, 388, 360, 360, 200, 360, 384,
+        385, 386, 390, 84, 79, 194, 195, 360,
+        360, 111, 388, 360, 360, 200, 360, 382,
+        360, 425, 360, 410, 410, 84, 79, 194,
+        195, 360, 360, 360, 365, 360, 382, 360,
+        382, 360, 360, 360, 401, 401, 360, 79,
+        194, 195, 360, 360, 360, 365, 360, 382,
+        360, 382, 360, 360, 360, 401, 426, 360,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        382, 360, 382, 360, 425, 360, 401, 401,
+        360, 79, 194, 195, 360, 360, 360, 365,
+        360, 382, 360, 382, 81, 360, 360, 98,
+        383, 360, 79, 194, 195, 360, 360, 360,
+        365, 360, 382, 360, 375, 376, 381, 381,
+        84, 79, 194, 195, 360, 360, 360, 379,
+        360, 360, 200, 360, 375, 376, 377, 381,
+        84, 79, 194, 195, 360, 360, 113, 379,
+        360, 360, 200, 360, 373, 360, 427, 360,
+        410, 410, 84, 79, 194, 195, 360, 360,
+        360, 365, 360, 373, 360, 373, 360, 360,
+        360, 401, 401, 360, 79, 194, 195, 360,
+        360, 360, 365, 360, 373, 360, 373, 360,
+        360, 360, 401, 428, 360, 79, 194, 195,
+        360, 360, 360, 365, 360, 373, 360, 373,
+        360, 427, 360, 401, 401, 360, 79, 194,
+        195, 360, 360, 360, 365, 360, 373, 360,
+        373, 81, 360, 360, 98, 374, 360, 79,
+        194, 195, 360, 360, 360, 365, 360, 373,
+        360, 366, 367, 372, 372, 84, 79, 194,
+        195, 360, 360, 360, 370, 360, 360, 200,
+        360, 366, 367, 368, 372, 84, 79, 194,
+        195, 360, 360, 115, 370, 360, 360, 200,
+        360, 363, 360, 429, 360, 410, 410, 84,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        363, 360, 363, 360, 360, 360, 401, 401,
+        360, 79, 194, 195, 360, 360, 360, 365,
+        360, 363, 360, 363, 360, 360, 360, 401,
+        430, 360, 79, 194, 195, 360, 360, 360,
+        365, 360, 363, 360, 363, 360, 429, 360,
+        401, 401, 360, 79, 194, 195, 360, 360,
+        360, 365, 360, 363, 360, 363, 81, 360,
+        360, 98, 364, 360, 79, 194, 195, 360,
+        360, 360, 365, 360, 363, 360, 116, 83,
+        83, 84, 79, 431, 431, 431, 431, 156,
+        116, 431, 190, 191, 362, 362, 84, 79,
+        194, 195, 360, 360, 360, 197, 360, 360,
+        200, 360, 116, 83, 83, 84, 79, 431,
+        431, 431, 431, 431, 116, 431, 433, 434,
+        435, 436, 123, 118, 437, 438, 432, 432,
+        155, 439, 432, 432, 440, 432, 441, 434,
+        436, 436, 123, 118, 437, 438, 432, 432,
+        432, 439, 432, 432, 440, 432, 434, 436,
+        436, 123, 118, 437, 438, 432, 432, 432,
+        439, 432, 432, 440, 432, 442, 432, 432,
+        432, 136, 443, 432, 118, 437, 438, 432,
+        432, 432, 444, 432, 442, 432, 445, 446,
+        447, 448, 123, 118, 437, 438, 432, 432,
+        153, 449, 432, 432, 440, 432, 450, 446,
+        451, 451, 123, 118, 437, 438, 432, 432,
+        432, 449, 432, 432, 440, 432, 446, 451,
+        451, 123, 118, 437, 438, 432, 432, 432,
+        449, 432, 432, 440, 432, 452, 432, 432,
+        432, 136, 453, 432, 118, 437, 438, 432,
+        432, 432, 444, 432, 452, 432, 454, 455,
+        456, 457, 123, 118, 437, 438, 432, 432,
+        151, 458, 432, 432, 440, 432, 459, 455,
+        460, 460, 123, 118, 437, 438, 432, 432,
+        432, 458, 432, 432, 440, 432, 455, 460,
+        460, 123, 118, 437, 438, 432, 432, 432,
+        458, 432, 432, 440, 432, 461, 432, 432,
+        432, 136, 462, 432, 118, 437, 438, 432,
+        432, 432, 444, 432, 461, 432, 463, 464,
+        465, 466, 123, 118, 437, 438, 432, 432,
+        149, 467, 432, 432, 440, 432, 468, 464,
+        469, 469, 123, 118, 437, 438, 432, 432,
+        432, 467, 432, 432, 440, 432, 464, 469,
+        469, 123, 118, 437, 438, 432, 432, 432,
+        467, 432, 432, 440, 432, 470, 432, 432,
+        432, 136, 471, 432, 118, 437, 438, 432,
+        432, 432, 444, 432, 470, 432, 472, 473,
+        474, 475, 123, 118, 437, 438, 432, 432,
+        147, 476, 432, 432, 440, 432, 477, 473,
+        478, 478, 123, 118, 437, 438, 432, 432,
+        432, 476, 432, 432, 440, 432, 473, 478,
+        478, 123, 118, 437, 438, 432, 432, 432,
+        476, 432, 432, 440, 432, 136, 479, 432,
+        118, 437, 438, 432, 432, 432, 444, 432,
+        480, 480, 432, 118, 437, 438, 432, 432,
+        432, 444, 432, 481, 432, 432, 482, 437,
+        438, 432, 437, 438, 432, 483, 432, 437,
+        484, 432, 437, 485, 432, 437, 432, 481,
+        432, 432, 432, 437, 438, 432, 486, 432,
+        487, 488, 432, 118, 437, 438, 432, 432,
+        121, 432, 120, 432, 480, 480, 432, 118,
+        437, 438, 432, 480, 480, 432, 118, 437,
+        438, 432, 486, 432, 480, 480, 432, 118,
+        437, 438, 432, 486, 432, 487, 480, 432,
+        118, 437, 438, 432, 432, 121, 432, 136,
+        432, 489, 489, 123, 118, 437, 438, 432,
+        432, 432, 444, 432, 490, 145, 491, 492,
+        126, 118, 437, 438, 432, 432, 432, 444,
+        432, 145, 491, 492, 126, 118, 437, 438,
+        432, 432, 432, 444, 432, 491, 491, 126,
+        118, 437, 438, 432, 432, 432, 444, 432,
+        493, 142, 494, 495, 129, 118, 437, 438,
+        432, 432, 432, 444, 432, 142, 494, 495,
+        129, 118, 437, 438, 432, 432, 432, 444,
+        432, 494, 494, 129, 118, 437, 438, 432,
+        432, 432, 444, 432, 496, 139, 497, 498,
+        132, 118, 437, 438, 432, 432, 432, 444,
+        432, 139, 497, 498, 132, 118, 437, 438,
+        432, 432, 432, 444, 432, 497, 497, 132,
+        118, 437, 438, 432, 432, 432, 444, 432,
+        499, 136, 480, 500, 432, 118, 437, 438,
+        432, 432, 432, 444, 432, 136, 480, 500,
+        432, 118, 437, 438, 432, 432, 432, 444,
+        432, 480, 501, 432, 118, 437, 438, 432,
+        432, 432, 444, 432, 136, 432, 480, 480,
+        432, 118, 437, 438, 432, 432, 432, 444,
+        432, 119, 120, 432, 432, 136, 479, 432,
+        118, 437, 438, 432, 432, 432, 444, 432,
+        119, 432, 473, 478, 478, 123, 118, 437,
+        438, 432, 432, 432, 476, 432, 472, 473,
+        478, 478, 123, 118, 437, 438, 432, 432,
+        432, 476, 432, 432, 440, 432, 472, 473,
+        474, 478, 123, 118, 437, 438, 432, 432,
+        147, 476, 432, 432, 440, 432, 470, 432,
+        502, 432, 489, 489, 123, 118, 437, 438,
+        432, 432, 432, 444, 432, 470, 432, 470,
+        432, 432, 432, 480, 480, 432, 118, 437,
+        438, 432, 432, 432, 444, 432, 470, 432,
+        470, 432, 432, 432, 480, 503, 432, 118,
+        437, 438, 432, 432, 432, 444, 432, 470,
+        432, 470, 432, 502, 432, 480, 480, 432,
+        118, 437, 438, 432, 432, 432, 444, 432,
+        470, 432, 470, 120, 432, 432, 136, 471,
+        432, 118, 437, 438, 432, 432, 432, 444,
+        432, 470, 432, 463, 464, 469, 469, 123,
+        118, 437, 438, 432, 432, 432, 467, 432,
+        432, 440, 432, 463, 464, 465, 469, 123,
+        118, 437, 438, 432, 432, 149, 467, 432,
+        432, 440, 432, 461, 432, 504, 432, 489,
+        489, 123, 118, 437, 438, 432, 432, 432,
+        444, 432, 461, 432, 461, 432, 432, 432,
+        480, 480, 432, 118, 437, 438, 432, 432,
+        432, 444, 432, 461, 432, 461, 432, 432,
+        432, 480, 505, 432, 118, 437, 438, 432,
+        432, 432, 444, 432, 461, 432, 461, 432,
+        504, 432, 480, 480, 432, 118, 437, 438,
+        432, 432, 432, 444, 432, 461, 432, 461,
+        120, 432, 432, 136, 462, 432, 118, 437,
+        438, 432, 432, 432, 444, 432, 461, 432,
+        454, 455, 460, 460, 123, 118, 437, 438,
+        432, 432, 432, 458, 432, 432, 440, 432,
+        454, 455, 456, 460, 123, 118, 437, 438,
+        432, 432, 151, 458, 432, 432, 440, 432,
+        452, 432, 506, 432, 489, 489, 123, 118,
+        437, 438, 432, 432, 432, 444, 432, 452,
+        432, 452, 432, 432, 432, 480, 480, 432,
+        118, 437, 438, 432, 432, 432, 444, 432,
+        452, 432, 452, 432, 432, 432, 480, 507,
+        432, 118, 437, 438, 432, 432, 432, 444,
+        432, 452, 432, 452, 432, 506, 432, 480,
+        480, 432, 118, 437, 438, 432, 432, 432,
+        444, 432, 452, 432, 452, 120, 432, 432,
+        136, 453, 432, 118, 437, 438, 432, 432,
+        432, 444, 432, 452, 432, 445, 446, 451,
+        451, 123, 118, 437, 438, 432, 432, 432,
+        449, 432, 432, 440, 432, 445, 446, 447,
+        451, 123, 118, 437, 438, 432, 432, 153,
+        449, 432, 432, 440, 432, 442, 432, 508,
+        432, 489, 489, 123, 118, 437, 438, 432,
+        432, 432, 444, 432, 442, 432, 442, 432,
+        432, 432, 480, 480, 432, 118, 437, 438,
+        432, 432, 432, 444, 432, 442, 432, 442,
+        432, 432, 432, 480, 509, 432, 118, 437,
+        438, 432, 432, 432, 444, 432, 442, 432,
+        442, 432, 508, 432, 480, 480, 432, 118,
+        437, 438, 432, 432, 432, 444, 432, 442,
+        432, 442, 120, 432, 432, 136, 443, 432,
+        118, 437, 438, 432, 432, 432, 444, 432,
+        442, 432, 433, 434, 436, 436, 123, 118,
+        437, 438, 432, 432, 432, 439, 432, 432,
+        440, 432, 188, 189, 190, 191, 510, 362,
+        84, 79, 194, 195, 196, 196, 156, 197,
+        360, 188, 200, 360, 203, 511, 205, 206,
+        6, 1, 207, 208, 202, 202, 38, 209,
+        202, 202, 210, 202, 213, 189, 190, 191,
+        512, 513, 84, 157, 514, 515, 202, 196,
+        156, 516, 202, 213, 200, 202, 116, 517,
+        517, 84, 157, 207, 208, 202, 202, 156,
+        518, 202, 519, 202, 202, 520, 514, 515,
+        202, 514, 515, 202, 254, 202, 514, 521,
+        202, 514, 522, 202, 514, 202, 519, 202,
+        202, 202, 514, 515, 202, 523, 3, 360,
+        360, 401, 430, 360, 79, 194, 195, 360,
+        360, 360, 365, 360, 523, 360, 524, 367,
+        525, 526, 84, 157, 514, 515, 202, 202,
+        158, 370, 202, 202, 200, 202, 527, 367,
+        528, 528, 84, 157, 514, 515, 202, 202,
+        202, 370, 202, 202, 200, 202, 367, 528,
+        528, 84, 157, 514, 515, 202, 202, 202,
+        370, 202, 202, 200, 202, 524, 367, 528,
+        528, 84, 157, 514, 515, 202, 202, 202,
+        370, 202, 202, 200, 202, 524, 367, 525,
+        528, 84, 157, 514, 515, 202, 202, 158,
+        370, 202, 202, 200, 202, 213, 202, 279,
+        116, 529, 529, 160, 157, 207, 208, 202,
+        202, 202, 518, 202, 213, 202, 530, 184,
+        531, 532, 162, 157, 514, 515, 202, 202,
+        202, 533, 202, 184, 531, 532, 162, 157,
+        514, 515, 202, 202, 202, 533, 202, 531,
+        531, 162, 157, 514, 515, 202, 202, 202,
+        533, 202, 534, 181, 535, 536, 165, 157,
+        514, 515, 202, 202, 202, 533, 202, 181,
+        535, 536, 165, 157, 514, 515, 202, 202,
+        202, 533, 202, 535, 535, 165, 157, 514,
+        515, 202, 202, 202, 533, 202, 537, 178,
+        538, 539, 168, 157, 514, 515, 202, 202,
+        202, 533, 202, 178, 538, 539, 168, 157,
+        514, 515, 202, 202, 202, 533, 202, 538,
+        538, 168, 157, 514, 515, 202, 202, 202,
+        533, 202, 540, 175, 541, 542, 202, 157,
+        514, 515, 202, 202, 202, 533, 202, 175,
+        541, 542, 202, 157, 514, 515, 202, 202,
+        202, 533, 202, 541, 541, 202, 157, 514,
+        515, 202, 202, 202, 533, 202, 543, 202,
+        544, 545, 202, 157, 514, 515, 202, 202,
+        172, 202, 171, 202, 541, 541, 202, 157,
+        514, 515, 202, 541, 541, 202, 157, 514,
+        515, 202, 543, 202, 541, 541, 202, 157,
+        514, 515, 202, 543, 202, 544, 541, 202,
+        157, 514, 515, 202, 202, 172, 202, 523,
+        171, 360, 360, 98, 364, 360, 79, 194,
+        195, 360, 360, 360, 365, 360, 523, 360,
+        547, 546, 548, 548, 546, 186, 549, 550,
+        546, 548, 548, 546, 186, 549, 550, 546,
+        551, 546, 546, 552, 549, 550, 546, 549,
+        550, 546, 553, 546, 549, 554, 546, 549,
+        555, 546, 549, 546, 551, 546, 546, 546,
+        549, 550, 546, 0
 };
 
 static const short _indic_syllable_machine_trans_targs[] = {
         178, 200, 207, 209, 210, 4, 213, 5,
         7, 216, 8, 10, 219, 11, 13, 222,
         14, 16, 17, 199, 19, 20, 221, 22,
-        23, 218, 25, 26, 215, 224, 229, 233,
-        236, 240, 243, 247, 250, 254, 257, 178,
-        280, 287, 289, 290, 41, 293, 42, 44,
-        296, 45, 47, 299, 48, 50, 302, 51,
-        53, 54, 279, 56, 57, 301, 59, 60,
-        298, 62, 63, 295, 304, 309, 313, 316,
-        320, 323, 327, 330, 334, 338, 178, 359,
-        366, 368, 369, 78, 372, 178, 79, 81,
-        375, 82, 84, 378, 85, 87, 381, 88,
-        90, 91, 358, 93, 94, 380, 96, 97,
-        377, 99, 100, 374, 383, 388, 392, 395,
-        399, 402, 406, 409, 413, 178, 440, 447,
-        449, 450, 114, 453, 115, 117, 456, 118,
-        120, 459, 121, 123, 462, 124, 126, 127,
-        439, 129, 130, 461, 132, 133, 458, 135,
-        136, 455, 464, 469, 473, 476, 480, 483,
-        487, 490, 494, 497, 417, 502, 513, 152,
-        516, 154, 519, 155, 157, 522, 158, 160,
-        525, 161, 528, 530, 531, 166, 167, 527,
-        169, 170, 524, 172, 173, 521, 175, 176,
-        518, 178, 536, 178, 179, 259, 339, 341,
-        416, 418, 361, 362, 419, 415, 498, 499,
-        386, 534, 387, 178, 180, 182, 36, 258,
-        202, 203, 256, 227, 228, 181, 35, 183,
-        252, 1, 184, 186, 34, 251, 249, 185,
-        33, 187, 245, 188, 190, 32, 244, 242,
-        189, 31, 191, 238, 192, 194, 30, 237,
-        235, 193, 29, 195, 231, 196, 198, 28,
-        230, 226, 197, 27, 212, 0, 201, 206,
-        178, 204, 205, 208, 2, 211, 3, 214,
-        6, 24, 217, 9, 21, 220, 12, 18,
-        223, 15, 225, 232, 234, 239, 241, 246,
-        248, 253, 255, 178, 260, 262, 73, 336,
-        282, 283, 337, 307, 308, 261, 72, 263,
-        332, 38, 264, 266, 71, 331, 329, 265,
-        70, 267, 325, 268, 270, 69, 324, 322,
-        269, 68, 271, 318, 272, 274, 67, 317,
-        315, 273, 66, 275, 311, 276, 278, 65,
-        310, 306, 277, 64, 292, 37, 281, 286,
-        178, 284, 285, 288, 39, 291, 40, 294,
-        43, 61, 297, 46, 58, 300, 49, 55,
-        303, 52, 305, 312, 314, 319, 321, 326,
-        328, 333, 335, 178, 340, 109, 342, 411,
-        75, 343, 345, 108, 410, 408, 344, 107,
-        346, 404, 347, 349, 106, 403, 401, 348,
-        105, 350, 397, 351, 353, 104, 396, 394,
-        352, 103, 354, 390, 355, 357, 102, 389,
-        385, 356, 101, 371, 74, 360, 365, 178,
-        363, 364, 367, 76, 370, 77, 373, 80,
-        98, 376, 83, 95, 379, 86, 92, 382,
-        89, 384, 391, 393, 398, 400, 405, 407,
-        412, 414, 178, 178, 420, 422, 146, 145,
-        442, 443, 496, 467, 468, 421, 423, 492,
-        111, 424, 426, 144, 491, 489, 425, 143,
-        427, 485, 428, 430, 142, 484, 482, 429,
-        141, 431, 478, 432, 434, 140, 477, 475,
-        433, 139, 435, 471, 436, 438, 138, 470,
-        466, 437, 137, 452, 110, 441, 446, 178,
-        444, 445, 448, 112, 451, 113, 454, 116,
-        134, 457, 119, 131, 460, 122, 128, 463,
-        125, 465, 472, 474, 479, 481, 486, 488,
-        493, 495, 147, 500, 501, 515, 504, 505,
-        533, 148, 509, 503, 508, 506, 507, 510,
-        511, 150, 514, 512, 149, 151, 517, 153,
-        174, 163, 520, 156, 171, 523, 159, 168,
-        526, 162, 165, 529, 164, 532, 178, 535,
-        177, 538, 539, 537, 542, 178, 540, 541
+        23, 218, 25, 26, 215, 224, 228, 232,
+        235, 239, 242, 246, 249, 253, 256, 178,
+        279, 286, 288, 289, 41, 292, 42, 44,
+        295, 45, 47, 298, 48, 50, 301, 51,
+        53, 54, 278, 56, 57, 300, 59, 60,
+        297, 62, 63, 294, 303, 307, 311, 314,
+        318, 321, 325, 328, 332, 336, 178, 357,
+        364, 366, 367, 78, 370, 178, 79, 81,
+        373, 82, 84, 376, 85, 87, 379, 88,
+        90, 91, 356, 93, 94, 378, 96, 97,
+        375, 99, 100, 372, 381, 385, 389, 392,
+        396, 399, 403, 406, 410, 178, 437, 444,
+        446, 447, 114, 450, 115, 117, 453, 118,
+        120, 456, 121, 123, 459, 124, 126, 127,
+        436, 129, 130, 458, 132, 133, 455, 135,
+        136, 452, 461, 465, 469, 472, 476, 479,
+        483, 486, 490, 493, 414, 498, 509, 152,
+        512, 154, 515, 155, 157, 518, 158, 160,
+        521, 161, 524, 526, 527, 166, 167, 523,
+        169, 170, 520, 172, 173, 517, 175, 176,
+        514, 178, 532, 178, 179, 258, 337, 339,
+        413, 415, 359, 360, 416, 412, 494, 495,
+        384, 530, 178, 180, 182, 36, 257, 202,
+        203, 255, 227, 181, 35, 183, 251, 1,
+        184, 186, 34, 250, 248, 185, 33, 187,
+        244, 188, 190, 32, 243, 241, 189, 31,
+        191, 237, 192, 194, 30, 236, 234, 193,
+        29, 195, 230, 196, 198, 28, 229, 226,
+        197, 27, 212, 0, 201, 206, 178, 204,
+        205, 208, 2, 211, 3, 214, 6, 24,
+        217, 9, 21, 220, 12, 18, 223, 15,
+        225, 231, 233, 238, 240, 245, 247, 252,
+        254, 178, 259, 261, 73, 334, 281, 282,
+        335, 306, 260, 72, 262, 330, 38, 263,
+        265, 71, 329, 327, 264, 70, 266, 323,
+        267, 269, 69, 322, 320, 268, 68, 270,
+        316, 271, 273, 67, 315, 313, 272, 66,
+        274, 309, 275, 277, 65, 308, 305, 276,
+        64, 291, 37, 280, 285, 178, 283, 284,
+        287, 39, 290, 40, 293, 43, 61, 296,
+        46, 58, 299, 49, 55, 302, 52, 304,
+        310, 312, 317, 319, 324, 326, 331, 333,
+        178, 338, 109, 340, 408, 75, 341, 343,
+        108, 407, 405, 342, 107, 344, 401, 345,
+        347, 106, 400, 398, 346, 105, 348, 394,
+        349, 351, 104, 393, 391, 350, 103, 352,
+        387, 353, 355, 102, 386, 383, 354, 101,
+        369, 74, 358, 363, 178, 361, 362, 365,
+        76, 368, 77, 371, 80, 98, 374, 83,
+        95, 377, 86, 92, 380, 89, 382, 388,
+        390, 395, 397, 402, 404, 409, 411, 178,
+        178, 417, 419, 146, 145, 439, 440, 492,
+        464, 418, 420, 488, 111, 421, 423, 144,
+        487, 485, 422, 143, 424, 481, 425, 427,
+        142, 480, 478, 426, 141, 428, 474, 429,
+        431, 140, 473, 471, 430, 139, 432, 467,
+        433, 435, 138, 466, 463, 434, 137, 449,
+        110, 438, 443, 178, 441, 442, 445, 112,
+        448, 113, 451, 116, 134, 454, 119, 131,
+        457, 122, 128, 460, 125, 462, 468, 470,
+        475, 477, 482, 484, 489, 491, 147, 496,
+        497, 511, 500, 501, 529, 148, 505, 499,
+        504, 502, 503, 506, 507, 150, 510, 508,
+        149, 151, 513, 153, 174, 163, 516, 156,
+        171, 519, 159, 168, 522, 162, 165, 525,
+        164, 528, 178, 531, 177, 534, 535, 533,
+        538, 178, 536, 537
 };
 
 static const char _indic_syllable_machine_trans_actions[] = {
@@ -1285,51 +1087,51 @@
         0, 0, 2, 0, 0, 2, 0, 0,
         2, 9, 0, 12, 2, 2, 6, 2,
         13, 13, 0, 0, 2, 2, 6, 2,
-        6, 2, 6, 14, 2, 2, 0, 2,
-        0, 0, 2, 2, 2, 2, 0, 2,
-        2, 0, 2, 2, 0, 2, 2, 2,
-        0, 2, 2, 2, 2, 0, 2, 2,
-        2, 0, 2, 2, 2, 2, 0, 2,
-        2, 2, 0, 2, 2, 2, 2, 0,
-        2, 2, 2, 0, 2, 0, 0, 0,
-        15, 0, 0, 2, 0, 2, 0, 2,
-        0, 0, 2, 0, 0, 2, 0, 0,
-        2, 0, 2, 2, 2, 2, 2, 2,
-        2, 2, 2, 16, 2, 2, 0, 2,
-        0, 0, 2, 2, 2, 2, 0, 2,
-        2, 0, 2, 2, 0, 2, 2, 2,
-        0, 2, 2, 2, 2, 0, 2, 2,
-        2, 0, 2, 2, 2, 2, 0, 2,
-        2, 2, 0, 2, 2, 2, 2, 0,
-        2, 2, 2, 0, 2, 0, 0, 0,
-        17, 0, 0, 2, 0, 2, 0, 2,
-        0, 0, 2, 0, 0, 2, 0, 0,
-        2, 0, 2, 2, 2, 2, 2, 2,
-        2, 2, 2, 18, 6, 0, 6, 6,
-        0, 6, 2, 0, 6, 2, 6, 0,
-        6, 6, 6, 2, 0, 6, 2, 6,
-        0, 6, 6, 6, 2, 0, 6, 2,
-        6, 0, 6, 6, 6, 2, 0, 6,
-        2, 6, 0, 6, 0, 0, 0, 19,
-        0, 0, 2, 0, 2, 0, 2, 0,
-        0, 2, 0, 0, 2, 0, 0, 2,
-        0, 2, 2, 2, 2, 2, 2, 2,
-        2, 2, 20, 21, 2, 2, 0, 0,
-        0, 0, 2, 2, 2, 2, 2, 2,
-        0, 2, 2, 0, 2, 2, 2, 0,
+        6, 2, 14, 2, 2, 0, 2, 0,
+        0, 2, 2, 2, 0, 2, 2, 0,
+        2, 2, 0, 2, 2, 2, 0, 2,
+        2, 2, 2, 0, 2, 2, 2, 0,
         2, 2, 2, 2, 0, 2, 2, 2,
         0, 2, 2, 2, 2, 0, 2, 2,
-        2, 0, 2, 2, 2, 2, 0, 2,
-        2, 2, 0, 2, 0, 0, 0, 22,
-        0, 0, 2, 0, 2, 0, 2, 0,
+        2, 0, 2, 0, 0, 0, 15, 0,
+        0, 2, 0, 2, 0, 2, 0, 0,
+        2, 0, 0, 2, 0, 0, 2, 0,
+        2, 2, 2, 2, 2, 2, 2, 2,
+        2, 16, 2, 2, 0, 2, 0, 0,
+        2, 2, 2, 0, 2, 2, 0, 2,
+        2, 0, 2, 2, 2, 0, 2, 2,
+        2, 2, 0, 2, 2, 2, 0, 2,
+        2, 2, 2, 0, 2, 2, 2, 0,
+        2, 2, 2, 2, 0, 2, 2, 2,
+        0, 2, 0, 0, 0, 17, 0, 0,
+        2, 0, 2, 0, 2, 0, 0, 2,
+        0, 0, 2, 0, 0, 2, 0, 2,
+        2, 2, 2, 2, 2, 2, 2, 2,
+        18, 6, 0, 6, 6, 0, 6, 2,
+        0, 6, 2, 6, 0, 6, 6, 6,
+        2, 0, 6, 2, 6, 0, 6, 6,
+        6, 2, 0, 6, 2, 6, 0, 6,
+        6, 6, 2, 0, 6, 2, 6, 0,
+        6, 0, 0, 0, 19, 0, 0, 2,
+        0, 2, 0, 2, 0, 0, 2, 0,
+        0, 2, 0, 0, 2, 0, 2, 2,
+        2, 2, 2, 2, 2, 2, 2, 20,
+        21, 2, 2, 0, 0, 0, 0, 2,
+        2, 2, 2, 2, 0, 2, 2, 0,
+        2, 2, 2, 0, 2, 2, 2, 2,
+        0, 2, 2, 2, 0, 2, 2, 2,
+        2, 0, 2, 2, 2, 0, 2, 2,
+        2, 2, 0, 2, 2, 2, 0, 2,
+        0, 0, 0, 22, 0, 0, 2, 0,
+        2, 0, 2, 0, 0, 2, 0, 0,
+        2, 0, 0, 2, 0, 2, 2, 2,
+        2, 2, 2, 2, 2, 2, 0, 0,
+        8, 2, 0, 0, 2, 0, 2, 0,
+        0, 0, 0, 8, 8, 0, 8, 8,
+        0, 0, 2, 0, 0, 0, 2, 0,
         0, 2, 0, 0, 2, 0, 0, 2,
-        0, 2, 2, 2, 2, 2, 2, 2,
-        2, 2, 0, 0, 8, 2, 0, 0,
-        2, 0, 2, 0, 0, 0, 0, 8,
-        8, 0, 8, 8, 0, 0, 2, 0,
-        0, 0, 2, 0, 0, 2, 0, 0,
-        2, 0, 0, 2, 0, 2, 23, 2,
-        0, 0, 0, 0, 0, 24, 0, 0
+        0, 2, 23, 2, 0, 0, 0, 0,
+        0, 24, 0, 0
 };
 
 static const char _indic_syllable_machine_to_state_actions[] = {
@@ -1400,7 +1202,7 @@
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0
 };
 
 static const char _indic_syllable_machine_from_state_actions[] = {
@@ -1471,7 +1273,7 @@
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0
 };
 
 static const short _indic_syllable_machine_eof_trans[] = {
@@ -1497,52 +1299,52 @@
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 186, 0, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        435, 364, 435, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 364, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 364, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 364, 551, 551,
-        551, 551, 551, 551, 551, 551, 551
+        1, 186, 0, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 432, 361, 432,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 361, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 361, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 361, 547, 547, 547, 547, 547, 547,
+        547, 547, 547
 };
 
 static const int indic_syllable_machine_start = 178;
@@ -1556,7 +1358,7 @@
 
 
 
-#line 97 "hb-ot-shape-complex-indic-machine.rl"
+#line 96 "hb-ot-shape-complex-indic-machine.rl"
 
 
 #define found_syllable(syllable_type) \
@@ -1576,7 +1378,7 @@
   int cs;
   hb_glyph_info_t *info = buffer->info;
 
-#line 1580 "hb-ot-shape-complex-indic-machine.hh"
+#line 1382 "hb-ot-shape-complex-indic-machine.hh"
         {
         cs = indic_syllable_machine_start;
         ts = 0;
@@ -1584,7 +1386,7 @@
         act = 0;
         }
 
-#line 118 "hb-ot-shape-complex-indic-machine.rl"
+#line 117 "hb-ot-shape-complex-indic-machine.rl"
 
 
   p = 0;
@@ -1593,7 +1395,7 @@
   unsigned int last = 0;
   unsigned int syllable_serial = 1;
 
-#line 1597 "hb-ot-shape-complex-indic-machine.hh"
+#line 1399 "hb-ot-shape-complex-indic-machine.hh"
         {
         int _slen;
         int _trans;
@@ -1607,7 +1409,7 @@
 #line 1 "NONE"
         {ts = p;}
         break;
-#line 1611 "hb-ot-shape-complex-indic-machine.hh"
+#line 1413 "hb-ot-shape-complex-indic-machine.hh"
         }
 
         _keys = _indic_syllable_machine_trans_keys + (cs<<1);
@@ -1630,71 +1432,71 @@
         {te = p+1;}
         break;
         case 15:
-#line 88 "hb-ot-shape-complex-indic-machine.rl"
+#line 87 "hb-ot-shape-complex-indic-machine.rl"
         {te = p+1;{ found_syllable (consonant_syllable); }}
         break;
         case 17:
-#line 89 "hb-ot-shape-complex-indic-machine.rl"
+#line 88 "hb-ot-shape-complex-indic-machine.rl"
         {te = p+1;{ found_syllable (vowel_syllable); }}
         break;
         case 22:
-#line 90 "hb-ot-shape-complex-indic-machine.rl"
+#line 89 "hb-ot-shape-complex-indic-machine.rl"
         {te = p+1;{ found_syllable (standalone_cluster); }}
         break;
         case 24:
-#line 91 "hb-ot-shape-complex-indic-machine.rl"
+#line 90 "hb-ot-shape-complex-indic-machine.rl"
         {te = p+1;{ found_syllable (symbol_cluster); }}
         break;
         case 19:
-#line 92 "hb-ot-shape-complex-indic-machine.rl"
+#line 91 "hb-ot-shape-complex-indic-machine.rl"
         {te = p+1;{ found_syllable (broken_cluster); }}
         break;
         case 12:
-#line 93 "hb-ot-shape-complex-indic-machine.rl"
+#line 92 "hb-ot-shape-complex-indic-machine.rl"
         {te = p+1;{ found_syllable (non_indic_cluster); }}
         break;
         case 14:
-#line 88 "hb-ot-shape-complex-indic-machine.rl"
+#line 87 "hb-ot-shape-complex-indic-machine.rl"
         {te = p;p--;{ found_syllable (consonant_syllable); }}
         break;
         case 16:
-#line 89 "hb-ot-shape-complex-indic-machine.rl"
+#line 88 "hb-ot-shape-complex-indic-machine.rl"
         {te = p;p--;{ found_syllable (vowel_syllable); }}
         break;
         case 21:
-#line 90 "hb-ot-shape-complex-indic-machine.rl"
+#line 89 "hb-ot-shape-complex-indic-machine.rl"
         {te = p;p--;{ found_syllable (standalone_cluster); }}
         break;
         case 23:
-#line 91 "hb-ot-shape-complex-indic-machine.rl"
+#line 90 "hb-ot-shape-complex-indic-machine.rl"
         {te = p;p--;{ found_syllable (symbol_cluster); }}
         break;
         case 18:
-#line 92 "hb-ot-shape-complex-indic-machine.rl"
+#line 91 "hb-ot-shape-complex-indic-machine.rl"
         {te = p;p--;{ found_syllable (broken_cluster); }}
         break;
         case 20:
-#line 93 "hb-ot-shape-complex-indic-machine.rl"
+#line 92 "hb-ot-shape-complex-indic-machine.rl"
         {te = p;p--;{ found_syllable (non_indic_cluster); }}
         break;
         case 1:
-#line 88 "hb-ot-shape-complex-indic-machine.rl"
+#line 87 "hb-ot-shape-complex-indic-machine.rl"
         {{p = ((te))-1;}{ found_syllable (consonant_syllable); }}
         break;
         case 3:
-#line 89 "hb-ot-shape-complex-indic-machine.rl"
+#line 88 "hb-ot-shape-complex-indic-machine.rl"
         {{p = ((te))-1;}{ found_syllable (vowel_syllable); }}
         break;
         case 7:
-#line 90 "hb-ot-shape-complex-indic-machine.rl"
+#line 89 "hb-ot-shape-complex-indic-machine.rl"
         {{p = ((te))-1;}{ found_syllable (standalone_cluster); }}
         break;
         case 9:
-#line 91 "hb-ot-shape-complex-indic-machine.rl"
+#line 90 "hb-ot-shape-complex-indic-machine.rl"
         {{p = ((te))-1;}{ found_syllable (symbol_cluster); }}
         break;
         case 4:
-#line 92 "hb-ot-shape-complex-indic-machine.rl"
+#line 91 "hb-ot-shape-complex-indic-machine.rl"
         {{p = ((te))-1;}{ found_syllable (broken_cluster); }}
         break;
         case 5:
@@ -1715,22 +1517,22 @@
         case 8:
 #line 1 "NONE"
         {te = p+1;}
-#line 88 "hb-ot-shape-complex-indic-machine.rl"
+#line 87 "hb-ot-shape-complex-indic-machine.rl"
         {act = 1;}
         break;
         case 6:
 #line 1 "NONE"
         {te = p+1;}
-#line 92 "hb-ot-shape-complex-indic-machine.rl"
+#line 91 "hb-ot-shape-complex-indic-machine.rl"
         {act = 5;}
         break;
         case 13:
 #line 1 "NONE"
         {te = p+1;}
-#line 93 "hb-ot-shape-complex-indic-machine.rl"
+#line 92 "hb-ot-shape-complex-indic-machine.rl"
         {act = 6;}
         break;
-#line 1734 "hb-ot-shape-complex-indic-machine.hh"
+#line 1536 "hb-ot-shape-complex-indic-machine.hh"
         }
 
 _again:
@@ -1739,7 +1541,7 @@
 #line 1 "NONE"
         {ts = 0;}
         break;
-#line 1743 "hb-ot-shape-complex-indic-machine.hh"
+#line 1545 "hb-ot-shape-complex-indic-machine.hh"
         }
 
         if ( ++p != pe )
@@ -1755,7 +1557,7 @@
 
         }
 
-#line 127 "hb-ot-shape-complex-indic-machine.rl"
+#line 126 "hb-ot-shape-complex-indic-machine.rl"
 
 }
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-private.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-private.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -60,11 +60,10 @@
   OT_Repha = 15, /* Atomically-encoded logical or visual repha. */
   OT_Ra = 16,
   OT_CM = 17,  /* Consonant-Medial. */
-  OT_Symbol = 18, /* Avagraha, etc that take marks (SM,A,VD). */
-  OT_CM2 = 31 /* Consonant-Medial, second slot. */
+  OT_Symbol = 18 /* Avagraha, etc that take marks (SM,A,VD). */
 };
 
-#define MEDIAL_FLAGS (FLAG (OT_CM) | FLAG (OT_CM2))
+#define MEDIAL_FLAGS (FLAG (OT_CM))
 
 /* Note:
  *
@@ -109,27 +108,31 @@
 
   INDIC_SYLLABIC_CATEGORY_AVAGRAHA                      = OT_Symbol,
   INDIC_SYLLABIC_CATEGORY_BINDU                         = OT_SM,
-  INDIC_SYLLABIC_CATEGORY_BRAHMI_JOINING_NUMBER         = OT_PLACEHOLDER, /* TODO */
+  INDIC_SYLLABIC_CATEGORY_BRAHMI_JOINING_NUMBER         = OT_PLACEHOLDER, /* Don't care. */
   INDIC_SYLLABIC_CATEGORY_CANTILLATION_MARK             = OT_A,
   INDIC_SYLLABIC_CATEGORY_CONSONANT                     = OT_C,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD                = OT_C,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL               = OT_CM,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_HEAD_LETTER         = OT_C,
+  INDIC_SYLLABIC_CATEGORY_CONSONANT_KILLER              = OT_M, /* U+17CD only. */
   INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL              = OT_CM,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER         = OT_PLACEHOLDER,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_PRECEDING_REPHA     = OT_Repha,
+  INDIC_SYLLABIC_CATEGORY_CONSONANT_PREFIXED            = OT_X, /* Don't care. */
   INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED           = OT_CM,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA    = OT_N,
+  INDIC_SYLLABIC_CATEGORY_CONSONANT_WITH_STACKER        = OT_Repha, /* TODO */
   INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK               = OT_SM,
-  INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER             = OT_H, /* TODO */
+  INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER             = OT_Coeng,
   INDIC_SYLLABIC_CATEGORY_JOINER                        = OT_ZWJ,
   INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER              = OT_X,
   INDIC_SYLLABIC_CATEGORY_NON_JOINER                    = OT_ZWNJ,
   INDIC_SYLLABIC_CATEGORY_NUKTA                         = OT_N,
   INDIC_SYLLABIC_CATEGORY_NUMBER                        = OT_PLACEHOLDER,
-  INDIC_SYLLABIC_CATEGORY_NUMBER_JOINER                 = OT_PLACEHOLDER, /* TODO */
-  INDIC_SYLLABIC_CATEGORY_PURE_KILLER                   = OT_H, /* TODO */
+  INDIC_SYLLABIC_CATEGORY_NUMBER_JOINER                 = OT_PLACEHOLDER, /* Don't care. */
+  INDIC_SYLLABIC_CATEGORY_PURE_KILLER                   = OT_M, /* Is like a vowel matra. */
   INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER              = OT_RS,
+  INDIC_SYLLABIC_CATEGORY_SYLLABLE_MODIFIER             = OT_M, /* Misc Khmer signs. */
   INDIC_SYLLABIC_CATEGORY_TONE_LETTER                   = OT_X,
   INDIC_SYLLABIC_CATEGORY_TONE_MARK                     = OT_N,
   INDIC_SYLLABIC_CATEGORY_VIRAMA                        = OT_H,
@@ -162,17 +165,23 @@
 };
 
 #define INDIC_COMBINE_CATEGORIES(S,M) \
-  (ASSERT_STATIC_EXPR_ZERO (M == INDIC_MATRA_CATEGORY_NOT_APPLICABLE || \
-                            ( \
-                             S == INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL || \
-                             S == INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK || \
-                             S == INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER || \
-                             S == INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA || \
-                             S == INDIC_SYLLABIC_CATEGORY_VIRAMA || \
-                             S == INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT || \
-                             false)) + \
-   ASSERT_STATIC_EXPR_ZERO (S < 255 && M < 255) + \
-   ((M << 8) | S))
+  ( \
+    ASSERT_STATIC_EXPR_ZERO (S < 255 && M < 255) + \
+    ( S | \
+     ( \
+      ( \
+       S == INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL || \
+       S == INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK || \
+       S == INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER || \
+       S == INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA || \
+       S == INDIC_SYLLABIC_CATEGORY_VIRAMA || \
+       S == INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT || \
+       false \
+       ? M : INDIC_MATRA_CATEGORY_NOT_APPLICABLE \
+      ) << 8 \
+     ) \
+    ) \
+   )
 
 HB_INTERNAL INDIC_TABLE_ELEMENT_TYPE
 hb_indic_get_categories (hb_codepoint_t u);
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-table.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-table.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -2,67 +2,71 @@
 /*
  * The following table is generated by running:
  *
- *   ./gen-indic-table.py IndicSyllabicCategory.txt IndicMatraCategory.txt Blocks.txt
+ *   ./gen-indic-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt Blocks.txt
  *
  * on files with these headers:
  *
- * # IndicSyllabicCategory-7.0.0.txt
- * # Date: 2014-06-03, 07:00:00 GMT [KW, LI, AG, RP]
- * # IndicMatraCategory-7.0.0.txt
- * # Date: 2014-06-03, 07:00:00 GMT [KW, LI, AG, RP]
- * # Blocks-7.0.0.txt
- * # Date: 2014-04-03, 23:23:00 GMT [RP, KW]
+ * # IndicSyllabicCategory-9.0.0.txt
+ * # Date: 2016-05-21, 02:46:00 GMT [RP]
+ * # IndicPositionalCategory-9.0.0.txt
+ * # Date: 2016-02-25, 00:48:00 GMT [RP]
+ * # Blocks-9.0.0.txt
+ * # Date: 2016-02-05, 23:48:00 GMT [KW]
  */
 
 #include "hb-ot-shape-complex-indic-private.hh"
 
 
-#define ISC_A   INDIC_SYLLABIC_CATEGORY_AVAGRAHA                /*  13 chars; Avagraha */
-#define ISC_Bi  INDIC_SYLLABIC_CATEGORY_BINDU                   /*  59 chars; Bindu */
+#define ISC_A   INDIC_SYLLABIC_CATEGORY_AVAGRAHA                /*  15 chars; Avagraha */
+#define ISC_Bi  INDIC_SYLLABIC_CATEGORY_BINDU                   /*  67 chars; Bindu */
 #define ISC_BJN INDIC_SYLLABIC_CATEGORY_BRAHMI_JOINING_NUMBER   /*  20 chars; Brahmi_Joining_Number */
-#define ISC_Ca  INDIC_SYLLABIC_CATEGORY_CANTILLATION_MARK       /*  30 chars; Cantillation_Mark */
-#define ISC_C   INDIC_SYLLABIC_CATEGORY_CONSONANT               /* 1744 chars; Consonant */
-#define ISC_CD  INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD          /*   7 chars; Consonant_Dead */
-#define ISC_CF  INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL         /*  61 chars; Consonant_Final */
+#define ISC_Ca  INDIC_SYLLABIC_CATEGORY_CANTILLATION_MARK       /*  53 chars; Cantillation_Mark */
+#define ISC_C   INDIC_SYLLABIC_CATEGORY_CONSONANT               /* 1907 chars; Consonant */
+#define ISC_CD  INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD          /*  10 chars; Consonant_Dead */
+#define ISC_CF  INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL         /*  62 chars; Consonant_Final */
 #define ISC_CHL INDIC_SYLLABIC_CATEGORY_CONSONANT_HEAD_LETTER   /*   5 chars; Consonant_Head_Letter */
-#define ISC_CM  INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL        /*  19 chars; Consonant_Medial */
-#define ISC_CP  INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER   /*  11 chars; Consonant_Placeholder */
+#define ISC_CK  INDIC_SYLLABIC_CATEGORY_CONSONANT_KILLER        /*   2 chars; Consonant_Killer */
+#define ISC_CM  INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL        /*  22 chars; Consonant_Medial */
+#define ISC_CP  INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER   /*  16 chars; Consonant_Placeholder */
 #define ISC_CPR INDIC_SYLLABIC_CATEGORY_CONSONANT_PRECEDING_REPHA       /*   1 chars; Consonant_Preceding_Repha */
-#define ISC_CS  INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED     /*  61 chars; Consonant_Subjoined */
+#define ISC_CPrf        INDIC_SYLLABIC_CATEGORY_CONSONANT_PREFIXED      /*   2 chars; Consonant_Prefixed */
+#define ISC_CS  INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED     /*  90 chars; Consonant_Subjoined */
 #define ISC_CSR INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA      /*   4 chars; Consonant_Succeeding_Repha */
+#define ISC_CWS INDIC_SYLLABIC_CATEGORY_CONSONANT_WITH_STACKER  /*   4 chars; Consonant_With_Stacker */
 #define ISC_GM  INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK         /*   2 chars; Gemination_Mark */
 #define ISC_IS  INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER       /*   7 chars; Invisible_Stacker */
 #define ISC_ZWJ INDIC_SYLLABIC_CATEGORY_JOINER                  /*   1 chars; Joiner */
 #define ISC_ML  INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER        /*   1 chars; Modifying_Letter */
 #define ISC_ZWNJ        INDIC_SYLLABIC_CATEGORY_NON_JOINER              /*   1 chars; Non_Joiner */
-#define ISC_N   INDIC_SYLLABIC_CATEGORY_NUKTA                   /*  18 chars; Nukta */
-#define ISC_Nd  INDIC_SYLLABIC_CATEGORY_NUMBER                  /* 408 chars; Number */
+#define ISC_N   INDIC_SYLLABIC_CATEGORY_NUKTA                   /*  24 chars; Nukta */
+#define ISC_Nd  INDIC_SYLLABIC_CATEGORY_NUMBER                  /* 459 chars; Number */
 #define ISC_NJ  INDIC_SYLLABIC_CATEGORY_NUMBER_JOINER           /*   1 chars; Number_Joiner */
 #define ISC_x   INDIC_SYLLABIC_CATEGORY_OTHER                   /*   1 chars; Other */
-#define ISC_PK  INDIC_SYLLABIC_CATEGORY_PURE_KILLER             /*  15 chars; Pure_Killer */
-#define ISC_RS  INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER        /*   3 chars; Register_Shifter */
+#define ISC_PK  INDIC_SYLLABIC_CATEGORY_PURE_KILLER             /*  16 chars; Pure_Killer */
+#define ISC_RS  INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER        /*   2 chars; Register_Shifter */
+#define ISC_SM  INDIC_SYLLABIC_CATEGORY_SYLLABLE_MODIFIER       /*  22 chars; Syllable_Modifier */
 #define ISC_TL  INDIC_SYLLABIC_CATEGORY_TONE_LETTER             /*   7 chars; Tone_Letter */
-#define ISC_TM  INDIC_SYLLABIC_CATEGORY_TONE_MARK               /*  62 chars; Tone_Mark */
-#define ISC_V   INDIC_SYLLABIC_CATEGORY_VIRAMA                  /*  22 chars; Virama */
-#define ISC_Vs  INDIC_SYLLABIC_CATEGORY_VISARGA                 /*  29 chars; Visarga */
+#define ISC_TM  INDIC_SYLLABIC_CATEGORY_TONE_MARK               /*  42 chars; Tone_Mark */
+#define ISC_V   INDIC_SYLLABIC_CATEGORY_VIRAMA                  /*  24 chars; Virama */
+#define ISC_Vs  INDIC_SYLLABIC_CATEGORY_VISARGA                 /*  31 chars; Visarga */
 #define ISC_Vo  INDIC_SYLLABIC_CATEGORY_VOWEL                   /*  30 chars; Vowel */
-#define ISC_M   INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT         /* 553 chars; Vowel_Dependent */
-#define ISC_VI  INDIC_SYLLABIC_CATEGORY_VOWEL_INDEPENDENT       /* 395 chars; Vowel_Independent */
+#define ISC_M   INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT         /* 602 chars; Vowel_Dependent */
+#define ISC_VI  INDIC_SYLLABIC_CATEGORY_VOWEL_INDEPENDENT       /* 431 chars; Vowel_Independent */
 
-#define IMC_B   INDIC_MATRA_CATEGORY_BOTTOM                     /* 142 chars; Bottom */
+#define IMC_B   INDIC_MATRA_CATEGORY_BOTTOM                     /* 300 chars; Bottom */
 #define IMC_BR  INDIC_MATRA_CATEGORY_BOTTOM_AND_RIGHT           /*   2 chars; Bottom_And_Right */
 #define IMC_L   INDIC_MATRA_CATEGORY_LEFT                       /*  57 chars; Left */
 #define IMC_LR  INDIC_MATRA_CATEGORY_LEFT_AND_RIGHT             /*  21 chars; Left_And_Right */
 #define IMC_x   INDIC_MATRA_CATEGORY_NOT_APPLICABLE             /*   1 chars; Not_Applicable */
-#define IMC_O   INDIC_MATRA_CATEGORY_OVERSTRUCK                 /*   2 chars; Overstruck */
-#define IMC_R   INDIC_MATRA_CATEGORY_RIGHT                      /* 163 chars; Right */
-#define IMC_T   INDIC_MATRA_CATEGORY_TOP                        /* 169 chars; Top */
+#define IMC_O   INDIC_MATRA_CATEGORY_OVERSTRUCK                 /*  10 chars; Overstruck */
+#define IMC_R   INDIC_MATRA_CATEGORY_RIGHT                      /* 258 chars; Right */
+#define IMC_T   INDIC_MATRA_CATEGORY_TOP                        /* 342 chars; Top */
 #define IMC_TB  INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM             /*  10 chars; Top_And_Bottom */
 #define IMC_TBR INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM_AND_RIGHT   /*   1 chars; Top_And_Bottom_And_Right */
 #define IMC_TL  INDIC_MATRA_CATEGORY_TOP_AND_LEFT               /*   6 chars; Top_And_Left */
 #define IMC_TLR INDIC_MATRA_CATEGORY_TOP_AND_LEFT_AND_RIGHT     /*   4 chars; Top_And_Left_And_Right */
 #define IMC_TR  INDIC_MATRA_CATEGORY_TOP_AND_RIGHT              /*  13 chars; Top_And_Right */
-#define IMC_VOL INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT          /*  15 chars; Visual_Order_Left */
+#define IMC_VOL INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT          /*  19 chars; Visual_Order_Left */
 
 #define _(S,M) INDIC_COMBINE_CATEGORIES (ISC_##S, IMC_##M)
 
@@ -79,29 +83,33 @@
   /* 0030 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* 0038 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0x00d0u 24
+#define indic_offset_0x00b0u 24
 
 
   /* Latin-1 Supplement */
 
+  /* 00B0 */  _(x,x),  _(x,x), _(SM,x), _(SM,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
+  /* 00B8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
+  /* 00C0 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
+  /* 00C8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
   /* 00D0 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x), _(CP,x),
 
-#define indic_offset_0x0900u 32
+#define indic_offset_0x0900u 64
 
 
   /* Devanagari */
 
-  /* 0900 */ _(Bi,x), _(Bi,x), _(Bi,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
+  /* 0900 */ _(Bi,T), _(Bi,T), _(Bi,T), _(Vs,R), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
   /* 0908 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
   /* 0910 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0918 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0920 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0928 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0930 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 0938 */  _(C,x),  _(C,x),  _(M,T),  _(M,R),  _(N,x),  _(A,x),  _(M,R),  _(M,L),
+  /* 0938 */  _(C,x),  _(C,x),  _(M,T),  _(M,R),  _(N,B),  _(A,x),  _(M,R),  _(M,L),
   /* 0940 */  _(M,R),  _(M,B),  _(M,B),  _(M,B),  _(M,B),  _(M,T),  _(M,T),  _(M,T),
   /* 0948 */  _(M,T),  _(M,R),  _(M,R),  _(M,R),  _(M,R),  _(V,B),  _(M,L),  _(M,R),
-  /* 0950 */  _(x,x), _(TM,x), _(TM,x),  _(x,x),  _(x,x),  _(M,T),  _(M,B),  _(M,B),
+  /* 0950 */  _(x,x), _(Ca,T), _(Ca,B),  _(x,T),  _(x,T),  _(M,T),  _(M,B),  _(M,B),
   /* 0958 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0960 */ _(VI,x), _(VI,x),  _(M,B),  _(M,B),  _(x,x),  _(x,x), _(Nd,x), _(Nd,x),
   /* 0968 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
@@ -110,14 +118,14 @@
 
   /* Bengali */
 
-  /* 0980 */  _(x,x), _(Bi,x), _(Bi,x), _(Vs,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
+  /* 0980 */  _(x,x), _(Bi,T), _(Bi,R), _(Vs,R),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
   /* 0988 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(x,x),  _(x,x), _(VI,x),
   /* 0990 */ _(VI,x),  _(x,x),  _(x,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0998 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 09A0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 09A8 */  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 09B0 */  _(C,x),  _(x,x),  _(C,x),  _(x,x),  _(x,x),  _(x,x),  _(C,x),  _(C,x),
-  /* 09B8 */  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(N,x),  _(A,x),  _(M,R),  _(M,L),
+  /* 09B8 */  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(N,B),  _(A,x),  _(M,R),  _(M,L),
   /* 09C0 */  _(M,R),  _(M,B),  _(M,B),  _(M,B),  _(M,B),  _(x,x),  _(x,x),  _(M,L),
   /* 09C8 */  _(M,L),  _(x,x),  _(x,x), _(M,LR), _(M,LR),  _(V,B), _(CD,x),  _(x,x),
   /* 09D0 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(M,R),
@@ -129,33 +137,33 @@
 
   /* Gurmukhi */
 
-  /* 0A00 */  _(x,x), _(Bi,x), _(Bi,x), _(Vs,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
+  /* 0A00 */  _(x,x), _(Bi,T), _(Bi,T), _(Vs,R),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
   /* 0A08 */ _(VI,x), _(VI,x), _(VI,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x), _(VI,x),
   /* 0A10 */ _(VI,x),  _(x,x),  _(x,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0A18 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0A20 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0A28 */  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0A30 */  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(x,x),
-  /* 0A38 */  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(N,x),  _(x,x),  _(M,R),  _(M,L),
+  /* 0A38 */  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(N,B),  _(x,x),  _(M,R),  _(M,L),
   /* 0A40 */  _(M,R),  _(M,B),  _(M,B),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(M,T),
   /* 0A48 */  _(M,T),  _(x,x),  _(x,x),  _(M,T),  _(M,T),  _(V,B),  _(x,x),  _(x,x),
   /* 0A50 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
   /* 0A58 */  _(x,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(x,x),  _(C,x),  _(x,x),
   /* 0A60 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x), _(Nd,x), _(Nd,x),
   /* 0A68 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 0A70 */ _(Bi,x), _(GM,T), _(CP,x), _(CP,x),  _(x,x), _(CM,x),  _(x,x),  _(x,x),
+  /* 0A70 */ _(Bi,T), _(GM,T), _(CP,x), _(CP,x),  _(x,x), _(CM,B),  _(x,x),  _(x,x),
   /* 0A78 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
   /* Gujarati */
 
-  /* 0A80 */  _(x,x), _(Bi,x), _(Bi,x), _(Vs,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
+  /* 0A80 */  _(x,x), _(Bi,T), _(Bi,T), _(Vs,R),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
   /* 0A88 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(x,x), _(VI,x),
   /* 0A90 */ _(VI,x), _(VI,x),  _(x,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0A98 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0AA0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0AA8 */  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0AB0 */  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 0AB8 */  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(N,x),  _(A,x),  _(M,R),  _(M,L),
+  /* 0AB8 */  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(N,B),  _(A,x),  _(M,R),  _(M,L),
   /* 0AC0 */  _(M,R),  _(M,B),  _(M,B),  _(M,B),  _(M,B),  _(M,T),  _(x,x),  _(M,T),
   /* 0AC8 */  _(M,T), _(M,TR),  _(x,x),  _(M,R),  _(M,R),  _(V,B),  _(x,x),  _(x,x),
   /* 0AD0 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
@@ -163,18 +171,18 @@
   /* 0AE0 */ _(VI,x), _(VI,x),  _(M,B),  _(M,B),  _(x,x),  _(x,x), _(Nd,x), _(Nd,x),
   /* 0AE8 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* 0AF0 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 0AF8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
+  /* 0AF8 */  _(x,x),  _(C,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
   /* Oriya */
 
-  /* 0B00 */  _(x,x), _(Bi,x), _(Bi,x), _(Vs,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
+  /* 0B00 */  _(x,x), _(Bi,T), _(Bi,R), _(Vs,R),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
   /* 0B08 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(x,x),  _(x,x), _(VI,x),
   /* 0B10 */ _(VI,x),  _(x,x),  _(x,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0B18 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0B20 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0B28 */  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0B30 */  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 0B38 */  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(N,x),  _(A,x),  _(M,R),  _(M,T),
+  /* 0B38 */  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(N,B),  _(A,x),  _(M,R),  _(M,T),
   /* 0B40 */  _(M,R),  _(M,B),  _(M,B),  _(M,B),  _(M,B),  _(x,x),  _(x,x),  _(M,L),
   /* 0B48 */ _(M,TL),  _(x,x),  _(x,x), _(M,LR),_(M,TLR),  _(V,B),  _(x,x),  _(x,x),
   /* 0B50 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(M,T), _(M,TR),
@@ -186,7 +194,7 @@
 
   /* Tamil */
 
-  /* 0B80 */  _(x,x),  _(x,x), _(Bi,x), _(ML,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
+  /* 0B80 */  _(x,x),  _(x,x), _(Bi,T), _(ML,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
   /* 0B88 */ _(VI,x), _(VI,x), _(VI,x),  _(x,x),  _(x,x),  _(x,x), _(VI,x), _(VI,x),
   /* 0B90 */ _(VI,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(x,x),  _(x,x),
   /* 0B98 */  _(x,x),  _(C,x),  _(C,x),  _(x,x),  _(C,x),  _(x,x),  _(C,x),  _(C,x),
@@ -194,7 +202,7 @@
   /* 0BA8 */  _(C,x),  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(x,x),  _(C,x),  _(C,x),
   /* 0BB0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0BB8 */  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(M,R),  _(M,R),
-  /* 0BC0 */  _(M,T),  _(M,B),  _(M,B),  _(x,x),  _(x,x),  _(x,x),  _(M,L),  _(M,L),
+  /* 0BC0 */  _(M,T),  _(M,R),  _(M,R),  _(x,x),  _(x,x),  _(x,x),  _(M,L),  _(M,L),
   /* 0BC8 */  _(M,L),  _(x,x), _(M,LR), _(M,LR), _(M,LR),  _(V,T),  _(x,x),  _(x,x),
   /* 0BD0 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(M,R),
   /* 0BD8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
@@ -205,7 +213,7 @@
 
   /* Telugu */
 
-  /* 0C00 */ _(Bi,x), _(Bi,x), _(Bi,x), _(Vs,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
+  /* 0C00 */ _(Bi,T), _(Bi,R), _(Bi,R), _(Vs,R),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
   /* 0C08 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(x,x), _(VI,x), _(VI,x),
   /* 0C10 */ _(VI,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0C18 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
@@ -216,7 +224,7 @@
   /* 0C40 */  _(M,T),  _(M,R),  _(M,R),  _(M,R),  _(M,R),  _(x,x),  _(M,T),  _(M,T),
   /* 0C48 */ _(M,TB),  _(x,x),  _(M,T),  _(M,T),  _(M,T),  _(V,T),  _(x,x),  _(x,x),
   /* 0C50 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(M,T),  _(M,B),  _(x,x),
-  /* 0C58 */  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
+  /* 0C58 */  _(C,x),  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
   /* 0C60 */ _(VI,x), _(VI,x),  _(M,B),  _(M,B),  _(x,x),  _(x,x), _(Nd,x), _(Nd,x),
   /* 0C68 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* 0C70 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
@@ -224,26 +232,26 @@
 
   /* Kannada */
 
-  /* 0C80 */  _(x,x), _(Bi,x), _(Bi,x), _(Vs,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
+  /* 0C80 */  _(x,x), _(Bi,T), _(Bi,R), _(Vs,R),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
   /* 0C88 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(x,x), _(VI,x), _(VI,x),
   /* 0C90 */ _(VI,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0C98 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0CA0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0CA8 */  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0CB0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 0CB8 */  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(N,x),  _(A,x),  _(M,R),  _(M,T),
+  /* 0CB8 */  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(N,B),  _(A,x),  _(M,R),  _(M,T),
   /* 0CC0 */ _(M,TR),  _(M,R),  _(M,R),  _(M,R),  _(M,R),  _(x,x),  _(M,T), _(M,TR),
   /* 0CC8 */ _(M,TR),  _(x,x), _(M,TR), _(M,TR),  _(M,T),  _(V,T),  _(x,x),  _(x,x),
   /* 0CD0 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(M,R),  _(M,R),  _(x,x),
   /* 0CD8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(C,x),  _(x,x),
   /* 0CE0 */ _(VI,x), _(VI,x),  _(M,B),  _(M,B),  _(x,x),  _(x,x), _(Nd,x), _(Nd,x),
   /* 0CE8 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 0CF0 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
+  /* 0CF0 */  _(x,x),_(CWS,x),_(CWS,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
   /* 0CF8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
   /* Malayalam */
 
-  /* 0D00 */  _(x,x), _(Bi,x), _(Bi,x), _(Vs,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
+  /* 0D00 */  _(x,x), _(Bi,T), _(Bi,R), _(Vs,R),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
   /* 0D08 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(x,x), _(VI,x), _(VI,x),
   /* 0D10 */ _(VI,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),
   /* 0D18 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
@@ -253,8 +261,8 @@
   /* 0D38 */  _(C,x),  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(A,x),  _(M,R),  _(M,R),
   /* 0D40 */  _(M,R),  _(M,R),  _(M,R),  _(M,B),  _(M,B),  _(x,x),  _(M,L),  _(M,L),
   /* 0D48 */  _(M,L),  _(x,x), _(M,LR), _(M,LR), _(M,LR),  _(V,T),_(CPR,x),  _(x,x),
-  /* 0D50 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(M,R),
-  /* 0D58 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
+  /* 0D50 */  _(x,x),  _(x,x),  _(x,x),  _(x,x), _(CD,x), _(CD,x), _(CD,x),  _(M,R),
+  /* 0D58 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x), _(VI,x),
   /* 0D60 */ _(VI,x), _(VI,x),  _(M,B),  _(M,B),  _(x,x),  _(x,x), _(Nd,x), _(Nd,x),
   /* 0D68 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* 0D70 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
@@ -262,7 +270,7 @@
 
   /* Sinhala */
 
-  /* 0D80 */  _(x,x),  _(x,x), _(Bi,x), _(Vs,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
+  /* 0D80 */  _(x,x),  _(x,x), _(Bi,R), _(Vs,R),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
   /* 0D88 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
   /* 0D90 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(x,x),
   /* 0D98 */  _(x,x),  _(x,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
@@ -278,7 +286,7 @@
   /* 0DE8 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* 0DF0 */  _(x,x),  _(x,x),  _(M,R),  _(M,R),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0x1000u 1304
+#define indic_offset_0x1000u 1336
 
 
   /* Myanmar */
@@ -289,51 +297,23 @@
   /* 1018 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* 1020 */  _(C,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
   /* 1028 */ _(VI,x), _(VI,x), _(VI,x),  _(M,R),  _(M,R),  _(M,T),  _(M,T),  _(M,B),
-  /* 1030 */  _(M,B),  _(M,L),  _(M,T),  _(M,T),  _(M,T),  _(M,T), _(Bi,x), _(TM,x),
-  /* 1038 */ _(Vs,x), _(IS,x), _(PK,T), _(CM,x), _(CM,x), _(CM,x), _(CM,x),  _(C,x),
+  /* 1030 */  _(M,B),  _(M,L),  _(M,T),  _(M,T),  _(M,T),  _(M,T), _(Bi,T), _(TM,B),
+  /* 1038 */ _(Vs,R), _(IS,x), _(PK,T), _(CM,R), _(CM,x), _(CM,B), _(CM,B),  _(C,x),
   /* 1040 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* 1048 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x), _(CP,x),  _(x,x),
   /* 1050 */  _(C,x),  _(C,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(M,R),  _(M,R),
-  /* 1058 */  _(M,B),  _(M,B),  _(C,x),  _(C,x),  _(C,x),  _(C,x), _(CM,x), _(CM,x),
-  /* 1060 */ _(CM,x),  _(C,x),  _(M,R), _(TM,x), _(TM,x),  _(C,x),  _(C,x),  _(M,R),
-  /* 1068 */  _(M,R), _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x),  _(C,x),  _(C,x),
+  /* 1058 */  _(M,B),  _(M,B),  _(C,x),  _(C,x),  _(C,x),  _(C,x), _(CM,B), _(CM,B),
+  /* 1060 */ _(CM,B),  _(C,x),  _(M,R), _(TM,R), _(TM,R),  _(C,x),  _(C,x),  _(M,R),
+  /* 1068 */  _(M,R), _(TM,R), _(TM,R), _(TM,R), _(TM,R), _(TM,R),  _(C,x),  _(C,x),
   /* 1070 */  _(C,x),  _(M,T),  _(M,T),  _(M,T),  _(M,T),  _(C,x),  _(C,x),  _(C,x),
   /* 1078 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1080 */  _(C,x),  _(C,x), _(CM,x),  _(M,R),  _(M,L),  _(M,T),  _(M,T), _(TM,x),
-  /* 1088 */ _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x),  _(C,x), _(TM,x),
+  /* 1080 */  _(C,x),  _(C,x), _(CM,B),  _(M,R),  _(M,L),  _(M,T),  _(M,T), _(TM,R),
+  /* 1088 */ _(TM,R), _(TM,R), _(TM,R), _(TM,R), _(TM,R), _(TM,B),  _(C,x), _(TM,R),
   /* 1090 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 1098 */ _(Nd,x), _(Nd,x), _(TM,x), _(TM,x),  _(M,R),  _(M,T),  _(x,x),  _(x,x),
-
-#define indic_offset_0x1700u 1464
-
-
-  /* Tagalog */
-
-  /* 1700 */ _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1708 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(x,x),  _(C,x),  _(C,x),
-  /* 1710 */  _(C,x),  _(C,x),  _(M,T),  _(M,B), _(PK,B),  _(x,x),  _(x,x),  _(x,x),
-  /* 1718 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Hanunoo */
+  /* 1098 */ _(Nd,x), _(Nd,x), _(TM,R), _(TM,R),  _(M,R),  _(M,T),  _(x,x),  _(x,x),
 
-  /* 1720 */ _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1728 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1730 */  _(C,x),  _(C,x),  _(M,T),  _(M,B), _(PK,B),  _(x,x),  _(x,x),  _(x,x),
-  /* 1738 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Buhid */
+#define indic_offset_0x1780u 1496
 
-  /* 1740 */ _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1748 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1750 */  _(C,x),  _(C,x),  _(M,T),  _(M,B),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1758 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Tagbanwa */
-
-  /* 1760 */ _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1768 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(x,x),  _(C,x),  _(C,x),
-  /* 1770 */  _(C,x),  _(x,x),  _(M,T),  _(M,B),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1778 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
   /* Khmer */
 
@@ -345,515 +325,72 @@
   /* 17A8 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
   /* 17B0 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(x,x),  _(x,x),  _(M,R),  _(M,T),
   /* 17B8 */  _(M,T),  _(M,T),  _(M,T),  _(M,B),  _(M,B),  _(M,B), _(M,TL),_(M,TLR),
-  /* 17C0 */ _(M,LR),  _(M,L),  _(M,L),  _(M,L), _(M,LR), _(M,LR), _(Bi,x), _(Vs,x),
-  /* 17C8 */  _(M,R), _(RS,T), _(RS,T), _(RS,T),_(CSR,T),  _(M,T),  _(M,T),  _(M,T),
-  /* 17D0 */  _(M,T), _(PK,T), _(IS,x),  _(M,T),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 17D8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(A,x),  _(x,x),  _(x,x),  _(x,x),
+  /* 17C0 */ _(M,LR),  _(M,L),  _(M,L),  _(M,L), _(M,LR), _(M,LR), _(Bi,T), _(Vs,R),
+  /* 17C8 */  _(M,R), _(RS,T), _(RS,T), _(SM,T),_(CSR,T), _(CK,T), _(SM,T), _(SM,T),
+  /* 17D0 */ _(SM,T), _(PK,T), _(IS,x), _(SM,T),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
+  /* 17D8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(A,x), _(SM,T),  _(x,x),  _(x,x),
   /* 17E0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* 17E8 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0x1900u 1704
-
-
-  /* Limbu */
-
-  /* 1900 */ _(CP,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1908 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1910 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1918 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(x,x),
-  /* 1920 */  _(M,T),  _(M,T),  _(M,B),  _(M,R),  _(M,R), _(M,TR), _(M,TR),  _(M,T),
-  /* 1928 */  _(M,T), _(CS,x), _(CS,x), _(CS,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1930 */ _(CF,x), _(CF,x), _(Bi,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x),
-  /* 1938 */ _(CF,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1940 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x), _(Nd,x), _(Nd,x),
-  /* 1948 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-
-  /* Tai Le */
-
-  /* 1950 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1958 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1960 */  _(C,x),  _(C,x),  _(C,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x),
-  /* 1968 */ _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x),  _(x,x),  _(x,x),
-  /* 1970 */ _(TL,x), _(TL,x), _(TL,x), _(TL,x), _(TL,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1978 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* New Tai Lue */
-
-  /* 1980 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1988 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1990 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1998 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 19A0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 19A8 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 19B0 */  _(M,R),  _(M,R),  _(M,R),  _(M,R),  _(M,R),  _(M,L),  _(M,L),  _(M,L),
-  /* 19B8 */  _(M,R),  _(M,R),  _(M,L),  _(M,R),  _(M,R),  _(M,R),  _(M,R),  _(M,R),
-  /* 19C0 */  _(M,R), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x),
-  /* 19C8 */ _(TM,x), _(TM,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 19D0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 19D8 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 19E0 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 19E8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 19F0 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 19F8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Buginese */
-
-  /* 1A00 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1A08 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1A10 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(M,T),
-  /* 1A18 */  _(M,B),  _(M,L),  _(M,R),  _(M,T),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Tai Tham */
-
-  /* 1A20 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1A28 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1A30 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1A38 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1A40 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1A48 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 1A50 */ _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x), _(CM,L), _(CM,x), _(CF,x),
-  /* 1A58 */ _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x),  _(x,x),
-  /* 1A60 */ _(IS,x),  _(M,R),  _(M,T),  _(M,R),  _(M,R),  _(M,T),  _(M,T),  _(M,T),
-  /* 1A68 */  _(M,T),  _(M,B),  _(M,B),  _(M,T),  _(M,B),  _(M,R),  _(M,L),  _(M,L),
-  /* 1A70 */  _(M,L),  _(M,L),  _(M,L),  _(M,T),  _(M,T), _(TM,x), _(TM,x), _(TM,x),
-  /* 1A78 */ _(TM,x), _(TM,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1A80 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 1A88 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1A90 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 1A98 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-#define indic_offset_0x1b00u 2120
-
-
-  /* Balinese */
-
-  /* 1B00 */ _(Bi,x), _(Bi,x), _(Bi,x),_(CSR,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 1B08 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 1B10 */ _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1B18 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1B20 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1B28 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1B30 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(N,x),  _(M,R),  _(M,T),  _(M,T),
-  /* 1B38 */  _(M,B),  _(M,B),  _(M,B), _(M,BR), _(M,TB),_(M,TBR),  _(M,L),  _(M,L),
-  /* 1B40 */ _(M,LR), _(M,LR),  _(M,T), _(M,TR),  _(V,R),  _(C,x),  _(C,x),  _(C,x),
-  /* 1B48 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1B50 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 1B58 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1B60 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1B68 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1B70 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1B78 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Sundanese */
-
-  /* 1B80 */ _(Bi,x),_(CSR,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 1B88 */ _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1B90 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1B98 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1BA0 */  _(C,x), _(CS,x), _(CS,x), _(CS,x),  _(M,T),  _(M,B),  _(M,L),  _(M,R),
-  /* 1BA8 */  _(M,T),  _(M,T), _(PK,R), _(IS,x), _(CS,x), _(CS,x),  _(C,x),  _(C,x),
-  /* 1BB0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 1BB8 */ _(Nd,x), _(Nd,x),  _(A,x),  _(C,x),  _(C,x),  _(C,x), _(CF,x), _(CF,x),
-
-  /* Batak */
-
-  /* 1BC0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1BC8 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1BD0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1BD8 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1BE0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x), _(VI,x), _(VI,x),  _(N,x),  _(M,R),
-  /* 1BE8 */  _(M,T),  _(M,T),  _(M,R),  _(M,R),  _(M,R),  _(M,T),  _(M,R),  _(M,T),
-  /* 1BF0 */ _(CF,x), _(CF,x), _(PK,R), _(PK,R),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1BF8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Lepcha */
-
-  /* 1C00 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1C08 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1C10 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1C18 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 1C20 */  _(C,x),  _(C,x),  _(C,x),  _(C,x), _(CS,x), _(CS,x),  _(M,R),  _(M,L),
-  /* 1C28 */  _(M,L), _(M,TL),  _(M,R),  _(M,R),  _(M,B), _(CF,x), _(CF,x), _(CF,x),
-  /* 1C30 */ _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(Bi,L), _(Bi,L),  _(x,x),  _(N,x),
-  /* 1C38 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1C40 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 1C48 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(C,x),  _(C,x),  _(C,x),
-
-#define indic_offset_0x1cd0u 2456
+#define indic_offset_0x1cd0u 1608
 
 
   /* Vedic Extensions */
 
-  /* 1CD0 */ _(TM,x), _(TM,x), _(TM,x),  _(x,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x),
-  /* 1CD8 */ _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x),
-  /* 1CE0 */ _(TM,x), _(TM,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1CE8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 1CF0 */  _(x,x),  _(x,x), _(Vs,x), _(Vs,x), _(TM,x),  _(x,x),  _(x,x),  _(x,x),
+  /* 1CD0 */ _(Ca,T), _(Ca,T), _(Ca,T),  _(x,x), _(Ca,O), _(Ca,B), _(Ca,B), _(Ca,B),
+  /* 1CD8 */ _(Ca,B), _(Ca,B), _(Ca,T), _(Ca,T), _(Ca,B), _(Ca,B), _(Ca,B), _(Ca,B),
+  /* 1CE0 */ _(Ca,T), _(Ca,R),  _(x,O),  _(x,O),  _(x,O),  _(x,O),  _(x,O),  _(x,O),
+  /* 1CE8 */  _(x,O),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,B),  _(x,x),  _(x,x),
+  /* 1CF0 */  _(x,x),  _(x,x), _(Vs,x), _(Vs,x), _(Ca,T),  _(x,x),  _(x,x),  _(x,x),
+  /* 1CF8 */ _(Ca,x), _(Ca,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0x2008u 2496
+#define indic_offset_0x2008u 1656
 
 
   /* General Punctuation */
 
   /* 2008 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),_(ZWNJ,x),_(ZWJ,x),  _(x,x),  _(x,x),
-  /* 2010 */  _(x,x),  _(x,x), _(CP,x), _(CP,x), _(CP,x),  _(x,x),  _(x,x),  _(x,x),
+  /* 2010 */ _(CP,x), _(CP,x), _(CP,x), _(CP,x), _(CP,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0xa800u 2512
+#define indic_offset_0x2070u 1672
 
 
-  /* Syloti Nagri */
-
-  /* A800 */ _(VI,x), _(VI,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x), _(PK,T),  _(C,x),
-  /* A808 */  _(C,x),  _(C,x),  _(C,x), _(Bi,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A810 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A818 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A820 */  _(C,x),  _(C,x),  _(C,x),  _(M,R),  _(M,R),  _(M,B),  _(M,T),  _(M,R),
-  /* A828 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* A830 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* A838 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Phags-pa */
+  /* Superscripts and Subscripts */
 
-  /* A840 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A848 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A850 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A858 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x), _(Vo,x), _(Vo,x),
-  /* A860 */ _(Vo,x), _(Vo,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x), _(Vo,x), _(CS,x),
-  /* A868 */ _(CS,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A870 */  _(C,x), _(CS,x),  _(C,x), _(Bi,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* A878 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Saurashtra */
+  /* 2070 */  _(x,x),  _(x,x),  _(x,x),  _(x,x), _(SM,x),  _(x,x),  _(x,x),  _(x,x),
+  /* 2078 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
+  /* 2080 */  _(x,x),  _(x,x), _(SM,x), _(SM,x), _(SM,x),  _(x,x),  _(x,x),  _(x,x),
 
-  /* A880 */ _(Bi,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
-  /* A888 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
-  /* A890 */ _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A898 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A8A0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A8A8 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A8B0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x), _(CF,x),  _(M,R),  _(M,R),  _(M,R),
-  /* A8B8 */  _(M,R),  _(M,R),  _(M,R),  _(M,R),  _(M,R),  _(M,R),  _(M,R),  _(M,R),
-  /* A8C0 */  _(M,R),  _(M,R),  _(M,R),  _(M,R),  _(V,B),  _(x,x),  _(x,x),  _(x,x),
-  /* A8C8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* A8D0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* A8D8 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
+#define indic_offset_0xa8e0u 1696
+
 
   /* Devanagari Extended */
 
-  /* A8E0 */ _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x),
-  /* A8E8 */ _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x),
-  /* A8F0 */ _(Ca,x), _(Ca,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* A8F8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Kayah Li */
-
-  /* A900 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* A908 */ _(Nd,x), _(Nd,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A910 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A918 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A920 */  _(C,x),  _(C,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x),
-  /* A928 */ _(Vo,x), _(Vo,x), _(Vo,x), _(TM,x), _(TM,x), _(TM,x),  _(x,x),  _(x,x),
-
-  /* Rejang */
+  /* A8E0 */ _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T),
+  /* A8E8 */ _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T),
+  /* A8F0 */ _(Ca,T), _(Ca,T),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
-  /* A930 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A938 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A940 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(M,B),
-  /* A948 */  _(M,B),  _(M,B),  _(M,T),  _(M,B),  _(M,B),  _(M,B),  _(M,B), _(CF,x),
-  /* A950 */ _(CF,x), _(CF,x), _(CF,x), _(PK,R),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* A958 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* A960 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* A968 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* A970 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* A978 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Javanese */
+#define indic_offset_0xa9e0u 1720
 
-  /* A980 */ _(Bi,x), _(Bi,x),_(CSR,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
-  /* A988 */ _(VI,x),  _(C,x),  _(C,x),  _(C,x), _(VI,x), _(VI,x), _(VI,x),  _(C,x),
-  /* A990 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A998 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A9A0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A9A8 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* A9B0 */  _(C,x),  _(C,x),  _(C,x),  _(N,x),  _(M,R),  _(M,R),  _(M,T),  _(M,T),
-  /* A9B8 */  _(M,B),  _(M,B),  _(M,L),  _(M,L),  _(M,T), _(CS,x), _(CM,x), _(CM,x),
-  /* A9C0 */ _(V,BR),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* A9C8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* A9D0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* A9D8 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
   /* Myanmar Extended-B */
 
-  /* A9E0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(C,x),
+  /* A9E0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(M,T),  _(x,x),  _(C,x),
   /* A9E8 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* A9F0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* A9F8 */ _(Nd,x), _(Nd,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(x,x),
 
-  /* Cham */
+#define indic_offset_0xaa60u 1752
 
-  /* AA00 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),
-  /* AA08 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* AA10 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* AA18 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* AA20 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* AA28 */  _(C,x),  _(M,T),  _(M,T),  _(M,T),  _(M,T),  _(M,B),  _(M,T),  _(M,L),
-  /* AA30 */  _(M,L),  _(M,T),  _(M,B), _(CM,x), _(CM,L), _(CM,x), _(CM,x),  _(x,x),
-  /* AA38 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* AA40 */ _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x),
-  /* AA48 */ _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x),  _(x,x),  _(x,x),
-  /* AA50 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* AA58 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
   /* Myanmar Extended-A */
 
   /* AA60 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
   /* AA68 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* AA70 */  _(x,x),  _(C,x),  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* AA78 */  _(x,x),  _(x,x),  _(C,x), _(TM,x), _(TM,x), _(TM,x),  _(C,x),  _(C,x),
-
-  /* Tai Viet */
-
-  /* AA80 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* AA88 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* AA90 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* AA98 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* AAA0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* AAA8 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* AAB0 */  _(M,T),  _(M,R),  _(M,T),  _(M,T),  _(M,B),_(M,VOL),_(M,VOL),  _(M,T),
-  /* AAB8 */  _(M,T),_(M,VOL),  _(M,R),_(M,VOL),_(M,VOL),  _(M,R),  _(M,T), _(TM,x),
-  /* AAC0 */ _(TL,x), _(TM,x), _(TL,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* AAC8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* AAD0 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* AAD8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Meetei Mayek Extensions */
-
-  /* AAE0 */ _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* AAE8 */  _(C,x),  _(C,x),  _(C,x),  _(M,L),  _(M,B),  _(M,T),  _(M,L),  _(M,R),
-  /* AAF0 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x), _(Vs,x), _(IS,x),  _(x,x),
-
-#define indic_offset_0xabc0u 3272
-
-
-  /* Meetei Mayek */
-
-  /* ABC0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* ABC8 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x), _(VI,x), _(VI,x),
-  /* ABD0 */  _(C,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* ABD8 */  _(C,x),  _(C,x),  _(C,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x),
-  /* ABE0 */ _(CF,x), _(CF,x), _(CF,x),  _(M,R),  _(M,R),  _(M,T),  _(M,R),  _(M,R),
-  /* ABE8 */  _(M,B),  _(M,R),  _(M,R),  _(x,x), _(TM,x), _(PK,B),  _(x,x),  _(x,x),
-  /* ABF0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* ABF8 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-#define indic_offset_0x10a00u 3336
-
-
-  /* Kharoshthi */
-
-  /* 10A00 */  _(C,x),  _(M,O),  _(M,B),  _(M,B),  _(x,x),  _(M,T),  _(M,O),  _(x,x),
-  /* 10A08 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(M,B),  _(x,x), _(Bi,x), _(Vs,x),
-  /* 10A10 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 10A18 */  _(x,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 10A20 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 10A28 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 10A30 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 10A38 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x), _(IS,x),
-  /* 10A40 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-
-#define indic_offset_0x11000u 3408
-
-
-  /* Brahmi */
-
-  /* 11000 */ _(Bi,x), _(Bi,x), _(Vs,x),  _(x,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 11008 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 11010 */ _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11018 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11020 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11028 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11030 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11038 */  _(M,T),  _(M,T),  _(M,T),  _(M,T),  _(M,B),  _(M,B),  _(M,B),  _(M,B),
-  /* 11040 */  _(M,B),  _(M,B),  _(M,T),  _(M,T),  _(M,T),  _(M,T),  _(V,T),  _(x,x),
-  /* 11048 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 11050 */  _(x,x),  _(x,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),
-  /* 11058 */_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),
-  /* 11060 */_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x), _(Nd,x), _(Nd,x),
-  /* 11068 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 11070 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 11078 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x), _(NJ,x),
-
-  /* Kaithi */
-
-  /* 11080 */ _(Bi,x), _(Bi,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 11088 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11090 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11098 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 110A0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 110A8 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 110B0 */  _(M,R),  _(M,L),  _(M,R),  _(M,B),  _(M,B),  _(M,T),  _(M,T),  _(M,R),
-  /* 110B8 */  _(M,R),  _(V,B),  _(N,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-#define indic_offset_0x11100u 3600
-
-
-  /* Chakma */
-
-  /* 11100 */ _(Bi,x), _(Bi,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(C,x),
-  /* 11108 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11110 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11118 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11120 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(M,T),
-  /* 11128 */  _(M,T),  _(M,T),  _(M,B),  _(M,B),  _(M,L),  _(M,T), _(M,TB), _(M,TB),
-  /* 11130 */  _(M,T),  _(M,B),  _(M,B), _(IS,x), _(PK,T),  _(x,x), _(Nd,x), _(Nd,x),
-  /* 11138 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 11140 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 11148 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Mahajani */
-
-  /* 11150 */ _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11158 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11160 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11168 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11170 */  _(C,x),  _(C,x),  _(C,x),  _(N,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 11178 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Sharada */
+  /* AA70 */  _(x,x),  _(C,x),  _(C,x),  _(C,x), _(CP,x), _(CP,x), _(CP,x),  _(x,x),
+  /* AA78 */  _(x,x),  _(x,x),  _(C,x), _(TM,R), _(TM,T), _(TM,R),  _(C,x),  _(C,x),
 
-  /* 11180 */ _(Bi,x), _(Bi,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 11188 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 11190 */ _(VI,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11198 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 111A0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 111A8 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 111B0 */  _(C,x),  _(C,x),  _(C,x),  _(M,R),  _(M,L),  _(M,R),  _(M,B),  _(M,B),
-  /* 111B8 */  _(M,B),  _(M,B),  _(M,B),  _(M,B),  _(M,T),  _(M,T),  _(M,T), _(M,TR),
-  /* 111C0 */  _(V,R),  _(A,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 111C8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 111D0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 111D8 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Sinhala Archaic Numbers */
-
-  /* 111E0 */  _(x,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 111E8 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 111F0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 111F8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Khojki */
-
-  /* 11200 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 11208 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11210 */  _(C,x),  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11218 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11220 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11228 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(M,R),  _(M,R),  _(M,R),  _(M,B),
-  /* 11230 */  _(M,T),  _(M,T), _(M,TR), _(M,TR), _(Bi,x),  _(V,R),  _(N,x), _(GM,T),
-
-#define indic_offset_0x112b0u 3912
-
-
-  /* Khudawadi */
-
-  /* 112B0 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 112B8 */ _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 112C0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 112C8 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 112D0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 112D8 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x), _(Bi,x),
-  /* 112E0 */  _(M,R),  _(M,L),  _(M,R),  _(M,B),  _(M,B),  _(M,T),  _(M,T),  _(M,T),
-  /* 112E8 */  _(M,T),  _(N,x), _(PK,B),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 112F0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 112F8 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Grantha */
-
-  /* 11300 */  _(x,x), _(Bi,x), _(Bi,x), _(Vs,x),  _(x,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 11308 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(x,x),  _(x,x), _(VI,x),
-  /* 11310 */ _(VI,x),  _(x,x),  _(x,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11318 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11320 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11328 */  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11330 */  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(x,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11338 */  _(C,x),  _(C,x),  _(x,x),  _(x,x),  _(N,x),  _(A,x),  _(M,R),  _(M,R),
-  /* 11340 */  _(M,T),  _(M,R),  _(M,R),  _(M,R),  _(M,R),  _(x,x),  _(x,x),  _(M,L),
-  /* 11348 */  _(M,L),  _(x,x),  _(x,x), _(M,LR), _(M,LR),  _(V,R),  _(x,x),  _(x,x),
-  /* 11350 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(M,R),
-  /* 11358 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 11360 */ _(VI,x), _(VI,x),  _(M,R),  _(M,R),  _(x,x),  _(x,x), _(Ca,x), _(Ca,x),
-  /* 11368 */ _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 11370 */ _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x),  _(x,x),  _(x,x),  _(x,x),
-
-#define indic_offset_0x11480u 4112
-
-
-  /* Tirhuta */
-
-  /* 11480 */  _(x,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 11488 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(C,x),
-  /* 11490 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11498 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 114A0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 114A8 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 114B0 */  _(M,R),  _(M,L),  _(M,R),  _(M,B),  _(M,B),  _(M,B),  _(M,B),  _(M,B),
-  /* 114B8 */  _(M,B),  _(M,L),  _(M,T), _(M,TL), _(M,LR),  _(M,R), _(M,LR), _(Bi,x),
-  /* 114C0 */ _(Bi,x), _(Vs,x),  _(V,B),  _(N,x),  _(A,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 114C8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 114D0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 114D8 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-#define indic_offset_0x11580u 4208
-
-
-  /* Siddham */
-
-  /* 11580 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 11588 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),
-  /* 11590 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11598 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 115A0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 115A8 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(M,R),
-  /* 115B0 */  _(M,L),  _(M,R),  _(M,B),  _(M,B),  _(M,B),  _(M,B),  _(x,x),  _(x,x),
-  /* 115B8 */  _(M,L), _(M,TL), _(M,LR),_(M,TLR), _(Bi,x), _(Bi,x), _(Vs,x),  _(V,B),
-  /* 115C0 */  _(N,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-#define indic_offset_0x11600u 4280
-
-
-  /* Modi */
-
-  /* 11600 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 11608 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),  _(C,x),  _(C,x),
-  /* 11610 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11618 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11620 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11628 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11630 */  _(M,R),  _(M,R),  _(M,R),  _(M,B),  _(M,B),  _(M,B),  _(M,B),  _(M,B),
-  /* 11638 */  _(M,B),  _(M,T),  _(M,T),  _(M,R),  _(M,R), _(Bi,x), _(Vs,x),  _(V,B),
-  /* 11640 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 11648 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 11650 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 11658 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 11660 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 11668 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 11670 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 11678 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-  /* Takri */
-
-  /* 11680 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
-  /* 11688 */ _(VI,x), _(VI,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11690 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 11698 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 116A0 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(C,x),
-  /* 116A8 */  _(C,x),  _(C,x),  _(C,x), _(Bi,x), _(Vs,x),  _(M,T),  _(M,L),  _(M,R),
-  /* 116B0 */  _(M,B),  _(M,B),  _(M,T),  _(M,T),  _(M,T),  _(M,T),  _(V,T),  _(N,x),
-  /* 116B8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-  /* 116C0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-  /* 116C8 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
-
-}; /* Table items: 4488; occupancy: 73% */
+}; /* Table items: 1784; occupancy: 69% */
 
 INDIC_TABLE_ELEMENT_TYPE
 hb_indic_get_categories (hb_codepoint_t u)
@@ -862,40 +399,27 @@
   {
     case 0x0u:
       if (hb_in_range (u, 0x0028u, 0x003Fu)) return indic_table[u - 0x0028u + indic_offset_0x0028u];
-      if (hb_in_range (u, 0x00D0u, 0x00D7u)) return indic_table[u - 0x00D0u + indic_offset_0x00d0u];
+      if (hb_in_range (u, 0x00B0u, 0x00D7u)) return indic_table[u - 0x00B0u + indic_offset_0x00b0u];
       if (hb_in_range (u, 0x0900u, 0x0DF7u)) return indic_table[u - 0x0900u + indic_offset_0x0900u];
       if (unlikely (u == 0x00A0u)) return _(CP,x);
       break;
 
     case 0x1u:
       if (hb_in_range (u, 0x1000u, 0x109Fu)) return indic_table[u - 0x1000u + indic_offset_0x1000u];
-      if (hb_in_range (u, 0x1700u, 0x17EFu)) return indic_table[u - 0x1700u + indic_offset_0x1700u];
-      if (hb_in_range (u, 0x1900u, 0x1A9Fu)) return indic_table[u - 0x1900u + indic_offset_0x1900u];
-      if (hb_in_range (u, 0x1B00u, 0x1C4Fu)) return indic_table[u - 0x1B00u + indic_offset_0x1b00u];
-      if (hb_in_range (u, 0x1CD0u, 0x1CF7u)) return indic_table[u - 0x1CD0u + indic_offset_0x1cd0u];
+      if (hb_in_range (u, 0x1780u, 0x17EFu)) return indic_table[u - 0x1780u + indic_offset_0x1780u];
+      if (hb_in_range (u, 0x1CD0u, 0x1CFFu)) return indic_table[u - 0x1CD0u + indic_offset_0x1cd0u];
       break;
 
     case 0x2u:
       if (hb_in_range (u, 0x2008u, 0x2017u)) return indic_table[u - 0x2008u + indic_offset_0x2008u];
+      if (hb_in_range (u, 0x2070u, 0x2087u)) return indic_table[u - 0x2070u + indic_offset_0x2070u];
       if (unlikely (u == 0x25CCu)) return _(CP,x);
       break;
 
     case 0xAu:
-      if (hb_in_range (u, 0xA800u, 0xAAF7u)) return indic_table[u - 0xA800u + indic_offset_0xa800u];
-      if (hb_in_range (u, 0xABC0u, 0xABFFu)) return indic_table[u - 0xABC0u + indic_offset_0xabc0u];
-      break;
-
-    case 0x10u:
-      if (hb_in_range (u, 0x10A00u, 0x10A47u)) return indic_table[u - 0x10A00u + indic_offset_0x10a00u];
-      break;
-
-    case 0x11u:
-      if (hb_in_range (u, 0x11000u, 0x110BFu)) return indic_table[u - 0x11000u + indic_offset_0x11000u];
-      if (hb_in_range (u, 0x11100u, 0x11237u)) return indic_table[u - 0x11100u + indic_offset_0x11100u];
-      if (hb_in_range (u, 0x112B0u, 0x11377u)) return indic_table[u - 0x112B0u + indic_offset_0x112b0u];
-      if (hb_in_range (u, 0x11480u, 0x114DFu)) return indic_table[u - 0x11480u + indic_offset_0x11480u];
-      if (hb_in_range (u, 0x11580u, 0x115C7u)) return indic_table[u - 0x11580u + indic_offset_0x11580u];
-      if (hb_in_range (u, 0x11600u, 0x116CFu)) return indic_table[u - 0x11600u + indic_offset_0x11600u];
+      if (hb_in_range (u, 0xA8E0u, 0xA8F7u)) return indic_table[u - 0xA8E0u + indic_offset_0xa8e0u];
+      if (hb_in_range (u, 0xA9E0u, 0xA9FFu)) return indic_table[u - 0xA9E0u + indic_offset_0xa9e0u];
+      if (hb_in_range (u, 0xAA60u, 0xAA7Fu)) return indic_table[u - 0xAA60u + indic_offset_0xaa60u];
       break;
 
     default:
@@ -914,11 +438,14 @@
 #undef ISC_CD
 #undef ISC_CF
 #undef ISC_CHL
+#undef ISC_CK
 #undef ISC_CM
 #undef ISC_CP
 #undef ISC_CPR
+#undef ISC_CPrf
 #undef ISC_CS
 #undef ISC_CSR
+#undef ISC_CWS
 #undef ISC_GM
 #undef ISC_IS
 #undef ISC_ZWJ
@@ -930,6 +457,7 @@
 #undef ISC_x
 #undef ISC_PK
 #undef ISC_RS
+#undef ISC_SM
 #undef ISC_TL
 #undef ISC_TM
 #undef ISC_V
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -176,24 +176,8 @@
    * Re-assign category
    */
 
-
-  /* The spec says U+0952 is OT_A.  However, testing shows that Uniscribe
-   * treats a whole bunch of characters similarly.
-   * TESTS: For example, for U+0951:
-   * U+092E,U+0947,U+0952
-   * U+092E,U+0952,U+0947
-   * U+092E,U+0947,U+0951
-   * U+092E,U+0951,U+0947
-   * U+092E,U+0951,U+0952
-   * U+092E,U+0952,U+0951
-   */
-  if (unlikely (hb_in_ranges (u, 0x0951u, 0x0952u,
-                                 0x1CD0u, 0x1CD2u,
-                                 0x1CD4u, 0x1CE1u) ||
-                            u == 0x1CF4u))
-    cat = OT_A;
   /* The following act more like the Bindus. */
-  else if (unlikely (hb_in_range (u, 0x0953u, 0x0954u)))
+  if (unlikely (hb_in_range (u, 0x0953u, 0x0954u)))
     cat = OT_SM;
   /* The following act like consonants. */
   else if (unlikely (hb_in_ranges (u, 0x0A72u, 0x0A73u,
@@ -216,21 +200,10 @@
     cat = OT_Symbol;
     ASSERT_STATIC ((int) INDIC_SYLLABIC_CATEGORY_AVAGRAHA == OT_Symbol);
   }
-  else if (unlikely (hb_in_range (u, 0x17CDu, 0x17D1u) ||
-                     u == 0x17CBu || u == 0x17D3u || u == 0x17DDu)) /* Khmer Various signs */
-  {
-    /* These are like Top Matras. */
-    cat = OT_M;
-    pos = POS_ABOVE_C;
-  }
   else if (unlikely (u == 0x17C6u)) cat = OT_N; /* Khmer Bindu doesn't like to be repositioned. */
-  else if (unlikely (u == 0x17D2u)) cat = OT_Coeng; /* Khmer coeng */
   else if (unlikely (hb_in_range (u, 0x2010u, 0x2011u)))
                                     cat = OT_PLACEHOLDER;
   else if (unlikely (u == 0x25CCu)) cat = OT_DOTTEDCIRCLE;
-  else if (unlikely (u == 0xA982u)) cat = OT_SM; /* Javanese repha. */
-  else if (unlikely (u == 0xA9BEu)) cat = OT_CM2; /* Javanese medial ya. */
-  else if (unlikely (u == 0xA9BDu)) { cat = OT_M; pos = POS_POST_C; } /* Javanese vocalic r. */
 
 
   /*
@@ -296,11 +269,6 @@
   BLWF_MODE_PRE_AND_POST, /* Below-forms feature applied to pre-base and post-base. */
   BLWF_MODE_POST_ONLY     /* Below-forms feature applied to post-base only. */
 };
-enum pref_len_t {
-  PREF_LEN_1 = 1,
-  PREF_LEN_2 = 2,
-  PREF_LEN_DONT_CARE = PREF_LEN_2
-};
 struct indic_config_t
 {
   hb_script_t     script;
@@ -310,26 +278,24 @@
   reph_position_t reph_pos;
   reph_mode_t     reph_mode;
   blwf_mode_t     blwf_mode;
-  pref_len_t      pref_len;
 };
 
 static const indic_config_t indic_configs[] =
 {
   /* Default.  Should be first. */
-  {HB_SCRIPT_INVALID,   false,      0,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_1},
-  {HB_SCRIPT_DEVANAGARI,true, 0x094Du,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
-  {HB_SCRIPT_BENGALI,   true, 0x09CDu,BASE_POS_LAST, REPH_POS_AFTER_SUB,  REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
-  {HB_SCRIPT_GURMUKHI,  true, 0x0A4Du,BASE_POS_LAST, REPH_POS_BEFORE_SUB, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
-  {HB_SCRIPT_GUJARATI,  true, 0x0ACDu,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
-  {HB_SCRIPT_ORIYA,     true, 0x0B4Du,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
-  {HB_SCRIPT_TAMIL,     true, 0x0BCDu,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_2},
-  {HB_SCRIPT_TELUGU,    true, 0x0C4Du,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_EXPLICIT, BLWF_MODE_POST_ONLY,    PREF_LEN_2},
-  {HB_SCRIPT_KANNADA,   true, 0x0CCDu,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_IMPLICIT, BLWF_MODE_POST_ONLY,    PREF_LEN_2},
-  {HB_SCRIPT_MALAYALAM, true, 0x0D4Du,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_MODE_LOG_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_2},
+  {HB_SCRIPT_INVALID,   false,      0,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST},
+  {HB_SCRIPT_DEVANAGARI,true, 0x094Du,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST},
+  {HB_SCRIPT_BENGALI,   true, 0x09CDu,BASE_POS_LAST, REPH_POS_AFTER_SUB,  REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST},
+  {HB_SCRIPT_GURMUKHI,  true, 0x0A4Du,BASE_POS_LAST, REPH_POS_BEFORE_SUB, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST},
+  {HB_SCRIPT_GUJARATI,  true, 0x0ACDu,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST},
+  {HB_SCRIPT_ORIYA,     true, 0x0B4Du,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST},
+  {HB_SCRIPT_TAMIL,     true, 0x0BCDu,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST},
+  {HB_SCRIPT_TELUGU,    true, 0x0C4Du,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_EXPLICIT, BLWF_MODE_POST_ONLY},
+  {HB_SCRIPT_KANNADA,   true, 0x0CCDu,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_IMPLICIT, BLWF_MODE_POST_ONLY},
+  {HB_SCRIPT_MALAYALAM, true, 0x0D4Du,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_MODE_LOG_REPHA,BLWF_MODE_PRE_AND_POST},
   {HB_SCRIPT_SINHALA,   false,0x0DCAu,BASE_POS_LAST_SINHALA,
-                                                     REPH_POS_AFTER_MAIN, REPH_MODE_EXPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
-  {HB_SCRIPT_KHMER,     false,0x17D2u,BASE_POS_FIRST,REPH_POS_DONT_CARE,  REPH_MODE_VIS_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_2},
-  {HB_SCRIPT_JAVANESE,  false,0xA9C0u,BASE_POS_FIRST,REPH_POS_DONT_CARE,  REPH_MODE_VIS_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_1},
+                                                     REPH_POS_AFTER_MAIN, REPH_MODE_EXPLICIT, BLWF_MODE_PRE_AND_POST},
+  {HB_SCRIPT_KHMER,     false,0x17D2u,BASE_POS_FIRST,REPH_POS_DONT_CARE,  REPH_MODE_VIS_REPHA,BLWF_MODE_PRE_AND_POST},
 };
 
 
@@ -512,12 +478,12 @@
     hb_codepoint_t glyph = virama_glyph;
     if (unlikely (virama_glyph == (hb_codepoint_t) -1))
     {
-      if (!config->virama || !font->get_glyph (config->virama, 0, &glyph))
+      if (!config->virama || !font->get_nominal_glyph (config->virama, &glyph))
         glyph = 0;
       /* Technically speaking, the spec says we should apply 'locl' to virama too.
        * Maybe one day... */
 
-      /* Our get_glyph() function needs a font, so we can't get the virama glyph
+      /* Our get_nominal_glyph() function needs a font, so we can't get the virama glyph
        * during shape planning...  Instead, overwrite it here.  It's safe.  Don't worry! */
       (const_cast<indic_shape_plan_t *> (this))->virama_glyph = glyph;
     }
@@ -557,8 +523,15 @@
   indic_plan->virama_glyph = (hb_codepoint_t) -1;
 
   /* Use zero-context would_substitute() matching for new-spec of the main
-   * Indic scripts, and scripts with one spec only, but not for old-specs. */
-  bool zero_context = !indic_plan->is_old_spec;
+   * Indic scripts, and scripts with one spec only, but not for old-specs.
+   * The new-spec for all dual-spec scripts says zero-context matching happens.
+   *
+   * However, testing with Malayalam shows that old and new spec both allow
+   * context.  Testing with Bengali new-spec however shows that it doesn't.
+   * So, the heuristic here is the way it is.  It should *only* be changed,
+   * as we discover more cases of what Windows does.  DON'T TOUCH OTHERWISE.
+   */
+  bool zero_context = !indic_plan->is_old_spec && plan->props.script != HB_SCRIPT_MALAYALAM;
   indic_plan->rphf.init (&plan->map, HB_TAG('r','p','h','f'), zero_context);
   indic_plan->pref.init (&plan->map, HB_TAG('p','r','e','f'), zero_context);
   indic_plan->blwf.init (&plan->map, HB_TAG('b','l','w','f'), zero_context);
@@ -600,12 +573,8 @@
   if (indic_plan->pstf.would_substitute (glyphs  , 2, face) ||
       indic_plan->pstf.would_substitute (glyphs+1, 2, face))
     return POS_POST_C;
-  unsigned int pref_len = indic_plan->config->pref_len;
-  if ((pref_len == PREF_LEN_2 &&
-       (indic_plan->pref.would_substitute (glyphs  , 2, face) ||
-        indic_plan->pref.would_substitute (glyphs+1, 2, face)))
-   || (pref_len == PREF_LEN_1 &&
-       indic_plan->pref.would_substitute (glyphs+1, 1, face)))
+  if (indic_plan->pref.would_substitute (glyphs  , 2, face) ||
+      indic_plan->pref.would_substitute (glyphs+1, 2, face))
     return POS_POST_C;
   return POS_BASE_C;
 }
@@ -754,10 +723,6 @@
 
     switch (indic_plan->config->base_pos)
     {
-      default:
-        assert (false);
-        /* fallthrough */
-
       case BASE_POS_LAST:
       {
         /* -> starting from the end of the syllable, move backwards */
@@ -1115,10 +1080,9 @@
       }
   }
 
-  unsigned int pref_len = indic_plan->config->pref_len;
+  unsigned int pref_len = 2;
   if (indic_plan->mask_array[PREF] && base + pref_len < end)
   {
-    assert (1 <= pref_len && pref_len <= 2);
     /* Find a Halant,Ra sequence and mark it for pre-base reordering processing. */
     for (unsigned int i = base + 1; i + pref_len - 1 < end; i++) {
       hb_codepoint_t glyphs[2];
@@ -1231,7 +1195,7 @@
 
 
   hb_codepoint_t dottedcircle_glyph;
-  if (!font->get_glyph (0x25CCu, 0, &dottedcircle_glyph))
+  if (!font->get_nominal_glyph (0x25CCu, &dottedcircle_glyph))
     return;
 
   hb_glyph_info_t dottedcircle = {0};
@@ -1243,7 +1207,7 @@
 
   buffer->idx = 0;
   unsigned int last_syllable = 0;
-  while (buffer->idx < buffer->len)
+  while (buffer->idx < buffer->len && !buffer->in_error)
   {
     unsigned int syllable = buffer->cur().syllable();
     syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F);
@@ -1251,19 +1215,19 @@
     {
       last_syllable = syllable;
 
-      hb_glyph_info_t info = dottedcircle;
-      info.cluster = buffer->cur().cluster;
-      info.mask = buffer->cur().mask;
-      info.syllable() = buffer->cur().syllable();
+      hb_glyph_info_t ginfo = dottedcircle;
+      ginfo.cluster = buffer->cur().cluster;
+      ginfo.mask = buffer->cur().mask;
+      ginfo.syllable() = buffer->cur().syllable();
       /* TODO Set glyph_props? */
 
       /* Insert dottedcircle after possible Repha. */
-      while (buffer->idx < buffer->len &&
+      while (buffer->idx < buffer->len && !buffer->in_error &&
              last_syllable == buffer->cur().syllable() &&
              buffer->cur().indic_category() == OT_Repha)
         buffer->next_glyph ();
 
-      buffer->output_info (info);
+      buffer->output_info (ginfo);
     }
     else
       buffer->next_glyph ();
@@ -1328,7 +1292,7 @@
   for (base = start; base < end; base++)
     if (info[base].indic_position() >= POS_BASE_C)
     {
-      if (try_pref && base + 1 < end && indic_plan->config->pref_len == 2)
+      if (try_pref && base + 1 < end)
       {
         for (unsigned int i = base + 1; i < end; i++)
           if ((info[i].mask & indic_plan->mask_array[PREF]) != 0)
@@ -1348,6 +1312,25 @@
             break;
           }
       }
+      /* For Malayalam, skip over unformed below- (but NOT post-) forms. */
+      if (buffer->props.script == HB_SCRIPT_MALAYALAM)
+      {
+        for (unsigned int i = base + 1; i < end; i++)
+        {
+          while (i < end && is_joiner (info[i]))
+            i++;
+          if (i == end || !is_halant_or_coeng (info[i]))
+            break;
+          i++; /* Skip halant. */
+          while (i < end && is_joiner (info[i]))
+            i++;
+          if (i < end && is_consonant (info[i]) && info[i].indic_position() == POS_BELOW_C)
+          {
+            base = i;
+            info[base].indic_position() = POS_BASE_C;
+          }
+        }
+      }
 
       if (start < base && info[base].indic_position() > POS_BASE_C)
         base--;
@@ -1591,7 +1574,6 @@
 
   if (try_pref && base + 1 < end) /* Otherwise there can't be any pre-base reordering Ra. */
   {
-    unsigned int pref_len = indic_plan->config->pref_len;
     for (unsigned int i = base + 1; i < end; i++)
       if ((info[i].mask & indic_plan->mask_array[PREF]) != 0)
       {
@@ -1602,10 +1584,8 @@
         /* Note: We just check that something got substituted.  We don't check that
          * the <pref> feature actually did it...
          *
-         * If pref len is longer than one, then only reorder if it ligated.  If
-         * pref len is one, only reorder if it didn't ligate with other things. */
-        if (_hb_glyph_info_substituted (&info[i]) &&
-            ((pref_len == 1) ^ _hb_glyph_info_ligated_and_didnt_multiply (&info[i])))
+         * Reorder pref only if it ligated. */
+        if (_hb_glyph_info_ligated_and_didnt_multiply (&info[i]))
         {
           /*
            *       2. Try to find a target position the same way as for pre-base matra.
@@ -1631,8 +1611,8 @@
             if (new_pos > start && info[new_pos - 1].indic_category() == OT_M)
             {
               unsigned int old_pos = i;
-              for (unsigned int i = base + 1; i < old_pos; i++)
-                if (info[i].indic_category() == OT_M)
+              for (unsigned int j = base + 1; j < old_pos; j++)
+                if (info[j].indic_category() == OT_M)
                 {
                   new_pos--;
                   break;
@@ -1796,7 +1776,7 @@
     hb_codepoint_t glyph;
 
     if (hb_options ().uniscribe_bug_compatible ||
-        (c->font->get_glyph (ab, 0, &glyph) &&
+        (c->font->get_nominal_glyph (ab, &glyph) &&
          indic_plan->pstf.would_substitute (&glyph, 1, c->font->face)))
     {
       /* Ok, safe to use Uniscribe-style decomposition. */
@@ -1806,7 +1786,7 @@
     }
   }
 
-  return c->unicode->decompose (ab, a, b);
+  return (bool) c->unicode->decompose (ab, a, b);
 }
 
 static bool
@@ -1822,7 +1802,7 @@
   /* Composition-exclusion exceptions that we want to recompose. */
   if (a == 0x09AFu && b == 0x09BCu) { *ab = 0x09DFu; return true; }
 
-  return c->unicode->compose (a, b, ab);
+  return (bool) c->unicode->compose (a, b, ab);
 }
 
 
@@ -1834,6 +1814,7 @@
   data_create_indic,
   data_destroy_indic,
   NULL, /* preprocess_text */
+  NULL, /* postprocess_glyphs */
   HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
   decompose_indic,
   compose_indic,
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-myanmar-machine.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-myanmar-machine.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 
-#line 1 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 1 "../../src/hb-ot-shape-complex-myanmar-machine.rl"
 /*
  * Copyright © 2011,2012  Google, Inc.
  *
@@ -32,7 +32,7 @@
 #include "hb-private.hh"
 
 
-#line 36 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 36 "../../src/hb-ot-shape-complex-myanmar-machine.hh.tmp"
 static const unsigned char _myanmar_syllable_machine_trans_keys[] = {
         1u, 31u, 3u, 30u, 5u, 29u, 5u, 8u, 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u,
         3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 1u, 16u, 3u, 29u, 3u, 29u, 3u, 29u,
@@ -261,11 +261,11 @@
 static const int myanmar_syllable_machine_en_main = 0;
 
 
-#line 36 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 36 "../../src/hb-ot-shape-complex-myanmar-machine.rl"
 
 
 
-#line 93 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 93 "../../src/hb-ot-shape-complex-myanmar-machine.rl"
 
 
 #define found_syllable(syllable_type) \
@@ -285,7 +285,7 @@
   int cs;
   hb_glyph_info_t *info = buffer->info;
 
-#line 289 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 289 "../../src/hb-ot-shape-complex-myanmar-machine.hh.tmp"
         {
         cs = myanmar_syllable_machine_start;
         ts = 0;
@@ -293,7 +293,7 @@
         act = 0;
         }
 
-#line 114 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 114 "../../src/hb-ot-shape-complex-myanmar-machine.rl"
 
 
   p = 0;
@@ -302,7 +302,7 @@
   unsigned int last = 0;
   unsigned int syllable_serial = 1;
 
-#line 306 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 306 "../../src/hb-ot-shape-complex-myanmar-machine.hh.tmp"
         {
         int _slen;
         int _trans;
@@ -316,7 +316,7 @@
 #line 1 "NONE"
         {ts = p;}
         break;
-#line 320 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 320 "../../src/hb-ot-shape-complex-myanmar-machine.hh.tmp"
         }
 
         _keys = _myanmar_syllable_machine_trans_keys + (cs<<1);
@@ -335,38 +335,38 @@
 
         switch ( _myanmar_syllable_machine_trans_actions[_trans] ) {
         case 7:
-#line 85 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 85 "../../src/hb-ot-shape-complex-myanmar-machine.rl"
         {te = p+1;{ found_syllable (consonant_syllable); }}
         break;
         case 5:
-#line 86 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 86 "../../src/hb-ot-shape-complex-myanmar-machine.rl"
         {te = p+1;{ found_syllable (non_myanmar_cluster); }}
         break;
         case 10:
-#line 87 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 87 "../../src/hb-ot-shape-complex-myanmar-machine.rl"
         {te = p+1;{ found_syllable (punctuation_cluster); }}
         break;
         case 4:
-#line 88 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 88 "../../src/hb-ot-shape-complex-myanmar-machine.rl"
         {te = p+1;{ found_syllable (broken_cluster); }}
         break;
         case 3:
-#line 89 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 89 "../../src/hb-ot-shape-complex-myanmar-machine.rl"
         {te = p+1;{ found_syllable (non_myanmar_cluster); }}
         break;
         case 6:
-#line 85 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 85 "../../src/hb-ot-shape-complex-myanmar-machine.rl"
         {te = p;p--;{ found_syllable (consonant_syllable); }}
         break;
         case 8:
-#line 88 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 88 "../../src/hb-ot-shape-complex-myanmar-machine.rl"
         {te = p;p--;{ found_syllable (broken_cluster); }}
         break;
         case 9:
-#line 89 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 89 "../../src/hb-ot-shape-complex-myanmar-machine.rl"
         {te = p;p--;{ found_syllable (non_myanmar_cluster); }}
         break;
-#line 370 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 370 "../../src/hb-ot-shape-complex-myanmar-machine.hh.tmp"
         }
 
 _again:
@@ -375,7 +375,7 @@
 #line 1 "NONE"
         {ts = 0;}
         break;
-#line 379 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 379 "../../src/hb-ot-shape-complex-myanmar-machine.hh.tmp"
         }
 
         if ( ++p != pe )
@@ -391,7 +391,7 @@
 
         }
 
-#line 123 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 123 "../../src/hb-ot-shape-complex-myanmar-machine.rl"
 
 }
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-myanmar.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-myanmar.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -199,6 +199,10 @@
       cat = (indic_category_t) OT_A;
       break;
 
+    case 0x1039u:
+      cat = (indic_category_t) OT_H;
+      break;
+
     case 0x103Au:
       cat = (indic_category_t) OT_As;
       break;
@@ -245,6 +249,11 @@
     case 0x104Au: case 0x104Bu:
       cat = (indic_category_t) OT_P;
       break;
+
+    case 0xAA74u: case 0xAA75u: case 0xAA76u:
+      /* https://github.com/roozbehp/unicode-data/issues/3 */
+      cat = (indic_category_t) OT_C;
+      break;
   }
 
   if (cat == OT_M)
@@ -435,7 +444,7 @@
 
 
   hb_codepoint_t dottedcircle_glyph;
-  if (!font->get_glyph (0x25CCu, 0, &dottedcircle_glyph))
+  if (!font->get_nominal_glyph (0x25CCu, &dottedcircle_glyph))
     return;
 
   hb_glyph_info_t dottedcircle = {0};
@@ -447,7 +456,7 @@
 
   buffer->idx = 0;
   unsigned int last_syllable = 0;
-  while (buffer->idx < buffer->len)
+  while (buffer->idx < buffer->len && !buffer->in_error)
   {
     unsigned int syllable = buffer->cur().syllable();
     syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F);
@@ -455,12 +464,12 @@
     {
       last_syllable = syllable;
 
-      hb_glyph_info_t info = dottedcircle;
-      info.cluster = buffer->cur().cluster;
-      info.mask = buffer->cur().mask;
-      info.syllable() = buffer->cur().syllable();
+      hb_glyph_info_t ginfo = dottedcircle;
+      ginfo.cluster = buffer->cur().cluster;
+      ginfo.mask = buffer->cur().mask;
+      ginfo.syllable() = buffer->cur().syllable();
 
-      buffer->output_info (info);
+      buffer->output_info (ginfo);
     }
     else
       buffer->next_glyph ();
@@ -507,6 +516,7 @@
   NULL, /* data_create */
   NULL, /* data_destroy */
   NULL, /* preprocess_text */
+  NULL, /* postprocess_glyphs */
   HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
   NULL, /* decompose */
   NULL, /* compose */
@@ -523,6 +533,7 @@
   NULL, /* data_create */
   NULL, /* data_destroy */
   NULL, /* preprocess_text */
+  NULL, /* postprocess_glyphs */
   HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
   NULL, /* decompose */
   NULL, /* compose */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-private.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-private.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -41,12 +41,8 @@
 
 enum hb_ot_shape_zero_width_marks_type_t {
   HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
-//  HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_EARLY,
-  HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE,
   HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
-  HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
-
-  HB_OT_SHAPE_ZERO_WIDTH_MARKS_DEFAULT = HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE
+  HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE
 };
 
 
@@ -110,6 +106,15 @@
                            hb_buffer_t              *buffer,
                            hb_font_t                *font);
 
+  /* postprocess_glyphs()
+   * Called during shape().
+   * Shapers can use to modify glyphs after shaping ends.
+   * May be NULL.
+   */
+  void (*postprocess_glyphs) (const hb_ot_shape_plan_t *plan,
+                              hb_buffer_t              *buffer,
+                              hb_font_t                *font);
+
 
   hb_ot_shape_normalization_mode_t normalization_preference;
 
@@ -236,9 +241,6 @@
     /* Unicode-3.0 additions */
     case HB_SCRIPT_SINHALA:
 
-    /* Unicode-5.2 additions */
-    case HB_SCRIPT_JAVANESE:
-
       /* If the designer designed the font for the 'DFLT' script,
        * use the default shaper.  Otherwise, use the specific shaper.
        * Note that for some simple scripts, there may not be *any*
@@ -311,7 +313,7 @@
 
     /* Unicode-5.2 additions */
     case HB_SCRIPT_EGYPTIAN_HIEROGLYPHS:
-    //case HB_SCRIPT_JAVANESE:
+    case HB_SCRIPT_JAVANESE:
     case HB_SCRIPT_KAITHI:
     case HB_SCRIPT_MEETEI_MAYEK:
     case HB_SCRIPT_TAI_THAM:
@@ -340,6 +342,15 @@
     case HB_SCRIPT_SIDDHAM:
     case HB_SCRIPT_TIRHUTA:
 
+    /* Unicode-8.0 additions */
+    case HB_SCRIPT_AHOM:
+    //case HB_SCRIPT_MULTANI:
+
+    /* Unicode-9.0 additions */
+    case HB_SCRIPT_BHAIKSUKI:
+    case HB_SCRIPT_MARCHEN:
+    case HB_SCRIPT_NEWA:
+
       /* If the designer designed the font for the 'DFLT' script,
        * use the default shaper.  Otherwise, use the specific shaper.
        * Note that for some simple scripts, there may not be *any*
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-thai.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-thai.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -139,7 +139,6 @@
   };
 
   switch (action) {
-    default: assert (false); /* Fallthrough */
     case NOP: return u;
     case SD:  pua_mappings = SD_mappings; break;
     case SDL: pua_mappings = SDL_mappings; break;
@@ -315,7 +314,7 @@
 
   buffer->clear_output ();
   unsigned int count = buffer->len;
-  for (buffer->idx = 0; buffer->idx < count;)
+  for (buffer->idx = 0; buffer->idx < count && !buffer->in_error;)
   {
     hb_codepoint_t u = buffer->cur().codepoint;
     if (likely (!IS_SARA_AM (u))) {
@@ -330,7 +329,7 @@
     if (unlikely (buffer->in_error))
       return;
 
-    /* Make Nikhahit be recognized as a mark when zeroing widths. */
+    /* Make Nikhahit be recognized as a ccc=0 mark when zeroing widths. */
     unsigned int end = buffer->out_len;
     _hb_glyph_info_set_general_category (&buffer->out_info[end - 2], HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK);
 
@@ -372,10 +371,11 @@
   NULL, /* data_create */
   NULL, /* data_destroy */
   preprocess_text_thai,
+  NULL, /* postprocess_glyphs */
   HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
   NULL, /* decompose */
   NULL, /* compose */
   NULL, /* setup_masks */
-  HB_OT_SHAPE_ZERO_WIDTH_MARKS_DEFAULT,
+  HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
   false,/* fallback_position */
 };
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-tibetan.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-tibetan.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -52,10 +52,11 @@
   NULL, /* data_create */
   NULL, /* data_destroy */
   NULL, /* preprocess_text */
+  NULL, /* postprocess_glyphs */
   HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
   NULL, /* decompose */
   NULL, /* compose */
   NULL, /* setup_masks */
-  HB_OT_SHAPE_ZERO_WIDTH_MARKS_DEFAULT,
+  HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
   true, /* fallback_position */
 };
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use-machine.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use-machine.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -36,291 +36,222 @@
 
 #line 38 "hb-ot-shape-complex-use-machine.hh"
 static const unsigned char _use_syllable_machine_trans_keys[] = {
-        0u, 0u, 4u, 4u, 1u, 1u, 0u, 39u, 21u, 21u, 8u, 39u, 8u, 39u, 1u, 1u,
-        8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u,
-        8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
-        8u, 39u, 8u, 39u, 8u, 39u, 1u, 1u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u,
+        1u, 1u, 0u, 39u, 21u, 21u, 8u, 39u, 8u, 39u, 1u, 1u, 8u, 39u, 8u, 39u,
+        8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
+        8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 13u, 21u,
+        4u, 4u, 13u, 13u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u,
         8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
-        8u, 39u, 12u, 21u, 12u, 13u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u,
-        8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
-        8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 1u, 39u, 8u, 39u, 21u, 42u, 41u, 42u,
+        8u, 39u, 8u, 39u, 8u, 39u, 1u, 1u, 1u, 39u, 8u, 39u, 21u, 42u, 41u, 42u,
         42u, 42u, 0
 };
 
 static const char _use_syllable_machine_key_spans[] = {
-        0, 1, 1, 40, 1, 32, 32, 1,
-        32, 32, 32, 19, 19, 19, 32, 32,
-        32, 32, 32, 32, 32, 32, 32, 32,
-        32, 32, 32, 1, 32, 32, 19, 19,
+        1, 40, 1, 32, 32, 1, 32, 32,
+        32, 19, 19, 19, 32, 32, 32, 32,
+        32, 32, 32, 32, 32, 32, 32, 9,
+        1, 1, 32, 32, 32, 32, 19, 19,
         19, 32, 32, 32, 32, 32, 32, 32,
-        32, 10, 2, 32, 32, 32, 32, 19,
-        19, 19, 32, 32, 32, 32, 32, 32,
-        32, 32, 32, 32, 39, 32, 22, 2,
+        32, 32, 32, 1, 39, 32, 22, 2,
         1
 };
 
 static const short _use_syllable_machine_index_offsets[] = {
-        0, 0, 2, 4, 45, 47, 80, 113,
-        115, 148, 181, 214, 234, 254, 274, 307,
-        340, 373, 406, 439, 472, 505, 538, 571,
-        604, 637, 670, 703, 705, 738, 771, 791,
-        811, 831, 864, 897, 930, 963, 996, 1029,
-        1062, 1095, 1106, 1109, 1142, 1175, 1208, 1241,
-        1261, 1281, 1301, 1334, 1367, 1400, 1433, 1466,
-        1499, 1532, 1565, 1598, 1631, 1671, 1704, 1727,
-        1730
+        0, 2, 43, 45, 78, 111, 113, 146,
+        179, 212, 232, 252, 272, 305, 338, 371,
+        404, 437, 470, 503, 536, 569, 602, 635,
+        645, 647, 649, 682, 715, 748, 781, 801,
+        821, 841, 874, 907, 940, 973, 1006, 1039,
+        1072, 1105, 1138, 1171, 1173, 1213, 1246, 1269,
+        1272
 };
 
 static const char _use_syllable_machine_indicies[] = {
-        1, 0, 3, 2, 4, 5, 6,
-        4, 1, 5, 8, 8, 7, 8, 8,
-        3, 9, 8, 8, 8, 4, 4, 10,
-        11, 8, 8, 12, 13, 14, 15, 16,
-        17, 18, 12, 19, 20, 21, 22, 23,
-        24, 8, 25, 26, 27, 8, 29, 28,
-        31, 30, 30, 32, 33, 30, 30, 30,
-        30, 30, 30, 30, 30, 34, 35, 36,
-        37, 38, 39, 40, 41, 35, 42, 34,
-        43, 44, 45, 46, 30, 47, 48, 49,
-        30, 31, 30, 30, 32, 33, 30, 30,
-        30, 30, 30, 30, 30, 30, 50, 35,
-        36, 37, 38, 39, 40, 41, 35, 42,
-        43, 43, 44, 45, 46, 30, 47, 48,
-        49, 30, 32, 51, 31, 30, 30, 32,
-        33, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 35, 36, 37, 38, 39, 40,
-        41, 35, 42, 43, 43, 44, 45, 46,
-        30, 47, 48, 49, 30, 31, 30, 30,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 30, 35, 36, 37, 38, 39,
-        30, 30, 30, 30, 30, 30, 44, 45,
-        46, 30, 47, 48, 49, 30, 31, 30,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 30, 30, 30, 36, 37, 38,
-        39, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 30, 47, 48, 49, 30, 31,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 30, 30, 30, 30, 30, 37,
-        38, 39, 30, 31, 30, 30, 30, 30,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 30, 30, 38, 39, 30, 31,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        30, 39, 30, 31, 30, 30, 30, 30,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 30, 37, 38, 39, 30, 30,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        47, 48, 49, 30, 31, 30, 30, 30,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 30, 30, 37, 38, 39, 30,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 48, 49, 30, 31, 30, 30,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 30, 30, 30, 37, 38, 39,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 30, 30, 49, 30, 31, 30,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 30, 30, 30, 36, 37, 38,
-        39, 30, 30, 30, 30, 30, 30, 44,
-        45, 46, 30, 47, 48, 49, 30, 31,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 30, 30, 30, 30, 36, 37,
-        38, 39, 30, 30, 30, 30, 30, 30,
-        30, 45, 46, 30, 47, 48, 49, 30,
-        31, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 30, 30, 30, 30, 30, 36,
-        37, 38, 39, 30, 30, 30, 30, 30,
-        30, 30, 30, 46, 30, 47, 48, 49,
-        30, 31, 30, 30, 30, 30, 30, 30,
-        30, 30, 30, 30, 30, 30, 30, 35,
-        36, 37, 38, 39, 30, 41, 35, 30,
-        30, 30, 44, 45, 46, 30, 47, 48,
-        49, 30, 31, 30, 30, 30, 30, 30,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        35, 36, 37, 38, 39, 30, 30, 35,
-        30, 30, 30, 44, 45, 46, 30, 47,
-        48, 49, 30, 31, 30, 30, 30, 30,
-        30, 30, 30, 30, 30, 30, 30, 30,
-        30, 35, 36, 37, 38, 39, 40, 41,
-        35, 30, 30, 30, 44, 45, 46, 30,
-        47, 48, 49, 30, 31, 30, 30, 32,
-        33, 30, 30, 30, 30, 30, 30, 30,
-        30, 30, 35, 36, 37, 38, 39, 40,
-        41, 35, 42, 30, 43, 44, 45, 46,
-        30, 47, 48, 49, 30, 31, 30, 30,
-        32, 33, 30, 30, 30, 30, 30, 30,
-        30, 30, 30, 35, 36, 37, 38, 39,
-        40, 41, 35, 42, 34, 43, 44, 45,
-        46, 30, 47, 48, 49, 30, 53, 52,
-        52, 54, 55, 52, 52, 52, 52, 52,
-        52, 52, 52, 56, 52, 57, 58, 59,
-        60, 61, 62, 57, 63, 56, 64, 52,
-        52, 52, 52, 65, 66, 67, 52, 53,
-        52, 52, 54, 55, 52, 52, 52, 52,
-        52, 52, 52, 52, 68, 52, 57, 58,
-        59, 60, 61, 62, 57, 63, 64, 64,
-        52, 52, 52, 52, 65, 66, 67, 52,
-        54, 51, 53, 52, 52, 54, 55, 52,
-        52, 52, 52, 52, 52, 52, 52, 52,
-        52, 57, 58, 59, 60, 61, 62, 57,
-        63, 64, 64, 52, 52, 52, 52, 65,
-        66, 67, 52, 53, 52, 52, 52, 52,
-        52, 52, 52, 52, 52, 52, 52, 52,
-        52, 52, 57, 58, 59, 60, 52, 52,
-        52, 52, 52, 52, 52, 52, 52, 52,
-        65, 66, 67, 52, 53, 52, 52, 52,
-        52, 52, 52, 52, 52, 52, 52, 52,
-        52, 52, 52, 52, 58, 59, 60, 52,
-        53, 52, 52, 52, 52, 52, 52, 52,
-        52, 52, 52, 52, 52, 52, 52, 52,
-        52, 59, 60, 52, 53, 52, 52, 52,
-        52, 52, 52, 52, 52, 52, 52, 52,
-        52, 52, 52, 52, 52, 52, 60, 52,
-        53, 52, 52, 52, 52, 52, 52, 52,
-        52, 52, 52, 52, 52, 52, 52, 52,
-        58, 59, 60, 52, 52, 52, 52, 52,
-        52, 52, 52, 52, 52, 65, 66, 67,
-        52, 53, 52, 52, 52, 52, 52, 52,
-        52, 52, 52, 52, 52, 52, 52, 52,
-        52, 58, 59, 60, 52, 52, 52, 52,
-        52, 52, 52, 52, 52, 52, 52, 66,
-        67, 52, 53, 52, 52, 52, 52, 52,
-        52, 52, 52, 52, 52, 52, 52, 52,
-        52, 52, 58, 59, 60, 52, 52, 52,
-        52, 52, 52, 52, 52, 52, 52, 52,
-        52, 67, 52, 53, 52, 52, 52, 52,
-        52, 52, 52, 52, 52, 52, 52, 52,
-        52, 52, 57, 58, 59, 60, 52, 62,
-        57, 52, 52, 52, 52, 52, 52, 52,
-        65, 66, 67, 52, 53, 52, 52, 52,
-        52, 52, 52, 52, 52, 52, 52, 52,
-        52, 52, 52, 57, 58, 59, 60, 52,
-        52, 57, 52, 52, 52, 52, 52, 52,
-        52, 65, 66, 67, 52, 53, 52, 52,
-        52, 52, 52, 52, 52, 52, 52, 52,
-        52, 52, 52, 52, 57, 58, 59, 60,
-        61, 62, 57, 52, 52, 52, 52, 52,
-        52, 52, 65, 66, 67, 52, 53, 52,
-        52, 54, 55, 52, 52, 52, 52, 52,
-        52, 52, 52, 52, 52, 57, 58, 59,
-        60, 61, 62, 57, 63, 52, 64, 52,
-        52, 52, 52, 65, 66, 67, 52, 53,
-        52, 52, 54, 55, 52, 52, 52, 52,
-        52, 52, 52, 52, 52, 52, 57, 58,
-        59, 60, 61, 62, 57, 63, 56, 64,
-        52, 52, 52, 52, 65, 66, 67, 52,
-        70, 71, 69, 69, 69, 69, 69, 69,
-        69, 72, 69, 70, 71, 69, 7, 73,
-        73, 3, 9, 73, 73, 73, 73, 73,
-        73, 73, 73, 74, 12, 13, 14, 15,
-        16, 17, 18, 12, 19, 21, 21, 22,
-        23, 24, 73, 25, 26, 27, 73, 7,
-        73, 73, 3, 9, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 12, 13, 14,
-        15, 16, 17, 18, 12, 19, 21, 21,
-        22, 23, 24, 73, 25, 26, 27, 73,
-        7, 73, 73, 73, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 73, 12, 13,
-        14, 15, 16, 73, 73, 73, 73, 73,
-        73, 22, 23, 24, 73, 25, 26, 27,
-        73, 7, 73, 73, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 73, 73, 73,
-        13, 14, 15, 16, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 73, 25, 26,
-        27, 73, 7, 73, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 73, 73, 73,
-        73, 73, 14, 15, 16, 73, 7, 73,
-        73, 73, 73, 73, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 73, 73, 15,
-        16, 73, 7, 73, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 73, 73, 73,
-        73, 73, 73, 73, 16, 73, 7, 73,
-        73, 73, 73, 73, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 73, 14, 15,
-        16, 73, 73, 73, 73, 73, 73, 73,
-        73, 73, 73, 25, 26, 27, 73, 7,
-        73, 73, 73, 73, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 73, 73, 14,
-        15, 16, 73, 73, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 26, 27, 73,
-        7, 73, 73, 73, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 73, 73, 73,
-        14, 15, 16, 73, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 73, 73, 27,
-        73, 7, 73, 73, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 73, 73, 73,
-        13, 14, 15, 16, 73, 73, 73, 73,
-        73, 73, 22, 23, 24, 73, 25, 26,
-        27, 73, 7, 73, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 73, 73, 73,
-        73, 13, 14, 15, 16, 73, 73, 73,
-        73, 73, 73, 73, 23, 24, 73, 25,
-        26, 27, 73, 7, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 73, 73, 73,
-        73, 73, 13, 14, 15, 16, 73, 73,
-        73, 73, 73, 73, 73, 73, 24, 73,
-        25, 26, 27, 73, 7, 73, 73, 73,
-        73, 73, 73, 73, 73, 73, 73, 73,
-        73, 73, 12, 13, 14, 15, 16, 73,
-        18, 12, 73, 73, 73, 22, 23, 24,
-        73, 25, 26, 27, 73, 7, 73, 73,
-        73, 73, 73, 73, 73, 73, 73, 73,
-        73, 73, 73, 12, 13, 14, 15, 16,
-        73, 73, 12, 73, 73, 73, 22, 23,
-        24, 73, 25, 26, 27, 73, 7, 73,
-        73, 73, 73, 73, 73, 73, 73, 73,
-        73, 73, 73, 73, 12, 13, 14, 15,
-        16, 17, 18, 12, 73, 73, 73, 22,
-        23, 24, 73, 25, 26, 27, 73, 7,
-        73, 73, 3, 9, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 12, 13, 14,
-        15, 16, 17, 18, 12, 19, 73, 21,
-        22, 23, 24, 73, 25, 26, 27, 73,
-        5, 6, 73, 73, 5, 73, 73, 7,
-        73, 73, 3, 9, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 12, 13, 14,
-        15, 16, 17, 18, 12, 19, 20, 21,
-        22, 23, 24, 73, 25, 26, 27, 73,
-        7, 73, 73, 3, 9, 73, 73, 73,
-        73, 73, 73, 73, 73, 73, 12, 13,
-        14, 15, 16, 17, 18, 12, 19, 20,
-        21, 22, 23, 24, 73, 25, 26, 27,
-        73, 76, 75, 75, 75, 75, 75, 75,
-        75, 75, 75, 75, 75, 75, 75, 75,
-        75, 75, 75, 75, 75, 76, 77, 75,
-        76, 77, 75, 77, 75, 0
+        1, 0, 2, 3, 4, 2, 5, 3,
+        4, 4, 6, 4, 4, 1, 7, 4,
+        4, 4, 2, 2, 8, 9, 4, 4,
+        10, 11, 12, 13, 14, 15, 16, 10,
+        17, 18, 19, 20, 21, 22, 4, 23,
+        24, 25, 4, 27, 26, 29, 28, 28,
+        30, 31, 28, 28, 28, 28, 28, 28,
+        28, 28, 32, 33, 34, 35, 36, 37,
+        38, 39, 33, 40, 32, 41, 42, 43,
+        44, 28, 45, 46, 47, 28, 29, 28,
+        28, 30, 31, 28, 28, 28, 28, 28,
+        28, 28, 28, 48, 33, 34, 35, 36,
+        37, 38, 39, 33, 40, 41, 41, 42,
+        43, 44, 28, 45, 46, 47, 28, 30,
+        49, 29, 28, 28, 30, 31, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 33,
+        34, 35, 36, 37, 38, 39, 33, 40,
+        41, 41, 42, 43, 44, 28, 45, 46,
+        47, 28, 29, 28, 28, 28, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        33, 34, 35, 36, 37, 28, 28, 28,
+        28, 28, 28, 42, 43, 44, 28, 45,
+        46, 47, 28, 29, 28, 28, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        28, 28, 34, 35, 36, 37, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        45, 46, 47, 28, 29, 28, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        28, 28, 28, 28, 35, 36, 37, 28,
+        29, 28, 28, 28, 28, 28, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        28, 36, 37, 28, 29, 28, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        28, 28, 28, 28, 28, 28, 37, 28,
+        29, 28, 28, 28, 28, 28, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        35, 36, 37, 28, 28, 28, 28, 28,
+        28, 28, 28, 28, 28, 45, 46, 47,
+        28, 29, 28, 28, 28, 28, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        28, 35, 36, 37, 28, 28, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 46,
+        47, 28, 29, 28, 28, 28, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        28, 28, 35, 36, 37, 28, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        28, 47, 28, 29, 28, 28, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        28, 28, 34, 35, 36, 37, 28, 28,
+        28, 28, 28, 28, 42, 43, 44, 28,
+        45, 46, 47, 28, 29, 28, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        28, 28, 28, 34, 35, 36, 37, 28,
+        28, 28, 28, 28, 28, 28, 43, 44,
+        28, 45, 46, 47, 28, 29, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        28, 28, 28, 28, 34, 35, 36, 37,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        44, 28, 45, 46, 47, 28, 29, 28,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        28, 28, 28, 28, 33, 34, 35, 36,
+        37, 28, 39, 33, 28, 28, 28, 42,
+        43, 44, 28, 45, 46, 47, 28, 29,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        28, 28, 28, 28, 28, 33, 34, 35,
+        36, 37, 28, 28, 33, 28, 28, 28,
+        42, 43, 44, 28, 45, 46, 47, 28,
+        29, 28, 28, 28, 28, 28, 28, 28,
+        28, 28, 28, 28, 28, 28, 33, 34,
+        35, 36, 37, 38, 39, 33, 28, 28,
+        28, 42, 43, 44, 28, 45, 46, 47,
+        28, 29, 28, 28, 30, 31, 28, 28,
+        28, 28, 28, 28, 28, 28, 28, 33,
+        34, 35, 36, 37, 38, 39, 33, 40,
+        28, 41, 42, 43, 44, 28, 45, 46,
+        47, 28, 29, 28, 28, 30, 31, 28,
+        28, 28, 28, 28, 28, 28, 28, 28,
+        33, 34, 35, 36, 37, 38, 39, 33,
+        40, 32, 41, 42, 43, 44, 28, 45,
+        46, 47, 28, 51, 50, 50, 50, 50,
+        50, 50, 50, 52, 50, 5, 53, 51,
+        50, 6, 54, 54, 1, 55, 54, 54,
+        54, 54, 54, 54, 54, 54, 56, 10,
+        11, 12, 13, 14, 15, 16, 10, 17,
+        19, 19, 20, 21, 22, 54, 23, 24,
+        25, 54, 6, 54, 54, 1, 55, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        10, 11, 12, 13, 14, 15, 16, 10,
+        17, 19, 19, 20, 21, 22, 54, 23,
+        24, 25, 54, 6, 54, 54, 54, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        54, 10, 11, 12, 13, 14, 54, 54,
+        54, 54, 54, 54, 20, 21, 22, 54,
+        23, 24, 25, 54, 6, 54, 54, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        54, 54, 54, 11, 12, 13, 14, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        54, 23, 24, 25, 54, 6, 54, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        54, 54, 54, 54, 54, 12, 13, 14,
+        54, 6, 54, 54, 54, 54, 54, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        54, 54, 13, 14, 54, 6, 54, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        54, 54, 54, 54, 54, 54, 54, 14,
+        54, 6, 54, 54, 54, 54, 54, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        54, 12, 13, 14, 54, 54, 54, 54,
+        54, 54, 54, 54, 54, 54, 23, 24,
+        25, 54, 6, 54, 54, 54, 54, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        54, 54, 12, 13, 14, 54, 54, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        24, 25, 54, 6, 54, 54, 54, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        54, 54, 54, 12, 13, 14, 54, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        54, 54, 25, 54, 6, 54, 54, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        54, 54, 54, 11, 12, 13, 14, 54,
+        54, 54, 54, 54, 54, 20, 21, 22,
+        54, 23, 24, 25, 54, 6, 54, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        54, 54, 54, 54, 11, 12, 13, 14,
+        54, 54, 54, 54, 54, 54, 54, 21,
+        22, 54, 23, 24, 25, 54, 6, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        54, 54, 54, 54, 54, 11, 12, 13,
+        14, 54, 54, 54, 54, 54, 54, 54,
+        54, 22, 54, 23, 24, 25, 54, 6,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        54, 54, 54, 54, 54, 10, 11, 12,
+        13, 14, 54, 16, 10, 54, 54, 54,
+        20, 21, 22, 54, 23, 24, 25, 54,
+        6, 54, 54, 54, 54, 54, 54, 54,
+        54, 54, 54, 54, 54, 54, 10, 11,
+        12, 13, 14, 54, 54, 10, 54, 54,
+        54, 20, 21, 22, 54, 23, 24, 25,
+        54, 6, 54, 54, 54, 54, 54, 54,
+        54, 54, 54, 54, 54, 54, 54, 10,
+        11, 12, 13, 14, 15, 16, 10, 54,
+        54, 54, 20, 21, 22, 54, 23, 24,
+        25, 54, 6, 54, 54, 1, 55, 54,
+        54, 54, 54, 54, 54, 54, 54, 54,
+        10, 11, 12, 13, 14, 15, 16, 10,
+        17, 54, 19, 20, 21, 22, 54, 23,
+        24, 25, 54, 1, 57, 3, 54, 54,
+        54, 3, 54, 54, 6, 54, 54, 1,
+        55, 54, 54, 54, 54, 54, 54, 54,
+        54, 54, 10, 11, 12, 13, 14, 15,
+        16, 10, 17, 18, 19, 20, 21, 22,
+        54, 23, 24, 25, 54, 6, 54, 54,
+        1, 55, 54, 54, 54, 54, 54, 54,
+        54, 54, 54, 10, 11, 12, 13, 14,
+        15, 16, 10, 17, 18, 19, 20, 21,
+        22, 54, 23, 24, 25, 54, 59, 58,
+        58, 58, 58, 58, 58, 58, 58, 58,
+        58, 58, 58, 58, 58, 58, 58, 58,
+        58, 58, 59, 60, 58, 59, 60, 58,
+        60, 58, 0
 };
 
 static const char _use_syllable_machine_trans_targs[] = {
-        3, 41, 3, 43, 4, 5, 25, 3,
-        0, 2, 60, 62, 45, 46, 47, 48,
-        49, 56, 57, 58, 61, 59, 53, 54,
-        55, 50, 51, 52, 3, 3, 3, 3,
-        6, 7, 24, 9, 10, 11, 12, 13,
-        20, 21, 22, 23, 17, 18, 19, 14,
-        15, 16, 8, 3, 3, 3, 26, 27,
-        40, 29, 30, 31, 32, 36, 37, 38,
-        39, 33, 34, 35, 28, 3, 3, 1,
-        42, 3, 44, 3, 63, 64
+        1, 26, 2, 3, 1, 23, 1, 43,
+        44, 46, 28, 29, 30, 31, 32, 39,
+        40, 41, 45, 42, 36, 37, 38, 33,
+        34, 35, 1, 1, 1, 1, 4, 5,
+        22, 7, 8, 9, 10, 11, 18, 19,
+        20, 21, 15, 16, 17, 12, 13, 14,
+        6, 1, 1, 24, 25, 1, 1, 0,
+        27, 1, 1, 47, 48
 };
 
 static const char _use_syllable_machine_trans_actions[] = {
-        1, 2, 3, 4, 0, 0, 0, 7,
-        0, 0, 4, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 4, 4, 0, 0,
-        0, 0, 0, 0, 8, 9, 10, 11,
+        1, 2, 0, 0, 5, 0, 6, 0,
+        2, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 2, 2, 0, 0, 0, 0,
+        0, 0, 7, 8, 9, 10, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 12, 13, 14, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 15, 16, 0,
-        2, 17, 4, 18, 0, 0
+        0, 11, 12, 0, 0, 13, 14, 0,
+        2, 15, 16, 0, 0
 };
 
 static const char _use_syllable_machine_to_state_actions[] = {
-        0, 0, 0, 5, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 3, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
@@ -330,9 +261,7 @@
 };
 
 static const char _use_syllable_machine_from_state_actions[] = {
-        0, 0, 0, 6, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 4, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
@@ -342,29 +271,27 @@
 };
 
 static const short _use_syllable_machine_eof_trans[] = {
-        0, 1, 3, 0, 29, 31, 31, 52,
-        31, 31, 31, 31, 31, 31, 31, 31,
-        31, 31, 31, 31, 31, 31, 31, 31,
-        31, 53, 53, 52, 53, 53, 53, 53,
-        53, 53, 53, 53, 53, 53, 53, 53,
-        53, 70, 70, 74, 74, 74, 74, 74,
-        74, 74, 74, 74, 74, 74, 74, 74,
-        74, 74, 74, 74, 74, 74, 76, 76,
-        76
+        1, 0, 27, 29, 29, 50, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 51,
+        54, 51, 55, 55, 55, 55, 55, 55,
+        55, 55, 55, 55, 55, 55, 55, 55,
+        55, 55, 55, 58, 55, 55, 59, 59,
+        59
 };
 
-static const int use_syllable_machine_start = 3;
-static const int use_syllable_machine_first_final = 3;
-static const int use_syllable_machine_error = 0;
+static const int use_syllable_machine_start = 1;
+static const int use_syllable_machine_first_final = 1;
+static const int use_syllable_machine_error = -1;
 
-static const int use_syllable_machine_en_main = 3;
+static const int use_syllable_machine_en_main = 1;
 
 
 #line 38 "hb-ot-shape-complex-use-machine.rl"
 
 
 
-#line 145 "hb-ot-shape-complex-use-machine.rl"
+#line 138 "hb-ot-shape-complex-use-machine.rl"
 
 
 #define found_syllable(syllable_type) \
@@ -384,7 +311,7 @@
   int cs;
   hb_glyph_info_t *info = buffer->info;
 
-#line 388 "hb-ot-shape-complex-use-machine.hh"
+#line 315 "hb-ot-shape-complex-use-machine.hh"
         {
         cs = use_syllable_machine_start;
         ts = 0;
@@ -392,7 +319,7 @@
         act = 0;
         }
 
-#line 166 "hb-ot-shape-complex-use-machine.rl"
+#line 159 "hb-ot-shape-complex-use-machine.rl"
 
 
   p = 0;
@@ -401,7 +328,7 @@
   unsigned int last = 0;
   unsigned int syllable_serial = 1;
 
-#line 405 "hb-ot-shape-complex-use-machine.hh"
+#line 332 "hb-ot-shape-complex-use-machine.hh"
         {
         int _slen;
         int _trans;
@@ -409,15 +336,13 @@
         const char *_inds;
         if ( p == pe )
                 goto _test_eof;
-        if ( cs == 0 )
-                goto _out;
 _resume:
         switch ( _use_syllable_machine_from_state_actions[cs] ) {
-        case 6:
+        case 4:
 #line 1 "NONE"
         {ts = p;}
         break;
-#line 421 "hb-ot-shape-complex-use-machine.hh"
+#line 346 "hb-ot-shape-complex-use-machine.hh"
         }
 
         _keys = _use_syllable_machine_trans_keys + (cs<<1);
@@ -439,92 +364,70 @@
 #line 1 "NONE"
         {te = p+1;}
         break;
-        case 9:
+        case 8:
+#line 127 "hb-ot-shape-complex-use-machine.rl"
+        {te = p+1;{ found_syllable (independent_cluster); }}
+        break;
+        case 10:
+#line 129 "hb-ot-shape-complex-use-machine.rl"
+        {te = p+1;{ found_syllable (standard_cluster); }}
+        break;
+        case 6:
+#line 133 "hb-ot-shape-complex-use-machine.rl"
+        {te = p+1;{ found_syllable (broken_cluster); }}
+        break;
+        case 5:
 #line 134 "hb-ot-shape-complex-use-machine.rl"
-        {te = p+1;{ found_syllable (independent_cluster); }}
+        {te = p+1;{ found_syllable (non_cluster); }}
+        break;
+        case 7:
+#line 127 "hb-ot-shape-complex-use-machine.rl"
+        {te = p;p--;{ found_syllable (independent_cluster); }}
         break;
         case 11:
-#line 136 "hb-ot-shape-complex-use-machine.rl"
-        {te = p+1;{ found_syllable (consonant_cluster); }}
-        break;
-        case 14:
-#line 137 "hb-ot-shape-complex-use-machine.rl"
-        {te = p+1;{ found_syllable (vowel_cluster); }}
-        break;
-        case 16:
-#line 138 "hb-ot-shape-complex-use-machine.rl"
-        {te = p+1;{ found_syllable (number_joiner_terminated_cluster); }}
-        break;
-        case 7:
-#line 141 "hb-ot-shape-complex-use-machine.rl"
-        {te = p+1;{ found_syllable (broken_cluster); }}
-        break;
-        case 8:
-#line 134 "hb-ot-shape-complex-use-machine.rl"
-        {te = p;p--;{ found_syllable (independent_cluster); }}
-        break;
-        case 12:
-#line 135 "hb-ot-shape-complex-use-machine.rl"
+#line 128 "hb-ot-shape-complex-use-machine.rl"
         {te = p;p--;{ found_syllable (virama_terminated_cluster); }}
         break;
-        case 10:
-#line 136 "hb-ot-shape-complex-use-machine.rl"
-        {te = p;p--;{ found_syllable (consonant_cluster); }}
+        case 9:
+#line 129 "hb-ot-shape-complex-use-machine.rl"
+        {te = p;p--;{ found_syllable (standard_cluster); }}
         break;
         case 13:
-#line 137 "hb-ot-shape-complex-use-machine.rl"
-        {te = p;p--;{ found_syllable (vowel_cluster); }}
+#line 130 "hb-ot-shape-complex-use-machine.rl"
+        {te = p;p--;{ found_syllable (number_joiner_terminated_cluster); }}
         break;
-        case 15:
-#line 139 "hb-ot-shape-complex-use-machine.rl"
+        case 12:
+#line 131 "hb-ot-shape-complex-use-machine.rl"
         {te = p;p--;{ found_syllable (numeral_cluster); }}
         break;
-        case 18:
-#line 140 "hb-ot-shape-complex-use-machine.rl"
+        case 16:
+#line 132 "hb-ot-shape-complex-use-machine.rl"
         {te = p;p--;{ found_syllable (symbol_cluster); }}
         break;
-        case 17:
-#line 141 "hb-ot-shape-complex-use-machine.rl"
+        case 14:
+#line 133 "hb-ot-shape-complex-use-machine.rl"
         {te = p;p--;{ found_syllable (broken_cluster); }}
         break;
+        case 15:
+#line 134 "hb-ot-shape-complex-use-machine.rl"
+        {te = p;p--;{ found_syllable (non_cluster); }}
+        break;
         case 1:
-#line 139 "hb-ot-shape-complex-use-machine.rl"
-        {{p = ((te))-1;}{ found_syllable (numeral_cluster); }}
-        break;
-        case 3:
-#line 1 "NONE"
-        {       switch( act ) {
-        case 0:
-        {{cs = 0; goto _again;}}
+#line 133 "hb-ot-shape-complex-use-machine.rl"
+        {{p = ((te))-1;}{ found_syllable (broken_cluster); }}
         break;
-        case 8:
-        {{p = ((te))-1;} found_syllable (broken_cluster); }
-        break;
-        }
-        }
-        break;
-        case 4:
-#line 1 "NONE"
-        {te = p+1;}
-#line 141 "hb-ot-shape-complex-use-machine.rl"
-        {act = 8;}
-        break;
-#line 513 "hb-ot-shape-complex-use-machine.hh"
+#line 420 "hb-ot-shape-complex-use-machine.hh"
         }
 
 _again:
         switch ( _use_syllable_machine_to_state_actions[cs] ) {
-        case 5:
+        case 3:
 #line 1 "NONE"
         {ts = 0;}
-#line 1 "NONE"
-        {act = 0;}
         break;
-#line 524 "hb-ot-shape-complex-use-machine.hh"
+#line 429 "hb-ot-shape-complex-use-machine.hh"
         }
 
-        if ( cs == 0 )
-                goto _out;
         if ( ++p != pe )
                 goto _resume;
         _test_eof: {}
@@ -536,10 +439,9 @@
         }
         }
 
-        _out: {}
         }
 
-#line 175 "hb-ot-shape-complex-use-machine.rl"
+#line 168 "hb-ot-shape-complex-use-machine.rl"
 
 }
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use-private.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use-private.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -46,7 +46,6 @@
   USE_O         = 0,    /* OTHER */
 
   USE_B         = 1,    /* BASE */
-  USE_IV        = 2,    /* BASE_VOWEL */
   USE_IND       = 3,    /* BASE_IND */
   USE_N         = 4,    /* BASE_NUM */
   USE_GB        = 5,    /* BASE_OTHER */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use-table.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use-table.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -6,12 +6,12 @@
  *
  * on files with these headers:
  *
- * # IndicSyllabicCategory-8.0.0.txt
- * # Date: 2015-05-12, 10:00:00 GMT [RP, KW, LI]
- * # IndicPositionalCategory-8.0.0.txt
- * # Date: 2015-05-12, 10:00:00 GMT [RP, KW, LI]
- * # Blocks-8.0.0.txt
- * # Date: 2014-11-10, 23:04:00 GMT [KW]
+ * # IndicSyllabicCategory-9.0.0.txt
+ * # Date: 2016-05-21, 02:46:00 GMT [RP]
+ * # IndicPositionalCategory-9.0.0.txt
+ * # Date: 2016-02-25, 00:48:00 GMT [RP]
+ * # Blocks-9.0.0.txt
+ * # Date: 2016-02-05, 23:48:00 GMT [KW]
  * UnicodeData.txt does not have a header.
  */
 
@@ -24,7 +24,6 @@
 #define H       USE_H   /* HALANT */
 #define HN      USE_HN  /* HALANT_NUM */
 #define IND     USE_IND /* BASE_IND */
-#define IV      USE_IV  /* BASE_VOWEL */
 #define N       USE_N   /* BASE_NUM */
 #define O       USE_O   /* OTHER */
 #define R       USE_R   /* REPHA */
@@ -80,30 +79,30 @@
 
   /* Devanagari */
 
-  /* 0900 */ VMAbv, VMAbv, VMAbv, VMPst,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,
-  /* 0910 */    IV,    IV,    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0900 */ VMAbv, VMAbv, VMAbv, VMPst,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0910 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 0920 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 0930 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,  VAbv,  VPst, CMBlw,     B,  VPst,  VPre,
   /* 0940 */  VPst,  VBlw,  VBlw,  VBlw,  VBlw,  VAbv,  VAbv,  VAbv,  VAbv,  VPst,  VPst,  VPst,  VPst,     H,  VPre,  VPst,
   /* 0950 */     O, VMAbv, VMBlw,     O,     O,  VAbv,  VBlw,  VBlw,     B,     B,     B,     B,     B,     B,     B,     B,
-  /* 0960 */    IV,    IV,  VBlw,  VBlw,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
-  /* 0970 */     O,     O,    IV,    IV,    IV,    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0960 */     B,     B,  VBlw,  VBlw,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0970 */     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
 
   /* Bengali */
 
-  /* 0980 */     O, VMAbv, VMPst, VMPst,     O,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,     O,     O,    IV,
-  /* 0990 */    IV,     O,     O,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0980 */     O, VMAbv, VMPst, VMPst,     O,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     B,
+  /* 0990 */     B,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 09A0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     B,     B,     B,     B,     B,
   /* 09B0 */     B,     O,     B,     O,     O,     O,     B,     B,     B,     B,     O,     O, CMBlw,     B,  VPst,  VPre,
   /* 09C0 */  VPst,  VBlw,  VBlw,  VBlw,  VBlw,     O,     O,  VPre,  VPre,     O,     O,  VPre,  VPre,     H,   IND,     O,
   /* 09D0 */     O,     O,     O,     O,     O,     O,     O,  VPst,     O,     O,     O,     O,     B,     B,     O,     B,
-  /* 09E0 */    IV,    IV,  VBlw,  VBlw,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 09E0 */     B,     B,  VBlw,  VBlw,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 09F0 */     B,     B,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
 
   /* Gurmukhi */
 
-  /* 0A00 */     O, VMAbv, VMAbv, VMPst,     O,    IV,    IV,    IV,    IV,    IV,    IV,     O,     O,     O,     O,    IV,
-  /* 0A10 */    IV,     O,     O,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0A00 */     O, VMAbv, VMAbv, VMPst,     O,     B,     B,     B,     B,     B,     B,     O,     O,     O,     O,     B,
+  /* 0A10 */     B,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 0A20 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     B,     B,     B,     B,     B,
   /* 0A30 */     B,     O,     B,     B,     O,     B,     B,     O,     B,     B,     O,     O, CMBlw,     O,  VPst,  VPre,
   /* 0A40 */  VPst,  VBlw,  VBlw,     O,     O,     O,     O,  VAbv,  VAbv,     O,     O,  VAbv,  VAbv,     H,     O,     O,
@@ -113,30 +112,30 @@
 
   /* Gujarati */
 
-  /* 0A80 */     O, VMAbv, VMAbv, VMPst,     O,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,     O,    IV,
-  /* 0A90 */    IV,    IV,     O,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0A80 */     O, VMAbv, VMAbv, VMPst,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,
+  /* 0A90 */     B,     B,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 0AA0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     B,     B,     B,     B,     B,
   /* 0AB0 */     B,     O,     B,     B,     O,     B,     B,     B,     B,     B,     O,     O, CMBlw,     B,  VPst,  VPre,
   /* 0AC0 */  VPst,  VBlw,  VBlw,  VBlw,  VBlw,  VAbv,     O,  VAbv,  VAbv,  VAbv,     O,  VPst,  VPst,     H,     O,     O,
   /* 0AD0 */     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
-  /* 0AE0 */    IV,    IV,  VBlw,  VBlw,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0AE0 */     B,     B,  VBlw,  VBlw,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 0AF0 */     O,     O,     O,     O,     O,     O,     O,     O,     O,     B,     O,     O,     O,     O,     O,     O,
 
   /* Oriya */
 
-  /* 0B00 */     O, VMAbv, VMPst, VMPst,     O,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,     O,     O,    IV,
-  /* 0B10 */    IV,     O,     O,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0B00 */     O, VMAbv, VMPst, VMPst,     O,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     B,
+  /* 0B10 */     B,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 0B20 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     B,     B,     B,     B,     B,
   /* 0B30 */     B,     O,     B,     B,     O,     B,     B,     B,     B,     B,     O,     O, CMBlw,     B,  VPst,  VAbv,
   /* 0B40 */  VPst,  VBlw,  VBlw,  VBlw,  VBlw,     O,     O,  VPre,  VPre,     O,     O,  VPre,  VPre,     H,     O,     O,
   /* 0B50 */     O,     O,     O,     O,     O,     O,  VAbv,  VAbv,     O,     O,     O,     O,     B,     B,     O,     B,
-  /* 0B60 */    IV,    IV,  VBlw,  VBlw,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0B60 */     B,     B,  VBlw,  VBlw,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 0B70 */     O,     B,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
 
   /* Tamil */
 
-  /* 0B80 */     O,     O, VMAbv,   IND,     O,    IV,    IV,    IV,    IV,    IV,    IV,     O,     O,     O,    IV,    IV,
-  /* 0B90 */    IV,     O,    IV,    IV,    IV,     B,     O,     O,     O,     B,     B,     O,     B,     O,     B,     B,
+  /* 0B80 */     O,     O, VMAbv,   IND,     O,     B,     B,     B,     B,     B,     B,     O,     O,     O,     B,     B,
+  /* 0B90 */     B,     O,     B,     B,     B,     B,     O,     O,     O,     B,     B,     O,     B,     O,     B,     B,
   /* 0BA0 */     O,     O,     O,     B,     B,     O,     O,     O,     B,     B,     B,     O,     O,     O,     B,     B,
   /* 0BB0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     O,     O,  VPst,  VPst,
   /* 0BC0 */  VAbv,  VPst,  VPst,     O,     O,     O,  VPre,  VPre,  VPre,     O,  VPre,  VPre,  VPre,     H,     O,     O,
@@ -146,41 +145,41 @@
 
   /* Telugu */
 
-  /* 0C00 */ VMAbv, VMPst, VMPst, VMPst,     O,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,     O,    IV,    IV,
-  /* 0C10 */    IV,     O,    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0C00 */ VMAbv, VMPst, VMPst, VMPst,     O,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     B,
+  /* 0C10 */     B,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 0C20 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     B,     B,     B,     B,     B,
   /* 0C30 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     O,     B,  VAbv,  VAbv,
   /* 0C40 */  VAbv,  VPst,  VPst,  VPst,  VPst,     O,  VAbv,  VAbv,  VAbv,     O,  VAbv,  VAbv,  VAbv,     H,     O,     O,
   /* 0C50 */     O,     O,     O,     O,     O,  VAbv,  VBlw,     O,     B,     B,     B,     O,     O,     O,     O,     O,
-  /* 0C60 */    IV,    IV,  VBlw,  VBlw,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0C60 */     B,     B,  VBlw,  VBlw,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 0C70 */     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
 
   /* Kannada */
 
-  /* 0C80 */     O, VMAbv, VMPst, VMPst,     O,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,     O,    IV,    IV,
-  /* 0C90 */    IV,     O,    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0C80 */     O, VMAbv, VMPst, VMPst,     O,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     B,
+  /* 0C90 */     B,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 0CA0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     B,     B,     B,     B,     B,
   /* 0CB0 */     B,     B,     B,     B,     O,     B,     B,     B,     B,     B,     O,     O, CMBlw,     B,  VPst,  VAbv,
   /* 0CC0 */  VAbv,  VPst,  VPst,  VPst,  VPst,     O,  VAbv,  VAbv,  VAbv,     O,  VAbv,  VAbv,  VAbv,     H,     O,     O,
   /* 0CD0 */     O,     O,     O,     O,     O,  VPst,  VPst,     O,     O,     O,     O,     O,     O,     O,     B,     O,
-  /* 0CE0 */    IV,    IV,  VBlw,  VBlw,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0CE0 */     B,     B,  VBlw,  VBlw,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 0CF0 */     O,     R,     R,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
 
   /* Malayalam */
 
-  /* 0D00 */     O, VMAbv, VMPst, VMPst,     O,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,     O,    IV,    IV,
-  /* 0D10 */    IV,     O,    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0D00 */     O, VMAbv, VMPst, VMPst,     O,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     B,
+  /* 0D10 */     B,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 0D20 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 0D30 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     B,  VPst,  VPst,
   /* 0D40 */  VPst,  VPst,  VPst,  VBlw,  VBlw,     O,  VPre,  VPre,  VPre,     O,  VPre,  VPre,  VPre,     H,     R,     O,
-  /* 0D50 */     O,     O,     O,     O,     O,     O,     O,  VPst,     O,     O,     O,     O,     O,     O,     O,    IV,
-  /* 0D60 */    IV,    IV,  VBlw,  VBlw,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0D50 */     O,     O,     O,     O,   IND,   IND,   IND,  VPst,     O,     O,     O,     O,     O,     O,     O,     B,
+  /* 0D60 */     B,     B,  VBlw,  VBlw,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 0D70 */     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,   IND,   IND,   IND,   IND,   IND,   IND,
 
   /* Sinhala */
 
-  /* 0D80 */     O,     O, VMPst, VMPst,     O,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,
-  /* 0D90 */    IV,    IV,    IV,    IV,    IV,    IV,    IV,     O,     O,     O,     B,     B,     B,     B,     B,     B,
+  /* 0D80 */     O,     O, VMPst, VMPst,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 0D90 */     B,     B,     B,     B,     B,     B,     B,     O,     O,     O,     B,     B,     B,     B,     B,     B,
   /* 0DA0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 0DB0 */     B,     B,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     O,     O,
   /* 0DC0 */     B,     B,     B,     B,     B,     B,     B,     O,     O,     O,     H,     O,     O,     O,     O,  VPst,
@@ -195,10 +194,10 @@
 
   /* 1000 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 1010 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
-  /* 1020 */     B,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,  VPst,  VPst,  VAbv,  VAbv,  VBlw,
+  /* 1020 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,  VPst,  VPst,  VAbv,  VAbv,  VBlw,
   /* 1030 */  VBlw,  VPre,  VAbv,  VAbv,  VAbv,  VAbv, VMAbv, VMBlw, VMPst,     H,  VAbv,  MPst,  MPre,  MBlw,  MBlw,     B,
   /* 1040 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     O,     O,    GB,     O,
-  /* 1050 */     B,     B,    IV,    IV,    IV,    IV,  VPst,  VPst,  VBlw,  VBlw,     B,     B,     B,     B,  MBlw,  MBlw,
+  /* 1050 */     B,     B,     B,     B,     B,     B,  VPst,  VPst,  VBlw,  VBlw,     B,     B,     B,     B,  MBlw,  MBlw,
   /* 1060 */  MBlw,     B,  VPst, VMPst, VMPst,     B,     B,  VPst,  VPst, VMPst, VMPst, VMPst, VMPst, VMPst,     B,     B,
   /* 1070 */     B,  VAbv,  VAbv,  VAbv,  VAbv,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 1080 */     B,     B,  MBlw,  VPst,  VPre,  VAbv,  VAbv, VMPst, VMPst, VMPst, VMPst, VMPst, VMPst, VMBlw,     B, VMPst,
@@ -209,30 +208,30 @@
 
   /* Tagalog */
 
-  /* 1700 */    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     B,
+  /* 1700 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     B,
   /* 1710 */     B,     B,  VAbv,  VBlw,  VBlw,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
 
   /* Hanunoo */
 
-  /* 1720 */    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 1720 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 1730 */     B,     B,  VAbv,  VBlw,  VBlw,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
 
   /* Buhid */
 
-  /* 1740 */    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 1740 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 1750 */     B,     B,  VAbv,  VBlw,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
 
   /* Tagbanwa */
 
-  /* 1760 */    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     B,
+  /* 1760 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     B,
   /* 1770 */     B,     O,  VAbv,  VBlw,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
 
   /* Khmer */
 
   /* 1780 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 1790 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
-  /* 17A0 */     B,     B,     B,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,
-  /* 17B0 */    IV,    IV,    IV,    IV,     O,     O,  VPst,  VAbv,  VAbv,  VAbv,  VAbv,  VBlw,  VBlw,  VBlw,  VPre,  VPre,
+  /* 17A0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 17B0 */     B,     B,     B,     B,     O,     O,  VPst,  VAbv,  VAbv,  VAbv,  VAbv,  VBlw,  VBlw,  VBlw,  VPre,  VPre,
   /* 17C0 */  VPre,  VPre,  VPre,  VPre,  VPre,  VPre, VMAbv, VMPst,  VPst, VMAbv, VMAbv,    FM,  FAbv, CMAbv,    FM,    FM,
   /* 17D0 */    FM,  VAbv,     H,    FM,     O,     O,     O,     O,     O,     O,     O,     O,     B,  VAbv,     O,     O,
   /* 17E0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     O,     O,     O,     O,
@@ -274,8 +273,8 @@
 
   /* 1A20 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 1A30 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
-  /* 1A40 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,    IV,    IV,    IV,
-  /* 1A50 */    IV,    IV,    IV,     B,     B,  MPre,  MBlw,  FPst,  FAbv,  FAbv,  FAbv,  FBlw,  FBlw,  FBlw,  FBlw,     O,
+  /* 1A40 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 1A50 */     B,     B,     B,     B,     B,  MPre,  MBlw,  FPst,  FAbv,  FAbv,  FAbv,  FBlw,  FBlw,  FBlw,  FBlw,     O,
   /* 1A60 */     H,  VPst,  VAbv,  VPst,  VPst,  VAbv,  VAbv,  VAbv,  VAbv,  VBlw,  VBlw,  VAbv,  VBlw,  VPst,  VPre,  VPre,
   /* 1A70 */  VPre,  VPre,  VPre,  VAbv,  VAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv,    FM,    FM,    FM,     O,     O,    FM,
   /* 1A80 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     O,     O,     O,     O,
@@ -286,8 +285,8 @@
 
   /* Balinese */
 
-  /* 1B00 */ VMAbv, VMAbv, VMAbv,  FAbv, VMPst,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,
-  /* 1B10 */    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 1B00 */ VMAbv, VMAbv, VMAbv,  FAbv, VMPst,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 1B10 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 1B20 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 1B30 */     B,     B,     B,     B, CMAbv,  VPst,  VAbv,  VAbv,  VBlw,  VBlw,  VBlw,  VBlw,  VAbv,  VAbv,  VPre,  VPre,
   /* 1B40 */  VPre,  VPre,  VAbv,  VAbv,     H,     B,     B,     B,     B,     B,     B,     B,     O,     O,     O,     O,
@@ -297,7 +296,7 @@
 
   /* Sundanese */
 
-  /* 1B80 */ VMAbv,  FAbv, VMPst,    IV,    IV,    IV,    IV,    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,
+  /* 1B80 */ VMAbv,  FAbv, VMPst,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 1B90 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 1BA0 */     B,   SUB,   SUB,   SUB,  VAbv,  VBlw,  VPre,  VPst,  VAbv,  VAbv,  VPst,     H,   SUB,   SUB,     B,     B,
   /* 1BB0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
@@ -306,7 +305,7 @@
 
   /* 1BC0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 1BD0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
-  /* 1BE0 */     B,     B,     B,     B,    IV,    IV, CMAbv,  VPst,  VAbv,  VAbv,  VPst,  VPst,  VPst,  VAbv,  VPst,  VAbv,
+  /* 1BE0 */     B,     B,     B,     B,     B,     B, CMAbv,  VPst,  VAbv,  VAbv,  VPst,  VPst,  VPst,  VAbv,  VPst,  VAbv,
   /* 1BF0 */  FAbv,  FAbv,  VPst,  VPst,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
 
   /* Lepcha */
@@ -326,14 +325,20 @@
   /* 1CE0 */ VMAbv, VMPst, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw,     O,     O,     O,     O, VMBlw,     O,     O,
   /* 1CF0 */     O,     O, VMPst, VMPst, VMAbv,     O,     O,     O, VMAbv, VMAbv,     O,     O,     O,     O,     O,     O,
 
-#define use_offset_0x2008u 2552
+#define use_offset_0x1df8u 2552
+
+
+  /* Combining Diacritical Marks Supplement */
+                                                                         O,     O,     O,    FM,     O,     O,     O,     O,
+
+#define use_offset_0x2008u 2560
 
 
   /* General Punctuation */
                                                                          O,     O,     O,     O,  ZWNJ,   ZWJ,     O,     O,
   /* 2010 */    GB,    GB,    GB,    GB,    GB,     O,     O,     O,
 
-#define use_offset_0x2060u 2568
+#define use_offset_0x2060u 2576
 
   /* 2060 */    WJ,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
 
@@ -342,12 +347,12 @@
   /* 2070 */     O,     O,     O,     O,    FM,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
   /* 2080 */     O,     O,    FM,    FM,    FM,     O,     O,     O,
 
-#define use_offset_0xa800u 2608
+#define use_offset_0xa800u 2616
 
 
   /* Syloti Nagri */
 
-  /* A800 */    IV,    IV,     O,    IV,    IV,    IV,  VAbv,     B,     B,     B,     B, VMAbv,     B,     B,     B,     B,
+  /* A800 */     B,     B,     O,     B,     B,     B,  VAbv,     B,     B,     B,     B, VMAbv,     B,     B,     B,     B,
   /* A810 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* A820 */     B,     B,     B,  VPst,  VPst,  VBlw,  VAbv,  VPst,     O,     O,     O,     O,     O,     O,     O,     O,
   /* A830 */     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
@@ -361,11 +366,11 @@
 
   /* Saurashtra */
 
-  /* A880 */ VMPst, VMPst,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,
-  /* A890 */    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* A880 */ VMPst, VMPst,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* A890 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* A8A0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* A8B0 */     B,     B,     B,     B,  FPst,  VPst,  VPst,  VPst,  VPst,  VPst,  VPst,  VPst,  VPst,  VPst,  VPst,  VPst,
-  /* A8C0 */  VPst,  VPst,  VPst,  VPst,     H,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
+  /* A8C0 */  VPst,  VPst,  VPst,  VPst,     H, VMAbv,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
   /* A8D0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     O,     O,     O,     O,
 
   /* Devanagari Extended */
@@ -389,7 +394,7 @@
 
   /* Javanese */
 
-  /* A980 */ VMAbv, VMAbv,  FAbv, VMPst,    IV,    IV,    IV,    IV,    IV,     B,     B,     B,    IV,    IV,    IV,     B,
+  /* A980 */ VMAbv, VMAbv,  FAbv, VMPst,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* A990 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* A9A0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* A9B0 */     B,     B,     B, CMAbv,  VPst,  VPst,  VAbv,  VAbv,  VBlw,  VBlw,  VPre,  VPre,  VAbv,   SUB,  MPst,  MPst,
@@ -403,7 +408,7 @@
 
   /* Cham */
 
-  /* AA00 */    IV,    IV,    IV,    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* AA00 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* AA10 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* AA20 */     B,     B,     B,     B,     B,     B,     B,     B,     B,  VAbv,  VAbv,  VAbv,  VAbv,  VBlw,  VAbv,  VPre,
   /* AA30 */  VPre,  VAbv,  VBlw,  MPst,  MPre,  MBlw,  MBlw,     O,     O,     O,     O,     O,     O,     O,     O,     O,
@@ -413,7 +418,7 @@
   /* Myanmar Extended-A */
 
   /* AA60 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
-  /* AA70 */     O,     B,     B,     B,     O,     O,     O,     O,     O,     O,     B, VMPst, VMAbv, VMPst,     B,     B,
+  /* AA70 */     O,     B,     B,     B,    GB,    GB,    GB,     O,     O,     O,     B, VMPst, VMAbv, VMPst,     B,     B,
 
   /* Tai Viet */
 
@@ -426,27 +431,27 @@
 
   /* Meetei Mayek Extensions */
 
-  /* AAE0 */    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,  VPre,  VBlw,  VAbv,  VPre,  VPst,
+  /* AAE0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,  VPre,  VBlw,  VAbv,  VPre,  VPst,
   /* AAF0 */     O,     O,     O,     O,     O, VMPst,     H,     O,
 
-#define use_offset_0xabc0u 3368
+#define use_offset_0xabc0u 3376
 
 
   /* Meetei Mayek */
 
-  /* ABC0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,    IV,    IV,
-  /* ABD0 */     B,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* ABC0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* ABD0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* ABE0 */     B,     B,     B,  VPst,  VPst,  VAbv,  VPst,  VPst,  VBlw,  VPst,  VPst,     O, VMPst,  VBlw,     O,     O,
   /* ABF0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     O,     O,     O,     O,
 
-#define use_offset_0xfe00u 3432
+#define use_offset_0xfe00u 3440
 
 
   /* Variation Selectors */
 
   /* FE00 */    VS,    VS,    VS,    VS,    VS,    VS,    VS,    VS,    VS,    VS,    VS,    VS,    VS,    VS,    VS,    VS,
 
-#define use_offset_0x10a00u 3448
+#define use_offset_0x10a00u 3456
 
 
   /* Kharoshthi */
@@ -457,13 +462,13 @@
   /* 10A30 */     B,     B,     B,     B,     O,     O,     O,     O, CMAbv, CMBlw, CMBlw,     O,     O,     O,     O,     H,
   /* 10A40 */     B,     B,     B,     B,     B,     B,     B,     B,
 
-#define use_offset_0x11000u 3520
+#define use_offset_0x11000u 3528
 
 
   /* Brahmi */
 
-  /* 11000 */ VMPst, VMAbv, VMPst,     R,     R,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,
-  /* 11010 */    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 11000 */ VMPst, VMAbv, VMPst,     R,     R,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 11010 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11020 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11030 */     B,     B,     B,     B,     B,     B,     B,     B,  VAbv,  VAbv,  VAbv,  VAbv,  VBlw,  VBlw,  VBlw,  VBlw,
   /* 11040 */  VBlw,  VBlw,  VAbv,  VAbv,  VAbv,  VAbv,     H,     O,     O,     O,     O,     O,     O,     O,     O,     O,
@@ -473,17 +478,17 @@
 
   /* Kaithi */
 
-  /* 11080 */ VMAbv, VMAbv, VMPst,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,     B,     B,     B,
+  /* 11080 */ VMAbv, VMAbv, VMPst,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11090 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 110A0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 110B0 */  VPst,  VPre,  VPst,  VBlw,  VBlw,  VAbv,  VAbv,  VPst,  VPst,     H, CMBlw,     O,     O,     O,     O,     O,
 
-#define use_offset_0x11100u 3712
+#define use_offset_0x11100u 3720
 
 
   /* Chakma */
 
-  /* 11100 */ VMAbv, VMAbv, VMAbv,    IV,    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 11100 */ VMAbv, VMAbv, VMAbv,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11110 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11120 */     B,     B,     B,     B,     B,     B,     B,  VAbv,  VAbv,  VAbv,  VBlw,  VBlw,  VPre,  VAbv,  VAbv,  VAbv,
   /* 11130 */  VAbv,  VBlw,  VBlw,     H,  VAbv,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
@@ -497,8 +502,8 @@
 
   /* Sharada */
 
-  /* 11180 */ VMAbv, VMAbv, VMPst,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,
-  /* 11190 */    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 11180 */ VMAbv, VMAbv, VMPst,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 11190 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 111A0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 111B0 */     B,     B,     B,  VPst,  VPre,  VPst,  VBlw,  VBlw,  VBlw,  VBlw,  VBlw,  VBlw,  VAbv,  VAbv,  VAbv,  VAbv,
   /* 111C0 */     H,     B,     R,     R,     O,     O,     O,     O,     O,     O, CMBlw,  VAbv,  VBlw,     O,     O,     O,
@@ -511,23 +516,23 @@
 
   /* Khojki */
 
-  /* 11200 */    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 11200 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11210 */     B,     B,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11220 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,  VPst,  VPst,  VPst,  VBlw,
-  /* 11230 */  VAbv,  VAbv,  VAbv,  VAbv, VMAbv,     H, CMAbv, CMAbv,
+  /* 11230 */  VAbv,  VAbv,  VAbv,  VAbv, VMAbv,     H, CMAbv, CMAbv,     O,     O,     O,     O,     O,     O, VMAbv,     O,
 
-#define use_offset_0x11280u 4024
+#define use_offset_0x11280u 4040
 
 
   /* Multani */
 
-  /* 11280 */    IV,    IV,    IV,    IV,     B,     B,     B,     O,     B,     O,     B,     B,     B,     B,     O,     B,
+  /* 11280 */     B,     B,     B,     B,     B,     B,     B,     O,     B,     O,     B,     B,     B,     B,     O,     B,
   /* 11290 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,
   /* 112A0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     O,     O,     O,     O,     O,
 
   /* Khudawadi */
 
-  /* 112B0 */    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,
+  /* 112B0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 112C0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 112D0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B, VMAbv,
   /* 112E0 */  VPst,  VPre,  VPst,  VBlw,  VBlw,  VAbv,  VAbv,  VAbv,  VAbv, CMBlw,  VBlw,     O,     O,     O,     O,     O,
@@ -535,44 +540,55 @@
 
   /* Grantha */
 
-  /* 11300 */ VMAbv, VMAbv, VMPst, VMPst,     O,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,     O,     O,    IV,
-  /* 11310 */    IV,     O,     O,    IV,    IV,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 11300 */ VMAbv, VMAbv, VMPst, VMPst,     O,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     B,
+  /* 11310 */     B,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11320 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     B,     B,     B,     B,     B,
   /* 11330 */     B,     O,     B,     B,     O,     B,     B,     B,     B,     B,     O,     O, CMBlw,     B,  VPst,  VPst,
   /* 11340 */  VAbv,  VPst,  VPst,  VPst,  VPst,     O,     O,  VPre,  VPre,     O,     O,  VPre,  VPre,     H,     O,     O,
   /* 11350 */     O,     O,     O,     O,     O,     O,     O,  VPst,     O,     O,     O,     O,     O,     O,     O,     O,
-  /* 11360 */    IV,    IV,  VPst,  VPst,     O,     O, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv,     O,     O,     O,
+  /* 11360 */     B,     B,  VPst,  VPst,     O,     O, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv,     O,     O,     O,
   /* 11370 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv,     O,     O,     O,
 
-#define use_offset_0x11480u 4272
+#define use_offset_0x11400u 4288
+
+
+  /* Newa */
 
+  /* 11400 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 11410 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 11420 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 11430 */     B,     B,     B,     B,     B,  VPst,  VPre,  VPst,  VBlw,  VBlw,  VBlw,  VBlw,  VBlw,  VBlw,  VAbv,  VAbv,
+  /* 11440 */  VPst,  VPst,     H, VMAbv, VMAbv, VMPst, CMBlw,     B,     O,     O,     O,     O,     O,     O,     O,     O,
+  /* 11450 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     O,     O,     O,     O,
+  /* 11460 */     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
+  /* 11470 */     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
 
   /* Tirhuta */
 
-  /* 11480 */     O,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,     B,
+  /* 11480 */     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11490 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 114A0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 114B0 */  VPst,  VPre,  VPst,  VBlw,  VBlw,  VBlw,  VBlw,  VBlw,  VBlw,  VPre,  VAbv,  VPre,  VPre,  VPst,  VPre, VMAbv,
   /* 114C0 */ VMAbv, VMPst,     H, CMBlw,     B,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
   /* 114D0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     O,     O,     O,     O,
 
-#define use_offset_0x11580u 4368
+#define use_offset_0x11580u 4512
 
 
   /* Siddham */
 
-  /* 11580 */    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,     B,     B,
+  /* 11580 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11590 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 115A0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,  VPst,
   /* 115B0 */  VPre,  VPst,  VBlw,  VBlw,  VBlw,  VBlw,     O,     O,  VPre,  VPre,  VPre,  VPre, VMAbv, VMAbv, VMPst,     H,
   /* 115C0 */ CMBlw,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
-  /* 115D0 */     O,     O,     O,     O,     O,     O,     O,     O,    IV,    IV,    IV,    IV,  VBlw,  VBlw,     O,     O,
+  /* 115D0 */     O,     O,     O,     O,     O,     O,     O,     O,     B,     B,     B,     B,  VBlw,  VBlw,     O,     O,
   /* 115E0 */     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
   /* 115F0 */     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
 
   /* Modi */
 
-  /* 11600 */    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,     B,     B,
+  /* 11600 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11610 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11620 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11630 */  VPst,  VPst,  VPst,  VBlw,  VBlw,  VBlw,  VBlw,  VBlw,  VBlw,  VAbv,  VAbv,  VPst,  VPst, VMAbv, VMPst,     H,
@@ -583,7 +599,7 @@
 
   /* Takri */
 
-  /* 11680 */    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,    IV,     B,     B,     B,     B,     B,     B,
+  /* 11680 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11690 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 116A0 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B, VMAbv, VMPst,  VAbv,  VPre,  VPst,
   /* 116B0 */  VBlw,  VBlw,  VAbv,  VAbv,  VAbv,  VAbv,     H, CMBlw,     O,     O,     O,     O,     O,     O,     O,     O,
@@ -599,7 +615,28 @@
   /* 11720 */  VPst,  VPst,  VAbv,  VAbv,  VBlw,  VBlw,  VPre,  VAbv,  VBlw,  VAbv,  VAbv,  VAbv,     O,     O,     O,     O,
   /* 11730 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     O,     O,
 
-}; /* Table items: 4816; occupancy: 72% */
+#define use_offset_0x11c00u 4960
+
+
+  /* Bhaiksuki */
+
+  /* 11C00 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     B,     B,     B,     B,     B,     B,
+  /* 11C10 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 11C20 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,  VPst,
+  /* 11C30 */  VAbv,  VAbv,  VBlw,  VBlw,  VBlw,  VBlw,  VBlw,     O,  VAbv,  VAbv,  VAbv,  VAbv, VMAbv, VMAbv, VMPst,     H,
+  /* 11C40 */     B,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
+  /* 11C50 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 11C60 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     O,     O,     O,
+
+  /* Marchen */
+
+  /* 11C70 */     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 11C80 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 11C90 */     O,     O,   SUB,   SUB,   SUB,   SUB,   SUB,   SUB,   SUB,   SUB,   SUB,   SUB,   SUB,   SUB,   SUB,   SUB,
+  /* 11CA0 */   SUB,   SUB,   SUB,   SUB,   SUB,   SUB,   SUB,   SUB,     O,   SUB,   SUB,   SUB,   SUB,   SUB,   SUB,   SUB,
+  /* 11CB0 */  VBlw,  VPre,  VBlw,  VAbv,  VPst, VMAbv, VMAbv,     O,
+
+}; /* Table items: 5144; occupancy: 72% */
 
 USE_TABLE_ELEMENT_TYPE
 hb_use_get_categories (hb_codepoint_t u)
@@ -619,6 +656,7 @@
       if (hb_in_range (u, 0x1900u, 0x1A9Fu)) return use_table[u - 0x1900u + use_offset_0x1900u];
       if (hb_in_range (u, 0x1B00u, 0x1C4Fu)) return use_table[u - 0x1B00u + use_offset_0x1b00u];
       if (hb_in_range (u, 0x1CD0u, 0x1CFFu)) return use_table[u - 0x1CD0u + use_offset_0x1cd0u];
+      if (hb_in_range (u, 0x1DF8u, 0x1DFFu)) return use_table[u - 0x1DF8u + use_offset_0x1df8u];
       break;
 
     case 0x2u:
@@ -642,10 +680,11 @@
 
     case 0x11u:
       if (hb_in_range (u, 0x11000u, 0x110BFu)) return use_table[u - 0x11000u + use_offset_0x11000u];
-      if (hb_in_range (u, 0x11100u, 0x11237u)) return use_table[u - 0x11100u + use_offset_0x11100u];
+      if (hb_in_range (u, 0x11100u, 0x1123Fu)) return use_table[u - 0x11100u + use_offset_0x11100u];
       if (hb_in_range (u, 0x11280u, 0x11377u)) return use_table[u - 0x11280u + use_offset_0x11280u];
-      if (hb_in_range (u, 0x11480u, 0x114DFu)) return use_table[u - 0x11480u + use_offset_0x11480u];
+      if (hb_in_range (u, 0x11400u, 0x114DFu)) return use_table[u - 0x11400u + use_offset_0x11400u];
       if (hb_in_range (u, 0x11580u, 0x1173Fu)) return use_table[u - 0x11580u + use_offset_0x11580u];
+      if (hb_in_range (u, 0x11C00u, 0x11CB7u)) return use_table[u - 0x11C00u + use_offset_0x11c00u];
       if (unlikely (u == 0x1107Fu)) return HN;
       break;
 
@@ -662,7 +701,6 @@
 #undef H
 #undef HN
 #undef IND
-#undef IV
 #undef N
 #undef O
 #undef R
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -184,6 +184,9 @@
     case HB_SCRIPT_MANICHAEAN:
     case HB_SCRIPT_PSALTER_PAHLAVI:
 
+    /* Unicode-9.0 additions */
+    case HB_SCRIPT_ADLAM:
+
       return true;
 
     default:
@@ -227,12 +230,12 @@
 enum syllable_type_t {
   independent_cluster,
   virama_terminated_cluster,
-  consonant_cluster,
-  vowel_cluster,
+  standard_cluster,
   number_joiner_terminated_cluster,
   numeral_cluster,
   symbol_cluster,
   broken_cluster,
+  non_cluster,
 };
 
 #include "hb-ot-shape-complex-use-machine.hh"
@@ -285,6 +288,9 @@
 setup_topographical_masks (const hb_ot_shape_plan_t *plan,
                            hb_buffer_t *buffer)
 {
+  const use_shape_plan_t *use_plan = (const use_shape_plan_t *) plan->data;
+  if (use_plan->arabic_plan)
+    return;
 
   ASSERT_STATIC (INIT < 4 && ISOL < 4 && MEDI < 4 && FINA < 4);
   hb_mask_t masks[4], all_masks = 0;
@@ -309,13 +315,13 @@
     {
       case independent_cluster:
       case symbol_cluster:
+      case non_cluster:
         /* These don't join.  Nothing to do. */
         last_form = _NONE;
         break;
 
       case virama_terminated_cluster:
-      case consonant_cluster:
-      case vowel_cluster:
+      case standard_cluster:
       case number_joiner_terminated_cluster:
       case numeral_cluster:
       case broken_cluster:
@@ -360,7 +366,7 @@
   hb_glyph_info_t *info = buffer->info;
   unsigned int count = buffer->len;
   for (unsigned int i = 0; i < count; i++)
-    _hb_glyph_info_clear_substituted_and_ligated_and_multiplied (&info[i]);
+    _hb_glyph_info_clear_substituted (&info[i]);
 }
 
 static void
@@ -405,6 +411,12 @@
   }
 }
 
+static inline bool
+is_halant (const hb_glyph_info_t &info)
+{
+  return info.use_category() == USE_H && !_hb_glyph_info_ligated (&info);
+}
+
 static void
 reorder_syllable (hb_buffer_t *buffer, unsigned int start, unsigned int end)
 {
@@ -412,28 +424,26 @@
   /* Only a few syllable types need reordering. */
   if (unlikely (!(FLAG_SAFE (syllable_type) &
                   (FLAG (virama_terminated_cluster) |
-                   FLAG (consonant_cluster) |
-                   FLAG (vowel_cluster) |
+                   FLAG (standard_cluster) |
                    FLAG (broken_cluster) |
                    0))))
     return;
 
   hb_glyph_info_t *info = buffer->info;
 
-#define HALANT_FLAGS FLAG(USE_H)
-#define BASE_FLAGS (FLAG (USE_B) | FLAG (USE_GB) | FLAG (USE_IV))
+#define BASE_FLAGS (FLAG (USE_B) | FLAG (USE_GB))
 
   /* Move things forward. */
   if (info[start].use_category() == USE_R && end - start > 1)
   {
     /* Got a repha.  Reorder it to after first base, before first halant. */
     for (unsigned int i = start + 1; i < end; i++)
-      if (FLAG_UNSAFE (info[i].use_category()) & (HALANT_FLAGS | BASE_FLAGS))
+      if ((FLAG_UNSAFE (info[i].use_category()) & (BASE_FLAGS)) || is_halant (info[i]))
       {
         /* If we hit a halant, move before it; otherwise it's a base: move to it's
          * place, and shift things in between backward. */
 
-        if (info[i].use_category() == USE_H)
+        if (is_halant (info[i]))
           i--;
 
         buffer->merge_clusters (start, i + 1);
@@ -450,11 +460,11 @@
   for (unsigned int i = start; i < end; i++)
   {
     uint32_t flag = FLAG_UNSAFE (info[i].use_category());
-    if (flag & (HALANT_FLAGS | BASE_FLAGS))
+    if ((flag & (BASE_FLAGS)) || is_halant (info[i]))
     {
-      /* If we hit a halant, move before it; otherwise it's a base: move to it's
+      /* If we hit a halant, move after it; otherwise it's a base: move to it's
        * place, and shift things in between backward. */
-      if (info[i].use_category() == USE_H)
+      if (is_halant (info[i]))
         j = i + 1;
       else
         j = i;
@@ -490,22 +500,16 @@
   if (likely (!has_broken_syllables))
     return;
 
-
-  hb_codepoint_t dottedcircle_glyph;
-  if (!font->get_glyph (0x25CCu, 0, &dottedcircle_glyph))
-    return;
-
   hb_glyph_info_t dottedcircle = {0};
-  if (!font->get_glyph (0x25CCu, 0, &dottedcircle.codepoint))
+  if (!font->get_nominal_glyph (0x25CCu, &dottedcircle.codepoint))
     return;
   dottedcircle.use_category() = hb_use_get_categories (0x25CC);
 
   buffer->clear_output ();
 
   buffer->idx = 0;
-
   unsigned int last_syllable = 0;
-  while (buffer->idx < buffer->len)
+  while (buffer->idx < buffer->len && !buffer->in_error)
   {
     unsigned int syllable = buffer->cur().syllable();
     syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F);
@@ -513,19 +517,19 @@
     {
       last_syllable = syllable;
 
-      hb_glyph_info_t info = dottedcircle;
-      info.cluster = buffer->cur().cluster;
-      info.mask = buffer->cur().mask;
-      info.syllable() = buffer->cur().syllable();
+      hb_glyph_info_t ginfo = dottedcircle;
+      ginfo.cluster = buffer->cur().cluster;
+      ginfo.mask = buffer->cur().mask;
+      ginfo.syllable() = buffer->cur().syllable();
       /* TODO Set glyph_props? */
 
       /* Insert dottedcircle after possible Repha. */
-      while (buffer->idx < buffer->len &&
+      while (buffer->idx < buffer->len && !buffer->in_error &&
              last_syllable == buffer->cur().syllable() &&
              buffer->cur().use_category() == USE_R)
         buffer->next_glyph ();
 
-      buffer->output_info (info);
+      buffer->output_info (ginfo);
     }
     else
       buffer->next_glyph ();
@@ -564,7 +568,7 @@
   if (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (c->unicode->general_category (a)))
     return false;
 
-  return c->unicode->compose (a, b, ab);
+  return (bool)c->unicode->compose (a, b, ab);
 }
 
 
@@ -576,10 +580,11 @@
   data_create_use,
   data_destroy_use,
   NULL, /* preprocess_text */
+  NULL, /* postprocess_glyphs */
   HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
   NULL, /* decompose */
   compose_use,
   setup_masks_use,
-  HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
+  HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
   false, /* fallback_position */
 };
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback-private.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback-private.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -45,5 +45,9 @@
                                              hb_font_t *font,
                                              hb_buffer_t  *buffer);
 
+HB_INTERNAL void _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan,
+                                               hb_font_t *font,
+                                               hb_buffer_t  *buffer);
+
 
 #endif /* HB_OT_SHAPE_FALLBACK_PRIVATE_HH */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -224,7 +224,7 @@
         pos.x_offset += base_extents.x_bearing + base_extents.width - mark_extents.width / 2 - mark_extents.x_bearing;
         break;
       }
-      /* Fall through */
+      HB_FALLTHROUGH;
 
     default:
     case HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW:
@@ -259,6 +259,7 @@
     case HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT:
       /* Add gap, fall-through. */
       base_extents.height -= y_gap;
+      HB_FALLTHROUGH;
 
     case HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT:
     case HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW:
@@ -279,6 +280,7 @@
       /* Add gap, fall-through. */
       base_extents.y_bearing += y_gap;
       base_extents.height -= y_gap;
+      HB_FALLTHROUGH;
 
     case HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE:
     case HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT:
@@ -482,3 +484,70 @@
     idx = skippy_iter.idx;
   }
 }
+
+
+/* Adjusts width of various spaces. */
+void
+_hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan,
+                              hb_font_t *font,
+                              hb_buffer_t  *buffer)
+{
+  if (!HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction))
+    return;
+
+  hb_glyph_info_t *info = buffer->info;
+  hb_glyph_position_t *pos = buffer->pos;
+  unsigned int count = buffer->len;
+  for (unsigned int i = 0; i < count; i++)
+    if (_hb_glyph_info_is_unicode_space (&info[i]) && !_hb_glyph_info_ligated (&info[i]))
+    {
+      hb_unicode_funcs_t::space_t space_type = _hb_glyph_info_get_unicode_space_fallback_type (&info[i]);
+      hb_codepoint_t glyph;
+      typedef hb_unicode_funcs_t t;
+      switch (space_type)
+      {
+        case t::NOT_SPACE: /* Shouldn't happen. */
+        case t::SPACE:
+          break;
+
+        case t::SPACE_EM:
+        case t::SPACE_EM_2:
+        case t::SPACE_EM_3:
+        case t::SPACE_EM_4:
+        case t::SPACE_EM_5:
+        case t::SPACE_EM_6:
+        case t::SPACE_EM_16:
+          pos[i].x_advance = (font->x_scale + ((int) space_type)/2) / (int) space_type;
+          break;
+
+        case t::SPACE_4_EM_18:
+          pos[i].x_advance = font->x_scale * 4 / 18;
+          break;
+
+        case t::SPACE_FIGURE:
+          for (char u = '0'; u <= '9'; u++)
+            if (font->get_nominal_glyph (u, &glyph))
+            {
+              pos[i].x_advance = font->get_glyph_h_advance (glyph);
+              break;
+            }
+          break;
+
+        case t::SPACE_PUNCTUATION:
+          if (font->get_nominal_glyph ('.', &glyph))
+            pos[i].x_advance = font->get_glyph_h_advance (glyph);
+          else if (font->get_nominal_glyph (',', &glyph))
+            pos[i].x_advance = font->get_glyph_h_advance (glyph);
+          break;
+
+        case t::SPACE_NARROW:
+          /* Half-space?
+           * Unicode doc http://www.unicode.org/charts/PDF/U2000.pdf says ~1/4 or 1/5 of EM.
+           * However, in my testing, many fonts have their regular space being about that
+           * size.  To me, a percentage of the space width makes more sense.  Half is as
+           * good as any. */
+          pos[i].x_advance /= 2;
+          break;
+      }
+    }
+}
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-normalize.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-normalize.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -62,24 +62,12 @@
  *     with previous base, use that.  This needs the itemizer to have this
  *     knowledge too.  We need to provide assistance to the itemizer.
  *
- *   - When a font does not support a character but supports its decomposition,
- *     well, use the decomposition (preferring the canonical decomposition, but
- *     falling back to the compatibility decomposition if necessary).  The
- *     compatibility decomposition is really nice to have, for characters like
- *     ellipsis, or various-sized space characters.
+ *   - When a font does not support a character but supports its canonical
+ *     decomposition, well, use the decomposition.
  *
  *   - The complex shapers can customize the compose and decompose functions to
  *     offload some of their requirements to the normalizer.  For example, the
  *     Indic shaper may want to disallow recomposing of two matras.
- *
- *   - We try compatibility decomposition if decomposing through canonical
- *     decomposition alone failed to find a sequence that the font supports.
- *     We don't try compatibility decomposition recursively during the canonical
- *     decomposition phase.  This has minimal impact.  There are only a handful
- *     of Greek letter that have canonical decompositions that include characters
- *     with compatibility decomposition.  Those can be found using this command:
- *
- *     egrep  "`echo -n ';('; grep ';<' UnicodeData.txt | cut -d';' -f1 | tr '\n' '|'; echo ') '`" UnicodeData.txt
  */
 
 static bool
@@ -88,7 +76,7 @@
                    hb_codepoint_t *a,
                    hb_codepoint_t *b)
 {
-  return c->unicode->decompose (ab, a, b);
+  return (bool) c->unicode->decompose (ab, a, b);
 }
 
 static bool
@@ -97,21 +85,21 @@
                  hb_codepoint_t  b,
                  hb_codepoint_t *ab)
 {
-  return c->unicode->compose (a, b, ab);
+  return (bool) c->unicode->compose (a, b, ab);
 }
 
 static inline void
 set_glyph (hb_glyph_info_t &info, hb_font_t *font)
 {
-  font->get_glyph (info.codepoint, 0, &info.glyph_index());
+  font->get_nominal_glyph (info.codepoint, &info.glyph_index());
 }
 
 static inline void
 output_char (hb_buffer_t *buffer, hb_codepoint_t unichar, hb_codepoint_t glyph)
 {
   buffer->cur().glyph_index() = glyph;
-  buffer->output_glyph (unichar);
-  _hb_glyph_info_set_unicode_props (&buffer->prev(), buffer->unicode);
+  buffer->output_glyph (unichar); /* This is very confusing indeed. */
+  _hb_glyph_info_set_unicode_props (&buffer->prev(), buffer);
 }
 
 static inline void
@@ -136,10 +124,10 @@
   hb_font_t * const font = c->font;
 
   if (!c->decompose (c, ab, &a, &b) ||
-      (b && !font->get_glyph (b, 0, &b_glyph)))
+      (b && !font->get_nominal_glyph (b, &b_glyph)))
     return 0;
 
-  bool has_a = font->get_glyph (a, 0, &a_glyph);
+  bool has_a = (bool) font->get_nominal_glyph (a, &a_glyph);
   if (shortest && has_a) {
     /* Output a and b */
     output_char (buffer, a, a_glyph);
@@ -171,28 +159,6 @@
   return 0;
 }
 
-/* Returns 0 if didn't decompose, number of resulting characters otherwise. */
-static inline unsigned int
-decompose_compatibility (const hb_ot_shape_normalize_context_t *c, hb_codepoint_t u)
-{
-  unsigned int len, i;
-  hb_codepoint_t decomposed[HB_UNICODE_MAX_DECOMPOSITION_LEN];
-  hb_codepoint_t glyphs[HB_UNICODE_MAX_DECOMPOSITION_LEN];
-
-  len = c->buffer->unicode->decompose_compatibility (u, decomposed);
-  if (!len)
-    return 0;
-
-  for (i = 0; i < len; i++)
-    if (!c->font->get_glyph (decomposed[i], 0, &glyphs[i]))
-      return 0;
-
-  for (i = 0; i < len; i++)
-    output_char (c->buffer, decomposed[i], glyphs[i]);
-
-  return len;
-}
-
 static inline void
 decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shortest)
 {
@@ -200,17 +166,50 @@
   hb_codepoint_t u = buffer->cur().codepoint;
   hb_codepoint_t glyph;
 
-  /* Kind of a cute waterfall here... */
-  if (shortest && c->font->get_glyph (u, 0, &glyph))
+  if (shortest && c->font->get_nominal_glyph (u, &glyph))
+  {
     next_char (buffer, glyph);
-  else if (decompose (c, shortest, u))
+    return;
+  }
+
+  if (decompose (c, shortest, u))
+  {
     skip_char (buffer);
-  else if (!shortest && c->font->get_glyph (u, 0, &glyph))
+    return;
+  }
+
+  if (!shortest && c->font->get_nominal_glyph (u, &glyph))
+  {
     next_char (buffer, glyph);
-  else if (decompose_compatibility (c, u))
-    skip_char (buffer);
-  else
-    next_char (buffer, glyph); /* glyph is initialized in earlier branches. */
+    return;
+  }
+
+  if (_hb_glyph_info_is_unicode_space (&buffer->cur()))
+  {
+    hb_codepoint_t space_glyph;
+    hb_unicode_funcs_t::space_t space_type = buffer->unicode->space_fallback_type (u);
+    if (space_type != hb_unicode_funcs_t::NOT_SPACE && c->font->get_nominal_glyph (0x0020u, &space_glyph))
+    {
+      _hb_glyph_info_set_unicode_space_fallback_type (&buffer->cur(), space_type);
+      next_char (buffer, space_glyph);
+      buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK;
+      return;
+    }
+  }
+
+  if (u == 0x2011u)
+  {
+    /* U+2011 is the only sensible character that is a no-break version of another character
+     * and not a space.  The space ones are handled already.  Handle this lone one. */
+    hb_codepoint_t other_glyph;
+    if (c->font->get_nominal_glyph (0x2010u, &other_glyph))
+    {
+      next_char (buffer, other_glyph);
+      return;
+    }
+  }
+
+  next_char (buffer, glyph); /* glyph is initialized in earlier branches. */
 }
 
 static inline void
@@ -219,10 +218,10 @@
   /* TODO Currently if there's a variation-selector we give-up, it's just too hard. */
   hb_buffer_t * const buffer = c->buffer;
   hb_font_t * const font = c->font;
-  for (; buffer->idx < end - 1;) {
+  for (; buffer->idx < end - 1 && !buffer->in_error;) {
     if (unlikely (buffer->unicode->is_variation_selector (buffer->cur(+1).codepoint))) {
       /* The next two lines are some ugly lines... But work. */
-      if (font->get_glyph (buffer->cur().codepoint, buffer->cur(+1).codepoint, &buffer->cur().glyph_index()))
+      if (font->get_variation_glyph (buffer->cur().codepoint, buffer->cur(+1).codepoint, &buffer->cur().glyph_index()))
       {
         buffer->replace_glyphs (2, 1, &buffer->cur().codepoint);
       }
@@ -255,13 +254,13 @@
 decompose_multi_char_cluster (const hb_ot_shape_normalize_context_t *c, unsigned int end, bool short_circuit)
 {
   hb_buffer_t * const buffer = c->buffer;
-  for (unsigned int i = buffer->idx; i < end; i++)
+  for (unsigned int i = buffer->idx; i < end && !buffer->in_error; i++)
     if (unlikely (buffer->unicode->is_variation_selector (buffer->info[i].codepoint))) {
       handle_variation_selector_cluster (c, end, short_circuit);
       return;
     }
 
-  while (buffer->idx < end)
+  while (buffer->idx < end && !buffer->in_error)
     decompose_current_character (c, short_circuit);
 }
 
@@ -321,7 +320,7 @@
 
   buffer->clear_output ();
   count = buffer->len;
-  for (buffer->idx = 0; buffer->idx < count;)
+  for (buffer->idx = 0; buffer->idx < count && !buffer->in_error;)
   {
     unsigned int end;
     for (end = buffer->idx + 1; end < count; end++)
@@ -371,7 +370,7 @@
   count = buffer->len;
   unsigned int starter = 0;
   buffer->next_glyph ();
-  while (buffer->idx < count)
+  while (buffer->idx < count && !buffer->in_error)
   {
     hb_codepoint_t composed, glyph;
     if (/* We don't try to compose a non-mark character with it's preceding starter.
@@ -389,7 +388,7 @@
                    buffer->cur().codepoint,
                    &composed) &&
         /* And the font has glyph for the composite. */
-        font->get_glyph (composed, 0, &glyph))
+        font->get_nominal_glyph (composed, &glyph))
     {
       /* Composes. */
       buffer->next_glyph (); /* Copy to out-buffer. */
@@ -400,7 +399,7 @@
       /* Modify starter and carry on. */
       buffer->out_info[starter].codepoint = composed;
       buffer->out_info[starter].glyph_index() = glyph;
-      _hb_glyph_info_set_unicode_props (&buffer->out_info[starter], buffer->unicode);
+      _hb_glyph_info_set_unicode_props (&buffer->out_info[starter], buffer);
 
       continue;
     }
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -145,7 +145,7 @@
 struct hb_ot_shaper_font_data_t {};
 
 hb_ot_shaper_font_data_t *
-_hb_ot_shaper_font_data_create (hb_font_t *font)
+_hb_ot_shaper_font_data_create (hb_font_t *font HB_UNUSED)
 {
   return (hb_ot_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED;
 }
@@ -228,7 +228,7 @@
   unsigned int count = buffer->len;
   hb_glyph_info_t *info = buffer->info;
   for (unsigned int i = 0; i < count; i++)
-    _hb_glyph_info_set_unicode_props (&info[i], buffer->unicode);
+    _hb_glyph_info_set_unicode_props (&info[i], buffer);
 }
 
 static void
@@ -245,7 +245,7 @@
 
   hb_glyph_info_t dottedcircle = {0};
   dottedcircle.codepoint = 0x25CCu;
-  _hb_glyph_info_set_unicode_props (&dottedcircle, buffer->unicode);
+  _hb_glyph_info_set_unicode_props (&dottedcircle, buffer);
 
   buffer->clear_output ();
 
@@ -254,7 +254,7 @@
   info.cluster = buffer->cur().cluster;
   info.mask = buffer->cur().mask;
   buffer->output_info (info);
-  while (buffer->idx < buffer->len)
+  while (buffer->idx < buffer->len && !buffer->in_error)
     buffer->next_glyph ();
 
   buffer->swap_buffers ();
@@ -263,16 +263,18 @@
 static void
 hb_form_clusters (hb_buffer_t *buffer)
 {
-  if (buffer->cluster_level != HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES)
+  if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII) ||
+      buffer->cluster_level != HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES)
     return;
 
-  /* Loop duplicated in hb_ensure_native_direction(). */
+  /* Loop duplicated in hb_ensure_native_direction(), and in _hb-coretext.cc */
   unsigned int base = 0;
   unsigned int count = buffer->len;
   hb_glyph_info_t *info = buffer->info;
   for (unsigned int i = 1; i < count; i++)
   {
-    if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&info[i]))))
+    if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&info[i])) &&
+                !_hb_glyph_info_is_joiner (&info[i])))
     {
       buffer->merge_clusters (base, i);
       base = i;
@@ -346,7 +348,8 @@
 static inline void
 hb_ot_shape_setup_masks_fraction (hb_ot_shape_context_t *c)
 {
-  if (!c->plan->has_frac)
+  if (!(c->buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII) ||
+      !c->plan->has_frac)
     return;
 
   hb_buffer_t *buffer = c->buffer;
@@ -416,7 +419,8 @@
 {
   hb_buffer_t *buffer = c->buffer;
 
-  if (buffer->flags & HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES)
+  if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES) ||
+      (buffer->flags & HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES))
     return;
 
   unsigned int count = buffer->len;
@@ -433,7 +437,8 @@
 {
   hb_buffer_t *buffer = c->buffer;
 
-  if (buffer->flags & HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES)
+  if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES) ||
+      (buffer->flags & HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES))
     return;
 
   unsigned int count = buffer->len;
@@ -451,7 +456,7 @@
     return;
 
   hb_codepoint_t space;
-  if (c->font->get_glyph (' ', 0, &space))
+  if (c->font->get_nominal_glyph (' ', &space))
   {
     /* Replace default-ignorables with a zero-advance space glyph. */
     for (/*continue*/; i < count; i++)
@@ -519,39 +524,10 @@
 }
 
 static inline void
-hb_synthesize_glyph_classes (hb_ot_shape_context_t *c)
-{
-  unsigned int count = c->buffer->len;
-  hb_glyph_info_t *info = c->buffer->info;
-  for (unsigned int i = 0; i < count; i++)
-  {
-    hb_ot_layout_glyph_class_mask_t klass;
-
-    /* Never mark default-ignorables as marks.
-     * They won't get in the way of lookups anyway,
-     * but having them as mark will cause them to be skipped
-     * over if the lookup-flag says so, but at least for the
-     * Mongolian variation selectors, looks like Uniscribe
-     * marks them as non-mark.  Some Mongolian fonts without
-     * GDEF rely on this.  Another notable character that
-     * this applies to is COMBINING GRAPHEME JOINER. */
-    klass = (_hb_glyph_info_get_general_category (&info[i]) !=
-             HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK ||
-             _hb_glyph_info_is_default_ignorable (&info[i])) ?
-            HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH :
-            HB_OT_LAYOUT_GLYPH_PROPS_MARK;
-    _hb_glyph_info_set_glyph_props (&info[i], klass);
-  }
-}
-
-static inline void
 hb_ot_substitute_default (hb_ot_shape_context_t *c)
 {
   hb_buffer_t *buffer = c->buffer;
 
-  if (c->plan->shaper->preprocess_text)
-    c->plan->shaper->preprocess_text (c->plan, buffer, c->font);
-
   hb_ot_shape_initialize_masks (c);
 
   hb_ot_mirror_chars (c);
@@ -576,16 +552,10 @@
 {
   hb_buffer_t *buffer = c->buffer;
 
-  _hb_buffer_allocate_gsubgpos_vars (buffer);
   hb_ot_layout_substitute_start (c->font, buffer);
 
-  if (!hb_ot_layout_has_glyph_classes (c->face))
-    hb_synthesize_glyph_classes (c);
-
   c->plan->substitute (c->font, buffer);
 
-  hb_ot_layout_substitute_finish (c->font, buffer);
-
   return;
 }
 
@@ -593,6 +563,9 @@
 hb_ot_substitute (hb_ot_shape_context_t *c)
 {
   hb_ot_substitute_default (c);
+
+  _hb_buffer_allocate_gsubgpos_vars (c->buffer);
+
   hb_ot_substitute_complex (c);
 }
 
@@ -613,20 +586,6 @@
 }
 
 static inline void
-zero_mark_widths_by_unicode (hb_buffer_t *buffer, bool adjust_offsets)
-{
-  unsigned int count = buffer->len;
-  hb_glyph_info_t *info = buffer->info;
-  for (unsigned int i = 0; i < count; i++)
-    if (_hb_glyph_info_get_general_category (&info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
-    {
-      if (adjust_offsets)
-        adjust_mark_offsets (&buffer->pos[i]);
-      zero_mark_width (&buffer->pos[i]);
-    }
-}
-
-static inline void
 zero_mark_widths_by_gdef (hb_buffer_t *buffer, bool adjust_offsets)
 {
   unsigned int count = buffer->len;
@@ -647,26 +606,41 @@
   unsigned int count = c->buffer->len;
   hb_glyph_info_t *info = c->buffer->info;
   hb_glyph_position_t *pos = c->buffer->pos;
-  for (unsigned int i = 0; i < count; i++)
+
+  if (HB_DIRECTION_IS_HORIZONTAL (direction))
   {
-    c->font->get_glyph_advance_for_direction (info[i].codepoint,
-                                              direction,
-                                              &pos[i].x_advance,
-                                              &pos[i].y_advance);
-    c->font->subtract_glyph_origin_for_direction (info[i].codepoint,
-                                                  direction,
-                                                  &pos[i].x_offset,
-                                                  &pos[i].y_offset);
-
+    for (unsigned int i = 0; i < count; i++)
+      pos[i].x_advance = c->font->get_glyph_h_advance (info[i].codepoint);
+    /* The nil glyph_h_origin() func returns 0, so no need to apply it. */
+    if (c->font->has_glyph_h_origin_func ())
+      for (unsigned int i = 0; i < count; i++)
+        c->font->subtract_glyph_h_origin (info[i].codepoint,
+                                          &pos[i].x_offset,
+                                          &pos[i].y_offset);
   }
+  else
+  {
+    for (unsigned int i = 0; i < count; i++)
+    {
+      pos[i].y_advance = c->font->get_glyph_v_advance (info[i].codepoint);
+      c->font->subtract_glyph_v_origin (info[i].codepoint,
+                                        &pos[i].x_offset,
+                                        &pos[i].y_offset);
+    }
+  }
+  if (c->buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK)
+    _hb_ot_shape_fallback_spaces (c->plan, c->font, c->buffer);
 }
 
 static inline bool
 hb_ot_position_complex (hb_ot_shape_context_t *c)
 {
+  hb_ot_layout_position_start (c->font, c->buffer);
+
   bool ret = false;
   unsigned int count = c->buffer->len;
-  bool has_positioning = hb_ot_layout_has_positioning (c->face);
+  bool has_positioning = (bool) hb_ot_layout_has_positioning (c->face);
+
   /* If the font has no GPOS, AND, no fallback positioning will
    * happen, AND, direction is forward, then when zeroing mark
    * widths, we shift the mark with it, such that the mark
@@ -685,15 +659,8 @@
       zero_mark_widths_by_gdef (c->buffer, adjust_offsets_when_zeroing);
       break;
 
-    /* Not currently used for any shaper:
-    case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_EARLY:
-      zero_mark_widths_by_unicode (c->buffer, adjust_offsets_when_zeroing);
-      break;
-    */
-
     default:
     case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE:
-    case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE:
     case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE:
       break;
   }
@@ -703,60 +670,56 @@
     hb_glyph_info_t *info = c->buffer->info;
     hb_glyph_position_t *pos = c->buffer->pos;
 
-    /* Change glyph origin to what GPOS expects, apply GPOS, change it back. */
+    /* Change glyph origin to what GPOS expects (horizontal), apply GPOS, change it back. */
 
-    for (unsigned int i = 0; i < count; i++) {
-      c->font->add_glyph_origin_for_direction (info[i].codepoint,
-                                               HB_DIRECTION_LTR,
-                                               &pos[i].x_offset,
-                                               &pos[i].y_offset);
-    }
+    /* The nil glyph_h_origin() func returns 0, so no need to apply it. */
+    if (c->font->has_glyph_h_origin_func ())
+      for (unsigned int i = 0; i < count; i++)
+        c->font->add_glyph_h_origin (info[i].codepoint,
+                                     &pos[i].x_offset,
+                                     &pos[i].y_offset);
 
     c->plan->position (c->font, c->buffer);
 
-    for (unsigned int i = 0; i < count; i++) {
-      c->font->subtract_glyph_origin_for_direction (info[i].codepoint,
-                                                    HB_DIRECTION_LTR,
-                                                    &pos[i].x_offset,
-                                                    &pos[i].y_offset);
-    }
+    /* The nil glyph_h_origin() func returns 0, so no need to apply it. */
+    if (c->font->has_glyph_h_origin_func ())
+      for (unsigned int i = 0; i < count; i++)
+        c->font->subtract_glyph_h_origin (info[i].codepoint,
+                                          &pos[i].x_offset,
+                                          &pos[i].y_offset);
 
     ret = true;
   }
 
   switch (c->plan->shaper->zero_width_marks)
   {
-    case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE:
-      zero_mark_widths_by_unicode (c->buffer, adjust_offsets_when_zeroing);
-      break;
-
     case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE:
       zero_mark_widths_by_gdef (c->buffer, adjust_offsets_when_zeroing);
       break;
 
     default:
     case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE:
-    //case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_EARLY:
     case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY:
       break;
   }
 
+  /* Finishing off GPOS has to follow a certain order. */
+  hb_ot_layout_position_finish_advances (c->font, c->buffer);
+  hb_ot_zero_width_default_ignorables (c);
+  hb_ot_layout_position_finish_offsets (c->font, c->buffer);
+
   return ret;
 }
 
 static inline void
 hb_ot_position (hb_ot_shape_context_t *c)
 {
-  hb_ot_layout_position_start (c->font, c->buffer);
+  c->buffer->clear_positions ();
 
   hb_ot_position_default (c);
 
   hb_bool_t fallback = !hb_ot_position_complex (c);
 
-  hb_ot_zero_width_default_ignorables (c);
-
-  hb_ot_layout_position_finish (c->font, c->buffer);
-
   if (fallback && c->plan->shaper->fallback_position)
     _hb_ot_shape_fallback_position (c->plan, c->font, c->buffer);
 
@@ -778,6 +741,12 @@
 hb_ot_shape_internal (hb_ot_shape_context_t *c)
 {
   c->buffer->deallocate_var_all ();
+  c->buffer->scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT;
+  if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_EXPANSION_FACTOR)))
+  {
+    c->buffer->max_len = MAX (c->buffer->len * HB_BUFFER_MAX_EXPANSION_FACTOR,
+                              (unsigned) HB_BUFFER_MAX_LEN_MIN);
+  }
 
   /* Save the original direction, we use it later. */
   c->target_direction = c->buffer->props.direction;
@@ -792,15 +761,22 @@
 
   hb_ensure_native_direction (c->buffer);
 
+  if (c->plan->shaper->preprocess_text)
+    c->plan->shaper->preprocess_text (c->plan, c->buffer, c->font);
+
   hb_ot_substitute (c);
   hb_ot_position (c);
 
   hb_ot_hide_default_ignorables (c);
 
+  if (c->plan->shaper->postprocess_glyphs)
+    c->plan->shaper->postprocess_glyphs (c->plan, c->buffer, c->font);
+
   _hb_buffer_deallocate_unicode_vars (c->buffer);
 
   c->buffer->props.direction = c->target_direction;
 
+  c->buffer->max_len = HB_BUFFER_MAX_LEN_DEFAULT;
   c->buffer->deallocate_var_all ();
 }
 
@@ -820,6 +796,8 @@
 
 
 /**
+ * hb_ot_shape_plan_collect_lookups:
+ *
  * Since: 0.9.7
  **/
 void
@@ -841,18 +819,20 @@
           hb_set_t           *glyphs)
 {
   hb_codepoint_t glyph;
-  if (font->get_glyph (u, 0, &glyph))
+  if (font->get_nominal_glyph (u, &glyph))
     glyphs->add (glyph);
   if (mirror)
   {
     hb_codepoint_t m = unicode->mirroring (u);
-    if (m != u && font->get_glyph (m, 0, &glyph))
+    if (m != u && font->get_nominal_glyph (m, &glyph))
       glyphs->add (glyph);
   }
 }
 
 
 /**
+ * hb_ot_shape_glyphs_closure:
+ *
  * Since: 0.9.2
  **/
 void
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape.h	Wed Jul 05 22:06:46 2017 +0200
@@ -36,14 +36,14 @@
 HB_BEGIN_DECLS
 
 /* TODO port to shape-plan / set. */
-void
+HB_EXTERN void
 hb_ot_shape_glyphs_closure (hb_font_t          *font,
                             hb_buffer_t        *buffer,
                             const hb_feature_t *features,
                             unsigned int        num_features,
                             hb_set_t           *glyphs);
 
-void
+HB_EXTERN void
 hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan,
                                   hb_tag_t         table_tag,
                                   hb_set_t        *lookup_indexes /* OUT */);
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-tag.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-tag.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -186,14 +186,18 @@
   {"aa",        HB_TAG('A','F','R',' ')},       /* Afar */
   {"ab",        HB_TAG('A','B','K',' ')},       /* Abkhazian */
   {"abq",       HB_TAG('A','B','A',' ')},       /* Abaza */
+  {"acf",       HB_TAG('F','A','N',' ')},       /* French Antillean */
   {"ach",       HB_TAG('A','C','H',' ')},       /* Acoli */
+  {"acr",       HB_TAG('A','C','R',' ')},       /* Achi */
   {"ada",       HB_TAG('D','N','G',' ')},       /* Dangme */
   {"ady",       HB_TAG('A','D','Y',' ')},       /* Adyghe */
   {"af",        HB_TAG('A','F','K',' ')},       /* Afrikaans */
+  {"ahg",       HB_TAG('A','G','W',' ')},       /* Agaw */
   {"aii",       HB_TAG('S','W','A',' ')},       /* Swadaya Aramaic */
   {"aio",       HB_TAG('A','I','O',' ')},       /* Aiton */
   {"aiw",       HB_TAG('A','R','I',' ')},       /* Aari */
   {"ak",        HB_TAG('T','W','I',' ')},       /* Akan [macrolanguage] */
+  {"aka",       HB_TAG('A','K','A',' ')},       /* Akan */
   {"alt",       HB_TAG('A','L','T',' ')},       /* [Southern] Altai */
   {"am",        HB_TAG('A','M','H',' ')},       /* Amharic */
   {"amf",       HB_TAG('H','B','N',' ')},       /* Hammer-Banna */
@@ -206,6 +210,7 @@
   {"as",        HB_TAG('A','S','M',' ')},       /* Assamese */
   {"ast",       HB_TAG('A','S','T',' ')},       /* Asturian/Asturleonese/Bable/Leonese */
   {"ath",       HB_TAG('A','T','H',' ')},       /* Athapaskan [family] */
+  {"atj",       HB_TAG('R','C','R',' ')},       /* R-Cree */
   {"atv",       HB_TAG('A','L','T',' ')},       /* [Northern] Altai */
   {"av",        HB_TAG('A','V','R',' ')},       /* Avaric */
   {"awa",       HB_TAG('A','W','A',' ')},       /* Awadhi */
@@ -214,6 +219,7 @@
   {"azb",       HB_TAG('A','Z','B',' ')},       /* South Azerbaijani */
   {"azj",       HB_TAG('A','Z','E',' ')},       /* North Azerbaijani */
   {"ba",        HB_TAG('B','S','H',' ')},       /* Bashkir */
+  {"bad",       HB_TAG('B','A','D','0')},       /* Banda */
   {"bai",       HB_TAG('B','M','L',' ')},       /* Bamileke [family] */
   {"bal",       HB_TAG('B','L','I',' ')},       /* Baluchi [macrolangauge] */
   {"ban",       HB_TAG('B','A','N',' ')},       /* Balinese */
@@ -222,11 +228,13 @@
   {"bci",       HB_TAG('B','A','U',' ')},       /* Baoulé */
   {"bcl",       HB_TAG('B','I','K',' ')},       /* Central Bikol */
   {"bcq",       HB_TAG('B','C','H',' ')},       /* Bench */
+  {"bdy",       HB_TAG('B','D','Y',' ')},       /* Bandjalang */
   {"be",        HB_TAG('B','E','L',' ')},       /* Belarusian */
   {"bem",       HB_TAG('B','E','M',' ')},       /* Bemba (Zambia) */
   {"ber",       HB_TAG('B','E','R',' ')},       /* Berber [family] */
   {"bfq",       HB_TAG('B','A','D',' ')},       /* Badaga */
   {"bft",       HB_TAG('B','L','T',' ')},       /* Balti */
+  {"bfu",       HB_TAG('L','A','H',' ')},       /* Lahuli */
   {"bfy",       HB_TAG('B','A','G',' ')},       /* Baghelkhandi */
   {"bg",        HB_TAG('B','G','R',' ')},       /* Bulgarian */
   {"bgc",       HB_TAG('B','G','C',' ')},       /* Haryanvi */
@@ -260,11 +268,13 @@
   {"bxr",       HB_TAG('R','B','U',' ')},       /* Russian Buriat */
   {"byn",       HB_TAG('B','I','L',' ')},       /* Bilen */
   {"ca",        HB_TAG('C','A','T',' ')},       /* Catalan */
+  {"cak",       HB_TAG('C','A','K',' ')},       /* Kaqchikel */
   {"cbk",       HB_TAG('C','B','K',' ')},       /* Chavacano */
   {"ce",        HB_TAG('C','H','E',' ')},       /* Chechen */
   {"ceb",       HB_TAG('C','E','B',' ')},       /* Cebuano */
   {"cgg",       HB_TAG('C','G','G',' ')},       /* Chiga */
   {"ch",        HB_TAG('C','H','A',' ')},       /* Chamorro */
+  {"chk",       HB_TAG('C','H','K','0')},       /* Chuukese */
   {"cho",       HB_TAG('C','H','O',' ')},       /* Choctaw */
   {"chp",       HB_TAG('C','H','P',' ')},       /* Chipewyan */
   {"chr",       HB_TAG('C','H','R',' ')},       /* Cherokee */
@@ -272,9 +282,12 @@
   {"ckb",       HB_TAG('K','U','R',' ')},       /* Central Kurdish (Sorani) */
   {"ckt",       HB_TAG('C','H','K',' ')},       /* Chukchi */
   {"cop",       HB_TAG('C','O','P',' ')},       /* Coptic */
+  {"cpp",       HB_TAG('C','P','P',' ')},       /* Creoles */
   {"cr",        HB_TAG('C','R','E',' ')},       /* Cree */
+  {"cre",       HB_TAG('Y','C','R',' ')},       /* Y-Cree */
   {"crh",       HB_TAG('C','R','T',' ')},       /* Crimean Tatar */
   {"crj",       HB_TAG('E','C','R',' ')},       /* [Southern] East Cree */
+  {"crk",       HB_TAG('W','C','R',' ')},       /* West-Cree */
   {"crl",       HB_TAG('E','C','R',' ')},       /* [Northern] East Cree */
   {"crm",       HB_TAG('M','C','R',' ')},       /* Moose Cree */
   {"crx",       HB_TAG('C','R','R',' ')},       /* Carrier */
@@ -283,21 +296,27 @@
   {"ctg",       HB_TAG('C','T','G',' ')},       /* Chittagonian */
   {"cts",       HB_TAG('B','I','K',' ')},       /* Northern Catanduanes Bikol */
   {"cu",        HB_TAG('C','S','L',' ')},       /* Church Slavic */
+  {"cuk",       HB_TAG('C','U','K',' ')},       /* San Blas Kuna */
   {"cv",        HB_TAG('C','H','U',' ')},       /* Chuvash */
   {"cwd",       HB_TAG('D','C','R',' ')},       /* Woods Cree */
   {"cy",        HB_TAG('W','E','L',' ')},       /* Welsh */
   {"da",        HB_TAG('D','A','N',' ')},       /* Danish */
   {"dap",       HB_TAG('N','I','S',' ')},       /* Nisi (India) */
   {"dar",       HB_TAG('D','A','R',' ')},       /* Dargwa */
+  {"dax",       HB_TAG('D','A','X',' ')},       /* Dayi */
   {"de",        HB_TAG('D','E','U',' ')},       /* German */
   {"dgo",       HB_TAG('D','G','O',' ')},       /* Dogri */
   {"dhd",       HB_TAG('M','A','W',' ')},       /* Dhundari */
+  {"dhg",       HB_TAG('D','H','G',' ')},       /* Dhangu */
   {"din",       HB_TAG('D','N','K',' ')},       /* Dinka [macrolanguage] */
   {"diq",       HB_TAG('D','I','Q',' ')},       /* Dimli */
   {"dje",       HB_TAG('D','J','R',' ')},       /* Zarma */
+  {"djr",       HB_TAG('D','J','R','0')},       /* Djambarrpuyngu */
   {"dng",       HB_TAG('D','U','N',' ')},       /* Dungan */
+  {"dnj",       HB_TAG('D','N','J',' ')},       /* Dan */
   {"doi",       HB_TAG('D','G','R',' ')},       /* Dogri [macrolanguage] */
   {"dsb",       HB_TAG('L','S','B',' ')},       /* Lower Sorbian */
+  {"duj",       HB_TAG('D','U','J',' ')},       /* Dhuwal */
   {"dv",        HB_TAG('D','I','V',' ')},       /* Dhivehi/Divehi/Maldivian */
   {"dyu",       HB_TAG('J','U','L',' ')},       /* Jula */
   {"dz",        HB_TAG('D','Z','N',' ')},       /* Dzongkha */
@@ -307,23 +326,30 @@
   {"el",        HB_TAG('E','L','L',' ')},       /* Modern Greek (1453-) */
   {"emk",       HB_TAG('M','N','K',' ')},       /* Eastern Maninkakan */
   {"en",        HB_TAG('E','N','G',' ')},       /* English */
+  {"enf",       HB_TAG('F','N','E',' ')},       /* Forest Nenets */
+  {"enh",       HB_TAG('T','N','E',' ')},       /* Tundra Nenets */
   {"eo",        HB_TAG('N','T','O',' ')},       /* Esperanto */
   {"eot",       HB_TAG('B','T','I',' ')},       /* Beti (Côte d'Ivoire) */
   {"es",        HB_TAG('E','S','P',' ')},       /* Spanish */
+  {"esu",       HB_TAG('E','S','U',' ')},       /* Central Yupik */
   {"et",        HB_TAG('E','T','I',' ')},       /* Estonian [macrolanguage] */
   {"eu",        HB_TAG('E','U','Q',' ')},       /* Basque */
   {"eve",       HB_TAG('E','V','N',' ')},       /* Even */
   {"evn",       HB_TAG('E','V','K',' ')},       /* Evenki */
   {"fa",        HB_TAG('F','A','R',' ')},       /* Persian [macrolanguage] */
+  {"fan",       HB_TAG('F','A','N','0')},       /* Fang */
+  {"fat",       HB_TAG('F','A','T',' ')},       /* Fanti */
   {"ff",        HB_TAG('F','U','L',' ')},       /* Fulah [macrolanguage] */
   {"fi",        HB_TAG('F','I','N',' ')},       /* Finnish */
   {"fil",       HB_TAG('P','I','L',' ')},       /* Filipino */
   {"fj",        HB_TAG('F','J','I',' ')},       /* Fijian */
+  {"flm",       HB_TAG('H','A','L',' ')},       /* Halam */
   {"fo",        HB_TAG('F','O','S',' ')},       /* Faroese */
   {"fon",       HB_TAG('F','O','N',' ')},       /* Fon */
   {"fr",        HB_TAG('F','R','A',' ')},       /* French */
   {"frc",       HB_TAG('F','R','C',' ')},       /* Cajun French */
   {"frp",       HB_TAG('F','R','P',' ')},       /* Arpitan/Francoprovençal */
+  {"fuf",       HB_TAG('F','T','A',' ')},       /* Futa */
   {"fur",       HB_TAG('F','R','L',' ')},       /* Friulian */
   {"fuv",       HB_TAG('F','U','V',' ')},       /* Nigerian Fulfulde */
   {"fy",        HB_TAG('F','R','I',' ')},       /* Western Frisian */
@@ -334,17 +360,24 @@
   {"gd",        HB_TAG('G','A','E',' ')},       /* Scottish Gaelic */
   {"gez",       HB_TAG('G','E','Z',' ')},       /* Ge'ez */
   {"ggo",       HB_TAG('G','O','N',' ')},       /* Southern Gondi */
+  {"gih",       HB_TAG('G','I','H',' ')},       /* Githabul */
+  {"gil",       HB_TAG('G','I','L','0')},       /* Kiribati (Gilbertese) */
+  {"gkp",       HB_TAG('G','K','P',' ')},       /* Kpelle (Guinea) */
   {"gl",        HB_TAG('G','A','L',' ')},       /* Galician */
   {"gld",       HB_TAG('N','A','N',' ')},       /* Nanai */
+  {"gle",       HB_TAG('I','R','T',' ')},       /* Irish Traditional */
   {"glk",       HB_TAG('G','L','K',' ')},       /* Gilaki */
   {"gn",        HB_TAG('G','U','A',' ')},       /* Guarani [macrolanguage] */
+  {"gnn",       HB_TAG('G','N','N',' ')},       /* Gumatj */
   {"gno",       HB_TAG('G','O','N',' ')},       /* Northern Gondi */
   {"gog",       HB_TAG('G','O','G',' ')},       /* Gogo */
   {"gon",       HB_TAG('G','O','N',' ')},       /* Gondi [macrolanguage] */
   {"grt",       HB_TAG('G','R','O',' ')},       /* Garo */
   {"gru",       HB_TAG('S','O','G',' ')},       /* Sodo Gurage */
+  {"gsw",       HB_TAG('A','L','S',' ')},       /* Alsatian */
   {"gu",        HB_TAG('G','U','J',' ')},       /* Gujarati */
   {"guc",       HB_TAG('G','U','C',' ')},       /* Wayuu */
+  {"guf",       HB_TAG('G','U','F',' ')},       /* Gupapuyngu */
   {"guk",       HB_TAG('G','M','Z',' ')},       /* Gumuz */
 /*{"guk",       HB_TAG('G','U','K',' ')},*/     /* Gumuz (in SIL fonts) */
   {"guz",       HB_TAG('G','U','Z',' ')},       /* Ekegusii/Gusii */
@@ -355,9 +388,9 @@
   {"hay",       HB_TAG('H','A','Y',' ')},       /* Haya */
   {"haz",       HB_TAG('H','A','Z',' ')},       /* Hazaragi */
   {"he",        HB_TAG('I','W','R',' ')},       /* Hebrew */
-  {"hz",        HB_TAG('H','E','R',' ')},       /* Herero */
   {"hi",        HB_TAG('H','I','N',' ')},       /* Hindi */
   {"hil",       HB_TAG('H','I','L',' ')},       /* Hiligaynon */
+  {"hmn",       HB_TAG('H','M','N',' ')},       /* Hmong */
   {"hnd",       HB_TAG('H','N','D',' ')},       /* [Southern] Hindko */
   {"hne",       HB_TAG('C','H','H',' ')},       /* Chattisgarhi */
   {"hno",       HB_TAG('H','N','D',' ')},       /* [Northern] Hindko */
@@ -371,11 +404,13 @@
   {"hy",        HB_TAG('H','Y','E',' ')},       /* Armenian */
   {"hz",        HB_TAG('H','E','R',' ')},       /* Herero */
   {"ia",        HB_TAG('I','N','A',' ')},       /* Interlingua (International Auxiliary Language Association) */
+  {"iba",       HB_TAG('I','B','A',' ')},       /* Iban */
   {"ibb",       HB_TAG('I','B','B',' ')},       /* Ibibio */
   {"id",        HB_TAG('I','N','D',' ')},       /* Indonesian */
   {"ie",        HB_TAG('I','L','E',' ')},       /* Interlingue/Occidental */
   {"ig",        HB_TAG('I','B','O',' ')},       /* Igbo */
   {"igb",       HB_TAG('E','B','I',' ')},       /* Ebira */
+  {"ii",        HB_TAG('Y','I','M',' ')},       /* Yi Modern */
   {"ijc",       HB_TAG('I','J','O',' ')},       /* Izon */
   {"ijo",       HB_TAG('I','J','O',' ')},       /* Ijo [family] */
   {"ik",        HB_TAG('I','P','K',' ')},       /* Inupiaq [macrolanguage] */
@@ -391,15 +426,20 @@
   {"jv",        HB_TAG('J','A','V',' ')},       /* Javanese */
   {"ka",        HB_TAG('K','A','T',' ')},       /* Georgian */
   {"kaa",       HB_TAG('K','R','K',' ')},       /* Karakalpak */
-  {"kab",       HB_TAG('K','A','B',' ')},       /* Kabyle */
+  {"kab",       HB_TAG('K','A','B','0')},       /* Kabyle */
   {"kam",       HB_TAG('K','M','B',' ')},       /* Kamba (Kenya) */
   {"kar",       HB_TAG('K','R','N',' ')},       /* Karen [family] */
+  {"kat",       HB_TAG('K','G','E',' ')},       /* Khutsuri Georgian */
   {"kbd",       HB_TAG('K','A','B',' ')},       /* Kabardian */
   {"kde",       HB_TAG('K','D','E',' ')},       /* Makonde */
   {"kdr",       HB_TAG('K','R','M',' ')},       /* Karaim */
   {"kdt",       HB_TAG('K','U','Y',' ')},       /* Kuy */
+  {"kea",       HB_TAG('K','E','A',' ')},       /* Kabuverdianu (Crioulo) */
+  {"kek",       HB_TAG('K','E','K',' ')},       /* Kekchi */
   {"kex",       HB_TAG('K','K','N',' ')},       /* Kokni */
+  {"kfa",       HB_TAG('K','O','D',' ')},       /* Kodagu */
   {"kfr",       HB_TAG('K','A','C',' ')},       /* Kachchi */
+  {"kfx",       HB_TAG('K','U','L',' ')},       /* Kulvi */
   {"kfy",       HB_TAG('K','M','N',' ')},       /* Kumaoni */
   {"kg",        HB_TAG('K','O','N',' ')},       /* Kongo [macrolanguage] */
   {"kha",       HB_TAG('K','S','I',' ')},       /* Khasi */
@@ -408,7 +448,9 @@
 /*{"kht",       HB_TAG('K','H','T',' ')},*/     /* Khamti (OpenType spec and SIL fonts) */
   {"khw",       HB_TAG('K','H','W',' ')},       /* Khowar */
   {"ki",        HB_TAG('K','I','K',' ')},       /* Gikuyu/Kikuyu */
+  {"kiu",       HB_TAG('K','I','U',' ')},       /* Kirmanjki */
   {"kj",        HB_TAG('K','U','A',' ')},       /* Kuanyama/Kwanyama */
+  {"kjd",       HB_TAG('K','J','D',' ')},       /* Southern Kiwai */
   {"kjh",       HB_TAG('K','H','A',' ')},       /* Khakass */
   {"kjp",       HB_TAG('K','J','P',' ')},       /* Pwo Eastern Karen */
   {"kk",        HB_TAG('K','A','Z',' ')},       /* Kazakh */
@@ -422,6 +464,8 @@
   {"ko",        HB_TAG('K','O','R',' ')},       /* Korean */
   {"koi",       HB_TAG('K','O','P',' ')},       /* Komi-Permyak */
   {"kok",       HB_TAG('K','O','K',' ')},       /* Konkani [macrolanguage] */
+  {"kon",       HB_TAG('K','O','N','0')},       /* Kongo */
+  {"kos",       HB_TAG('K','O','S',' ')},       /* Kosraean */
   {"kpe",       HB_TAG('K','P','L',' ')},       /* Kpelle [macrolanguage] */
   {"kpv",       HB_TAG('K','O','Z',' ')},       /* Komi-Zyrian */
   {"kpy",       HB_TAG('K','Y','K',' ')},       /* Koryak */
@@ -431,9 +475,11 @@
   {"krl",       HB_TAG('K','R','L',' ')},       /* Karelian */
   {"kru",       HB_TAG('K','U','U',' ')},       /* Kurukh */
   {"ks",        HB_TAG('K','S','H',' ')},       /* Kashmiri */
-  {"ksh",       HB_TAG('K','S','H',' ')},       /* Kölsch */
+  {"ksh",       HB_TAG('K','S','H','0')},       /* Ripuarian, Kölsch */
 /*{"ksw",       HB_TAG('K','R','N',' ')},*/     /* S'gaw Karen (Microsoft fonts?) */
   {"ksw",       HB_TAG('K','S','W',' ')},       /* S'gaw Karen (OpenType spec and SIL fonts) */
+  {"ktb",       HB_TAG('K','E','B',' ')},       /* Kebena */
+  {"ktu",       HB_TAG('K','O','N',' ')},       /* Kikongo */
   {"ku",        HB_TAG('K','U','R',' ')},       /* Kurdish [macrolanguage] */
   {"kum",       HB_TAG('K','U','M',' ')},       /* Kumyk */
   {"kv",        HB_TAG('K','O','M',' ')},       /* Komi [macrolanguage] */
@@ -461,6 +507,7 @@
   {"lmo",       HB_TAG('L','M','O',' ')},       /* Lombard */
   {"ln",        HB_TAG('L','I','N',' ')},       /* Lingala */
   {"lo",        HB_TAG('L','A','O',' ')},       /* Lao */
+  {"lom",       HB_TAG('L','O','M',' ')},       /* Loma */
   {"lrc",       HB_TAG('L','R','C',' ')},       /* Northern Luri */
   {"lt",        HB_TAG('L','T','H',' ')},       /* Lithuanian */
   {"lu",        HB_TAG('L','U','B',' ')},       /* Luba-Katanga */
@@ -475,6 +522,8 @@
   {"mag",       HB_TAG('M','A','G',' ')},       /* Magahi */
   {"mai",       HB_TAG('M','T','H',' ')},       /* Maithili */
   {"mak",       HB_TAG('M','K','R',' ')},       /* Makasar */
+  {"mal",       HB_TAG('M','A','L',' ')},       /* Malayalam */
+  {"mam",       HB_TAG('M','A','M',' ')},       /* Mam */
   {"man",       HB_TAG('M','N','K',' ')},       /* Manding/Mandingo [macrolanguage] */
   {"mdc",       HB_TAG('M','L','E',' ')},       /* Male (Papua New Guinea) */
   {"mdf",       HB_TAG('M','O','K',' ')},       /* Moksha */
@@ -517,6 +566,7 @@
   {"mww",       HB_TAG('M','W','W',' ')},       /* Hmong Daw */
   {"my",        HB_TAG('B','R','M',' ')},       /* Burmese */
   {"mym",       HB_TAG('M','E','N',' ')},       /* Me'en */
+  {"myn",       HB_TAG('M','Y','N',' ')},       /* Mayan */
   {"myq",       HB_TAG('M','N','K',' ')},       /* Forest Maninka (retired code) */
   {"myv",       HB_TAG('E','R','Z',' ')},       /* Erzya */
   {"mzn",       HB_TAG('M','Z','N',' ')},       /* Mazanderani */
@@ -534,6 +584,7 @@
   {"ng",        HB_TAG('N','D','G',' ')},       /* Ndonga */
   {"nga",       HB_TAG('N','G','A',' ')},       /* Ngabaka */
   {"ngl",       HB_TAG('L','M','W',' ')},       /* Lomwe */
+  {"ngo",       HB_TAG('S','X','T',' ')},       /* Sutu */
   {"niu",       HB_TAG('N','I','U',' ')},       /* Niuean */
   {"niv",       HB_TAG('G','I','L',' ')},       /* Gilyak */
   {"nl",        HB_TAG('N','L','D',' ')},       /* Dutch */
@@ -554,13 +605,15 @@
   {"oc",        HB_TAG('O','C','I',' ')},       /* Occitan (post 1500) */
   {"oj",        HB_TAG('O','J','B',' ')},       /* Ojibwa [macrolanguage] */
   {"ojs",       HB_TAG('O','C','R',' ')},       /* Oji-Cree */
+  {"okm",       HB_TAG('K','O','H',' ')},       /* Korean Old Hangul */
   {"om",        HB_TAG('O','R','O',' ')},       /* Oromo [macrolanguage] */
   {"or",        HB_TAG('O','R','I',' ')},       /* Oriya */
   {"os",        HB_TAG('O','S','S',' ')},       /* Ossetian */
   {"pa",        HB_TAG('P','A','N',' ')},       /* Panjabi */
   {"pag",       HB_TAG('P','A','G',' ')},       /* Pangasinan */
   {"pam",       HB_TAG('P','A','M',' ')},       /* Kapampangan/Pampanga */
-  {"pap",       HB_TAG('P','A','P',' ')},       /* Papiamento */
+  {"pap",       HB_TAG('P','A','P','0')},       /* Papiamento */
+  {"pau",       HB_TAG('P','A','U',' ')},       /* Palauan */
   {"pcc",       HB_TAG('P','C','C',' ')},       /* Bouyei */
   {"pcd",       HB_TAG('P','C','D',' ')},       /* Picard */
   {"pce",       HB_TAG('P','L','G',' ')},       /* [Ruching] Palaung */
@@ -574,24 +627,34 @@
   {"plp",       HB_TAG('P','A','P',' ')},       /* Palpa */
   {"pms",       HB_TAG('P','M','S',' ')},       /* Piemontese */
   {"pnb",       HB_TAG('P','N','B',' ')},       /* Western Panjabi */
+  {"poh",       HB_TAG('P','O','H',' ')},       /* Pocomchi */
+  {"pon",       HB_TAG('P','O','N',' ')},       /* Pohnpeian */
   {"prs",       HB_TAG('D','R','I',' ')},       /* Afghan Persian/Dari */
   {"ps",        HB_TAG('P','A','S',' ')},       /* Pashto/Pushto [macrolanguage] */
   {"pt",        HB_TAG('P','T','G',' ')},       /* Portuguese */
   {"pwo",       HB_TAG('P','W','O',' ')},       /* Pwo Western Karen */
   {"qu",        HB_TAG('Q','U','Z',' ')},       /* Quechua [macrolanguage] */
   {"quc",       HB_TAG('Q','U','C',' ')},       /* K'iche'/Quiché */
+  {"quh",       HB_TAG('Q','U','H',' ')},       /* Quechua (Bolivia) */
   {"quz",       HB_TAG('Q','U','Z',' ')},       /* Cusco Quechua */
+  {"qvi",       HB_TAG('Q','V','I',' ')},       /* Quechua (Ecuador) */
+  {"qwh",       HB_TAG('Q','W','H',' ')},       /* Quechua (Peru) */
   {"raj",       HB_TAG('R','A','J',' ')},       /* Rajasthani [macrolanguage] */
+  {"rar",       HB_TAG('R','A','R',' ')},       /* Rarotongan */
   {"rbb",       HB_TAG('P','L','G',' ')},       /* Rumai Palaung */
   {"rej",       HB_TAG('R','E','J',' ')},       /* Rejang */
   {"ria",       HB_TAG('R','I','A',' ')},       /* Riang (India) */
+  {"rif",       HB_TAG('R','I','F',' ')},       /* Tarifit */
   {"ril",       HB_TAG('R','I','A',' ')},       /* Riang (Myanmar) */
+  {"rit",       HB_TAG('R','I','T',' ')},       /* Ritarungo */
   {"rki",       HB_TAG('A','R','K',' ')},       /* Rakhine */
+  {"rkw",       HB_TAG('R','K','W',' ')},       /* Arakwal */
   {"rm",        HB_TAG('R','M','S',' ')},       /* Romansh */
   {"rmy",       HB_TAG('R','M','Y',' ')},       /* Vlax Romani */
   {"rn",        HB_TAG('R','U','N',' ')},       /* Rundi */
   {"ro",        HB_TAG('R','O','M',' ')},       /* Romanian */
   {"rom",       HB_TAG('R','O','Y',' ')},       /* Romany [macrolanguage] */
+  {"rtm",       HB_TAG('R','T','M',' ')},       /* Rotuman */
   {"ru",        HB_TAG('R','U','S',' ')},       /* Russian */
   {"rue",       HB_TAG('R','S','Y',' ')},       /* Rusyn */
   {"rup",       HB_TAG('R','U','P',' ')},       /* Aromanian/Arumanian/Macedo-Romanian */
@@ -599,10 +662,11 @@
   {"rwr",       HB_TAG('M','A','W',' ')},       /* Marwari (India) */
   {"sa",        HB_TAG('S','A','N',' ')},       /* Sanskrit */
   {"sah",       HB_TAG('Y','A','K',' ')},       /* Yakut */
+  {"sam",       HB_TAG('P','A','A',' ')},       /* Palestinian Aramaic */
   {"sas",       HB_TAG('S','A','S',' ')},       /* Sasak */
   {"sat",       HB_TAG('S','A','T',' ')},       /* Santali */
+  {"sc",        HB_TAG('S','R','D',' ')},       /* Sardinian [macrolanguage] */
   {"sck",       HB_TAG('S','A','D',' ')},       /* Sadri */
-  {"sc",        HB_TAG('S','R','D',' ')},       /* Sardinian [macrolanguage] */
   {"scn",       HB_TAG('S','C','N',' ')},       /* Sicilian */
   {"sco",       HB_TAG('S','C','O',' ')},       /* Scots */
   {"scs",       HB_TAG('S','L','A',' ')},       /* [North] Slavey */
@@ -615,6 +679,7 @@
   {"sgs",       HB_TAG('S','G','S',' ')},       /* Samogitian */
   {"sgw",       HB_TAG('C','H','G',' ')},       /* Sebat Bet Gurage */
 /*{"sgw",       HB_TAG('S','G','W',' ')},*/     /* Sebat Bet Gurage (in SIL fonts) */
+  {"shi",       HB_TAG('S','H','I',' ')},       /* Tachelhit */
   {"shn",       HB_TAG('S','H','N',' ')},       /* Shan */
   {"si",        HB_TAG('S','N','H',' ')},       /* Sinhala */
   {"sid",       HB_TAG('S','I','D',' ')},       /* Sidamo */
@@ -627,7 +692,7 @@
   {"smj",       HB_TAG('L','S','M',' ')},       /* Lule Sami */
   {"smn",       HB_TAG('I','S','M',' ')},       /* Inari Sami */
   {"sms",       HB_TAG('S','K','S',' ')},       /* Skolt Sami */
-  {"sn",        HB_TAG('S','N','A',' ')},       /* Shona */
+  {"sn",        HB_TAG('S','N','A','0')},       /* Shona */
   {"snk",       HB_TAG('S','N','K',' ')},       /* Soninke */
   {"so",        HB_TAG('S','M','L',' ')},       /* Somali */
   {"sop",       HB_TAG('S','O','P',' ')},       /* Songe */
@@ -665,20 +730,24 @@
   {"tiv",       HB_TAG('T','I','V',' ')},       /* Tiv */
   {"tk",        HB_TAG('T','K','M',' ')},       /* Turkmen */
   {"tl",        HB_TAG('T','G','L',' ')},       /* Tagalog */
-  {"tmh",       HB_TAG('t','m','h',' ')},       /* Tamashek [macrolanguage] */
+  {"tmh",       HB_TAG('T','M','H',' ')},       /* Tamashek */
   {"tn",        HB_TAG('T','N','A',' ')},       /* Tswana */
   {"to",        HB_TAG('T','G','N',' ')},       /* Tonga (Tonga Islands) */
+  {"tod",       HB_TAG('T','O','D','0')},       /* Toma */
+  {"toi",       HB_TAG('T','N','G',' ')},       /* Tonga */
   {"tpi",       HB_TAG('T','P','I',' ')},       /* Tok Pisin */
   {"tr",        HB_TAG('T','R','K',' ')},       /* Turkish */
   {"tru",       HB_TAG('T','U','A',' ')},       /* Turoyo Aramaic */
   {"ts",        HB_TAG('T','S','G',' ')},       /* Tsonga */
   {"tt",        HB_TAG('T','A','T',' ')},       /* Tatar */
   {"tum",       HB_TAG('T','U','M',' ')},       /* Tumbuka */
+  {"tvl",       HB_TAG('T','V','L',' ')},       /* Tuvalu */
   {"tw",        HB_TAG('T','W','I',' ')},       /* Twi */
   {"ty",        HB_TAG('T','H','T',' ')},       /* Tahitian */
   {"tyv",       HB_TAG('T','U','V',' ')},       /* Tuvin */
   {"tyz",       HB_TAG('T','Y','Z',' ')},       /* Tày */
   {"tzm",       HB_TAG('T','Z','M',' ')},       /* Central Atlas Tamazight */
+  {"tzo",       HB_TAG('T','Z','O',' ')},       /* Tzotzil */
   {"udm",       HB_TAG('U','D','M',' ')},       /* Udmurt */
   {"ug",        HB_TAG('U','Y','G',' ')},       /* Uighur */
   {"uk",        HB_TAG('U','K','R',' ')},       /* Ukrainian */
@@ -690,8 +759,8 @@
   {"uzs",       HB_TAG('U','Z','B',' ')},       /* Southern Uzbek */
   {"ve",        HB_TAG('V','E','N',' ')},       /* Venda */
   {"vec",       HB_TAG('V','E','C',' ')},       /* Venetian */
+  {"vi",        HB_TAG('V','I','T',' ')},       /* Vietnamese */
   {"vls",       HB_TAG('F','L','E',' ')},       /* Vlaams */
-  {"vi",        HB_TAG('V','I','T',' ')},       /* Vietnamese */
   {"vmw",       HB_TAG('M','A','K',' ')},       /* Makhuwa */
   {"vo",        HB_TAG('V','O','L',' ')},       /* Volapük */
   {"vro",       HB_TAG('V','R','O',' ')},       /* Võro */
@@ -700,72 +769,60 @@
   {"wbm",       HB_TAG('W','A',' ',' ')},       /* Wa */
   {"wbr",       HB_TAG('W','A','G',' ')},       /* Wagdi */
   {"wle",       HB_TAG('S','I','G',' ')},       /* Wolane */
+  {"wo",        HB_TAG('W','L','F',' ')},       /* Wolof */
   {"wry",       HB_TAG('M','A','W',' ')},       /* Merwari */
   {"wtm",       HB_TAG('W','T','M',' ')},       /* Mewati */
-  {"wo",        HB_TAG('W','L','F',' ')},       /* Wolof */
   {"xal",       HB_TAG('K','L','M',' ')},       /* Kalmyk */
+  {"xan",       HB_TAG('S','E','K',' ')},       /* Sekota */
   {"xh",        HB_TAG('X','H','S',' ')},       /* Xhosa */
+  {"xjb",       HB_TAG('X','J','B',' ')},       /* Minjangbal */
   {"xog",       HB_TAG('X','O','G',' ')},       /* Soga */
   {"xom",       HB_TAG('K','M','O',' ')},       /* Komo (Sudan) */
+  {"xpe",       HB_TAG('X','P','E',' ')},       /* Kpelle (Liberia) */
   {"xsl",       HB_TAG('S','S','L',' ')},       /* South Slavey */
   {"xst",       HB_TAG('S','I','G',' ')},       /* Silt'e (retired code) */
   {"xwo",       HB_TAG('T','O','D',' ')},       /* Written Oirat (Todo) */
   {"yao",       HB_TAG('Y','A','O',' ')},       /* Yao */
+  {"yap",       HB_TAG('Y','A','P',' ')},       /* Yapese */
   {"yi",        HB_TAG('J','I','I',' ')},       /* Yiddish [macrolanguage] */
   {"yo",        HB_TAG('Y','B','A',' ')},       /* Yoruba */
   {"yso",       HB_TAG('N','I','S',' ')},       /* Nisi (China) */
   {"za",        HB_TAG('Z','H','A',' ')},       /* Chuang/Zhuang [macrolanguage] */
   {"zea",       HB_TAG('Z','E','A',' ')},       /* Zeeuws */
+  {"zgh",       HB_TAG('Z','G','H',' ')},       /* Standard Morrocan Tamazigh */
   {"zne",       HB_TAG('Z','N','D',' ')},       /* Zande */
   {"zu",        HB_TAG('Z','U','L',' ')},       /* Zulu */
-  {"zum",       HB_TAG('L','R','C',' ')}        /* Kumzari */
+  {"zum",       HB_TAG('L','R','C',' ')},       /* Kumzari */
+  {"zza",       HB_TAG('Z','Z','A',' ')},       /* Zazaki */
 
   /* The corresponding languages IDs for the following IDs are unclear,
    * overlap, or are architecturally weird. Needs more research. */
 
-/*{"ahg/awn/xan?",      HB_TAG('A','G','W',' ')},*/     /* Agaw */
-/*{"gsw?/gsw-FR?",      HB_TAG('A','L','S',' ')},*/     /* Alsatian */
+/*{"chp",       HB_TAG('S','A','Y',' ')},*/     /* Sayisi */
+/*{"cwd",       HB_TAG('T','C','R',' ')},*/     /* TH-Cree */
+/*{"emk",       HB_TAG('E','M','K',' ')},*/     /* Eastern Maninkakan */
 /*{"krc",       HB_TAG('B','A','L',' ')},*/     /* Balkar */
 /*{"??",        HB_TAG('B','C','R',' ')},*/     /* Bible Cree */
 /*{"zh?",       HB_TAG('C','H','N',' ')},*/     /* Chinese (seen in Microsoft fonts) */
-/*{"acf/gcf?",  HB_TAG('F','A','N',' ')},*/     /* French Antillean */
-/*{"enf?/yrk?", HB_TAG('F','N','E',' ')},*/     /* Forest Nenets */
-/*{"fuf?",      HB_TAG('F','T','A',' ')},*/     /* Futa */
 /*{"ar-Syrc?",  HB_TAG('G','A','R',' ')},*/     /* Garshuni */
-/*{"cfm/rnl?",  HB_TAG('H','A','L',' ')},*/     /* Halam */
-/*{"ga-Latg?/Latg?",    HB_TAG('I','R','T',' ')},*/     /* Irish Traditional */
+/*{"hy?",       HB_TAG('H','Y','E','0')},*/     /* Armenian East (ISO 639-3 hye according to Microsoft, but that’s equivalent to ISO 639-1 hy) */
+/*{"ga-Latg?/"  HB_TAG('I','R','T',' ')},*/     /* Irish Traditional */
 /*{"krc",       HB_TAG('K','A','R',' ')},*/     /* Karachay */
-/*{"alw?/ktb?", HB_TAG('K','E','B',' ')},*/     /* Kebena */
-/*{"Geok",      HB_TAG('K','G','E',' ')},*/     /* Khutsuri Georgian */
+/*{"ka-Geok?",  HB_TAG('K','G','E',' ')},*/     /* Khutsuri Georgian */
 /*{"kca",       HB_TAG('K','H','K',' ')},*/     /* Khanty-Kazim */
 /*{"kca",       HB_TAG('K','H','S',' ')},*/     /* Khanty-Shurishkar */
 /*{"kca",       HB_TAG('K','H','V',' ')},*/     /* Khanty-Vakhi */
-/*{"guz?/kqs?/kss?",    HB_TAG('K','I','S',' ')},*/     /* Kisii */
-/*{"kfa/kfi?/kpb?/xua?/xuj?",   HB_TAG('K','O','D',' ')},*/     /* Kodagu */
-/*{"okm?/oko?", HB_TAG('K','O','H',' ')},*/     /* Korean Old Hangul */
-/*{"kon?/ktu?/...",     HB_TAG('K','O','N',' ')},*/     /* Kikongo */
-/*{"kfx?",      HB_TAG('K','U','L',' ')},*/     /* Kulvi */
-/*{"??",        HB_TAG('L','A','H',' ')},*/     /* Lahuli */
-/*{"??",        HB_TAG('L','C','R',' ')},*/     /* L-Cree */
+/*{"kqs, kss",  HB_TAG('K','I','S',' ')},*/     /* Kisii */
+/*{"lua",       HB_TAG('L','U','A',' ')},*/     /* Luba-Lulua */
+/*{"mlq",       HB_TAG('M','L','N',' ')},*/     /* Malinke */
+/*{"nso",       HB_TAG('N','S','O',' ')},*/     /* Sotho, Northern */
 /*{"??",        HB_TAG('M','A','L',' ')},*/     /* Malayalam Traditional */
-/*{"mnk?/mlq?/...",     HB_TAG('M','L','N',' ')},*/     /* Malinke */
-/*{"??",        HB_TAG('N','C','R',' ')},*/     /* N-Cree */
-/*{"??",        HB_TAG('N','H','C',' ')},*/     /* Norway House Cree */
-/*{"jpa?/sam?", HB_TAG('P','A','A',' ')},*/     /* Palestinian Aramaic */
-/*{"polyton",   HB_TAG('P','G','R',' ')},*/     /* Polytonic Greek */
-/*{"??",        HB_TAG('Q','I','N',' ')},*/     /* Asho Chin */
-/*{"??",        HB_TAG('R','C','R',' ')},*/     /* R-Cree */
-/*{"chp?",      HB_TAG('S','A','Y',' ')},*/     /* Sayisi */
-/*{"xan?",      HB_TAG('S','E','K',' ')},*/     /* Sekota */
-/*{"ngo?",      HB_TAG('S','X','T',' ')},*/     /* Sutu */
-/*{"??",        HB_TAG('T','C','R',' ')},*/     /* TH-Cree */
-/*{"tnz?/tog?/toi?",    HB_TAG('T','N','G',' ')},*/     /* Tonga */
-/*{"enh?/yrk?", HB_TAG('T','N','E',' ')},*/     /* Tundra Nenets */
-/*{"??",        HB_TAG('W','C','R',' ')},*/     /* West-Cree */
-/*{"cre?",      HB_TAG('Y','C','R',' ')},*/     /* Y-Cree */
+/*{"csw",       HB_TAG('N','C','R',' ')},*/     /* N-Cree */
+/*{"csw",       HB_TAG('N','H','C',' ')},*/     /* Norway House Cree */
+/*{"el-polyton",        HB_TAG('P','G','R',' ')},*/     /* Polytonic Greek */
+/*{"bgr, cnh, cnw, czt, sez, tcp, csy, ctd, flm, pck, tcz, zom, cmr, dao, hlt, cka, cnk, mrh, mwg, cbl, cnb, csh",      HB_TAG('Q','I','N',' ')},*/     /* Chin */
 /*{"??",        HB_TAG('Y','I','C',' ')},*/     /* Yi Classic */
-/*{"ii?/Yiii?", HB_TAG('Y','I','M',' ')},*/     /* Yi Modern */
-/*{"??",        HB_TAG('Z','H','P',' ')},*/     /* Chinese Phonetic */
+/*{"zh-Latn-pinyin",    HB_TAG('Z','H','P',' ')},*/     /* Chinese Phonetic */
 };
 
 typedef struct {
@@ -928,4 +985,27 @@
   }
 }
 
+#ifdef MAIN
+static inline void
+test_langs_sorted (void)
+{
+  for (unsigned int i = 1; i < ARRAY_LENGTH (ot_languages); i++)
+  {
+    int c = lang_compare_first_component (ot_languages[i-1].language, ot_languages[i].language);
+    if (c >= 0)
+    {
+      fprintf (stderr, "ot_languages not sorted at index %d: %s %d %s\n",
+               i, ot_languages[i-1].language, c, ot_languages[i].language);
+      abort();
+    }
+  }
+}
 
+int
+main (void)
+{
+  test_langs_sorted ();
+  return 0;
+}
+
+#endif
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-tag.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-tag.h	Wed Jul 05 22:06:46 2017 +0200
@@ -39,18 +39,18 @@
 #define HB_OT_TAG_DEFAULT_SCRIPT        HB_TAG ('D', 'F', 'L', 'T')
 #define HB_OT_TAG_DEFAULT_LANGUAGE      HB_TAG ('d', 'f', 'l', 't')
 
-void
+HB_EXTERN void
 hb_ot_tags_from_script (hb_script_t  script,
                         hb_tag_t    *script_tag_1,
                         hb_tag_t    *script_tag_2);
 
-hb_script_t
+HB_EXTERN hb_script_t
 hb_ot_tag_to_script (hb_tag_t tag);
 
-hb_tag_t
+HB_EXTERN hb_tag_t
 hb_ot_tag_from_language (hb_language_t language);
 
-hb_language_t
+HB_EXTERN hb_language_t
 hb_ot_tag_to_language (hb_tag_t tag);
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-private.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-private.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -83,7 +83,7 @@
 #define unlikely(expr) (expr)
 #endif
 
-#ifndef __GNUC__
+#if !defined(__GNUC__) && !defined(__clang__)
 #undef __attribute__
 #define __attribute__(x)
 #endif
@@ -119,6 +119,36 @@
 #define HB_FUNC __func__
 #endif
 
+/*
+ * Borrowed from https://bugzilla.mozilla.org/show_bug.cgi?id=1215411
+ * HB_FALLTHROUGH is an annotation to suppress compiler warnings about switch
+ * cases that fall through without a break or return statement. HB_FALLTHROUGH
+ * is only needed on cases that have code:
+ *
+ * switch (foo) {
+ *   case 1: // These cases have no code. No fallthrough annotations are needed.
+ *   case 2:
+ *   case 3:
+ *     foo = 4; // This case has code, so a fallthrough annotation is needed:
+ *     HB_FALLTHROUGH;
+ *   default:
+ *     return foo;
+ * }
+ */
+#if defined(__clang__) && __cplusplus >= 201103L
+   /* clang's fallthrough annotations are only available starting in C++11. */
+#  define HB_FALLTHROUGH [[clang::fallthrough]]
+#elif defined(_MSC_VER)
+   /*
+    * MSVC's __fallthrough annotations are checked by /analyze (Code Analysis):
+    * https://msdn.microsoft.com/en-us/library/ms235402%28VS.80%29.aspx
+    */
+#  include <sal.h>
+#  define HB_FALLTHROUGH __fallthrough
+#else
+#  define HB_FALLTHROUGH /* FALLTHROUGH */
+#endif
+
 #if defined(_WIN32) || defined(__CYGWIN__)
    /* We need Windows Vista for both Uniscribe backend and for
     * MemoryBarrier.  We don't support compiling on Windows XP,
@@ -139,6 +169,7 @@
 #  if defined(_WIN32_WCE)
      /* Some things not defined on Windows CE. */
 #    define strdup _strdup
+#    define vsnprintf _vsnprintf
 #    define getenv(Name) NULL
 #    if _WIN32_WCE < 0x800
 #      define setlocale(Category, Locale) "C"
@@ -149,6 +180,9 @@
 #  endif
 #  if defined(_MSC_VER) && _MSC_VER < 1900
 #    define snprintf _snprintf
+#  elif defined(_MSC_VER) && _MSC_VER >= 1900
+#    /* Covers VC++ Error for strdup being a deprecated POSIX name and to instead use _strdup instead */
+#    define strdup _strdup
 #  endif
 #endif
 
@@ -210,9 +244,9 @@
 #define _ASSERT_STATIC0(_line, _cond)   _ASSERT_STATIC1 (_line, (_cond))
 #define ASSERT_STATIC(_cond)            _ASSERT_STATIC0 (__LINE__, (_cond))
 
-/* Note: C++ allows sizeof() of variable-lengh arrays.  So, if _cond is not
- * constant, it still compiles (ouch!), but at least we'll get a -Wvla warning. */
-#define ASSERT_STATIC_EXPR_ZERO(_cond) (0 * sizeof (char[(_cond) ? 1 : -1]))
+template <unsigned int cond> class hb_assert_constant_t {};
+
+#define ASSERT_STATIC_EXPR_ZERO(_cond) (0 * (unsigned int) sizeof (hb_assert_constant_t<_cond>))
 
 #define _PASTE1(a,b) a##b
 #define PASTE(a,b) _PASTE1(a,b)
@@ -578,6 +612,15 @@
 /* Debug */
 
 
+/* HB_NDEBUG disables some sanity checks that are very safe to disable and
+ * should be disabled in production systems.  If NDEBUG is defined, enable
+ * HB_NDEBUG; but if it's desirable that normal assert()s (which are very
+ * light-weight) to be enabled, then HB_DEBUG can be defined to disable
+ * the costlier checks. */
+#ifdef NDEBUG
+#define HB_NDEBUG
+#endif
+
 #ifndef HB_DEBUG
 #define HB_DEBUG 0
 #endif
@@ -861,6 +904,29 @@
 }
 
 
+/* Enable bitwise ops on enums marked as flags_t */
+/* To my surprise, looks like the function resolver is happy to silently cast
+ * one enum to another...  So this doesn't provide the type-checking that I
+ * originally had in mind... :(.
+ *
+ * For MSVC warnings, see: https://github.com/behdad/harfbuzz/pull/163
+ */
+#ifdef _MSC_VER
+# pragma warning(disable:4200)
+# pragma warning(disable:4800)
+#endif
+#define HB_MARK_AS_FLAG_T(T) \
+        extern "C++" { \
+          static inline T operator | (T l, T r) { return T ((unsigned) l | (unsigned) r); } \
+          static inline T operator & (T l, T r) { return T ((unsigned) l & (unsigned) r); } \
+          static inline T operator ^ (T l, T r) { return T ((unsigned) l ^ (unsigned) r); } \
+          static inline T operator ~ (T r) { return T (~(unsigned int) r); } \
+          static inline T& operator |= (T &l, T r) { l = l | r; return l; } \
+          static inline T& operator &= (T& l, T r) { l = l & r; return l; } \
+          static inline T& operator ^= (T& l, T r) { l = l ^ r; return l; } \
+        }
+
+
 /* Useful for set-operations on small enums.
  * For example, for testing "x ∈ {x1, x2, x3}" use:
  * (FLAG_SAFE(x) & (FLAG(x1) | FLAG(x2) | FLAG(x3)))
@@ -949,5 +1015,7 @@
   return _hb_options.opts;
 }
 
+/* Size signifying variable-sized array */
+#define VAR 1
 
 #endif /* HB_PRIVATE_HH */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-set.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-set.h	Wed Jul 05 22:06:46 2017 +0200
@@ -44,109 +44,109 @@
 typedef struct hb_set_t hb_set_t;
 
 
-hb_set_t *
+HB_EXTERN hb_set_t *
 hb_set_create (void);
 
-hb_set_t *
+HB_EXTERN hb_set_t *
 hb_set_get_empty (void);
 
-hb_set_t *
+HB_EXTERN hb_set_t *
 hb_set_reference (hb_set_t *set);
 
-void
+HB_EXTERN void
 hb_set_destroy (hb_set_t *set);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_set_set_user_data (hb_set_t           *set,
                       hb_user_data_key_t *key,
                       void *              data,
                       hb_destroy_func_t   destroy,
                       hb_bool_t           replace);
 
-void *
+HB_EXTERN void *
 hb_set_get_user_data (hb_set_t           *set,
                       hb_user_data_key_t *key);
 
 
 /* Returns false if allocation has failed before */
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_set_allocation_successful (const hb_set_t *set);
 
-void
+HB_EXTERN void
 hb_set_clear (hb_set_t *set);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_set_is_empty (const hb_set_t *set);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_set_has (const hb_set_t *set,
             hb_codepoint_t  codepoint);
 
 /* Right now limited to 16-bit integers.  Eventually will do full codepoint range, sans -1
  * which we will use as a sentinel. */
-void
+HB_EXTERN void
 hb_set_add (hb_set_t       *set,
             hb_codepoint_t  codepoint);
 
-void
+HB_EXTERN void
 hb_set_add_range (hb_set_t       *set,
                   hb_codepoint_t  first,
                   hb_codepoint_t  last);
 
-void
+HB_EXTERN void
 hb_set_del (hb_set_t       *set,
             hb_codepoint_t  codepoint);
 
-void
+HB_EXTERN void
 hb_set_del_range (hb_set_t       *set,
                   hb_codepoint_t  first,
                   hb_codepoint_t  last);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_set_is_equal (const hb_set_t *set,
                  const hb_set_t *other);
 
-void
+HB_EXTERN void
 hb_set_set (hb_set_t       *set,
             const hb_set_t *other);
 
-void
+HB_EXTERN void
 hb_set_union (hb_set_t       *set,
               const hb_set_t *other);
 
-void
+HB_EXTERN void
 hb_set_intersect (hb_set_t       *set,
                   const hb_set_t *other);
 
-void
+HB_EXTERN void
 hb_set_subtract (hb_set_t       *set,
                  const hb_set_t *other);
 
-void
+HB_EXTERN void
 hb_set_symmetric_difference (hb_set_t       *set,
                              const hb_set_t *other);
 
-void
+HB_EXTERN void
 hb_set_invert (hb_set_t *set);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_set_get_population (const hb_set_t *set);
 
 /* Returns -1 if set empty. */
-hb_codepoint_t
+HB_EXTERN hb_codepoint_t
 hb_set_get_min (const hb_set_t *set);
 
 /* Returns -1 if set empty. */
-hb_codepoint_t
+HB_EXTERN hb_codepoint_t
 hb_set_get_max (const hb_set_t *set);
 
 /* Pass -1 in to get started. */
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_set_next (const hb_set_t *set,
              hb_codepoint_t *codepoint);
 
 /* Pass -1 for first and last to get started. */
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_set_next_range (const hb_set_t *set,
                    hb_codepoint_t *first,
                    hb_codepoint_t *last);
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan.h	Wed Jul 05 22:06:46 2017 +0200
@@ -38,49 +38,49 @@
 
 typedef struct hb_shape_plan_t hb_shape_plan_t;
 
-hb_shape_plan_t *
+HB_EXTERN hb_shape_plan_t *
 hb_shape_plan_create (hb_face_t                     *face,
                       const hb_segment_properties_t *props,
                       const hb_feature_t            *user_features,
                       unsigned int                   num_user_features,
                       const char * const            *shaper_list);
 
-hb_shape_plan_t *
+HB_EXTERN hb_shape_plan_t *
 hb_shape_plan_create_cached (hb_face_t                     *face,
                              const hb_segment_properties_t *props,
                              const hb_feature_t            *user_features,
                              unsigned int                   num_user_features,
                              const char * const            *shaper_list);
 
-hb_shape_plan_t *
+HB_EXTERN hb_shape_plan_t *
 hb_shape_plan_get_empty (void);
 
-hb_shape_plan_t *
+HB_EXTERN hb_shape_plan_t *
 hb_shape_plan_reference (hb_shape_plan_t *shape_plan);
 
-void
+HB_EXTERN void
 hb_shape_plan_destroy (hb_shape_plan_t *shape_plan);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_shape_plan_set_user_data (hb_shape_plan_t    *shape_plan,
                              hb_user_data_key_t *key,
                              void *              data,
                              hb_destroy_func_t   destroy,
                              hb_bool_t           replace);
 
-void *
+HB_EXTERN void *
 hb_shape_plan_get_user_data (hb_shape_plan_t    *shape_plan,
                              hb_user_data_key_t *key);
 
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_shape_plan_execute (hb_shape_plan_t    *shape_plan,
                        hb_font_t          *font,
                        hb_buffer_t        *buffer,
                        const hb_feature_t *features,
                        unsigned int        num_features);
 
-const char *
+HB_EXTERN const char *
 hb_shape_plan_get_shaper (hb_shape_plan_t *shape_plan);
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -210,13 +210,15 @@
 /**
  * hb_feature_from_string:
  * @str: (array length=len) (element-type uint8_t): a string to parse
- * @len: length of @str, or -1 if string is nul-terminated
+ * @len: length of @str, or -1 if string is %NULL terminated
  * @feature: (out): the #hb_feature_t to initialize with the parsed values
  *
- * Parses a string into a #hb_feature_t. If @len is -1 then @str is
- * %NULL-terminated.
+ * Parses a string into a #hb_feature_t.
  *
- * Return value: %TRUE if @str is successfully parsed, %FALSE otherwise
+ * TODO: document the syntax here.
+ *
+ * Return value:
+ * %true if @str is successfully parsed, %false otherwise.
  *
  * Since: 0.9.5
  **/
@@ -392,8 +394,6 @@
  * positioned glyphs. If @features is not %NULL, it will be used to control the
  * features applied during shaping.
  *
- * Return value: %FALSE if all shapers failed, %TRUE otherwise
- *
  * Since: 0.9.2
  **/
 void
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape.h	Wed Jul 05 22:06:46 2017 +0200
@@ -47,29 +47,29 @@
   unsigned int  end;
 } hb_feature_t;
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_feature_from_string (const char *str, int len,
                         hb_feature_t *feature);
 
-void
+HB_EXTERN void
 hb_feature_to_string (hb_feature_t *feature,
                       char *buf, unsigned int size);
 
 
-void
+HB_EXTERN void
 hb_shape (hb_font_t           *font,
           hb_buffer_t         *buffer,
           const hb_feature_t  *features,
           unsigned int         num_features);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_shape_full (hb_font_t          *font,
                hb_buffer_t        *buffer,
                const hb_feature_t *features,
                unsigned int        num_features,
                const char * const *shaper_list);
 
-const char **
+HB_EXTERN const char **
 hb_shape_list_shapers (void);
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shaper-list.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shaper-list.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -46,6 +46,9 @@
 #ifdef HAVE_UNISCRIBE
 HB_SHAPER_IMPLEMENT (uniscribe)
 #endif
+#ifdef HAVE_DIRECTWRITE
+HB_SHAPER_IMPLEMENT (directwrite)
+#endif
 #ifdef HAVE_CORETEXT
 HB_SHAPER_IMPLEMENT (coretext)
 #endif
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ucdn.cc	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ucdn.cc	Wed Jul 05 22:06:46 2017 +0200
@@ -154,6 +154,12 @@
     HB_SCRIPT_MULTANI,
     HB_SCRIPT_OLD_HUNGARIAN,
     HB_SCRIPT_SIGNWRITING,
+    HB_SCRIPT_ADLAM,
+    HB_SCRIPT_BHAIKSUKI,
+    HB_SCRIPT_MARCHEN,
+    HB_SCRIPT_NEWA,
+    HB_SCRIPT_OSAGE,
+    HB_SCRIPT_TANGUT,
 };
 
 static hb_unicode_combining_class_t
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ucdn/ucdn.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ucdn/ucdn.c	Wed Jul 05 22:06:46 2017 +0200
@@ -16,6 +16,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include "ucdn.h"
 
 typedef struct {
@@ -24,8 +25,8 @@
     unsigned char bidi_class;
     unsigned char mirrored;
     unsigned char east_asian_width;
-    unsigned char normalization_check;
     unsigned char script;
+    unsigned char linebreak_class;
 } UCDRecord;
 
 typedef struct {
@@ -33,6 +34,11 @@
 } MirrorPair;
 
 typedef struct {
+  unsigned short from, to;
+  unsigned char type;
+} BracketPair;
+
+typedef struct {
     unsigned int start;
     short count, index;
 } Reindex;
@@ -108,6 +114,24 @@
     return mpa->from - mpb->from;
 }
 
+static int compare_bp(const void *a, const void *b)
+{
+    BracketPair *bpa = (BracketPair *)a;
+    BracketPair *bpb = (BracketPair *)b;
+    return bpa->from - bpb->from;
+}
+
+static BracketPair *search_bp(uint32_t code)
+{
+    BracketPair bp = {0,0,2};
+    BracketPair *res;
+
+    bp.from = code;
+    res = bsearch(&bp, bracket_pairs, BIDI_BRACKET_LEN, sizeof(BracketPair),
+            compare_bp);
+    return res;
+}
+
 static int hangul_pair_decompose(uint32_t code, uint32_t *a, uint32_t *b)
 {
     int si = code - SBASE;
@@ -199,6 +223,42 @@
     return get_ucd_record(code)->script;
 }
 
+int ucdn_get_linebreak_class(uint32_t code)
+{
+    return get_ucd_record(code)->linebreak_class;
+}
+
+int ucdn_get_resolved_linebreak_class(uint32_t code)
+{
+    const UCDRecord *record = get_ucd_record(code);
+
+    switch (record->linebreak_class)
+    {
+    case UCDN_LINEBREAK_CLASS_AI:
+    case UCDN_LINEBREAK_CLASS_SG:
+    case UCDN_LINEBREAK_CLASS_XX:
+        return UCDN_LINEBREAK_CLASS_AL;
+
+    case UCDN_LINEBREAK_CLASS_SA:
+        if (record->category == UCDN_GENERAL_CATEGORY_MC ||
+                record->category == UCDN_GENERAL_CATEGORY_MN)
+            return UCDN_LINEBREAK_CLASS_CM;
+        return UCDN_LINEBREAK_CLASS_AL;
+
+    case UCDN_LINEBREAK_CLASS_CJ:
+        return UCDN_LINEBREAK_CLASS_NS;
+
+    case UCDN_LINEBREAK_CLASS_CB:
+        return UCDN_LINEBREAK_CLASS_B2;
+
+    case UCDN_LINEBREAK_CLASS_NL:
+        return UCDN_LINEBREAK_CLASS_BK;
+
+    default:
+        return record->linebreak_class;
+    }
+}
+
 uint32_t ucdn_mirror(uint32_t code)
 {
     MirrorPair mp = {0};
@@ -217,6 +277,24 @@
         return res->to;
 }
 
+uint32_t ucdn_paired_bracket(uint32_t code)
+{
+    BracketPair *res = search_bp(code);
+    if (res == NULL)
+        return code;
+    else
+        return res->to;
+}
+
+int ucdn_paired_bracket_type(uint32_t code)
+{
+    BracketPair *res = search_bp(code);
+    if (res == NULL)
+        return UCDN_BIDI_PAIRED_BRACKET_TYPE_NONE;
+    else
+        return res->type;
+}
+
 int ucdn_decompose(uint32_t code, uint32_t *a, uint32_t *b)
 {
     const unsigned short *rec;
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ucdn/ucdn.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ucdn/ucdn.h	Wed Jul 05 22:06:46 2017 +0200
@@ -17,6 +17,8 @@
 #ifndef UCDN_H
 #define UCDN_H
 
+
+
 #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__MINGW32__)
 # define HB_BEGIN_VISIBILITY _Pragma ("GCC visibility push(hidden)")
 # define HB_END_VISIBILITY _Pragma ("GCC visibility pop")
@@ -58,6 +60,7 @@
 
 #endif
 
+
 #define UCDN_EAST_ASIAN_F 0
 #define UCDN_EAST_ASIAN_H 1
 #define UCDN_EAST_ASIAN_W 2
@@ -197,6 +200,53 @@
 #define UCDN_SCRIPT_MULTANI 129
 #define UCDN_SCRIPT_OLD_HUNGARIAN 130
 #define UCDN_SCRIPT_SIGNWRITING 131
+#define UCDN_SCRIPT_ADLAM 132
+#define UCDN_SCRIPT_BHAIKSUKI 133
+#define UCDN_SCRIPT_MARCHEN 134
+#define UCDN_SCRIPT_NEWA 135
+#define UCDN_SCRIPT_OSAGE 136
+#define UCDN_SCRIPT_TANGUT 137
+
+#define UCDN_LINEBREAK_CLASS_OP 0
+#define UCDN_LINEBREAK_CLASS_CL 1
+#define UCDN_LINEBREAK_CLASS_CP 2
+#define UCDN_LINEBREAK_CLASS_QU 3
+#define UCDN_LINEBREAK_CLASS_GL 4
+#define UCDN_LINEBREAK_CLASS_NS 5
+#define UCDN_LINEBREAK_CLASS_EX 6
+#define UCDN_LINEBREAK_CLASS_SY 7
+#define UCDN_LINEBREAK_CLASS_IS 8
+#define UCDN_LINEBREAK_CLASS_PR 9
+#define UCDN_LINEBREAK_CLASS_PO 10
+#define UCDN_LINEBREAK_CLASS_NU 11
+#define UCDN_LINEBREAK_CLASS_AL 12
+#define UCDN_LINEBREAK_CLASS_HL 13
+#define UCDN_LINEBREAK_CLASS_ID 14
+#define UCDN_LINEBREAK_CLASS_IN 15
+#define UCDN_LINEBREAK_CLASS_HY 16
+#define UCDN_LINEBREAK_CLASS_BA 17
+#define UCDN_LINEBREAK_CLASS_BB 18
+#define UCDN_LINEBREAK_CLASS_B2 19
+#define UCDN_LINEBREAK_CLASS_ZW 20
+#define UCDN_LINEBREAK_CLASS_CM 21
+#define UCDN_LINEBREAK_CLASS_WJ 22
+#define UCDN_LINEBREAK_CLASS_H2 23
+#define UCDN_LINEBREAK_CLASS_H3 24
+#define UCDN_LINEBREAK_CLASS_JL 25
+#define UCDN_LINEBREAK_CLASS_JV 26
+#define UCDN_LINEBREAK_CLASS_JT 27
+#define UCDN_LINEBREAK_CLASS_RI 28
+#define UCDN_LINEBREAK_CLASS_AI 29
+#define UCDN_LINEBREAK_CLASS_BK 30
+#define UCDN_LINEBREAK_CLASS_CB 31
+#define UCDN_LINEBREAK_CLASS_CJ 32
+#define UCDN_LINEBREAK_CLASS_CR 33
+#define UCDN_LINEBREAK_CLASS_LF 34
+#define UCDN_LINEBREAK_CLASS_NL 35
+#define UCDN_LINEBREAK_CLASS_SA 36
+#define UCDN_LINEBREAK_CLASS_SG 37
+#define UCDN_LINEBREAK_CLASS_SP 38
+#define UCDN_LINEBREAK_CLASS_XX 39
 
 #define UCDN_GENERAL_CATEGORY_CC 0
 #define UCDN_GENERAL_CATEGORY_CF 1
@@ -253,6 +303,10 @@
 #define UCDN_BIDI_CLASS_FSI 21
 #define UCDN_BIDI_CLASS_PDI 22
 
+#define UCDN_BIDI_PAIRED_BRACKET_TYPE_OPEN 0
+#define UCDN_BIDI_PAIRED_BRACKET_TYPE_CLOSE 1
+#define UCDN_BIDI_PAIRED_BRACKET_TYPE_NONE 2
+
 /**
  * Return version of the Unicode database.
  *
@@ -302,6 +356,27 @@
 int ucdn_get_script(uint32_t code);
 
 /**
+ * Get unresolved linebreak class of a codepoint. This does not take
+ * rule LB1 of UAX#14 into account. See ucdn_get_resolved_linebreak_class()
+ * for resolved linebreak classes.
+ *
+ * @param code Unicode codepoint
+ * @return value according to UCDN_LINEBREAK_* and as defined in UAX#14.
+ */
+int ucdn_get_linebreak_class(uint32_t code);
+
+/**
+ * Get resolved linebreak class of a codepoint. This resolves characters
+ * in the AI, SG, XX, SA and CJ classes according to rule LB1 of UAX#14.
+ * In addition the CB class is resolved as the equivalent B2 class and
+ * the NL class is resolved as the equivalent BK class.
+ *
+ * @param code Unicode codepoint
+ * @return value according to UCDN_LINEBREAK_* and as defined in UAX#14.
+ */
+int ucdn_get_resolved_linebreak_class(uint32_t code);
+
+/**
  * Check if codepoint can be mirrored.
  *
  * @param code Unicode codepoint
@@ -319,6 +394,25 @@
 uint32_t ucdn_mirror(uint32_t code);
 
 /**
+ * Get paired bracket for a codepoint.
+ *
+ * @param code Unicode codepoint
+ * @return paired bracket codepoint or the original codepoint if no
+ * paired bracket character exists
+ */
+uint32_t ucdn_paired_bracket(uint32_t code);
+
+/**
+ * Get paired bracket type for a codepoint.
+ *
+ * @param code Unicode codepoint
+ * @return value according to UCDN_BIDI_PAIRED_BRACKET_TYPE_* and as defined
+ * in UAX#9.
+ *
+ */
+int ucdn_paired_bracket_type(uint32_t code);
+
+/**
  * Pairwise canonical decomposition of a codepoint. This includes
  * Hangul Jamo decomposition (see chapter 3.12 of the Unicode core
  * specification).
@@ -359,6 +453,8 @@
  */
 int ucdn_compose(uint32_t *code, uint32_t a, uint32_t b);
 
-HB_END_HEADER
+#ifdef __cplusplus
+}
+#endif
 
 #endif
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ucdn/unicodedata_db.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ucdn/unicodedata_db.h	Wed Jul 05 22:06:46 2017 +0200
@@ -1,821 +1,999 @@
 /* this file was generated by makeunicodedata.py 3.2 */
 
-#define UNIDATA_VERSION "8.0.0"
+#define UNIDATA_VERSION "9.0.0"
 /* a list of unique database records */
 static const UCDRecord ucd_records[] = {
-    {2, 0, 18, 0, 5, 0, 102},
-    {0, 0, 14, 0, 5, 0, 0},
-    {0, 0, 16, 0, 5, 0, 0},
-    {0, 0, 15, 0, 5, 0, 0},
-    {0, 0, 17, 0, 5, 0, 0},
-    {29, 0, 17, 0, 3, 0, 0},
-    {21, 0, 18, 0, 3, 0, 0},
-    {21, 0, 10, 0, 3, 0, 0},
-    {23, 0, 10, 0, 3, 0, 0},
+    {2, 0, 18, 0, 5, 102, 41},
+    {0, 0, 14, 0, 5, 0, 21},
+    {0, 0, 16, 0, 5, 0, 17},
+    {0, 0, 15, 0, 5, 0, 35},
+    {0, 0, 16, 0, 5, 0, 30},
+    {0, 0, 17, 0, 5, 0, 30},
+    {0, 0, 15, 0, 5, 0, 33},
+    {0, 0, 15, 0, 5, 0, 21},
+    {0, 0, 16, 0, 5, 0, 21},
+    {29, 0, 17, 0, 3, 0, 40},
+    {21, 0, 18, 0, 3, 0, 6},
+    {21, 0, 18, 0, 3, 0, 3},
+    {21, 0, 10, 0, 3, 0, 12},
+    {23, 0, 10, 0, 3, 0, 9},
+    {21, 0, 10, 0, 3, 0, 10},
+    {21, 0, 18, 0, 3, 0, 12},
     {22, 0, 18, 1, 3, 0, 0},
-    {18, 0, 18, 1, 3, 0, 0},
-    {25, 0, 9, 0, 3, 0, 0},
-    {21, 0, 12, 0, 3, 0, 0},
-    {17, 0, 9, 0, 3, 0, 0},
-    {13, 0, 8, 0, 3, 0, 0},
-    {25, 0, 18, 1, 3, 0, 0},
-    {25, 0, 18, 0, 3, 0, 0},
-    {9, 0, 0, 0, 3, 0, 1},
-    {24, 0, 18, 0, 3, 0, 0},
-    {16, 0, 18, 0, 3, 0, 0},
-    {5, 0, 0, 0, 3, 0, 1},
-    {29, 0, 12, 0, 5, 0, 0},
+    {18, 0, 18, 1, 3, 0, 2},
+    {25, 0, 9, 0, 3, 0, 9},
+    {21, 0, 12, 0, 3, 0, 8},
+    {17, 0, 9, 0, 3, 0, 16},
+    {21, 0, 12, 0, 3, 0, 7},
+    {13, 0, 8, 0, 3, 0, 11},
+    {21, 0, 18, 0, 3, 0, 8},
+    {25, 0, 18, 1, 3, 0, 12},
+    {25, 0, 18, 0, 3, 0, 12},
+    {9, 0, 0, 0, 3, 1, 12},
+    {21, 0, 18, 0, 3, 0, 9},
+    {24, 0, 18, 0, 3, 0, 12},
+    {16, 0, 18, 0, 3, 0, 12},
+    {5, 0, 0, 0, 3, 1, 12},
+    {25, 0, 18, 0, 3, 0, 17},
+    {18, 0, 18, 1, 3, 0, 1},
+    {0, 0, 15, 0, 5, 0, 36},
+    {29, 0, 12, 0, 5, 0, 4},
     {21, 0, 18, 0, 4, 0, 0},
-    {23, 0, 10, 0, 4, 0, 0},
-    {26, 0, 18, 0, 3, 0, 0},
-    {24, 0, 18, 0, 4, 0, 0},
-    {26, 0, 18, 0, 5, 0, 0},
-    {7, 0, 0, 0, 4, 0, 1},
-    {20, 0, 18, 1, 5, 0, 0},
-    {1, 0, 14, 0, 4, 0, 0},
-    {26, 0, 18, 0, 4, 0, 0},
-    {26, 0, 10, 0, 4, 0, 0},
-    {25, 0, 10, 0, 4, 0, 0},
-    {15, 0, 8, 0, 4, 0, 0},
-    {5, 0, 0, 0, 5, 0, 0},
-    {19, 0, 18, 1, 5, 0, 0},
-    {15, 0, 18, 0, 4, 0, 0},
-    {9, 0, 0, 0, 5, 0, 1},
-    {9, 0, 0, 0, 4, 0, 1},
-    {25, 0, 18, 0, 4, 0, 0},
-    {5, 0, 0, 0, 4, 0, 1},
-    {5, 0, 0, 0, 5, 0, 1},
-    {7, 0, 0, 0, 5, 0, 1},
-    {8, 0, 0, 0, 5, 0, 1},
-    {6, 0, 0, 0, 5, 0, 1},
-    {6, 0, 18, 0, 5, 0, 0},
-    {6, 0, 0, 0, 5, 0, 0},
-    {24, 0, 18, 0, 5, 0, 0},
-    {6, 0, 18, 0, 4, 0, 0},
-    {6, 0, 0, 0, 4, 0, 0},
-    {24, 0, 18, 0, 5, 0, 34},
-    {12, 230, 13, 0, 4, 0, 40},
-    {12, 232, 13, 0, 4, 0, 40},
-    {12, 220, 13, 0, 4, 0, 40},
-    {12, 216, 13, 0, 4, 0, 40},
-    {12, 202, 13, 0, 4, 0, 40},
-    {12, 1, 13, 0, 4, 0, 40},
-    {12, 240, 13, 0, 4, 0, 40},
-    {12, 0, 13, 0, 4, 0, 40},
-    {12, 233, 13, 0, 4, 0, 40},
-    {12, 234, 13, 0, 4, 0, 40},
-    {9, 0, 0, 0, 5, 0, 2},
-    {5, 0, 0, 0, 5, 0, 2},
-    {24, 0, 18, 0, 5, 0, 2},
-    {2, 0, 18, 0, 5, 0, 102},
-    {6, 0, 0, 0, 5, 0, 2},
-    {21, 0, 18, 0, 5, 0, 0},
-    {9, 0, 0, 0, 4, 0, 2},
-    {5, 0, 0, 0, 4, 0, 2},
-    {9, 0, 0, 0, 5, 0, 54},
-    {5, 0, 0, 0, 5, 0, 54},
-    {25, 0, 18, 0, 5, 0, 2},
-    {9, 0, 0, 0, 5, 0, 3},
-    {9, 0, 0, 0, 4, 0, 3},
-    {5, 0, 0, 0, 4, 0, 3},
-    {5, 0, 0, 0, 5, 0, 3},
-    {26, 0, 0, 0, 5, 0, 3},
-    {12, 230, 13, 0, 5, 0, 3},
-    {12, 230, 13, 0, 5, 0, 40},
-    {11, 0, 13, 0, 5, 0, 3},
-    {9, 0, 0, 0, 5, 0, 4},
-    {6, 0, 0, 0, 5, 0, 4},
-    {21, 0, 0, 0, 5, 0, 4},
-    {5, 0, 0, 0, 5, 0, 4},
-    {21, 0, 0, 0, 5, 0, 0},
-    {17, 0, 18, 0, 5, 0, 4},
-    {26, 0, 18, 0, 5, 0, 4},
-    {23, 0, 10, 0, 5, 0, 4},
-    {12, 220, 13, 0, 5, 0, 5},
-    {12, 230, 13, 0, 5, 0, 5},
-    {12, 222, 13, 0, 5, 0, 5},
-    {12, 228, 13, 0, 5, 0, 5},
-    {12, 10, 13, 0, 5, 0, 5},
-    {12, 11, 13, 0, 5, 0, 5},
-    {12, 12, 13, 0, 5, 0, 5},
-    {12, 13, 13, 0, 5, 0, 5},
-    {12, 14, 13, 0, 5, 0, 5},
-    {12, 15, 13, 0, 5, 0, 5},
-    {12, 16, 13, 0, 5, 0, 5},
-    {12, 17, 13, 0, 5, 0, 5},
-    {12, 18, 13, 0, 5, 0, 5},
-    {12, 19, 13, 0, 5, 0, 5},
-    {12, 20, 13, 0, 5, 0, 5},
-    {12, 21, 13, 0, 5, 0, 5},
-    {12, 22, 13, 0, 5, 0, 5},
-    {17, 0, 3, 0, 5, 0, 5},
-    {12, 23, 13, 0, 5, 0, 5},
-    {21, 0, 3, 0, 5, 0, 5},
-    {12, 24, 13, 0, 5, 0, 5},
-    {12, 25, 13, 0, 5, 0, 5},
-    {7, 0, 3, 0, 5, 0, 5},
-    {1, 0, 11, 0, 5, 0, 6},
-    {1, 0, 11, 0, 5, 0, 0},
-    {25, 0, 18, 0, 5, 0, 6},
-    {25, 0, 4, 0, 5, 0, 6},
-    {21, 0, 10, 0, 5, 0, 6},
-    {23, 0, 4, 0, 5, 0, 6},
-    {21, 0, 12, 0, 5, 0, 0},
+    {23, 0, 10, 0, 3, 0, 10},
+    {23, 0, 10, 0, 4, 0, 9},
+    {26, 0, 18, 0, 3, 0, 12},
+    {21, 0, 18, 0, 4, 0, 29},
+    {24, 0, 18, 0, 4, 0, 29},
+    {26, 0, 18, 0, 5, 0, 12},
+    {7, 0, 0, 0, 4, 1, 29},
+    {20, 0, 18, 1, 5, 0, 3},
+    {1, 0, 14, 0, 4, 0, 17},
+    {26, 0, 18, 0, 4, 0, 12},
+    {26, 0, 10, 0, 4, 0, 10},
+    {25, 0, 10, 0, 4, 0, 9},
+    {15, 0, 8, 0, 4, 0, 29},
+    {24, 0, 18, 0, 4, 0, 18},
+    {5, 0, 0, 0, 5, 0, 12},
+    {19, 0, 18, 1, 5, 0, 3},
+    {15, 0, 18, 0, 4, 0, 29},
+    {9, 0, 0, 0, 5, 1, 12},
+    {9, 0, 0, 0, 4, 1, 12},
+    {25, 0, 18, 0, 4, 0, 29},
+    {5, 0, 0, 0, 4, 1, 12},
+    {5, 0, 0, 0, 5, 1, 12},
+    {7, 0, 0, 0, 5, 1, 12},
+    {8, 0, 0, 0, 5, 1, 12},
+    {6, 0, 0, 0, 5, 1, 12},
+    {6, 0, 18, 0, 5, 0, 12},
+    {6, 0, 0, 0, 5, 0, 12},
+    {24, 0, 18, 0, 5, 0, 12},
+    {24, 0, 18, 0, 4, 0, 12},
+    {6, 0, 18, 0, 4, 0, 29},
+    {6, 0, 18, 0, 5, 0, 18},
+    {6, 0, 0, 0, 4, 0, 29},
+    {24, 0, 18, 0, 5, 34, 12},
+    {12, 230, 13, 0, 4, 40, 21},
+    {12, 232, 13, 0, 4, 40, 21},
+    {12, 220, 13, 0, 4, 40, 21},
+    {12, 216, 13, 0, 4, 40, 21},
+    {12, 202, 13, 0, 4, 40, 21},
+    {12, 1, 13, 0, 4, 40, 21},
+    {12, 240, 13, 0, 4, 40, 21},
+    {12, 0, 13, 0, 4, 40, 4},
+    {12, 233, 13, 0, 4, 40, 4},
+    {12, 234, 13, 0, 4, 40, 4},
+    {9, 0, 0, 0, 5, 2, 12},
+    {5, 0, 0, 0, 5, 2, 12},
+    {24, 0, 18, 0, 5, 2, 12},
+    {2, 0, 18, 0, 5, 102, 41},
+    {6, 0, 0, 0, 5, 2, 12},
+    {21, 0, 18, 0, 5, 0, 8},
+    {21, 0, 18, 0, 5, 0, 12},
+    {9, 0, 0, 0, 4, 2, 12},
+    {5, 0, 0, 0, 4, 2, 12},
+    {9, 0, 0, 0, 5, 54, 12},
+    {5, 0, 0, 0, 5, 54, 12},
+    {25, 0, 18, 0, 5, 2, 12},
+    {9, 0, 0, 0, 5, 3, 12},
+    {9, 0, 0, 0, 4, 3, 12},
+    {5, 0, 0, 0, 4, 3, 12},
+    {5, 0, 0, 0, 5, 3, 12},
+    {26, 0, 0, 0, 5, 3, 12},
+    {12, 230, 13, 0, 5, 3, 21},
+    {12, 230, 13, 0, 5, 40, 21},
+    {11, 0, 13, 0, 5, 3, 21},
+    {9, 0, 0, 0, 5, 4, 12},
+    {6, 0, 0, 0, 5, 4, 12},
+    {21, 0, 0, 0, 5, 4, 12},
+    {5, 0, 0, 0, 5, 4, 12},
+    {21, 0, 0, 0, 5, 0, 8},
+    {17, 0, 18, 0, 5, 4, 17},
+    {26, 0, 18, 0, 5, 4, 12},
+    {23, 0, 10, 0, 5, 4, 9},
+    {12, 220, 13, 0, 5, 5, 21},
+    {12, 230, 13, 0, 5, 5, 21},
+    {12, 222, 13, 0, 5, 5, 21},
+    {12, 228, 13, 0, 5, 5, 21},
+    {12, 10, 13, 0, 5, 5, 21},
+    {12, 11, 13, 0, 5, 5, 21},
+    {12, 12, 13, 0, 5, 5, 21},
+    {12, 13, 13, 0, 5, 5, 21},
+    {12, 14, 13, 0, 5, 5, 21},
+    {12, 15, 13, 0, 5, 5, 21},
+    {12, 16, 13, 0, 5, 5, 21},
+    {12, 17, 13, 0, 5, 5, 21},
+    {12, 18, 13, 0, 5, 5, 21},
+    {12, 19, 13, 0, 5, 5, 21},
+    {12, 20, 13, 0, 5, 5, 21},
+    {12, 21, 13, 0, 5, 5, 21},
+    {12, 22, 13, 0, 5, 5, 21},
+    {17, 0, 3, 0, 5, 5, 17},
+    {12, 23, 13, 0, 5, 5, 21},
+    {21, 0, 3, 0, 5, 5, 12},
+    {12, 24, 13, 0, 5, 5, 21},
+    {12, 25, 13, 0, 5, 5, 21},
+    {21, 0, 3, 0, 5, 5, 6},
+    {7, 0, 3, 0, 5, 5, 13},
+    {1, 0, 11, 0, 5, 6, 12},
+    {1, 0, 11, 0, 5, 0, 12},
+    {25, 0, 18, 0, 5, 6, 12},
+    {25, 0, 4, 0, 5, 6, 12},
+    {21, 0, 10, 0, 5, 6, 10},
+    {23, 0, 4, 0, 5, 6, 10},
+    {21, 0, 12, 0, 5, 0, 8},
+    {21, 0, 4, 0, 5, 6, 8},
+    {26, 0, 18, 0, 5, 6, 12},
+    {12, 230, 13, 0, 5, 6, 21},
+    {12, 30, 13, 0, 5, 6, 21},
+    {12, 31, 13, 0, 5, 6, 21},
+    {12, 32, 13, 0, 5, 6, 21},
     {21, 0, 4, 0, 5, 0, 6},
-    {26, 0, 18, 0, 5, 0, 6},
-    {12, 230, 13, 0, 5, 0, 6},
-    {12, 30, 13, 0, 5, 0, 6},
-    {12, 31, 13, 0, 5, 0, 6},
-    {12, 32, 13, 0, 5, 0, 6},
-    {21, 0, 4, 0, 5, 0, 0},
-    {1, 0, 4, 0, 5, 0, 0},
-    {7, 0, 4, 0, 5, 0, 6},
-    {6, 0, 4, 0, 5, 0, 0},
-    {12, 27, 13, 0, 5, 0, 40},
-    {12, 28, 13, 0, 5, 0, 40},
-    {12, 29, 13, 0, 5, 0, 40},
-    {12, 30, 13, 0, 5, 0, 40},
-    {12, 31, 13, 0, 5, 0, 40},
-    {12, 32, 13, 0, 5, 0, 40},
-    {12, 33, 13, 0, 5, 0, 40},
-    {12, 34, 13, 0, 5, 0, 40},
-    {12, 220, 13, 0, 5, 0, 40},
-    {12, 220, 13, 0, 5, 0, 6},
-    {13, 0, 11, 0, 5, 0, 6},
-    {21, 0, 11, 0, 5, 0, 6},
-    {12, 35, 13, 0, 5, 0, 40},
-    {6, 0, 4, 0, 5, 0, 6},
-    {13, 0, 8, 0, 5, 0, 6},
-    {26, 0, 4, 0, 5, 0, 6},
-    {21, 0, 4, 0, 5, 0, 7},
-    {1, 0, 4, 0, 5, 0, 7},
-    {7, 0, 4, 0, 5, 0, 7},
-    {12, 36, 13, 0, 5, 0, 7},
-    {12, 230, 13, 0, 5, 0, 7},
-    {12, 220, 13, 0, 5, 0, 7},
-    {7, 0, 4, 0, 5, 0, 8},
-    {12, 0, 13, 0, 5, 0, 8},
-    {13, 0, 3, 0, 5, 0, 65},
-    {7, 0, 3, 0, 5, 0, 65},
-    {12, 230, 13, 0, 5, 0, 65},
-    {12, 220, 13, 0, 5, 0, 65},
-    {6, 0, 3, 0, 5, 0, 65},
-    {26, 0, 18, 0, 5, 0, 65},
-    {21, 0, 18, 0, 5, 0, 65},
-    {7, 0, 3, 0, 5, 0, 81},
-    {12, 230, 13, 0, 5, 0, 81},
-    {6, 0, 3, 0, 5, 0, 81},
-    {21, 0, 3, 0, 5, 0, 81},
-    {7, 0, 3, 0, 5, 0, 94},
-    {12, 220, 13, 0, 5, 0, 94},
-    {21, 0, 3, 0, 5, 0, 94},
-    {12, 27, 13, 0, 5, 0, 6},
-    {12, 28, 13, 0, 5, 0, 6},
-    {12, 29, 13, 0, 5, 0, 6},
-    {12, 0, 13, 0, 5, 0, 9},
-    {10, 0, 0, 0, 5, 0, 9},
-    {7, 0, 0, 0, 5, 0, 9},
-    {12, 7, 13, 0, 5, 0, 9},
-    {12, 9, 13, 0, 5, 0, 9},
-    {12, 230, 13, 0, 5, 0, 9},
-    {13, 0, 0, 0, 5, 0, 9},
-    {21, 0, 0, 0, 5, 0, 9},
-    {6, 0, 0, 0, 5, 0, 9},
-    {7, 0, 0, 0, 5, 0, 10},
-    {12, 0, 13, 0, 5, 0, 10},
-    {10, 0, 0, 0, 5, 0, 10},
-    {12, 7, 13, 0, 5, 0, 10},
-    {12, 9, 13, 0, 5, 0, 10},
-    {13, 0, 0, 0, 5, 0, 10},
-    {23, 0, 10, 0, 5, 0, 10},
-    {15, 0, 0, 0, 5, 0, 10},
-    {26, 0, 0, 0, 5, 0, 10},
-    {12, 0, 13, 0, 5, 0, 11},
-    {10, 0, 0, 0, 5, 0, 11},
-    {7, 0, 0, 0, 5, 0, 11},
-    {12, 7, 13, 0, 5, 0, 11},
-    {12, 9, 13, 0, 5, 0, 11},
-    {13, 0, 0, 0, 5, 0, 11},
-    {12, 0, 13, 0, 5, 0, 12},
-    {10, 0, 0, 0, 5, 0, 12},
-    {7, 0, 0, 0, 5, 0, 12},
-    {12, 7, 13, 0, 5, 0, 12},
-    {12, 9, 13, 0, 5, 0, 12},
-    {13, 0, 0, 0, 5, 0, 12},
+    {1, 0, 4, 0, 5, 0, 21},
+    {21, 0, 4, 0, 5, 6, 6},
+    {7, 0, 4, 0, 5, 6, 12},
+    {6, 0, 4, 0, 5, 0, 12},
+    {12, 27, 13, 0, 5, 40, 21},
+    {12, 28, 13, 0, 5, 40, 21},
+    {12, 29, 13, 0, 5, 40, 21},
+    {12, 30, 13, 0, 5, 40, 21},
+    {12, 31, 13, 0, 5, 40, 21},
+    {12, 32, 13, 0, 5, 40, 21},
+    {12, 33, 13, 0, 5, 40, 21},
+    {12, 34, 13, 0, 5, 40, 21},
+    {12, 220, 13, 0, 5, 40, 21},
+    {12, 220, 13, 0, 5, 6, 21},
+    {13, 0, 11, 0, 5, 6, 11},
+    {21, 0, 11, 0, 5, 6, 11},
+    {21, 0, 4, 0, 5, 6, 12},
+    {12, 35, 13, 0, 5, 40, 21},
+    {6, 0, 4, 0, 5, 6, 12},
+    {13, 0, 8, 0, 5, 6, 11},
+    {26, 0, 4, 0, 5, 6, 12},
+    {21, 0, 4, 0, 5, 7, 12},
+    {1, 0, 4, 0, 5, 7, 12},
+    {7, 0, 4, 0, 5, 7, 12},
+    {12, 36, 13, 0, 5, 7, 21},
+    {12, 230, 13, 0, 5, 7, 21},
+    {12, 220, 13, 0, 5, 7, 21},
+    {7, 0, 4, 0, 5, 8, 12},
+    {12, 0, 13, 0, 5, 8, 21},
+    {13, 0, 3, 0, 5, 65, 11},
+    {7, 0, 3, 0, 5, 65, 12},
+    {12, 230, 13, 0, 5, 65, 21},
+    {12, 220, 13, 0, 5, 65, 21},
+    {6, 0, 3, 0, 5, 65, 12},
+    {26, 0, 18, 0, 5, 65, 12},
+    {21, 0, 18, 0, 5, 65, 12},
+    {21, 0, 18, 0, 5, 65, 8},
+    {21, 0, 18, 0, 5, 65, 6},
+    {7, 0, 3, 0, 5, 81, 12},
+    {12, 230, 13, 0, 5, 81, 21},
+    {6, 0, 3, 0, 5, 81, 12},
+    {21, 0, 3, 0, 5, 81, 12},
+    {7, 0, 3, 0, 5, 94, 12},
+    {12, 220, 13, 0, 5, 94, 21},
+    {21, 0, 3, 0, 5, 94, 12},
+    {12, 27, 13, 0, 5, 6, 21},
+    {12, 28, 13, 0, 5, 6, 21},
+    {12, 29, 13, 0, 5, 6, 21},
+    {12, 0, 13, 0, 5, 9, 21},
+    {10, 0, 0, 0, 5, 9, 21},
+    {7, 0, 0, 0, 5, 9, 12},
+    {12, 7, 13, 0, 5, 9, 21},
+    {12, 9, 13, 0, 5, 9, 21},
+    {12, 230, 13, 0, 5, 9, 21},
+    {21, 0, 0, 0, 5, 0, 17},
+    {13, 0, 0, 0, 5, 9, 11},
+    {21, 0, 0, 0, 5, 9, 12},
+    {6, 0, 0, 0, 5, 9, 12},
+    {7, 0, 0, 0, 5, 10, 12},
+    {12, 0, 13, 0, 5, 10, 21},
+    {10, 0, 0, 0, 5, 10, 21},
+    {12, 7, 13, 0, 5, 10, 21},
+    {12, 9, 13, 0, 5, 10, 21},
+    {13, 0, 0, 0, 5, 10, 11},
+    {23, 0, 10, 0, 5, 10, 10},
+    {15, 0, 0, 0, 5, 10, 12},
+    {15, 0, 0, 0, 5, 10, 10},
+    {26, 0, 0, 0, 5, 10, 12},
+    {23, 0, 10, 0, 5, 10, 9},
+    {12, 0, 13, 0, 5, 11, 21},
+    {10, 0, 0, 0, 5, 11, 21},
+    {7, 0, 0, 0, 5, 11, 12},
+    {12, 7, 13, 0, 5, 11, 21},
+    {12, 9, 13, 0, 5, 11, 21},
+    {13, 0, 0, 0, 5, 11, 11},
+    {12, 0, 13, 0, 5, 12, 21},
+    {10, 0, 0, 0, 5, 12, 21},
+    {7, 0, 0, 0, 5, 12, 12},
+    {12, 7, 13, 0, 5, 12, 21},
+    {12, 9, 13, 0, 5, 12, 21},
+    {13, 0, 0, 0, 5, 12, 11},
+    {21, 0, 0, 0, 5, 12, 12},
+    {23, 0, 10, 0, 5, 12, 9},
+    {12, 0, 13, 0, 5, 13, 21},
+    {10, 0, 0, 0, 5, 13, 21},
+    {7, 0, 0, 0, 5, 13, 12},
+    {12, 7, 13, 0, 5, 13, 21},
+    {12, 9, 13, 0, 5, 13, 21},
+    {13, 0, 0, 0, 5, 13, 11},
+    {26, 0, 0, 0, 5, 13, 12},
+    {15, 0, 0, 0, 5, 13, 12},
+    {12, 0, 13, 0, 5, 14, 21},
+    {7, 0, 0, 0, 5, 14, 12},
+    {10, 0, 0, 0, 5, 14, 21},
+    {12, 9, 13, 0, 5, 14, 21},
+    {13, 0, 0, 0, 5, 14, 11},
+    {15, 0, 0, 0, 5, 14, 12},
+    {26, 0, 18, 0, 5, 14, 12},
+    {23, 0, 10, 0, 5, 14, 9},
+    {12, 0, 13, 0, 5, 15, 21},
+    {10, 0, 0, 0, 5, 15, 21},
+    {7, 0, 0, 0, 5, 15, 12},
+    {12, 9, 13, 0, 5, 15, 21},
+    {12, 84, 13, 0, 5, 15, 21},
+    {12, 91, 13, 0, 5, 15, 21},
+    {13, 0, 0, 0, 5, 15, 11},
+    {15, 0, 18, 0, 5, 15, 12},
+    {26, 0, 0, 0, 5, 15, 12},
+    {7, 0, 0, 0, 5, 16, 12},
+    {12, 0, 13, 0, 5, 16, 21},
+    {10, 0, 0, 0, 5, 16, 21},
+    {12, 7, 13, 0, 5, 16, 21},
+    {12, 0, 0, 0, 5, 16, 21},
+    {12, 9, 13, 0, 5, 16, 21},
+    {13, 0, 0, 0, 5, 16, 11},
+    {12, 0, 13, 0, 5, 17, 21},
+    {10, 0, 0, 0, 5, 17, 21},
+    {7, 0, 0, 0, 5, 17, 12},
+    {12, 9, 13, 0, 5, 17, 21},
+    {26, 0, 0, 0, 5, 17, 12},
+    {15, 0, 0, 0, 5, 17, 12},
+    {13, 0, 0, 0, 5, 17, 11},
+    {26, 0, 0, 0, 5, 17, 10},
+    {10, 0, 0, 0, 5, 18, 21},
+    {7, 0, 0, 0, 5, 18, 12},
+    {12, 9, 13, 0, 5, 18, 21},
+    {12, 0, 13, 0, 5, 18, 21},
+    {13, 0, 0, 0, 5, 18, 11},
+    {21, 0, 0, 0, 5, 18, 12},
+    {7, 0, 0, 0, 5, 19, 38},
+    {12, 0, 13, 0, 5, 19, 38},
+    {12, 103, 13, 0, 5, 19, 38},
+    {12, 9, 13, 0, 5, 19, 38},
+    {23, 0, 10, 0, 5, 0, 9},
+    {6, 0, 0, 0, 5, 19, 38},
+    {12, 107, 13, 0, 5, 19, 38},
+    {21, 0, 0, 0, 5, 19, 12},
+    {13, 0, 0, 0, 5, 19, 11},
+    {21, 0, 0, 0, 5, 19, 17},
+    {7, 0, 0, 0, 5, 20, 38},
+    {12, 0, 13, 0, 5, 20, 38},
+    {12, 118, 13, 0, 5, 20, 38},
+    {6, 0, 0, 0, 5, 20, 38},
+    {12, 122, 13, 0, 5, 20, 38},
+    {13, 0, 0, 0, 5, 20, 11},
+    {7, 0, 0, 0, 5, 21, 12},
+    {26, 0, 0, 0, 5, 21, 18},
+    {21, 0, 0, 0, 5, 21, 18},
+    {21, 0, 0, 0, 5, 21, 12},
+    {21, 0, 0, 0, 5, 21, 4},
+    {21, 0, 0, 0, 5, 21, 17},
+    {21, 0, 0, 0, 5, 21, 6},
+    {26, 0, 0, 0, 5, 21, 12},
+    {12, 220, 13, 0, 5, 21, 21},
+    {13, 0, 0, 0, 5, 21, 11},
+    {15, 0, 0, 0, 5, 21, 12},
+    {26, 0, 0, 0, 5, 21, 17},
+    {12, 216, 13, 0, 5, 21, 21},
+    {22, 0, 18, 1, 5, 21, 0},
+    {18, 0, 18, 1, 5, 21, 1},
+    {10, 0, 0, 0, 5, 21, 21},
+    {12, 129, 13, 0, 5, 21, 21},
+    {12, 130, 13, 0, 5, 21, 21},
+    {12, 0, 13, 0, 5, 21, 21},
+    {12, 132, 13, 0, 5, 21, 21},
+    {10, 0, 0, 0, 5, 21, 17},
+    {12, 230, 13, 0, 5, 21, 21},
+    {12, 9, 13, 0, 5, 21, 21},
+    {26, 0, 0, 0, 5, 0, 12},
+    {7, 0, 0, 0, 5, 22, 38},
+    {10, 0, 0, 0, 5, 22, 38},
+    {12, 0, 13, 0, 5, 22, 38},
+    {12, 7, 13, 0, 5, 22, 38},
+    {12, 9, 13, 0, 5, 22, 38},
+    {13, 0, 0, 0, 5, 22, 11},
+    {21, 0, 0, 0, 5, 22, 17},
+    {21, 0, 0, 0, 5, 22, 12},
+    {12, 220, 13, 0, 5, 22, 38},
+    {26, 0, 0, 0, 5, 22, 38},
+    {9, 0, 0, 0, 5, 23, 12},
+    {7, 0, 0, 0, 5, 23, 12},
     {21, 0, 0, 0, 5, 0, 12},
-    {23, 0, 10, 0, 5, 0, 12},
-    {12, 0, 13, 0, 5, 0, 13},
-    {10, 0, 0, 0, 5, 0, 13},
-    {7, 0, 0, 0, 5, 0, 13},
-    {12, 7, 13, 0, 5, 0, 13},
-    {12, 9, 13, 0, 5, 0, 13},
-    {13, 0, 0, 0, 5, 0, 13},
-    {26, 0, 0, 0, 5, 0, 13},
-    {15, 0, 0, 0, 5, 0, 13},
-    {12, 0, 13, 0, 5, 0, 14},
-    {7, 0, 0, 0, 5, 0, 14},
-    {10, 0, 0, 0, 5, 0, 14},
-    {12, 9, 13, 0, 5, 0, 14},
-    {13, 0, 0, 0, 5, 0, 14},
-    {15, 0, 0, 0, 5, 0, 14},
-    {26, 0, 18, 0, 5, 0, 14},
-    {23, 0, 10, 0, 5, 0, 14},
-    {12, 0, 13, 0, 5, 0, 15},
-    {10, 0, 0, 0, 5, 0, 15},
-    {7, 0, 0, 0, 5, 0, 15},
-    {12, 9, 13, 0, 5, 0, 15},
-    {12, 84, 13, 0, 5, 0, 15},
-    {12, 91, 13, 0, 5, 0, 15},
-    {13, 0, 0, 0, 5, 0, 15},
-    {15, 0, 18, 0, 5, 0, 15},
-    {26, 0, 0, 0, 5, 0, 15},
-    {12, 0, 13, 0, 5, 0, 16},
-    {10, 0, 0, 0, 5, 0, 16},
-    {7, 0, 0, 0, 5, 0, 16},
-    {12, 7, 13, 0, 5, 0, 16},
-    {12, 0, 0, 0, 5, 0, 16},
-    {12, 9, 13, 0, 5, 0, 16},
-    {13, 0, 0, 0, 5, 0, 16},
-    {12, 0, 13, 0, 5, 0, 17},
-    {10, 0, 0, 0, 5, 0, 17},
-    {7, 0, 0, 0, 5, 0, 17},
-    {12, 9, 13, 0, 5, 0, 17},
-    {13, 0, 0, 0, 5, 0, 17},
-    {15, 0, 0, 0, 5, 0, 17},
-    {26, 0, 0, 0, 5, 0, 17},
-    {10, 0, 0, 0, 5, 0, 18},
-    {7, 0, 0, 0, 5, 0, 18},
-    {12, 9, 13, 0, 5, 0, 18},
-    {12, 0, 13, 0, 5, 0, 18},
-    {13, 0, 0, 0, 5, 0, 18},
-    {21, 0, 0, 0, 5, 0, 18},
-    {7, 0, 0, 0, 5, 0, 19},
-    {12, 0, 13, 0, 5, 0, 19},
-    {12, 103, 13, 0, 5, 0, 19},
-    {12, 9, 13, 0, 5, 0, 19},
-    {23, 0, 10, 0, 5, 0, 0},
-    {6, 0, 0, 0, 5, 0, 19},
-    {12, 107, 13, 0, 5, 0, 19},
-    {21, 0, 0, 0, 5, 0, 19},
-    {13, 0, 0, 0, 5, 0, 19},
-    {7, 0, 0, 0, 5, 0, 20},
-    {12, 0, 13, 0, 5, 0, 20},
-    {12, 118, 13, 0, 5, 0, 20},
-    {6, 0, 0, 0, 5, 0, 20},
-    {12, 122, 13, 0, 5, 0, 20},
-    {13, 0, 0, 0, 5, 0, 20},
-    {7, 0, 0, 0, 5, 0, 21},
-    {26, 0, 0, 0, 5, 0, 21},
-    {21, 0, 0, 0, 5, 0, 21},
-    {12, 220, 13, 0, 5, 0, 21},
-    {13, 0, 0, 0, 5, 0, 21},
-    {15, 0, 0, 0, 5, 0, 21},
-    {12, 216, 13, 0, 5, 0, 21},
-    {22, 0, 18, 1, 5, 0, 21},
-    {18, 0, 18, 1, 5, 0, 21},
+    {6, 0, 0, 0, 5, 23, 12},
+    {7, 0, 0, 0, 2, 24, 25},
+    {7, 0, 0, 0, 5, 24, 26},
+    {7, 0, 0, 0, 5, 24, 27},
+    {7, 0, 0, 0, 5, 25, 12},
+    {12, 230, 13, 0, 5, 25, 21},
+    {21, 0, 0, 0, 5, 25, 12},
+    {21, 0, 0, 0, 5, 25, 17},
+    {15, 0, 0, 0, 5, 25, 12},
+    {26, 0, 18, 0, 5, 25, 12},
+    {9, 0, 0, 0, 5, 26, 12},
+    {5, 0, 0, 0, 5, 26, 12},
+    {17, 0, 18, 0, 5, 27, 17},
+    {7, 0, 0, 0, 5, 27, 12},
+    {21, 0, 0, 0, 5, 27, 12},
+    {29, 0, 17, 0, 5, 28, 17},
+    {7, 0, 0, 0, 5, 28, 12},
+    {22, 0, 18, 1, 5, 28, 0},
+    {18, 0, 18, 1, 5, 28, 1},
+    {7, 0, 0, 0, 5, 29, 12},
+    {14, 0, 0, 0, 5, 29, 12},
+    {7, 0, 0, 0, 5, 41, 12},
+    {12, 0, 13, 0, 5, 41, 21},
+    {12, 9, 13, 0, 5, 41, 21},
+    {7, 0, 0, 0, 5, 42, 12},
+    {12, 0, 13, 0, 5, 42, 21},
+    {12, 9, 13, 0, 5, 42, 21},
+    {7, 0, 0, 0, 5, 43, 12},
+    {12, 0, 13, 0, 5, 43, 21},
+    {7, 0, 0, 0, 5, 44, 12},
+    {12, 0, 13, 0, 5, 44, 21},
+    {7, 0, 0, 0, 5, 30, 38},
+    {12, 0, 13, 0, 5, 30, 38},
+    {10, 0, 0, 0, 5, 30, 38},
+    {12, 9, 13, 0, 5, 30, 38},
+    {21, 0, 0, 0, 5, 30, 17},
+    {21, 0, 0, 0, 5, 30, 5},
+    {6, 0, 0, 0, 5, 30, 38},
+    {21, 0, 0, 0, 5, 30, 12},
+    {23, 0, 10, 0, 5, 30, 9},
+    {12, 230, 13, 0, 5, 30, 38},
+    {13, 0, 0, 0, 5, 30, 11},
+    {15, 0, 18, 0, 5, 30, 12},
+    {21, 0, 18, 0, 5, 31, 12},
+    {21, 0, 18, 0, 5, 0, 6},
+    {21, 0, 18, 0, 5, 31, 17},
+    {21, 0, 18, 0, 5, 0, 17},
+    {17, 0, 18, 0, 5, 31, 18},
+    {21, 0, 18, 0, 5, 31, 6},
+    {12, 0, 13, 0, 5, 31, 21},
+    {1, 0, 14, 0, 5, 31, 4},
+    {13, 0, 0, 0, 5, 31, 11},
+    {7, 0, 0, 0, 5, 31, 12},
+    {6, 0, 0, 0, 5, 31, 12},
+    {12, 228, 13, 0, 5, 31, 21},
+    {7, 0, 0, 0, 5, 45, 12},
+    {12, 0, 13, 0, 5, 45, 21},
+    {10, 0, 0, 0, 5, 45, 21},
+    {12, 222, 13, 0, 5, 45, 21},
+    {12, 230, 13, 0, 5, 45, 21},
+    {12, 220, 13, 0, 5, 45, 21},
+    {26, 0, 18, 0, 5, 45, 12},
+    {21, 0, 18, 0, 5, 45, 6},
+    {13, 0, 0, 0, 5, 45, 11},
+    {7, 0, 0, 0, 5, 46, 38},
+    {7, 0, 0, 0, 5, 55, 38},
+    {13, 0, 0, 0, 5, 55, 11},
+    {15, 0, 0, 0, 5, 55, 38},
+    {26, 0, 18, 0, 5, 55, 38},
+    {26, 0, 18, 0, 5, 30, 12},
+    {7, 0, 0, 0, 5, 53, 12},
+    {12, 230, 13, 0, 5, 53, 21},
+    {12, 220, 13, 0, 5, 53, 21},
+    {10, 0, 0, 0, 5, 53, 21},
+    {12, 0, 13, 0, 5, 53, 21},
+    {21, 0, 0, 0, 5, 53, 12},
+    {7, 0, 0, 0, 5, 77, 38},
+    {10, 0, 0, 0, 5, 77, 38},
+    {12, 0, 13, 0, 5, 77, 38},
+    {12, 9, 13, 0, 5, 77, 38},
+    {12, 230, 13, 0, 5, 77, 38},
+    {12, 220, 13, 0, 5, 77, 21},
+    {13, 0, 0, 0, 5, 77, 11},
+    {21, 0, 0, 0, 5, 77, 38},
+    {6, 0, 0, 0, 5, 77, 38},
+    {11, 0, 13, 0, 5, 40, 21},
+    {12, 0, 13, 0, 5, 61, 21},
+    {10, 0, 0, 0, 5, 61, 21},
+    {7, 0, 0, 0, 5, 61, 12},
+    {12, 7, 13, 0, 5, 61, 21},
+    {10, 9, 0, 0, 5, 61, 21},
+    {13, 0, 0, 0, 5, 61, 11},
+    {21, 0, 0, 0, 5, 61, 17},
+    {21, 0, 0, 0, 5, 61, 12},
+    {26, 0, 0, 0, 5, 61, 12},
+    {12, 230, 13, 0, 5, 61, 21},
+    {12, 220, 13, 0, 5, 61, 21},
+    {12, 0, 13, 0, 5, 66, 21},
+    {10, 0, 0, 0, 5, 66, 21},
+    {7, 0, 0, 0, 5, 66, 12},
+    {10, 9, 0, 0, 5, 66, 21},
+    {12, 9, 13, 0, 5, 66, 21},
+    {13, 0, 0, 0, 5, 66, 11},
+    {7, 0, 0, 0, 5, 92, 12},
+    {12, 7, 13, 0, 5, 92, 21},
+    {10, 0, 0, 0, 5, 92, 21},
+    {12, 0, 13, 0, 5, 92, 21},
+    {10, 9, 0, 0, 5, 92, 21},
+    {21, 0, 0, 0, 5, 92, 12},
+    {7, 0, 0, 0, 5, 67, 12},
+    {10, 0, 0, 0, 5, 67, 21},
+    {12, 0, 13, 0, 5, 67, 21},
+    {12, 7, 13, 0, 5, 67, 21},
+    {21, 0, 0, 0, 5, 67, 17},
+    {13, 0, 0, 0, 5, 67, 11},
+    {13, 0, 0, 0, 5, 68, 11},
+    {7, 0, 0, 0, 5, 68, 12},
+    {6, 0, 0, 0, 5, 68, 12},
+    {21, 0, 0, 0, 5, 68, 17},
+    {21, 0, 0, 0, 5, 66, 12},
+    {12, 1, 13, 0, 5, 40, 21},
     {10, 0, 0, 0, 5, 0, 21},
-    {12, 129, 13, 0, 5, 0, 21},
-    {12, 130, 13, 0, 5, 0, 21},
-    {12, 0, 13, 0, 5, 0, 21},
-    {12, 132, 13, 0, 5, 0, 21},
-    {12, 230, 13, 0, 5, 0, 21},
-    {12, 9, 13, 0, 5, 0, 21},
-    {26, 0, 0, 0, 5, 0, 0},
-    {7, 0, 0, 0, 5, 0, 22},
-    {10, 0, 0, 0, 5, 0, 22},
-    {12, 0, 13, 0, 5, 0, 22},
-    {12, 7, 13, 0, 5, 0, 22},
-    {12, 9, 13, 0, 5, 0, 22},
-    {13, 0, 0, 0, 5, 0, 22},
-    {21, 0, 0, 0, 5, 0, 22},
-    {12, 220, 13, 0, 5, 0, 22},
-    {26, 0, 0, 0, 5, 0, 22},
-    {9, 0, 0, 0, 5, 0, 23},
-    {7, 0, 0, 0, 5, 0, 23},
-    {6, 0, 0, 0, 5, 0, 23},
-    {7, 0, 0, 0, 2, 0, 24},
-    {7, 0, 0, 0, 5, 0, 24},
-    {7, 0, 0, 0, 5, 0, 25},
-    {12, 230, 13, 0, 5, 0, 25},
-    {21, 0, 0, 0, 5, 0, 25},
-    {15, 0, 0, 0, 5, 0, 25},
-    {26, 0, 18, 0, 5, 0, 25},
-    {9, 0, 0, 0, 5, 0, 26},
-    {5, 0, 0, 0, 5, 0, 26},
-    {17, 0, 18, 0, 5, 0, 27},
-    {7, 0, 0, 0, 5, 0, 27},
-    {21, 0, 0, 0, 5, 0, 27},
-    {29, 0, 17, 0, 5, 0, 28},
-    {7, 0, 0, 0, 5, 0, 28},
-    {22, 0, 18, 1, 5, 0, 28},
-    {18, 0, 18, 1, 5, 0, 28},
-    {7, 0, 0, 0, 5, 0, 29},
-    {14, 0, 0, 0, 5, 0, 29},
-    {7, 0, 0, 0, 5, 0, 41},
-    {12, 0, 13, 0, 5, 0, 41},
-    {12, 9, 13, 0, 5, 0, 41},
-    {7, 0, 0, 0, 5, 0, 42},
-    {12, 0, 13, 0, 5, 0, 42},
-    {12, 9, 13, 0, 5, 0, 42},
-    {7, 0, 0, 0, 5, 0, 43},
-    {12, 0, 13, 0, 5, 0, 43},
-    {7, 0, 0, 0, 5, 0, 44},
-    {12, 0, 13, 0, 5, 0, 44},
-    {7, 0, 0, 0, 5, 0, 30},
-    {12, 0, 13, 0, 5, 0, 30},
-    {10, 0, 0, 0, 5, 0, 30},
-    {12, 9, 13, 0, 5, 0, 30},
-    {21, 0, 0, 0, 5, 0, 30},
-    {6, 0, 0, 0, 5, 0, 30},
-    {23, 0, 10, 0, 5, 0, 30},
-    {12, 230, 13, 0, 5, 0, 30},
-    {13, 0, 0, 0, 5, 0, 30},
-    {15, 0, 18, 0, 5, 0, 30},
-    {21, 0, 18, 0, 5, 0, 31},
-    {17, 0, 18, 0, 5, 0, 31},
-    {12, 0, 13, 0, 5, 0, 31},
-    {1, 0, 14, 0, 5, 0, 31},
-    {13, 0, 0, 0, 5, 0, 31},
-    {7, 0, 0, 0, 5, 0, 31},
-    {6, 0, 0, 0, 5, 0, 31},
-    {12, 228, 13, 0, 5, 0, 31},
-    {7, 0, 0, 0, 5, 0, 45},
-    {12, 0, 13, 0, 5, 0, 45},
-    {10, 0, 0, 0, 5, 0, 45},
-    {12, 222, 13, 0, 5, 0, 45},
-    {12, 230, 13, 0, 5, 0, 45},
-    {12, 220, 13, 0, 5, 0, 45},
-    {26, 0, 18, 0, 5, 0, 45},
-    {21, 0, 18, 0, 5, 0, 45},
-    {13, 0, 0, 0, 5, 0, 45},
-    {7, 0, 0, 0, 5, 0, 46},
-    {7, 0, 0, 0, 5, 0, 55},
-    {13, 0, 0, 0, 5, 0, 55},
-    {15, 0, 0, 0, 5, 0, 55},
-    {26, 0, 18, 0, 5, 0, 55},
-    {26, 0, 18, 0, 5, 0, 30},
-    {7, 0, 0, 0, 5, 0, 53},
-    {12, 230, 13, 0, 5, 0, 53},
-    {12, 220, 13, 0, 5, 0, 53},
-    {10, 0, 0, 0, 5, 0, 53},
-    {12, 0, 13, 0, 5, 0, 53},
-    {21, 0, 0, 0, 5, 0, 53},
-    {7, 0, 0, 0, 5, 0, 77},
-    {10, 0, 0, 0, 5, 0, 77},
-    {12, 0, 13, 0, 5, 0, 77},
-    {12, 9, 13, 0, 5, 0, 77},
-    {12, 230, 13, 0, 5, 0, 77},
-    {12, 220, 13, 0, 5, 0, 77},
-    {13, 0, 0, 0, 5, 0, 77},
-    {21, 0, 0, 0, 5, 0, 77},
-    {6, 0, 0, 0, 5, 0, 77},
-    {11, 0, 13, 0, 5, 0, 40},
-    {12, 0, 13, 0, 5, 0, 61},
-    {10, 0, 0, 0, 5, 0, 61},
-    {7, 0, 0, 0, 5, 0, 61},
-    {12, 7, 13, 0, 5, 0, 61},
-    {10, 9, 0, 0, 5, 0, 61},
-    {13, 0, 0, 0, 5, 0, 61},
-    {21, 0, 0, 0, 5, 0, 61},
-    {26, 0, 0, 0, 5, 0, 61},
-    {12, 230, 13, 0, 5, 0, 61},
-    {12, 220, 13, 0, 5, 0, 61},
-    {12, 0, 13, 0, 5, 0, 66},
-    {10, 0, 0, 0, 5, 0, 66},
-    {7, 0, 0, 0, 5, 0, 66},
-    {10, 9, 0, 0, 5, 0, 66},
-    {12, 9, 13, 0, 5, 0, 66},
-    {13, 0, 0, 0, 5, 0, 66},
-    {7, 0, 0, 0, 5, 0, 92},
-    {12, 7, 13, 0, 5, 0, 92},
-    {10, 0, 0, 0, 5, 0, 92},
-    {12, 0, 13, 0, 5, 0, 92},
-    {10, 9, 0, 0, 5, 0, 92},
-    {21, 0, 0, 0, 5, 0, 92},
-    {7, 0, 0, 0, 5, 0, 67},
-    {10, 0, 0, 0, 5, 0, 67},
-    {12, 0, 13, 0, 5, 0, 67},
-    {12, 7, 13, 0, 5, 0, 67},
-    {21, 0, 0, 0, 5, 0, 67},
-    {13, 0, 0, 0, 5, 0, 67},
-    {13, 0, 0, 0, 5, 0, 68},
-    {7, 0, 0, 0, 5, 0, 68},
-    {6, 0, 0, 0, 5, 0, 68},
-    {21, 0, 0, 0, 5, 0, 68},
-    {21, 0, 0, 0, 5, 0, 66},
-    {12, 1, 13, 0, 5, 0, 40},
-    {10, 0, 0, 0, 5, 0, 0},
-    {7, 0, 0, 0, 5, 0, 0},
-    {6, 0, 0, 0, 5, 0, 3},
-    {12, 234, 13, 0, 5, 0, 40},
-    {12, 214, 13, 0, 5, 0, 40},
-    {12, 202, 13, 0, 5, 0, 40},
-    {12, 233, 13, 0, 5, 0, 40},
-    {8, 0, 0, 0, 5, 0, 2},
-    {29, 0, 17, 0, 5, 0, 0},
-    {1, 0, 14, 0, 5, 0, 0},
-    {1, 0, 14, 0, 5, 0, 40},
-    {1, 0, 0, 0, 5, 0, 0},
-    {1, 0, 3, 0, 5, 0, 0},
-    {17, 0, 18, 0, 4, 0, 0},
-    {17, 0, 18, 0, 5, 0, 0},
-    {20, 0, 18, 0, 4, 0, 0},
-    {19, 0, 18, 0, 4, 0, 0},
+    {7, 0, 0, 0, 5, 0, 12},
+    {6, 0, 0, 0, 5, 3, 12},
+    {12, 234, 13, 0, 5, 40, 21},
+    {12, 214, 13, 0, 5, 40, 21},
+    {12, 202, 13, 0, 5, 40, 21},
+    {12, 233, 13, 0, 5, 40, 21},
+    {8, 0, 0, 0, 5, 2, 12},
+    {24, 0, 18, 0, 5, 2, 18},
+    {29, 0, 17, 0, 5, 0, 17},
+    {29, 0, 17, 0, 5, 0, 4},
+    {1, 0, 14, 0, 5, 0, 20},
+    {1, 0, 14, 0, 5, 40, 21},
+    {1, 0, 14, 0, 5, 40, 41},
+    {1, 0, 0, 0, 5, 0, 21},
+    {1, 0, 3, 0, 5, 0, 21},
+    {17, 0, 18, 0, 4, 0, 17},
+    {17, 0, 18, 0, 5, 0, 4},
+    {17, 0, 18, 0, 5, 0, 17},
+    {17, 0, 18, 0, 4, 0, 19},
+    {17, 0, 18, 0, 4, 0, 29},
+    {20, 0, 18, 0, 4, 0, 3},
+    {19, 0, 18, 0, 4, 0, 3},
     {22, 0, 18, 0, 5, 0, 0},
-    {20, 0, 18, 0, 5, 0, 0},
-    {27, 0, 17, 0, 5, 0, 0},
-    {28, 0, 15, 0, 5, 0, 0},
-    {1, 0, 1, 0, 5, 0, 0},
-    {1, 0, 5, 0, 5, 0, 0},
-    {1, 0, 7, 0, 5, 0, 0},
-    {1, 0, 2, 0, 5, 0, 0},
-    {1, 0, 6, 0, 5, 0, 0},
-    {21, 0, 10, 0, 4, 0, 0},
-    {21, 0, 10, 0, 5, 0, 0},
-    {16, 0, 18, 0, 5, 0, 0},
-    {25, 0, 12, 0, 5, 0, 0},
+    {20, 0, 18, 0, 5, 0, 3},
+    {21, 0, 18, 0, 4, 0, 12},
+    {21, 0, 18, 0, 4, 0, 15},
+    {21, 0, 18, 0, 4, 0, 17},
+    {27, 0, 17, 0, 5, 0, 30},
+    {28, 0, 15, 0, 5, 0, 30},
+    {1, 0, 1, 0, 5, 0, 21},
+    {1, 0, 5, 0, 5, 0, 21},
+    {1, 0, 7, 0, 5, 0, 21},
+    {1, 0, 2, 0, 5, 0, 21},
+    {1, 0, 6, 0, 5, 0, 21},
+    {21, 0, 10, 0, 4, 0, 10},
+    {21, 0, 10, 0, 5, 0, 10},
+    {21, 0, 18, 0, 4, 0, 10},
+    {21, 0, 18, 0, 5, 0, 10},
+    {21, 0, 18, 0, 5, 0, 5},
+    {16, 0, 18, 0, 5, 0, 12},
+    {25, 0, 12, 0, 5, 0, 8},
     {22, 0, 18, 1, 5, 0, 0},
-    {18, 0, 18, 1, 5, 0, 0},
-    {25, 0, 18, 0, 5, 0, 0},
-    {1, 0, 19, 0, 5, 0, 0},
-    {1, 0, 20, 0, 5, 0, 0},
-    {1, 0, 21, 0, 5, 0, 0},
-    {1, 0, 22, 0, 5, 0, 0},
-    {15, 0, 8, 0, 5, 0, 0},
-    {25, 0, 9, 0, 5, 0, 0},
-    {6, 0, 0, 0, 4, 0, 1},
-    {23, 0, 10, 0, 1, 0, 0},
-    {9, 0, 0, 0, 5, 0, 0},
-    {5, 0, 0, 0, 4, 0, 0},
-    {26, 0, 10, 0, 5, 0, 0},
-    {25, 0, 18, 1, 5, 0, 0},
-    {15, 0, 18, 0, 5, 0, 0},
-    {14, 0, 0, 0, 4, 0, 1},
-    {14, 0, 0, 0, 5, 0, 1},
-    {25, 0, 18, 1, 4, 0, 0},
-    {25, 0, 10, 0, 5, 0, 0},
+    {18, 0, 18, 1, 5, 0, 1},
+    {25, 0, 18, 0, 5, 0, 12},
+    {1, 0, 14, 0, 5, 0, 22},
+    {1, 0, 14, 0, 5, 0, 12},
+    {1, 0, 19, 0, 5, 0, 21},
+    {1, 0, 20, 0, 5, 0, 21},
+    {1, 0, 21, 0, 5, 0, 21},
+    {1, 0, 22, 0, 5, 0, 21},
+    {1, 0, 14, 0, 5, 0, 21},
+    {15, 0, 8, 0, 5, 0, 12},
+    {25, 0, 9, 0, 5, 0, 12},
+    {6, 0, 0, 0, 4, 1, 29},
+    {23, 0, 10, 0, 5, 0, 10},
+    {23, 0, 10, 0, 1, 0, 9},
+    {2, 0, 18, 0, 5, 102, 9},
+    {9, 0, 0, 0, 5, 0, 12},
+    {26, 0, 18, 0, 4, 0, 10},
+    {26, 0, 18, 0, 4, 0, 29},
+    {5, 0, 0, 0, 4, 0, 29},
+    {26, 0, 18, 0, 4, 0, 9},
+    {9, 0, 0, 0, 4, 1, 29},
+    {26, 0, 10, 0, 5, 0, 12},
+    {25, 0, 18, 1, 5, 0, 12},
+    {15, 0, 18, 0, 5, 0, 12},
+    {15, 0, 18, 0, 4, 0, 12},
+    {15, 0, 18, 0, 5, 0, 29},
+    {14, 0, 0, 0, 4, 1, 29},
+    {14, 0, 0, 0, 5, 1, 12},
+    {25, 0, 18, 1, 4, 0, 29},
+    {25, 0, 9, 0, 5, 0, 9},
+    {25, 0, 10, 0, 5, 0, 9},
+    {25, 0, 18, 0, 5, 0, 15},
+    {26, 0, 18, 0, 2, 0, 14},
     {22, 0, 18, 1, 2, 0, 0},
-    {18, 0, 18, 1, 2, 0, 0},
-    {26, 0, 0, 0, 4, 0, 0},
-    {26, 0, 0, 0, 5, 0, 52},
-    {9, 0, 0, 0, 5, 0, 56},
-    {5, 0, 0, 0, 5, 0, 56},
-    {26, 0, 18, 0, 5, 0, 54},
-    {12, 230, 13, 0, 5, 0, 54},
-    {21, 0, 18, 0, 5, 0, 54},
-    {15, 0, 18, 0, 5, 0, 54},
-    {5, 0, 0, 0, 5, 0, 23},
-    {7, 0, 0, 0, 5, 0, 57},
-    {6, 0, 0, 0, 5, 0, 57},
-    {21, 0, 0, 0, 5, 0, 57},
-    {12, 9, 13, 0, 5, 0, 57},
-    {26, 0, 18, 0, 2, 0, 35},
-    {26, 0, 18, 0, 2, 0, 0},
-    {29, 0, 17, 0, 0, 0, 0},
-    {21, 0, 18, 0, 2, 0, 0},
-    {6, 0, 0, 0, 2, 0, 35},
-    {7, 0, 0, 0, 2, 0, 0},
-    {14, 0, 0, 0, 2, 0, 35},
-    {17, 0, 18, 0, 2, 0, 0},
-    {22, 0, 18, 0, 2, 0, 0},
-    {18, 0, 18, 0, 2, 0, 0},
-    {12, 218, 13, 0, 2, 0, 40},
-    {12, 228, 13, 0, 2, 0, 40},
-    {12, 232, 13, 0, 2, 0, 40},
-    {12, 222, 13, 0, 2, 0, 40},
-    {10, 224, 0, 0, 2, 0, 24},
-    {6, 0, 0, 0, 2, 0, 0},
-    {7, 0, 0, 0, 2, 0, 32},
-    {12, 8, 13, 0, 2, 0, 40},
-    {24, 0, 18, 0, 2, 0, 0},
-    {6, 0, 0, 0, 2, 0, 32},
-    {7, 0, 0, 0, 2, 0, 33},
-    {6, 0, 0, 0, 2, 0, 33},
-    {7, 0, 0, 0, 2, 0, 34},
-    {26, 0, 0, 0, 2, 0, 0},
-    {15, 0, 0, 0, 2, 0, 0},
-    {26, 0, 0, 0, 2, 0, 24},
-    {26, 0, 18, 0, 2, 0, 24},
-    {15, 0, 0, 0, 4, 0, 0},
-    {15, 0, 18, 0, 2, 0, 0},
-    {26, 0, 0, 0, 2, 0, 33},
-    {7, 0, 0, 0, 2, 0, 35},
-    {2, 0, 18, 0, 2, 0, 102},
-    {7, 0, 0, 0, 2, 0, 36},
-    {6, 0, 0, 0, 2, 0, 36},
-    {26, 0, 18, 0, 2, 0, 36},
-    {7, 0, 0, 0, 5, 0, 82},
-    {6, 0, 0, 0, 5, 0, 82},
-    {21, 0, 0, 0, 5, 0, 82},
-    {7, 0, 0, 0, 5, 0, 69},
-    {6, 0, 0, 0, 5, 0, 69},
-    {21, 0, 18, 0, 5, 0, 69},
-    {13, 0, 0, 0, 5, 0, 69},
-    {7, 0, 0, 0, 5, 0, 3},
+    {18, 0, 18, 1, 2, 0, 1},
+    {26, 0, 18, 0, 2, 0, 12},
+    {26, 0, 18, 0, 5, 0, 14},
+    {26, 0, 0, 0, 4, 0, 29},
+    {26, 0, 18, 0, 5, 0, 29},
+    {25, 0, 18, 0, 2, 0, 12},
+    {26, 0, 18, 0, 4, 0, 14},
+    {26, 0, 18, 0, 5, 0, 41},
+    {26, 0, 18, 0, 4, 0, 41},
+    {26, 0, 18, 0, 2, 0, 41},
+    {26, 0, 18, 0, 2, 0, 29},
+    {26, 0, 18, 0, 5, 0, 3},
+    {26, 0, 18, 0, 5, 0, 6},
+    {26, 0, 0, 0, 5, 52, 12},
+    {9, 0, 0, 0, 5, 56, 12},
+    {5, 0, 0, 0, 5, 56, 12},
+    {26, 0, 18, 0, 5, 54, 12},
+    {12, 230, 13, 0, 5, 54, 21},
+    {21, 0, 18, 0, 5, 54, 6},
+    {21, 0, 18, 0, 5, 54, 17},
+    {15, 0, 18, 0, 5, 54, 12},
+    {5, 0, 0, 0, 5, 23, 12},
+    {7, 0, 0, 0, 5, 57, 12},
+    {6, 0, 0, 0, 5, 57, 12},
+    {21, 0, 0, 0, 5, 57, 17},
+    {12, 9, 13, 0, 5, 57, 21},
     {21, 0, 18, 0, 5, 0, 3},
-    {6, 0, 18, 0, 5, 0, 3},
-    {7, 0, 0, 0, 5, 0, 83},
-    {14, 0, 0, 0, 5, 0, 83},
-    {12, 230, 13, 0, 5, 0, 83},
-    {21, 0, 0, 0, 5, 0, 83},
-    {24, 0, 0, 0, 5, 0, 0},
-    {7, 0, 0, 0, 5, 0, 58},
-    {12, 0, 13, 0, 5, 0, 58},
-    {12, 9, 13, 0, 5, 0, 58},
-    {10, 0, 0, 0, 5, 0, 58},
-    {26, 0, 18, 0, 5, 0, 58},
-    {15, 0, 0, 0, 5, 0, 0},
-    {7, 0, 0, 0, 5, 0, 64},
-    {21, 0, 18, 0, 5, 0, 64},
-    {10, 0, 0, 0, 5, 0, 70},
-    {7, 0, 0, 0, 5, 0, 70},
-    {12, 9, 13, 0, 5, 0, 70},
-    {21, 0, 0, 0, 5, 0, 70},
-    {13, 0, 0, 0, 5, 0, 70},
-    {13, 0, 0, 0, 5, 0, 71},
-    {7, 0, 0, 0, 5, 0, 71},
-    {12, 0, 13, 0, 5, 0, 71},
-    {12, 220, 13, 0, 5, 0, 71},
-    {21, 0, 0, 0, 5, 0, 71},
-    {7, 0, 0, 0, 5, 0, 72},
-    {12, 0, 13, 0, 5, 0, 72},
-    {10, 0, 0, 0, 5, 0, 72},
-    {10, 9, 0, 0, 5, 0, 72},
-    {21, 0, 0, 0, 5, 0, 72},
-    {12, 0, 13, 0, 5, 0, 84},
-    {10, 0, 0, 0, 5, 0, 84},
-    {7, 0, 0, 0, 5, 0, 84},
-    {12, 7, 13, 0, 5, 0, 84},
-    {10, 9, 0, 0, 5, 0, 84},
-    {21, 0, 0, 0, 5, 0, 84},
-    {13, 0, 0, 0, 5, 0, 84},
-    {6, 0, 0, 0, 5, 0, 22},
-    {7, 0, 0, 0, 5, 0, 76},
-    {12, 0, 13, 0, 5, 0, 76},
-    {10, 0, 0, 0, 5, 0, 76},
-    {13, 0, 0, 0, 5, 0, 76},
-    {21, 0, 0, 0, 5, 0, 76},
-    {7, 0, 0, 0, 5, 0, 78},
-    {12, 230, 13, 0, 5, 0, 78},
-    {12, 220, 13, 0, 5, 0, 78},
-    {6, 0, 0, 0, 5, 0, 78},
-    {21, 0, 0, 0, 5, 0, 78},
-    {7, 0, 0, 0, 5, 0, 85},
-    {10, 0, 0, 0, 5, 0, 85},
-    {12, 0, 13, 0, 5, 0, 85},
-    {21, 0, 0, 0, 5, 0, 85},
-    {6, 0, 0, 0, 5, 0, 85},
-    {12, 9, 13, 0, 5, 0, 85},
-    {13, 0, 0, 0, 5, 0, 85},
-    {4, 0, 0, 0, 5, 0, 102},
-    {3, 0, 0, 0, 4, 0, 102},
-    {12, 26, 13, 0, 5, 0, 5},
-    {25, 0, 9, 0, 5, 0, 5},
-    {24, 0, 4, 0, 5, 0, 6},
-    {18, 0, 18, 0, 5, 0, 0},
-    {16, 0, 18, 0, 2, 0, 0},
-    {21, 0, 12, 0, 2, 0, 0},
-    {21, 0, 10, 0, 2, 0, 0},
-    {25, 0, 9, 0, 2, 0, 0},
-    {17, 0, 9, 0, 2, 0, 0},
-    {25, 0, 18, 1, 2, 0, 0},
-    {25, 0, 18, 0, 2, 0, 0},
-    {23, 0, 10, 0, 2, 0, 0},
-    {21, 0, 18, 0, 0, 0, 0},
-    {21, 0, 10, 0, 0, 0, 0},
-    {23, 0, 10, 0, 0, 0, 0},
+    {21, 0, 18, 0, 5, 0, 0},
+    {17, 0, 18, 0, 5, 0, 12},
+    {17, 0, 18, 0, 5, 0, 19},
+    {26, 0, 18, 0, 2, 35, 14},
+    {29, 0, 17, 0, 0, 0, 17},
+    {21, 0, 18, 0, 2, 0, 1},
+    {21, 0, 18, 0, 2, 0, 14},
+    {6, 0, 0, 0, 2, 35, 5},
+    {7, 0, 0, 0, 2, 0, 14},
+    {14, 0, 0, 0, 2, 35, 14},
+    {17, 0, 18, 0, 2, 0, 5},
+    {22, 0, 18, 0, 2, 0, 0},
+    {18, 0, 18, 0, 2, 0, 1},
+    {12, 218, 13, 0, 2, 40, 21},
+    {12, 228, 13, 0, 2, 40, 21},
+    {12, 232, 13, 0, 2, 40, 21},
+    {12, 222, 13, 0, 2, 40, 21},
+    {10, 224, 0, 0, 2, 24, 21},
+    {17, 0, 18, 0, 2, 0, 14},
+    {6, 0, 0, 0, 2, 0, 14},
+    {6, 0, 0, 0, 2, 0, 21},
+    {7, 0, 0, 0, 2, 0, 5},
+    {7, 0, 0, 0, 2, 32, 32},
+    {7, 0, 0, 0, 2, 32, 14},
+    {12, 8, 13, 0, 2, 40, 21},
+    {24, 0, 18, 0, 2, 0, 5},
+    {6, 0, 0, 0, 2, 32, 5},
+    {7, 0, 0, 0, 2, 33, 32},
+    {7, 0, 0, 0, 2, 33, 14},
+    {21, 0, 18, 0, 2, 0, 5},
+    {6, 0, 0, 0, 2, 0, 32},
+    {6, 0, 0, 0, 2, 33, 5},
+    {7, 0, 0, 0, 2, 34, 14},
+    {7, 0, 0, 0, 2, 24, 14},
+    {26, 0, 0, 0, 2, 0, 14},
+    {15, 0, 0, 0, 2, 0, 14},
+    {26, 0, 0, 0, 2, 24, 14},
+    {26, 0, 18, 0, 2, 24, 14},
+    {15, 0, 0, 0, 4, 0, 29},
+    {15, 0, 18, 0, 2, 0, 14},
+    {26, 0, 0, 0, 2, 33, 14},
+    {7, 0, 0, 0, 2, 35, 14},
+    {2, 0, 18, 0, 2, 102, 14},
+    {7, 0, 0, 0, 2, 36, 14},
+    {6, 0, 0, 0, 2, 36, 5},
+    {26, 0, 18, 0, 2, 36, 14},
+    {7, 0, 0, 0, 5, 82, 12},
+    {6, 0, 0, 0, 5, 82, 12},
+    {21, 0, 0, 0, 5, 82, 17},
+    {7, 0, 0, 0, 5, 69, 12},
+    {6, 0, 0, 0, 5, 69, 12},
+    {21, 0, 18, 0, 5, 69, 17},
+    {21, 0, 18, 0, 5, 69, 6},
+    {13, 0, 0, 0, 5, 69, 11},
+    {7, 0, 0, 0, 5, 3, 12},
+    {21, 0, 18, 0, 5, 3, 12},
+    {6, 0, 18, 0, 5, 3, 12},
+    {7, 0, 0, 0, 5, 83, 12},
+    {14, 0, 0, 0, 5, 83, 12},
+    {12, 230, 13, 0, 5, 83, 21},
+    {21, 0, 0, 0, 5, 83, 12},
+    {21, 0, 0, 0, 5, 83, 17},
+    {24, 0, 0, 0, 5, 0, 12},
+    {7, 0, 0, 0, 5, 58, 12},
+    {12, 0, 13, 0, 5, 58, 21},
+    {12, 9, 13, 0, 5, 58, 21},
+    {10, 0, 0, 0, 5, 58, 21},
+    {26, 0, 18, 0, 5, 58, 12},
+    {15, 0, 0, 0, 5, 0, 12},
+    {7, 0, 0, 0, 5, 64, 12},
+    {21, 0, 18, 0, 5, 64, 18},
+    {21, 0, 18, 0, 5, 64, 6},
+    {10, 0, 0, 0, 5, 70, 21},
+    {7, 0, 0, 0, 5, 70, 12},
+    {12, 9, 13, 0, 5, 70, 21},
+    {12, 0, 13, 0, 5, 70, 21},
+    {21, 0, 0, 0, 5, 70, 17},
+    {13, 0, 0, 0, 5, 70, 11},
+    {21, 0, 0, 0, 5, 9, 18},
+    {13, 0, 0, 0, 5, 71, 11},
+    {7, 0, 0, 0, 5, 71, 12},
+    {12, 0, 13, 0, 5, 71, 21},
+    {12, 220, 13, 0, 5, 71, 21},
+    {21, 0, 0, 0, 5, 71, 17},
+    {7, 0, 0, 0, 5, 72, 12},
+    {12, 0, 13, 0, 5, 72, 21},
+    {10, 0, 0, 0, 5, 72, 21},
+    {10, 9, 0, 0, 5, 72, 21},
+    {21, 0, 0, 0, 5, 72, 12},
+    {12, 0, 13, 0, 5, 84, 21},
+    {10, 0, 0, 0, 5, 84, 21},
+    {7, 0, 0, 0, 5, 84, 12},
+    {12, 7, 13, 0, 5, 84, 21},
+    {10, 9, 0, 0, 5, 84, 21},
+    {21, 0, 0, 0, 5, 84, 12},
+    {21, 0, 0, 0, 5, 84, 17},
+    {13, 0, 0, 0, 5, 84, 11},
+    {6, 0, 0, 0, 5, 22, 38},
+    {7, 0, 0, 0, 5, 76, 12},
+    {12, 0, 13, 0, 5, 76, 21},
+    {10, 0, 0, 0, 5, 76, 21},
+    {13, 0, 0, 0, 5, 76, 11},
+    {21, 0, 0, 0, 5, 76, 12},
+    {21, 0, 0, 0, 5, 76, 17},
+    {7, 0, 0, 0, 5, 78, 38},
+    {12, 230, 13, 0, 5, 78, 38},
+    {12, 220, 13, 0, 5, 78, 38},
+    {6, 0, 0, 0, 5, 78, 38},
+    {21, 0, 0, 0, 5, 78, 38},
+    {7, 0, 0, 0, 5, 85, 12},
+    {10, 0, 0, 0, 5, 85, 21},
+    {12, 0, 13, 0, 5, 85, 21},
+    {21, 0, 0, 0, 5, 85, 17},
+    {6, 0, 0, 0, 5, 85, 12},
+    {12, 9, 13, 0, 5, 85, 21},
+    {13, 0, 0, 0, 5, 85, 11},
+    {7, 0, 0, 0, 2, 24, 23},
+    {7, 0, 0, 0, 2, 24, 24},
+    {4, 0, 0, 0, 5, 102, 39},
+    {3, 0, 0, 0, 4, 102, 41},
+    {12, 26, 13, 0, 5, 5, 21},
+    {25, 0, 9, 0, 5, 5, 12},
+    {24, 0, 4, 0, 5, 6, 12},
+    {18, 0, 18, 0, 5, 0, 1},
+    {12, 0, 13, 0, 4, 40, 21},
+    {21, 0, 18, 0, 2, 0, 8},
+    {21, 0, 18, 0, 2, 0, 6},
+    {21, 0, 18, 0, 2, 0, 15},
+    {16, 0, 18, 0, 2, 0, 14},
+    {21, 0, 12, 0, 2, 0, 1},
+    {21, 0, 12, 0, 2, 0, 5},
+    {21, 0, 10, 0, 2, 0, 14},
+    {25, 0, 9, 0, 2, 0, 14},
+    {17, 0, 9, 0, 2, 0, 14},
+    {25, 0, 18, 1, 2, 0, 14},
+    {25, 0, 18, 0, 2, 0, 14},
+    {23, 0, 10, 0, 2, 0, 9},
+    {21, 0, 10, 0, 2, 0, 10},
+    {21, 0, 18, 0, 0, 0, 6},
+    {21, 0, 18, 0, 0, 0, 14},
+    {21, 0, 10, 0, 0, 0, 14},
+    {23, 0, 10, 0, 0, 0, 9},
+    {21, 0, 10, 0, 0, 0, 10},
     {22, 0, 18, 1, 0, 0, 0},
-    {18, 0, 18, 1, 0, 0, 0},
-    {25, 0, 9, 0, 0, 0, 0},
-    {21, 0, 12, 0, 0, 0, 0},
-    {17, 0, 9, 0, 0, 0, 0},
-    {13, 0, 8, 0, 0, 0, 0},
-    {25, 0, 18, 1, 0, 0, 0},
-    {25, 0, 18, 0, 0, 0, 0},
-    {9, 0, 0, 0, 0, 0, 1},
-    {24, 0, 18, 0, 0, 0, 0},
-    {16, 0, 18, 0, 0, 0, 0},
-    {5, 0, 0, 0, 0, 0, 1},
-    {21, 0, 18, 0, 1, 0, 0},
+    {18, 0, 18, 1, 0, 0, 1},
+    {25, 0, 9, 0, 0, 0, 14},
+    {21, 0, 12, 0, 0, 0, 1},
+    {17, 0, 9, 0, 0, 0, 14},
+    {21, 0, 12, 0, 0, 0, 14},
+    {13, 0, 8, 0, 0, 0, 14},
+    {21, 0, 12, 0, 0, 0, 5},
+    {21, 0, 18, 0, 0, 0, 5},
+    {25, 0, 18, 1, 0, 0, 14},
+    {25, 0, 18, 0, 0, 0, 14},
+    {9, 0, 0, 0, 0, 1, 14},
+    {24, 0, 18, 0, 0, 0, 14},
+    {16, 0, 18, 0, 0, 0, 14},
+    {5, 0, 0, 0, 0, 1, 14},
+    {21, 0, 18, 0, 1, 0, 1},
     {22, 0, 18, 1, 1, 0, 0},
-    {18, 0, 18, 1, 1, 0, 0},
-    {7, 0, 0, 0, 1, 0, 33},
-    {6, 0, 0, 0, 1, 0, 0},
-    {7, 0, 0, 0, 1, 0, 24},
-    {26, 0, 18, 0, 0, 0, 0},
-    {26, 0, 18, 0, 1, 0, 0},
-    {25, 0, 18, 0, 1, 0, 0},
-    {1, 0, 18, 0, 5, 0, 0},
-    {7, 0, 0, 0, 5, 0, 47},
-    {14, 0, 18, 0, 5, 0, 2},
-    {15, 0, 18, 0, 5, 0, 2},
-    {26, 0, 18, 0, 5, 0, 2},
-    {7, 0, 0, 0, 5, 0, 73},
-    {7, 0, 0, 0, 5, 0, 74},
-    {7, 0, 0, 0, 5, 0, 37},
-    {15, 0, 0, 0, 5, 0, 37},
-    {7, 0, 0, 0, 5, 0, 38},
-    {14, 0, 0, 0, 5, 0, 38},
-    {7, 0, 0, 0, 5, 0, 118},
-    {12, 230, 13, 0, 5, 0, 118},
-    {7, 0, 0, 0, 5, 0, 48},
-    {21, 0, 0, 0, 5, 0, 48},
-    {7, 0, 0, 0, 5, 0, 59},
-    {21, 0, 0, 0, 5, 0, 59},
-    {14, 0, 0, 0, 5, 0, 59},
-    {9, 0, 0, 0, 5, 0, 39},
-    {5, 0, 0, 0, 5, 0, 39},
-    {7, 0, 0, 0, 5, 0, 49},
-    {7, 0, 0, 0, 5, 0, 50},
-    {13, 0, 0, 0, 5, 0, 50},
-    {7, 0, 0, 0, 5, 0, 106},
-    {7, 0, 0, 0, 5, 0, 104},
-    {21, 0, 0, 0, 5, 0, 104},
-    {7, 0, 0, 0, 5, 0, 110},
-    {7, 0, 3, 0, 5, 0, 51},
-    {7, 0, 3, 0, 5, 0, 86},
-    {21, 0, 3, 0, 5, 0, 86},
-    {15, 0, 3, 0, 5, 0, 86},
-    {7, 0, 3, 0, 5, 0, 120},
-    {26, 0, 3, 0, 5, 0, 120},
-    {15, 0, 3, 0, 5, 0, 120},
-    {7, 0, 3, 0, 5, 0, 116},
-    {15, 0, 3, 0, 5, 0, 116},
-    {7, 0, 3, 0, 5, 0, 128},
-    {15, 0, 3, 0, 5, 0, 128},
-    {7, 0, 3, 0, 5, 0, 63},
-    {15, 0, 3, 0, 5, 0, 63},
-    {21, 0, 18, 0, 5, 0, 63},
-    {7, 0, 3, 0, 5, 0, 75},
-    {21, 0, 3, 0, 5, 0, 75},
-    {7, 0, 3, 0, 5, 0, 97},
-    {7, 0, 3, 0, 5, 0, 96},
-    {15, 0, 3, 0, 5, 0, 96},
-    {7, 0, 3, 0, 5, 0, 60},
-    {12, 0, 13, 0, 5, 0, 60},
-    {12, 220, 13, 0, 5, 0, 60},
-    {12, 230, 13, 0, 5, 0, 60},
-    {12, 1, 13, 0, 5, 0, 60},
-    {12, 9, 13, 0, 5, 0, 60},
-    {15, 0, 3, 0, 5, 0, 60},
-    {21, 0, 3, 0, 5, 0, 60},
-    {7, 0, 3, 0, 5, 0, 87},
-    {15, 0, 3, 0, 5, 0, 87},
-    {21, 0, 3, 0, 5, 0, 87},
-    {7, 0, 3, 0, 5, 0, 117},
-    {15, 0, 3, 0, 5, 0, 117},
-    {7, 0, 3, 0, 5, 0, 112},
-    {26, 0, 3, 0, 5, 0, 112},
-    {12, 230, 13, 0, 5, 0, 112},
-    {12, 220, 13, 0, 5, 0, 112},
-    {15, 0, 3, 0, 5, 0, 112},
-    {21, 0, 3, 0, 5, 0, 112},
-    {7, 0, 3, 0, 5, 0, 79},
-    {21, 0, 18, 0, 5, 0, 79},
-    {7, 0, 3, 0, 5, 0, 88},
-    {15, 0, 3, 0, 5, 0, 88},
-    {7, 0, 3, 0, 5, 0, 89},
-    {15, 0, 3, 0, 5, 0, 89},
-    {7, 0, 3, 0, 5, 0, 122},
-    {21, 0, 3, 0, 5, 0, 122},
-    {15, 0, 3, 0, 5, 0, 122},
-    {7, 0, 3, 0, 5, 0, 90},
-    {9, 0, 3, 0, 5, 0, 130},
-    {5, 0, 3, 0, 5, 0, 130},
-    {15, 0, 3, 0, 5, 0, 130},
-    {15, 0, 11, 0, 5, 0, 6},
-    {10, 0, 0, 0, 5, 0, 93},
-    {12, 0, 13, 0, 5, 0, 93},
-    {7, 0, 0, 0, 5, 0, 93},
-    {12, 9, 13, 0, 5, 0, 93},
-    {21, 0, 0, 0, 5, 0, 93},
-    {15, 0, 18, 0, 5, 0, 93},
-    {13, 0, 0, 0, 5, 0, 93},
-    {12, 0, 13, 0, 5, 0, 91},
-    {10, 0, 0, 0, 5, 0, 91},
-    {7, 0, 0, 0, 5, 0, 91},
-    {12, 9, 13, 0, 5, 0, 91},
-    {12, 7, 13, 0, 5, 0, 91},
-    {21, 0, 0, 0, 5, 0, 91},
-    {1, 0, 0, 0, 5, 0, 91},
-    {7, 0, 0, 0, 5, 0, 100},
-    {13, 0, 0, 0, 5, 0, 100},
-    {12, 230, 13, 0, 5, 0, 95},
-    {7, 0, 0, 0, 5, 0, 95},
-    {12, 0, 13, 0, 5, 0, 95},
-    {10, 0, 0, 0, 5, 0, 95},
-    {12, 9, 13, 0, 5, 0, 95},
-    {13, 0, 0, 0, 5, 0, 95},
-    {21, 0, 0, 0, 5, 0, 95},
-    {7, 0, 0, 0, 5, 0, 111},
-    {12, 7, 13, 0, 5, 0, 111},
-    {21, 0, 0, 0, 5, 0, 111},
-    {12, 0, 13, 0, 5, 0, 99},
-    {10, 0, 0, 0, 5, 0, 99},
-    {7, 0, 0, 0, 5, 0, 99},
-    {10, 9, 0, 0, 5, 0, 99},
-    {21, 0, 0, 0, 5, 0, 99},
-    {12, 7, 13, 0, 5, 0, 99},
-    {13, 0, 0, 0, 5, 0, 99},
-    {15, 0, 0, 0, 5, 0, 18},
-    {7, 0, 0, 0, 5, 0, 108},
-    {10, 0, 0, 0, 5, 0, 108},
-    {12, 0, 13, 0, 5, 0, 108},
-    {10, 9, 0, 0, 5, 0, 108},
-    {12, 7, 13, 0, 5, 0, 108},
-    {21, 0, 0, 0, 5, 0, 108},
-    {7, 0, 0, 0, 5, 0, 129},
-    {21, 0, 0, 0, 5, 0, 129},
-    {7, 0, 0, 0, 5, 0, 109},
-    {12, 0, 13, 0, 5, 0, 109},
-    {10, 0, 0, 0, 5, 0, 109},
-    {12, 7, 13, 0, 5, 0, 109},
-    {12, 9, 13, 0, 5, 0, 109},
-    {13, 0, 0, 0, 5, 0, 109},
-    {12, 0, 13, 0, 5, 0, 107},
-    {10, 0, 0, 0, 5, 0, 107},
-    {7, 0, 0, 0, 5, 0, 107},
-    {12, 7, 13, 0, 5, 0, 107},
-    {10, 9, 0, 0, 5, 0, 107},
-    {12, 230, 13, 0, 5, 0, 107},
-    {7, 0, 0, 0, 5, 0, 124},
-    {10, 0, 0, 0, 5, 0, 124},
-    {12, 0, 13, 0, 5, 0, 124},
-    {12, 9, 13, 0, 5, 0, 124},
-    {12, 7, 13, 0, 5, 0, 124},
-    {21, 0, 0, 0, 5, 0, 124},
-    {13, 0, 0, 0, 5, 0, 124},
-    {7, 0, 0, 0, 5, 0, 123},
-    {10, 0, 0, 0, 5, 0, 123},
-    {12, 0, 13, 0, 5, 0, 123},
-    {12, 9, 13, 0, 5, 0, 123},
-    {12, 7, 13, 0, 5, 0, 123},
-    {21, 0, 0, 0, 5, 0, 123},
-    {7, 0, 0, 0, 5, 0, 114},
-    {10, 0, 0, 0, 5, 0, 114},
-    {12, 0, 13, 0, 5, 0, 114},
-    {12, 9, 13, 0, 5, 0, 114},
-    {21, 0, 0, 0, 5, 0, 114},
-    {13, 0, 0, 0, 5, 0, 114},
-    {7, 0, 0, 0, 5, 0, 101},
-    {12, 0, 13, 0, 5, 0, 101},
-    {10, 0, 0, 0, 5, 0, 101},
-    {10, 9, 0, 0, 5, 0, 101},
-    {12, 7, 13, 0, 5, 0, 101},
-    {13, 0, 0, 0, 5, 0, 101},
-    {7, 0, 0, 0, 5, 0, 126},
-    {12, 0, 13, 0, 5, 0, 126},
-    {10, 0, 0, 0, 5, 0, 126},
-    {12, 9, 13, 0, 5, 0, 126},
-    {13, 0, 0, 0, 5, 0, 126},
-    {15, 0, 0, 0, 5, 0, 126},
-    {21, 0, 0, 0, 5, 0, 126},
-    {26, 0, 0, 0, 5, 0, 126},
-    {9, 0, 0, 0, 5, 0, 125},
-    {5, 0, 0, 0, 5, 0, 125},
-    {13, 0, 0, 0, 5, 0, 125},
-    {15, 0, 0, 0, 5, 0, 125},
-    {7, 0, 0, 0, 5, 0, 125},
-    {7, 0, 0, 0, 5, 0, 121},
-    {7, 0, 0, 0, 5, 0, 62},
-    {14, 0, 0, 0, 5, 0, 62},
-    {21, 0, 0, 0, 5, 0, 62},
-    {7, 0, 0, 0, 5, 0, 80},
-    {7, 0, 0, 0, 5, 0, 127},
-    {7, 0, 0, 0, 5, 0, 115},
-    {13, 0, 0, 0, 5, 0, 115},
-    {21, 0, 0, 0, 5, 0, 115},
-    {7, 0, 0, 0, 5, 0, 103},
-    {12, 1, 13, 0, 5, 0, 103},
-    {21, 0, 0, 0, 5, 0, 103},
-    {7, 0, 0, 0, 5, 0, 119},
-    {12, 230, 13, 0, 5, 0, 119},
-    {21, 0, 0, 0, 5, 0, 119},
-    {26, 0, 0, 0, 5, 0, 119},
-    {6, 0, 0, 0, 5, 0, 119},
-    {13, 0, 0, 0, 5, 0, 119},
-    {15, 0, 0, 0, 5, 0, 119},
-    {7, 0, 0, 0, 5, 0, 98},
-    {10, 0, 0, 0, 5, 0, 98},
-    {12, 0, 13, 0, 5, 0, 98},
-    {6, 0, 0, 0, 5, 0, 98},
-    {7, 0, 0, 0, 5, 0, 105},
-    {26, 0, 0, 0, 5, 0, 105},
-    {12, 0, 13, 0, 5, 0, 105},
-    {12, 1, 13, 0, 5, 0, 105},
-    {21, 0, 0, 0, 5, 0, 105},
-    {10, 216, 0, 0, 5, 0, 0},
-    {10, 226, 0, 0, 5, 0, 0},
-    {12, 230, 13, 0, 5, 0, 2},
-    {25, 0, 0, 0, 5, 0, 0},
-    {13, 0, 8, 0, 5, 0, 0},
-    {26, 0, 0, 0, 5, 0, 131},
-    {12, 0, 13, 0, 5, 0, 131},
-    {21, 0, 0, 0, 5, 0, 131},
-    {7, 0, 3, 0, 5, 0, 113},
-    {15, 0, 3, 0, 5, 0, 113},
-    {12, 220, 13, 0, 5, 0, 113},
-    {26, 0, 0, 0, 2, 0, 32},
+    {18, 0, 18, 1, 1, 0, 1},
+    {21, 0, 18, 0, 1, 0, 5},
+    {7, 0, 0, 0, 1, 33, 14},
+    {7, 0, 0, 0, 1, 33, 32},
+    {6, 0, 0, 0, 1, 0, 32},
+    {6, 0, 0, 0, 1, 0, 5},
+    {7, 0, 0, 0, 1, 24, 14},
+    {23, 0, 10, 0, 0, 0, 10},
+    {26, 0, 18, 0, 0, 0, 14},
+    {26, 0, 18, 0, 1, 0, 12},
+    {25, 0, 18, 0, 1, 0, 12},
+    {1, 0, 18, 0, 5, 0, 21},
+    {26, 0, 18, 0, 5, 0, 31},
+    {7, 0, 0, 0, 5, 47, 12},
+    {14, 0, 18, 0, 5, 2, 12},
+    {15, 0, 18, 0, 5, 2, 12},
+    {26, 0, 18, 0, 5, 2, 12},
+    {26, 0, 0, 0, 5, 2, 12},
+    {7, 0, 0, 0, 5, 73, 12},
+    {7, 0, 0, 0, 5, 74, 12},
+    {7, 0, 0, 0, 5, 37, 12},
+    {15, 0, 0, 0, 5, 37, 12},
+    {7, 0, 0, 0, 5, 38, 12},
+    {14, 0, 0, 0, 5, 38, 12},
+    {7, 0, 0, 0, 5, 118, 12},
+    {12, 230, 13, 0, 5, 118, 21},
+    {7, 0, 0, 0, 5, 48, 12},
+    {21, 0, 0, 0, 5, 48, 17},
+    {7, 0, 0, 0, 5, 59, 12},
+    {21, 0, 0, 0, 5, 59, 17},
+    {14, 0, 0, 0, 5, 59, 12},
+    {9, 0, 0, 0, 5, 39, 12},
+    {5, 0, 0, 0, 5, 39, 12},
+    {7, 0, 0, 0, 5, 49, 12},
+    {7, 0, 0, 0, 5, 50, 12},
+    {13, 0, 0, 0, 5, 50, 11},
+    {9, 0, 0, 0, 5, 136, 12},
+    {5, 0, 0, 0, 5, 136, 12},
+    {7, 0, 0, 0, 5, 106, 12},
+    {7, 0, 0, 0, 5, 104, 12},
+    {21, 0, 0, 0, 5, 104, 12},
+    {7, 0, 0, 0, 5, 110, 12},
+    {7, 0, 3, 0, 5, 51, 12},
+    {7, 0, 3, 0, 5, 86, 12},
+    {21, 0, 3, 0, 5, 86, 17},
+    {15, 0, 3, 0, 5, 86, 12},
+    {7, 0, 3, 0, 5, 120, 12},
+    {26, 0, 3, 0, 5, 120, 12},
+    {15, 0, 3, 0, 5, 120, 12},
+    {7, 0, 3, 0, 5, 116, 12},
+    {15, 0, 3, 0, 5, 116, 12},
+    {7, 0, 3, 0, 5, 128, 12},
+    {15, 0, 3, 0, 5, 128, 12},
+    {7, 0, 3, 0, 5, 63, 12},
+    {15, 0, 3, 0, 5, 63, 12},
+    {21, 0, 18, 0, 5, 63, 17},
+    {7, 0, 3, 0, 5, 75, 12},
+    {21, 0, 3, 0, 5, 75, 12},
+    {7, 0, 3, 0, 5, 97, 12},
+    {7, 0, 3, 0, 5, 96, 12},
+    {15, 0, 3, 0, 5, 96, 12},
+    {7, 0, 3, 0, 5, 60, 12},
+    {12, 0, 13, 0, 5, 60, 21},
+    {12, 220, 13, 0, 5, 60, 21},
+    {12, 230, 13, 0, 5, 60, 21},
+    {12, 1, 13, 0, 5, 60, 21},
+    {12, 9, 13, 0, 5, 60, 21},
+    {15, 0, 3, 0, 5, 60, 12},
+    {21, 0, 3, 0, 5, 60, 17},
+    {21, 0, 3, 0, 5, 60, 12},
+    {7, 0, 3, 0, 5, 87, 12},
+    {15, 0, 3, 0, 5, 87, 12},
+    {21, 0, 3, 0, 5, 87, 12},
+    {7, 0, 3, 0, 5, 117, 12},
+    {15, 0, 3, 0, 5, 117, 12},
+    {7, 0, 3, 0, 5, 112, 12},
+    {26, 0, 3, 0, 5, 112, 12},
+    {12, 230, 13, 0, 5, 112, 21},
+    {12, 220, 13, 0, 5, 112, 21},
+    {15, 0, 3, 0, 5, 112, 12},
+    {21, 0, 3, 0, 5, 112, 17},
+    {21, 0, 3, 0, 5, 112, 15},
+    {7, 0, 3, 0, 5, 79, 12},
+    {21, 0, 18, 0, 5, 79, 17},
+    {7, 0, 3, 0, 5, 88, 12},
+    {15, 0, 3, 0, 5, 88, 12},
+    {7, 0, 3, 0, 5, 89, 12},
+    {15, 0, 3, 0, 5, 89, 12},
+    {7, 0, 3, 0, 5, 122, 12},
+    {21, 0, 3, 0, 5, 122, 12},
+    {15, 0, 3, 0, 5, 122, 12},
+    {7, 0, 3, 0, 5, 90, 12},
+    {9, 0, 3, 0, 5, 130, 12},
+    {5, 0, 3, 0, 5, 130, 12},
+    {15, 0, 3, 0, 5, 130, 12},
+    {15, 0, 11, 0, 5, 6, 12},
+    {10, 0, 0, 0, 5, 93, 21},
+    {12, 0, 13, 0, 5, 93, 21},
+    {7, 0, 0, 0, 5, 93, 12},
+    {12, 9, 13, 0, 5, 93, 21},
+    {21, 0, 0, 0, 5, 93, 17},
+    {21, 0, 0, 0, 5, 93, 12},
+    {15, 0, 18, 0, 5, 93, 12},
+    {13, 0, 0, 0, 5, 93, 11},
+    {12, 0, 13, 0, 5, 91, 21},
+    {10, 0, 0, 0, 5, 91, 21},
+    {7, 0, 0, 0, 5, 91, 12},
+    {12, 9, 13, 0, 5, 91, 21},
+    {12, 7, 13, 0, 5, 91, 21},
+    {21, 0, 0, 0, 5, 91, 12},
+    {1, 0, 0, 0, 5, 91, 12},
+    {21, 0, 0, 0, 5, 91, 17},
+    {7, 0, 0, 0, 5, 100, 12},
+    {13, 0, 0, 0, 5, 100, 11},
+    {12, 230, 13, 0, 5, 95, 21},
+    {7, 0, 0, 0, 5, 95, 12},
+    {12, 0, 13, 0, 5, 95, 21},
+    {10, 0, 0, 0, 5, 95, 21},
+    {12, 9, 13, 0, 5, 95, 21},
+    {13, 0, 0, 0, 5, 95, 11},
+    {21, 0, 0, 0, 5, 95, 17},
+    {7, 0, 0, 0, 5, 111, 12},
+    {12, 7, 13, 0, 5, 111, 21},
+    {21, 0, 0, 0, 5, 111, 12},
+    {21, 0, 0, 0, 5, 111, 18},
+    {12, 0, 13, 0, 5, 99, 21},
+    {10, 0, 0, 0, 5, 99, 21},
+    {7, 0, 0, 0, 5, 99, 12},
+    {10, 9, 0, 0, 5, 99, 21},
+    {21, 0, 0, 0, 5, 99, 17},
+    {21, 0, 0, 0, 5, 99, 12},
+    {12, 7, 13, 0, 5, 99, 21},
+    {13, 0, 0, 0, 5, 99, 11},
+    {21, 0, 0, 0, 5, 99, 18},
+    {15, 0, 0, 0, 5, 18, 12},
+    {7, 0, 0, 0, 5, 108, 12},
+    {10, 0, 0, 0, 5, 108, 21},
+    {12, 0, 13, 0, 5, 108, 21},
+    {10, 9, 0, 0, 5, 108, 21},
+    {12, 7, 13, 0, 5, 108, 21},
+    {21, 0, 0, 0, 5, 108, 17},
+    {21, 0, 0, 0, 5, 108, 12},
+    {7, 0, 0, 0, 5, 129, 12},
+    {21, 0, 0, 0, 5, 129, 17},
+    {7, 0, 0, 0, 5, 109, 12},
+    {12, 0, 13, 0, 5, 109, 21},
+    {10, 0, 0, 0, 5, 109, 21},
+    {12, 7, 13, 0, 5, 109, 21},
+    {12, 9, 13, 0, 5, 109, 21},
+    {13, 0, 0, 0, 5, 109, 11},
+    {12, 0, 13, 0, 5, 107, 21},
+    {10, 0, 0, 0, 5, 107, 21},
+    {7, 0, 0, 0, 5, 107, 12},
+    {12, 7, 13, 0, 5, 107, 21},
+    {10, 9, 0, 0, 5, 107, 21},
+    {12, 230, 13, 0, 5, 107, 21},
+    {7, 0, 0, 0, 5, 135, 12},
+    {10, 0, 0, 0, 5, 135, 21},
+    {12, 0, 13, 0, 5, 135, 21},
+    {12, 9, 13, 0, 5, 135, 21},
+    {12, 7, 13, 0, 5, 135, 21},
+    {21, 0, 0, 0, 5, 135, 17},
+    {21, 0, 0, 0, 5, 135, 12},
+    {13, 0, 0, 0, 5, 135, 11},
+    {7, 0, 0, 0, 5, 124, 12},
+    {10, 0, 0, 0, 5, 124, 21},
+    {12, 0, 13, 0, 5, 124, 21},
+    {12, 9, 13, 0, 5, 124, 21},
+    {12, 7, 13, 0, 5, 124, 21},
+    {21, 0, 0, 0, 5, 124, 12},
+    {13, 0, 0, 0, 5, 124, 11},
+    {7, 0, 0, 0, 5, 123, 12},
+    {10, 0, 0, 0, 5, 123, 21},
+    {12, 0, 13, 0, 5, 123, 21},
+    {12, 9, 13, 0, 5, 123, 21},
+    {12, 7, 13, 0, 5, 123, 21},
+    {21, 0, 0, 0, 5, 123, 18},
+    {21, 0, 0, 0, 5, 123, 17},
+    {21, 0, 0, 0, 5, 123, 6},
+    {21, 0, 0, 0, 5, 123, 12},
+    {7, 0, 0, 0, 5, 114, 12},
+    {10, 0, 0, 0, 5, 114, 21},
+    {12, 0, 13, 0, 5, 114, 21},
+    {12, 9, 13, 0, 5, 114, 21},
+    {21, 0, 0, 0, 5, 114, 17},
+    {21, 0, 0, 0, 5, 114, 12},
+    {13, 0, 0, 0, 5, 114, 11},
+    {21, 0, 18, 0, 5, 31, 18},
+    {7, 0, 0, 0, 5, 101, 12},
+    {12, 0, 13, 0, 5, 101, 21},
+    {10, 0, 0, 0, 5, 101, 21},
+    {10, 9, 0, 0, 5, 101, 21},
+    {12, 7, 13, 0, 5, 101, 21},
+    {13, 0, 0, 0, 5, 101, 11},
+    {7, 0, 0, 0, 5, 126, 38},
+    {12, 0, 13, 0, 5, 126, 38},
+    {10, 0, 0, 0, 5, 126, 38},
+    {12, 9, 13, 0, 5, 126, 38},
+    {13, 0, 0, 0, 5, 126, 11},
+    {15, 0, 0, 0, 5, 126, 38},
+    {21, 0, 0, 0, 5, 126, 17},
+    {26, 0, 0, 0, 5, 126, 38},
+    {9, 0, 0, 0, 5, 125, 12},
+    {5, 0, 0, 0, 5, 125, 12},
+    {13, 0, 0, 0, 5, 125, 11},
+    {15, 0, 0, 0, 5, 125, 12},
+    {7, 0, 0, 0, 5, 125, 12},
+    {7, 0, 0, 0, 5, 121, 12},
+    {7, 0, 0, 0, 5, 133, 12},
+    {10, 0, 0, 0, 5, 133, 21},
+    {12, 0, 13, 0, 5, 133, 21},
+    {12, 9, 0, 0, 5, 133, 21},
+    {21, 0, 0, 0, 5, 133, 17},
+    {13, 0, 0, 0, 5, 133, 11},
+    {15, 0, 0, 0, 5, 133, 12},
+    {21, 0, 0, 0, 5, 134, 18},
+    {21, 0, 0, 0, 5, 134, 6},
+    {7, 0, 0, 0, 5, 134, 12},
+    {12, 0, 13, 0, 5, 134, 21},
+    {10, 0, 0, 0, 5, 134, 21},
+    {7, 0, 0, 0, 5, 62, 12},
+    {14, 0, 0, 0, 5, 62, 12},
+    {21, 0, 0, 0, 5, 62, 17},
+    {7, 0, 0, 0, 5, 80, 12},
+    {7, 0, 0, 0, 5, 80, 0},
+    {7, 0, 0, 0, 5, 80, 1},
+    {7, 0, 0, 0, 5, 127, 12},
+    {7, 0, 0, 0, 5, 127, 0},
+    {7, 0, 0, 0, 5, 127, 1},
+    {7, 0, 0, 0, 5, 115, 12},
+    {13, 0, 0, 0, 5, 115, 11},
+    {21, 0, 0, 0, 5, 115, 17},
+    {7, 0, 0, 0, 5, 103, 12},
+    {12, 1, 13, 0, 5, 103, 21},
+    {21, 0, 0, 0, 5, 103, 17},
+    {7, 0, 0, 0, 5, 119, 12},
+    {12, 230, 13, 0, 5, 119, 21},
+    {21, 0, 0, 0, 5, 119, 17},
+    {21, 0, 0, 0, 5, 119, 12},
+    {26, 0, 0, 0, 5, 119, 12},
+    {6, 0, 0, 0, 5, 119, 12},
+    {13, 0, 0, 0, 5, 119, 11},
+    {15, 0, 0, 0, 5, 119, 12},
+    {7, 0, 0, 0, 5, 98, 12},
+    {10, 0, 0, 0, 5, 98, 21},
+    {12, 0, 13, 0, 5, 98, 21},
+    {6, 0, 0, 0, 5, 98, 12},
+    {6, 0, 0, 0, 2, 137, 5},
+    {7, 0, 0, 0, 2, 137, 14},
+    {7, 0, 0, 0, 5, 105, 12},
+    {26, 0, 0, 0, 5, 105, 12},
+    {12, 0, 13, 0, 5, 105, 21},
+    {12, 1, 13, 0, 5, 105, 21},
+    {21, 0, 0, 0, 5, 105, 17},
+    {10, 216, 0, 0, 5, 0, 21},
+    {10, 226, 0, 0, 5, 0, 21},
+    {12, 230, 13, 0, 5, 2, 21},
+    {25, 0, 0, 0, 5, 0, 12},
+    {13, 0, 8, 0, 5, 0, 11},
+    {26, 0, 0, 0, 5, 131, 12},
+    {12, 0, 13, 0, 5, 131, 21},
+    {21, 0, 0, 0, 5, 131, 17},
+    {21, 0, 0, 0, 5, 131, 12},
+    {12, 230, 13, 0, 5, 56, 21},
+    {7, 0, 3, 0, 5, 113, 12},
+    {15, 0, 3, 0, 5, 113, 12},
+    {12, 220, 13, 0, 5, 113, 21},
+    {9, 0, 3, 0, 5, 132, 12},
+    {5, 0, 3, 0, 5, 132, 12},
+    {12, 230, 13, 0, 5, 132, 21},
+    {12, 7, 13, 0, 5, 132, 21},
+    {13, 0, 3, 0, 5, 132, 11},
+    {21, 0, 3, 0, 5, 132, 0},
+    {2, 0, 18, 0, 5, 102, 14},
+    {26, 0, 0, 0, 2, 0, 29},
+    {26, 0, 0, 0, 5, 0, 28},
+    {26, 0, 0, 0, 2, 32, 14},
+    {24, 0, 18, 0, 2, 0, 41},
+    {26, 0, 18, 0, 5, 0, 5},
 };
 
 #define BIDI_MIRROR_LEN 364
@@ -1186,6 +1364,130 @@
     {65379, 65378},
 };
 
+#define BIDI_BRACKET_LEN 120
+static const BracketPair bracket_pairs[] = {
+    {40, 41, 0},
+    {41, 40, 1},
+    {91, 93, 0},
+    {93, 91, 1},
+    {123, 125, 0},
+    {125, 123, 1},
+    {3898, 3899, 0},
+    {3899, 3898, 1},
+    {3900, 3901, 0},
+    {3901, 3900, 1},
+    {5787, 5788, 0},
+    {5788, 5787, 1},
+    {8261, 8262, 0},
+    {8262, 8261, 1},
+    {8317, 8318, 0},
+    {8318, 8317, 1},
+    {8333, 8334, 0},
+    {8334, 8333, 1},
+    {8968, 8969, 0},
+    {8969, 8968, 1},
+    {8970, 8971, 0},
+    {8971, 8970, 1},
+    {9001, 9002, 0},
+    {9002, 9001, 1},
+    {10088, 10089, 0},
+    {10089, 10088, 1},
+    {10090, 10091, 0},
+    {10091, 10090, 1},
+    {10092, 10093, 0},
+    {10093, 10092, 1},
+    {10094, 10095, 0},
+    {10095, 10094, 1},
+    {10096, 10097, 0},
+    {10097, 10096, 1},
+    {10098, 10099, 0},
+    {10099, 10098, 1},
+    {10100, 10101, 0},
+    {10101, 10100, 1},
+    {10181, 10182, 0},
+    {10182, 10181, 1},
+    {10214, 10215, 0},
+    {10215, 10214, 1},
+    {10216, 10217, 0},
+    {10217, 10216, 1},
+    {10218, 10219, 0},
+    {10219, 10218, 1},
+    {10220, 10221, 0},
+    {10221, 10220, 1},
+    {10222, 10223, 0},
+    {10223, 10222, 1},
+    {10627, 10628, 0},
+    {10628, 10627, 1},
+    {10629, 10630, 0},
+    {10630, 10629, 1},
+    {10631, 10632, 0},
+    {10632, 10631, 1},
+    {10633, 10634, 0},
+    {10634, 10633, 1},
+    {10635, 10636, 0},
+    {10636, 10635, 1},
+    {10637, 10640, 0},
+    {10638, 10639, 1},
+    {10639, 10638, 0},
+    {10640, 10637, 1},
+    {10641, 10642, 0},
+    {10642, 10641, 1},
+    {10643, 10644, 0},
+    {10644, 10643, 1},
+    {10645, 10646, 0},
+    {10646, 10645, 1},
+    {10647, 10648, 0},
+    {10648, 10647, 1},
+    {10712, 10713, 0},
+    {10713, 10712, 1},
+    {10714, 10715, 0},
+    {10715, 10714, 1},
+    {10748, 10749, 0},
+    {10749, 10748, 1},
+    {11810, 11811, 0},
+    {11811, 11810, 1},
+    {11812, 11813, 0},
+    {11813, 11812, 1},
+    {11814, 11815, 0},
+    {11815, 11814, 1},
+    {11816, 11817, 0},
+    {11817, 11816, 1},
+    {12296, 12297, 0},
+    {12297, 12296, 1},
+    {12298, 12299, 0},
+    {12299, 12298, 1},
+    {12300, 12301, 0},
+    {12301, 12300, 1},
+    {12302, 12303, 0},
+    {12303, 12302, 1},
+    {12304, 12305, 0},
+    {12305, 12304, 1},
+    {12308, 12309, 0},
+    {12309, 12308, 1},
+    {12310, 12311, 0},
+    {12311, 12310, 1},
+    {12312, 12313, 0},
+    {12313, 12312, 1},
+    {12314, 12315, 0},
+    {12315, 12314, 1},
+    {65113, 65114, 0},
+    {65114, 65113, 1},
+    {65115, 65116, 0},
+    {65116, 65115, 1},
+    {65117, 65118, 0},
+    {65118, 65117, 1},
+    {65288, 65289, 0},
+    {65289, 65288, 1},
+    {65339, 65341, 0},
+    {65341, 65339, 1},
+    {65371, 65373, 0},
+    {65373, 65371, 1},
+    {65375, 65376, 0},
+    {65376, 65375, 1},
+    {65378, 65379, 0},
+    {65379, 65378, 1},
+};
+
 /* Reindexing of NFC first characters. */
 #define TOTAL_FIRST 376
 #define TOTAL_LAST 62
@@ -1585,6 +1887,12 @@
 #define UCDN_SCRIPT_MULTANI 129
 #define UCDN_SCRIPT_OLD_HUNGARIAN 130
 #define UCDN_SCRIPT_SIGNWRITING 131
+#define UCDN_SCRIPT_ADLAM 132
+#define UCDN_SCRIPT_BHAIKSUKI 133
+#define UCDN_SCRIPT_MARCHEN 134
+#define UCDN_SCRIPT_NEWA 135
+#define UCDN_SCRIPT_OSAGE 136
+#define UCDN_SCRIPT_TANGUT 137
 
 #define UCDN_GENERAL_CATEGORY_CC 0
 #define UCDN_GENERAL_CATEGORY_CF 1
@@ -1654,27 +1962,27 @@
     52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
     52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
     52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 54, 55, 56, 56, 56, 57,
-    58, 59, 60, 61, 62, 63, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
-    65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
-    65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 67, 67, 67,
-    67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 52, 69, 70, 71, 72, 73,
-    74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 88, 90,
-    91, 92, 93, 94, 95, 96, 97, 98, 88, 99, 88, 88, 88, 88, 88, 100, 100,
-    100, 101, 102, 103, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 104, 104,
-    104, 104, 105, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 106, 106, 107, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 108, 108, 109, 110, 88, 88, 88, 111, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 112, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 113, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 114,
-    115, 116, 117, 118, 119, 120, 121, 122, 122, 123, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 124, 88, 88, 88, 88, 88, 125, 88, 126, 127,
-    128, 129, 130, 131, 132, 133, 134, 135, 88, 88, 88, 88, 88, 88, 52, 52,
-    52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
+    58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 65, 66, 67, 68,
+    69, 70, 71, 65, 66, 67, 68, 69, 70, 71, 65, 66, 67, 68, 69, 70, 71, 65,
+    66, 67, 68, 69, 70, 71, 65, 66, 67, 68, 69, 70, 71, 65, 72, 73, 73, 73,
+    73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 52, 75, 76, 77, 78, 79,
+    80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 94, 96,
+    97, 98, 99, 100, 101, 102, 103, 104, 94, 105, 94, 106, 94, 94, 94, 107,
+    107, 107, 108, 109, 110, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 111,
+    111, 112, 113, 114, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 115, 116, 117, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 118, 118, 119, 120, 94, 94, 94, 121, 122, 122, 122, 122, 122,
+    122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+    122, 122, 122, 122, 123, 122, 122, 124, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 125, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 126, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 127, 128, 129, 130, 131, 132, 133, 134, 135,
+    135, 136, 94, 94, 94, 94, 94, 137, 94, 94, 94, 94, 94, 94, 94, 138, 139,
+    94, 94, 94, 94, 140, 94, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+    150, 151, 151, 151, 151, 151, 152, 52, 52, 52, 52, 52, 52, 52, 52, 52,
     52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
     52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
     52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
@@ -1683,215 +1991,216 @@
     52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
     52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
     52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
-    52, 52, 136, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
-    52, 137, 138, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
-    52, 52, 52, 52, 52, 52, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 52, 52, 141, 140, 140, 140, 140, 142, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-    142, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 143, 144, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
-    88, 88, 88, 88, 88, 88, 88, 88, 88, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 145, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 145,
+    52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 153, 52, 52, 52, 52,
+    52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 154, 155, 52, 52, 52, 52,
+    52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 156,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 52, 52,
+    158, 157, 157, 157, 157, 159, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+    157, 157, 157, 157, 157, 157, 157, 157, 157, 159, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 160, 161,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+    94, 94, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 162, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+    74, 74, 74, 74, 74, 74, 74, 74, 74, 162,
 };
 
 static const unsigned short index1[] = {
@@ -1912,992 +2221,1135 @@
     146, 147, 148, 149, 128, 128, 128, 128, 128, 128, 150, 150, 150, 150,
     151, 152, 153, 120, 154, 155, 156, 156, 156, 157, 158, 159, 160, 160,
     161, 162, 163, 164, 165, 166, 167, 167, 167, 168, 120, 120, 120, 120,
-    120, 120, 120, 120, 128, 128, 169, 120, 120, 120, 120, 120, 170, 171,
-    172, 173, 174, 175, 175, 175, 175, 175, 175, 176, 177, 178, 179, 175,
-    180, 181, 182, 175, 183, 184, 185, 186, 186, 187, 188, 189, 190, 191,
-    192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 201, 202, 203, 204,
-    205, 206, 207, 208, 209, 210, 211, 120, 212, 213, 214, 215, 215, 216,
-    217, 218, 219, 220, 221, 120, 222, 223, 224, 225, 226, 227, 228, 229,
-    229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 120, 240, 241,
-    242, 243, 244, 241, 245, 246, 247, 248, 249, 120, 250, 251, 252, 253,
-    254, 255, 256, 257, 257, 256, 257, 258, 259, 260, 261, 262, 263, 264,
-    120, 265, 266, 267, 268, 269, 269, 268, 270, 271, 272, 273, 274, 275,
-    276, 277, 278, 120, 279, 280, 281, 282, 282, 282, 282, 283, 284, 285,
-    286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 293, 293, 296, 297,
-    294, 298, 299, 300, 301, 302, 303, 120, 304, 305, 305, 305, 305, 305,
-    306, 307, 308, 309, 310, 311, 120, 120, 120, 120, 312, 313, 314, 315,
-    316, 317, 318, 319, 320, 321, 322, 323, 120, 120, 120, 120, 324, 325,
-    326, 327, 328, 329, 330, 331, 332, 333, 332, 332, 332, 334, 335, 336,
-    337, 338, 339, 340, 339, 339, 339, 341, 342, 343, 344, 345, 120, 120,
-    120, 120, 346, 346, 346, 346, 346, 347, 348, 349, 350, 351, 352, 353,
-    354, 355, 356, 346, 357, 358, 350, 359, 360, 360, 360, 360, 361, 362,
-    363, 363, 363, 363, 363, 364, 365, 365, 365, 365, 365, 365, 365, 365,
-    365, 365, 365, 365, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366,
-    366, 366, 366, 366, 366, 366, 366, 366, 366, 366, 367, 367, 367, 367,
-    367, 367, 367, 367, 367, 368, 369, 368, 367, 367, 367, 367, 367, 368,
-    367, 367, 367, 367, 368, 369, 368, 367, 369, 367, 367, 367, 367, 367,
-    367, 367, 368, 367, 367, 367, 367, 367, 367, 367, 367, 370, 371, 372,
-    373, 374, 367, 367, 375, 376, 377, 377, 377, 377, 377, 377, 377, 377,
-    377, 377, 378, 379, 380, 381, 381, 381, 381, 381, 381, 381, 381, 381,
-    381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381,
-    381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381,
-    381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381,
-    381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381,
-    381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 382, 381, 381,
-    383, 384, 384, 385, 386, 386, 386, 386, 386, 386, 386, 386, 386, 387,
-    388, 389, 390, 391, 392, 120, 393, 393, 394, 120, 395, 395, 396, 120,
-    397, 398, 399, 120, 400, 400, 400, 400, 400, 400, 401, 402, 403, 404,
-    405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 415, 415, 415,
-    416, 415, 415, 415, 415, 415, 415, 120, 415, 415, 415, 415, 415, 417,
-    381, 381, 381, 381, 381, 381, 381, 381, 418, 120, 419, 419, 419, 420,
-    421, 422, 423, 424, 425, 426, 427, 427, 427, 428, 429, 120, 430, 430,
-    430, 430, 430, 431, 430, 430, 430, 432, 433, 434, 435, 435, 435, 435,
-    436, 436, 437, 438, 439, 439, 439, 439, 439, 439, 440, 441, 442, 443,
-    444, 445, 446, 447, 446, 447, 448, 449, 450, 451, 120, 120, 120, 120,
-    120, 120, 120, 120, 452, 453, 453, 453, 453, 453, 454, 455, 456, 457,
-    458, 459, 460, 461, 462, 463, 464, 465, 465, 465, 466, 467, 468, 469,
-    470, 470, 470, 470, 471, 472, 473, 474, 475, 475, 475, 475, 476, 477,
-    478, 479, 480, 481, 482, 483, 484, 484, 484, 485, 120, 120, 120, 120,
-    120, 120, 120, 120, 486, 120, 487, 488, 489, 490, 491, 492, 54, 54, 54,
-    54, 493, 494, 56, 56, 56, 56, 56, 495, 496, 497, 54, 498, 54, 54, 54,
-    499, 56, 56, 56, 500, 501, 502, 503, 504, 504, 504, 505, 506, 27, 27, 27,
-    27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 507, 508, 27,
-    27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 509, 510, 511, 512, 509, 510,
-    509, 510, 511, 512, 509, 513, 509, 510, 509, 511, 509, 514, 509, 514,
-    509, 514, 515, 516, 517, 518, 519, 520, 509, 521, 522, 523, 524, 525,
-    526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539,
-    540, 541, 56, 542, 543, 544, 543, 545, 120, 120, 546, 547, 548, 549, 550,
-    120, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563,
-    564, 563, 565, 566, 567, 568, 569, 570, 571, 572, 573, 572, 574, 575,
-    572, 576, 572, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587,
-    588, 589, 590, 591, 592, 587, 587, 593, 594, 595, 596, 597, 587, 587,
-    598, 578, 599, 600, 587, 587, 601, 587, 587, 572, 602, 603, 572, 604,
-    605, 606, 607, 607, 607, 607, 607, 607, 607, 607, 608, 572, 572, 609,
-    610, 578, 578, 611, 572, 572, 572, 572, 577, 612, 572, 572, 613, 572,
-    572, 572, 572, 614, 120, 120, 120, 572, 613, 120, 120, 615, 615, 615,
-    615, 615, 616, 616, 617, 618, 618, 618, 618, 618, 618, 618, 618, 618,
-    619, 615, 615, 620, 620, 620, 620, 620, 620, 620, 620, 620, 621, 620,
-    620, 620, 620, 621, 572, 620, 620, 622, 572, 623, 573, 624, 625, 626,
-    627, 573, 572, 622, 576, 572, 578, 628, 629, 625, 630, 572, 572, 572,
-    572, 631, 572, 572, 572, 632, 633, 572, 572, 572, 572, 572, 634, 572,
-    635, 572, 634, 636, 637, 620, 620, 638, 620, 620, 620, 572, 572, 572,
-    572, 572, 572, 572, 639, 572, 572, 576, 572, 572, 640, 641, 615, 642,
-    642, 643, 572, 572, 572, 572, 572, 644, 645, 646, 647, 648, 649, 578,
-    578, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650,
-    650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650,
-    650, 650, 650, 650, 650, 578, 578, 578, 578, 578, 578, 578, 578, 578,
-    578, 578, 578, 578, 578, 578, 578, 651, 652, 652, 653, 587, 587, 578,
-    654, 601, 655, 656, 657, 658, 659, 660, 661, 578, 662, 587, 663, 664,
-    665, 666, 647, 578, 578, 590, 654, 666, 667, 668, 669, 587, 587, 587,
-    587, 670, 671, 587, 587, 587, 587, 672, 673, 674, 647, 675, 676, 572,
-    572, 572, 572, 572, 572, 578, 578, 677, 678, 679, 573, 572, 572, 680,
-    572, 572, 572, 681, 572, 572, 572, 572, 682, 572, 683, 684, 120, 120,
-    685, 120, 120, 686, 686, 686, 686, 686, 687, 688, 688, 688, 688, 688,
-    689, 690, 691, 692, 693, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
-    694, 695, 696, 697, 698, 698, 698, 698, 699, 700, 701, 701, 701, 701,
-    701, 701, 701, 702, 703, 704, 367, 367, 369, 120, 369, 369, 369, 369,
-    369, 369, 369, 369, 705, 705, 705, 705, 706, 707, 708, 709, 710, 711,
-    533, 712, 713, 120, 120, 120, 120, 120, 120, 120, 714, 714, 714, 715,
-    714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 716, 120, 714, 714,
-    714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714,
-    714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 717, 120, 120, 120,
-    718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 729, 729,
-    729, 729, 729, 729, 729, 729, 730, 731, 732, 733, 733, 733, 733, 733,
-    733, 733, 733, 733, 733, 734, 735, 736, 736, 736, 736, 737, 738, 365,
-    365, 365, 365, 365, 365, 365, 365, 365, 365, 739, 740, 741, 736, 736,
-    736, 742, 718, 718, 718, 718, 719, 120, 733, 733, 743, 743, 743, 744,
-    745, 746, 741, 741, 741, 747, 748, 749, 743, 743, 743, 750, 745, 746,
-    741, 741, 741, 741, 751, 749, 741, 752, 753, 753, 753, 753, 753, 754,
-    753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 741, 741, 741,
-    755, 756, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 757,
-    741, 741, 741, 755, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758,
-    758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758,
-    758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758,
-    758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758,
-    758, 758, 759, 760, 572, 572, 572, 572, 572, 572, 572, 572, 758, 758,
-    758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758,
-    758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 759, 760, 760, 760,
-    760, 760, 761, 761, 762, 761, 761, 761, 761, 761, 761, 761, 761, 761,
-    761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761,
-    761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761,
-    761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761,
-    761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761,
-    761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 763,
-    764, 764, 764, 764, 764, 764, 765, 120, 766, 766, 766, 766, 766, 767,
-    768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
-    768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
-    768, 768, 768, 768, 768, 769, 768, 768, 770, 771, 120, 120, 101, 101,
-    101, 101, 101, 772, 773, 774, 101, 101, 101, 775, 776, 776, 776, 776,
-    776, 776, 776, 776, 777, 778, 779, 120, 64, 64, 780, 781, 782, 27, 783,
-    27, 27, 27, 27, 27, 27, 27, 784, 785, 27, 786, 787, 27, 27, 788, 789,
-    120, 120, 120, 120, 120, 120, 120, 790, 791, 792, 793, 794, 794, 795,
-    796, 797, 798, 799, 799, 799, 799, 799, 799, 800, 120, 801, 802, 802,
-    802, 802, 802, 803, 804, 805, 806, 807, 808, 809, 809, 810, 811, 812,
-    813, 814, 814, 815, 816, 817, 817, 818, 819, 820, 821, 365, 365, 365,
-    822, 823, 824, 824, 824, 824, 824, 825, 826, 827, 828, 829, 830, 831,
-    346, 350, 832, 833, 833, 833, 833, 833, 834, 835, 120, 836, 837, 838,
-    839, 346, 346, 840, 841, 842, 842, 842, 842, 842, 842, 843, 844, 845,
-    120, 120, 846, 847, 848, 849, 120, 850, 850, 850, 120, 369, 369, 54, 54,
-    54, 54, 54, 851, 852, 120, 853, 853, 853, 853, 853, 853, 853, 853, 853,
-    853, 847, 847, 847, 847, 854, 855, 856, 857, 365, 365, 365, 365, 365,
-    365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365,
-    365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365,
-    365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365,
-    365, 365, 365, 365, 365, 858, 120, 366, 366, 859, 860, 366, 366, 366,
-    366, 366, 861, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862,
-    862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862,
-    862, 862, 862, 862, 862, 862, 862, 863, 863, 863, 863, 863, 863, 863,
-    863, 863, 863, 863, 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
-    863, 863, 863, 863, 863, 863, 863, 863, 863, 863, 863, 758, 758, 758,
-    758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 759, 758, 758, 758,
-    758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 864, 760, 760, 760,
-    760, 865, 120, 866, 867, 121, 868, 869, 870, 871, 121, 128, 128, 128,
-    128, 128, 128, 128, 128, 128, 128, 128, 128, 872, 873, 874, 120, 875,
-    128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+    120, 120, 120, 120, 128, 128, 169, 170, 120, 120, 171, 126, 172, 173,
+    174, 175, 176, 177, 177, 177, 177, 177, 177, 178, 179, 180, 181, 177,
+    182, 183, 184, 177, 185, 186, 187, 188, 188, 189, 190, 191, 192, 193,
+    194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 203, 204, 205, 206,
+    207, 208, 209, 210, 211, 212, 213, 120, 214, 215, 216, 217, 217, 218,
+    219, 220, 221, 222, 223, 120, 224, 225, 226, 227, 228, 229, 230, 231,
+    231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 120, 242, 243,
+    244, 245, 246, 243, 247, 248, 249, 250, 251, 120, 252, 253, 254, 255,
+    256, 257, 258, 259, 259, 258, 259, 260, 261, 262, 263, 264, 265, 266,
+    120, 267, 268, 269, 270, 271, 271, 270, 272, 273, 274, 275, 276, 277,
+    278, 279, 280, 120, 281, 282, 283, 284, 284, 284, 284, 285, 286, 287,
+    288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 295, 295, 298, 299,
+    296, 300, 301, 302, 303, 304, 305, 120, 306, 307, 307, 307, 307, 307,
+    308, 309, 310, 311, 312, 313, 120, 120, 120, 120, 314, 315, 316, 317,
+    318, 319, 320, 321, 322, 323, 324, 325, 120, 120, 120, 120, 326, 327,
+    328, 329, 330, 331, 332, 333, 334, 335, 334, 334, 334, 336, 337, 338,
+    339, 340, 341, 342, 341, 341, 341, 343, 344, 345, 346, 347, 120, 120,
+    120, 120, 348, 348, 348, 348, 348, 349, 350, 351, 352, 353, 354, 355,
+    356, 357, 358, 348, 359, 360, 352, 361, 362, 362, 362, 362, 363, 364,
+    365, 365, 365, 365, 365, 366, 367, 367, 367, 367, 367, 367, 367, 367,
+    367, 367, 367, 367, 368, 368, 368, 368, 368, 368, 368, 368, 368, 369,
+    369, 369, 369, 369, 369, 369, 369, 369, 369, 369, 370, 370, 370, 370,
+    370, 370, 370, 370, 370, 371, 372, 371, 370, 370, 370, 370, 370, 371,
+    370, 370, 370, 370, 371, 372, 371, 370, 372, 370, 370, 370, 370, 370,
+    370, 370, 371, 370, 370, 370, 370, 370, 370, 370, 370, 373, 374, 375,
+    376, 377, 370, 370, 378, 379, 380, 380, 380, 380, 380, 380, 380, 380,
+    380, 380, 381, 382, 383, 384, 384, 384, 384, 384, 384, 384, 384, 384,
+    384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384,
+    384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384,
+    384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384,
+    384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384,
+    384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 385, 384, 384,
+    386, 387, 387, 388, 389, 389, 389, 389, 389, 389, 389, 389, 389, 390,
+    391, 392, 393, 394, 395, 120, 396, 396, 397, 120, 398, 398, 399, 120,
+    400, 401, 402, 120, 403, 403, 403, 403, 403, 403, 404, 405, 406, 407,
+    408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 418, 418, 418,
+    419, 418, 418, 418, 418, 418, 418, 120, 420, 418, 418, 418, 418, 421,
+    384, 384, 384, 384, 384, 384, 384, 384, 422, 120, 423, 423, 423, 424,
+    425, 426, 427, 428, 429, 430, 431, 431, 431, 432, 433, 120, 434, 434,
+    434, 434, 434, 435, 434, 434, 434, 436, 437, 438, 439, 439, 439, 439,
+    440, 440, 441, 442, 443, 443, 443, 443, 443, 443, 444, 445, 446, 447,
+    448, 449, 450, 451, 450, 451, 452, 453, 454, 455, 120, 120, 120, 120,
+    120, 120, 120, 120, 456, 457, 457, 457, 457, 457, 458, 459, 460, 461,
+    462, 463, 464, 465, 466, 467, 468, 469, 469, 469, 470, 471, 472, 473,
+    474, 474, 474, 474, 475, 476, 477, 478, 479, 479, 479, 479, 480, 481,
+    482, 483, 484, 485, 486, 487, 488, 488, 488, 489, 100, 490, 120, 120,
+    120, 120, 120, 120, 491, 120, 492, 493, 494, 495, 496, 497, 54, 54, 54,
+    54, 498, 499, 56, 56, 56, 56, 56, 500, 501, 502, 54, 503, 54, 54, 54,
+    504, 56, 56, 56, 505, 506, 507, 508, 509, 509, 509, 510, 511, 27, 27, 27,
+    27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 512, 513, 27,
+    27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 514, 515, 516, 517, 514, 515,
+    514, 515, 516, 517, 514, 518, 514, 515, 514, 516, 514, 519, 514, 519,
+    514, 519, 520, 521, 522, 523, 524, 525, 514, 526, 527, 528, 529, 530,
+    531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544,
+    545, 546, 56, 547, 548, 549, 550, 551, 552, 552, 553, 554, 555, 556, 557,
+    120, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570,
+    571, 570, 572, 573, 574, 575, 576, 577, 578, 579, 580, 579, 581, 582,
+    579, 583, 579, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594,
+    595, 596, 597, 598, 599, 594, 594, 600, 601, 602, 603, 604, 594, 594,
+    605, 585, 606, 607, 594, 594, 608, 594, 594, 579, 609, 610, 611, 612,
+    613, 614, 615, 615, 615, 615, 615, 615, 615, 615, 616, 579, 579, 617,
+    618, 585, 585, 619, 579, 579, 579, 579, 584, 620, 621, 622, 623, 579,
+    579, 579, 579, 623, 120, 120, 120, 579, 624, 120, 120, 625, 625, 625,
+    625, 625, 626, 626, 627, 628, 628, 628, 628, 628, 628, 628, 628, 628,
+    629, 625, 630, 631, 631, 631, 631, 631, 631, 631, 631, 631, 632, 631,
+    631, 631, 631, 633, 579, 631, 631, 634, 579, 635, 636, 637, 638, 639,
+    640, 636, 579, 634, 641, 579, 642, 643, 644, 645, 646, 579, 579, 579,
+    647, 648, 649, 650, 579, 651, 652, 579, 653, 579, 579, 654, 655, 656,
+    657, 579, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 579,
+    579, 579, 669, 579, 670, 579, 671, 672, 673, 674, 675, 676, 625, 677,
+    677, 678, 579, 579, 579, 669, 679, 680, 681, 682, 683, 684, 685, 585,
+    585, 686, 686, 686, 686, 686, 686, 686, 686, 686, 686, 686, 686, 686,
+    686, 686, 686, 686, 686, 686, 686, 686, 686, 686, 686, 686, 686, 686,
+    686, 686, 686, 686, 686, 585, 585, 585, 585, 585, 585, 585, 585, 585,
+    585, 585, 585, 585, 585, 585, 585, 687, 688, 688, 689, 594, 594, 585,
+    690, 691, 692, 693, 694, 695, 696, 697, 698, 585, 699, 594, 700, 701,
+    702, 703, 683, 585, 585, 597, 690, 703, 704, 705, 706, 594, 594, 594,
+    594, 707, 708, 594, 594, 594, 594, 709, 710, 711, 683, 712, 713, 579,
+    579, 579, 714, 579, 579, 585, 585, 715, 716, 717, 636, 579, 579, 718,
+    579, 579, 579, 719, 579, 579, 579, 579, 720, 579, 721, 722, 120, 120,
+    723, 120, 120, 724, 724, 724, 724, 724, 725, 726, 726, 726, 726, 726,
+    727, 728, 729, 730, 731, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
+    732, 733, 734, 735, 736, 736, 736, 736, 737, 738, 739, 739, 739, 739,
+    739, 739, 739, 740, 741, 742, 370, 370, 372, 120, 372, 372, 372, 372,
+    372, 372, 372, 372, 743, 743, 743, 743, 744, 745, 746, 747, 748, 749,
+    750, 751, 752, 120, 120, 120, 120, 120, 120, 120, 753, 753, 753, 754,
+    753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 755, 120, 753, 753,
+    753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753,
+    753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 756, 120, 120, 120,
+    757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 769,
+    770, 769, 769, 769, 771, 772, 773, 774, 775, 776, 777, 777, 778, 777,
+    777, 777, 779, 780, 781, 782, 783, 784, 784, 784, 784, 785, 786, 787,
+    787, 787, 787, 787, 787, 787, 787, 787, 787, 788, 789, 790, 784, 784,
+    784, 791, 757, 757, 757, 757, 758, 120, 792, 792, 793, 793, 793, 794,
+    795, 796, 790, 790, 790, 797, 798, 799, 793, 793, 793, 800, 795, 796,
+    790, 790, 790, 790, 801, 799, 790, 802, 803, 803, 803, 803, 803, 804,
+    803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 790, 790, 790,
+    805, 806, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 807,
+    790, 790, 790, 805, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808,
+    808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808,
+    808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808,
+    808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808,
+    808, 808, 809, 810, 579, 579, 579, 579, 579, 579, 579, 579, 808, 808,
+    808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808,
+    808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 809, 810, 810, 810,
+    810, 810, 811, 811, 812, 811, 811, 811, 811, 811, 811, 811, 811, 811,
+    811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811,
+    811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811,
+    811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811,
+    811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811,
+    811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 813,
+    814, 814, 814, 814, 814, 814, 815, 120, 816, 816, 816, 816, 816, 817,
+    818, 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, 818,
+    818, 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, 818,
+    818, 818, 818, 818, 818, 819, 818, 818, 820, 821, 120, 120, 101, 101,
+    101, 101, 101, 822, 823, 824, 101, 101, 101, 825, 826, 826, 826, 826,
+    826, 826, 826, 826, 827, 828, 829, 120, 64, 64, 830, 831, 832, 27, 833,
+    27, 27, 27, 27, 27, 27, 27, 834, 835, 27, 836, 837, 27, 27, 838, 839,
+    120, 120, 120, 120, 120, 120, 120, 840, 841, 842, 843, 844, 844, 845,
+    846, 847, 848, 849, 849, 849, 849, 849, 849, 850, 120, 851, 852, 852,
+    852, 852, 852, 853, 854, 855, 856, 857, 858, 859, 859, 860, 861, 862,
+    863, 864, 864, 865, 866, 867, 867, 868, 869, 870, 871, 367, 367, 367,
+    872, 873, 874, 874, 874, 874, 874, 875, 876, 877, 878, 879, 880, 881,
+    348, 352, 882, 883, 883, 883, 883, 883, 884, 885, 120, 886, 887, 888,
+    889, 348, 348, 890, 891, 892, 892, 892, 892, 892, 892, 893, 894, 895,
+    120, 120, 896, 897, 898, 899, 120, 900, 900, 900, 120, 372, 372, 54, 54,
+    54, 54, 54, 901, 902, 120, 903, 903, 903, 903, 903, 903, 903, 903, 903,
+    903, 897, 897, 897, 897, 904, 905, 906, 907, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909, 909, 910, 909,
+    909, 909, 908, 909, 909, 910, 909, 909, 909, 909, 909, 909, 908, 909,
+    909, 910, 909, 909, 909, 908, 909, 909, 910, 909, 909, 909, 908, 909,
+    909, 911, 120, 368, 368, 912, 913, 369, 369, 369, 369, 369, 914, 915,
+    915, 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+    915, 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+    915, 915, 915, 916, 916, 916, 916, 916, 916, 916, 916, 916, 916, 916,
+    916, 916, 916, 916, 916, 916, 916, 916, 916, 916, 916, 916, 916, 916,
+    916, 916, 916, 916, 916, 916, 916, 808, 808, 808, 808, 808, 808, 808,
+    808, 808, 808, 808, 808, 808, 809, 808, 808, 808, 808, 808, 808, 808,
+    808, 808, 808, 808, 808, 808, 917, 810, 810, 810, 810, 918, 120, 919,
+    920, 121, 921, 922, 923, 924, 121, 128, 128, 128, 128, 128, 128, 128,
+    128, 128, 128, 128, 128, 925, 926, 927, 120, 928, 128, 128, 128, 128,
     128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
     128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
-    128, 128, 876, 120, 120, 128, 128, 128, 128, 128, 128, 128, 128, 877,
-    128, 128, 128, 128, 128, 128, 120, 120, 120, 120, 120, 128, 878, 879,
-    879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892,
-    128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
-    128, 128, 893, 894, 895, 896, 897, 898, 899, 899, 900, 901, 902, 902,
-    903, 904, 905, 906, 905, 905, 905, 905, 907, 908, 908, 908, 909, 910,
-    910, 910, 911, 912, 913, 120, 914, 915, 916, 915, 915, 917, 915, 915,
-    918, 915, 919, 915, 919, 120, 120, 120, 120, 915, 915, 915, 915, 915,
-    915, 915, 915, 915, 915, 915, 915, 915, 915, 915, 920, 921, 922, 922,
-    922, 922, 922, 923, 607, 924, 924, 924, 924, 924, 924, 925, 926, 927,
-    928, 572, 929, 930, 120, 120, 120, 120, 120, 607, 607, 607, 607, 607,
-    931, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 932, 932, 932, 933, 934, 934, 934, 934, 934, 934, 935,
-    120, 936, 937, 937, 938, 939, 939, 939, 939, 940, 120, 941, 941, 942,
-    943, 944, 944, 944, 944, 945, 946, 947, 947, 947, 948, 949, 949, 949,
-    949, 950, 949, 951, 120, 120, 120, 120, 120, 952, 952, 952, 952, 952,
-    953, 953, 953, 953, 953, 954, 954, 954, 954, 954, 954, 955, 955, 955,
-    956, 957, 958, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 959,
-    959, 959, 959, 959, 120, 960, 960, 960, 960, 960, 960, 961, 962, 120,
-    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 963, 963, 963, 963, 963, 963, 963, 963, 963, 963, 963,
-    963, 963, 963, 963, 963, 963, 963, 963, 963, 963, 963, 963, 963, 963,
-    963, 963, 963, 963, 963, 963, 963, 963, 963, 963, 963, 963, 963, 964,
-    120, 963, 963, 965, 120, 963, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 966, 967, 968,
-    968, 968, 968, 969, 970, 971, 971, 972, 973, 974, 974, 975, 976, 977,
-    977, 977, 978, 979, 980, 120, 120, 120, 120, 120, 120, 981, 981, 982,
-    983, 984, 984, 985, 986, 987, 987, 987, 988, 120, 120, 120, 120, 120,
-    120, 120, 120, 989, 989, 989, 989, 990, 990, 990, 991, 992, 992, 993,
-    992, 992, 992, 992, 992, 994, 995, 996, 997, 998, 998, 999, 1000, 1001,
-    120, 1002, 1003, 1004, 1004, 1004, 1005, 1006, 1006, 1006, 1007, 120,
-    120, 120, 120, 1008, 1009, 1008, 1008, 1010, 1011, 1012, 120, 1013, 1013,
-    1013, 1013, 1013, 1013, 1014, 1015, 1016, 1016, 1017, 1018, 1019, 1019,
-    1020, 1021, 1022, 1022, 1023, 1024, 120, 1025, 120, 120, 120, 120, 120,
-    120, 120, 120, 120, 120, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026,
-    1026, 1027, 120, 120, 120, 120, 120, 120, 1028, 1028, 1028, 1028, 1028,
-    1028, 1029, 120, 1030, 1030, 1030, 1030, 1030, 1030, 1031, 1032, 120,
+    128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 929, 120,
+    120, 128, 128, 128, 128, 128, 128, 128, 128, 930, 128, 128, 128, 128,
+    128, 128, 120, 120, 120, 120, 120, 128, 931, 932, 932, 933, 934, 935,
+    936, 937, 938, 939, 940, 941, 942, 943, 944, 169, 128, 128, 128, 128,
+    128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 945, 946,
+    947, 948, 949, 950, 951, 951, 952, 953, 954, 954, 955, 956, 957, 958,
+    959, 959, 959, 959, 960, 961, 961, 961, 962, 963, 963, 963, 964, 965,
+    966, 120, 967, 968, 969, 968, 968, 970, 968, 968, 971, 968, 972, 968,
+    972, 120, 120, 120, 120, 968, 968, 968, 968, 968, 968, 968, 968, 968,
+    968, 968, 968, 968, 968, 968, 973, 974, 975, 975, 975, 975, 975, 976,
+    615, 977, 977, 977, 977, 977, 977, 978, 979, 980, 981, 579, 982, 983,
+    120, 120, 120, 120, 120, 615, 615, 615, 615, 615, 984, 120, 120, 120,
+    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 985,
+    985, 985, 986, 987, 987, 987, 987, 987, 987, 988, 120, 989, 990, 990,
+    991, 992, 992, 992, 992, 993, 120, 994, 994, 995, 996, 997, 997, 997,
+    997, 998, 999, 1000, 1000, 1000, 1001, 1002, 1002, 1002, 1002, 1003,
+    1002, 1004, 120, 120, 120, 120, 120, 1005, 1005, 1005, 1005, 1005, 1006,
+    1006, 1006, 1006, 1006, 1007, 1007, 1007, 1007, 1007, 1007, 1008, 1008,
+    1008, 1009, 1010, 1011, 1012, 1012, 1012, 1012, 1013, 1014, 1014, 1014,
+    1014, 1015, 1016, 1016, 1016, 1016, 1016, 120, 1017, 1017, 1017, 1017,
+    1017, 1017, 1018, 1019, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+    120, 120, 120, 120, 120, 120, 120, 120, 1020, 1020, 1020, 1020, 1020,
+    1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020,
+    1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020,
+    1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1021, 120, 1020,
+    1020, 1022, 120, 1020, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+    120, 120, 120, 120, 120, 120, 120, 120, 120, 1023, 1024, 1025, 1025,
+    1025, 1025, 1026, 1027, 1028, 1028, 1029, 1030, 1031, 1031, 1032, 1033,
+    1034, 1034, 1034, 1035, 1036, 1037, 120, 120, 120, 120, 120, 120, 1038,
+    1038, 1039, 1040, 1041, 1041, 1042, 1043, 1044, 1044, 1044, 1045, 120,
+    120, 120, 120, 120, 120, 120, 120, 1046, 1046, 1046, 1046, 1047, 1047,
+    1047, 1048, 1049, 1049, 1050, 1049, 1049, 1049, 1049, 1049, 1051, 1052,
+    1053, 1054, 1055, 1055, 1056, 1057, 1058, 120, 1059, 1060, 1061, 1061,
+    1061, 1062, 1063, 1063, 1063, 1064, 120, 120, 120, 120, 1065, 1066, 1065,
+    1065, 1067, 1068, 1069, 120, 1070, 1070, 1070, 1070, 1070, 1070, 1071,
+    1072, 1073, 1073, 1074, 1075, 1076, 1076, 1077, 1078, 1079, 1079, 1080,
+    1081, 120, 1082, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 1083,
+    1083, 1083, 1083, 1083, 1083, 1083, 1083, 1083, 1084, 120, 120, 120, 120,
+    120, 120, 1085, 1085, 1085, 1085, 1085, 1085, 1086, 120, 1087, 1087,
+    1087, 1087, 1087, 1087, 1088, 1089, 120, 120, 120, 120, 120, 120, 120,
     120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
     120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+    120, 120, 120, 120, 120, 120, 120, 120, 120, 1090, 1090, 1090, 1091, 120,
     120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 1033, 1033, 1033, 1034, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 120, 120, 120, 120, 1035, 1036, 1036, 1036, 1036, 1036,
-    1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 120, 1044, 1045, 1046,
-    1046, 1046, 1046, 1046, 1047, 1048, 1049, 120, 1050, 1050, 1050, 1051,
-    1052, 1053, 1054, 1055, 1055, 1055, 1056, 1057, 1058, 1059, 1060, 120,
-    1061, 1061, 1061, 1061, 1062, 120, 1063, 1064, 1064, 1064, 1064, 1064,
-    1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 120, 1074, 1074,
-    1075, 1074, 1074, 1076, 1077, 1078, 120, 120, 120, 120, 120, 120, 120,
-    120, 1079, 1080, 1081, 1082, 1081, 1083, 1084, 1084, 1084, 1084, 1084,
-    1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1093, 1094, 1095,
-    1096, 1097, 1098, 1099, 1100, 1101, 1102, 1102, 120, 120, 120, 120, 120,
+    120, 1092, 1093, 1093, 1093, 1093, 1093, 1093, 1094, 1095, 1096, 1097,
+    1098, 1099, 1100, 120, 1101, 1102, 1103, 1103, 1103, 1103, 1103, 1104,
+    1105, 1106, 120, 1107, 1107, 1107, 1108, 1109, 1110, 1111, 1112, 1112,
+    1112, 1113, 1114, 1115, 1116, 1117, 120, 1118, 1118, 1118, 1118, 1119,
+    120, 1120, 1121, 1121, 1121, 1121, 1121, 1122, 1123, 1124, 1125, 1126,
+    1127, 1128, 1129, 1130, 120, 1131, 1131, 1132, 1131, 1131, 1133, 1134,
+    1135, 120, 120, 120, 120, 120, 120, 120, 120, 1136, 1137, 1138, 1139,
+    1138, 1140, 1141, 1141, 1141, 1141, 1141, 1142, 1143, 1144, 1145, 1146,
+    1147, 1148, 1149, 1150, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157,
+    1158, 1159, 1159, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+    120, 120, 120, 120, 120, 120, 1160, 1160, 1160, 1160, 1160, 1160, 1161,
+    1162, 1163, 1164, 1165, 1166, 120, 120, 120, 120, 1167, 1167, 1167, 1167,
+    1167, 1167, 1168, 1169, 1170, 120, 1171, 1172, 120, 120, 120, 120, 120,
     120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    1103, 1103, 1103, 1103, 1103, 1103, 1104, 1105, 1106, 120, 1107, 1108,
-    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 120, 120, 120, 1109, 1109, 1109, 1109, 1109, 1110, 1111,
-    1112, 1113, 1114, 1114, 1115, 120, 120, 120, 120, 1116, 1116, 1116, 1116,
-    1116, 1116, 1117, 1118, 1119, 120, 1120, 1121, 120, 120, 120, 120, 1122,
-    1122, 1122, 1122, 1122, 1123, 1124, 120, 1125, 1126, 120, 120, 120, 120,
-    120, 120, 1127, 1127, 1127, 1128, 1129, 1130, 1131, 1132, 120, 120, 120,
+    120, 1173, 1173, 1173, 1173, 1173, 1174, 1175, 1176, 1177, 1178, 1179,
+    1180, 120, 120, 120, 120, 1181, 1181, 1181, 1181, 1181, 1181, 1182, 1183,
+    1184, 120, 1185, 1186, 1187, 1188, 120, 120, 1189, 1189, 1189, 1189,
+    1189, 1190, 1191, 120, 1192, 1193, 120, 120, 120, 120, 120, 120, 1194,
+    1194, 1194, 1195, 1196, 1197, 1198, 1199, 120, 120, 120, 120, 120, 120,
     120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
     120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 1133,
-    1133, 1133, 1133, 1134, 1134, 1134, 1134, 1135, 1136, 1137, 1138, 120,
+    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 1200, 1200, 1200, 1200,
+    1201, 1201, 1201, 1201, 1202, 1203, 1204, 1205, 120, 120, 120, 120, 120,
     120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 120, 120, 120, 120, 120, 120, 1139, 1139, 1139, 1139,
-    1139, 1139, 1139, 1140, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141,
-    1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141,
-    1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141,
-    1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141,
-    1141, 1141, 1141, 1141, 1141, 1141, 1141, 1142, 120, 120, 120, 120, 120,
-    120, 120, 120, 120, 120, 120, 120, 1143, 1143, 1143, 1143, 1143, 1143,
-    1143, 1143, 1143, 1143, 1143, 1143, 1143, 1144, 1145, 120, 1141, 1141,
-    1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141,
-    1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1146, 120,
-    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 120, 120, 120, 120, 120, 1147, 1147, 1147, 1147, 1147,
-    1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147,
-    1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147,
-    1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1148, 120, 120, 120, 120,
-    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 120, 120, 120, 120, 120, 1149, 1149, 1149, 1149, 1149,
-    1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149,
-    1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149,
-    1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1150,
+    120, 120, 120, 120, 120, 1206, 1206, 1206, 1206, 1206, 1206, 1206, 1207,
+    1208, 1209, 1208, 1208, 1208, 1210, 1211, 1212, 1213, 120, 1214, 1215,
+    1216, 1217, 1218, 1219, 1219, 1219, 1220, 1221, 1221, 1222, 1223, 120,
+    120, 120, 120, 120, 120, 120, 120, 120, 1224, 1224, 1224, 1224, 1224,
+    1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224,
+    1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224,
+    1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224,
+    1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1225, 120,
+    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 1226, 1226, 1226,
+    1226, 1226, 1226, 1226, 1226, 1226, 1226, 1226, 1226, 1226, 1227, 1228,
+    120, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224,
+    1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224,
+    1224, 1229, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 1230, 1230, 1230,
+    1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
+    1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
+    1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
+    1230, 1230, 1230, 1230, 1231, 1230, 1230, 1230, 1230, 1232, 1233, 1230,
+    1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
+    1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
+    1230, 1230, 1230, 1230, 1234, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
+    1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
+    1230, 1230, 1235, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
     120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 120, 120, 120, 120, 120, 120, 776, 776, 776, 776, 776,
-    776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776,
-    776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776,
-    776, 776, 776, 776, 776, 776, 1151, 1152, 1152, 1152, 1153, 1154, 1155,
-    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 1156, 1156,
-    1156, 1157, 1158, 120, 1159, 1159, 1159, 1159, 1159, 1159, 1160, 1161,
-    1162, 120, 1163, 1164, 1165, 1159, 1159, 1166, 1159, 1159, 120, 120, 120,
-    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 1167, 1167, 1167,
-    1167, 1167, 1167, 1167, 1167, 1168, 120, 1169, 1170, 1170, 1170, 1170,
-    1171, 120, 1172, 1173, 1174, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 1175, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+    120, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
+    1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
+    1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
+    1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
+    1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1237, 1236,
+    1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
+    1236, 1238, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 826, 826, 826,
+    826, 826, 826, 826, 826, 826, 826, 826, 826, 826, 826, 826, 826, 826,
+    826, 826, 826, 826, 826, 826, 826, 826, 826, 826, 826, 826, 826, 826,
+    826, 826, 826, 826, 826, 826, 826, 826, 1239, 1240, 1240, 1240, 1241,
+    1242, 1243, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+    1244, 1244, 1244, 1245, 1246, 120, 1247, 1247, 1247, 1247, 1247, 1247,
+    1248, 1249, 1250, 120, 1251, 1252, 1253, 1247, 1247, 1254, 1247, 1247,
     120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 120, 120, 120, 120, 1176, 1176, 1176, 1176, 1176, 1176,
-    1176, 1176, 1176, 1176, 1176, 1176, 1176, 1177, 1176, 1178, 1176, 1179,
-    1176, 1180, 1181, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607,
-    607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607,
-    607, 607, 1182, 120, 607, 607, 607, 607, 1183, 1184, 607, 607, 607, 607,
-    607, 607, 1185, 1186, 1187, 1188, 1189, 1190, 607, 607, 607, 1191, 607,
-    607, 607, 607, 607, 607, 607, 1192, 120, 120, 927, 927, 927, 927, 927,
-    927, 927, 927, 1193, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 572,
-    572, 572, 572, 572, 572, 572, 572, 572, 572, 614, 120, 922, 922, 1194,
+    1255, 1255, 1255, 1255, 1255, 1255, 1255, 1255, 1256, 120, 1257, 1258,
+    1258, 1258, 1258, 1259, 120, 1260, 1261, 1262, 120, 120, 120, 120, 120,
+    120, 120, 120, 1263, 120, 120, 120, 1264, 1264, 1264, 1264, 1264, 1264,
+    1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264,
+    1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264,
+    1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264,
+    1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264,
+    1264, 1264, 1264, 1264, 1264, 1264, 1264, 1265, 120, 120, 1264, 1264,
+    1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264,
+    1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264, 1264,
+    1264, 1264, 1264, 1264, 1266, 120, 1267, 120, 120, 120, 120, 120, 120,
+    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 1268, 1268, 1268,
+    1268, 1268, 1268, 1268, 1268, 1268, 1268, 1268, 1268, 1268, 1269, 1268,
+    1270, 1268, 1271, 1268, 1272, 1273, 120, 120, 120, 120, 120, 120, 120,
+    120, 120, 120, 120, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615,
+    615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615,
+    615, 615, 615, 615, 615, 615, 1274, 120, 615, 615, 615, 615, 1275, 1276,
+    615, 615, 615, 615, 615, 615, 1277, 1278, 1279, 1280, 1281, 1282, 615,
+    615, 615, 1283, 615, 615, 615, 615, 615, 615, 615, 1284, 120, 120, 980,
+    980, 980, 980, 980, 980, 980, 980, 1285, 120, 120, 120, 120, 120, 120,
     120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 1195, 1195, 1195, 1196, 1197, 1197, 1198, 1195, 1195,
-    1199, 1200, 1197, 1197, 1195, 1195, 1195, 1196, 1197, 1197, 1201, 1202,
-    1203, 1199, 1204, 1205, 1197, 1195, 1195, 1195, 1196, 1197, 1197, 1206,
-    1207, 1208, 1209, 1197, 1197, 1197, 1210, 1211, 1212, 1213, 1197, 1197,
-    1198, 1195, 1195, 1199, 1197, 1197, 1197, 1195, 1195, 1195, 1196, 1197,
-    1197, 1198, 1195, 1195, 1199, 1197, 1197, 1197, 1195, 1195, 1195, 1196,
-    1197, 1197, 1198, 1195, 1195, 1199, 1197, 1197, 1197, 1195, 1195, 1195,
-    1196, 1197, 1197, 1214, 1195, 1195, 1195, 1215, 1197, 1197, 1216, 1217,
-    1195, 1195, 1218, 1197, 1197, 1219, 1198, 1195, 1195, 1220, 1197, 1197,
-    1221, 1222, 1195, 1195, 1223, 1197, 1197, 1197, 1224, 1195, 1195, 1195,
-    1215, 1197, 1197, 1216, 1225, 1226, 1226, 1226, 1226, 1226, 1226, 1227,
-    1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227,
-    1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227,
-    1227, 1227, 1227, 1227, 1227, 1227, 1227, 1228, 1228, 1228, 1228, 1228,
-    1228, 1229, 1230, 1228, 1228, 1228, 1228, 1228, 1231, 1232, 1227, 1233,
-    1234, 120, 1235, 1236, 1228, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237,
-    1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237,
-    1237, 1238, 1239, 1240, 120, 120, 120, 120, 120, 1241, 128, 128, 128,
-    1242, 1243, 1244, 1245, 1246, 1247, 1242, 1248, 1242, 1244, 1244, 1249,
-    128, 1250, 128, 1251, 1252, 1250, 128, 1251, 120, 120, 120, 120, 120,
-    120, 1253, 120, 572, 572, 572, 572, 572, 929, 572, 572, 572, 572, 572,
-    572, 572, 572, 572, 572, 572, 572, 929, 120, 572, 614, 1254, 572, 1254,
-    572, 1254, 572, 572, 572, 681, 120, 616, 1255, 618, 618, 618, 1256, 618,
-    618, 618, 618, 618, 618, 618, 1257, 618, 618, 618, 618, 618, 1258, 120,
-    120, 120, 120, 120, 120, 120, 120, 1259, 607, 607, 607, 1260, 120, 741,
-    741, 741, 741, 741, 1261, 741, 1262, 1263, 120, 120, 120, 120, 120, 120,
+    120, 120, 120, 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, 623,
+    120, 975, 975, 1286, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+    120, 120, 120, 120, 120, 120, 120, 1287, 1287, 1287, 1288, 1289, 1289,
+    1290, 1287, 1287, 1291, 1292, 1289, 1289, 1287, 1287, 1287, 1288, 1289,
+    1289, 1293, 1294, 1295, 1291, 1296, 1297, 1289, 1287, 1287, 1287, 1288,
+    1289, 1289, 1298, 1299, 1300, 1301, 1289, 1289, 1289, 1302, 1303, 1304,
+    1305, 1289, 1289, 1290, 1287, 1287, 1291, 1289, 1289, 1289, 1287, 1287,
+    1287, 1288, 1289, 1289, 1290, 1287, 1287, 1291, 1289, 1289, 1289, 1287,
+    1287, 1287, 1288, 1289, 1289, 1290, 1287, 1287, 1291, 1289, 1289, 1289,
+    1287, 1287, 1287, 1288, 1289, 1289, 1306, 1287, 1287, 1287, 1307, 1289,
+    1289, 1308, 1309, 1287, 1287, 1310, 1289, 1289, 1311, 1290, 1287, 1287,
+    1312, 1289, 1289, 1313, 1314, 1287, 1287, 1315, 1289, 1289, 1289, 1316,
+    1287, 1287, 1287, 1307, 1289, 1289, 1308, 1317, 1318, 1318, 1318, 1318,
+    1318, 1318, 1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319,
+    1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319,
+    1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319, 1320, 1320,
+    1320, 1320, 1320, 1320, 1321, 1322, 1320, 1320, 1320, 1320, 1320, 1323,
+    1324, 1319, 1325, 1326, 120, 1327, 1328, 1320, 120, 120, 120, 120, 120,
+    120, 120, 120, 120, 120, 1329, 1330, 1330, 1331, 1332, 1333, 120, 120,
     120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572,
-    572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572,
-    572, 572, 572, 572, 1264, 572, 572, 572, 572, 572, 572, 572, 572, 572,
-    572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572,
-    572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572,
-    572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 1265, 572, 572, 572,
-    572, 1266, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572,
-    572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572,
-    572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 1267, 120, 572,
-    1268, 929, 120, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572,
-    572, 572, 572, 929, 120, 572, 572, 572, 572, 572, 572, 572, 572, 572,
-    572, 1268, 120, 120, 120, 120, 120, 572, 929, 572, 572, 572, 572, 572,
-    572, 572, 120, 572, 684, 572, 572, 572, 572, 572, 120, 572, 572, 572,
-    681, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 572,
-    1267, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 1268,
-    120, 120, 120, 120, 120, 120, 120, 1267, 120, 120, 120, 120, 120, 120,
-    120, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758,
-    758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 1269,
-    760, 760, 760, 760, 760, 758, 758, 758, 758, 758, 758, 1270, 760, 758,
-    758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758,
-    758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 759, 758,
-    758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758,
-    758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758,
-    758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758,
-    758, 758, 758, 758, 758, 864, 760, 760, 760, 760, 760, 760, 760, 760,
-    760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760,
-    760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760,
-    760, 760, 760, 760, 760, 760, 760, 758, 758, 758, 759, 760, 760, 760,
-    760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760,
-    760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760,
-    760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760,
-    760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 760,
-    1271, 1272, 120, 120, 120, 1273, 1273, 1273, 1273, 1273, 1273, 1273,
-    1273, 1273, 1273, 1273, 1273, 120, 120, 120, 120, 120, 120, 120, 120,
-    120, 120, 120, 120, 120, 120, 120, 120, 879, 879, 879, 879, 879, 879,
-    879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879,
-    879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 120, 120, 863, 863,
-    863, 863, 863, 863, 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
-    863, 863, 863, 863, 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
-    863, 1274,
+    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 1334, 1334, 1334, 1334,
+    1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334,
+    1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1335, 1336, 1337, 120,
+    120, 120, 120, 120, 1338, 1338, 1338, 1338, 1339, 1340, 1340, 1340, 1341,
+    1342, 1343, 1344, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+    120, 120, 120, 120, 120, 120, 120, 120, 120, 1345, 128, 128, 128, 1346,
+    1347, 1348, 1349, 1350, 1351, 1346, 1352, 1346, 1348, 1348, 1353, 128,
+    1354, 128, 1355, 1356, 1354, 128, 1355, 120, 120, 120, 120, 120, 120,
+    1357, 120, 1358, 1359, 1359, 1359, 1359, 1360, 1359, 1359, 1359, 1359,
+    1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1360, 1361, 1359, 1362,
+    1363, 1359, 1363, 1364, 1363, 1359, 1359, 1359, 1365, 1361, 626, 1366,
+    628, 628, 628, 1367, 628, 628, 628, 628, 628, 628, 628, 1368, 628, 628,
+    628, 1369, 1370, 1371, 628, 1372, 1361, 1361, 1361, 1361, 1361, 1361,
+    1373, 1374, 1374, 1374, 1375, 1361, 790, 790, 790, 790, 790, 1376, 790,
+    1377, 1378, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361,
+    1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 757,
+    757, 757, 757, 1379, 1380, 1381, 757, 757, 757, 757, 757, 757, 757, 757,
+    1382, 1383, 757, 1384, 1385, 757, 757, 1386, 1387, 1388, 1389, 1384,
+    1359, 757, 757, 1390, 1391, 757, 757, 757, 757, 757, 757, 757, 1392,
+    1393, 1394, 1395, 757, 1396, 1397, 1394, 1398, 1399, 757, 757, 757, 1400,
+    1401, 1402, 757, 757, 757, 757, 757, 757, 757, 757, 1403, 1404, 757,
+    1405, 649, 1406, 757, 1407, 1408, 579, 1409, 757, 757, 757, 1359, 1410,
+    1411, 1359, 1359, 1412, 1359, 1358, 1359, 1359, 1359, 1359, 1359, 1413,
+    1414, 1359, 1359, 1413, 1415, 757, 757, 757, 757, 757, 757, 757, 757,
+    1416, 1417, 579, 579, 579, 579, 1418, 1419, 757, 757, 757, 757, 1420,
+    757, 1421, 757, 1422, 1358, 1423, 1361, 1359, 1424, 1425, 1361, 579, 579,
+    579, 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, 1426, 1361,
+    579, 579, 579, 579, 579, 579, 579, 579, 579, 579, 1427, 1361, 1361, 1361,
+    1361, 1361, 579, 1426, 579, 579, 579, 579, 579, 579, 579, 1361, 579,
+    1428, 579, 579, 579, 579, 579, 1361, 579, 579, 579, 1429, 1361, 1361,
+    1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 757, 1430,
+    1431, 1361, 1432, 1433, 757, 1434, 757, 1435, 1361, 1361, 1361, 1361,
+    757, 757, 1436, 1361, 1361, 1361, 1361, 1361, 1437, 1361, 1361, 1361,
+    1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361,
+    1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361,
+    1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361,
+    1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361,
+    1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361,
+    1361, 1361, 1361, 1361, 1361, 1361, 1361, 1438, 808, 808, 808, 808, 808,
+    808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808,
+    808, 808, 808, 808, 808, 808, 808, 1439, 810, 810, 810, 810, 810, 808,
+    808, 808, 808, 808, 808, 1440, 810, 808, 808, 808, 808, 808, 808, 808,
+    808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808,
+    808, 808, 808, 808, 808, 808, 809, 808, 808, 808, 808, 808, 808, 808,
+    808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808,
+    808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808,
+    808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 917,
+    810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810,
+    810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810,
+    810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810,
+    810, 808, 808, 808, 809, 810, 810, 810, 810, 810, 810, 810, 810, 810,
+    810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810,
+    810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810,
+    810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810,
+    810, 810, 810, 810, 810, 810, 810, 810, 1441, 1442, 120, 120, 120, 1443,
+    1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 120,
+    120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+    120, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932,
+    932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932,
+    932, 932, 932, 120, 120, 916, 916, 916, 916, 916, 916, 916, 916, 916,
+    916, 916, 916, 916, 916, 916, 916, 916, 916, 916, 916, 916, 916, 916,
+    916, 916, 916, 916, 916, 916, 916, 916, 1444,
 };
 
 static const unsigned short index2[] = {
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 4, 3, 1, 1, 1, 1, 1, 1, 3, 3, 3, 2,
-    5, 6, 6, 7, 8, 7, 6, 6, 9, 10, 6, 11, 12, 13, 12, 12, 14, 14, 14, 14, 14,
-    14, 14, 14, 14, 14, 12, 6, 15, 16, 15, 6, 6, 17, 17, 17, 17, 17, 17, 17,
-    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 9, 6, 10, 18, 19, 18, 20, 20,
-    20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 9, 16,
-    10, 16, 1, 1, 1, 1, 1, 1, 3, 1, 1, 21, 22, 8, 8, 23, 8, 24, 22, 25, 26,
-    27, 28, 16, 29, 30, 18, 31, 32, 33, 33, 25, 34, 22, 22, 25, 33, 27, 35,
-    36, 36, 36, 22, 37, 37, 37, 37, 37, 37, 38, 37, 37, 37, 37, 37, 37, 37,
-    37, 37, 38, 37, 37, 37, 37, 37, 37, 39, 38, 37, 37, 37, 37, 37, 38, 40,
-    40, 40, 41, 41, 41, 41, 40, 41, 40, 40, 40, 41, 40, 40, 41, 41, 40, 41,
-    40, 40, 41, 41, 41, 39, 40, 40, 40, 41, 40, 41, 40, 41, 37, 40, 37, 41,
-    37, 41, 37, 41, 37, 41, 37, 41, 37, 41, 37, 41, 37, 40, 37, 40, 37, 41,
-    37, 41, 37, 41, 37, 40, 37, 41, 37, 41, 37, 41, 37, 41, 37, 41, 38, 40,
-    37, 40, 38, 40, 37, 41, 37, 41, 40, 37, 41, 37, 41, 37, 41, 38, 40, 38,
-    40, 37, 40, 37, 41, 37, 40, 40, 38, 40, 37, 40, 37, 41, 37, 41, 38, 40,
-    37, 41, 37, 41, 37, 37, 41, 37, 41, 37, 41, 41, 41, 37, 37, 41, 37, 41,
-    37, 37, 41, 37, 37, 37, 41, 41, 37, 37, 37, 37, 41, 37, 37, 41, 37, 37,
-    37, 41, 41, 41, 37, 37, 41, 37, 37, 41, 37, 41, 37, 41, 37, 37, 41, 37,
-    41, 41, 37, 41, 37, 37, 41, 37, 37, 37, 41, 37, 41, 37, 37, 41, 41, 42,
-    37, 41, 41, 41, 42, 42, 42, 42, 37, 43, 41, 37, 43, 41, 37, 43, 41, 37,
-    40, 37, 40, 37, 40, 37, 40, 37, 40, 37, 40, 37, 40, 37, 40, 41, 37, 41,
-    41, 37, 43, 41, 37, 41, 37, 37, 37, 41, 37, 41, 41, 41, 41, 41, 41, 41,
-    37, 37, 41, 37, 37, 41, 41, 37, 41, 37, 37, 37, 37, 41, 41, 40, 41, 41,
-    41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 41,
-    41, 41, 44, 44, 44, 44, 44, 44, 44, 44, 44, 45, 45, 46, 46, 46, 46, 46,
-    46, 46, 47, 47, 25, 47, 45, 48, 45, 48, 48, 48, 45, 48, 45, 45, 49, 46,
-    47, 47, 47, 47, 47, 47, 25, 25, 25, 25, 47, 25, 47, 25, 44, 44, 44, 44,
-    44, 47, 47, 47, 47, 47, 50, 50, 45, 47, 46, 47, 47, 47, 47, 47, 47, 47,
-    47, 47, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 53, 53,
-    53, 53, 52, 54, 53, 53, 53, 53, 53, 55, 55, 53, 53, 53, 53, 55, 55, 53,
-    53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 56, 56, 56, 56, 56, 53, 53, 53,
-    53, 51, 51, 51, 51, 51, 51, 51, 51, 57, 51, 53, 53, 53, 51, 51, 51, 53,
-    53, 58, 51, 51, 51, 53, 53, 53, 53, 51, 52, 53, 53, 51, 59, 60, 60, 59,
-    60, 60, 59, 51, 51, 51, 51, 51, 61, 62, 61, 62, 45, 63, 61, 62, 64, 64,
-    65, 62, 62, 62, 66, 61, 64, 64, 64, 64, 63, 47, 61, 66, 61, 61, 61, 64,
-    61, 64, 61, 61, 62, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
-    67, 67, 67, 67, 64, 67, 67, 67, 67, 67, 67, 67, 61, 61, 62, 62, 62, 62,
-    62, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
-    62, 68, 68, 68, 68, 68, 68, 68, 62, 62, 62, 62, 62, 61, 62, 62, 61, 61,
-    61, 62, 62, 62, 61, 62, 61, 62, 61, 62, 61, 62, 61, 62, 69, 70, 69, 70,
-    69, 70, 69, 70, 69, 70, 69, 70, 69, 70, 62, 62, 62, 62, 61, 62, 71, 61,
-    62, 61, 61, 62, 62, 61, 61, 61, 72, 73, 72, 72, 72, 72, 72, 72, 72, 72,
-    72, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 73, 74, 74, 74, 74,
-    74, 74, 74, 74, 75, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
-    75, 75, 72, 75, 72, 75, 72, 75, 72, 75, 72, 75, 76, 77, 77, 78, 78, 77,
-    79, 79, 72, 75, 72, 75, 72, 75, 72, 72, 75, 72, 75, 72, 75, 72, 75, 72,
-    75, 72, 75, 72, 75, 75, 64, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
-    80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 64, 64, 81, 82, 82, 82, 82,
-    82, 82, 64, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
-    64, 84, 85, 64, 64, 86, 86, 87, 64, 88, 89, 89, 89, 89, 88, 89, 89, 89,
-    90, 88, 89, 89, 89, 89, 89, 89, 88, 88, 88, 88, 88, 88, 89, 89, 88, 89,
-    89, 90, 91, 89, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 101, 102, 103,
-    104, 105, 106, 107, 108, 109, 107, 89, 88, 107, 100, 64, 64, 64, 64, 64,
-    64, 64, 64, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 64,
-    64, 64, 64, 64, 110, 110, 110, 107, 107, 64, 64, 64, 111, 111, 111, 111,
-    111, 112, 113, 113, 114, 115, 115, 116, 117, 118, 119, 119, 120, 120,
-    120, 120, 120, 120, 120, 120, 121, 122, 123, 124, 125, 64, 118, 124, 126,
-    126, 126, 126, 126, 126, 126, 126, 127, 126, 126, 126, 126, 126, 126,
-    126, 126, 126, 126, 128, 129, 130, 131, 132, 133, 134, 135, 78, 78, 136,
-    137, 120, 120, 120, 120, 120, 137, 120, 120, 137, 138, 138, 138, 138,
-    138, 138, 138, 138, 138, 138, 115, 139, 139, 118, 126, 126, 140, 126,
-    126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 118, 126, 120, 120,
-    120, 120, 120, 120, 120, 112, 119, 120, 120, 120, 120, 137, 120, 141,
-    141, 120, 120, 119, 137, 120, 120, 137, 126, 126, 142, 142, 142, 142,
-    142, 142, 142, 142, 142, 142, 126, 126, 126, 143, 143, 126, 144, 144,
-    144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 64, 145, 146,
-    147, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
-    146, 148, 149, 148, 148, 149, 148, 148, 149, 149, 149, 148, 149, 149,
-    148, 149, 148, 148, 148, 149, 148, 149, 148, 149, 148, 149, 148, 148, 64,
-    64, 146, 146, 146, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
-    150, 150, 150, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
-    150, 64, 64, 64, 64, 64, 64, 152, 152, 152, 152, 152, 152, 152, 152, 152,
-    152, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
-    153, 153, 153, 153, 154, 154, 154, 154, 154, 154, 154, 155, 154, 156,
-    156, 157, 158, 158, 158, 156, 64, 64, 64, 64, 64, 159, 159, 159, 159,
-    159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 160, 160, 160, 160,
-    161, 160, 160, 160, 160, 160, 160, 160, 160, 160, 161, 160, 160, 160,
-    161, 160, 160, 160, 160, 160, 64, 64, 162, 162, 162, 162, 162, 162, 162,
-    162, 162, 162, 162, 162, 162, 162, 162, 64, 163, 163, 163, 163, 163, 163,
-    163, 163, 163, 164, 164, 164, 64, 64, 165, 64, 126, 126, 126, 126, 126,
-    64, 64, 64, 64, 64, 64, 137, 120, 120, 137, 120, 120, 137, 120, 120, 120,
-    137, 137, 137, 166, 167, 168, 120, 120, 120, 137, 120, 120, 137, 137,
-    120, 120, 120, 120, 120, 169, 169, 169, 170, 171, 171, 171, 171, 171,
-    171, 171, 171, 171, 171, 171, 171, 171, 171, 169, 170, 172, 171, 170,
-    170, 170, 169, 169, 169, 169, 169, 169, 169, 169, 170, 170, 170, 170,
-    173, 170, 170, 171, 78, 136, 174, 174, 169, 169, 169, 171, 171, 169, 169,
-    84, 84, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 176, 177, 171,
-    171, 171, 171, 171, 171, 178, 179, 180, 180, 64, 178, 178, 178, 178, 178,
-    178, 178, 178, 64, 64, 178, 178, 64, 64, 178, 178, 178, 178, 178, 178,
-    178, 178, 178, 178, 178, 178, 178, 178, 64, 178, 178, 178, 178, 178, 178,
-    178, 64, 178, 64, 64, 64, 178, 178, 178, 178, 64, 64, 181, 178, 180, 180,
-    180, 179, 179, 179, 179, 64, 64, 180, 180, 64, 64, 180, 180, 182, 178,
-    64, 64, 64, 64, 64, 64, 64, 64, 180, 64, 64, 64, 64, 178, 178, 64, 178,
-    178, 178, 179, 179, 64, 64, 183, 183, 183, 183, 183, 183, 183, 183, 183,
-    183, 178, 178, 184, 184, 185, 185, 185, 185, 185, 185, 186, 184, 64, 64,
-    64, 64, 64, 187, 187, 188, 64, 189, 189, 189, 189, 189, 189, 64, 64, 64,
-    64, 189, 189, 64, 64, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
-    189, 189, 189, 189, 64, 189, 189, 189, 189, 189, 189, 189, 64, 189, 189,
-    64, 189, 189, 64, 189, 189, 64, 64, 190, 64, 188, 188, 188, 187, 187, 64,
-    64, 64, 64, 187, 187, 64, 64, 187, 187, 191, 64, 64, 64, 187, 64, 64, 64,
-    64, 64, 64, 64, 189, 189, 189, 189, 64, 189, 64, 64, 64, 64, 64, 64, 64,
-    192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 187, 187, 189, 189,
-    189, 187, 64, 64, 64, 193, 193, 194, 64, 195, 195, 195, 195, 195, 195,
-    195, 195, 195, 64, 195, 195, 195, 64, 195, 195, 195, 195, 195, 195, 195,
-    195, 195, 195, 195, 195, 195, 195, 64, 195, 195, 195, 195, 195, 195, 195,
-    64, 195, 195, 64, 195, 195, 195, 195, 195, 64, 64, 196, 195, 194, 194,
-    194, 193, 193, 193, 193, 193, 64, 193, 193, 194, 64, 194, 194, 197, 64,
-    64, 195, 64, 64, 64, 64, 64, 64, 64, 195, 195, 193, 193, 64, 64, 198,
-    198, 198, 198, 198, 198, 198, 198, 198, 198, 199, 200, 64, 64, 64, 64,
-    64, 64, 64, 195, 64, 64, 64, 64, 64, 64, 64, 201, 202, 202, 64, 203, 203,
-    203, 203, 203, 203, 203, 203, 64, 64, 203, 203, 64, 64, 203, 203, 203,
-    203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 64, 203, 203, 203,
-    203, 203, 203, 203, 64, 203, 203, 64, 203, 203, 203, 203, 203, 64, 64,
-    204, 203, 202, 201, 202, 201, 201, 201, 201, 64, 64, 202, 202, 64, 64,
-    202, 202, 205, 64, 64, 64, 64, 64, 64, 64, 64, 201, 202, 64, 64, 64, 64,
-    203, 203, 64, 203, 203, 203, 201, 201, 64, 64, 206, 206, 206, 206, 206,
-    206, 206, 206, 206, 206, 207, 203, 208, 208, 208, 208, 208, 208, 64, 64,
-    209, 210, 64, 210, 210, 210, 210, 210, 210, 64, 64, 64, 210, 210, 210,
-    64, 210, 210, 210, 210, 64, 64, 64, 210, 210, 64, 210, 64, 210, 210, 64,
-    64, 64, 210, 210, 64, 64, 64, 210, 210, 210, 210, 210, 210, 210, 210,
-    210, 210, 64, 64, 64, 64, 211, 211, 209, 211, 211, 64, 64, 64, 211, 211,
-    211, 64, 211, 211, 211, 212, 64, 64, 210, 64, 64, 64, 64, 64, 64, 211,
-    64, 64, 64, 64, 64, 64, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213,
-    214, 214, 214, 215, 215, 215, 215, 215, 215, 216, 215, 64, 64, 64, 64,
-    64, 217, 218, 218, 218, 64, 219, 219, 219, 219, 219, 219, 219, 219, 64,
-    219, 219, 219, 64, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219,
-    219, 219, 219, 219, 219, 64, 64, 64, 219, 217, 217, 217, 218, 218, 218,
-    218, 64, 217, 217, 217, 64, 217, 217, 217, 220, 64, 64, 64, 64, 64, 64,
-    64, 221, 222, 64, 219, 219, 219, 64, 64, 64, 64, 64, 219, 219, 217, 217,
-    64, 64, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 224, 224, 224,
-    224, 224, 224, 224, 225, 64, 226, 227, 227, 64, 228, 228, 228, 228, 228,
-    228, 228, 228, 64, 228, 228, 228, 64, 228, 228, 228, 228, 228, 228, 228,
-    228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 64, 228, 228, 228,
-    228, 228, 64, 64, 229, 228, 227, 230, 227, 227, 227, 227, 227, 64, 230,
-    227, 227, 64, 227, 227, 226, 231, 64, 64, 64, 64, 64, 64, 64, 227, 227,
-    64, 64, 64, 64, 64, 64, 64, 228, 64, 228, 228, 226, 226, 64, 64, 232,
-    232, 232, 232, 232, 232, 232, 232, 232, 232, 64, 228, 228, 64, 64, 64,
-    64, 64, 64, 233, 234, 234, 64, 235, 235, 235, 235, 235, 235, 235, 235,
-    64, 235, 235, 235, 64, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
-    235, 235, 235, 235, 235, 235, 235, 64, 64, 235, 234, 234, 234, 233, 233,
-    233, 233, 64, 234, 234, 234, 64, 234, 234, 234, 236, 235, 64, 64, 64, 64,
-    64, 64, 64, 64, 234, 64, 64, 64, 64, 64, 64, 64, 235, 235, 235, 233, 233,
-    64, 64, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 238, 238, 238,
-    238, 238, 238, 64, 64, 64, 239, 235, 235, 235, 235, 235, 235, 64, 64,
-    240, 240, 64, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241,
-    241, 241, 241, 241, 241, 241, 64, 64, 64, 241, 241, 241, 241, 241, 241,
-    241, 241, 64, 241, 241, 241, 241, 241, 241, 241, 241, 241, 64, 241, 64,
-    64, 64, 64, 242, 64, 64, 64, 64, 240, 240, 240, 243, 243, 243, 64, 243,
-    64, 240, 240, 240, 240, 240, 240, 240, 240, 64, 64, 64, 64, 64, 64, 244,
-    244, 244, 244, 244, 244, 244, 244, 244, 244, 64, 64, 240, 240, 245, 64,
-    64, 64, 64, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
-    246, 246, 246, 246, 247, 246, 246, 247, 247, 247, 247, 248, 248, 249, 64,
-    64, 64, 64, 250, 246, 246, 246, 246, 246, 246, 251, 247, 252, 252, 252,
-    252, 247, 247, 247, 253, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-    254, 253, 253, 64, 64, 64, 64, 64, 255, 255, 64, 255, 64, 64, 255, 255,
-    64, 255, 64, 64, 255, 64, 64, 64, 64, 64, 64, 255, 255, 255, 255, 64,
-    255, 255, 255, 255, 255, 255, 255, 64, 255, 255, 255, 64, 255, 64, 255,
-    64, 64, 255, 255, 64, 255, 255, 255, 255, 256, 255, 255, 256, 256, 256,
-    256, 257, 257, 64, 256, 256, 255, 64, 64, 255, 255, 255, 255, 255, 64,
-    258, 64, 259, 259, 259, 259, 256, 256, 64, 64, 260, 260, 260, 260, 260,
-    260, 260, 260, 260, 260, 64, 64, 255, 255, 255, 255, 261, 262, 262, 262,
-    263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263,
-    263, 262, 263, 262, 262, 262, 264, 264, 262, 262, 262, 262, 262, 262,
-    265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 266, 266, 266, 266,
-    266, 266, 266, 266, 266, 266, 262, 264, 262, 264, 262, 267, 268, 269,
-    268, 269, 270, 270, 261, 261, 261, 261, 261, 261, 261, 261, 64, 261, 261,
-    261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 64, 64, 64, 64, 271,
-    272, 273, 274, 273, 273, 273, 273, 273, 272, 272, 272, 272, 273, 270,
-    272, 273, 275, 275, 276, 263, 275, 275, 261, 261, 261, 261, 261, 273,
-    273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 64, 273, 273, 273, 273,
-    273, 273, 273, 273, 273, 273, 273, 273, 64, 262, 262, 262, 262, 262, 262,
-    262, 262, 264, 262, 262, 262, 262, 262, 262, 64, 262, 262, 263, 263, 263,
-    263, 263, 277, 277, 277, 277, 263, 263, 64, 64, 64, 64, 64, 278, 278,
-    278, 278, 278, 278, 278, 278, 278, 278, 278, 279, 279, 280, 280, 280,
-    280, 279, 280, 280, 280, 280, 280, 281, 279, 282, 282, 279, 279, 280,
-    280, 278, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 284, 284,
-    284, 284, 284, 284, 278, 278, 278, 278, 278, 278, 279, 279, 280, 280,
-    278, 278, 278, 278, 280, 280, 280, 278, 279, 279, 279, 278, 278, 279,
-    279, 279, 279, 279, 279, 279, 278, 278, 278, 280, 280, 280, 280, 278,
-    278, 278, 278, 278, 280, 279, 279, 280, 280, 279, 279, 279, 279, 279,
-    279, 285, 278, 279, 283, 283, 279, 279, 279, 280, 286, 286, 287, 287,
-    287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 64, 287, 64,
-    64, 64, 64, 64, 287, 64, 64, 288, 288, 288, 288, 288, 288, 288, 288, 288,
-    288, 288, 84, 289, 288, 288, 288, 290, 290, 290, 290, 290, 290, 290, 290,
-    291, 291, 291, 291, 291, 291, 291, 291, 292, 292, 292, 292, 292, 292,
-    292, 292, 292, 64, 292, 292, 292, 292, 64, 64, 292, 292, 292, 292, 292,
-    292, 292, 64, 292, 292, 292, 64, 64, 293, 293, 293, 294, 294, 294, 294,
-    294, 294, 294, 294, 294, 295, 295, 295, 295, 295, 295, 295, 295, 295,
-    295, 295, 295, 295, 295, 295, 295, 295, 295, 295, 295, 64, 64, 64, 296,
-    296, 296, 296, 296, 296, 296, 296, 296, 296, 64, 64, 64, 64, 64, 64, 297,
-    297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 64, 64,
-    298, 298, 298, 298, 298, 298, 64, 64, 299, 300, 300, 300, 300, 300, 300,
-    300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
-    301, 301, 300, 302, 303, 303, 303, 303, 303, 303, 303, 303, 303, 303,
-    303, 303, 303, 303, 303, 303, 303, 303, 304, 305, 64, 64, 64, 306, 306,
-    306, 306, 306, 306, 306, 306, 306, 306, 306, 84, 84, 84, 307, 307, 307,
-    306, 306, 306, 306, 306, 306, 306, 306, 64, 64, 64, 64, 64, 64, 64, 308,
-    308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 64, 308, 308,
-    308, 308, 309, 309, 310, 64, 64, 64, 311, 311, 311, 311, 311, 311, 311,
-    311, 311, 311, 312, 312, 313, 84, 84, 64, 314, 314, 314, 314, 314, 314,
-    314, 314, 314, 314, 315, 315, 64, 64, 64, 64, 316, 316, 316, 316, 316,
-    316, 316, 316, 316, 316, 316, 316, 316, 64, 316, 316, 316, 64, 317, 317,
-    64, 64, 64, 64, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
-    318, 319, 319, 320, 319, 319, 319, 319, 319, 319, 319, 320, 320, 320,
-    320, 320, 320, 320, 320, 319, 320, 320, 319, 319, 319, 319, 319, 319,
-    319, 319, 319, 321, 319, 322, 322, 322, 323, 322, 322, 322, 324, 318,
-    325, 64, 64, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 64, 64,
-    64, 64, 64, 64, 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, 64, 64,
-    64, 64, 64, 64, 328, 328, 66, 66, 328, 66, 329, 328, 328, 328, 328, 330,
-    330, 330, 331, 64, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 64,
-    64, 64, 64, 64, 64, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333,
-    333, 334, 333, 333, 333, 333, 333, 335, 333, 64, 64, 64, 64, 64, 300,
-    300, 300, 300, 300, 300, 64, 64, 336, 336, 336, 336, 336, 336, 336, 336,
-    336, 336, 336, 336, 336, 336, 336, 64, 337, 337, 337, 338, 338, 338, 338,
-    337, 337, 338, 338, 338, 64, 64, 64, 64, 338, 338, 337, 338, 338, 338,
-    338, 338, 338, 339, 340, 341, 64, 64, 64, 64, 342, 64, 64, 64, 343, 343,
-    344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 345, 345, 345, 345,
-    345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 64, 64, 345, 345, 345,
-    345, 345, 64, 64, 64, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
-    346, 346, 64, 64, 64, 64, 346, 346, 64, 64, 64, 64, 64, 64, 347, 347,
-    347, 347, 347, 347, 347, 347, 347, 347, 348, 64, 64, 64, 349, 349, 350,
-    350, 350, 350, 350, 350, 350, 350, 351, 351, 351, 351, 351, 351, 351,
-    351, 351, 351, 351, 351, 351, 351, 351, 352, 353, 354, 354, 355, 64, 64,
-    356, 356, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357,
-    357, 358, 359, 358, 359, 359, 359, 359, 359, 359, 359, 64, 360, 358, 359,
-    358, 358, 359, 359, 359, 359, 359, 359, 359, 359, 358, 358, 358, 358,
-    358, 358, 359, 359, 361, 361, 361, 361, 361, 361, 361, 361, 64, 64, 362,
-    363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 64, 64, 64, 64, 64, 64,
-    364, 364, 364, 364, 364, 364, 364, 365, 364, 364, 364, 364, 364, 364, 64,
-    64, 78, 78, 78, 78, 78, 136, 136, 136, 136, 136, 136, 78, 78, 136, 366,
-    64, 367, 367, 367, 367, 368, 369, 369, 369, 369, 369, 369, 369, 369, 369,
-    369, 369, 369, 369, 369, 369, 370, 368, 367, 367, 367, 367, 367, 368,
-    367, 368, 368, 368, 368, 368, 367, 368, 371, 369, 369, 369, 369, 369,
-    369, 369, 64, 64, 64, 64, 372, 372, 372, 372, 372, 372, 372, 372, 372,
-    372, 373, 373, 373, 373, 373, 373, 373, 374, 374, 374, 374, 374, 374,
-    374, 374, 374, 374, 375, 376, 375, 375, 375, 375, 375, 375, 375, 374,
-    374, 374, 374, 374, 374, 374, 374, 374, 64, 64, 64, 377, 377, 378, 379,
-    379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 378,
-    377, 377, 377, 377, 378, 378, 377, 377, 380, 381, 377, 377, 379, 379,
-    382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 379, 379, 379, 379,
-    379, 379, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
-    383, 383, 384, 385, 386, 386, 385, 385, 385, 386, 385, 386, 386, 386,
-    387, 387, 64, 64, 64, 64, 64, 64, 64, 64, 388, 388, 388, 388, 389, 389,
-    389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 390, 390, 390, 390,
-    390, 390, 390, 390, 391, 391, 391, 391, 391, 391, 391, 391, 390, 390,
-    391, 392, 64, 64, 64, 393, 393, 393, 393, 393, 394, 394, 394, 394, 394,
-    394, 394, 394, 394, 394, 64, 64, 64, 389, 389, 389, 395, 395, 395, 395,
-    395, 395, 395, 395, 395, 395, 396, 396, 396, 396, 396, 396, 396, 396,
-    396, 396, 396, 396, 396, 396, 397, 397, 397, 397, 397, 397, 398, 398,
-    399, 399, 399, 399, 399, 399, 399, 399, 78, 78, 78, 84, 400, 136, 136,
-    136, 136, 136, 78, 78, 136, 136, 136, 136, 78, 401, 400, 400, 400, 400,
-    400, 400, 400, 402, 402, 402, 402, 136, 402, 402, 402, 402, 401, 401, 78,
-    402, 402, 64, 78, 78, 64, 64, 64, 64, 64, 64, 41, 41, 41, 41, 41, 41, 62,
-    62, 62, 62, 62, 75, 44, 44, 44, 44, 44, 44, 44, 44, 44, 65, 65, 65, 65,
-    65, 44, 44, 44, 44, 65, 65, 65, 65, 65, 41, 41, 41, 41, 41, 403, 41, 41,
-    41, 41, 41, 41, 41, 41, 41, 41, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
-    44, 44, 65, 78, 78, 136, 78, 78, 78, 78, 78, 78, 78, 136, 78, 78, 404,
-    405, 136, 406, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
-    78, 78, 78, 78, 78, 78, 78, 64, 64, 64, 64, 64, 64, 407, 136, 78, 136,
-    37, 41, 37, 41, 37, 41, 41, 41, 41, 41, 41, 41, 41, 41, 37, 41, 62, 62,
-    62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 61, 62, 62, 62, 62,
-    62, 62, 64, 64, 61, 61, 61, 61, 61, 61, 64, 64, 64, 61, 64, 61, 64, 61,
-    64, 61, 408, 408, 408, 408, 408, 408, 408, 408, 62, 62, 62, 62, 62, 64,
-    62, 62, 61, 61, 61, 61, 408, 63, 62, 63, 63, 63, 62, 62, 62, 64, 62, 62,
-    61, 61, 61, 61, 408, 63, 63, 63, 62, 62, 62, 62, 64, 64, 62, 62, 61, 61,
-    61, 61, 64, 63, 63, 63, 61, 61, 61, 61, 61, 63, 63, 63, 64, 64, 62, 62,
-    62, 64, 62, 62, 61, 61, 61, 61, 408, 63, 63, 64, 409, 409, 409, 409, 409,
-    409, 409, 409, 409, 409, 409, 410, 411, 411, 412, 413, 414, 415, 415,
-    414, 414, 414, 22, 66, 416, 417, 418, 419, 416, 417, 418, 419, 22, 22,
-    22, 66, 22, 22, 22, 22, 420, 421, 422, 423, 424, 425, 426, 21, 427, 428,
-    427, 427, 428, 22, 66, 66, 66, 28, 35, 22, 66, 66, 22, 429, 429, 66, 66,
-    66, 430, 431, 432, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 433, 66,
-    429, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 409, 410, 410, 410, 410,
-    410, 64, 434, 435, 436, 437, 410, 410, 410, 410, 410, 410, 438, 44, 64,
-    64, 33, 438, 438, 438, 438, 438, 439, 439, 433, 431, 432, 440, 438, 33,
-    33, 33, 33, 438, 438, 438, 438, 438, 439, 439, 433, 431, 432, 64, 44, 44,
-    44, 44, 44, 64, 64, 64, 250, 250, 250, 250, 250, 250, 250, 250, 250, 441,
-    250, 250, 23, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 64, 78,
-    78, 400, 400, 78, 78, 78, 78, 400, 400, 400, 78, 78, 366, 366, 366, 366,
-    78, 366, 366, 366, 400, 400, 78, 136, 78, 400, 400, 136, 136, 136, 136,
-    78, 64, 64, 64, 64, 64, 64, 64, 26, 26, 442, 30, 26, 30, 26, 442, 26, 30,
-    34, 442, 442, 442, 34, 34, 442, 442, 442, 443, 26, 442, 30, 26, 433, 442,
-    442, 442, 442, 442, 26, 26, 26, 30, 30, 26, 442, 26, 67, 26, 442, 26, 37,
-    38, 442, 442, 444, 34, 442, 442, 37, 442, 34, 402, 402, 402, 402, 34, 26,
-    26, 34, 34, 442, 442, 445, 433, 433, 433, 433, 442, 34, 34, 34, 34, 26,
-    433, 26, 26, 41, 277, 446, 446, 446, 36, 36, 446, 446, 446, 446, 446,
-    446, 36, 36, 36, 36, 446, 447, 447, 447, 447, 447, 447, 447, 447, 447,
-    447, 447, 447, 448, 448, 448, 448, 447, 447, 448, 448, 448, 448, 448,
-    448, 448, 448, 448, 37, 41, 448, 448, 448, 448, 36, 26, 26, 64, 64, 64,
-    64, 39, 39, 39, 39, 39, 30, 30, 30, 30, 30, 433, 433, 26, 26, 26, 26,
-    433, 26, 26, 433, 26, 26, 433, 26, 26, 26, 26, 26, 26, 26, 433, 26, 26,
-    26, 26, 26, 26, 26, 26, 26, 30, 30, 26, 26, 26, 26, 26, 26, 26, 26, 26,
-    26, 26, 26, 433, 433, 26, 26, 39, 26, 39, 26, 26, 26, 26, 26, 26, 26, 26,
-    26, 26, 30, 26, 26, 26, 26, 433, 433, 433, 433, 433, 433, 433, 433, 433,
-    433, 433, 433, 39, 445, 449, 449, 445, 433, 433, 39, 449, 445, 445, 449,
-    445, 445, 433, 39, 433, 449, 439, 450, 433, 449, 445, 433, 433, 433, 449,
-    445, 445, 449, 39, 449, 449, 445, 445, 39, 445, 39, 445, 39, 39, 39, 39,
-    449, 449, 445, 449, 445, 445, 445, 445, 445, 39, 39, 39, 39, 433, 445,
-    433, 445, 449, 449, 445, 445, 445, 445, 445, 445, 445, 445, 445, 445,
-    449, 445, 445, 445, 449, 433, 433, 433, 433, 433, 449, 445, 445, 445,
-    433, 433, 433, 433, 433, 433, 433, 433, 433, 445, 449, 39, 445, 433, 449,
-    449, 449, 449, 445, 445, 449, 449, 433, 433, 449, 449, 445, 445, 449,
-    449, 445, 445, 449, 449, 445, 445, 445, 445, 445, 433, 433, 445, 445,
-    445, 445, 433, 433, 39, 433, 433, 445, 39, 433, 433, 433, 433, 433, 433,
-    433, 433, 445, 445, 433, 39, 445, 445, 445, 433, 433, 433, 433, 433, 445,
-    449, 433, 445, 445, 445, 445, 445, 433, 433, 445, 445, 433, 433, 433,
-    433, 445, 445, 445, 445, 445, 445, 445, 445, 433, 433, 431, 432, 431,
-    432, 26, 26, 26, 26, 26, 26, 30, 26, 26, 26, 26, 26, 445, 445, 26, 26,
-    26, 26, 26, 26, 26, 451, 452, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
-    277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 26, 433,
-    26, 26, 26, 26, 26, 26, 26, 26, 277, 26, 26, 26, 26, 26, 433, 433, 433,
-    433, 433, 433, 433, 433, 433, 26, 26, 26, 26, 433, 433, 26, 26, 26, 26,
-    26, 26, 26, 26, 26, 64, 64, 64, 64, 64, 26, 26, 26, 26, 26, 26, 26, 64,
-    36, 36, 36, 36, 36, 36, 36, 36, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
-    33, 33, 453, 453, 453, 453, 453, 453, 453, 453, 453, 453, 453, 453, 453,
-    453, 446, 36, 36, 36, 36, 36, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
-    30, 26, 26, 26, 26, 26, 26, 30, 30, 30, 30, 26, 26, 30, 30, 26, 30, 30,
-    30, 30, 30, 26, 26, 30, 30, 26, 26, 30, 39, 26, 26, 26, 26, 30, 30, 26,
-    26, 30, 39, 26, 26, 26, 26, 30, 30, 30, 26, 26, 30, 26, 26, 30, 30, 26,
-    26, 26, 26, 26, 30, 30, 26, 26, 30, 26, 26, 26, 26, 30, 30, 26, 26, 26,
-    26, 30, 26, 30, 26, 30, 26, 30, 26, 26, 26, 26, 26, 30, 30, 26, 30, 30,
-    30, 26, 30, 30, 30, 30, 26, 30, 30, 26, 39, 26, 26, 26, 26, 26, 26, 30,
-    30, 26, 26, 26, 26, 277, 26, 26, 26, 26, 26, 26, 26, 30, 30, 30, 30, 30,
-    30, 30, 30, 30, 30, 26, 30, 30, 30, 26, 30, 26, 26, 26, 26, 26, 26, 26,
-    26, 26, 30, 26, 26, 431, 432, 431, 432, 431, 432, 431, 432, 431, 432,
-    431, 432, 431, 432, 36, 36, 446, 446, 446, 446, 446, 446, 446, 446, 446,
-    446, 446, 446, 26, 26, 26, 26, 445, 433, 433, 445, 445, 431, 432, 433,
-    445, 445, 433, 445, 445, 445, 433, 433, 433, 433, 433, 445, 445, 445,
-    445, 433, 433, 433, 433, 433, 445, 445, 445, 433, 433, 433, 445, 445,
-    445, 445, 9, 10, 9, 10, 9, 10, 9, 10, 431, 432, 454, 454, 454, 454, 454,
-    454, 454, 454, 433, 433, 433, 431, 432, 9, 10, 431, 432, 431, 432, 431,
-    432, 431, 432, 431, 432, 433, 433, 445, 445, 445, 445, 445, 445, 433,
-    433, 433, 433, 433, 433, 433, 433, 445, 433, 433, 433, 433, 445, 445,
-    445, 445, 445, 433, 445, 445, 433, 433, 431, 432, 431, 432, 445, 433,
-    433, 433, 433, 445, 433, 445, 445, 445, 433, 433, 445, 445, 433, 433,
-    433, 433, 433, 433, 433, 433, 433, 433, 445, 445, 445, 445, 445, 445,
-    433, 433, 431, 432, 433, 433, 433, 433, 445, 445, 445, 445, 445, 445,
-    445, 445, 445, 445, 445, 433, 445, 445, 445, 445, 433, 433, 445, 433,
-    445, 433, 433, 445, 433, 445, 445, 445, 445, 433, 433, 433, 433, 433,
-    445, 445, 433, 433, 433, 433, 445, 445, 445, 445, 433, 445, 445, 433,
-    433, 445, 445, 433, 433, 433, 433, 445, 445, 445, 445, 445, 445, 445,
-    445, 445, 445, 445, 433, 433, 445, 445, 445, 445, 445, 445, 445, 445,
-    433, 445, 445, 445, 445, 445, 445, 445, 445, 433, 433, 433, 433, 433,
-    445, 433, 445, 433, 433, 433, 445, 445, 445, 445, 445, 433, 433, 433,
-    433, 445, 433, 433, 433, 445, 445, 445, 445, 445, 433, 445, 433, 433,
-    433, 433, 433, 433, 433, 26, 26, 433, 433, 433, 433, 433, 433, 26, 26,
-    26, 26, 26, 26, 26, 26, 30, 30, 30, 26, 26, 26, 26, 64, 64, 26, 26, 26,
-    26, 26, 26, 26, 26, 64, 64, 26, 26, 64, 64, 64, 26, 26, 26, 26, 64, 26,
-    26, 26, 26, 26, 26, 26, 26, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 26,
-    26, 26, 26, 455, 455, 455, 455, 455, 455, 455, 455, 455, 455, 455, 455,
-    455, 455, 455, 64, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456,
-    456, 456, 456, 456, 64, 37, 41, 37, 37, 37, 41, 41, 37, 41, 37, 41, 37,
-    41, 37, 37, 37, 37, 41, 37, 41, 41, 37, 41, 41, 41, 41, 41, 41, 44, 44,
-    37, 37, 69, 70, 69, 70, 70, 457, 457, 457, 457, 457, 457, 69, 70, 69, 70,
-    458, 458, 458, 69, 70, 64, 64, 64, 64, 64, 459, 459, 459, 459, 460, 459,
-    459, 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, 461,
-    461, 64, 461, 64, 64, 64, 64, 64, 461, 64, 64, 462, 462, 462, 462, 462,
-    462, 462, 462, 64, 64, 64, 64, 64, 64, 64, 463, 464, 64, 64, 64, 64, 64,
-    64, 64, 64, 64, 64, 64, 64, 64, 64, 465, 77, 77, 77, 77, 77, 77, 77, 77,
-    66, 66, 28, 35, 28, 35, 66, 66, 66, 28, 35, 66, 28, 35, 66, 66, 66, 66,
-    66, 66, 66, 66, 66, 415, 66, 66, 415, 66, 28, 35, 66, 66, 28, 35, 431,
-    432, 431, 432, 431, 432, 431, 432, 66, 66, 66, 66, 66, 45, 66, 66, 415,
-    415, 66, 66, 66, 66, 415, 66, 418, 64, 64, 64, 64, 64, 466, 466, 466,
-    466, 466, 466, 466, 466, 466, 466, 64, 466, 466, 466, 466, 466, 466, 466,
-    466, 466, 64, 64, 64, 64, 466, 466, 466, 466, 466, 466, 64, 64, 467, 467,
-    467, 467, 467, 467, 467, 467, 467, 467, 467, 467, 64, 64, 64, 64, 468,
-    469, 469, 469, 467, 470, 471, 472, 451, 452, 451, 452, 451, 452, 451,
-    452, 451, 452, 467, 467, 451, 452, 451, 452, 451, 452, 451, 452, 473,
-    474, 475, 475, 467, 472, 472, 472, 472, 472, 472, 472, 472, 472, 476,
-    477, 478, 479, 480, 480, 473, 481, 481, 481, 481, 481, 467, 467, 472,
-    472, 472, 470, 471, 469, 467, 26, 64, 482, 482, 482, 482, 482, 482, 482,
-    482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482,
-    482, 64, 64, 483, 483, 484, 484, 485, 485, 482, 473, 486, 486, 486, 486,
-    486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486,
-    469, 481, 487, 487, 486, 64, 64, 64, 64, 64, 488, 488, 488, 488, 488,
-    488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 64, 64, 64,
-    290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 64,
-    489, 489, 490, 490, 490, 490, 489, 489, 489, 489, 489, 489, 489, 489,
-    489, 489, 488, 488, 488, 64, 64, 64, 64, 64, 491, 491, 491, 491, 491,
-    491, 491, 491, 491, 491, 491, 491, 491, 492, 492, 64, 490, 490, 490, 490,
-    490, 490, 490, 490, 490, 490, 489, 489, 489, 489, 489, 489, 493, 493,
-    493, 493, 493, 493, 493, 493, 467, 494, 494, 494, 494, 494, 494, 494,
-    494, 494, 494, 494, 494, 494, 494, 494, 491, 491, 491, 491, 492, 492,
-    492, 489, 489, 494, 494, 494, 494, 494, 494, 494, 489, 489, 489, 489,
-    467, 467, 467, 467, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495,
-    495, 495, 495, 495, 495, 64, 489, 489, 489, 489, 489, 489, 489, 467, 467,
-    467, 467, 489, 489, 489, 489, 489, 489, 489, 489, 489, 489, 489, 467,
-    467, 496, 496, 496, 496, 496, 496, 496, 496, 496, 496, 496, 496, 496,
-    496, 497, 497, 497, 497, 497, 497, 497, 497, 497, 497, 498, 498, 498,
-    498, 498, 498, 498, 498, 498, 498, 498, 498, 498, 499, 498, 498, 498,
-    498, 498, 498, 498, 64, 64, 64, 500, 500, 500, 500, 500, 500, 500, 500,
-    500, 500, 500, 500, 500, 500, 500, 64, 501, 501, 501, 501, 501, 501, 501,
-    501, 502, 502, 502, 502, 502, 502, 503, 503, 504, 504, 504, 504, 504,
-    504, 504, 504, 504, 504, 504, 504, 505, 506, 506, 506, 507, 507, 507,
-    507, 507, 507, 507, 507, 507, 507, 504, 504, 64, 64, 64, 64, 72, 75, 72,
-    75, 72, 75, 508, 77, 79, 79, 79, 509, 77, 77, 77, 77, 77, 77, 77, 77, 77,
-    77, 509, 510, 72, 75, 72, 75, 403, 403, 77, 77, 511, 511, 511, 511, 511,
-    511, 511, 511, 511, 511, 511, 511, 511, 511, 512, 512, 512, 512, 512,
-    512, 512, 512, 512, 512, 513, 513, 514, 514, 514, 514, 514, 514, 47, 47,
-    47, 47, 47, 47, 47, 45, 45, 45, 45, 45, 45, 45, 45, 45, 47, 47, 37, 41,
-    37, 41, 37, 41, 41, 41, 37, 41, 37, 41, 37, 41, 44, 41, 41, 41, 41, 41,
-    41, 41, 41, 37, 41, 37, 41, 37, 37, 41, 45, 515, 515, 37, 41, 37, 41, 42,
-    37, 41, 37, 41, 41, 41, 37, 41, 37, 41, 37, 37, 37, 37, 64, 64, 37, 37,
-    37, 37, 37, 41, 37, 41, 64, 64, 64, 64, 64, 64, 64, 42, 44, 44, 41, 42,
-    42, 42, 42, 42, 516, 516, 517, 516, 516, 516, 518, 516, 516, 516, 516,
-    517, 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, 516,
-    516, 516, 519, 519, 517, 517, 519, 520, 520, 520, 520, 64, 64, 64, 64,
-    521, 521, 521, 521, 521, 521, 277, 277, 250, 444, 64, 64, 64, 64, 64, 64,
-    522, 522, 522, 522, 522, 522, 522, 522, 522, 522, 522, 522, 523, 523,
-    523, 523, 524, 524, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525,
-    525, 525, 525, 525, 525, 525, 525, 525, 524, 524, 524, 524, 524, 524,
-    524, 524, 524, 524, 524, 524, 524, 524, 524, 524, 526, 64, 64, 64, 64,
-    64, 64, 64, 64, 64, 527, 527, 528, 528, 528, 528, 528, 528, 528, 528,
-    528, 528, 64, 64, 64, 64, 64, 64, 174, 174, 174, 174, 174, 174, 174, 174,
-    174, 174, 171, 171, 171, 171, 171, 171, 176, 176, 176, 171, 176, 171, 64,
-    64, 529, 529, 529, 529, 529, 529, 529, 529, 529, 529, 530, 530, 530, 530,
-    530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 530,
-    530, 530, 531, 531, 531, 531, 531, 532, 532, 532, 84, 533, 534, 534, 534,
-    534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 535, 535,
-    535, 535, 535, 535, 535, 535, 535, 535, 535, 536, 537, 64, 64, 64, 64,
-    64, 64, 64, 64, 64, 64, 64, 538, 290, 290, 290, 290, 290, 64, 64, 64,
-    539, 539, 539, 540, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541,
-    541, 541, 541, 541, 541, 542, 540, 540, 539, 539, 539, 539, 540, 540,
-    539, 540, 540, 540, 543, 544, 544, 544, 544, 544, 544, 544, 544, 544,
-    544, 544, 544, 544, 64, 46, 545, 545, 545, 545, 545, 545, 545, 545, 545,
-    545, 64, 64, 64, 64, 544, 544, 278, 278, 278, 278, 278, 280, 546, 278,
-    283, 283, 278, 278, 278, 278, 278, 64, 547, 547, 547, 547, 547, 547, 547,
-    547, 547, 548, 548, 548, 548, 548, 548, 549, 549, 548, 548, 549, 549,
-    548, 548, 64, 547, 547, 547, 548, 547, 547, 547, 547, 547, 547, 547, 547,
-    548, 549, 64, 64, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 64,
-    64, 551, 551, 551, 551, 546, 278, 278, 278, 278, 278, 278, 286, 286, 286,
-    278, 279, 280, 279, 278, 278, 552, 552, 552, 552, 552, 552, 552, 552,
-    553, 552, 553, 553, 554, 552, 552, 553, 553, 552, 552, 552, 552, 552,
-    553, 553, 552, 553, 552, 64, 64, 64, 64, 64, 64, 64, 64, 552, 552, 555,
-    556, 556, 557, 557, 557, 557, 557, 557, 557, 557, 557, 557, 557, 558,
-    559, 559, 558, 558, 560, 560, 557, 561, 561, 558, 562, 64, 64, 292, 292,
-    292, 292, 292, 292, 64, 41, 41, 41, 515, 44, 44, 44, 44, 41, 41, 41, 41,
-    41, 62, 64, 64, 298, 298, 298, 298, 298, 298, 298, 298, 557, 557, 557,
-    558, 558, 559, 558, 558, 559, 558, 558, 560, 558, 562, 64, 64, 563, 563,
-    563, 563, 563, 563, 563, 563, 563, 563, 64, 64, 64, 64, 64, 64, 290, 290,
-    290, 290, 64, 64, 64, 64, 291, 291, 291, 291, 291, 291, 291, 64, 64, 64,
-    64, 291, 291, 291, 291, 291, 291, 291, 291, 291, 64, 64, 64, 64, 564,
-    564, 564, 564, 564, 564, 564, 564, 565, 565, 565, 565, 565, 565, 565,
-    565, 496, 496, 497, 497, 497, 497, 497, 497, 41, 41, 41, 41, 41, 41, 41,
-    64, 64, 64, 64, 83, 83, 83, 83, 83, 64, 64, 64, 64, 64, 110, 566, 110,
-    110, 567, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
-    110, 64, 110, 110, 110, 110, 110, 64, 110, 64, 110, 110, 64, 110, 110,
-    64, 110, 110, 126, 126, 568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
-    568, 568, 568, 568, 568, 568, 64, 64, 64, 64, 64, 64, 64, 64, 64, 126,
-    126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 569, 418, 64, 64, 126,
-    126, 126, 126, 126, 126, 126, 126, 126, 126, 116, 119, 64, 64, 58, 58,
-    58, 58, 58, 58, 58, 58, 469, 469, 469, 469, 469, 469, 469, 474, 475, 469,
-    64, 64, 64, 64, 64, 64, 78, 78, 78, 78, 78, 78, 78, 136, 136, 136, 136,
-    136, 136, 136, 77, 77, 469, 473, 473, 570, 570, 474, 475, 474, 475, 474,
-    475, 474, 475, 474, 475, 474, 475, 474, 475, 474, 475, 469, 469, 474,
-    475, 469, 469, 469, 469, 570, 570, 570, 571, 469, 571, 64, 469, 571, 469,
-    469, 473, 451, 452, 451, 452, 451, 452, 572, 469, 469, 573, 574, 575,
-    575, 576, 64, 469, 577, 572, 469, 64, 64, 64, 64, 126, 126, 126, 126,
-    126, 64, 126, 126, 126, 126, 126, 126, 126, 64, 64, 410, 64, 578, 578,
-    579, 580, 579, 578, 578, 581, 582, 578, 583, 584, 585, 584, 584, 586,
-    586, 586, 586, 586, 586, 586, 586, 586, 586, 584, 578, 587, 588, 587,
-    578, 578, 589, 589, 589, 589, 589, 589, 589, 589, 589, 589, 589, 589,
-    589, 589, 589, 589, 589, 589, 581, 578, 582, 590, 591, 590, 592, 592,
-    592, 592, 592, 592, 592, 592, 592, 592, 592, 592, 592, 592, 592, 592,
-    592, 592, 581, 588, 582, 588, 581, 582, 593, 594, 595, 593, 593, 596,
-    596, 596, 596, 596, 596, 596, 596, 596, 596, 597, 596, 596, 596, 596,
-    596, 596, 596, 596, 596, 596, 596, 596, 596, 597, 597, 598, 598, 598,
-    598, 598, 598, 598, 598, 598, 598, 598, 598, 598, 598, 598, 64, 64, 64,
-    598, 598, 598, 598, 598, 598, 64, 64, 598, 598, 598, 64, 64, 64, 580,
-    580, 588, 590, 599, 580, 580, 64, 600, 601, 601, 601, 601, 600, 600, 64,
-    64, 602, 602, 602, 26, 30, 64, 64, 603, 603, 603, 603, 603, 603, 603,
-    603, 603, 603, 603, 603, 64, 603, 603, 603, 603, 603, 603, 603, 603, 603,
-    603, 64, 603, 603, 603, 64, 603, 603, 64, 603, 603, 603, 603, 603, 603,
-    603, 64, 64, 603, 603, 603, 64, 64, 64, 64, 64, 84, 66, 84, 64, 64, 64,
-    64, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 64,
-    64, 64, 277, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604,
-    604, 605, 605, 605, 605, 606, 606, 606, 606, 606, 606, 606, 606, 606,
-    606, 606, 606, 606, 606, 606, 606, 606, 605, 605, 606, 64, 64, 64, 26,
-    26, 26, 26, 64, 64, 64, 64, 606, 64, 64, 64, 64, 64, 64, 64, 277, 277,
-    277, 277, 277, 136, 64, 64, 607, 607, 607, 607, 607, 607, 607, 607, 607,
-    607, 607, 607, 607, 64, 64, 64, 608, 608, 608, 608, 608, 608, 608, 608,
-    608, 64, 64, 64, 64, 64, 64, 64, 136, 438, 438, 438, 438, 438, 438, 438,
-    438, 438, 438, 438, 438, 438, 438, 438, 438, 438, 438, 438, 64, 64, 64,
-    64, 609, 609, 609, 609, 609, 609, 609, 609, 610, 610, 610, 610, 64, 64,
-    64, 64, 611, 611, 611, 611, 611, 611, 611, 611, 611, 612, 611, 611, 611,
-    611, 611, 611, 611, 611, 612, 64, 64, 64, 64, 64, 613, 613, 613, 613,
-    613, 613, 613, 613, 613, 613, 613, 613, 613, 613, 614, 614, 614, 614,
-    614, 64, 64, 64, 64, 64, 615, 615, 615, 615, 615, 615, 615, 615, 615,
-    615, 615, 615, 615, 615, 64, 616, 617, 617, 617, 617, 617, 617, 617, 617,
-    617, 617, 617, 617, 64, 64, 64, 64, 618, 619, 619, 619, 619, 619, 64, 64,
-    620, 620, 620, 620, 620, 620, 620, 620, 621, 621, 621, 621, 621, 621,
-    621, 621, 622, 622, 622, 622, 622, 622, 622, 622, 623, 623, 623, 623,
-    623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 64, 64, 624, 624, 624,
-    624, 624, 624, 624, 624, 624, 624, 64, 64, 64, 64, 64, 64, 625, 625, 625,
-    625, 625, 625, 625, 625, 626, 626, 626, 626, 626, 626, 626, 626, 626,
-    626, 626, 626, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 627, 628, 628,
-    628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 64, 628,
-    628, 628, 628, 628, 628, 64, 64, 629, 629, 629, 629, 629, 629, 64, 64,
-    629, 64, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629,
-    629, 629, 629, 629, 629, 629, 629, 64, 629, 629, 64, 64, 64, 629, 64, 64,
-    629, 630, 630, 630, 630, 630, 630, 630, 630, 630, 630, 630, 630, 630,
-    630, 64, 631, 632, 632, 632, 632, 632, 632, 632, 632, 633, 633, 633, 633,
-    633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 634, 634, 635,
-    635, 635, 635, 635, 635, 635, 636, 636, 636, 636, 636, 636, 636, 636,
-    636, 636, 636, 636, 636, 636, 636, 64, 64, 64, 64, 64, 64, 64, 64, 637,
-    637, 637, 637, 637, 637, 637, 637, 637, 638, 638, 638, 638, 638, 638,
-    638, 638, 638, 638, 638, 64, 638, 638, 64, 64, 64, 64, 64, 639, 639, 639,
-    639, 639, 640, 640, 640, 640, 640, 640, 640, 640, 640, 640, 640, 640,
-    640, 640, 641, 641, 641, 641, 641, 641, 64, 64, 64, 642, 643, 643, 643,
-    643, 643, 643, 643, 643, 643, 643, 64, 64, 64, 64, 64, 644, 645, 645,
-    645, 645, 645, 645, 645, 645, 646, 646, 646, 646, 646, 646, 646, 646, 64,
-    64, 64, 64, 647, 647, 646, 646, 647, 647, 647, 647, 647, 647, 647, 647,
-    64, 64, 647, 647, 647, 647, 647, 647, 648, 649, 649, 649, 64, 649, 649,
-    64, 64, 64, 64, 64, 649, 650, 649, 651, 648, 648, 648, 648, 64, 648, 648,
-    648, 64, 648, 648, 648, 648, 648, 648, 648, 648, 648, 648, 648, 648, 648,
-    648, 648, 648, 648, 648, 648, 64, 64, 64, 64, 651, 652, 650, 64, 64, 64,
-    64, 653, 654, 654, 654, 654, 654, 654, 654, 654, 655, 655, 655, 655, 655,
-    655, 655, 655, 655, 64, 64, 64, 64, 64, 64, 64, 656, 656, 656, 656, 656,
-    656, 656, 656, 656, 656, 656, 656, 656, 657, 657, 658, 659, 659, 659,
-    659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 660, 660, 660, 661,
-    661, 661, 661, 661, 661, 661, 661, 662, 661, 661, 661, 661, 661, 661,
-    661, 661, 661, 661, 661, 661, 663, 664, 64, 64, 64, 64, 665, 665, 665,
-    665, 665, 666, 666, 666, 666, 666, 666, 666, 64, 667, 667, 667, 667, 667,
-    667, 667, 667, 667, 667, 667, 667, 667, 667, 64, 64, 64, 668, 668, 668,
-    668, 668, 668, 668, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669,
-    669, 669, 669, 669, 64, 64, 670, 670, 670, 670, 670, 670, 670, 670, 671,
-    671, 671, 671, 671, 671, 671, 671, 671, 671, 671, 64, 64, 64, 64, 64,
-    672, 672, 672, 672, 672, 672, 672, 672, 673, 673, 673, 673, 673, 673,
-    673, 673, 673, 673, 64, 64, 64, 64, 64, 64, 64, 674, 674, 674, 674, 64,
-    64, 64, 64, 675, 675, 675, 675, 675, 675, 675, 676, 676, 676, 676, 676,
-    676, 676, 676, 676, 64, 64, 64, 64, 64, 64, 64, 677, 677, 677, 677, 677,
-    677, 677, 677, 677, 677, 677, 64, 64, 64, 64, 64, 678, 678, 678, 678,
-    678, 678, 678, 678, 678, 678, 678, 64, 64, 64, 64, 64, 64, 64, 679, 679,
-    679, 679, 679, 679, 680, 680, 680, 680, 680, 680, 680, 680, 680, 680,
-    680, 680, 680, 680, 680, 64, 681, 682, 681, 683, 683, 683, 683, 683, 683,
-    683, 683, 683, 683, 683, 683, 683, 682, 682, 682, 682, 682, 682, 682,
-    682, 682, 682, 682, 682, 682, 682, 684, 685, 685, 685, 685, 685, 685,
-    685, 64, 64, 64, 64, 686, 686, 686, 686, 686, 686, 686, 686, 686, 686,
-    686, 686, 686, 686, 686, 686, 686, 686, 686, 686, 687, 687, 687, 687,
-    687, 687, 687, 687, 687, 687, 64, 64, 64, 64, 64, 64, 64, 684, 688, 688,
-    689, 690, 690, 690, 690, 690, 690, 690, 690, 690, 690, 690, 690, 690,
-    689, 689, 689, 688, 688, 688, 688, 689, 689, 691, 692, 693, 693, 694,
-    693, 693, 693, 693, 64, 64, 64, 64, 64, 64, 695, 695, 695, 695, 695, 695,
-    695, 695, 695, 64, 64, 64, 64, 64, 64, 64, 696, 696, 696, 696, 696, 696,
-    696, 696, 696, 696, 64, 64, 64, 64, 64, 64, 697, 697, 697, 698, 698, 698,
-    698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698,
-    698, 698, 698, 699, 699, 699, 699, 699, 700, 699, 699, 699, 699, 699,
-    699, 701, 701, 64, 702, 702, 702, 702, 702, 702, 702, 702, 702, 702, 703,
-    703, 703, 703, 64, 64, 64, 64, 704, 704, 704, 704, 704, 704, 704, 704,
-    704, 704, 704, 705, 706, 706, 704, 64, 707, 707, 708, 709, 709, 709, 709,
-    709, 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, 708, 708,
-    708, 707, 707, 707, 707, 707, 707, 707, 707, 707, 708, 710, 709, 709,
-    709, 709, 711, 711, 711, 711, 711, 712, 707, 707, 711, 64, 64, 713, 713,
-    713, 713, 713, 713, 713, 713, 713, 713, 709, 711, 709, 711, 711, 711, 64,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 1, 1, 1, 1, 1, 1, 7, 7, 7, 8,
+    9, 10, 11, 12, 13, 14, 15, 11, 16, 17, 15, 18, 19, 20, 19, 21, 22, 22,
+    22, 22, 22, 22, 22, 22, 22, 22, 19, 23, 24, 25, 24, 10, 15, 26, 26, 26,
+    26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 16, 27, 17,
+    28, 29, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+    30, 30, 30, 16, 31, 32, 25, 1, 1, 1, 1, 1, 1, 33, 1, 1, 34, 35, 36, 13,
+    37, 13, 38, 39, 40, 41, 42, 43, 25, 44, 45, 28, 46, 47, 48, 48, 49, 50,
+    39, 39, 40, 48, 42, 51, 52, 52, 52, 35, 53, 53, 53, 53, 53, 53, 54, 53,
+    53, 53, 53, 53, 53, 53, 53, 53, 54, 53, 53, 53, 53, 53, 53, 55, 54, 53,
+    53, 53, 53, 53, 54, 56, 56, 56, 57, 57, 57, 57, 56, 57, 56, 56, 56, 57,
+    56, 56, 57, 57, 56, 57, 56, 56, 57, 57, 57, 55, 56, 56, 56, 57, 56, 57,
+    56, 57, 53, 56, 53, 57, 53, 57, 53, 57, 53, 57, 53, 57, 53, 57, 53, 57,
+    53, 56, 53, 56, 53, 57, 53, 57, 53, 57, 53, 56, 53, 57, 53, 57, 53, 57,
+    53, 57, 53, 57, 54, 56, 53, 56, 54, 56, 53, 57, 53, 57, 56, 53, 57, 53,
+    57, 53, 57, 54, 56, 54, 56, 53, 56, 53, 57, 53, 56, 56, 54, 56, 53, 56,
+    53, 57, 53, 57, 54, 56, 53, 57, 53, 57, 53, 53, 57, 53, 57, 53, 57, 57,
+    57, 53, 53, 57, 53, 57, 53, 53, 57, 53, 53, 53, 57, 57, 53, 53, 53, 53,
+    57, 53, 53, 57, 53, 53, 53, 57, 57, 57, 53, 53, 57, 53, 53, 57, 53, 57,
+    53, 57, 53, 53, 57, 53, 57, 57, 53, 57, 53, 53, 57, 53, 53, 53, 57, 53,
+    57, 53, 53, 57, 57, 58, 53, 57, 57, 57, 58, 58, 58, 58, 53, 59, 57, 53,
+    59, 57, 53, 59, 57, 53, 56, 53, 56, 53, 56, 53, 56, 53, 56, 53, 56, 53,
+    56, 53, 56, 57, 53, 57, 57, 53, 59, 57, 53, 57, 53, 53, 53, 57, 53, 57,
+    57, 57, 57, 57, 57, 57, 53, 53, 57, 53, 53, 57, 57, 53, 57, 53, 53, 53,
+    53, 57, 57, 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
+    57, 57, 57, 57, 58, 57, 57, 57, 60, 60, 60, 60, 60, 60, 60, 60, 60, 61,
+    61, 62, 62, 62, 62, 62, 62, 62, 63, 63, 64, 63, 61, 65, 66, 65, 65, 65,
+    66, 65, 61, 61, 67, 62, 63, 63, 63, 63, 63, 63, 40, 40, 40, 40, 63, 40,
+    63, 49, 60, 60, 60, 60, 60, 63, 63, 63, 63, 63, 68, 68, 61, 63, 62, 63,
+    63, 63, 63, 63, 63, 63, 63, 63, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
+    69, 69, 69, 70, 71, 71, 71, 71, 70, 72, 71, 71, 71, 71, 71, 73, 73, 71,
+    71, 71, 71, 73, 73, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 74, 74,
+    74, 74, 74, 71, 71, 71, 71, 69, 69, 69, 69, 69, 69, 69, 69, 75, 69, 71,
+    71, 71, 69, 69, 69, 71, 71, 76, 69, 69, 69, 71, 71, 71, 71, 69, 70, 71,
+    71, 69, 77, 78, 78, 77, 78, 78, 77, 69, 69, 69, 69, 69, 79, 80, 79, 80,
+    61, 81, 79, 80, 82, 82, 83, 80, 80, 80, 84, 79, 82, 82, 82, 82, 81, 63,
+    79, 85, 79, 79, 79, 82, 79, 82, 79, 79, 80, 86, 86, 86, 86, 86, 86, 86,
+    86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 82, 86, 86, 86, 86, 86, 86, 86,
+    79, 79, 80, 80, 80, 80, 80, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+    87, 87, 87, 87, 87, 87, 80, 87, 87, 87, 87, 87, 87, 87, 80, 80, 80, 80,
+    80, 79, 80, 80, 79, 79, 79, 80, 80, 80, 79, 80, 79, 80, 79, 80, 79, 80,
+    79, 80, 88, 89, 88, 89, 88, 89, 88, 89, 88, 89, 88, 89, 88, 89, 80, 80,
+    80, 80, 79, 80, 90, 79, 80, 79, 79, 80, 80, 79, 79, 79, 91, 92, 91, 91,
+    91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92,
+    92, 92, 93, 93, 93, 93, 93, 93, 93, 93, 94, 93, 94, 94, 94, 94, 94, 94,
+    94, 94, 94, 94, 94, 94, 94, 94, 91, 94, 91, 94, 91, 94, 91, 94, 91, 94,
+    95, 96, 96, 97, 97, 96, 98, 98, 91, 94, 91, 94, 91, 94, 91, 91, 94, 91,
+    94, 91, 94, 91, 94, 91, 94, 91, 94, 91, 94, 94, 82, 99, 99, 99, 99, 99,
+    99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 82,
+    82, 100, 101, 101, 101, 101, 101, 101, 82, 102, 102, 102, 102, 102, 102,
+    102, 102, 102, 102, 102, 102, 102, 102, 102, 82, 103, 104, 82, 82, 105,
+    105, 106, 82, 107, 108, 108, 108, 108, 107, 108, 108, 108, 109, 107, 108,
+    108, 108, 108, 108, 108, 107, 107, 107, 107, 107, 107, 108, 108, 107,
+    108, 108, 109, 110, 108, 111, 112, 113, 114, 115, 116, 117, 118, 119,
+    120, 120, 121, 122, 123, 124, 125, 126, 127, 128, 126, 108, 107, 129,
+    119, 82, 82, 82, 82, 82, 82, 82, 82, 130, 130, 130, 130, 130, 130, 130,
+    130, 130, 130, 130, 82, 82, 82, 82, 82, 130, 130, 130, 126, 126, 82, 82,
+    82, 131, 131, 131, 131, 131, 132, 133, 133, 134, 135, 135, 136, 137, 138,
+    139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 141, 142, 143, 144,
+    145, 82, 146, 144, 147, 147, 147, 147, 147, 147, 147, 147, 148, 147, 147,
+    147, 147, 147, 147, 147, 147, 147, 147, 149, 150, 151, 152, 153, 154,
+    155, 156, 97, 97, 157, 158, 140, 140, 140, 140, 140, 158, 140, 140, 158,
+    159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 135, 160, 160, 161,
+    147, 147, 162, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
+    146, 147, 140, 140, 140, 140, 140, 140, 140, 132, 139, 140, 140, 140,
+    140, 158, 140, 163, 163, 140, 140, 139, 158, 140, 140, 158, 147, 147,
+    164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 147, 147, 147, 165,
+    165, 147, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
+    166, 166, 82, 167, 168, 169, 168, 168, 168, 168, 168, 168, 168, 168, 168,
+    168, 168, 168, 168, 168, 170, 171, 170, 170, 171, 170, 170, 171, 171,
+    171, 170, 171, 171, 170, 171, 170, 170, 170, 171, 170, 171, 170, 171,
+    170, 171, 170, 170, 82, 82, 168, 168, 168, 172, 172, 172, 172, 172, 172,
+    172, 172, 172, 172, 172, 172, 172, 172, 173, 173, 173, 173, 173, 173,
+    173, 173, 173, 173, 173, 172, 82, 82, 82, 82, 82, 82, 174, 174, 174, 174,
+    174, 174, 174, 174, 174, 174, 175, 175, 175, 175, 175, 175, 175, 175,
+    175, 175, 175, 175, 175, 175, 175, 175, 175, 176, 176, 176, 176, 176,
+    176, 176, 177, 176, 178, 178, 179, 180, 181, 182, 178, 82, 82, 82, 82,
+    82, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
+    184, 184, 184, 184, 185, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+    185, 184, 184, 184, 185, 184, 184, 184, 184, 184, 82, 82, 186, 186, 186,
+    186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 82, 187, 187,
+    187, 187, 187, 187, 187, 187, 187, 188, 188, 188, 82, 82, 189, 82, 147,
+    147, 147, 147, 147, 82, 147, 147, 147, 147, 147, 147, 147, 147, 82, 82,
+    82, 82, 82, 82, 140, 140, 140, 140, 140, 140, 132, 158, 140, 140, 158,
+    140, 140, 158, 140, 140, 140, 158, 158, 158, 190, 191, 192, 140, 140,
+    140, 158, 140, 140, 158, 158, 140, 140, 140, 140, 140, 193, 193, 193,
+    194, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
+    195, 193, 194, 196, 195, 194, 194, 194, 193, 193, 193, 193, 193, 193,
+    193, 193, 194, 194, 194, 194, 197, 194, 194, 195, 97, 157, 198, 198, 193,
+    193, 193, 195, 195, 193, 193, 199, 199, 200, 200, 200, 200, 200, 200,
+    200, 200, 200, 200, 201, 202, 195, 195, 195, 195, 195, 195, 203, 204,
+    205, 205, 82, 203, 203, 203, 203, 203, 203, 203, 203, 82, 82, 203, 203,
+    82, 82, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203,
+    203, 82, 203, 203, 203, 203, 203, 203, 203, 82, 203, 82, 82, 82, 203,
+    203, 203, 203, 82, 82, 206, 203, 205, 205, 205, 204, 204, 204, 204, 82,
+    82, 205, 205, 82, 82, 205, 205, 207, 203, 82, 82, 82, 82, 82, 82, 82, 82,
+    205, 82, 82, 82, 82, 203, 203, 82, 203, 203, 203, 204, 204, 82, 82, 208,
+    208, 208, 208, 208, 208, 208, 208, 208, 208, 203, 203, 209, 209, 210,
+    210, 210, 210, 210, 211, 212, 213, 82, 82, 82, 82, 82, 214, 214, 215, 82,
+    216, 216, 216, 216, 216, 216, 82, 82, 82, 82, 216, 216, 82, 82, 216, 216,
+    216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 82, 216, 216,
+    216, 216, 216, 216, 216, 82, 216, 216, 82, 216, 216, 82, 216, 216, 82,
+    82, 217, 82, 215, 215, 215, 214, 214, 82, 82, 82, 82, 214, 214, 82, 82,
+    214, 214, 218, 82, 82, 82, 214, 82, 82, 82, 82, 82, 82, 82, 216, 216,
+    216, 216, 82, 216, 82, 82, 82, 82, 82, 82, 82, 219, 219, 219, 219, 219,
+    219, 219, 219, 219, 219, 214, 214, 216, 216, 216, 214, 82, 82, 82, 220,
+    220, 221, 82, 222, 222, 222, 222, 222, 222, 222, 222, 222, 82, 222, 222,
+    222, 82, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222,
+    222, 82, 222, 222, 222, 222, 222, 222, 222, 82, 222, 222, 82, 222, 222,
+    222, 222, 222, 82, 82, 223, 222, 221, 221, 221, 220, 220, 220, 220, 220,
+    82, 220, 220, 221, 82, 221, 221, 224, 82, 82, 222, 82, 82, 82, 82, 82,
+    82, 82, 222, 222, 220, 220, 82, 82, 225, 225, 225, 225, 225, 225, 225,
+    225, 225, 225, 226, 227, 82, 82, 82, 82, 82, 82, 82, 222, 82, 82, 82, 82,
+    82, 82, 82, 228, 229, 229, 82, 230, 230, 230, 230, 230, 230, 230, 230,
+    82, 82, 230, 230, 82, 82, 230, 230, 230, 230, 230, 230, 230, 230, 230,
+    230, 230, 230, 230, 230, 82, 230, 230, 230, 230, 230, 230, 230, 82, 230,
+    230, 82, 230, 230, 230, 230, 230, 82, 82, 231, 230, 229, 228, 229, 228,
+    228, 228, 228, 82, 82, 229, 229, 82, 82, 229, 229, 232, 82, 82, 82, 82,
+    82, 82, 82, 82, 228, 229, 82, 82, 82, 82, 230, 230, 82, 230, 230, 230,
+    228, 228, 82, 82, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 234,
+    230, 235, 235, 235, 235, 235, 235, 82, 82, 236, 237, 82, 237, 237, 237,
+    237, 237, 237, 82, 82, 82, 237, 237, 237, 82, 237, 237, 237, 237, 82, 82,
+    82, 237, 237, 82, 237, 82, 237, 237, 82, 82, 82, 237, 237, 82, 82, 82,
+    237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 82, 82, 82, 82, 238,
+    238, 236, 238, 238, 82, 82, 82, 238, 238, 238, 82, 238, 238, 238, 239,
+    82, 82, 237, 82, 82, 82, 82, 82, 82, 238, 82, 82, 82, 82, 82, 82, 240,
+    240, 240, 240, 240, 240, 240, 240, 240, 240, 241, 241, 241, 242, 242,
+    242, 242, 242, 242, 243, 242, 82, 82, 82, 82, 82, 244, 245, 245, 245, 82,
+    246, 246, 246, 246, 246, 246, 246, 246, 82, 246, 246, 246, 82, 246, 246,
+    246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 82,
+    82, 82, 246, 244, 244, 244, 245, 245, 245, 245, 82, 244, 244, 244, 82,
+    244, 244, 244, 247, 82, 82, 82, 82, 82, 82, 82, 248, 249, 82, 246, 246,
+    246, 82, 82, 82, 82, 82, 246, 246, 244, 244, 82, 82, 250, 250, 250, 250,
+    250, 250, 250, 250, 250, 250, 251, 251, 251, 251, 251, 251, 251, 252,
+    253, 254, 255, 255, 82, 253, 253, 253, 253, 253, 253, 253, 253, 82, 253,
+    253, 253, 82, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253,
+    253, 253, 253, 253, 253, 253, 82, 253, 253, 253, 253, 253, 82, 82, 256,
+    253, 255, 257, 255, 255, 255, 255, 255, 82, 257, 255, 255, 82, 255, 255,
+    254, 258, 82, 82, 82, 82, 82, 82, 82, 255, 255, 82, 82, 82, 82, 82, 82,
+    82, 253, 82, 253, 253, 254, 254, 82, 82, 259, 259, 259, 259, 259, 259,
+    259, 259, 259, 259, 82, 253, 253, 82, 82, 82, 82, 82, 82, 260, 261, 261,
+    82, 262, 262, 262, 262, 262, 262, 262, 262, 82, 262, 262, 262, 82, 262,
+    262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262,
+    262, 262, 82, 82, 262, 261, 261, 261, 260, 260, 260, 260, 82, 261, 261,
+    261, 82, 261, 261, 261, 263, 262, 264, 82, 82, 82, 82, 262, 262, 262,
+    261, 265, 265, 265, 265, 265, 265, 265, 262, 262, 262, 260, 260, 82, 82,
+    266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 265, 265, 265, 265,
+    265, 265, 265, 265, 265, 267, 262, 262, 262, 262, 262, 262, 82, 82, 268,
+    268, 82, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269,
+    269, 269, 269, 269, 269, 82, 82, 82, 269, 269, 269, 269, 269, 269, 269,
+    269, 82, 269, 269, 269, 269, 269, 269, 269, 269, 269, 82, 269, 82, 82,
+    82, 82, 270, 82, 82, 82, 82, 268, 268, 268, 271, 271, 271, 82, 271, 82,
+    268, 268, 268, 268, 268, 268, 268, 268, 82, 82, 82, 82, 82, 82, 272, 272,
+    272, 272, 272, 272, 272, 272, 272, 272, 82, 82, 268, 268, 273, 82, 82,
+    82, 82, 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
+    274, 274, 274, 275, 274, 274, 275, 275, 275, 275, 276, 276, 277, 82, 82,
+    82, 82, 278, 274, 274, 274, 274, 274, 274, 279, 275, 280, 280, 280, 280,
+    275, 275, 275, 281, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+    283, 283, 82, 82, 82, 82, 82, 284, 284, 82, 284, 82, 82, 284, 284, 82,
+    284, 82, 82, 284, 82, 82, 82, 82, 82, 82, 284, 284, 284, 284, 82, 284,
+    284, 284, 284, 284, 284, 284, 82, 284, 284, 284, 82, 284, 82, 284, 82,
+    82, 284, 284, 82, 284, 284, 284, 284, 285, 284, 284, 285, 285, 285, 285,
+    286, 286, 82, 285, 285, 284, 82, 82, 284, 284, 284, 284, 284, 82, 287,
+    82, 288, 288, 288, 288, 285, 285, 82, 82, 289, 289, 289, 289, 289, 289,
+    289, 289, 289, 289, 82, 82, 284, 284, 284, 284, 290, 291, 291, 291, 292,
+    293, 292, 292, 294, 292, 292, 295, 294, 296, 296, 296, 296, 296, 294,
+    297, 296, 297, 297, 297, 298, 298, 297, 297, 297, 297, 297, 297, 299,
+    299, 299, 299, 299, 299, 299, 299, 299, 299, 300, 300, 300, 300, 300,
+    300, 300, 300, 300, 300, 301, 298, 297, 298, 297, 302, 303, 304, 303,
+    304, 305, 305, 290, 290, 290, 290, 290, 290, 290, 290, 82, 290, 290, 290,
+    290, 290, 290, 290, 290, 290, 290, 290, 290, 82, 82, 82, 82, 306, 307,
+    308, 309, 308, 308, 308, 308, 308, 307, 307, 307, 307, 308, 310, 307,
+    308, 311, 311, 312, 295, 311, 311, 290, 290, 290, 290, 290, 308, 308,
+    308, 308, 308, 308, 308, 308, 308, 308, 308, 82, 308, 308, 308, 308, 308,
+    308, 308, 308, 308, 308, 308, 308, 82, 301, 301, 297, 297, 297, 297, 297,
+    297, 298, 297, 297, 297, 297, 297, 297, 82, 297, 297, 292, 292, 295, 292,
+    293, 313, 313, 313, 313, 294, 294, 82, 82, 82, 82, 82, 314, 314, 314,
+    314, 314, 314, 314, 314, 314, 314, 314, 315, 315, 316, 316, 316, 316,
+    315, 316, 316, 316, 316, 316, 317, 315, 318, 318, 315, 315, 316, 316,
+    314, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 320, 320, 321,
+    321, 321, 321, 314, 314, 314, 314, 314, 314, 315, 315, 316, 316, 314,
+    314, 314, 314, 316, 316, 316, 314, 315, 315, 315, 314, 314, 315, 315,
+    315, 315, 315, 315, 315, 314, 314, 314, 316, 316, 316, 316, 314, 314,
+    314, 314, 314, 316, 315, 315, 316, 316, 315, 315, 315, 315, 315, 315,
+    322, 314, 315, 319, 319, 315, 315, 315, 316, 323, 323, 324, 324, 324,
+    324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 82, 324, 82, 82,
+    82, 82, 82, 324, 82, 82, 325, 325, 325, 325, 325, 325, 325, 325, 325,
+    325, 325, 326, 327, 325, 325, 325, 328, 328, 328, 328, 328, 328, 328,
+    328, 329, 329, 329, 329, 329, 329, 329, 329, 330, 330, 330, 330, 330,
+    330, 330, 330, 331, 331, 331, 331, 331, 331, 331, 331, 331, 82, 331, 331,
+    331, 331, 82, 82, 331, 331, 331, 331, 331, 331, 331, 82, 331, 331, 331,
+    82, 82, 332, 332, 332, 333, 334, 333, 333, 333, 333, 333, 333, 333, 335,
+    335, 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, 335,
+    335, 335, 335, 335, 335, 82, 82, 82, 336, 336, 336, 336, 336, 336, 336,
+    336, 336, 336, 82, 82, 82, 82, 82, 82, 337, 337, 337, 337, 337, 337, 337,
+    337, 337, 337, 337, 337, 337, 337, 82, 82, 338, 338, 338, 338, 338, 338,
+    82, 82, 339, 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, 340,
+    340, 340, 340, 340, 340, 340, 340, 340, 341, 341, 340, 342, 343, 343,
+    343, 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, 343,
+    343, 343, 344, 345, 82, 82, 82, 346, 346, 346, 346, 346, 346, 346, 346,
+    346, 346, 346, 199, 199, 199, 347, 347, 347, 346, 346, 346, 346, 346,
+    346, 346, 346, 82, 82, 82, 82, 82, 82, 82, 348, 348, 348, 348, 348, 348,
+    348, 348, 348, 348, 348, 348, 348, 82, 348, 348, 348, 348, 349, 349, 350,
+    82, 82, 82, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 352, 352,
+    353, 199, 199, 82, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 355,
+    355, 82, 82, 82, 82, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356,
+    356, 356, 356, 82, 356, 356, 356, 82, 357, 357, 82, 82, 82, 82, 358, 358,
+    358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 359, 359, 360, 359,
+    359, 359, 359, 359, 359, 359, 360, 360, 360, 360, 360, 360, 360, 360,
+    359, 360, 360, 359, 359, 359, 359, 359, 359, 359, 359, 359, 361, 359,
+    362, 362, 363, 364, 362, 365, 362, 366, 358, 367, 82, 82, 368, 368, 368,
+    368, 368, 368, 368, 368, 368, 368, 82, 82, 82, 82, 82, 82, 369, 369, 369,
+    369, 369, 369, 369, 369, 369, 369, 82, 82, 82, 82, 82, 82, 370, 370, 371,
+    371, 372, 373, 374, 370, 375, 375, 370, 376, 376, 376, 377, 82, 378, 378,
+    378, 378, 378, 378, 378, 378, 378, 378, 82, 82, 82, 82, 82, 82, 379, 379,
+    379, 379, 379, 379, 379, 379, 379, 379, 379, 380, 379, 379, 379, 379,
+    379, 379, 379, 379, 379, 376, 376, 379, 379, 381, 379, 82, 82, 82, 82,
+    82, 340, 340, 340, 340, 340, 340, 82, 82, 382, 382, 382, 382, 382, 382,
+    382, 382, 382, 382, 382, 382, 382, 382, 382, 82, 383, 383, 383, 384, 384,
+    384, 384, 383, 383, 384, 384, 384, 82, 82, 82, 82, 384, 384, 383, 384,
+    384, 384, 384, 384, 384, 385, 386, 387, 82, 82, 82, 82, 388, 82, 82, 82,
+    389, 389, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 391, 391,
+    391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 82, 82, 391,
+    391, 391, 391, 391, 82, 82, 82, 392, 392, 392, 392, 392, 392, 392, 392,
+    392, 392, 392, 392, 82, 82, 82, 82, 392, 392, 82, 82, 82, 82, 82, 82,
+    393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 394, 82, 82, 82, 395,
+    395, 396, 396, 396, 396, 396, 396, 396, 396, 397, 397, 397, 397, 397,
+    397, 397, 397, 397, 397, 397, 397, 397, 397, 397, 398, 399, 400, 400,
+    401, 82, 82, 402, 402, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
+    403, 403, 403, 404, 405, 404, 405, 405, 405, 405, 405, 405, 405, 82, 406,
+    404, 405, 404, 404, 405, 405, 405, 405, 405, 405, 405, 405, 404, 404,
+    404, 404, 404, 404, 405, 405, 407, 407, 407, 407, 407, 407, 407, 407, 82,
+    82, 408, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 82, 82, 82,
+    82, 82, 82, 410, 410, 410, 410, 410, 410, 410, 411, 410, 410, 410, 410,
+    410, 410, 82, 82, 97, 97, 97, 97, 97, 157, 157, 157, 157, 157, 157, 97,
+    97, 157, 412, 82, 413, 413, 413, 413, 414, 415, 415, 415, 415, 415, 415,
+    415, 415, 415, 415, 415, 415, 415, 415, 415, 416, 414, 413, 413, 413,
+    413, 413, 414, 413, 414, 414, 414, 414, 414, 413, 414, 417, 415, 415,
+    415, 415, 415, 415, 415, 82, 82, 82, 82, 418, 418, 418, 418, 418, 418,
+    418, 418, 418, 418, 419, 419, 420, 419, 419, 419, 419, 421, 421, 421,
+    421, 421, 421, 421, 421, 421, 421, 422, 423, 422, 422, 422, 422, 422,
+    422, 422, 421, 421, 421, 421, 421, 421, 421, 421, 421, 82, 82, 82, 424,
+    424, 425, 426, 426, 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+    426, 426, 425, 424, 424, 424, 424, 425, 425, 424, 424, 427, 428, 424,
+    424, 426, 426, 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, 426,
+    426, 426, 426, 426, 426, 430, 430, 430, 430, 430, 430, 430, 430, 430,
+    430, 430, 430, 430, 430, 431, 432, 433, 433, 432, 432, 432, 433, 432,
+    433, 433, 433, 434, 434, 82, 82, 82, 82, 82, 82, 82, 82, 435, 435, 435,
+    435, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 437,
+    437, 437, 437, 437, 437, 437, 437, 438, 438, 438, 438, 438, 438, 438,
+    438, 437, 437, 438, 439, 82, 82, 82, 440, 440, 440, 440, 440, 441, 441,
+    441, 441, 441, 441, 441, 441, 441, 441, 82, 82, 82, 436, 436, 436, 442,
+    442, 442, 442, 442, 442, 442, 442, 442, 442, 443, 443, 443, 443, 443,
+    443, 443, 443, 443, 443, 443, 443, 443, 443, 444, 444, 444, 444, 444,
+    444, 445, 445, 94, 82, 82, 82, 82, 82, 82, 82, 446, 446, 446, 446, 446,
+    446, 446, 446, 97, 97, 97, 326, 447, 157, 157, 157, 157, 157, 97, 97,
+    157, 157, 157, 157, 97, 448, 447, 447, 447, 447, 447, 447, 447, 449, 449,
+    449, 449, 157, 449, 449, 449, 449, 448, 448, 97, 449, 449, 82, 97, 97,
+    82, 82, 82, 82, 82, 82, 57, 57, 57, 57, 57, 57, 80, 80, 80, 80, 80, 94,
+    60, 60, 60, 60, 60, 60, 60, 60, 60, 83, 83, 83, 83, 83, 60, 60, 60, 60,
+    83, 83, 83, 83, 83, 57, 57, 57, 57, 57, 450, 57, 57, 57, 57, 57, 57, 57,
+    57, 57, 57, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 83, 97, 97,
+    157, 97, 97, 97, 97, 97, 97, 97, 157, 97, 97, 451, 452, 157, 453, 97, 97,
+    97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+    97, 82, 82, 82, 82, 82, 97, 454, 157, 97, 157, 53, 57, 53, 57, 53, 57,
+    57, 57, 57, 57, 57, 57, 57, 57, 53, 57, 80, 80, 80, 80, 80, 80, 80, 80,
+    79, 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 82, 82, 79, 79,
+    79, 79, 79, 79, 82, 82, 82, 79, 82, 79, 82, 79, 82, 79, 455, 455, 455,
+    455, 455, 455, 455, 455, 80, 80, 80, 80, 80, 82, 80, 80, 79, 79, 79, 79,
+    455, 81, 80, 81, 81, 81, 80, 80, 80, 82, 80, 80, 79, 79, 79, 79, 455, 81,
+    81, 81, 80, 80, 80, 80, 82, 82, 80, 80, 79, 79, 79, 79, 82, 81, 81, 81,
+    79, 79, 79, 79, 79, 81, 81, 81, 82, 82, 80, 80, 80, 82, 80, 80, 79, 79,
+    79, 79, 455, 456, 81, 82, 457, 457, 457, 457, 457, 457, 457, 458, 457,
+    457, 457, 459, 460, 461, 462, 463, 464, 465, 466, 464, 467, 468, 39, 85,
+    469, 470, 471, 472, 469, 470, 471, 472, 39, 39, 473, 85, 474, 474, 474,
+    475, 476, 477, 478, 479, 480, 481, 482, 34, 483, 484, 483, 483, 484, 485,
+    486, 486, 85, 43, 51, 39, 487, 487, 473, 488, 488, 85, 85, 85, 489, 490,
+    491, 487, 487, 487, 85, 85, 85, 85, 85, 85, 85, 85, 492, 85, 488, 85,
+    373, 85, 373, 373, 373, 373, 85, 373, 373, 457, 493, 494, 494, 494, 494,
+    82, 495, 496, 497, 498, 499, 499, 499, 499, 499, 499, 500, 60, 82, 82,
+    48, 500, 500, 500, 500, 500, 501, 501, 492, 490, 491, 502, 500, 48, 48,
+    48, 48, 500, 500, 500, 500, 500, 501, 501, 492, 490, 491, 82, 60, 60, 60,
+    60, 60, 82, 82, 82, 278, 278, 278, 278, 278, 278, 278, 503, 278, 504,
+    278, 278, 37, 278, 278, 278, 278, 278, 278, 278, 278, 278, 503, 278, 278,
+    278, 278, 503, 278, 278, 503, 505, 505, 505, 505, 505, 505, 505, 505,
+    505, 97, 97, 447, 447, 97, 97, 97, 97, 447, 447, 447, 97, 97, 412, 412,
+    412, 412, 97, 412, 412, 412, 447, 447, 97, 157, 97, 447, 447, 157, 157,
+    157, 157, 97, 82, 82, 82, 82, 82, 82, 82, 41, 41, 506, 507, 41, 508, 41,
+    506, 41, 507, 50, 506, 506, 506, 50, 50, 506, 506, 506, 509, 41, 506,
+    510, 41, 492, 506, 506, 506, 506, 506, 41, 41, 41, 508, 508, 41, 506, 41,
+    86, 41, 506, 41, 53, 511, 506, 506, 512, 50, 506, 506, 53, 506, 50, 449,
+    449, 449, 449, 50, 41, 41, 50, 50, 506, 506, 513, 492, 492, 492, 492,
+    506, 50, 50, 50, 50, 41, 492, 41, 41, 57, 313, 514, 514, 514, 515, 52,
+    516, 514, 514, 514, 514, 514, 52, 515, 515, 52, 514, 517, 517, 517, 517,
+    517, 517, 517, 517, 517, 517, 517, 517, 518, 518, 518, 518, 517, 517,
+    518, 518, 518, 518, 518, 518, 518, 518, 518, 53, 57, 518, 518, 518, 518,
+    52, 41, 41, 82, 82, 82, 82, 55, 55, 55, 55, 55, 508, 508, 508, 508, 508,
+    492, 492, 41, 41, 41, 41, 492, 41, 41, 492, 41, 41, 492, 41, 41, 41, 41,
+    41, 41, 41, 492, 41, 41, 41, 41, 41, 41, 41, 41, 41, 45, 45, 41, 41, 41,
+    41, 41, 41, 41, 41, 41, 41, 41, 41, 492, 492, 41, 41, 55, 41, 55, 41, 41,
+    41, 41, 41, 41, 41, 41, 41, 41, 45, 41, 41, 41, 41, 492, 492, 492, 492,
+    492, 492, 492, 492, 492, 492, 492, 492, 55, 513, 519, 519, 513, 492, 492,
+    55, 519, 513, 513, 519, 513, 513, 492, 55, 492, 519, 520, 521, 492, 519,
+    513, 492, 492, 492, 519, 513, 513, 519, 55, 519, 519, 513, 513, 55, 513,
+    55, 513, 55, 55, 55, 55, 519, 519, 513, 519, 513, 513, 513, 513, 513, 55,
+    55, 55, 55, 492, 513, 492, 513, 519, 519, 513, 513, 513, 513, 513, 513,
+    513, 513, 513, 513, 519, 513, 513, 513, 519, 492, 492, 492, 492, 492,
+    519, 513, 513, 513, 492, 492, 492, 492, 492, 492, 492, 492, 492, 513,
+    519, 55, 513, 492, 519, 519, 519, 519, 513, 513, 519, 519, 492, 492, 519,
+    519, 513, 513, 519, 519, 513, 513, 519, 519, 513, 513, 513, 513, 513,
+    492, 492, 513, 513, 513, 513, 492, 492, 55, 492, 492, 513, 55, 492, 492,
+    492, 492, 492, 492, 492, 492, 513, 513, 492, 55, 513, 513, 513, 492, 492,
+    492, 492, 492, 513, 519, 492, 513, 513, 513, 513, 513, 492, 492, 513,
+    513, 492, 492, 492, 492, 513, 513, 513, 513, 513, 513, 513, 513, 492,
+    522, 490, 491, 490, 491, 41, 41, 41, 41, 41, 41, 508, 41, 41, 41, 41, 41,
+    41, 41, 523, 523, 41, 41, 41, 41, 513, 513, 41, 41, 41, 41, 41, 41, 41,
+    524, 525, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 313, 313, 313, 313,
+    313, 313, 313, 313, 313, 313, 313, 313, 313, 41, 492, 41, 41, 41, 41, 41,
+    41, 41, 41, 313, 41, 41, 41, 41, 41, 492, 492, 492, 492, 492, 492, 492,
+    492, 492, 41, 41, 41, 41, 492, 492, 41, 41, 41, 41, 41, 41, 41, 526, 526,
+    526, 526, 41, 41, 41, 523, 527, 527, 523, 41, 41, 41, 41, 41, 41, 41, 41,
+    41, 41, 41, 82, 41, 41, 41, 82, 82, 82, 82, 82, 52, 52, 52, 52, 52, 52,
+    52, 52, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 528, 528, 528,
+    528, 528, 528, 528, 528, 528, 528, 528, 528, 528, 528, 516, 52, 52, 52,
+    52, 52, 52, 52, 52, 52, 52, 52, 52, 515, 508, 508, 508, 508, 508, 508,
+    508, 508, 508, 508, 508, 508, 41, 41, 41, 41, 508, 508, 508, 508, 529,
+    41, 41, 41, 41, 41, 508, 508, 508, 508, 41, 41, 508, 508, 41, 508, 508,
+    508, 508, 508, 508, 508, 41, 41, 41, 41, 41, 41, 41, 41, 508, 508, 41,
+    41, 508, 55, 41, 41, 41, 41, 508, 508, 41, 41, 508, 55, 41, 41, 41, 41,
+    508, 508, 508, 41, 41, 508, 41, 41, 508, 508, 41, 41, 41, 41, 41, 41, 41,
+    508, 492, 492, 492, 492, 492, 530, 530, 492, 527, 527, 527, 527, 41, 508,
+    508, 41, 41, 508, 41, 41, 41, 41, 508, 508, 41, 41, 41, 41, 523, 523,
+    529, 529, 527, 41, 527, 527, 531, 532, 531, 527, 41, 527, 527, 527, 41,
+    41, 41, 41, 508, 41, 508, 41, 41, 41, 41, 41, 526, 526, 526, 526, 526,
+    526, 526, 526, 526, 526, 526, 526, 41, 41, 41, 41, 508, 508, 41, 508,
+    508, 508, 41, 508, 531, 508, 508, 41, 508, 508, 41, 55, 41, 41, 41, 41,
+    41, 41, 41, 523, 41, 41, 41, 526, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+    508, 508, 41, 526, 41, 41, 41, 41, 41, 41, 41, 41, 526, 526, 313, 41, 41,
+    41, 41, 41, 41, 41, 41, 523, 523, 531, 527, 527, 527, 527, 523, 523, 531,
+    531, 531, 508, 508, 508, 508, 531, 526, 531, 531, 531, 508, 531, 523,
+    508, 508, 508, 531, 531, 508, 508, 531, 508, 508, 531, 531, 531, 41, 508,
+    41, 41, 41, 41, 508, 508, 523, 508, 508, 508, 508, 508, 508, 531, 523,
+    523, 531, 523, 508, 531, 531, 533, 523, 508, 508, 523, 531, 531, 527,
+    527, 527, 527, 527, 526, 41, 41, 527, 527, 534, 534, 532, 532, 41, 41,
+    526, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 45, 41, 41, 41, 41,
+    41, 41, 526, 41, 526, 41, 41, 41, 41, 526, 526, 526, 41, 535, 41, 41, 41,
+    536, 536, 536, 536, 536, 536, 41, 537, 537, 527, 41, 41, 41, 490, 491,
+    490, 491, 490, 491, 490, 491, 490, 491, 490, 491, 490, 491, 52, 52, 516,
+    516, 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, 41, 526, 526, 526,
+    41, 41, 41, 41, 41, 41, 41, 526, 513, 492, 492, 513, 513, 490, 491, 492,
+    513, 513, 492, 513, 513, 513, 492, 492, 492, 492, 492, 513, 513, 513,
+    513, 492, 492, 492, 492, 492, 513, 513, 513, 492, 492, 492, 513, 513,
+    513, 513, 16, 32, 16, 32, 16, 32, 16, 32, 490, 491, 538, 538, 538, 538,
+    538, 538, 538, 538, 492, 492, 492, 490, 491, 16, 32, 490, 491, 490, 491,
+    490, 491, 490, 491, 490, 491, 492, 492, 513, 513, 513, 513, 513, 513,
+    492, 492, 492, 492, 492, 492, 492, 513, 513, 513, 513, 513, 513, 492,
+    492, 492, 513, 492, 492, 492, 492, 513, 513, 513, 513, 513, 492, 513,
+    513, 492, 492, 490, 491, 490, 491, 513, 492, 492, 492, 492, 513, 492,
+    513, 513, 513, 492, 492, 513, 513, 492, 492, 492, 492, 492, 492, 492,
+    492, 492, 492, 513, 513, 513, 513, 513, 513, 492, 492, 490, 491, 492,
+    492, 492, 492, 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, 513,
+    492, 513, 513, 513, 513, 492, 492, 513, 492, 513, 492, 492, 513, 492,
+    513, 513, 513, 513, 492, 492, 492, 492, 492, 513, 513, 492, 492, 492,
+    492, 513, 513, 513, 513, 492, 513, 513, 492, 492, 513, 513, 492, 492,
+    492, 492, 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, 492,
+    492, 513, 513, 513, 513, 513, 513, 513, 513, 492, 513, 513, 513, 513,
+    513, 513, 513, 513, 492, 492, 492, 492, 492, 513, 492, 513, 492, 492,
+    492, 513, 513, 513, 513, 513, 492, 492, 492, 492, 513, 492, 492, 492,
+    513, 513, 513, 513, 513, 492, 513, 492, 492, 41, 41, 41, 526, 526, 41,
+    41, 41, 492, 492, 492, 492, 492, 41, 41, 492, 492, 492, 492, 492, 492,
+    41, 41, 41, 526, 41, 41, 41, 41, 535, 508, 508, 41, 41, 41, 41, 82, 82,
+    41, 41, 41, 41, 41, 41, 41, 41, 82, 82, 41, 41, 82, 82, 82, 41, 41, 41,
+    41, 82, 41, 41, 41, 41, 41, 41, 41, 41, 82, 82, 82, 82, 82, 82, 82, 82,
+    82, 82, 41, 41, 41, 41, 539, 539, 539, 539, 539, 539, 539, 539, 539, 539,
+    539, 539, 539, 539, 539, 82, 540, 540, 540, 540, 540, 540, 540, 540, 540,
+    540, 540, 540, 540, 540, 540, 82, 53, 57, 53, 53, 53, 57, 57, 53, 57, 53,
+    57, 53, 57, 53, 53, 53, 53, 57, 53, 57, 57, 53, 57, 57, 57, 57, 57, 57,
+    60, 60, 53, 53, 88, 89, 88, 89, 89, 541, 541, 541, 541, 541, 541, 88, 89,
+    88, 89, 542, 542, 542, 88, 89, 82, 82, 82, 82, 82, 543, 544, 544, 544,
+    545, 543, 544, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
+    546, 546, 546, 82, 546, 82, 82, 82, 82, 82, 546, 82, 82, 547, 547, 547,
+    547, 547, 547, 547, 547, 82, 82, 82, 82, 82, 82, 82, 548, 549, 82, 82,
+    82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 550, 96, 96, 96, 96, 96,
+    96, 96, 96, 551, 551, 43, 51, 43, 51, 551, 551, 551, 43, 51, 551, 43, 51,
+    373, 373, 373, 373, 373, 373, 373, 373, 85, 466, 552, 373, 553, 85, 43,
+    51, 85, 85, 43, 51, 490, 491, 490, 491, 490, 491, 490, 491, 373, 373,
+    373, 373, 371, 61, 373, 373, 85, 373, 373, 85, 85, 85, 85, 85, 554, 554,
+    373, 373, 373, 85, 466, 373, 471, 373, 373, 82, 82, 82, 555, 555, 555,
+    555, 555, 555, 555, 555, 555, 555, 82, 555, 555, 555, 555, 555, 555, 555,
+    555, 555, 82, 82, 82, 82, 555, 555, 555, 555, 555, 555, 82, 82, 523, 523,
+    523, 523, 523, 523, 523, 523, 523, 523, 523, 523, 82, 82, 82, 82, 556,
+    557, 557, 558, 523, 559, 560, 561, 524, 525, 524, 525, 524, 525, 524,
+    525, 524, 525, 523, 523, 524, 525, 524, 525, 524, 525, 524, 525, 562,
+    563, 564, 564, 523, 561, 561, 561, 561, 561, 561, 561, 561, 561, 565,
+    566, 567, 568, 569, 569, 570, 571, 571, 571, 571, 572, 523, 523, 561,
+    561, 561, 559, 573, 558, 523, 527, 82, 574, 575, 574, 575, 574, 575, 574,
+    575, 574, 575, 575, 575, 575, 575, 575, 575, 575, 575, 575, 575, 575,
+    575, 575, 575, 575, 575, 574, 575, 575, 575, 575, 575, 575, 575, 574,
+    575, 574, 575, 574, 575, 575, 575, 575, 575, 575, 574, 575, 575, 575,
+    575, 575, 575, 574, 574, 82, 82, 576, 576, 577, 577, 578, 578, 575, 562,
+    579, 580, 579, 580, 579, 580, 579, 580, 579, 580, 580, 580, 580, 580,
+    580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 579, 580,
+    580, 580, 580, 580, 580, 580, 579, 580, 579, 580, 579, 580, 580, 580,
+    580, 580, 580, 579, 580, 580, 580, 580, 580, 580, 579, 579, 580, 580,
+    580, 580, 581, 582, 583, 583, 580, 82, 82, 82, 82, 82, 584, 584, 584,
+    584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 82,
+    82, 82, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585,
+    585, 585, 585, 585, 585, 585, 585, 585, 585, 82, 586, 586, 587, 587, 587,
+    587, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 584, 584, 584, 82,
+    82, 82, 82, 82, 579, 579, 579, 579, 579, 579, 579, 579, 588, 588, 588,
+    588, 588, 588, 588, 588, 588, 588, 588, 588, 588, 589, 589, 82, 587, 587,
+    587, 587, 587, 587, 587, 587, 587, 587, 586, 586, 586, 586, 586, 586,
+    590, 590, 590, 590, 590, 590, 590, 590, 523, 591, 591, 591, 591, 591,
+    591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 588, 588, 588, 588,
+    589, 589, 589, 586, 586, 591, 591, 591, 591, 591, 591, 591, 586, 586,
+    586, 586, 523, 523, 523, 523, 592, 592, 592, 592, 592, 592, 592, 592,
+    592, 592, 592, 592, 592, 592, 592, 82, 586, 586, 586, 586, 586, 586, 586,
+    523, 523, 523, 523, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586,
+    586, 523, 523, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593,
+    593, 593, 593, 594, 594, 594, 594, 594, 594, 594, 594, 594, 594, 595,
+    595, 595, 595, 595, 595, 595, 595, 595, 595, 595, 595, 595, 596, 595,
+    595, 595, 595, 595, 595, 595, 82, 82, 82, 597, 597, 597, 597, 597, 597,
+    597, 597, 597, 597, 597, 597, 597, 597, 597, 82, 598, 598, 598, 598, 598,
+    598, 598, 598, 599, 599, 599, 599, 599, 599, 600, 600, 601, 601, 601,
+    601, 601, 601, 601, 601, 601, 601, 601, 601, 602, 603, 604, 603, 605,
+    605, 605, 605, 605, 605, 605, 605, 605, 605, 601, 601, 82, 82, 82, 82,
+    91, 94, 91, 94, 91, 94, 606, 96, 98, 98, 98, 607, 96, 96, 96, 96, 96, 96,
+    96, 96, 96, 96, 607, 608, 91, 94, 91, 94, 450, 450, 96, 96, 609, 609,
+    609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 610, 610,
+    610, 610, 610, 610, 610, 610, 610, 610, 611, 611, 612, 613, 613, 613,
+    613, 613, 63, 63, 63, 63, 63, 63, 63, 61, 61, 61, 61, 61, 61, 61, 61, 61,
+    63, 63, 53, 57, 53, 57, 53, 57, 57, 57, 53, 57, 53, 57, 53, 57, 60, 57,
+    57, 57, 57, 57, 57, 57, 57, 53, 57, 53, 57, 53, 53, 57, 61, 614, 614, 53,
+    57, 53, 57, 58, 53, 57, 53, 57, 57, 57, 53, 57, 53, 57, 53, 53, 53, 53,
+    53, 82, 53, 53, 53, 53, 53, 57, 53, 57, 82, 82, 82, 82, 82, 82, 82, 58,
+    60, 60, 57, 58, 58, 58, 58, 58, 615, 615, 616, 615, 615, 615, 617, 615,
+    615, 615, 615, 616, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615,
+    615, 615, 615, 615, 615, 618, 618, 616, 616, 618, 619, 619, 619, 619, 82,
+    82, 82, 82, 620, 620, 620, 620, 620, 620, 313, 313, 503, 512, 82, 82, 82,
+    82, 82, 82, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621,
+    622, 622, 623, 623, 624, 624, 625, 625, 625, 625, 625, 625, 625, 625,
+    625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 624, 624, 624, 624,
+    624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 626, 627, 82,
+    82, 82, 82, 82, 82, 82, 82, 628, 628, 629, 629, 629, 629, 629, 629, 629,
+    629, 629, 629, 82, 82, 82, 82, 82, 82, 198, 198, 198, 198, 198, 198, 198,
+    198, 198, 198, 195, 195, 195, 195, 195, 195, 201, 201, 201, 195, 630,
+    195, 82, 82, 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, 632, 632,
+    632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632,
+    632, 632, 632, 632, 633, 633, 633, 633, 633, 634, 634, 634, 199, 635,
+    636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636,
+    636, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 638, 639, 82,
+    82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 640, 328, 328, 328, 328, 328, 82,
+    82, 82, 641, 641, 641, 642, 643, 643, 643, 643, 643, 643, 643, 643, 643,
+    643, 643, 643, 643, 643, 643, 644, 642, 642, 641, 641, 641, 641, 642,
+    642, 641, 642, 642, 642, 645, 646, 646, 646, 646, 646, 646, 647, 647,
+    647, 646, 646, 646, 646, 82, 62, 648, 648, 648, 648, 648, 648, 648, 648,
+    648, 648, 82, 82, 82, 82, 646, 646, 314, 314, 314, 314, 314, 316, 649,
+    314, 319, 319, 314, 314, 314, 314, 314, 82, 650, 650, 650, 650, 650, 650,
+    650, 650, 650, 651, 651, 651, 651, 651, 651, 652, 652, 651, 651, 652,
+    652, 651, 651, 82, 650, 650, 650, 651, 650, 650, 650, 650, 650, 650, 650,
+    650, 651, 652, 82, 82, 653, 653, 653, 653, 653, 653, 653, 653, 653, 653,
+    82, 82, 654, 655, 655, 655, 649, 314, 314, 314, 314, 314, 314, 323, 323,
+    323, 314, 315, 316, 315, 314, 314, 656, 656, 656, 656, 656, 656, 656,
+    656, 657, 656, 657, 657, 658, 656, 656, 657, 657, 656, 656, 656, 656,
+    656, 657, 657, 656, 657, 656, 82, 82, 82, 82, 82, 82, 82, 82, 656, 656,
+    659, 660, 660, 661, 661, 661, 661, 661, 661, 661, 661, 661, 661, 661,
+    662, 663, 663, 662, 662, 664, 664, 661, 665, 665, 662, 666, 82, 82, 331,
+    331, 331, 331, 331, 331, 82, 57, 57, 57, 614, 60, 60, 60, 60, 57, 57, 57,
+    57, 57, 80, 82, 82, 338, 338, 338, 338, 338, 338, 338, 338, 661, 661,
+    661, 662, 662, 663, 662, 662, 663, 662, 662, 664, 662, 666, 82, 82, 667,
+    667, 667, 667, 667, 667, 667, 667, 667, 667, 82, 82, 82, 82, 82, 82, 668,
+    669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669,
+    669, 669, 669, 669, 669, 668, 669, 669, 669, 669, 669, 669, 669, 82, 82,
+    82, 82, 329, 329, 329, 329, 329, 329, 329, 82, 82, 82, 82, 330, 330, 330,
+    330, 330, 330, 330, 330, 330, 82, 82, 82, 82, 670, 670, 670, 670, 670,
+    670, 670, 670, 671, 671, 671, 671, 671, 671, 671, 671, 593, 593, 594,
+    594, 594, 594, 594, 594, 57, 57, 57, 57, 57, 57, 57, 82, 82, 82, 82, 102,
+    102, 102, 102, 102, 82, 82, 82, 82, 82, 130, 672, 130, 130, 673, 130,
+    130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 82, 130, 130,
+    130, 130, 130, 82, 130, 82, 130, 130, 82, 130, 130, 82, 130, 130, 147,
+    147, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674,
+    674, 674, 674, 82, 82, 82, 82, 82, 82, 82, 82, 82, 147, 147, 147, 147,
+    147, 147, 147, 147, 147, 147, 147, 675, 471, 82, 82, 147, 147, 147, 147,
+    147, 147, 147, 147, 147, 147, 136, 139, 82, 82, 676, 676, 676, 676, 676,
+    676, 676, 676, 677, 557, 557, 677, 677, 678, 678, 563, 564, 679, 82, 82,
+    82, 82, 82, 82, 97, 97, 97, 97, 97, 97, 97, 157, 157, 157, 157, 157, 157,
+    157, 96, 96, 558, 570, 570, 680, 680, 563, 564, 563, 564, 563, 564, 563,
+    564, 563, 564, 563, 564, 563, 564, 563, 564, 558, 558, 563, 564, 558,
+    558, 558, 558, 680, 680, 680, 681, 558, 681, 82, 581, 682, 678, 678, 570,
+    524, 525, 524, 525, 524, 525, 683, 558, 558, 684, 685, 686, 686, 687, 82,
+    558, 688, 689, 558, 82, 82, 82, 82, 147, 147, 147, 147, 147, 82, 82, 493,
+    82, 690, 691, 692, 693, 694, 691, 691, 695, 696, 691, 697, 698, 699, 698,
+    700, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 702, 703, 704,
+    705, 704, 690, 691, 706, 706, 706, 706, 706, 706, 706, 706, 706, 706,
+    706, 706, 706, 706, 706, 706, 706, 706, 695, 691, 696, 707, 708, 707,
+    709, 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
+    709, 709, 709, 709, 695, 705, 696, 705, 695, 696, 710, 711, 712, 710,
+    713, 714, 715, 715, 715, 715, 715, 715, 715, 715, 715, 716, 714, 714,
     714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714,
-    714, 714, 714, 714, 714, 714, 64, 64, 64, 715, 715, 715, 715, 715, 715,
-    715, 715, 715, 715, 64, 715, 715, 715, 715, 715, 715, 715, 715, 715, 716,
-    716, 716, 717, 717, 717, 716, 716, 717, 718, 719, 717, 720, 720, 720,
-    720, 720, 720, 64, 64, 721, 721, 721, 721, 721, 721, 721, 64, 721, 64,
-    721, 721, 721, 721, 64, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721,
-    721, 721, 721, 721, 721, 64, 721, 721, 722, 64, 64, 64, 64, 64, 64, 723,
-    723, 723, 723, 723, 723, 723, 723, 723, 723, 723, 723, 723, 723, 723,
-    724, 725, 725, 725, 724, 724, 724, 724, 724, 724, 726, 727, 64, 64, 64,
-    64, 64, 728, 728, 728, 728, 728, 728, 728, 728, 728, 728, 64, 64, 64, 64,
-    64, 64, 729, 729, 730, 730, 64, 731, 731, 731, 731, 731, 731, 731, 731,
-    64, 64, 731, 731, 64, 64, 731, 731, 731, 731, 731, 731, 731, 731, 731,
-    731, 731, 731, 731, 731, 64, 731, 731, 731, 731, 731, 731, 731, 64, 731,
-    731, 64, 731, 731, 731, 731, 731, 64, 64, 732, 731, 730, 730, 729, 730,
-    730, 730, 730, 64, 64, 730, 730, 64, 64, 730, 730, 733, 64, 64, 731, 64,
-    64, 64, 64, 64, 64, 730, 64, 64, 64, 64, 64, 731, 731, 731, 731, 731,
-    730, 730, 64, 64, 734, 734, 734, 734, 734, 734, 734, 64, 64, 64, 735,
-    735, 735, 735, 735, 735, 735, 735, 736, 736, 736, 737, 737, 737, 737,
-    737, 737, 736, 737, 736, 736, 736, 736, 737, 737, 736, 738, 739, 735,
-    735, 740, 735, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 64, 64,
-    64, 64, 64, 64, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742,
-    742, 742, 742, 742, 743, 743, 743, 744, 744, 744, 744, 64, 64, 743, 743,
-    743, 743, 744, 744, 743, 745, 746, 747, 747, 747, 747, 747, 747, 747,
-    747, 747, 747, 747, 747, 747, 747, 747, 742, 742, 742, 742, 744, 744, 64,
-    64, 748, 748, 748, 748, 748, 748, 748, 748, 749, 749, 749, 750, 750, 750,
-    750, 750, 750, 750, 750, 749, 749, 750, 749, 751, 750, 752, 752, 752,
-    748, 64, 64, 64, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 64,
-    64, 64, 64, 64, 64, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754,
-    754, 755, 756, 755, 756, 756, 755, 755, 755, 755, 755, 755, 757, 758,
-    759, 759, 759, 759, 759, 759, 759, 759, 759, 759, 64, 64, 64, 64, 64, 64,
-    760, 760, 760, 760, 760, 760, 760, 760, 760, 760, 64, 64, 64, 761, 761,
-    761, 762, 762, 761, 761, 761, 761, 762, 761, 761, 761, 761, 763, 64, 64,
-    64, 64, 764, 764, 764, 764, 764, 764, 764, 764, 764, 764, 765, 765, 766,
-    766, 766, 767, 768, 768, 768, 768, 768, 768, 768, 768, 769, 769, 769,
-    769, 769, 769, 769, 769, 770, 770, 770, 770, 770, 770, 770, 770, 770,
-    770, 771, 771, 771, 771, 771, 771, 771, 771, 771, 64, 64, 64, 64, 64, 64,
-    64, 64, 64, 64, 64, 64, 772, 773, 773, 773, 773, 773, 773, 773, 773, 773,
-    64, 64, 64, 64, 64, 64, 64, 774, 774, 774, 774, 774, 774, 774, 774, 774,
-    774, 64, 64, 64, 64, 64, 64, 775, 775, 775, 775, 775, 775, 775, 775, 775,
-    775, 775, 775, 775, 775, 775, 64, 776, 776, 776, 776, 776, 64, 64, 64,
-    774, 774, 774, 774, 64, 64, 64, 64, 777, 777, 777, 777, 777, 777, 777,
-    777, 777, 777, 777, 777, 777, 777, 777, 64, 778, 778, 778, 778, 778, 778,
-    778, 778, 778, 778, 778, 778, 778, 778, 778, 64, 511, 64, 64, 64, 64, 64,
-    64, 64, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779,
-    779, 779, 64, 780, 780, 780, 780, 780, 780, 780, 780, 780, 780, 64, 64,
-    64, 64, 781, 781, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782,
-    782, 782, 782, 64, 64, 783, 783, 783, 783, 783, 784, 64, 64, 785, 785,
-    785, 785, 785, 785, 785, 785, 786, 786, 786, 786, 786, 786, 786, 787,
-    787, 787, 787, 787, 788, 788, 788, 788, 789, 789, 789, 789, 787, 788, 64,
-    64, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 64, 791, 791, 791,
-    791, 791, 791, 791, 64, 785, 785, 785, 785, 785, 64, 64, 64, 64, 64, 785,
-    785, 785, 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, 792,
-    792, 64, 64, 64, 792, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793,
-    793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 64, 64, 64,
-    64, 64, 64, 64, 64, 794, 794, 794, 794, 795, 795, 795, 795, 795, 795,
-    795, 795, 795, 795, 795, 795, 795, 486, 482, 64, 64, 64, 64, 64, 64, 796,
-    796, 796, 796, 796, 796, 796, 796, 796, 796, 796, 64, 64, 64, 64, 64,
-    796, 796, 796, 796, 796, 64, 64, 64, 796, 64, 64, 64, 64, 64, 64, 64,
-    796, 796, 64, 64, 797, 798, 799, 800, 410, 410, 410, 410, 64, 64, 64, 64,
-    277, 277, 277, 277, 277, 277, 64, 64, 277, 277, 277, 277, 277, 277, 277,
-    64, 64, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 801,
-    801, 400, 400, 400, 277, 277, 277, 802, 801, 801, 801, 801, 801, 410,
-    410, 410, 410, 410, 410, 410, 410, 136, 136, 136, 136, 136, 136, 136,
-    136, 277, 277, 78, 78, 78, 78, 78, 136, 136, 277, 277, 277, 277, 277,
-    277, 78, 78, 78, 78, 277, 277, 277, 64, 64, 64, 64, 64, 64, 64, 606, 606,
-    803, 803, 803, 606, 64, 64, 521, 521, 64, 64, 64, 64, 64, 64, 442, 442,
-    442, 442, 442, 442, 442, 442, 442, 442, 34, 34, 34, 34, 34, 34, 34, 34,
-    34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 442, 442, 442, 442, 442, 442,
-    442, 442, 442, 442, 34, 34, 34, 34, 34, 34, 34, 64, 34, 34, 34, 34, 34,
-    34, 442, 64, 442, 442, 64, 64, 442, 64, 64, 442, 442, 64, 64, 442, 442,
-    442, 442, 64, 442, 442, 34, 34, 64, 34, 64, 34, 34, 34, 34, 34, 34, 34,
-    64, 34, 34, 34, 34, 34, 34, 34, 442, 442, 64, 442, 442, 442, 442, 64, 64,
-    442, 442, 442, 442, 442, 442, 442, 442, 64, 442, 442, 442, 442, 442, 442,
-    442, 64, 34, 34, 442, 442, 64, 442, 442, 442, 442, 64, 442, 442, 442,
-    442, 442, 64, 442, 64, 64, 64, 442, 442, 442, 442, 442, 442, 442, 64, 34,
-    34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 64, 64, 442, 804, 34, 34, 34,
-    34, 34, 34, 34, 34, 34, 445, 34, 34, 34, 34, 34, 34, 442, 442, 442, 442,
-    442, 442, 442, 442, 442, 804, 34, 34, 34, 34, 34, 34, 34, 34, 34, 445,
-    34, 34, 442, 442, 442, 442, 442, 804, 34, 34, 34, 34, 34, 34, 34, 34, 34,
-    445, 34, 34, 34, 34, 34, 34, 442, 442, 442, 442, 442, 442, 442, 442, 442,
-    804, 34, 445, 34, 34, 34, 34, 34, 34, 34, 34, 442, 34, 64, 64, 805, 805,
-    805, 805, 805, 805, 805, 805, 805, 805, 806, 806, 806, 806, 806, 806,
-    806, 806, 807, 807, 807, 807, 807, 807, 807, 807, 807, 807, 807, 807,
-    807, 807, 807, 806, 806, 806, 806, 807, 807, 807, 807, 807, 807, 807,
-    807, 807, 807, 806, 806, 806, 806, 806, 806, 806, 806, 807, 806, 806,
-    806, 806, 806, 806, 807, 806, 806, 808, 808, 808, 808, 808, 64, 64, 64,
-    64, 64, 64, 64, 807, 807, 807, 807, 807, 64, 807, 807, 807, 807, 807,
-    807, 807, 809, 809, 809, 809, 809, 809, 809, 809, 809, 809, 809, 809,
-    809, 64, 64, 810, 810, 810, 810, 810, 810, 810, 810, 810, 811, 811, 811,
-    811, 811, 811, 811, 64, 126, 126, 126, 126, 64, 126, 126, 126, 64, 126,
-    126, 64, 126, 64, 64, 126, 64, 126, 126, 126, 126, 126, 126, 126, 126,
-    126, 126, 64, 126, 126, 126, 126, 64, 126, 64, 126, 64, 64, 64, 64, 64,
-    64, 126, 64, 64, 64, 64, 126, 64, 126, 64, 126, 64, 126, 126, 126, 64,
-    126, 64, 126, 64, 126, 64, 126, 64, 126, 126, 126, 126, 64, 126, 64, 126,
-    126, 64, 126, 126, 126, 126, 126, 126, 126, 126, 126, 64, 64, 64, 64, 64,
-    126, 126, 126, 64, 126, 126, 126, 113, 113, 64, 64, 64, 64, 64, 64, 64,
-    26, 26, 26, 26, 26, 26, 26, 33, 33, 33, 446, 446, 64, 64, 64, 453, 453,
-    453, 453, 453, 453, 277, 64, 453, 453, 26, 26, 64, 64, 64, 64, 453, 453,
-    453, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 277, 277, 812, 489, 489,
-    64, 64, 64, 64, 64, 489, 489, 489, 64, 64, 64, 64, 64, 489, 64, 64, 64,
-    64, 64, 64, 64, 489, 489, 64, 64, 64, 64, 64, 64, 26, 26, 26, 47, 47, 47,
-    47, 47, 26, 26, 64, 26, 26, 26, 26, 26, 26, 26, 26, 26, 64, 26, 26, 26,
-    26, 64, 64, 64, 64, 64, 64, 64, 26, 26, 26, 26, 26, 64, 64, 64, 496, 496,
-    496, 496, 496, 496, 496, 497, 496, 496, 496, 496, 496, 497, 497, 497,
-    497, 497, 497, 497, 497, 497, 64, 64, 64, 410, 64, 64, 64, 64, 64, 64,
-    410, 410, 410, 410, 410, 410, 410, 410, 565, 565, 565, 565, 565, 565, 64,
-    64,
+    714, 714, 714, 714, 714, 717, 717, 718, 718, 718, 718, 718, 718, 718,
+    718, 718, 718, 718, 718, 718, 718, 718, 82, 82, 82, 718, 718, 718, 718,
+    718, 718, 82, 82, 718, 718, 718, 82, 82, 82, 719, 693, 705, 707, 720,
+    693, 693, 82, 721, 722, 722, 722, 722, 721, 721, 82, 82, 723, 723, 723,
+    724, 508, 82, 82, 725, 725, 725, 725, 725, 725, 725, 725, 725, 725, 725,
+    725, 82, 725, 725, 725, 725, 725, 725, 725, 725, 725, 725, 82, 725, 725,
+    725, 82, 725, 725, 82, 725, 725, 725, 725, 725, 725, 725, 82, 82, 725,
+    725, 725, 82, 82, 82, 82, 82, 199, 373, 199, 82, 82, 82, 82, 620, 620,
+    620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 82, 82, 82, 313,
+    726, 726, 726, 726, 726, 726, 726, 726, 726, 726, 726, 726, 726, 727,
+    727, 727, 727, 728, 728, 728, 728, 728, 728, 728, 728, 728, 728, 728,
+    728, 728, 728, 728, 728, 728, 727, 727, 728, 729, 729, 82, 41, 41, 41,
+    41, 82, 82, 82, 82, 728, 82, 82, 82, 82, 82, 82, 82, 313, 313, 313, 313,
+    313, 157, 82, 82, 730, 730, 730, 730, 730, 730, 730, 730, 730, 730, 730,
+    730, 730, 82, 82, 82, 731, 731, 731, 731, 731, 731, 731, 731, 731, 82,
+    82, 82, 82, 82, 82, 82, 157, 500, 500, 500, 500, 500, 500, 500, 500, 500,
+    500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 82, 82, 82, 82, 732,
+    732, 732, 732, 732, 732, 732, 732, 733, 733, 733, 733, 82, 82, 82, 82,
+    734, 734, 734, 734, 734, 734, 734, 734, 734, 735, 734, 734, 734, 734,
+    734, 734, 734, 734, 735, 82, 82, 82, 82, 82, 736, 736, 736, 736, 736,
+    736, 736, 736, 736, 736, 736, 736, 736, 736, 737, 737, 737, 737, 737, 82,
+    82, 82, 82, 82, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738,
+    738, 738, 738, 82, 739, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740,
+    740, 740, 82, 82, 82, 82, 741, 742, 742, 742, 742, 742, 82, 82, 743, 743,
+    743, 743, 743, 743, 743, 743, 744, 744, 744, 744, 744, 744, 744, 744,
+    745, 745, 745, 745, 745, 745, 745, 745, 746, 746, 746, 746, 746, 746,
+    746, 746, 746, 746, 746, 746, 746, 746, 82, 82, 747, 747, 747, 747, 747,
+    747, 747, 747, 747, 747, 82, 82, 82, 82, 82, 82, 748, 748, 748, 748, 748,
+    748, 748, 748, 748, 748, 748, 748, 82, 82, 82, 82, 749, 749, 749, 749,
+    749, 749, 749, 749, 749, 749, 749, 749, 82, 82, 82, 82, 750, 750, 750,
+    750, 750, 750, 750, 750, 751, 751, 751, 751, 751, 751, 751, 751, 751,
+    751, 751, 751, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 752, 753, 753,
+    753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 82, 753,
+    753, 753, 753, 753, 753, 82, 82, 754, 754, 754, 754, 754, 754, 82, 82,
+    754, 82, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754,
+    754, 754, 754, 754, 754, 754, 754, 82, 754, 754, 82, 82, 82, 754, 82, 82,
+    754, 755, 755, 755, 755, 755, 755, 755, 755, 755, 755, 755, 755, 755,
+    755, 82, 756, 757, 757, 757, 757, 757, 757, 757, 757, 758, 758, 758, 758,
+    758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 759, 759, 760,
+    760, 760, 760, 760, 760, 760, 761, 761, 761, 761, 761, 761, 761, 761,
+    761, 761, 761, 761, 761, 761, 761, 82, 82, 82, 82, 82, 82, 82, 82, 762,
+    762, 762, 762, 762, 762, 762, 762, 762, 763, 763, 763, 763, 763, 763,
+    763, 763, 763, 763, 763, 82, 763, 763, 82, 82, 82, 82, 82, 764, 764, 764,
+    764, 764, 765, 765, 765, 765, 765, 765, 765, 765, 765, 765, 765, 765,
+    765, 765, 766, 766, 766, 766, 766, 766, 82, 82, 82, 767, 768, 768, 768,
+    768, 768, 768, 768, 768, 768, 768, 82, 82, 82, 82, 82, 769, 770, 770,
+    770, 770, 770, 770, 770, 770, 771, 771, 771, 771, 771, 771, 771, 771, 82,
+    82, 82, 82, 772, 772, 771, 771, 772, 772, 772, 772, 772, 772, 772, 772,
+    82, 82, 772, 772, 772, 772, 772, 772, 773, 774, 774, 774, 82, 774, 774,
+    82, 82, 82, 82, 82, 774, 775, 774, 776, 773, 773, 773, 773, 82, 773, 773,
+    773, 82, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773,
+    773, 773, 773, 773, 773, 773, 82, 82, 82, 82, 776, 777, 775, 82, 82, 82,
+    82, 778, 779, 779, 779, 779, 779, 779, 779, 779, 780, 780, 780, 780, 780,
+    780, 780, 780, 781, 82, 82, 82, 82, 82, 82, 82, 782, 782, 782, 782, 782,
+    782, 782, 782, 782, 782, 782, 782, 782, 783, 783, 784, 785, 785, 785,
+    785, 785, 785, 785, 785, 785, 785, 785, 785, 785, 786, 786, 786, 787,
+    787, 787, 787, 787, 787, 787, 787, 788, 787, 787, 787, 787, 787, 787,
+    787, 787, 787, 787, 787, 787, 789, 790, 82, 82, 82, 82, 791, 791, 791,
+    791, 791, 792, 792, 792, 792, 792, 792, 793, 82, 794, 794, 794, 794, 794,
+    794, 794, 794, 794, 794, 794, 794, 794, 794, 82, 82, 82, 795, 795, 795,
+    795, 795, 795, 795, 796, 796, 796, 796, 796, 796, 796, 796, 796, 796,
+    796, 796, 796, 796, 82, 82, 797, 797, 797, 797, 797, 797, 797, 797, 798,
+    798, 798, 798, 798, 798, 798, 798, 798, 798, 798, 82, 82, 82, 82, 82,
+    799, 799, 799, 799, 799, 799, 799, 799, 800, 800, 800, 800, 800, 800,
+    800, 800, 800, 800, 82, 82, 82, 82, 82, 82, 82, 801, 801, 801, 801, 82,
+    82, 82, 82, 802, 802, 802, 802, 802, 802, 802, 803, 803, 803, 803, 803,
+    803, 803, 803, 803, 82, 82, 82, 82, 82, 82, 82, 804, 804, 804, 804, 804,
+    804, 804, 804, 804, 804, 804, 82, 82, 82, 82, 82, 805, 805, 805, 805,
+    805, 805, 805, 805, 805, 805, 805, 82, 82, 82, 82, 82, 82, 82, 806, 806,
+    806, 806, 806, 806, 807, 807, 807, 807, 807, 807, 807, 807, 807, 807,
+    807, 807, 807, 807, 807, 82, 808, 809, 808, 810, 810, 810, 810, 810, 810,
+    810, 810, 810, 810, 810, 810, 810, 809, 809, 809, 809, 809, 809, 809,
+    809, 809, 809, 809, 809, 809, 809, 811, 812, 812, 813, 813, 813, 813,
+    813, 82, 82, 82, 82, 814, 814, 814, 814, 814, 814, 814, 814, 814, 814,
+    814, 814, 814, 814, 814, 814, 814, 814, 814, 814, 815, 815, 815, 815,
+    815, 815, 815, 815, 815, 815, 82, 82, 82, 82, 82, 82, 82, 811, 816, 816,
+    817, 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, 818,
+    817, 817, 817, 816, 816, 816, 816, 817, 817, 819, 820, 821, 821, 822,
+    823, 823, 823, 823, 82, 82, 82, 82, 82, 82, 824, 824, 824, 824, 824, 824,
+    824, 824, 824, 82, 82, 82, 82, 82, 82, 82, 825, 825, 825, 825, 825, 825,
+    825, 825, 825, 825, 82, 82, 82, 82, 82, 82, 826, 826, 826, 827, 827, 827,
+    827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827,
+    827, 827, 827, 828, 828, 828, 828, 828, 829, 828, 828, 828, 828, 828,
+    828, 830, 830, 82, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 832,
+    832, 832, 832, 82, 82, 82, 82, 833, 833, 833, 833, 833, 833, 833, 833,
+    833, 833, 833, 834, 835, 836, 833, 82, 837, 837, 838, 839, 839, 839, 839,
+    839, 839, 839, 839, 839, 839, 839, 839, 839, 839, 839, 839, 838, 838,
+    838, 837, 837, 837, 837, 837, 837, 837, 837, 837, 838, 840, 839, 839,
+    839, 839, 841, 841, 842, 841, 842, 843, 837, 837, 842, 82, 82, 844, 844,
+    844, 844, 844, 844, 844, 844, 844, 844, 839, 845, 839, 841, 841, 841, 82,
+    846, 846, 846, 846, 846, 846, 846, 846, 846, 846, 846, 846, 846, 846,
+    846, 846, 846, 846, 846, 846, 82, 82, 82, 847, 847, 847, 847, 847, 847,
+    847, 847, 847, 847, 82, 847, 847, 847, 847, 847, 847, 847, 847, 847, 848,
+    848, 848, 849, 849, 849, 848, 848, 849, 850, 851, 849, 852, 852, 853,
+    852, 852, 853, 849, 82, 854, 854, 854, 854, 854, 854, 854, 82, 854, 82,
+    854, 854, 854, 854, 82, 854, 854, 854, 854, 854, 854, 854, 854, 854, 854,
+    854, 854, 854, 854, 854, 82, 854, 854, 855, 82, 82, 82, 82, 82, 82, 856,
+    856, 856, 856, 856, 856, 856, 856, 856, 856, 856, 856, 856, 856, 856,
+    857, 858, 858, 858, 857, 857, 857, 857, 857, 857, 859, 860, 82, 82, 82,
+    82, 82, 861, 861, 861, 861, 861, 861, 861, 861, 861, 861, 82, 82, 82, 82,
+    82, 82, 862, 862, 863, 863, 82, 864, 864, 864, 864, 864, 864, 864, 864,
+    82, 82, 864, 864, 82, 82, 864, 864, 864, 864, 864, 864, 864, 864, 864,
+    864, 864, 864, 864, 864, 82, 864, 864, 864, 864, 864, 864, 864, 82, 864,
+    864, 82, 864, 864, 864, 864, 864, 82, 82, 865, 864, 863, 863, 862, 863,
+    863, 863, 863, 82, 82, 863, 863, 82, 82, 863, 863, 866, 82, 82, 864, 82,
+    82, 82, 82, 82, 82, 863, 82, 82, 82, 82, 82, 864, 864, 864, 864, 864,
+    863, 863, 82, 82, 867, 867, 867, 867, 867, 867, 867, 82, 82, 82, 868,
+    868, 868, 868, 868, 868, 868, 868, 868, 868, 868, 868, 868, 869, 869,
+    869, 870, 870, 870, 870, 870, 870, 870, 870, 869, 869, 871, 870, 870,
+    869, 872, 868, 868, 868, 868, 873, 873, 873, 873, 874, 875, 875, 875,
+    875, 875, 875, 875, 875, 875, 875, 82, 873, 82, 874, 82, 82, 876, 876,
+    876, 876, 876, 876, 876, 876, 877, 877, 877, 878, 878, 878, 878, 878,
+    878, 877, 878, 877, 877, 877, 877, 878, 878, 877, 879, 880, 876, 876,
+    881, 876, 882, 882, 882, 882, 882, 882, 882, 882, 882, 882, 82, 82, 82,
+    82, 82, 82, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883,
+    883, 883, 883, 884, 884, 884, 885, 885, 885, 885, 82, 82, 884, 884, 884,
+    884, 885, 885, 884, 886, 887, 888, 889, 889, 890, 890, 891, 891, 891,
+    889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889,
+    889, 883, 883, 883, 883, 885, 885, 82, 82, 892, 892, 892, 892, 892, 892,
+    892, 892, 893, 893, 893, 894, 894, 894, 894, 894, 894, 894, 894, 893,
+    893, 894, 893, 895, 894, 896, 896, 897, 892, 82, 82, 82, 898, 898, 898,
+    898, 898, 898, 898, 898, 898, 898, 82, 82, 82, 82, 82, 82, 899, 899, 899,
+    899, 899, 899, 899, 899, 899, 899, 899, 899, 899, 82, 82, 82, 900, 900,
+    900, 900, 900, 900, 900, 900, 900, 900, 900, 901, 902, 901, 902, 902,
+    901, 901, 901, 901, 901, 901, 903, 904, 905, 905, 905, 905, 905, 905,
+    905, 905, 905, 905, 82, 82, 82, 82, 82, 82, 906, 906, 906, 906, 906, 906,
+    906, 906, 906, 906, 82, 82, 82, 907, 907, 907, 908, 908, 907, 907, 907,
+    907, 908, 907, 907, 907, 907, 909, 82, 82, 82, 82, 910, 910, 910, 910,
+    910, 910, 910, 910, 910, 910, 911, 911, 912, 912, 912, 913, 914, 914,
+    914, 914, 914, 914, 914, 914, 915, 915, 915, 915, 915, 915, 915, 915,
+    916, 916, 916, 916, 916, 916, 916, 916, 916, 916, 917, 917, 917, 917,
+    917, 917, 917, 917, 917, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+    918, 919, 919, 919, 919, 919, 919, 919, 919, 919, 82, 82, 82, 82, 82, 82,
+    82, 920, 920, 920, 920, 920, 920, 920, 920, 920, 82, 920, 920, 920, 920,
+    920, 920, 920, 920, 920, 920, 920, 920, 920, 921, 922, 922, 922, 922,
+    922, 922, 922, 82, 922, 922, 922, 922, 922, 922, 921, 923, 920, 924, 924,
+    924, 924, 924, 82, 82, 925, 925, 925, 925, 925, 925, 925, 925, 925, 925,
+    926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926,
+    926, 926, 926, 926, 926, 82, 82, 82, 927, 928, 929, 929, 929, 929, 929,
+    929, 929, 929, 929, 929, 929, 929, 929, 929, 82, 82, 930, 930, 930, 930,
+    930, 930, 930, 930, 930, 930, 930, 930, 930, 930, 82, 931, 930, 930, 930,
+    930, 930, 930, 930, 931, 930, 930, 931, 930, 930, 82, 932, 932, 932, 932,
+    932, 932, 932, 932, 932, 932, 82, 82, 82, 82, 82, 82, 933, 933, 933, 933,
+    933, 933, 933, 933, 933, 933, 933, 933, 933, 933, 933, 82, 934, 934, 934,
+    934, 934, 82, 82, 82, 932, 932, 932, 932, 82, 82, 82, 82, 935, 935, 935,
+    935, 935, 935, 935, 935, 936, 936, 936, 937, 937, 937, 935, 935, 935,
+    935, 937, 935, 935, 935, 936, 937, 936, 937, 935, 935, 935, 935, 935,
+    935, 935, 936, 937, 937, 935, 935, 935, 935, 935, 935, 935, 935, 935,
+    935, 935, 82, 938, 938, 938, 938, 938, 938, 938, 938, 938, 938, 938, 938,
+    938, 938, 939, 940, 938, 938, 938, 938, 938, 938, 938, 82, 609, 82, 82,
+    82, 82, 82, 82, 82, 941, 941, 941, 941, 941, 941, 941, 941, 941, 941,
+    941, 941, 941, 941, 941, 82, 942, 942, 942, 942, 942, 942, 942, 942, 942,
+    942, 82, 82, 82, 82, 943, 943, 944, 944, 944, 944, 944, 944, 944, 944,
+    944, 944, 944, 944, 944, 944, 82, 82, 945, 945, 945, 945, 945, 946, 82,
+    82, 947, 947, 947, 947, 947, 947, 947, 947, 948, 948, 948, 948, 948, 948,
+    948, 949, 949, 949, 950, 950, 951, 951, 951, 951, 952, 952, 952, 952,
+    949, 951, 82, 82, 953, 953, 953, 953, 953, 953, 953, 953, 953, 953, 82,
+    954, 954, 954, 954, 954, 954, 954, 82, 947, 947, 947, 947, 947, 82, 82,
+    82, 82, 82, 947, 947, 947, 955, 955, 955, 955, 955, 955, 955, 955, 955,
+    955, 955, 955, 955, 82, 82, 82, 955, 956, 956, 956, 956, 956, 956, 956,
+    956, 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
+    956, 82, 82, 82, 82, 82, 82, 82, 82, 957, 957, 957, 957, 958, 958, 958,
+    958, 958, 958, 958, 958, 958, 958, 958, 958, 958, 959, 82, 82, 82, 82,
+    82, 82, 82, 960, 960, 960, 960, 960, 960, 960, 960, 960, 960, 960, 960,
+    960, 82, 82, 82, 960, 960, 960, 82, 82, 82, 82, 82, 580, 575, 82, 82, 82,
+    82, 82, 82, 961, 961, 961, 961, 961, 961, 961, 961, 961, 961, 961, 82,
+    82, 82, 82, 82, 961, 961, 961, 961, 961, 82, 82, 82, 961, 82, 82, 82, 82,
+    82, 82, 82, 961, 961, 82, 82, 962, 963, 964, 965, 499, 499, 499, 499, 82,
+    82, 82, 82, 313, 313, 313, 313, 313, 313, 82, 82, 313, 313, 313, 313,
+    313, 313, 313, 82, 82, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+    313, 313, 966, 966, 447, 447, 447, 313, 313, 313, 967, 966, 966, 966,
+    966, 966, 499, 499, 499, 499, 499, 499, 499, 499, 157, 157, 157, 157,
+    157, 157, 157, 157, 313, 313, 97, 97, 97, 97, 97, 157, 157, 313, 313,
+    313, 313, 313, 313, 97, 97, 97, 97, 313, 313, 313, 82, 82, 82, 82, 82,
+    82, 82, 728, 728, 968, 968, 968, 728, 82, 82, 620, 620, 82, 82, 82, 82,
+    82, 82, 506, 506, 506, 506, 506, 506, 506, 506, 506, 506, 50, 50, 50, 50,
+    50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 506, 506, 506,
+    506, 506, 506, 506, 506, 506, 506, 50, 50, 50, 50, 50, 50, 50, 82, 50,
+    50, 50, 50, 50, 50, 506, 82, 506, 506, 82, 82, 506, 82, 82, 506, 506, 82,
+    82, 506, 506, 506, 506, 82, 506, 506, 50, 50, 82, 50, 82, 50, 50, 50, 50,
+    50, 50, 50, 82, 50, 50, 50, 50, 50, 50, 50, 506, 506, 82, 506, 506, 506,
+    506, 82, 82, 506, 506, 506, 506, 506, 506, 506, 506, 82, 506, 506, 506,
+    506, 506, 506, 506, 82, 50, 50, 506, 506, 82, 506, 506, 506, 506, 82,
+    506, 506, 506, 506, 506, 82, 506, 82, 82, 82, 506, 506, 506, 506, 506,
+    506, 506, 82, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 82, 82,
+    506, 969, 50, 50, 50, 50, 50, 50, 50, 50, 50, 513, 50, 50, 50, 50, 50,
+    50, 506, 506, 506, 506, 506, 506, 506, 506, 506, 969, 50, 50, 50, 50, 50,
+    50, 50, 50, 50, 513, 50, 50, 506, 506, 506, 506, 506, 969, 50, 50, 50,
+    50, 50, 50, 50, 50, 50, 513, 50, 50, 50, 50, 50, 50, 506, 506, 506, 506,
+    506, 506, 506, 506, 506, 969, 50, 513, 50, 50, 50, 50, 50, 50, 50, 50,
+    506, 50, 82, 82, 970, 970, 970, 970, 970, 970, 970, 970, 970, 970, 971,
+    971, 971, 971, 971, 971, 971, 971, 972, 972, 972, 972, 972, 972, 972,
+    972, 972, 972, 972, 972, 972, 972, 972, 971, 971, 971, 971, 972, 972,
+    972, 972, 972, 972, 972, 972, 972, 972, 971, 971, 971, 971, 971, 971,
+    971, 971, 972, 971, 971, 971, 971, 971, 971, 972, 971, 971, 973, 973,
+    973, 973, 974, 82, 82, 82, 82, 82, 82, 82, 972, 972, 972, 972, 972, 82,
+    972, 972, 972, 972, 972, 972, 972, 975, 975, 975, 975, 975, 975, 975, 82,
+    975, 975, 975, 975, 975, 975, 975, 975, 975, 82, 82, 975, 975, 975, 975,
+    975, 975, 975, 82, 975, 975, 82, 975, 975, 975, 975, 975, 82, 82, 82, 82,
+    82, 976, 976, 976, 976, 976, 976, 976, 976, 976, 976, 976, 976, 976, 82,
+    82, 977, 977, 977, 977, 977, 977, 977, 977, 977, 978, 978, 978, 978, 978,
+    978, 978, 82, 979, 979, 979, 979, 979, 979, 979, 979, 979, 979, 980, 980,
+    980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980,
+    980, 980, 981, 981, 981, 981, 981, 981, 982, 82, 82, 82, 82, 82, 983,
+    983, 983, 983, 983, 983, 983, 983, 983, 983, 82, 82, 82, 82, 984, 984,
+    147, 147, 147, 147, 82, 147, 147, 147, 82, 147, 147, 82, 147, 82, 82,
+    147, 82, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 82, 147, 147,
+    147, 147, 82, 147, 82, 147, 82, 82, 82, 82, 82, 82, 147, 82, 82, 82, 82,
+    147, 82, 147, 82, 147, 82, 147, 147, 147, 82, 147, 82, 147, 82, 147, 82,
+    147, 82, 147, 147, 147, 147, 82, 147, 82, 147, 147, 82, 147, 147, 147,
+    147, 147, 147, 147, 147, 147, 82, 82, 82, 82, 82, 147, 147, 147, 82, 147,
+    147, 147, 133, 133, 82, 82, 82, 82, 82, 82, 527, 527, 527, 527, 523, 527,
+    527, 527, 527, 527, 527, 527, 527, 527, 527, 527, 527, 527, 527, 527,
+    985, 985, 985, 985, 985, 985, 985, 985, 985, 985, 985, 985, 527, 527,
+    527, 527, 527, 527, 527, 985, 985, 527, 527, 527, 527, 527, 527, 527,
+    527, 527, 527, 527, 527, 527, 527, 523, 527, 527, 527, 527, 527, 527,
+    985, 985, 48, 48, 48, 516, 516, 985, 985, 985, 528, 528, 528, 528, 528,
+    528, 313, 985, 528, 528, 41, 41, 985, 985, 985, 985, 528, 528, 528, 528,
+    528, 528, 986, 528, 528, 986, 986, 986, 986, 986, 986, 986, 986, 986,
+    986, 528, 528, 528, 528, 528, 528, 528, 528, 528, 528, 985, 985, 985,
+    985, 985, 985, 985, 985, 985, 987, 987, 987, 987, 987, 987, 987, 987,
+    987, 987, 988, 586, 586, 985, 985, 985, 985, 985, 586, 586, 586, 586,
+    985, 985, 985, 985, 586, 985, 985, 985, 985, 985, 985, 985, 586, 586,
+    985, 985, 985, 985, 985, 985, 523, 527, 527, 527, 527, 527, 527, 527,
+    527, 527, 527, 527, 527, 523, 523, 523, 523, 523, 523, 523, 523, 523,
+    527, 523, 523, 523, 523, 523, 523, 527, 523, 523, 523, 523, 523, 523,
+    523, 534, 523, 523, 523, 523, 523, 523, 527, 527, 527, 527, 527, 527,
+    527, 527, 41, 41, 527, 527, 523, 523, 523, 523, 523, 526, 526, 523, 523,
+    523, 523, 523, 526, 523, 523, 523, 523, 523, 523, 534, 534, 523, 523,
+    523, 523, 523, 534, 532, 527, 527, 527, 523, 523, 527, 527, 527, 523,
+    527, 527, 527, 523, 523, 523, 989, 989, 989, 989, 989, 523, 523, 523,
+    523, 523, 523, 523, 527, 523, 527, 534, 534, 523, 523, 534, 534, 534,
+    534, 534, 534, 534, 534, 534, 534, 534, 523, 523, 523, 523, 523, 523,
+    523, 523, 523, 523, 523, 523, 523, 534, 534, 534, 534, 523, 523, 523,
+    523, 534, 523, 534, 523, 523, 523, 534, 523, 523, 523, 523, 534, 534,
+    534, 523, 534, 534, 534, 526, 523, 526, 523, 526, 523, 523, 523, 523,
+    523, 534, 523, 523, 523, 523, 526, 523, 526, 526, 523, 523, 523, 523,
+    523, 523, 523, 523, 523, 523, 527, 527, 523, 526, 526, 526, 526, 526,
+    526, 526, 523, 523, 523, 523, 523, 523, 523, 523, 526, 526, 526, 526,
+    526, 526, 523, 523, 523, 523, 523, 526, 526, 526, 526, 526, 526, 526,
+    526, 526, 526, 526, 526, 41, 41, 41, 41, 527, 523, 523, 523, 523, 527,
+    527, 527, 527, 527, 527, 532, 527, 527, 527, 527, 534, 527, 527, 527,
+    527, 527, 532, 527, 527, 527, 527, 534, 534, 527, 527, 527, 527, 527, 41,
+    41, 41, 41, 41, 41, 41, 41, 527, 527, 527, 527, 41, 41, 527, 523, 523,
+    523, 523, 523, 523, 523, 523, 523, 523, 534, 534, 534, 523, 523, 523,
+    534, 534, 534, 534, 534, 41, 41, 41, 41, 41, 41, 536, 536, 536, 990, 990,
+    990, 41, 41, 41, 41, 523, 523, 523, 534, 523, 523, 523, 523, 523, 523,
+    523, 523, 534, 534, 534, 523, 534, 523, 523, 523, 523, 523, 527, 527,
+    523, 523, 523, 985, 985, 985, 985, 985, 527, 527, 527, 523, 523, 985,
+    985, 985, 527, 527, 527, 527, 523, 523, 523, 985, 41, 41, 41, 41, 985,
+    985, 985, 985, 41, 41, 41, 41, 41, 985, 985, 985, 41, 41, 985, 985, 985,
+    985, 985, 985, 41, 41, 41, 41, 41, 41, 985, 985, 534, 534, 534, 534, 534,
+    534, 534, 985, 523, 523, 523, 523, 523, 523, 534, 523, 534, 985, 985,
+    534, 534, 534, 534, 534, 534, 534, 523, 523, 534, 534, 534, 985, 523,
+    523, 523, 523, 985, 985, 985, 985, 523, 523, 523, 523, 523, 523, 523,
+    985, 523, 523, 985, 985, 985, 985, 985, 985, 523, 985, 985, 985, 985,
+    985, 985, 985, 985, 985, 985, 985, 985, 985, 82, 82, 593, 593, 593, 593,
+    593, 593, 593, 594, 593, 593, 593, 593, 593, 594, 594, 594, 594, 594,
+    594, 594, 594, 594, 82, 82, 82, 499, 82, 82, 82, 82, 82, 82, 499, 499,
+    499, 499, 499, 499, 499, 499, 671, 671, 671, 671, 671, 671, 82, 82,
 };
 
 /* decomposition data */
@@ -3874,98 +4326,98 @@
     25429, 266, 19968, 266, 19977, 266, 36938, 266, 24038, 266, 20013, 266,
     21491, 266, 25351, 266, 36208, 266, 25171, 266, 31105, 266, 31354, 266,
     21512, 266, 28288, 266, 26377, 266, 26376, 266, 30003, 266, 21106, 266,
-    21942, 770, 12308, 26412, 12309, 770, 12308, 19977, 12309, 770, 12308,
-    20108, 12309, 770, 12308, 23433, 12309, 770, 12308, 28857, 12309, 770,
-    12308, 25171, 12309, 770, 12308, 30423, 12309, 770, 12308, 21213, 12309,
-    770, 12308, 25943, 12309, 263, 24471, 263, 21487, 256, 20029, 256, 20024,
-    256, 20033, 256, 55360, 56610, 256, 20320, 256, 20398, 256, 20411, 256,
-    20482, 256, 20602, 256, 20633, 256, 20711, 256, 20687, 256, 13470, 256,
-    55361, 56890, 256, 20813, 256, 20820, 256, 20836, 256, 20855, 256, 55361,
-    56604, 256, 13497, 256, 20839, 256, 20877, 256, 55361, 56651, 256, 20887,
-    256, 20900, 256, 20172, 256, 20908, 256, 20917, 256, 55396, 56799, 256,
-    20981, 256, 20995, 256, 13535, 256, 21051, 256, 21062, 256, 21106, 256,
-    21111, 256, 13589, 256, 21191, 256, 21193, 256, 21220, 256, 21242, 256,
-    21253, 256, 21254, 256, 21271, 256, 21321, 256, 21329, 256, 21338, 256,
-    21363, 256, 21373, 256, 21375, 256, 21375, 256, 21375, 256, 55362, 56876,
-    256, 28784, 256, 21450, 256, 21471, 256, 55362, 57187, 256, 21483, 256,
-    21489, 256, 21510, 256, 21662, 256, 21560, 256, 21576, 256, 21608, 256,
-    21666, 256, 21750, 256, 21776, 256, 21843, 256, 21859, 256, 21892, 256,
-    21892, 256, 21913, 256, 21931, 256, 21939, 256, 21954, 256, 22294, 256,
-    22022, 256, 22295, 256, 22097, 256, 22132, 256, 20999, 256, 22766, 256,
-    22478, 256, 22516, 256, 22541, 256, 22411, 256, 22578, 256, 22577, 256,
-    22700, 256, 55365, 56548, 256, 22770, 256, 22775, 256, 22790, 256, 22810,
-    256, 22818, 256, 22882, 256, 55365, 57000, 256, 55365, 57066, 256, 23020,
-    256, 23067, 256, 23079, 256, 23000, 256, 23142, 256, 14062, 256, 14076,
-    256, 23304, 256, 23358, 256, 23358, 256, 55366, 56776, 256, 23491, 256,
-    23512, 256, 23527, 256, 23539, 256, 55366, 57112, 256, 23551, 256, 23558,
-    256, 24403, 256, 23586, 256, 14209, 256, 23648, 256, 23662, 256, 23744,
-    256, 23693, 256, 55367, 56804, 256, 23875, 256, 55367, 56806, 256, 23918,
-    256, 23915, 256, 23932, 256, 24033, 256, 24034, 256, 14383, 256, 24061,
-    256, 24104, 256, 24125, 256, 24169, 256, 14434, 256, 55368, 56707, 256,
-    14460, 256, 24240, 256, 24243, 256, 24246, 256, 24266, 256, 55400, 57234,
-    256, 24318, 256, 55368, 57137, 256, 55368, 57137, 256, 33281, 256, 24354,
-    256, 24354, 256, 14535, 256, 55372, 57016, 256, 55384, 56794, 256, 24418,
-    256, 24427, 256, 14563, 256, 24474, 256, 24525, 256, 24535, 256, 24569,
-    256, 24705, 256, 14650, 256, 14620, 256, 24724, 256, 55369, 57044, 256,
-    24775, 256, 24904, 256, 24908, 256, 24910, 256, 24908, 256, 24954, 256,
-    24974, 256, 25010, 256, 24996, 256, 25007, 256, 25054, 256, 25074, 256,
-    25078, 256, 25104, 256, 25115, 256, 25181, 256, 25265, 256, 25300, 256,
-    25424, 256, 55370, 57100, 256, 25405, 256, 25340, 256, 25448, 256, 25475,
-    256, 25572, 256, 55370, 57329, 256, 25634, 256, 25541, 256, 25513, 256,
-    14894, 256, 25705, 256, 25726, 256, 25757, 256, 25719, 256, 14956, 256,
-    25935, 256, 25964, 256, 55372, 56330, 256, 26083, 256, 26360, 256, 26185,
-    256, 15129, 256, 26257, 256, 15112, 256, 15076, 256, 20882, 256, 20885,
-    256, 26368, 256, 26268, 256, 32941, 256, 17369, 256, 26391, 256, 26395,
-    256, 26401, 256, 26462, 256, 26451, 256, 55372, 57283, 256, 15177, 256,
-    26618, 256, 26501, 256, 26706, 256, 26757, 256, 55373, 56429, 256, 26766,
-    256, 26655, 256, 26900, 256, 15261, 256, 26946, 256, 27043, 256, 27114,
-    256, 27304, 256, 55373, 56995, 256, 27355, 256, 15384, 256, 27425, 256,
-    55374, 56487, 256, 27476, 256, 15438, 256, 27506, 256, 27551, 256, 27578,
-    256, 27579, 256, 55374, 56973, 256, 55367, 56587, 256, 55374, 57082, 256,
-    27726, 256, 55375, 56508, 256, 27839, 256, 27853, 256, 27751, 256, 27926,
-    256, 27966, 256, 28023, 256, 27969, 256, 28009, 256, 28024, 256, 28037,
-    256, 55375, 56606, 256, 27956, 256, 28207, 256, 28270, 256, 15667, 256,
-    28363, 256, 28359, 256, 55375, 57041, 256, 28153, 256, 28526, 256, 55375,
-    57182, 256, 55375, 57230, 256, 28614, 256, 28729, 256, 28702, 256, 28699,
-    256, 15766, 256, 28746, 256, 28797, 256, 28791, 256, 28845, 256, 55361,
-    56613, 256, 28997, 256, 55376, 56931, 256, 29084, 256, 55376, 57259, 256,
-    29224, 256, 29237, 256, 29264, 256, 55377, 56840, 256, 29312, 256, 29333,
-    256, 55377, 57141, 256, 55378, 56340, 256, 29562, 256, 29579, 256, 16044,
-    256, 29605, 256, 16056, 256, 16056, 256, 29767, 256, 29788, 256, 29809,
-    256, 29829, 256, 29898, 256, 16155, 256, 29988, 256, 55379, 56374, 256,
-    30014, 256, 55379, 56466, 256, 30064, 256, 55368, 56735, 256, 30224, 256,
-    55379, 57249, 256, 55379, 57272, 256, 55380, 56388, 256, 16380, 256,
-    16392, 256, 30452, 256, 55380, 56563, 256, 55380, 56562, 256, 55380,
-    56601, 256, 55380, 56627, 256, 30494, 256, 30495, 256, 30495, 256, 30538,
-    256, 16441, 256, 30603, 256, 16454, 256, 16534, 256, 55381, 56349, 256,
-    30798, 256, 30860, 256, 30924, 256, 16611, 256, 55381, 56870, 256, 31062,
-    256, 55381, 56986, 256, 55381, 57029, 256, 31119, 256, 31211, 256, 16687,
-    256, 31296, 256, 31306, 256, 31311, 256, 55382, 56700, 256, 55382, 56999,
-    256, 55382, 56999, 256, 31470, 256, 16898, 256, 55382, 57259, 256, 31686,
-    256, 31689, 256, 16935, 256, 55383, 56448, 256, 31954, 256, 17056, 256,
-    31976, 256, 31971, 256, 32000, 256, 55383, 57222, 256, 32099, 256, 17153,
-    256, 32199, 256, 32258, 256, 32325, 256, 17204, 256, 55384, 56872, 256,
-    55384, 56903, 256, 17241, 256, 55384, 57049, 256, 32634, 256, 55384,
-    57150, 256, 32661, 256, 32762, 256, 32773, 256, 55385, 56538, 256, 55385,
-    56611, 256, 32864, 256, 55385, 56744, 256, 32880, 256, 55372, 57183, 256,
-    17365, 256, 32946, 256, 33027, 256, 17419, 256, 33086, 256, 23221, 256,
-    55385, 57255, 256, 55385, 57269, 256, 55372, 57235, 256, 55372, 57244,
-    256, 33281, 256, 33284, 256, 36766, 256, 17515, 256, 33425, 256, 33419,
-    256, 33437, 256, 21171, 256, 33457, 256, 33459, 256, 33469, 256, 33510,
-    256, 55386, 57148, 256, 33509, 256, 33565, 256, 33635, 256, 33709, 256,
-    33571, 256, 33725, 256, 33767, 256, 33879, 256, 33619, 256, 33738, 256,
-    33740, 256, 33756, 256, 55387, 56374, 256, 55387, 56683, 256, 55387,
-    56533, 256, 17707, 256, 34033, 256, 34035, 256, 34070, 256, 55388, 57290,
-    256, 34148, 256, 55387, 57132, 256, 17757, 256, 17761, 256, 55387, 57265,
-    256, 55388, 56530, 256, 17771, 256, 34384, 256, 34396, 256, 34407, 256,
-    34409, 256, 34473, 256, 34440, 256, 34574, 256, 34530, 256, 34681, 256,
-    34600, 256, 34667, 256, 34694, 256, 17879, 256, 34785, 256, 34817, 256,
-    17913, 256, 34912, 256, 34915, 256, 55389, 56935, 256, 35031, 256, 35038,
-    256, 17973, 256, 35066, 256, 13499, 256, 55390, 56494, 256, 55390, 56678,
-    256, 18110, 256, 18119, 256, 35488, 256, 35565, 256, 35722, 256, 35925,
-    256, 55391, 56488, 256, 36011, 256, 36033, 256, 36123, 256, 36215, 256,
-    55391, 57135, 256, 55362, 56324, 256, 36299, 256, 36284, 256, 36336, 256,
-    55362, 56542, 256, 36564, 256, 36664, 256, 55393, 56786, 256, 55393,
+    21942, 266, 37197, 770, 12308, 26412, 12309, 770, 12308, 19977, 12309,
+    770, 12308, 20108, 12309, 770, 12308, 23433, 12309, 770, 12308, 28857,
+    12309, 770, 12308, 25171, 12309, 770, 12308, 30423, 12309, 770, 12308,
+    21213, 12309, 770, 12308, 25943, 12309, 263, 24471, 263, 21487, 256,
+    20029, 256, 20024, 256, 20033, 256, 55360, 56610, 256, 20320, 256, 20398,
+    256, 20411, 256, 20482, 256, 20602, 256, 20633, 256, 20711, 256, 20687,
+    256, 13470, 256, 55361, 56890, 256, 20813, 256, 20820, 256, 20836, 256,
+    20855, 256, 55361, 56604, 256, 13497, 256, 20839, 256, 20877, 256, 55361,
+    56651, 256, 20887, 256, 20900, 256, 20172, 256, 20908, 256, 20917, 256,
+    55396, 56799, 256, 20981, 256, 20995, 256, 13535, 256, 21051, 256, 21062,
+    256, 21106, 256, 21111, 256, 13589, 256, 21191, 256, 21193, 256, 21220,
+    256, 21242, 256, 21253, 256, 21254, 256, 21271, 256, 21321, 256, 21329,
+    256, 21338, 256, 21363, 256, 21373, 256, 21375, 256, 21375, 256, 21375,
+    256, 55362, 56876, 256, 28784, 256, 21450, 256, 21471, 256, 55362, 57187,
+    256, 21483, 256, 21489, 256, 21510, 256, 21662, 256, 21560, 256, 21576,
+    256, 21608, 256, 21666, 256, 21750, 256, 21776, 256, 21843, 256, 21859,
+    256, 21892, 256, 21892, 256, 21913, 256, 21931, 256, 21939, 256, 21954,
+    256, 22294, 256, 22022, 256, 22295, 256, 22097, 256, 22132, 256, 20999,
+    256, 22766, 256, 22478, 256, 22516, 256, 22541, 256, 22411, 256, 22578,
+    256, 22577, 256, 22700, 256, 55365, 56548, 256, 22770, 256, 22775, 256,
+    22790, 256, 22810, 256, 22818, 256, 22882, 256, 55365, 57000, 256, 55365,
+    57066, 256, 23020, 256, 23067, 256, 23079, 256, 23000, 256, 23142, 256,
+    14062, 256, 14076, 256, 23304, 256, 23358, 256, 23358, 256, 55366, 56776,
+    256, 23491, 256, 23512, 256, 23527, 256, 23539, 256, 55366, 57112, 256,
+    23551, 256, 23558, 256, 24403, 256, 23586, 256, 14209, 256, 23648, 256,
+    23662, 256, 23744, 256, 23693, 256, 55367, 56804, 256, 23875, 256, 55367,
+    56806, 256, 23918, 256, 23915, 256, 23932, 256, 24033, 256, 24034, 256,
+    14383, 256, 24061, 256, 24104, 256, 24125, 256, 24169, 256, 14434, 256,
+    55368, 56707, 256, 14460, 256, 24240, 256, 24243, 256, 24246, 256, 24266,
+    256, 55400, 57234, 256, 24318, 256, 55368, 57137, 256, 55368, 57137, 256,
+    33281, 256, 24354, 256, 24354, 256, 14535, 256, 55372, 57016, 256, 55384,
+    56794, 256, 24418, 256, 24427, 256, 14563, 256, 24474, 256, 24525, 256,
+    24535, 256, 24569, 256, 24705, 256, 14650, 256, 14620, 256, 24724, 256,
+    55369, 57044, 256, 24775, 256, 24904, 256, 24908, 256, 24910, 256, 24908,
+    256, 24954, 256, 24974, 256, 25010, 256, 24996, 256, 25007, 256, 25054,
+    256, 25074, 256, 25078, 256, 25104, 256, 25115, 256, 25181, 256, 25265,
+    256, 25300, 256, 25424, 256, 55370, 57100, 256, 25405, 256, 25340, 256,
+    25448, 256, 25475, 256, 25572, 256, 55370, 57329, 256, 25634, 256, 25541,
+    256, 25513, 256, 14894, 256, 25705, 256, 25726, 256, 25757, 256, 25719,
+    256, 14956, 256, 25935, 256, 25964, 256, 55372, 56330, 256, 26083, 256,
+    26360, 256, 26185, 256, 15129, 256, 26257, 256, 15112, 256, 15076, 256,
+    20882, 256, 20885, 256, 26368, 256, 26268, 256, 32941, 256, 17369, 256,
+    26391, 256, 26395, 256, 26401, 256, 26462, 256, 26451, 256, 55372, 57283,
+    256, 15177, 256, 26618, 256, 26501, 256, 26706, 256, 26757, 256, 55373,
+    56429, 256, 26766, 256, 26655, 256, 26900, 256, 15261, 256, 26946, 256,
+    27043, 256, 27114, 256, 27304, 256, 55373, 56995, 256, 27355, 256, 15384,
+    256, 27425, 256, 55374, 56487, 256, 27476, 256, 15438, 256, 27506, 256,
+    27551, 256, 27578, 256, 27579, 256, 55374, 56973, 256, 55367, 56587, 256,
+    55374, 57082, 256, 27726, 256, 55375, 56508, 256, 27839, 256, 27853, 256,
+    27751, 256, 27926, 256, 27966, 256, 28023, 256, 27969, 256, 28009, 256,
+    28024, 256, 28037, 256, 55375, 56606, 256, 27956, 256, 28207, 256, 28270,
+    256, 15667, 256, 28363, 256, 28359, 256, 55375, 57041, 256, 28153, 256,
+    28526, 256, 55375, 57182, 256, 55375, 57230, 256, 28614, 256, 28729, 256,
+    28702, 256, 28699, 256, 15766, 256, 28746, 256, 28797, 256, 28791, 256,
+    28845, 256, 55361, 56613, 256, 28997, 256, 55376, 56931, 256, 29084, 256,
+    55376, 57259, 256, 29224, 256, 29237, 256, 29264, 256, 55377, 56840, 256,
+    29312, 256, 29333, 256, 55377, 57141, 256, 55378, 56340, 256, 29562, 256,
+    29579, 256, 16044, 256, 29605, 256, 16056, 256, 16056, 256, 29767, 256,
+    29788, 256, 29809, 256, 29829, 256, 29898, 256, 16155, 256, 29988, 256,
+    55379, 56374, 256, 30014, 256, 55379, 56466, 256, 30064, 256, 55368,
+    56735, 256, 30224, 256, 55379, 57249, 256, 55379, 57272, 256, 55380,
+    56388, 256, 16380, 256, 16392, 256, 30452, 256, 55380, 56563, 256, 55380,
+    56562, 256, 55380, 56601, 256, 55380, 56627, 256, 30494, 256, 30495, 256,
+    30495, 256, 30538, 256, 16441, 256, 30603, 256, 16454, 256, 16534, 256,
+    55381, 56349, 256, 30798, 256, 30860, 256, 30924, 256, 16611, 256, 55381,
+    56870, 256, 31062, 256, 55381, 56986, 256, 55381, 57029, 256, 31119, 256,
+    31211, 256, 16687, 256, 31296, 256, 31306, 256, 31311, 256, 55382, 56700,
+    256, 55382, 56999, 256, 55382, 56999, 256, 31470, 256, 16898, 256, 55382,
+    57259, 256, 31686, 256, 31689, 256, 16935, 256, 55383, 56448, 256, 31954,
+    256, 17056, 256, 31976, 256, 31971, 256, 32000, 256, 55383, 57222, 256,
+    32099, 256, 17153, 256, 32199, 256, 32258, 256, 32325, 256, 17204, 256,
+    55384, 56872, 256, 55384, 56903, 256, 17241, 256, 55384, 57049, 256,
+    32634, 256, 55384, 57150, 256, 32661, 256, 32762, 256, 32773, 256, 55385,
+    56538, 256, 55385, 56611, 256, 32864, 256, 55385, 56744, 256, 32880, 256,
+    55372, 57183, 256, 17365, 256, 32946, 256, 33027, 256, 17419, 256, 33086,
+    256, 23221, 256, 55385, 57255, 256, 55385, 57269, 256, 55372, 57235, 256,
+    55372, 57244, 256, 33281, 256, 33284, 256, 36766, 256, 17515, 256, 33425,
+    256, 33419, 256, 33437, 256, 21171, 256, 33457, 256, 33459, 256, 33469,
+    256, 33510, 256, 55386, 57148, 256, 33509, 256, 33565, 256, 33635, 256,
+    33709, 256, 33571, 256, 33725, 256, 33767, 256, 33879, 256, 33619, 256,
+    33738, 256, 33740, 256, 33756, 256, 55387, 56374, 256, 55387, 56683, 256,
+    55387, 56533, 256, 17707, 256, 34033, 256, 34035, 256, 34070, 256, 55388,
+    57290, 256, 34148, 256, 55387, 57132, 256, 17757, 256, 17761, 256, 55387,
+    57265, 256, 55388, 56530, 256, 17771, 256, 34384, 256, 34396, 256, 34407,
+    256, 34409, 256, 34473, 256, 34440, 256, 34574, 256, 34530, 256, 34681,
+    256, 34600, 256, 34667, 256, 34694, 256, 17879, 256, 34785, 256, 34817,
+    256, 17913, 256, 34912, 256, 34915, 256, 55389, 56935, 256, 35031, 256,
+    35038, 256, 17973, 256, 35066, 256, 13499, 256, 55390, 56494, 256, 55390,
+    56678, 256, 18110, 256, 18119, 256, 35488, 256, 35565, 256, 35722, 256,
+    35925, 256, 55391, 56488, 256, 36011, 256, 36033, 256, 36123, 256, 36215,
+    256, 55391, 57135, 256, 55362, 56324, 256, 36299, 256, 36284, 256, 36336,
+    256, 55362, 56542, 256, 36564, 256, 36664, 256, 55393, 56786, 256, 55393,
     56813, 256, 37012, 256, 37105, 256, 37137, 256, 55393, 57134, 256, 37147,
     256, 37432, 256, 37591, 256, 37592, 256, 37500, 256, 37881, 256, 37909,
     256, 55394, 57338, 256, 38283, 256, 18837, 256, 38327, 256, 55395, 56695,
@@ -4642,64 +5094,64 @@
     13103, 13105, 13107, 13109, 13111, 13113, 13115, 13117, 13119, 13121,
     13123, 13125, 13127, 13129, 13131, 13133, 13135, 13137, 13139, 13141,
     13143, 13145, 13147, 13149, 13151, 13153, 13155, 13157, 13159, 13161,
-    13163, 13165, 13167, 13169, 13171, 13173, 13175, 13177, 0, 0, 0, 0, 0,
-    13179, 13183, 13187, 13191, 13195, 13199, 13203, 13207, 13211, 0, 0, 0,
-    0, 0, 0, 0, 13215, 13217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    13219, 13221, 13223, 13225, 13228, 13230, 13232, 13234, 13236, 13238,
-    13240, 13242, 13244, 13246, 13249, 13251, 13253, 13255, 13257, 13260,
-    13262, 13264, 13266, 13269, 13271, 13273, 13275, 13277, 13279, 13282,
-    13284, 13286, 13288, 13290, 13292, 13294, 13296, 13298, 13300, 13302,
-    13304, 13306, 13308, 13310, 13312, 13314, 13316, 13318, 13320, 13322,
-    13324, 13326, 13328, 13331, 13333, 13335, 13337, 13340, 13342, 13344,
-    13346, 13348, 13350, 13352, 13354, 13356, 13358, 13360, 13362, 13364,
-    13366, 13368, 13370, 13372, 13374, 13376, 13378, 13380, 13382, 13384,
-    13386, 13388, 13390, 13392, 13394, 13396, 13398, 13400, 13402, 13404,
-    13407, 13409, 13411, 13413, 13415, 13417, 13419, 13422, 13425, 13427,
-    13429, 13431, 13433, 13435, 13437, 13439, 13441, 13443, 13445, 13448,
-    13450, 13452, 13454, 13456, 13459, 13461, 13463, 13465, 13467, 13469,
-    13471, 13473, 13475, 13477, 13480, 13482, 13485, 13487, 13489, 13491,
-    13493, 13495, 13497, 13499, 13501, 13503, 13505, 13507, 13510, 13512,
-    13514, 13516, 13518, 13520, 13523, 13525, 13528, 13531, 13533, 13535,
-    13537, 13539, 13542, 13545, 13547, 13549, 13551, 13553, 13555, 13557,
-    13559, 13561, 13563, 13565, 13567, 13570, 13572, 13574, 13576, 13578,
-    13580, 13582, 13584, 13586, 13588, 13590, 13592, 13594, 13596, 13598,
-    13600, 13602, 13604, 13606, 13608, 13611, 13613, 13615, 13617, 13619,
-    13621, 13624, 13626, 13628, 13630, 13632, 13634, 13636, 13638, 13640,
-    13642, 13644, 13646, 13649, 13651, 13653, 13655, 13657, 13659, 13661,
-    13663, 13665, 13667, 13669, 13671, 13673, 13675, 13677, 13679, 13681,
-    13683, 13685, 13688, 13690, 13692, 13694, 13696, 13698, 13701, 13703,
-    13705, 13707, 13709, 13711, 13713, 13715, 13717, 13720, 13722, 13724,
-    13726, 13729, 13731, 13733, 13735, 13737, 13739, 13741, 13744, 13747,
-    13750, 13752, 13755, 13757, 13759, 13761, 13763, 13765, 13767, 13769,
-    13771, 13773, 13775, 13778, 13780, 13782, 13784, 13786, 13788, 13790,
-    13793, 13795, 13797, 13800, 13803, 13805, 13807, 13809, 13811, 13813,
-    13815, 13817, 13819, 13821, 13824, 13826, 13829, 13831, 13834, 13836,
-    13838, 13840, 13843, 13845, 13847, 13850, 13853, 13855, 13857, 13859,
-    13861, 13863, 13865, 13867, 13869, 13871, 13873, 13875, 13877, 13879,
-    13882, 13884, 13887, 13889, 13892, 13894, 13897, 13900, 13903, 13905,
-    13907, 13909, 13912, 13915, 13918, 13921, 13923, 13925, 13927, 13929,
-    13931, 13933, 13935, 13937, 13940, 13942, 13944, 13946, 13948, 13951,
-    13953, 13956, 13959, 13961, 13963, 13965, 13967, 13969, 13971, 13974,
-    13977, 13980, 13982, 13984, 13987, 13989, 13991, 13993, 13996, 13998,
-    14000, 14002, 14004, 14006, 14009, 14011, 14013, 14015, 14017, 14019,
-    14021, 14024, 14027, 14029, 14032, 14034, 14037, 14039, 14041, 14043,
-    14046, 14049, 14051, 14054, 14056, 14059, 14061, 14063, 14065, 14067,
-    14069, 14071, 14074, 14077, 14080, 14083, 14085, 14087, 14089, 14091,
-    14093, 14095, 14097, 14099, 14101, 14103, 14105, 14107, 14110, 14112,
-    14114, 14116, 14118, 14120, 14122, 14124, 14126, 14128, 14130, 14132,
-    14134, 14137, 14140, 14143, 14145, 14147, 14149, 14151, 14154, 14156,
-    14159, 14161, 14163, 14166, 14169, 14171, 14173, 14175, 14177, 14179,
-    14181, 14183, 14185, 14187, 14189, 14191, 14193, 14195, 14197, 14199,
-    14201, 14203, 14205, 14207, 14210, 14212, 14214, 14216, 14218, 14220,
-    14223, 14226, 14228, 14230, 14232, 14234, 14236, 14238, 14241, 14243,
-    14245, 14247, 14249, 14252, 14255, 14257, 14259, 14261, 14264, 14266,
-    14268, 14271, 14274, 14276, 14278, 14280, 14283, 14285, 14287, 14289,
-    14291, 14293, 14295, 14297, 14300, 14302, 14304, 14306, 14309, 14311,
-    14313, 14315, 14317, 14320, 14323, 14325, 14327, 14329, 14332, 14334,
-    14337, 14339, 14341, 14343, 14346, 14348, 14350, 14352, 14354, 14356,
-    14358, 14360, 14363, 14365, 14367, 14369, 14371, 14373, 14375, 14378,
-    14380, 14383, 14386, 14389, 14391, 14393, 14395, 14397, 14399, 14401,
-    14403, 14405, 0, 0,
+    13163, 13165, 13167, 13169, 13171, 13173, 13175, 13177, 13179, 0, 0, 0,
+    0, 13181, 13185, 13189, 13193, 13197, 13201, 13205, 13209, 13213, 0, 0,
+    0, 0, 0, 0, 0, 13217, 13219, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    13221, 13223, 13225, 13227, 13230, 13232, 13234, 13236, 13238, 13240,
+    13242, 13244, 13246, 13248, 13251, 13253, 13255, 13257, 13259, 13262,
+    13264, 13266, 13268, 13271, 13273, 13275, 13277, 13279, 13281, 13284,
+    13286, 13288, 13290, 13292, 13294, 13296, 13298, 13300, 13302, 13304,
+    13306, 13308, 13310, 13312, 13314, 13316, 13318, 13320, 13322, 13324,
+    13326, 13328, 13330, 13333, 13335, 13337, 13339, 13342, 13344, 13346,
+    13348, 13350, 13352, 13354, 13356, 13358, 13360, 13362, 13364, 13366,
+    13368, 13370, 13372, 13374, 13376, 13378, 13380, 13382, 13384, 13386,
+    13388, 13390, 13392, 13394, 13396, 13398, 13400, 13402, 13404, 13406,
+    13409, 13411, 13413, 13415, 13417, 13419, 13421, 13424, 13427, 13429,
+    13431, 13433, 13435, 13437, 13439, 13441, 13443, 13445, 13447, 13450,
+    13452, 13454, 13456, 13458, 13461, 13463, 13465, 13467, 13469, 13471,
+    13473, 13475, 13477, 13479, 13482, 13484, 13487, 13489, 13491, 13493,
+    13495, 13497, 13499, 13501, 13503, 13505, 13507, 13509, 13512, 13514,
+    13516, 13518, 13520, 13522, 13525, 13527, 13530, 13533, 13535, 13537,
+    13539, 13541, 13544, 13547, 13549, 13551, 13553, 13555, 13557, 13559,
+    13561, 13563, 13565, 13567, 13569, 13572, 13574, 13576, 13578, 13580,
+    13582, 13584, 13586, 13588, 13590, 13592, 13594, 13596, 13598, 13600,
+    13602, 13604, 13606, 13608, 13610, 13613, 13615, 13617, 13619, 13621,
+    13623, 13626, 13628, 13630, 13632, 13634, 13636, 13638, 13640, 13642,
+    13644, 13646, 13648, 13651, 13653, 13655, 13657, 13659, 13661, 13663,
+    13665, 13667, 13669, 13671, 13673, 13675, 13677, 13679, 13681, 13683,
+    13685, 13687, 13690, 13692, 13694, 13696, 13698, 13700, 13703, 13705,
+    13707, 13709, 13711, 13713, 13715, 13717, 13719, 13722, 13724, 13726,
+    13728, 13731, 13733, 13735, 13737, 13739, 13741, 13743, 13746, 13749,
+    13752, 13754, 13757, 13759, 13761, 13763, 13765, 13767, 13769, 13771,
+    13773, 13775, 13777, 13780, 13782, 13784, 13786, 13788, 13790, 13792,
+    13795, 13797, 13799, 13802, 13805, 13807, 13809, 13811, 13813, 13815,
+    13817, 13819, 13821, 13823, 13826, 13828, 13831, 13833, 13836, 13838,
+    13840, 13842, 13845, 13847, 13849, 13852, 13855, 13857, 13859, 13861,
+    13863, 13865, 13867, 13869, 13871, 13873, 13875, 13877, 13879, 13881,
+    13884, 13886, 13889, 13891, 13894, 13896, 13899, 13902, 13905, 13907,
+    13909, 13911, 13914, 13917, 13920, 13923, 13925, 13927, 13929, 13931,
+    13933, 13935, 13937, 13939, 13942, 13944, 13946, 13948, 13950, 13953,
+    13955, 13958, 13961, 13963, 13965, 13967, 13969, 13971, 13973, 13976,
+    13979, 13982, 13984, 13986, 13989, 13991, 13993, 13995, 13998, 14000,
+    14002, 14004, 14006, 14008, 14011, 14013, 14015, 14017, 14019, 14021,
+    14023, 14026, 14029, 14031, 14034, 14036, 14039, 14041, 14043, 14045,
+    14048, 14051, 14053, 14056, 14058, 14061, 14063, 14065, 14067, 14069,
+    14071, 14073, 14076, 14079, 14082, 14085, 14087, 14089, 14091, 14093,
+    14095, 14097, 14099, 14101, 14103, 14105, 14107, 14109, 14112, 14114,
+    14116, 14118, 14120, 14122, 14124, 14126, 14128, 14130, 14132, 14134,
+    14136, 14139, 14142, 14145, 14147, 14149, 14151, 14153, 14156, 14158,
+    14161, 14163, 14165, 14168, 14171, 14173, 14175, 14177, 14179, 14181,
+    14183, 14185, 14187, 14189, 14191, 14193, 14195, 14197, 14199, 14201,
+    14203, 14205, 14207, 14209, 14212, 14214, 14216, 14218, 14220, 14222,
+    14225, 14228, 14230, 14232, 14234, 14236, 14238, 14240, 14243, 14245,
+    14247, 14249, 14251, 14254, 14257, 14259, 14261, 14263, 14266, 14268,
+    14270, 14273, 14276, 14278, 14280, 14282, 14285, 14287, 14289, 14291,
+    14293, 14295, 14297, 14299, 14302, 14304, 14306, 14308, 14311, 14313,
+    14315, 14317, 14319, 14322, 14325, 14327, 14329, 14331, 14334, 14336,
+    14339, 14341, 14343, 14345, 14348, 14350, 14352, 14354, 14356, 14358,
+    14360, 14362, 14365, 14367, 14369, 14371, 14373, 14375, 14377, 14380,
+    14382, 14385, 14388, 14391, 14393, 14395, 14397, 14399, 14401, 14403,
+    14405, 14407, 0, 0,
 };
 
 /* NFC pairs */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-unicode-private.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-unicode-private.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -115,6 +115,8 @@
     /* XXX This hack belongs to the Tibetan shaper:
      * Reorder PADMA to ensure it comes after any vowel marks. */
     if (unlikely (unicode == 0x0FC6u)) return 254;
+    /* Reorder TSA -PHRU to reorder before U+0F74 */
+    if (unlikely (unicode == 0x0F39u)) return 127;
 
     return _hb_modified_combining_class[combining_class (unicode)];
   }
@@ -180,8 +182,8 @@
         case 0x17: return hb_in_range (ch, 0x17B4u, 0x17B5u);
         case 0x18: return hb_in_range (ch, 0x180Bu, 0x180Eu);
         case 0x20: return hb_in_ranges (ch, 0x200Bu, 0x200Fu,
-                                                            0x202Au, 0x202Eu,
-                                                            0x2060u, 0x206Fu);
+                                            0x202Au, 0x202Eu,
+                                            0x2060u, 0x206Fu);
         case 0xFE: return hb_in_range (ch, 0xFE00u, 0xFE0Fu) || ch == 0xFEFFu;
         case 0xFF: return hb_in_range (ch, 0xFFF0u, 0xFFF8u);
         default: return false;
@@ -199,6 +201,50 @@
     }
   }
 
+  /* Space estimates based on:
+   * http://www.unicode.org/charts/PDF/U2000.pdf
+   * https://www.microsoft.com/typography/developers/fdsspec/spaces.aspx
+   */
+  enum space_t {
+    NOT_SPACE = 0,
+    SPACE_EM   = 1,
+    SPACE_EM_2 = 2,
+    SPACE_EM_3 = 3,
+    SPACE_EM_4 = 4,
+    SPACE_EM_5 = 5,
+    SPACE_EM_6 = 6,
+    SPACE_EM_16 = 16,
+    SPACE_4_EM_18,      /* 4/18th of an EM! */
+    SPACE,
+    SPACE_FIGURE,
+    SPACE_PUNCTUATION,
+    SPACE_NARROW,
+  };
+  static inline space_t
+  space_fallback_type (hb_codepoint_t u)
+  {
+    switch (u)
+    {
+      /* All GC=Zs chars that can use a fallback. */
+      default:      return NOT_SPACE;   /* U+1680 OGHAM SPACE MARK */
+      case 0x0020u: return SPACE;       /* U+0020 SPACE */
+      case 0x00A0u: return SPACE;       /* U+00A0 NO-BREAK SPACE */
+      case 0x2000u: return SPACE_EM_2;  /* U+2000 EN QUAD */
+      case 0x2001u: return SPACE_EM;    /* U+2001 EM QUAD */
+      case 0x2002u: return SPACE_EM_2;  /* U+2002 EN SPACE */
+      case 0x2003u: return SPACE_EM;    /* U+2003 EM SPACE */
+      case 0x2004u: return SPACE_EM_3;  /* U+2004 THREE-PER-EM SPACE */
+      case 0x2005u: return SPACE_EM_4;  /* U+2005 FOUR-PER-EM SPACE */
+      case 0x2006u: return SPACE_EM_6;  /* U+2006 SIX-PER-EM SPACE */
+      case 0x2007u: return SPACE_FIGURE;        /* U+2007 FIGURE SPACE */
+      case 0x2008u: return SPACE_PUNCTUATION;   /* U+2008 PUNCTUATION SPACE */
+      case 0x2009u: return SPACE_EM_5;          /* U+2009 THIN SPACE */
+      case 0x200Au: return SPACE_EM_16;         /* U+200A HAIR SPACE */
+      case 0x202Fu: return SPACE_NARROW;        /* U+202F NARROW NO-BREAK SPACE */
+      case 0x205Fu: return SPACE_4_EM_18;       /* U+205F MEDIUM MATHEMATICAL SPACE */
+      case 0x3000u: return SPACE_EM;            /* U+3000 IDEOGRAPHIC SPACE */
+    }
+  }
 
   struct {
 #define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_func_t name;
@@ -299,10 +345,12 @@
 #define HB_MODIFIED_COMBINING_CLASS_CCC118 118 /* sign u / sign uu */
 #define HB_MODIFIED_COMBINING_CLASS_CCC122 122 /* mai * */
 
-/* Tibetan */
+/* Tibetan
+ * Modify U+0F74 (ccc=132) to reorder before ccc=130 marks.
+ */
 #define HB_MODIFIED_COMBINING_CLASS_CCC129 129 /* sign aa */
 #define HB_MODIFIED_COMBINING_CLASS_CCC130 130 /* sign i */
-#define HB_MODIFIED_COMBINING_CLASS_CCC132 132 /* sign u */
+#define HB_MODIFIED_COMBINING_CLASS_CCC132 128 /* sign u */
 
 
 /* Misc */
@@ -313,5 +361,10 @@
           FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) | \
           FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)))
 
+#define HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL(gen_cat) \
+        (FLAG_SAFE (gen_cat) & \
+         (FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL)))
 
 #endif /* HB_UNICODE_PRIVATE_HH */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-unicode.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-unicode.h	Wed Jul 05 22:06:46 2017 +0200
@@ -174,23 +174,23 @@
 /*
  * just give me the best implementation you've got there.
  */
-hb_unicode_funcs_t *
+HB_EXTERN hb_unicode_funcs_t *
 hb_unicode_funcs_get_default (void);
 
 
-hb_unicode_funcs_t *
+HB_EXTERN hb_unicode_funcs_t *
 hb_unicode_funcs_create (hb_unicode_funcs_t *parent);
 
-hb_unicode_funcs_t *
+HB_EXTERN hb_unicode_funcs_t *
 hb_unicode_funcs_get_empty (void);
 
-hb_unicode_funcs_t *
+HB_EXTERN hb_unicode_funcs_t *
 hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs);
 
-void
+HB_EXTERN void
 hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs,
                                 hb_user_data_key_t *key,
                                 void *              data,
@@ -198,18 +198,18 @@
                                 hb_bool_t           replace);
 
 
-void *
+HB_EXTERN void *
 hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs,
                                 hb_user_data_key_t *key);
 
 
-void
+HB_EXTERN void
 hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_unicode_funcs_is_immutable (hb_unicode_funcs_t *ufuncs);
 
-hb_unicode_funcs_t *
+HB_EXTERN hb_unicode_funcs_t *
 hb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs);
 
 
@@ -285,7 +285,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_unicode_funcs_set_combining_class_func (hb_unicode_funcs_t *ufuncs,
                                            hb_unicode_combining_class_func_t func,
                                            void *user_data, hb_destroy_func_t destroy);
@@ -301,7 +301,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_unicode_funcs_set_eastasian_width_func (hb_unicode_funcs_t *ufuncs,
                                            hb_unicode_eastasian_width_func_t func,
                                            void *user_data, hb_destroy_func_t destroy);
@@ -317,7 +317,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_unicode_funcs_set_general_category_func (hb_unicode_funcs_t *ufuncs,
                                             hb_unicode_general_category_func_t func,
                                             void *user_data, hb_destroy_func_t destroy);
@@ -333,7 +333,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_unicode_funcs_set_mirroring_func (hb_unicode_funcs_t *ufuncs,
                                      hb_unicode_mirroring_func_t func,
                                      void *user_data, hb_destroy_func_t destroy);
@@ -349,7 +349,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_unicode_funcs_set_script_func (hb_unicode_funcs_t *ufuncs,
                                   hb_unicode_script_func_t func,
                                   void *user_data, hb_destroy_func_t destroy);
@@ -365,7 +365,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_unicode_funcs_set_compose_func (hb_unicode_funcs_t *ufuncs,
                                    hb_unicode_compose_func_t func,
                                    void *user_data, hb_destroy_func_t destroy);
@@ -381,7 +381,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_unicode_funcs_set_decompose_func (hb_unicode_funcs_t *ufuncs,
                                      hb_unicode_decompose_func_t func,
                                      void *user_data, hb_destroy_func_t destroy);
@@ -397,7 +397,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_unicode_funcs_set_decompose_compatibility_func (hb_unicode_funcs_t *ufuncs,
                                                    hb_unicode_decompose_compatibility_func_t func,
                                                    void *user_data, hb_destroy_func_t destroy);
@@ -405,62 +405,63 @@
 /* accessors */
 
 /**
+ * hb_unicode_combining_class:
+ *
  * Since: 0.9.2
  **/
-hb_unicode_combining_class_t
+HB_EXTERN hb_unicode_combining_class_t
 hb_unicode_combining_class (hb_unicode_funcs_t *ufuncs,
                             hb_codepoint_t unicode);
 
 /**
+ * hb_unicode_eastasian_width:
+ *
  * Since: 0.9.2
  **/
-unsigned int
+HB_EXTERN unsigned int
 hb_unicode_eastasian_width (hb_unicode_funcs_t *ufuncs,
                             hb_codepoint_t unicode);
 
 /**
+ * hb_unicode_general_category:
+ *
  * Since: 0.9.2
  **/
-hb_unicode_general_category_t
+HB_EXTERN hb_unicode_general_category_t
 hb_unicode_general_category (hb_unicode_funcs_t *ufuncs,
                              hb_codepoint_t unicode);
 
 /**
+ * hb_unicode_mirroring:
+ *
  * Since: 0.9.2
  **/
-hb_codepoint_t
+HB_EXTERN hb_codepoint_t
 hb_unicode_mirroring (hb_unicode_funcs_t *ufuncs,
                       hb_codepoint_t unicode);
 
 /**
+ * hb_unicode_script:
+ *
  * Since: 0.9.2
  **/
-hb_script_t
+HB_EXTERN hb_script_t
 hb_unicode_script (hb_unicode_funcs_t *ufuncs,
                    hb_codepoint_t unicode);
 
-/**
- * Since: 0.9.2
- **/
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_unicode_compose (hb_unicode_funcs_t *ufuncs,
                     hb_codepoint_t      a,
                     hb_codepoint_t      b,
                     hb_codepoint_t     *ab);
 
-/**
- * Since: 0.9.2
- **/
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_unicode_decompose (hb_unicode_funcs_t *ufuncs,
                       hb_codepoint_t      ab,
                       hb_codepoint_t     *a,
                       hb_codepoint_t     *b);
 
-/**
- * Since: 0.9.2
- **/
-unsigned int
+HB_EXTERN unsigned int
 hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs,
                                     hb_codepoint_t      u,
                                     hb_codepoint_t     *decomposed);
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-utf-private.hh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-utf-private.hh	Wed Jul 05 22:06:46 2017 +0200
@@ -146,11 +146,11 @@
       return text;
     }
 
-    if (likely (hb_in_range (c, 0xD800u, 0xDBFFu)))
+    if (likely (c <= 0xDBFFu && text < end))
     {
       /* High-surrogate in c */
-      hb_codepoint_t l;
-      if (text < end && ((l = *text), likely (hb_in_range (l, 0xDC00u, 0xDFFFu))))
+      hb_codepoint_t l = *text;
+      if (likely (hb_in_range (l, 0xDC00u, 0xDFFFu)))
       {
         /* Low-surrogate in l */
         *unicode = (c << 10) + l - ((0xD800u << 10) - 0x10000u + 0xDC00u);
@@ -170,8 +170,7 @@
         hb_codepoint_t *unicode,
         hb_codepoint_t replacement)
   {
-    const uint16_t *end = text--;
-    hb_codepoint_t c = *text;
+    hb_codepoint_t c = *--text;
 
     if (likely (!hb_in_range (c, 0xD800u, 0xDFFFu)))
     {
@@ -179,14 +178,22 @@
       return text;
     }
 
-    if (likely (start < text && hb_in_range (c, 0xDC00u, 0xDFFFu)))
-      text--;
+    if (likely (c >= 0xDC00u && start < text))
+    {
+      /* Low-surrogate in c */
+      hb_codepoint_t h = text[-1];
+      if (likely (hb_in_range (h, 0xD800u, 0xDBFFu)))
+      {
+        /* High-surrogate in h */
+        *unicode = (h << 10) + c - ((0xD800u << 10) - 0x10000u + 0xDC00u);
+        text--;
+        return text;
+      }
+    }
 
-    if (likely (next (text, end, unicode, replacement) == end))
-      return text;
-
+    /* Lonely / out-of-order surrogate. */
     *unicode = replacement;
-    return end - 1;
+    return text;
   }
 
 
@@ -211,14 +218,9 @@
         hb_codepoint_t *unicode,
         hb_codepoint_t replacement)
   {
-    hb_codepoint_t c = *text++;
-    if (validate && unlikely (c > 0x10FFFFu || hb_in_range (c, 0xD800u, 0xDFFFu)))
-      goto error;
-    *unicode = c;
-    return text;
-
-  error:
-    *unicode = replacement;
+    hb_codepoint_t c = *unicode = *text++;
+    if (validate && unlikely (c >= 0xD800u && (c <= 0xDFFFu || c > 0x10FFFFu)))
+      *unicode = replacement;
     return text;
   }
 
@@ -228,8 +230,10 @@
         hb_codepoint_t *unicode,
         hb_codepoint_t replacement)
   {
-    next (text - 1, text, unicode, replacement);
-    return text - 1;
+    hb_codepoint_t c = *unicode = *--text;
+    if (validate && unlikely (c >= 0xD800u && (c <= 0xDFFFu || c > 0x10FFFFu)))
+      *unicode = replacement;
+    return text;
   }
 
   static inline unsigned int
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-version.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-version.h	Wed Jul 05 22:06:46 2017 +0200
@@ -37,25 +37,25 @@
 
 
 #define HB_VERSION_MAJOR 1
-#define HB_VERSION_MINOR 0
-#define HB_VERSION_MICRO 5
+#define HB_VERSION_MINOR 3
+#define HB_VERSION_MICRO 0
 
-#define HB_VERSION_STRING "1.0.5"
+#define HB_VERSION_STRING "1.3.0"
 
 #define HB_VERSION_ATLEAST(major,minor,micro) \
         ((major)*10000+(minor)*100+(micro) <= \
          HB_VERSION_MAJOR*10000+HB_VERSION_MINOR*100+HB_VERSION_MICRO)
 
 
-void
+HB_EXTERN void
 hb_version (unsigned int *major,
             unsigned int *minor,
             unsigned int *micro);
 
-const char *
+HB_EXTERN const char *
 hb_version_string (void);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_version_atleast (unsigned int major,
                     unsigned int minor,
                     unsigned int micro);
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb.h	Wed Jul 05 22:06:46 2017 +0200
@@ -28,6 +28,10 @@
 #define HB_H
 #define HB_H_IN
 
+#ifndef HB_EXTERN
+#define HB_EXTERN extern
+#endif
+
 #include "hb-blob.h"
 #include "hb-buffer.h"
 #include "hb-common.h"
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES	Wed Jul 05 22:06:46 2017 +0200
@@ -5088,7 +5088,8 @@
 Version 1.6.15beta05 [November 5, 2014]
   Use png_get_libpng_ver(NULL) instead of PNG_LIBPNG_VER_STRING in
     example.c, pngtest.c, and applications in the contrib directory.
-  Avoid out-of-bounds memory access in png_user_version_check().
+  Fixed an out-of-range read in png_user_version_check() (Bug report from
+    Qixue Xiao, CVE-2015-8540).
   Simplified and future-proofed png_user_version_check().
   Fixed GCC unsigned int->float warnings. Various versions of GCC
     seem to generate warnings when an unsigned value is implicitly
@@ -5446,7 +5447,7 @@
 Version 1.6.20beta02 [November 23, 2015]
   Fixed incorrect implementation of png_set_PLTE() that uses png_ptr
     not info_ptr, that left png_set_PLTE() open to the CVE-2015-8126
-    vulnerability.
+    vulnerability.  Fixes CVE-2015-8472.
 
 Version 1.6.20beta03 [November 24, 2015]
   Backported tests from libpng-1.7.0beta69.
@@ -5471,6 +5472,155 @@
 Version 1.6.20 [December 3, 2015]
   No changes.
 
+Version 1.6.21beta01 [December 11, 2015]
+  Fixed syntax "$(command)" in tests/pngstest that some shells other than
+    bash could not parse (Bug report by Nelson Beebe). Use `command` instead.
+
+Version 1.6.21beta02 [December 14, 2015]
+  Moved png_check_keyword() from pngwutil.c to pngset.c
+  Removed LE/BE dependencies in pngvalid, to 'fix' the current problem
+    in the BigEndian tests by not testing it, making the BE code the same 
+    as the LE version.
+  Fixes to pngvalid for various reduced build configurations (eliminate unused
+    statics) and a fix for the case in rgb_to_gray when the digitize option
+    reduces graylo to 0, producing a large error.
+
+Version 1.6.21beta03 [December 18, 2015]
+  Widened the 'limit' check on the internally calculated error limits in
+    the 'DIGITIZE' case (the code used prior to 1.7 for rgb_to_gray error
+    checks) and changed the check to only operate in non-release builds
+    (base build type not RC or RELEASE.)
+  Fixed undefined behavior in pngvalid.c, undefined because
+    (png_byte) << shift is undefined if it changes the signed bit
+    (because png_byte is promoted to int). The libpng exported functions
+    png_get_uint_32 and png_get_uint_16 handle this. (Bug reported by
+    David Drysdale as a result of reports from UBSAN in clang 3.8).
+  This changes pngvalid to use BE random numbers; this used to produce
+    errors but these should not be fixed as a result of the previous changes.
+
+Version 1.6.21rc01 [January 4, 2016]
+  In projects/vstudio, combined readme.txt and WARNING into README.txt
+
+Version 1.6.21rc02 [January 7, 2016]
+  Relocated assert() in contrib/tools/pngfix.c, bug found by American
+    Fuzzy Lop, reported by Brian Carpenter.
+  Marked 'limit' UNUSED in transform_range_check().  This only affects
+    release builds.
+
+Version 1.6.21 [January 15, 2016]
+  Worked around a false-positive Coverity issue in pngvalid.c.
+
+Version 1.6.22beta01 [January 23, 2016]
+  Changed PNG_USE_MKSTEMP to __COVERITY__ to select alternate
+    "tmpfile()" implementation in contrib/libtests/pngstest.c
+  Fixed NO_STDIO build of pngunknown.c to skip calling png_init_io()
+    if there is no stdio.h support.
+  Added a png_image_write_to_memory() API and a number of assist macros
+    to allow an application that uses the simplified API write to bypass
+    stdio and write directly to memory.
+  Added some warnings (png.h) and some check code to detect *possible*
+    overflow in the ROW_STRIDE and simplified image SIZE macros.  This
+    disallows image width/height/format that *might* overflow.  This is
+    a quiet API change that limits in-memory image size (uncompressed) to
+    less than 4GByte and image row size (stride) to less than 2GByte.
+  Revised workaround for false-positive Coverity issue in pngvalid.c.
+
+Version 1.6.22beta02 [February 8, 2016]
+  Only use exit(77) in configure builds.
+  Corrected error in PNG_IMAGE_PNG_SIZE_MAX. This new macro underreported
+    the palette size because it failed to take into account that the memory
+    palette has to be expanded to full RGB when it is written to PNG.
+  Updated CMakeLists.txt, added supporting scripts/gen*.cmake.in
+    and test.cmake.in (Roger Leigh).
+  Relaxed limit checks on gamma values in pngrtran.c. As suggested in
+    the comments gamma values outside the range currently permitted
+    by png_set_alpha_mode are useful for HDR data encoding.  These values
+    are already permitted by png_set_gamma so it is reasonable caution to
+    extend the png_set_alpha_mode range as HDR imaging systems are starting
+    to emerge.
+
+Version 1.6.22beta03 [March 9, 2016]
+  Added a common-law trademark notice and export control information
+    to the LICENSE file, png.h, and the man page.
+  Restored "& 0xff" in png_save_uint_16() and png_save_uint_32() that
+    were accidentally removed from libpng-1.6.17. 
+  Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in png.h
+    (Robert C. Seacord).
+  Removed dubious "#if INT_MAX" test from png.h that was added to
+    libpng-1.6.19beta02 (John Bowler).
+  Add ${INCLUDES} in scripts/genout.cmake.in (Bug report by Nixon Kwok).
+  Updated LICENSE to say files in the contrib directory are not
+    necessarily under the libpng license, and that some makefiles have
+    other copyright owners.
+  Added INTEL-SSE2 support (Mike Klein and Matt Sarett, Google, Inc.).
+  Made contrib/libtests/timepng more robust.  The code no longer gives
+    up/fails on invalid PNG data, it just skips it (with error messages).
+    The code no longer fails on PNG files with data beyond IEND.  Options
+    exist to use png_read_png (reading the whole image, not by row) and, in
+    that case, to apply any of the supported transforms.  This makes for
+    more realistic testing; the decoded data actually gets used in a
+    meaningful fashion (John Bowler).
+  Fixed some misleading indentation (Krishnaraj Bhat).
+
+Version 1.6.22beta04 [April 5, 2016]
+  Force GCC compilation to C89 if needed (Dagobert Michelsen).
+  SSE filter speed improvements for bpp=3:
+    memcpy-free implementations of load3() / store3().
+    call load3() only when needed at the end of a scanline.
+
+Version 1.6.22beta05 [April 27, 2016]
+  Added PNG_FAST_FILTERS macro (defined as
+    PNG_FILTER_NONE|PNG_FILTER_SUB|PNG_FILTER_UP).
+  Various fixes for contrib/libtests/timepng.c
+  Moved INTEL-SSE code from pngpriv.h into contrib/intel/intel_sse.patch.
+  Fixed typo (missing underscore) in #define PNG_READ_16_TO_8_SUPPORTED
+    (Bug report by Y.Ohashik).
+
+Version 1.6.22beta06 [May 5, 2016]
+  Rebased contrib/intel_sse.patch.
+  Quieted two Coverity issues in contrib/libtests/timepng.c.
+  Fixed issues with scripts/genout.cmake.in (David Capello, Nixon Kwok):
+    Added support to use multiple directories in ZLIBINCDIR variable,
+    Fixed CMAKE_C_FLAGS with multiple values when genout is compiled on MSVC,
+    Fixed pnglibconf.c compilation on OS X including the sysroot path.
+
+Version 1.6.22rc01 [May 14, 2016]
+  No changes.
+
+Version 1.6.22rc02 [May 16, 2016]
+  Removed contrib/timepng from default build; it does not build on platforms
+    that don't supply clock_gettime().
+
+Version 1.6.22rc03 [May 17, 2016]
+  Restored contrib/timepng to default build but check for the presence
+    of clock_gettime() in configure.ac and Makefile.am.
+
+Version 1.6.22 [May 26, 2016]
+  No changes.
+
+Version 1.6.23beta01 [May 29, 2016]
+  Stop a potential memory leak in png_set_tRNS() (Bug report by Ted Ying).
+  Fixed the progressive reader to handle empty first IDAT chunk properly
+    (patch by Timothy Nikkel).  This bug was introduced in libpng-1.6.0 and
+    only affected the libpng16 branch.
+  Added tests in pngvalid.c to check zero-length IDAT chunks in various
+    positions.  Fixed the sequential reader to handle these more robustly
+    (John Bowler).
+
+Version 1.6.23rc01 [June 2, 2016]
+  Corrected progressive read input buffer in pngvalid.c. The previous version
+    the code invariably passed just one byte at a time to libpng.  The intent
+    was to pass a random number of bytes in the range 0..511.
+  Moved sse2 prototype from pngpriv.h to contrib/intel/intel_sse.patch.
+  Added missing ")" in pngerror.c (Matt Sarrett).
+
+Version 1.6.23rc02 [June 4, 2016]
+  Fixed undefined behavior in png_push_save_buffer(). Do not call
+    memcpy() with a null source, even if count is zero (Leon Scroggins III).
+
+Version 1.6.23 [June 9, 2016]
+  Fixed bad link to RFC2083 in png.5 (Nikola Forro).
+
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
 https://lists.sourceforge.net/lists/listinfo/png-mng-implement
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE	Wed Jul 05 22:06:46 2017 +0200
@@ -10,8 +10,8 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.0.7, July 1, 2000, through 1.6.20, December 3, 2015, are
-Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
+libpng versions 1.0.7, July 1, 2000 through 1.6.23, June 9, 2016 are
+Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
 derived from libpng-1.0.6, and are distributed according to the same
 disclaimer and license as libpng-1.0.6 with the following individuals
 added to the list of Contributing Authors:
@@ -32,6 +32,10 @@
    risk of satisfactory quality, performance, accuracy, and effort is with
    the user.
 
+Some files in the "contrib" directory and some configure-generated
+files that are distributed with libpng have other copyright owners and
+are released under other open source licenses.
+
 libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
 Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
 libpng-0.96, and are distributed according to the same disclaimer and
@@ -55,6 +59,9 @@
    Greg Roelofs
    Tom Tanner
 
+Some files in the "scripts" directory have other copyright owners
+but are released under this license.
+
 libpng versions 0.5, May 1995, through 0.88, January 1996, are
 Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
 
@@ -95,18 +102,29 @@
 
 END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
 
-A "png_get_copyright" function is available, for convenient use in "about"
-boxes and the like:
+TRADEMARK:
 
-   printf("%s", png_get_copyright(NULL));
+The name "libpng" has not been registered by the Copyright owner
+as a trademark in any jurisdiction.  However, because libpng has
+been distributed and maintained world-wide, continually since 1995,
+the Copyright owner claims "common-law trademark protection" in any
+jurisdiction where common-law trademark is recognized.
 
-Also, the PNG logo (in PNG format, of course) is supplied in the
-files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
+OSI CERTIFICATION:
 
 Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is
 a certification mark of the Open Source Initiative. OSI has not addressed
 the additional disclaimers inserted at version 1.0.7.
 
+EXPORT CONTROL:
+
+The Copyright owner believes that the Export Control Classification
+Number (ECCN) for libpng is EAR99, which means not subject to export
+controls or International Traffic in Arms Regulations (ITAR) because
+it is open source, publicly available software, that does not contain
+any encryption software.  See the EAR, paragraphs 734.3(b)(3) and
+734.7(b).
+
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-December 3, 2015
+June 9, 2016
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/README	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/README	Wed Jul 05 22:06:46 2017 +0200
@@ -1,4 +1,4 @@
-README for libpng version 1.6.20 - December 3, 2015 (shared library 16.0)
+README for libpng version 1.6.23 - June 9, 2016 (shared library 16.0)
 See the note about version numbers near the top of png.h
 
 See INSTALL for instructions on how to install libpng.
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/png.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/png.c	Wed Jul 05 22:06:46 2017 +0200
@@ -30,7 +30,7 @@
  * file and, per its terms, should not be removed:
  *
  * Last changed in libpng 1.6.19 [November 12, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -42,7 +42,7 @@
 #include "pngpriv.h"
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_20 Your_png_h_is_not_version_1_6_20;
+typedef png_libpng_version_1_6_23 Your_png_h_is_not_version_1_6_23;
 
 /* Tells libpng that we have already handled the first "num_bytes" bytes
  * of the PNG file signature.  If the PNG data is embedded into another
@@ -803,14 +803,15 @@
 #else
 #  ifdef __STDC__
    return PNG_STRING_NEWLINE \
-      "libpng version 1.6.20 - December 3, 2015" PNG_STRING_NEWLINE \
-      "Copyright (c) 1998-2015 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
+      "libpng version 1.6.23 - June 9, 2016" PNG_STRING_NEWLINE \
+      "Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson" \
+      PNG_STRING_NEWLINE \
       "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
       "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
       PNG_STRING_NEWLINE;
 #  else
-   return "libpng version 1.6.20 - December 3, 2015\
-      Copyright (c) 1998-2015 Glenn Randers-Pehrson\
+   return "libpng version 1.6.23 - June 9, 2016\
+      Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson\
       Copyright (c) 1996-1997 Andreas Dilger\
       Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
 #  endif
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/png.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/png.h	Wed Jul 05 22:06:46 2017 +0200
@@ -29,9 +29,9 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * libpng version 1.6.20, December 3, 2015
+ * libpng version 1.6.23, June 9, 2016
  *
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -40,7 +40,7 @@
  * Authors and maintainers:
  *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
  *   libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
- *   libpng versions 0.97, January 1998, through 1.6.20, December 3, 2015:
+ *   libpng versions 0.97, January 1998, through 1.6.23, June 9, 2016:
  *     Glenn Randers-Pehrson.
  *   See also "Contributing Authors", below.
  */
@@ -53,8 +53,12 @@
  *
  * This code is released under the libpng license.
  *
- * libpng versions 1.0.7, July 1, 2000, through 1.6.20, December 3, 2015, are
- * Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
+ * Some files in the "contrib" directory and some configure-generated
+ * files that are distributed with libpng have other copyright owners and
+ * are released under other open source licenses.
+ *
+ * libpng versions 1.0.7, July 1, 2000 through 1.6.23, June 9, 2016 are
+ * Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
  * derived from libpng-1.0.6, and are distributed according to the same
  * disclaimer and license as libpng-1.0.6 with the following individuals
  * added to the list of Contributing Authors:
@@ -75,6 +79,10 @@
  *    risk of satisfactory quality, performance, accuracy, and effort is with
  *    the user.
  *
+ * Some files in the "contrib" directory have other copyright owners and
+ * are released under other open source licenses.
+ *
+ *
  * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
  * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
  * libpng-0.96, and are distributed according to the same disclaimer and
@@ -85,6 +93,9 @@
  *    Glenn Randers-Pehrson
  *    Willem van Schaik
  *
+ * Some files in the "scripts" directory have different copyright owners
+ * but are also released under this license.
+ *
  * libpng versions 0.89, June 1996, through 0.96, May 1997, are
  * Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
  * and are distributed according to the same disclaimer and license as
@@ -98,6 +109,9 @@
  *    Greg Roelofs
  *    Tom Tanner
  *
+ * Some files in the "scripts" directory have other copyright owners
+ * but are released under this license.
+ *
  * libpng versions 0.5, May 1995, through 0.88, January 1996, are
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
  *
@@ -137,6 +151,29 @@
  * appreciated.
  *
  * END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
+ *
+ * TRADEMARK:
+ *
+ * The name "libpng" has not been registered by the Copyright owner
+ * as a trademark in any jurisdiction.  However, because libpng has
+ * been distributed and maintained world-wide, continually since 1995,
+ * the Copyright owner claims "common-law trademark protection" in any
+ * jurisdiction where common-law trademark is recognized.
+ *
+ * OSI CERTIFICATION:
+ *
+ * Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is
+ * a certification mark of the Open Source Initiative. OSI has not addressed
+ * the additional disclaimers inserted at version 1.0.7.
+ *
+ * EXPORT CONTROL:
+ *
+ * The Copyright owner believes that the Export Control Classification
+ * Number (ECCN) for libpng is EAR99, which means not subject to export
+ * controls or International Traffic in Arms Regulations (ITAR) because
+ * it is open source, publicly available software, that does not contain
+ * any encryption software.  See the EAR, paragraphs 734.3(b)(3) and
+ * 734.7(b).
  */
 
 /*
@@ -150,12 +187,6 @@
  */
 
 /*
- * Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is
- * a certification mark of the Open Source Initiative. OSI has not addressed
- * the additional disclaimers inserted at version 1.0.7.
- */
-
-/*
  * The contributing authors would like to thank all those who helped
  * with testing, bug fixes, and patience.  This wouldn't have been
  * possible without all of you.
@@ -210,11 +241,11 @@
  *    ...
  *    1.0.19                  10    10019  10.so.0.19[.0]
  *    ...
- *    1.2.53                  13    10253  12.so.0.53[.0]
+ *    1.2.56                  13    10256  12.so.0.56[.0]
  *    ...
- *    1.5.23                  15    10523  15.so.15.23[.0]
+ *    1.5.27                  15    10527  15.so.15.27[.0]
  *    ...
- *    1.6.20                  16    10620  16.so.16.20[.0]
+ *    1.6.23                  16    10623  16.so.16.23[.0]
  *
  *    Henceforth the source version will match the shared-library major
  *    and minor numbers; the shared-library major version number will be
@@ -242,13 +273,13 @@
  * Y2K compliance in libpng:
  * =========================
  *
- *    December 3, 2015
+ *    June 9, 2016
  *
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    an official declaration.
  *
  *    This is your unofficial assurance that libpng from version 0.71 and
- *    upward through 1.6.20 are Y2K compliant.  It is my belief that
+ *    upward through 1.6.23 are Y2K compliant.  It is my belief that
  *    earlier versions were also Y2K compliant.
  *
  *    Libpng only has two year fields.  One is a 2-byte unsigned integer
@@ -310,9 +341,9 @@
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.20"
+#define PNG_LIBPNG_VER_STRING "1.6.23"
 #define PNG_HEADER_VERSION_STRING \
-     " libpng version 1.6.20 - December 3, 2015\n"
+     " libpng version 1.6.23 - June 9, 2016\n"
 
 #define PNG_LIBPNG_VER_SONUM   16
 #define PNG_LIBPNG_VER_DLLNUM  16
@@ -320,7 +351,7 @@
 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
 #define PNG_LIBPNG_VER_MAJOR   1
 #define PNG_LIBPNG_VER_MINOR   6
-#define PNG_LIBPNG_VER_RELEASE 20
+#define PNG_LIBPNG_VER_RELEASE 23
 
 /* This should match the numeric part of the final component of
  * PNG_LIBPNG_VER_STRING, omitting any leading zero:
@@ -351,7 +382,7 @@
  * version 1.0.0 was mis-numbered 100 instead of 10000).  From
  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release
  */
-#define PNG_LIBPNG_VER 10620 /* 1.6.20 */
+#define PNG_LIBPNG_VER 10623 /* 1.6.23 */
 
 /* Library configuration: these options cannot be changed after
  * the library has been built.
@@ -461,7 +492,7 @@
 /* This triggers a compiler error in png.c, if png.c and png.h
  * do not agree upon the version number.
  */
-typedef char* png_libpng_version_1_6_20;
+typedef char* png_libpng_version_1_6_23;
 
 /* Basic control structions.  Read libpng-manual.txt or libpng.3 for more info.
  *
@@ -762,24 +793,22 @@
  * data in the info_struct to be written into the output file.  The values
  * of the PNG_INFO_<chunk> defines should NOT be changed.
  */
-#define PNG_INFO_gAMA 0x0001
-#define PNG_INFO_sBIT 0x0002
-#define PNG_INFO_cHRM 0x0004
-#define PNG_INFO_PLTE 0x0008
-#define PNG_INFO_tRNS 0x0010
-#define PNG_INFO_bKGD 0x0020
-#define PNG_INFO_hIST 0x0040
-#define PNG_INFO_pHYs 0x0080
-#define PNG_INFO_oFFs 0x0100
-#define PNG_INFO_tIME 0x0200
-#define PNG_INFO_pCAL 0x0400
-#define PNG_INFO_sRGB 0x0800   /* GR-P, 0.96a */
-#define PNG_INFO_iCCP 0x1000   /* ESR, 1.0.6 */
-#define PNG_INFO_sPLT 0x2000   /* ESR, 1.0.6 */
-#define PNG_INFO_sCAL 0x4000   /* ESR, 1.0.6 */
-#if INT_MAX >= 0x8000 /* else this might break */
-#define PNG_INFO_IDAT 0x8000   /* ESR, 1.0.6 */
-#endif
+#define PNG_INFO_gAMA 0x0001U
+#define PNG_INFO_sBIT 0x0002U
+#define PNG_INFO_cHRM 0x0004U
+#define PNG_INFO_PLTE 0x0008U
+#define PNG_INFO_tRNS 0x0010U
+#define PNG_INFO_bKGD 0x0020U
+#define PNG_INFO_hIST 0x0040U
+#define PNG_INFO_pHYs 0x0080U
+#define PNG_INFO_oFFs 0x0100U
+#define PNG_INFO_tIME 0x0200U
+#define PNG_INFO_pCAL 0x0400U
+#define PNG_INFO_sRGB 0x0800U  /* GR-P, 0.96a */
+#define PNG_INFO_iCCP 0x1000U  /* ESR, 1.0.6 */
+#define PNG_INFO_sPLT 0x2000U  /* ESR, 1.0.6 */
+#define PNG_INFO_sCAL 0x4000U  /* ESR, 1.0.6 */
+#define PNG_INFO_IDAT 0x8000U  /* ESR, 1.0.6 */
 
 /* This is used for the transformation routines, as some of them
  * change these values for the row.  It also should enable using
@@ -1350,7 +1379,7 @@
 #endif
 
 #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
-#define PNG_READ_16_TO_8 SUPPORTED /* Name prior to 1.5.4 */
+#define PNG_READ_16_TO_8_SUPPORTED /* Name prior to 1.5.4 */
 /* Strip the second byte of information from a 16-bit depth file. */
 PNG_EXPORT(48, void, png_set_strip_16, (png_structrp png_ptr));
 #endif
@@ -1501,8 +1530,8 @@
 #define PNG_FILTER_UP      0x20
 #define PNG_FILTER_AVG     0x40
 #define PNG_FILTER_PAETH   0x80
-#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
-                         PNG_FILTER_AVG | PNG_FILTER_PAETH)
+#define PNG_FAST_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP)
+#define PNG_ALL_FILTERS (PNG_FAST_FILTERS | PNG_FILTER_AVG | PNG_FILTER_PAETH)
 
 /* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
  * These defines should NOT be changed.
@@ -1779,21 +1808,21 @@
 #define PNG_SET_WILL_FREE_DATA 1
 #define PNG_USER_WILL_FREE_DATA 2
 /* Flags for png_ptr->free_me and info_ptr->free_me */
-#define PNG_FREE_HIST 0x0008
-#define PNG_FREE_ICCP 0x0010
-#define PNG_FREE_SPLT 0x0020
-#define PNG_FREE_ROWS 0x0040
-#define PNG_FREE_PCAL 0x0080
-#define PNG_FREE_SCAL 0x0100
+#define PNG_FREE_HIST 0x0008U
+#define PNG_FREE_ICCP 0x0010U
+#define PNG_FREE_SPLT 0x0020U
+#define PNG_FREE_ROWS 0x0040U
+#define PNG_FREE_PCAL 0x0080U
+#define PNG_FREE_SCAL 0x0100U
 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
-#  define PNG_FREE_UNKN 0x0200
+#  define PNG_FREE_UNKN 0x0200U
 #endif
-/*      PNG_FREE_LIST 0x0400    removed in 1.6.0 because it is ignored */
-#define PNG_FREE_PLTE 0x1000
-#define PNG_FREE_TRNS 0x2000
-#define PNG_FREE_TEXT 0x4000
-#define PNG_FREE_ALL  0x7fff
-#define PNG_FREE_MUL  0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
+/*      PNG_FREE_LIST 0x0400U   removed in 1.6.0 because it is ignored */
+#define PNG_FREE_PLTE 0x1000U
+#define PNG_FREE_TRNS 0x2000U
+#define PNG_FREE_TEXT 0x4000U
+#define PNG_FREE_ALL  0x7fffU
+#define PNG_FREE_MUL  0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
 
 #ifdef PNG_USER_MEM_SUPPORTED
 PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_const_structrp png_ptr,
@@ -2917,12 +2946,19 @@
     * is the minimum 'row stride', the minimum count of components between each
     * row.  For a color-mapped image this is the minimum number of bytes in a
     * row.
+    *
+    * WARNING: this macro overflows for some images with more than one component
+    * and very large image widths.  libpng will refuse to process an image where
+    * this macro would overflow.
     */
 
 #define PNG_IMAGE_BUFFER_SIZE(image, row_stride)\
    (PNG_IMAGE_PIXEL_COMPONENT_SIZE((image).format)*(image).height*(row_stride))
    /* Return the size, in bytes, of an image buffer given a png_image and a row
     * stride - the number of components to leave space for in each row.
+    *
+    * WARNING: this macro overflows a 32-bit integer for some large PNG images,
+    * libpng will refuse to process an image where such an overflow would occur.
     */
 
 #define PNG_IMAGE_SIZE(image)\
@@ -3043,7 +3079,6 @@
 #endif /* SIMPLIFIED_READ */
 
 #ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
-#ifdef PNG_STDIO_SUPPORTED
 /* WRITE APIS
  * ----------
  * For write you must initialize a png_image structure to describe the image to
@@ -3060,6 +3095,7 @@
  *    values do not correspond to the colors in sRGB.
  * colormap_entries: set to the number of entries in the color-map (0 to 256)
  */
+#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
 PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image,
    const char *file, int convert_to_8bit, const void *buffer,
    png_int_32 row_stride, const void *colormap));
@@ -3069,8 +3105,9 @@
    int convert_to_8_bit, const void *buffer, png_int_32 row_stride,
    const void *colormap));
    /* Write the image to the given (FILE*). */
-
-/* With both write APIs if image is in one of the linear formats with 16-bit
+#endif /* SIMPLIFIED_WRITE_STDIO */
+
+/* With all write APIs if image is in one of the linear formats with 16-bit
  * data then setting convert_to_8_bit will cause the output to be an 8-bit PNG
  * gamma encoded according to the sRGB specification, otherwise a 16-bit linear
  * encoded PNG file is written.
@@ -3082,13 +3119,103 @@
  *
  * With all APIs row_stride is handled as in the read APIs - it is the spacing
  * from one row to the next in component sized units (1 or 2 bytes) and if
- * negative indicates a bottom-up row layout in the buffer.  If row_stride is zero,
- * libpng will calculate it for you from the image width and number of channels.
+ * negative indicates a bottom-up row layout in the buffer.  If row_stride is
+ * zero, libpng will calculate it for you from the image width and number of
+ * channels.
  *
- * Note that the write API does not support interlacing, sub-8-bit pixels, indexed
- * PNG (color_type 3) or most ancillary chunks.
+ * Note that the write API does not support interlacing, sub-8-bit pixels or
+ * most ancillary chunks.  If you need to write text chunks (e.g. for copyright
+ * notices) you need to use one of the other APIs.
  */
-#endif /* STDIO */
+
+PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
+   png_alloc_size_t * PNG_RESTRICT memory_bytes, int convert_to_8_bit,
+   const void *buffer, png_int_32 row_stride, const void *colormap));
+   /* Write the image to the given memory buffer.  The function both writes the
+    * whole PNG data stream to *memory and updates *memory_bytes with the count
+    * of bytes written.
+    *
+    * 'memory' may be NULL.  In this case *memory_bytes is not read however on
+    * success the number of bytes which would have been written will still be
+    * stored in *memory_bytes.  On failure *memory_bytes will contain 0.
+    *
+    * If 'memory' is not NULL it must point to memory[*memory_bytes] of
+    * writeable memory.
+    *
+    * If the function returns success memory[*memory_bytes] (if 'memory' is not
+    * NULL) contains the written PNG data.  *memory_bytes will always be less
+    * than or equal to the original value.
+    *
+    * If the function returns false and *memory_bytes was not changed an error
+    * occured during write.  If *memory_bytes was changed, or is not 0 if
+    * 'memory' was NULL, the write would have succeeded but for the memory
+    * buffer being too small.  *memory_bytes contains the required number of
+    * bytes and will be bigger that the original value.
+    */
+
+#define png_image_write_get_memory_size(image, size, convert_to_8_bit, buffer,\
+   row_stride, colormap)\
+   png_image_write_to_memory(&(image), 0, &(size), convert_to_8_bit, buffer,\
+         row_stride, colormap)
+   /* Return the amount of memory in 'size' required to compress this image.
+    * The png_image structure 'image' must be filled in as in the above
+    * function and must not be changed before the actual write call, the buffer
+    * and all other parameters must also be identical to that in the final
+    * write call.  The 'size' variable need not be initialized.
+    *
+    * NOTE: the macro returns true/false, if false is returned 'size' will be
+    * set to zero and the write failed and probably will fail if tried again.
+    */
+
+/* You can pre-allocate the buffer by making sure it is of sufficient size
+ * regardless of the amount of compression achieved.  The buffer size will
+ * always be bigger than the original image and it will never be filled.  The
+ * following macros are provided to assist in allocating the buffer.
+ */
+#define PNG_IMAGE_DATA_SIZE(image) (PNG_IMAGE_SIZE(image)+(image).height)
+   /* The number of uncompressed bytes in the PNG byte encoding of the image;
+    * uncompressing the PNG IDAT data will give this number of bytes.
+    *
+    * NOTE: while PNG_IMAGE_SIZE cannot overflow for an image in memory this
+    * macro can because of the extra bytes used in the PNG byte encoding.  You
+    * need to avoid this macro if your image size approaches 2^30 in width or
+    * height.  The same goes for the remainder of these macros; they all produce
+    * bigger numbers than the actual in-memory image size.
+    */
+#ifndef PNG_ZLIB_MAX_SIZE
+#  define PNG_ZLIB_MAX_SIZE(b) ((b)+(((b)+7U)>>3)+(((b)+63U)>>6)+11U)
+   /* An upper bound on the number of compressed bytes given 'b' uncompressed
+    * bytes.  This is based on deflateBounds() in zlib; different
+    * implementations of zlib compression may conceivably produce more data so
+    * if your zlib implementation is not zlib itself redefine this macro
+    * appropriately.
+    */
+#endif
+
+#define PNG_IMAGE_COMPRESSED_SIZE_MAX(image)\
+   PNG_ZLIB_MAX_SIZE((png_alloc_size_t)PNG_IMAGE_DATA_SIZE(image))
+   /* An upper bound on the size of the data in the PNG IDAT chunks. */
+
+#define PNG_IMAGE_PNG_SIZE_MAX_(image, image_size)\
+   ((8U/*sig*/+25U/*IHDR*/+16U/*gAMA*/+44U/*cHRM*/+12U/*IEND*/+\
+    (((image).format&PNG_FORMAT_FLAG_COLORMAP)?/*colormap: PLTE, tRNS*/\
+     12U+3U*(image).colormap_entries/*PLTE data*/+\
+     (((image).format&PNG_FORMAT_FLAG_ALPHA)?\
+      12U/*tRNS*/+(image).colormap_entries:0U):0U)+\
+    12U)+(12U*((image_size)/PNG_ZBUF_SIZE))/*IDAT*/+(image_size))
+   /* A helper for the following macro; if your compiler cannot handle the
+    * following macro use this one with the result of
+    * PNG_IMAGE_COMPRESSED_SIZE_MAX(image) as the second argument (most
+    * compilers should handle this just fine.)
+    */
+
+#define PNG_IMAGE_PNG_SIZE_MAX(image)\
+   PNG_IMAGE_PNG_SIZE_MAX_(image, PNG_IMAGE_COMPRESSED_SIZE_MAX(image))
+   /* An upper bound on the total length of the PNG data stream for 'image'.
+    * The result is of type png_alloc_size_t, on 32-bit systems this may
+    * overflow even though PNG_IMAGE_DATA_SIZE does not overflow; the write will
+    * run out of buffer space but return a corrected size which should work.
+    */
 #endif /* SIMPLIFIED_WRITE */
 /*******************************************************************************
  *  END OF SIMPLIFIED API
@@ -3146,7 +3273,7 @@
  * one to use is one more than this.)
  */
 #ifdef PNG_EXPORT_LAST_ORDINAL
-  PNG_EXPORT_LAST_ORDINAL(244);
+  PNG_EXPORT_LAST_ORDINAL(245);
 #endif
 
 #ifdef __cplusplus
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h	Wed Jul 05 22:06:46 2017 +0200
@@ -29,9 +29,9 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * libpng version 1.6.20, December 3, 2015
+ * libpng version 1.6.23, June 9, 2016
  *
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngdebug.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngdebug.h	Wed Jul 05 22:06:46 2017 +0200
@@ -30,7 +30,7 @@
  * file and, per its terms, should not be removed:
  *
  * Last changed in libpng 1.6.8 [December 19, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c	Wed Jul 05 22:06:46 2017 +0200
@@ -30,7 +30,7 @@
  * file and, per its terms, should not be removed:
  *
  * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -72,7 +72,7 @@
    if (png_ptr != NULL)
    {
       if ((png_ptr->flags &
-         (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0
+         (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0)
       {
          if (*error_message == PNG_LITERAL_SHARP)
          {
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c	Wed Jul 05 22:06:46 2017 +0200
@@ -30,7 +30,7 @@
  * file and, per its terms, should not be removed:
  *
  * Last changed in libpng 1.6.17 [March 26, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -484,11 +484,11 @@
    return (retval);
 }
 #endif /* pHYs */
-#endif  /* INCH_CONVERSIONS */
+#endif /* INCH_CONVERSIONS */
 
 /* png_get_channels really belongs in here, too, but it's been around longer */
 
-#endif  /* EASY_ACCESS */
+#endif /* EASY_ACCESS */
 
 
 png_byte PNGAPI
@@ -1170,19 +1170,19 @@
       return 0;
 
 #ifdef PNG_WRITE_SUPPORTED
-      if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
+   if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
 #endif
    {
 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
-         return png_ptr->IDAT_read_size;
+      return png_ptr->IDAT_read_size;
 #else
-         return PNG_IDAT_READ_SIZE;
+      return PNG_IDAT_READ_SIZE;
 #endif
    }
 
 #ifdef PNG_WRITE_SUPPORTED
-      else
-         return png_ptr->zbuffer_size;
+   else
+      return png_ptr->zbuffer_size;
 #endif
 }
 
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h	Wed Jul 05 22:06:46 2017 +0200
@@ -30,7 +30,7 @@
  * file and, per its terms, should not be removed:
  *
  * Last changed in libpng 1.6.1 [March 28, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h	Wed Jul 05 22:06:46 2017 +0200
@@ -27,16 +27,15 @@
 /* libpng STANDARD API DEFINITION */
 
 /* pnglibconf.h - library build configuration */
-
 /* This file is available under and governed by the GNU General Public
  * License version 2 only, as published by the Free Software Foundation.
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  */
 
-/* libpng version 1.6.20, December 3, 2015 */
+/* libpng version 1.6.23, June 9, 2016 */
 
-/* Copyright (c) 1998-2014 Glenn Randers-Pehrson */
+/* Copyright (c) 1998-2016 Glenn Randers-Pehrson */
 
 /* This code is released under the libpng license. */
 /* For conditions of distribution and use, see the disclaimer */
@@ -141,6 +140,7 @@
 #define PNG_SIMPLIFIED_READ_SUPPORTED
 /*#undef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED*/
 /*#undef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED*/
+/*#undef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED*/
 /*#undef PNG_SIMPLIFIED_WRITE_SUPPORTED*/
 #define PNG_STDIO_SUPPORTED
 #define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c	Wed Jul 05 22:06:46 2017 +0200
@@ -30,7 +30,7 @@
  * file and, per its terms, should not be removed:
  *
  * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c	Wed Jul 05 22:06:46 2017 +0200
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.18 [July 23, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.23 [June 9, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -238,12 +238,14 @@
           (png_ptr->mode & PNG_HAVE_PLTE) == 0)
          png_error(png_ptr, "Missing PLTE before IDAT");
 
-      png_ptr->mode |= PNG_HAVE_IDAT;
       png_ptr->process_mode = PNG_READ_IDAT_MODE;
 
-      if ((png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) == 0)
-         if (png_ptr->push_length == 0)
-            return;
+      if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+         if ((png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) == 0)
+            if (png_ptr->push_length == 0)
+               return;
+
+      png_ptr->mode |= PNG_HAVE_IDAT;
 
       if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
          png_benign_error(png_ptr, "Too many IDATs found");
@@ -527,7 +529,10 @@
          png_error(png_ptr, "Insufficient memory for save_buffer");
       }
 
-      memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
+      if (old_buffer)
+         memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
+      else if (png_ptr->save_buffer_size)
+         png_error(png_ptr, "save_buffer error");
       png_free(png_ptr, old_buffer);
       png_ptr->save_buffer_max = new_max;
    }
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h	Wed Jul 05 22:06:46 2017 +0200
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.18 [July 23, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.22 [May 26, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -1945,6 +1945,9 @@
    (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
 #endif
 
+PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
+   png_const_charp key, png_bytep new_key), PNG_EMPTY);
+
 /* Maintainer: Put new private prototypes here ^ */
 
 #include "pngdebug.h"
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c	Wed Jul 05 22:06:46 2017 +0200
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.17 [March 26, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.23 [June 9, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -155,7 +155,10 @@
       }
 
       else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+      {
+         png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
          png_ptr->mode |= PNG_AFTER_IDAT;
+      }
 
       /* This should be a binary subdivision search or a hash for
        * matching the chunk name rather than a linear search.
@@ -813,6 +816,9 @@
       png_uint_32 length = png_read_chunk_header(png_ptr);
       png_uint_32 chunk_name = png_ptr->chunk_name;
 
+      if (chunk_name != png_IDAT)
+         png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
+
       if (chunk_name == png_IEND)
          png_handle_IEND(png_ptr, info_ptr, length);
 
@@ -827,9 +833,9 @@
       {
          if (chunk_name == png_IDAT)
          {
-            if ((length > 0) ||
-                (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
-               png_benign_error(png_ptr, "Too many IDATs found");
+            if ((length > 0 && !(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
+                || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
+               png_benign_error(png_ptr, ".Too many IDATs found");
          }
          png_handle_unknown(png_ptr, info_ptr, length, keep);
          if (chunk_name == png_PLTE)
@@ -840,10 +846,14 @@
       else if (chunk_name == png_IDAT)
       {
          /* Zero length IDATs are legal after the last IDAT has been
-          * read, but not after other chunks have been read.
+          * read, but not after other chunks have been read.  1.6 does not
+          * always read all the deflate data; specifically it cannot be relied
+          * upon to read the Adler32 at the end.  If it doesn't ignore IDAT
+          * chunks which are longer than zero as well:
           */
-         if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
-            png_benign_error(png_ptr, "Too many IDATs found");
+         if ((length > 0 && !(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
+             || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
+            png_benign_error(png_ptr, "..Too many IDATs found");
 
          png_crc_finish(png_ptr, length);
       }
@@ -3876,16 +3886,16 @@
             else
                filler = 255;
 
-#           ifdef PNG_FORMAT_AFIRST_SUPPORTED
-               if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
-               {
-                  where = PNG_FILLER_BEFORE;
-                  change &= ~PNG_FORMAT_FLAG_AFIRST;
-               }
-
-               else
-#           endif
-               where = PNG_FILLER_AFTER;
+#ifdef PNG_FORMAT_AFIRST_SUPPORTED
+            if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
+            {
+               where = PNG_FILLER_BEFORE;
+               change &= ~PNG_FORMAT_FLAG_AFIRST;
+            }
+
+            else
+#endif
+            where = PNG_FILLER_AFTER;
 
             png_set_add_alpha(png_ptr, filler, where);
          }
@@ -3993,12 +4003,12 @@
       if (info_ptr->bit_depth == 16)
          info_format |= PNG_FORMAT_FLAG_LINEAR;
 
-#     ifdef PNG_FORMAT_BGR_SUPPORTED
-         if ((png_ptr->transformations & PNG_BGR) != 0)
-            info_format |= PNG_FORMAT_FLAG_BGR;
-#     endif
-
-#     ifdef PNG_FORMAT_AFIRST_SUPPORTED
+#ifdef PNG_FORMAT_BGR_SUPPORTED
+      if ((png_ptr->transformations & PNG_BGR) != 0)
+         info_format |= PNG_FORMAT_FLAG_BGR;
+#endif
+
+#ifdef PNG_FORMAT_AFIRST_SUPPORTED
          if (do_local_background == 2)
          {
             if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
@@ -4099,58 +4109,84 @@
 {
    if (image != NULL && image->version == PNG_IMAGE_VERSION)
    {
-      png_uint_32 check;
-
-      if (row_stride == 0)
-         row_stride = PNG_IMAGE_ROW_STRIDE(*image);
-
-      if (row_stride < 0)
-         check = -row_stride;
-
-      else
-         check = row_stride;
-
-      if (image->opaque != NULL && buffer != NULL &&
-         check >= PNG_IMAGE_ROW_STRIDE(*image))
+      /* Check for row_stride overflow.  This check is not performed on the
+       * original PNG format because it may not occur in the output PNG format
+       * and libpng deals with the issues of reading the original.
+       */
+      const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format);
+
+      if (image->width <= 0x7FFFFFFFU/channels) /* no overflow */
       {
-         if ((image->format & PNG_FORMAT_FLAG_COLORMAP) == 0 ||
-            (image->colormap_entries > 0 && colormap != NULL))
+         png_uint_32 check;
+         const png_uint_32 png_row_stride = image->width * channels;
+
+         if (row_stride == 0)
+            row_stride = (png_int_32)/*SAFE*/png_row_stride;
+
+         if (row_stride < 0)
+            check = -row_stride;
+
+         else
+            check = row_stride;
+
+         if (image->opaque != NULL && buffer != NULL && check >= png_row_stride)
          {
-            int result;
-            png_image_read_control display;
-
-            memset(&display, 0, (sizeof display));
-            display.image = image;
-            display.buffer = buffer;
-            display.row_stride = row_stride;
-            display.colormap = colormap;
-            display.background = background;
-            display.local_row = NULL;
-
-            /* Choose the correct 'end' routine; for the color-map case all the
-             * setup has already been done.
+            /* Now check for overflow of the image buffer calculation; this
+             * limits the whole image size to 32 bits for API compatibility with
+             * the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro.
              */
-            if ((image->format & PNG_FORMAT_FLAG_COLORMAP) != 0)
-               result =
-                  png_safe_execute(image, png_image_read_colormap, &display) &&
-                  png_safe_execute(image, png_image_read_colormapped, &display);
+            if (image->height <= 0xFFFFFFFF/png_row_stride)
+            {
+               if ((image->format & PNG_FORMAT_FLAG_COLORMAP) == 0 ||
+                  (image->colormap_entries > 0 && colormap != NULL))
+               {
+                  int result;
+                  png_image_read_control display;
+
+                  memset(&display, 0, (sizeof display));
+                  display.image = image;
+                  display.buffer = buffer;
+                  display.row_stride = row_stride;
+                  display.colormap = colormap;
+                  display.background = background;
+                  display.local_row = NULL;
+
+                  /* Choose the correct 'end' routine; for the color-map case
+                   * all the setup has already been done.
+                   */
+                  if ((image->format & PNG_FORMAT_FLAG_COLORMAP) != 0)
+                     result = png_safe_execute(image,
+                                    png_image_read_colormap, &display) &&
+                              png_safe_execute(image,
+                                    png_image_read_colormapped, &display);
+
+                  else
+                     result =
+                        png_safe_execute(image,
+                              png_image_read_direct, &display);
+
+                  png_image_free(image);
+                  return result;
+               }
+
+               else
+                  return png_image_error(image,
+                     "png_image_finish_read[color-map]: no color-map");
+            }
 
             else
-               result =
-                  png_safe_execute(image, png_image_read_direct, &display);
-
-            png_image_free(image);
-            return result;
+               return png_image_error(image,
+                  "png_image_finish_read: image too large");
          }
 
          else
             return png_image_error(image,
-               "png_image_finish_read[color-map]: no color-map");
+               "png_image_finish_read: invalid argument");
       }
 
       else
          return png_image_error(image,
-            "png_image_finish_read: invalid argument");
+            "png_image_finish_read: row_stride too large");
    }
 
    else if (image != NULL)
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrio.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrio.c	Wed Jul 05 22:06:46 2017 +0200
@@ -30,7 +30,7 @@
  * file and, per its terms, should not be removed:
  *
  * Last changed in libpng 1.6.17 [March 26, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c	Wed Jul 05 22:06:46 2017 +0200
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.19 [November 12, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.22 [May 26, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -187,7 +187,7 @@
    png_set_background_fixed(png_ptr, background_color, background_gamma_code,
       need_expand, png_fixed(png_ptr, background_gamma, "png_set_background"));
 }
-#  endif  /* FLOATING_POINT */
+#  endif /* FLOATING_POINT */
 #endif /* READ_BACKGROUND */
 
 /* Scale 16-bit depth files to 8-bit depth.  If both of these are set then the
@@ -317,9 +317,12 @@
     * is expected to be 1 or greater, but this range test allows for some
     * viewing correction values.  The intent is to weed out users of this API
     * who use the inverse of the gamma value accidentally!  Since some of these
-    * values are reasonable this may have to be changed.
+    * values are reasonable this may have to be changed:
+    *
+    * 1.6.x: changed from 0.07..3 to 0.01..100 (to accomodate the optimal 16-bit
+    * gamma of 36, and its reciprocal.)
     */
-   if (output_gamma < 70000 || output_gamma > 300000)
+   if (output_gamma < 1000 || output_gamma > 10000000)
       png_error(png_ptr, "output gamma out of expected range");
 
    /* The default file gamma is the inverse of the output gamma; the output
@@ -1940,7 +1943,7 @@
             png_ptr->palette[i].blue = (png_byte)component;
          }
    }
-#endif  /* READ_SHIFT */
+#endif /* READ_SHIFT */
 }
 
 /* Modify the info structure to reflect the transformations.  The
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c	Wed Jul 05 22:06:46 2017 +0200
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.20 [December 3, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.20 [December 3, 2014]
+ * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c	Wed Jul 05 22:06:46 2017 +0200
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.19 [November 12, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.23 [June 9, 2016]
+ * Copyright (c) 1998-2016 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -980,12 +980,14 @@
 
        png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
 
-       /* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
-       png_ptr->trans_alpha = info_ptr->trans_alpha = png_voidcast(png_bytep,
-         png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
-
        if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
+       {
+         /* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
+          info_ptr->trans_alpha = png_voidcast(png_bytep,
+             png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
           memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans);
+       }
+       png_ptr->trans_alpha = info_ptr->trans_alpha;
    }
 
    if (trans_color != NULL)
@@ -1672,4 +1674,88 @@
       png_ptr->num_palette_max = -1;
 }
 #endif
+
+#if defined(PNG_TEXT_SUPPORTED) || defined(PNG_pCAL_SUPPORTED) || \
+    defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
+/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification,
+ * and if invalid, correct the keyword rather than discarding the entire
+ * chunk.  The PNG 1.0 specification requires keywords 1-79 characters in
+ * length, forbids leading or trailing whitespace, multiple internal spaces,
+ * and the non-break space (0x80) from ISO 8859-1.  Returns keyword length.
+ *
+ * The 'new_key' buffer must be 80 characters in size (for the keyword plus a
+ * trailing '\0').  If this routine returns 0 then there was no keyword, or a
+ * valid one could not be generated, and the caller must png_error.
+ */
+png_uint_32 /* PRIVATE */
+png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
+{
+   png_const_charp orig_key = key;
+   png_uint_32 key_len = 0;
+   int bad_character = 0;
+   int space = 1;
+
+   png_debug(1, "in png_check_keyword");
+
+   if (key == NULL)
+   {
+      *new_key = 0;
+      return 0;
+   }
+
+   while (*key && key_len < 79)
+   {
+      png_byte ch = (png_byte)*key++;
+
+      if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
+         *new_key++ = ch, ++key_len, space = 0;
+
+      else if (space == 0)
+      {
+         /* A space or an invalid character when one wasn't seen immediately
+          * before; output just a space.
+          */
+         *new_key++ = 32, ++key_len, space = 1;
+
+         /* If the character was not a space then it is invalid. */
+         if (ch != 32)
+            bad_character = ch;
+      }
+
+      else if (bad_character == 0)
+         bad_character = ch; /* just skip it, record the first error */
+   }
+
+   if (key_len > 0 && space != 0) /* trailing space */
+   {
+      --key_len, --new_key;
+      if (bad_character == 0)
+         bad_character = 32;
+   }
+
+   /* Terminate the keyword */
+   *new_key = 0;
+
+   if (key_len == 0)
+      return 0;
+
+#ifdef PNG_WARNINGS_SUPPORTED
+   /* Try to only output one warning per keyword: */
+   if (*key != 0) /* keyword too long */
+      png_warning(png_ptr, "keyword truncated");
+
+   else if (bad_character != 0)
+   {
+      PNG_WARNING_PARAMETERS(p)
+
+      png_warning_parameter(p, 1, orig_key);
+      png_warning_parameter_signed(p, 2, PNG_NUMBER_FORMAT_02x, bad_character);
+
+      png_formatted_warning(png_ptr, p, "keyword \"@1\": bad character '0x@2'");
+   }
+#endif /* WARNINGS */
+
+   return key_len;
+}
+#endif /* TEXT || pCAL || iCCP || sPLT */
 #endif /* READ || WRITE */
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngstruct.h	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngstruct.h	Wed Jul 05 22:06:46 2017 +0200
@@ -30,7 +30,7 @@
  * file and, per its terms, should not be removed:
  *
  * Last changed in libpng 1.6.18 [July 23, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngtest.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngtest.c	Wed Jul 05 22:06:46 2017 +0200
@@ -30,7 +30,7 @@
  * file and, per its terms, should not be removed:
  *
  * Last changed in libpng 1.5.25 [December 3, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -71,6 +71,15 @@
 
 #include "png.h"
 
+/* 1.6.1 added support for the configure test harness, which uses 77 to indicate
+ * a skipped test, in earlier versions we need to succeed on a skipped test, so:
+ */
+#if PNG_LIBPNG_VER >= 10601 && defined(HAVE_CONFIG_H)
+#  define SKIP 77
+#else
+#  define SKIP 0
+#endif
+
 /* Known chunks that exist in pngtest.png must be supported or pngtest will fail
  * simply as a result of re-ordering them.  This may be fixed in 1.7
  *
@@ -2093,9 +2102,9 @@
    fprintf(STDERR,
       " test ignored because libpng was not built with read support\n");
    /* And skip this test */
-   return PNG_LIBPNG_VER < 10600 ? 0 : 77;
+   return SKIP;
 }
 #endif
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_20 Your_png_h_is_not_version_1_6_20;
+typedef png_libpng_version_1_6_23 Your_png_h_is_not_version_1_6_23;
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c	Wed Jul 05 22:06:46 2017 +0200
@@ -30,7 +30,7 @@
  * file and, per its terms, should not be removed:
  *
  * Last changed in libpng 1.6.18 [July 23, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwio.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwio.c	Wed Jul 05 22:06:46 2017 +0200
@@ -30,7 +30,7 @@
  * file and, per its terms, should not be removed:
  *
  * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwrite.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwrite.c	Wed Jul 05 22:06:46 2017 +0200
@@ -30,7 +30,7 @@
  * file and, per its terms, should not be removed:
  *
  * Last changed in libpng 1.6.19 [November 12, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -40,9 +40,9 @@
  */
 
 #include "pngpriv.h"
-#if defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
+#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
 #  include <errno.h>
-#endif
+#endif /* SIMPLIFIED_WRITE_STDIO */
 
 #ifdef PNG_WRITE_SUPPORTED
 
@@ -1480,7 +1480,6 @@
 
 
 #ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
-# ifdef PNG_STDIO_SUPPORTED /* currently required for png_image_write_* */
 /* Initialize the write structure - general purpose utility. */
 static int
 png_image_write_init(png_imagep image)
@@ -1532,6 +1531,10 @@
    png_const_voidp first_row;
    ptrdiff_t       row_bytes;
    png_voidp       local_row;
+   /* Byte count for memory writing */
+   png_bytep        memory;
+   png_alloc_size_t memory_bytes; /* not used for STDIO */
+   png_alloc_size_t output_bytes; /* running total */
 } png_image_write_control;
 
 /* Write png_uint_16 input to a 16-bit PNG; the png_ptr has already been set to
@@ -1959,9 +1962,43 @@
       png_set_benign_errors(png_ptr, 0/*error*/);
 #   endif
 
-   /* Default the 'row_stride' parameter if required. */
-   if (display->row_stride == 0)
-      display->row_stride = PNG_IMAGE_ROW_STRIDE(*image);
+   /* Default the 'row_stride' parameter if required, also check the row stride
+    * and total image size to ensure that they are within the system limits.
+    */
+   {
+      const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format);
+
+      if (image->width <= 0x7FFFFFFFU/channels) /* no overflow */
+      {
+         png_uint_32 check;
+         const png_uint_32 png_row_stride = image->width * channels;
+
+         if (display->row_stride == 0)
+            display->row_stride = (png_int_32)/*SAFE*/png_row_stride;
+
+         if (display->row_stride < 0)
+            check = -display->row_stride;
+
+         else
+            check = display->row_stride;
+
+         if (check >= png_row_stride)
+         {
+            /* Now check for overflow of the image buffer calculation; this
+             * limits the whole image size to 32 bits for API compatibility with
+             * the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro.
+             */
+            if (image->height > 0xFFFFFFFF/png_row_stride)
+               png_error(image->opaque->png_ptr, "memory image too large");
+         }
+
+         else
+            png_error(image->opaque->png_ptr, "supplied row stride too small");
+      }
+
+      else
+         png_error(image->opaque->png_ptr, "image row stride too large");
+   }
 
    /* Set the required transforms then write the rows in the correct order. */
    if ((format & PNG_FORMAT_FLAG_COLORMAP) != 0)
@@ -2138,6 +2175,122 @@
    return 1;
 }
 
+
+static void (PNGCBAPI
+image_memory_write)(png_structp png_ptr, png_bytep/*const*/ data,
+   png_size_t size)
+{
+   png_image_write_control *display = png_voidcast(png_image_write_control*,
+      png_ptr->io_ptr/*backdoor: png_get_io_ptr(png_ptr)*/);
+   const png_alloc_size_t ob = display->output_bytes;
+
+   /* Check for overflow; this should never happen: */
+   if (size <= ((png_alloc_size_t)-1) - ob)
+   {
+      /* I don't think libpng ever does this, but just in case: */
+      if (size > 0)
+      {
+         if (display->memory_bytes >= ob+size) /* writing */
+            memcpy(display->memory+ob, data, size);
+
+         /* Always update the size: */
+         display->output_bytes = ob+size;
+      }
+   }
+
+   else
+      png_error(png_ptr, "png_image_write_to_memory: PNG too big");
+}
+
+static void (PNGCBAPI
+image_memory_flush)(png_structp png_ptr)
+{
+   PNG_UNUSED(png_ptr)
+}
+
+static int
+png_image_write_memory(png_voidp argument)
+{
+   png_image_write_control *display = png_voidcast(png_image_write_control*,
+      argument);
+
+   /* The rest of the memory-specific init and write_main in an error protected
+    * environment.  This case needs to use callbacks for the write operations
+    * since libpng has no built in support for writing to memory.
+    */
+   png_set_write_fn(display->image->opaque->png_ptr, display/*io_ptr*/,
+         image_memory_write, image_memory_flush);
+
+   return png_image_write_main(display);
+}
+
+int PNGAPI
+png_image_write_to_memory(png_imagep image, void *memory,
+   png_alloc_size_t * PNG_RESTRICT memory_bytes, int convert_to_8bit,
+   const void *buffer, png_int_32 row_stride, const void *colormap)
+{
+   /* Write the image to the given buffer, or count the bytes if it is NULL */
+   if (image != NULL && image->version == PNG_IMAGE_VERSION)
+   {
+      if (memory_bytes != NULL && buffer != NULL)
+      {
+         /* This is to give the caller an easier error detection in the NULL
+          * case and guard against uninitialized variable problems:
+          */
+         if (memory == NULL)
+            *memory_bytes = 0;
+
+         if (png_image_write_init(image) != 0)
+         {
+            png_image_write_control display;
+            int result;
+
+            memset(&display, 0, (sizeof display));
+            display.image = image;
+            display.buffer = buffer;
+            display.row_stride = row_stride;
+            display.colormap = colormap;
+            display.convert_to_8bit = convert_to_8bit;
+            display.memory = png_voidcast(png_bytep, memory);
+            display.memory_bytes = *memory_bytes;
+            display.output_bytes = 0;
+
+            result = png_safe_execute(image, png_image_write_memory, &display);
+            png_image_free(image);
+
+            /* write_memory returns true even if we ran out of buffer. */
+            if (result)
+            {
+               /* On out-of-buffer this function returns '0' but still updates
+                * memory_bytes:
+                */
+               if (memory != NULL && display.output_bytes > *memory_bytes)
+                  result = 0;
+
+               *memory_bytes = display.output_bytes;
+            }
+
+            return result;
+         }
+
+         else
+            return 0;
+      }
+
+      else
+         return png_image_error(image,
+            "png_image_write_to_memory: invalid argument");
+   }
+
+   else if (image != NULL)
+      return png_image_error(image,
+         "png_image_write_to_memory: incorrect PNG_IMAGE_VERSION");
+
+   else
+      return 0;
+}
+
+#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
 int PNGAPI
 png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
    const void *buffer, png_int_32 row_stride, const void *colormap)
@@ -2145,7 +2298,7 @@
    /* Write the image to the given (FILE*). */
    if (image != NULL && image->version == PNG_IMAGE_VERSION)
    {
-      if (file != NULL)
+      if (file != NULL && buffer != NULL)
       {
          if (png_image_write_init(image) != 0)
          {
@@ -2195,7 +2348,7 @@
    /* Write the image to the named file. */
    if (image != NULL && image->version == PNG_IMAGE_VERSION)
    {
-      if (file_name != NULL)
+      if (file_name != NULL && buffer != NULL)
       {
          FILE *fp = fopen(file_name, "wb");
 
@@ -2253,6 +2406,6 @@
    else
       return 0;
 }
-# endif /* STDIO */
+#endif /* SIMPLIFIED_WRITE_STDIO */
 #endif /* SIMPLIFIED_WRITE */
 #endif /* WRITE */
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwtran.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwtran.c	Wed Jul 05 22:06:46 2017 +0200
@@ -30,7 +30,7 @@
  * file and, per its terms, should not be removed:
  *
  * Last changed in libpng 1.6.18 [July 23, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwutil.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwutil.c	Wed Jul 05 22:06:46 2017 +0200
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.19 [November 12, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.22 [May 26, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -51,10 +51,10 @@
 void PNGAPI
 png_save_uint_32(png_bytep buf, png_uint_32 i)
 {
-   buf[0] = (png_byte)(i >> 24);
-   buf[1] = (png_byte)(i >> 16);
-   buf[2] = (png_byte)(i >> 8);
-   buf[3] = (png_byte)(i     );
+   buf[0] = (png_byte)((i >> 24) & 0xffU);
+   buf[1] = (png_byte)((i >> 16) & 0xffU);
+   buf[2] = (png_byte)((i >>  8) & 0xffU);
+   buf[3] = (png_byte)( i        & 0xffU);
 }
 
 /* Place a 16-bit number into a buffer in PNG byte order.
@@ -64,8 +64,8 @@
 void PNGAPI
 png_save_uint_16(png_bytep buf, unsigned int i)
 {
-   buf[0] = (png_byte)(i >> 8);
-   buf[1] = (png_byte)(i     );
+   buf[0] = (png_byte)((i >> 8) & 0xffU);
+   buf[1] = (png_byte)( i       & 0xffU);
 }
 #endif
 
@@ -693,90 +693,6 @@
 }
 #endif /* WRITE_COMPRESSED_TEXT */
 
-#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
-    defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
-/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification,
- * and if invalid, correct the keyword rather than discarding the entire
- * chunk.  The PNG 1.0 specification requires keywords 1-79 characters in
- * length, forbids leading or trailing whitespace, multiple internal spaces,
- * and the non-break space (0x80) from ISO 8859-1.  Returns keyword length.
- *
- * The 'new_key' buffer must be 80 characters in size (for the keyword plus a
- * trailing '\0').  If this routine returns 0 then there was no keyword, or a
- * valid one could not be generated, and the caller must png_error.
- */
-static png_uint_32
-png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
-{
-   png_const_charp orig_key = key;
-   png_uint_32 key_len = 0;
-   int bad_character = 0;
-   int space = 1;
-
-   png_debug(1, "in png_check_keyword");
-
-   if (key == NULL)
-   {
-      *new_key = 0;
-      return 0;
-   }
-
-   while (*key && key_len < 79)
-   {
-      png_byte ch = (png_byte)*key++;
-
-      if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
-         *new_key++ = ch, ++key_len, space = 0;
-
-      else if (space == 0)
-      {
-         /* A space or an invalid character when one wasn't seen immediately
-          * before; output just a space.
-          */
-         *new_key++ = 32, ++key_len, space = 1;
-
-         /* If the character was not a space then it is invalid. */
-         if (ch != 32)
-            bad_character = ch;
-      }
-
-      else if (bad_character == 0)
-         bad_character = ch; /* just skip it, record the first error */
-   }
-
-   if (key_len > 0 && space != 0) /* trailing space */
-   {
-      --key_len, --new_key;
-      if (bad_character == 0)
-         bad_character = 32;
-   }
-
-   /* Terminate the keyword */
-   *new_key = 0;
-
-   if (key_len == 0)
-      return 0;
-
-#ifdef PNG_WARNINGS_SUPPORTED
-   /* Try to only output one warning per keyword: */
-   if (*key != 0) /* keyword too long */
-      png_warning(png_ptr, "keyword truncated");
-
-   else if (bad_character != 0)
-   {
-      PNG_WARNING_PARAMETERS(p)
-
-      png_warning_parameter(p, 1, orig_key);
-      png_warning_parameter_signed(p, 2, PNG_NUMBER_FORMAT_02x, bad_character);
-
-      png_formatted_warning(png_ptr, p, "keyword \"@1\": bad character '0x@2'");
-   }
-#endif /* WARNINGS */
-
-   return key_len;
-}
-#endif /* WRITE_TEXT || WRITE_pCAL || WRITE_iCCP || WRITE_sPLT */
-
 /* Write the IHDR chunk, and update the png_struct with the necessary
  * information.  Note that the rest of this code depends upon this
  * information being correct.
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -93,7 +93,6 @@
 
         if (XWM.getWMID() != XWM.METACITY_WM) {
             parentXED = dummyXED; // We don't like to leave it 'null'.
-
         } else {
             parentXED = new XEventDispatcher() {
                 // It's executed under AWTLock.
@@ -300,10 +299,19 @@
 
         removeXED(getWindow(), eframeXED);
         removeXED(eframeParentID, parentXED);
+        removeListeners();
         eframe.realDispose();
         balloon.dispose();
+        tooltip.dispose();
         isTrayIconDisplayed = false;
+        canvas.dispose();
+        canvas = null;
+        popup = null;
+        balloon = null;
+        tooltip = null;
         XToolkit.targetDisposedPeer(target, this);
+        target = null;
+        eframe = null;
     }
 
     public static void suppressWarningString(Window w) {
@@ -416,6 +424,12 @@
         eframe.addMouseListener(eventProxy);
     }
 
+    void removeListeners() {
+        canvas.removeMouseListener(eventProxy);
+        canvas.removeMouseMotionListener(eventProxy);
+        eframe.removeMouseListener(eventProxy);
+    }
+
     long getWindow() {
         return AWTAccessor.getComponentAccessor()
                           .<XEmbeddedFramePeer>getPeer(eframe).getWindow();
@@ -550,6 +564,11 @@
 
             super.repaintImage(doClear || (old_autosize != autosize));
         }
+
+        public void dispose() {
+            super.dispose();
+            target = null;
+        }
     }
 
     @SuppressWarnings("serial") // JDK-implementation class
@@ -573,6 +592,10 @@
             repaintImage(true);
         }
 
+        public void dispose() {
+            observer = null;
+        }
+
         // Invoke on EDT.
         protected void repaintImage(boolean doClear) {
             Graphics g = getGraphics();
--- a/jdk/src/java.desktop/windows/native/libfontmanager/fontpath.c	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.desktop/windows/native/libfontmanager/fontpath.c	Wed Jul 05 22:06:46 2017 +0200
@@ -263,6 +263,7 @@
     jstring familyLC;
     size_t slen;
     LOGFONTW lfw;
+    jboolean mapHasKey;
 
     /* Exceptions indicate critical errors such that program cannot continue
      * with further execution. Henceforth, the function returns immediately
@@ -311,10 +312,10 @@
     }
 
     /* check if already seen this family with a different charset */
-    jboolean mapHasKey = (*env)->CallBooleanMethod(env,
-                                                   fmi->familyToFontListMap,
-                                                   fmi->containsKeyMID,
-                                                   familyLC);
+    mapHasKey = (*env)->CallBooleanMethod(env,
+                                          fmi->familyToFontListMap,
+                                          fmi->containsKeyMID,
+                                          familyLC);
     if ((*env)->ExceptionCheck(env)) {
         /* Delete the created references before return */
         DeleteLocalReference(env, fmi->family);
@@ -535,6 +536,7 @@
     jclass classIDString;
     jmethodID putMID;
     GdiFontMapInfo fmi;
+    LOGFONTW lfw;
 
     /* Check we were passed all the maps we need, and do lookup of
      * methods for JNI up-calls
@@ -598,7 +600,6 @@
     }
 
     /* Enumerate fonts via GDI to build maps of fonts and families */
-    LOGFONTW lfw;
     memset(&lfw, 0, sizeof(lfw));
     lfw.lfCharSet = DEFAULT_CHARSET;  /* all charsets */
     wcscpy(lfw.lfFaceName, L"");      /* one face per family (CHECK) */
--- a/jdk/src/java.httpclient/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.httpclient/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,9 @@
  * questions.
  */
 
+/**
+ * Defines the high-level HTTP and WebSocket API.
+ */
 module java.httpclient {
     requires java.base;
     exports java.net.http;
--- a/jdk/src/java.instrument/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.instrument/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,10 @@
  * questions.
  */
 
+/**
+ * Defines services that allow agents to
+ * instrument programs running on the JVM.
+ */
 module java.instrument {
     exports java.lang.instrument;
 }
--- a/jdk/src/java.logging/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.logging/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,9 @@
  * questions.
  */
 
+/**
+ * Defines the Java Logging API.
+ */
 module java.logging {
     exports java.util.logging;
     provides jdk.internal.logger.DefaultLoggerFinder with
--- a/jdk/src/java.management/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.management/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,12 @@
  * questions.
  */
 
+/**
+ * Defines the Java Management Extensions (JMX) API.
+ * <P>
+ * The JMX API consists of interfaces for monitoring and management of the
+ * JVM and other components in the Java runtime.
+ */
 module java.management {
     requires public java.rmi;
     requires java.logging;
--- a/jdk/src/java.naming/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.naming/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,9 @@
  * questions.
  */
 
+/**
+ * Defines the Java Naming and Directory Interface (JNDI) API.
+ */
 module java.naming {
     requires java.security.sasl;
 
--- a/jdk/src/java.naming/share/classes/sun/security/provider/certpath/ldap/JdkLDAP.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.naming/share/classes/sun/security/provider/certpath/ldap/JdkLDAP.java	Wed Jul 05 22:06:46 2017 +0200
@@ -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
@@ -29,6 +29,7 @@
 import java.util.List;
 import java.security.*;
 import java.security.cert.CertStoreParameters;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
 
 /**
  * Provider class for the JdkLDAP provider.
@@ -69,7 +70,7 @@
     }
 
     public JdkLDAP() {
-        super("JdkLDAP", 9.0d, "JdkLDAP Provider (implements LDAP CertStore)");
+        super("JdkLDAP", PROVIDER_VER, "JdkLDAP Provider (implements LDAP CertStore)");
 
         final Provider p = this;
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
--- a/jdk/src/java.prefs/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.prefs/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,9 @@
  * questions.
  */
 
+/**
+ * Defines the Preferences API.
+ */
 module java.prefs {
     requires java.xml;
 
--- a/jdk/src/java.rmi/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.rmi/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,9 @@
  * questions.
  */
 
+/**
+ * Defines the Remote Method Invocation (RMI) API.
+ */
 module java.rmi {
     requires java.logging;
 
--- a/jdk/src/java.scripting/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.scripting/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,9 @@
  * questions.
  */
 
+/**
+ * Defines the Scripting API.
+ */
 module java.scripting {
     exports javax.script;
     uses javax.script.ScriptEngineFactory;
--- a/jdk/src/java.se.ee/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.se.ee/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,12 @@
  * questions.
  */
 
+/**
+ * Defines the full API of the Java SE Platform.
+ * <P>
+ * This module requires {@code java.se} and supplements it with modules
+ * that define CORBA and Java EE APIs. These modules are upgradeable.
+ */
 module java.se.ee {
 
     requires public java.se;
--- a/jdk/src/java.se/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.se/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,13 @@
  * questions.
  */
 
+/**
+ * Defines the core Java SE API.
+ * <P>
+ * The modules defining
+ * CORBA and Java EE APIs are not required by this module, but they are
+ * required by {@code java.se.ee}.
+ */
 module java.se {
     requires public java.compact3;
     requires public java.datatransfer;
--- a/jdk/src/java.security.jgss/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.security.jgss/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,11 @@
  * questions.
  */
 
+/**
+ * Defines the Java binding of the IETF Generic Security Services API (GSS-API).
+ * <P>
+ * This module also contains GSS-API mechanisms including Kerberos v5 and SPNEGO.
+ */
 module java.security.jgss {
     requires java.naming;
     exports javax.security.auth.kerberos;
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/SunProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/SunProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -33,6 +33,7 @@
 import java.security.ProviderException;
 import sun.security.jgss.krb5.Krb5MechFactory;
 import sun.security.jgss.spnego.SpNegoMechFactory;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
 
 /**
  * Defines the Sun JGSS provider.
@@ -99,7 +100,7 @@
 
     public SunProvider() {
         /* We are the Sun JGSS provider */
-        super("SunJGSS", 9.0d, INFO);
+        super("SunJGSS", PROVIDER_VER, INFO);
 
         final Provider p = this;
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -31,6 +31,7 @@
 import java.security.PrivilegedAction;
 import org.ietf.jgss.Oid;
 import sun.security.action.PutAllAction;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
 
 /**
  * Defines the Sun NativeGSS provider for plugging in the
@@ -120,7 +121,7 @@
 
     public SunNativeProvider() {
         /* We are the Sun NativeGSS provider */
-        super(NAME, 9.0d, INFO);
+        super(NAME, PROVIDER_VER, INFO);
 
         if (MECH_MAP != null) {
             AccessController.doPrivileged(new PutAllAction(this, MECH_MAP));
--- a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/Provider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/Provider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -29,6 +29,7 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.InvalidParameterException;
 import java.security.ProviderException;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
 
 /**
  * The SASL provider.
@@ -98,7 +99,7 @@
     }
 
     public Provider() {
-        super("SunSASL", 9.0d, info);
+        super("SunSASL", PROVIDER_VER, info);
 
         final Provider p = this;
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
--- a/jdk/src/java.security.sasl/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.security.sasl/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,13 @@
  * questions.
  */
 
+/**
+ * Defines Java support for the IETF Simple Authentication and Security Layer
+ * (SASL).
+ * <P>
+ * This module also contains SASL mechanisms including DIGEST-MD5,
+ * CRAM-MD5, and NTLM.
+ */
 module java.security.sasl {
     requires java.logging;
 
--- a/jdk/src/java.smartcardio/share/classes/javax/smartcardio/TerminalFactory.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.smartcardio/share/classes/javax/smartcardio/TerminalFactory.java	Wed Jul 05 22:06:46 2017 +0200
@@ -134,7 +134,7 @@
         private static final long serialVersionUID = 2745808869881593918L;
         final static Provider INSTANCE = new NoneProvider();
         private NoneProvider() {
-            super("None", 1.0d, "none");
+            super("None", "1.0", "none");
         }
     }
 
--- a/jdk/src/java.smartcardio/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.smartcardio/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,9 @@
  * questions.
  */
 
+/**
+ * Defines the Java Smart Card I/O API.
+ */
 module java.smartcardio {
     exports javax.smartcardio;
     provides java.security.Provider with sun.security.smartcardio.SunPCSC;
--- a/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/SunPCSC.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/SunPCSC.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -28,6 +28,7 @@
 import java.security.*;
 
 import javax.smartcardio.*;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
 
 /**
  * Provider object for PC/SC.
@@ -65,7 +66,7 @@
     }
 
     public SunPCSC() {
-        super("SunPCSC", 9.0d, "Sun PC/SC provider");
+        super("SunPCSC", PROVIDER_VER, "Sun PC/SC provider");
 
         final Provider p = this;
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
--- a/jdk/src/java.sql.rowset/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.sql.rowset/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,9 @@
  * questions.
  */
 
+/**
+ * Defines the JDBC RowSet API.
+ */
 module java.sql.rowset {
     requires public java.logging;
     requires public java.naming;
--- a/jdk/src/java.sql/share/classes/javax/sql/DataSource.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.sql/share/classes/javax/sql/DataSource.java	Wed Jul 05 22:06:46 2017 +0200
@@ -64,7 +64,7 @@
  * <P>
  * A driver that is accessed via a {@code DataSource} object does not
  * register itself with the {@code DriverManager}.  Rather, a
- * {@code DataSource} object is retrieved though a lookup operation
+ * {@code DataSource} object is retrieved through a lookup operation
  * and then used to create a {@code Connection} object.  With a basic
  * implementation, the connection obtained through a {@code DataSource}
  * object is identical to a connection obtained through the
--- a/jdk/src/java.sql/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.sql/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,9 @@
  * questions.
  */
 
+/**
+ * Defines the JDBC API.
+ */
 module java.sql {
     requires public java.logging;
     requires public java.xml;
--- a/jdk/src/java.transaction/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.transaction/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,12 @@
  * questions.
  */
 
+/**
+ * Defines a subset of the Java Transaction API (JTA) to support CORBA interop.
+ * <P>
+ * The subset consists of RMI exception types which are mapped to CORBA system
+ * exceptions by the 'Java Language to IDL Mapping Specification'.
+ */
 module java.transaction {
     requires public java.rmi;
     exports javax.transaction;
--- a/jdk/src/java.xml.crypto/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.xml.crypto/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,6 +23,9 @@
  * questions.
  */
 
+/**
+ * Defines an API for XML cryptography.
+ */
 module java.xml.crypto {
     requires public java.xml;
     requires java.logging;
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java	Wed Jul 05 22:06:46 2017 +0200
@@ -28,7 +28,7 @@
  * ===========================================================================
  */
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: XMLDSigRI.java 1400021 2012-10-19 10:16:04Z coheigea $
@@ -59,6 +59,13 @@
         "C14N 1.0, C14N 1.1, Exclusive C14N, Base64, Enveloped, XPath, " +
         "XPath2, XSLT TransformServices)";
 
+    private static final String VER =
+        AccessController.doPrivileged(new PrivilegedAction<>() {
+            public String run() {
+                return System.getProperty("java.specification.version");
+            }
+        });
+
     private static final class ProviderService extends Provider.Service {
 
         ProviderService(Provider p, String type, String algo, String cn) {
@@ -129,7 +136,7 @@
 
     public XMLDSigRI() {
         /* We are the XMLDSig provider */
-        super("XMLDSig", 9.0d, INFO);
+        super("XMLDSig", VER, INFO);
 
         final Provider p = this;
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
--- a/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/SunEC.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/SunEC.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -31,6 +31,7 @@
 import sun.security.util.CurveDB;
 import sun.security.util.NamedCurve;
 import sun.security.util.ECParameters;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
 
 /**
  * Provider class for the Elliptic Curve provider.
@@ -142,7 +143,8 @@
     }
 
     public SunEC() {
-        super("SunEC", 9.0d, "Sun Elliptic Curve provider (EC, ECDSA, ECDH)");
+        super("SunEC", PROVIDER_VER,
+            "Sun Elliptic Curve provider (EC, ECDSA, ECDH)");
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
             public Void run() {
                 putEntries(useFullImplementation);
--- a/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/Key.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/Key.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,7 +30,6 @@
 /**
  * The handle for an RSA or DSA key using the Microsoft Crypto API.
  *
- * @see DSAPrivateKey
  * @see RSAPrivateKey
  * @see RSAPublicKey
  *
@@ -41,9 +40,35 @@
 {
     private static final long serialVersionUID = -1088859394025049194L;
 
-    // Native handle
-    protected long hCryptProv = 0;
-    protected long hCryptKey = 0;
+    static class NativeHandles {
+        long hCryptProv = 0;
+        long hCryptKey = 0;
+
+        public NativeHandles(long hCryptProv, long hCryptKey) {
+            this.hCryptProv = hCryptProv;
+            this.hCryptKey = hCryptKey;
+        }
+
+        /**
+         * Finalization method
+         */
+        protected void finalize() throws Throwable
+        {
+            try {
+                synchronized(this)
+                {
+                    cleanUp(hCryptProv, hCryptKey);
+                    hCryptProv = 0;
+                    hCryptKey = 0;
+                }
+
+            } finally {
+                super.finalize();
+            }
+        }
+    }
+
+    protected NativeHandles handles;
 
     // Key length
     protected int keyLength = 0;
@@ -51,29 +76,10 @@
     /**
      * Construct a Key object.
      */
-    protected Key(long hCryptProv, long hCryptKey, int keyLength)
-    {
-        this.hCryptProv = hCryptProv;
-        this.hCryptKey = hCryptKey;
-        this.keyLength = keyLength;
-    }
-
-    /**
-     * Finalization method
-     */
-    protected void finalize() throws Throwable
+    protected Key(NativeHandles handles, int keyLength)
     {
-        try {
-            synchronized(this)
-            {
-                cleanUp(hCryptProv, hCryptKey);
-                hCryptProv = 0;
-                hCryptKey = 0;
-            }
-
-        } finally {
-            super.finalize();
-        }
+        this.handles = handles;
+        this.keyLength = keyLength;
     }
 
     /**
@@ -96,7 +102,7 @@
      */
     public long getHCryptKey()
     {
-        return hCryptKey;
+        return handles.hCryptKey;
     }
 
     /**
@@ -104,12 +110,12 @@
      */
     public long getHCryptProvider()
     {
-        return hCryptProv;
+        return handles.hCryptProv;
     }
 
     /**
      * Returns the standard algorithm name for this key. For
-     * example, "DSA" would indicate that this key is a DSA key.
+     * example, "RSA" would indicate that this key is a RSA key.
      * See Appendix A in the <a href=
      * "../../../guide/security/CryptoSpec.html#AppA">
      * Java Cryptography Architecture API Specification &amp; Reference </a>
--- a/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java	Wed Jul 05 22:06:46 2017 +0200
@@ -168,7 +168,7 @@
             }
             certChain = chain;
         }
-    };
+    }
 
     /*
      * An X.509 certificate factory.
@@ -798,7 +798,8 @@
             }
 
             storeWithUniqueAlias(alias, new KeyEntry(alias,
-                    new RSAPrivateKey(hCryptProv, hCryptKey, keyLength),
+                    new RSAPrivateKey(new Key.NativeHandles(hCryptProv,
+                            hCryptKey), keyLength),
                     certChain));
         }
         catch (Throwable e)
@@ -854,7 +855,6 @@
      * Load keys and/or certificates from keystore into Collection.
      *
      * @param name Name of keystore.
-     * @param entries Collection of key/certificate.
      */
     private native void loadKeysOrCertificateChains(String name)
             throws KeyStoreException;
--- a/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/RSAKeyPair.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/RSAKeyPair.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -41,8 +41,9 @@
      */
     RSAKeyPair(long hCryptProv, long hCryptKey, int keyLength)
     {
-        privateKey = new RSAPrivateKey(hCryptProv, hCryptKey, keyLength);
-        publicKey = new RSAPublicKey(hCryptProv, hCryptKey, keyLength);
+        Key.NativeHandles handles = new Key.NativeHandles(hCryptProv, hCryptKey);
+        privateKey = new RSAPrivateKey(handles, keyLength);
+        publicKey = new RSAPublicKey(handles, keyLength);
     }
 
     public RSAPrivateKey getPrivate() {
--- a/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/RSAPrivateKey.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/RSAPrivateKey.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -42,7 +42,15 @@
      */
     RSAPrivateKey(long hCryptProv, long hCryptKey, int keyLength)
     {
-        super(hCryptProv, hCryptKey, keyLength);
+        super(new NativeHandles(hCryptProv, hCryptKey), keyLength);
+    }
+
+    /**
+     * Construct an RSAPrivateKey object.
+     */
+    RSAPrivateKey(NativeHandles handles, int keyLength)
+    {
+        super(handles, keyLength);
     }
 
     /**
@@ -63,8 +71,8 @@
     public String toString()
     {
         return "RSAPrivateKey [size=" + keyLength + " bits, type=" +
-            getKeyType(hCryptKey) + ", container=" +
-            getContainerName(hCryptProv) + "]";
+            getKeyType(handles.hCryptKey) + ", container=" +
+            getContainerName(handles.hCryptProv) + "]";
     }
 
     // This class is not serializable
--- a/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/RSAPublicKey.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/RSAPublicKey.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -51,7 +51,15 @@
      */
     RSAPublicKey(long hCryptProv, long hCryptKey, int keyLength)
     {
-        super(hCryptProv, hCryptKey, keyLength);
+        super(new NativeHandles(hCryptProv, hCryptKey), keyLength);
+    }
+
+    /**
+     * Construct an RSAPublicKey object.
+     */
+    RSAPublicKey(NativeHandles handles, int keyLength)
+    {
+        super(handles, keyLength);
     }
 
     /**
@@ -77,8 +85,8 @@
         StringBuffer sb = new StringBuffer();
 
         sb.append("RSAPublicKey [size=").append(keyLength)
-            .append(" bits, type=").append(getKeyType(hCryptKey))
-            .append(", container=").append(getContainerName(hCryptProv))
+            .append(" bits, type=").append(getKeyType(handles.hCryptKey))
+            .append(", container=").append(getContainerName(handles.hCryptProv))
             .append("]\n  modulus: ").append(getModulus())
             .append("\n  public exponent: ").append(getPublicExponent());
 
@@ -93,7 +101,7 @@
         if (exponent == null) {
 
             try {
-                publicKeyBlob = getPublicKeyBlob(hCryptKey);
+                publicKeyBlob = getPublicKeyBlob(handles.hCryptKey);
                 exponent = new BigInteger(1, getExponent(publicKeyBlob));
 
             } catch (KeyException e) {
@@ -112,7 +120,7 @@
         if (modulus == null) {
 
             try {
-                publicKeyBlob = getPublicKeyBlob(hCryptKey);
+                publicKeyBlob = getPublicKeyBlob(handles.hCryptKey);
                 modulus = new BigInteger(1, getModulus(publicKeyBlob));
 
             } catch (KeyException e) {
--- a/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/SunMSCAPI.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/SunMSCAPI.java	Wed Jul 05 22:06:46 2017 +0200
@@ -33,6 +33,7 @@
 import java.security.ProviderException;
 import java.util.HashMap;
 import java.util.Arrays;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
 
 /**
  * A Cryptographic Service Provider for the Microsoft Crypto API.
@@ -124,7 +125,7 @@
     }
 
     public SunMSCAPI() {
-        super("SunMSCAPI", 9.0d, INFO);
+        super("SunMSCAPI", PROVIDER_VER, INFO);
 
         final Provider p = this;
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
--- a/jdk/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp	Wed Jul 05 22:06:46 2017 +0200
@@ -358,38 +358,50 @@
             BOOL bHasNoPrivateKey = FALSE;
             DWORD dwPublicKeyLength = 0;
 
-            if (::CryptAcquireCertificatePrivateKey(pCertContext, NULL, NULL,
-                                                    &hCryptProv, &dwKeySpec, &bCallerFreeProv) == FALSE)
+            // First, probe it silently
+            if (::CryptAcquireCertificatePrivateKey(pCertContext, CRYPT_ACQUIRE_SILENT_FLAG, NULL,
+                    &hCryptProv, &dwKeySpec, &bCallerFreeProv) == FALSE
+                && GetLastError() != NTE_SILENT_CONTEXT)
             {
                 bHasNoPrivateKey = TRUE;
-
-            } else {
-                // Private key is available
-
-                BOOL bGetUserKey = ::CryptGetUserKey(hCryptProv, dwKeySpec, &hUserKey);
-
-                // Skip certificate if cannot find private key
-                if (bGetUserKey == FALSE)
-                {
-                    if (bCallerFreeProv)
-                        ::CryptReleaseContext(hCryptProv, NULL);
-
-                    continue;
+            }
+            else
+            {
+                if (bCallerFreeProv == TRUE) {
+                    ::CryptReleaseContext(hCryptProv, NULL);
+                    bCallerFreeProv = FALSE;
                 }
 
-                // Set cipher mode to ECB
-                DWORD dwCipherMode = CRYPT_MODE_ECB;
-                ::CryptSetKeyParam(hUserKey, KP_MODE, (BYTE*)&dwCipherMode, NULL);
-
+                // Second, acquire the key normally (not silently)
+                if (::CryptAcquireCertificatePrivateKey(pCertContext, 0, NULL,
+                        &hCryptProv, &dwKeySpec, &bCallerFreeProv) == FALSE)
+                {
+                    bHasNoPrivateKey = TRUE;
+                }
+                else
+                {
+                    // Private key is available
+                    BOOL bGetUserKey = ::CryptGetUserKey(hCryptProv, dwKeySpec, &hUserKey);
 
-                // If the private key is present in smart card, we may not be able to
-                // determine the key length by using the private key handle. However,
-                // since public/private key pairs must have the same length, we could
-                // determine the key length of the private key by using the public key
-                // in the certificate.
-                dwPublicKeyLength = ::CertGetPublicKeyLength(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
-                        &(pCertContext->pCertInfo->SubjectPublicKeyInfo));
+                    // Skip certificate if cannot find private key
+                    if (bGetUserKey == FALSE) {
+                        if (bCallerFreeProv)
+                            ::CryptReleaseContext(hCryptProv, NULL);
+                        continue;
+                    }
 
+                    // Set cipher mode to ECB
+                    DWORD dwCipherMode = CRYPT_MODE_ECB;
+                    ::CryptSetKeyParam(hUserKey, KP_MODE, (BYTE*)&dwCipherMode, NULL);
+
+                    // If the private key is present in smart card, we may not be able to
+                    // determine the key length by using the private key handle. However,
+                    // since public/private key pairs must have the same length, we could
+                    // determine the key length of the private key by using the public key
+                    // in the certificate.
+                    dwPublicKeyLength = ::CertGetPublicKeyLength(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
+                            &(pCertContext->pCertInfo->SubjectPublicKeyInfo));
+                }
             }
             PCCERT_CHAIN_CONTEXT pCertChainContext = NULL;
 
@@ -398,8 +410,7 @@
             //
             if (GetCertificateChain(OID_EKU_ANY, pCertContext, &pCertChainContext))
             {
-
-                for (unsigned int i=0; i < pCertChainContext->cChain; i++)
+                for (DWORD i = 0; i < pCertChainContext->cChain; i++)
                 {
                     // Found cert chain
                     PCERT_SIMPLE_CHAIN rgpChain =
@@ -449,6 +460,7 @@
                         // cert collection
                         env->CallVoidMethod(obj, mGenCert, byteArray, jArrayList);
                     }
+
                     if (bHasNoPrivateKey)
                     {
                         // Generate certificate chain and store into cert chain
@@ -1367,43 +1379,57 @@
     HCRYPTPROV hCryptProv = NULL;
     HCRYPTKEY hKey = NULL;
     DWORD dwKeySpec;
+    BOOL bCallerFreeProv = FALSE;
+    BOOL bRes;
 
     __try
     {
         if (usePrivateKey == JNI_TRUE) {
             // Locate the key container for the certificate's private key
-            if (!(::CryptAcquireCertificatePrivateKey(
-                (PCCERT_CONTEXT) pCertContext, 0, NULL, &hCryptProv,
-                &dwKeySpec, NULL))) {
+
+            // First, probe it silently
+            bRes = ::CryptAcquireCertificatePrivateKey(
+                    (PCCERT_CONTEXT) pCertContext, CRYPT_ACQUIRE_SILENT_FLAG,
+                    NULL, &hCryptProv, &dwKeySpec, &bCallerFreeProv);
 
+            if (bRes == FALSE && GetLastError() != NTE_SILENT_CONTEXT)
+            {
+                ThrowException(env, KEYSTORE_EXCEPTION, GetLastError());
+                __leave;
+            }
+
+            if (bCallerFreeProv == TRUE) {
+                ::CryptReleaseContext(hCryptProv, NULL);
+                bCallerFreeProv = FALSE;
+            }
+
+            // Now, do it normally (not silently)
+            if (::CryptAcquireCertificatePrivateKey(
+                    (PCCERT_CONTEXT) pCertContext, 0, NULL, &hCryptProv,
+                    &dwKeySpec, &bCallerFreeProv) == FALSE)
+            {
                 ThrowException(env, KEYSTORE_EXCEPTION, GetLastError());
                 __leave;
             }
 
             // Get a handle to the private key
-            if (!(::CryptGetUserKey(hCryptProv, dwKeySpec, &hKey))) {
+            if (::CryptGetUserKey(hCryptProv, dwKeySpec, &hKey) == FALSE) {
                 ThrowException(env, KEY_EXCEPTION, GetLastError());
                 __leave;
             }
-
-        } else { // use public key
+        }
+        else // use public key
+        {
+            bCallerFreeProv = TRUE;
 
             //  Acquire a CSP context.
-            if(::CryptAcquireContext(
-               &hCryptProv,
-               "J2SE",
-               NULL,
-               PROV_RSA_FULL,
-               0) == FALSE)
+            if (::CryptAcquireContext(&hCryptProv, "J2SE", NULL,
+                    PROV_RSA_FULL, 0) == FALSE)
             {
                 // If CSP context hasn't been created, create one.
                 //
-                if (::CryptAcquireContext(
-                    &hCryptProv,
-                    "J2SE",
-                    NULL,
-                    PROV_RSA_FULL,
-                    CRYPT_NEWKEYSET) == FALSE)
+                if (::CryptAcquireContext(&hCryptProv, "J2SE", NULL,
+                        PROV_RSA_FULL, CRYPT_NEWKEYSET) == FALSE)
                 {
                     ThrowException(env, KEYSTORE_EXCEPTION, GetLastError());
                     __leave;
@@ -1411,10 +1437,10 @@
             }
 
             // Import the certificate's public key into the key container
-            if (!(::CryptImportPublicKeyInfo(hCryptProv, X509_ASN_ENCODING,
-                &(((PCCERT_CONTEXT) pCertContext)->pCertInfo->SubjectPublicKeyInfo),
-                &hKey))) {
-
+            if (::CryptImportPublicKeyInfo(hCryptProv, X509_ASN_ENCODING,
+                    &(((PCCERT_CONTEXT) pCertContext)->pCertInfo->SubjectPublicKeyInfo),
+                    &hKey) == FALSE)
+            {
                 ThrowException(env, KEY_EXCEPTION, GetLastError());
                 __leave;
             }
@@ -1425,7 +1451,7 @@
         //--------------------------------------------------------------------
         // Clean up.
 
-        if (hCryptProv)
+        if (bCallerFreeProv == TRUE && hCryptProv != NULL)
             ::CryptReleaseContext(hCryptProv, 0);
     }
 
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Key.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Key.java	Wed Jul 05 22:06:46 2017 +0200
@@ -340,25 +340,33 @@
         } else {
             switch (algorithm) {
                 case "RSA":
-                    // XXX better test for RSA CRT keys (single getAttributes() call)
-                    // we need to determine whether this is a CRT key
-                    // see if we can obtain the public exponent
-                    // this should also be readable for sensitive/extractable keys
+                    // In order to decide if this is RSA CRT key, we first query
+                    // and see if all extra CRT attributes are available.
                     CK_ATTRIBUTE[] attrs2 = new CK_ATTRIBUTE[] {
                         new CK_ATTRIBUTE(CKA_PUBLIC_EXPONENT),
+                        new CK_ATTRIBUTE(CKA_PRIME_1),
+                        new CK_ATTRIBUTE(CKA_PRIME_2),
+                        new CK_ATTRIBUTE(CKA_EXPONENT_1),
+                        new CK_ATTRIBUTE(CKA_EXPONENT_2),
+                        new CK_ATTRIBUTE(CKA_COEFFICIENT),
                     };
                     boolean crtKey;
                     try {
                         session.token.p11.C_GetAttributeValue
                             (session.id(), keyID, attrs2);
-                        crtKey = (attrs2[0].pValue instanceof byte[]);
+                        crtKey = ((attrs2[0].pValue instanceof byte[]) &&
+                                  (attrs2[1].pValue instanceof byte[]) &&
+                                  (attrs2[2].pValue instanceof byte[]) &&
+                                  (attrs2[3].pValue instanceof byte[]) &&
+                                  (attrs2[4].pValue instanceof byte[]) &&
+                                  (attrs2[5].pValue instanceof byte[])) ;
                     } catch (PKCS11Exception e) {
                         // ignore, assume not available
                         crtKey = false;
                     }
                     if (crtKey) {
                         return new P11RSAPrivateKey
-                                (session, keyID, algorithm, keyLength, attributes);
+                                (session, keyID, algorithm, keyLength, attributes, attrs2);
                     } else {
                         return new P11RSAPrivateNonCRTKey
                                 (session, keyID, algorithm, keyLength, attributes);
@@ -475,8 +483,24 @@
         private BigInteger n, e, d, p, q, pe, qe, coeff;
         private byte[] encoded;
         P11RSAPrivateKey(Session session, long keyID, String algorithm,
-                int keyLength, CK_ATTRIBUTE[] attributes) {
-            super(PRIVATE, session, keyID, algorithm, keyLength, attributes);
+                int keyLength, CK_ATTRIBUTE[] attrs, CK_ATTRIBUTE[] crtAttrs) {
+            super(PRIVATE, session, keyID, algorithm, keyLength, attrs);
+
+            for (CK_ATTRIBUTE a : crtAttrs) {
+                if (a.type == CKA_PUBLIC_EXPONENT) {
+                    e = a.getBigInteger();
+                } else if (a.type == CKA_PRIME_1) {
+                    p = a.getBigInteger();
+                } else if (a.type == CKA_PRIME_2) {
+                    q = a.getBigInteger();
+                } else if (a.type == CKA_EXPONENT_1) {
+                    pe = a.getBigInteger();
+                } else if (a.type == CKA_EXPONENT_2) {
+                    qe = a.getBigInteger();
+                } else if (a.type == CKA_COEFFICIENT) {
+                    coeff = a.getBigInteger();
+                }
+            }
         }
         private synchronized void fetchValues() {
             token.ensureValid();
@@ -485,24 +509,13 @@
             }
             CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
                 new CK_ATTRIBUTE(CKA_MODULUS),
-                new CK_ATTRIBUTE(CKA_PUBLIC_EXPONENT),
                 new CK_ATTRIBUTE(CKA_PRIVATE_EXPONENT),
-                new CK_ATTRIBUTE(CKA_PRIME_1),
-                new CK_ATTRIBUTE(CKA_PRIME_2),
-                new CK_ATTRIBUTE(CKA_EXPONENT_1),
-                new CK_ATTRIBUTE(CKA_EXPONENT_2),
-                new CK_ATTRIBUTE(CKA_COEFFICIENT),
             };
             fetchAttributes(attributes);
             n = attributes[0].getBigInteger();
-            e = attributes[1].getBigInteger();
-            d = attributes[2].getBigInteger();
-            p = attributes[3].getBigInteger();
-            q = attributes[4].getBigInteger();
-            pe = attributes[5].getBigInteger();
-            qe = attributes[6].getBigInteger();
-            coeff = attributes[7].getBigInteger();
+            d = attributes[1].getBigInteger();
         }
+
         public String getFormat() {
             token.ensureValid();
             return "PKCS#8";
@@ -529,7 +542,6 @@
             return n;
         }
         public BigInteger getPublicExponent() {
-            fetchValues();
             return e;
         }
         public BigInteger getPrivateExponent() {
@@ -537,23 +549,18 @@
             return d;
         }
         public BigInteger getPrimeP() {
-            fetchValues();
             return p;
         }
         public BigInteger getPrimeQ() {
-            fetchValues();
             return q;
         }
         public BigInteger getPrimeExponentP() {
-            fetchValues();
             return pe;
         }
         public BigInteger getPrimeExponentQ() {
-            fetchValues();
             return qe;
         }
         public BigInteger getCrtCoefficient() {
-            fetchValues();
             return coeff;
         }
     }
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SunPKCS11.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SunPKCS11.java	Wed Jul 05 22:06:46 2017 +0200
@@ -44,6 +44,7 @@
 
 import sun.security.util.Debug;
 import sun.security.util.ResourcesMgr;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
 
 import sun.security.pkcs11.Secmod.*;
 
@@ -89,7 +90,8 @@
     }
 
     public SunPKCS11() {
-        super("SunPKCS11", 9.0d, "Unconfigured and unusable PKCS11 provider");
+        super("SunPKCS11", PROVIDER_VER,
+            "Unconfigured and unusable PKCS11 provider");
         p11 = null;
         config = null;
         slotID = 0;
@@ -132,7 +134,7 @@
 
     // Used by Secmod
     SunPKCS11(Config c) {
-        super("SunPKCS11-" + c.getName(), 9.0d, c.getDescription());
+        super("SunPKCS11-" + c.getName(), PROVIDER_VER, c.getDescription());
         this.config = c;
 
         if (debug != null) {
@@ -816,6 +818,7 @@
         }
         final TokenPoller poller = new TokenPoller(this);
         Thread t = new Thread(null, poller, "Poller " + getName(), 0, false);
+        t.setContextClassLoader(null);
         t.setDaemon(true);
         t.setPriority(Thread.MIN_PRIORITY);
         t.start();
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -30,6 +30,8 @@
 import java.lang.reflect.Constructor;
 import java.util.*;
 import java.security.*;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
+
 
 /**
  * OracleUcrypto provider main class.
@@ -196,7 +198,7 @@
     }
 
     public UcryptoProvider() {
-        super("OracleUcrypto", 9.0d, "Provider using Oracle Ucrypto API");
+        super("OracleUcrypto", PROVIDER_VER, "Provider using Oracle Ucrypto API");
 
         AccessController.doPrivileged(new PrivilegedAction<>() {
             public Void run() {
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties	Wed Jul 05 22:06:46 2017 +0200
@@ -68,15 +68,15 @@
 error.versioned.info.name.notequal=\
         module-info.class in a versioned directory contains incorrect name
 error.versioned.info.requires.public=\
-        module-info.class in a versioned directory contains additional requires public
+        module-info.class in a versioned directory contains additional "requires public"
 error.versioned.info.requires.added=\
-        module-info.class in a versioned directory contains additional requires
+        module-info.class in a versioned directory contains additional "requires"
 error.versioned.info.requires.dropped=\
-        module-info.class in a versioned directory contains missing requires
+        module-info.class in a versioned directory contains missing "requires"
 error.versioned.info.exports.notequal=\
-        module-info.class in a versioned directory contains different exports
+        module-info.class in a versioned directory contains different "exports"
 error.versioned.info.provides.notequal=\
-        module-info.class in a versioned directory contains different provides
+        module-info.class in a versioned directory contains different "provides"
 error.invalid.versioned.module.attribute=\
         Invalid module descriptor attribute {0}
 error.missing.provider=\
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java	Wed Jul 05 22:06:46 2017 +0200
@@ -55,7 +55,7 @@
 
     private static final String DESCRIPTION = PluginsResourceBundle.getDescription(NAME);
 
-    private static final String DMH = "java/lang/invoke/DirectMethodHandle$Holder";
+    private static final String DIRECT_METHOD_HANDLE = "java/lang/invoke/DirectMethodHandle$Holder";
     private static final String DMH_INVOKE_VIRTUAL = "invokeVirtual";
     private static final String DMH_INVOKE_STATIC = "invokeStatic";
     private static final String DMH_INVOKE_SPECIAL = "invokeSpecial";
@@ -63,6 +63,10 @@
     private static final String DMH_INVOKE_INTERFACE = "invokeInterface";
     private static final String DMH_INVOKE_STATIC_INIT = "invokeStaticInit";
 
+    private static final String DELEGATING_METHOD_HANDLE = "java/lang/invoke/DelegatingMethodHandle$Holder";
+
+    private static final String BASIC_FORMS_HANDLE = "java/lang/invoke/LambdaForm$Holder";
+
     private static final JavaLangInvokeAccess JLIA
             = SharedSecrets.getJavaLangInvokeAccess();
 
@@ -222,9 +226,18 @@
     @Override
     public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         // Copy all but DMH_ENTRY to out
-        in.transformAndCopy(entry -> entry.path().equals(DMH_ENTRY) ? null : entry, out);
+        in.transformAndCopy(entry -> {
+                // filter out placeholder entries
+                if (entry.path().equals(DIRECT_METHOD_HANDLE_ENTRY) ||
+                    entry.path().equals(DELEGATING_METHOD_HANDLE_ENTRY) ||
+                    entry.path().equals(BASIC_FORMS_HANDLE_ENTRY)) {
+                    return null;
+                } else {
+                    return entry;
+                }
+            }, out);
         speciesTypes.forEach(types -> generateBMHClass(types, out));
-        generateDMHClass(out);
+        generateHolderClasses(out);
         return out.build();
     }
 
@@ -247,7 +260,7 @@
         }
     }
 
-    private void generateDMHClass(ResourcePoolBuilder out) {
+    private void generateHolderClasses(ResourcePoolBuilder out) {
         int count = 0;
         for (List<String> entry : dmhMethods.values()) {
             count += entry.size();
@@ -264,15 +277,30 @@
             }
         }
         try {
-            byte[] bytes =
-                    JLIA.generateDMHClassBytes(DMH, methodTypes, dmhTypes);
-            ResourcePoolEntry ndata = ResourcePoolEntry.create(DMH_ENTRY, bytes);
+            byte[] bytes = JLIA.generateDirectMethodHandleHolderClassBytes(
+                    DIRECT_METHOD_HANDLE, methodTypes, dmhTypes);
+            ResourcePoolEntry ndata = ResourcePoolEntry
+                    .create(DIRECT_METHOD_HANDLE_ENTRY, bytes);
+            out.add(ndata);
+
+            bytes = JLIA.generateDelegatingMethodHandleHolderClassBytes(
+                    DELEGATING_METHOD_HANDLE, methodTypes);
+            ndata = ResourcePoolEntry.create(DELEGATING_METHOD_HANDLE_ENTRY, bytes);
+            out.add(ndata);
+
+            bytes = JLIA.generateBasicFormsClassBytes(BASIC_FORMS_HANDLE);
+            ndata = ResourcePoolEntry.create(BASIC_FORMS_HANDLE_ENTRY, bytes);
             out.add(ndata);
         } catch (Exception ex) {
             throw new PluginException(ex);
         }
     }
-    private static final String DMH_ENTRY = "/java.base/" + DMH + ".class";
+    private static final String DIRECT_METHOD_HANDLE_ENTRY =
+            "/java.base/" + DIRECT_METHOD_HANDLE + ".class";
+    private static final String DELEGATING_METHOD_HANDLE_ENTRY =
+            "/java.base/" + DELEGATING_METHOD_HANDLE + ".class";
+    private static final String BASIC_FORMS_HANDLE_ENTRY =
+            "/java.base/" + BASIC_FORMS_HANDLE + ".class";
 
     // Convert LL -> LL, L3 -> LLL
     private static String expandSignature(String signature) {
@@ -310,15 +338,19 @@
         assert(parts.length == 2);
         assert(parts[1].length() == 1);
         String parameters = expandSignature(parts[0]);
-        Class<?> rtype = primitiveType(parts[1].charAt(0));
-        Class<?>[] ptypes = new Class<?>[parameters.length()];
-        for (int i = 0; i < ptypes.length; i++) {
-            ptypes[i] = primitiveType(parameters.charAt(i));
+        Class<?> rtype = simpleType(parts[1].charAt(0));
+        if (parameters.isEmpty()) {
+            return MethodType.methodType(rtype);
+        } else {
+            Class<?>[] ptypes = new Class<?>[parameters.length()];
+            for (int i = 0; i < ptypes.length; i++) {
+                ptypes[i] = simpleType(parameters.charAt(i));
+            }
+            return MethodType.methodType(rtype, ptypes);
         }
-        return MethodType.methodType(rtype, ptypes);
     }
 
-    private static Class<?> primitiveType(char c) {
+    private static Class<?> simpleType(char c) {
         switch (c) {
             case 'F':
                 return float.class;
--- a/jdk/src/jdk.security.auth/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.security.auth/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,6 +23,10 @@
  * questions.
  */
 
+/**
+ * Contains the implementation of the javax.security.auth.* interfaces and
+ * various authentication modules.
+ */
 module jdk.security.auth {
     requires public java.naming;
     requires java.security.jgss;
--- a/jdk/src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/JdkSASL.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/JdkSASL.java	Wed Jul 05 22:06:46 2017 +0200
@@ -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,6 +30,8 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.InvalidParameterException;
 import java.security.ProviderException;
+import static sun.security.util.SecurityConstants.PROVIDER_VER;
+
 
 /**
  * The JdkSASL provider class -
@@ -73,7 +75,7 @@
     }
 
     public JdkSASL() {
-        super("JdkSASL", 9.0d, info);
+        super("JdkSASL", PROVIDER_VER, info);
 
         final Provider p = this;
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
--- a/jdk/src/jdk.security.jgss/share/classes/module-info.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/src/jdk.security.jgss/share/classes/module-info.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -23,6 +23,10 @@
  * questions.
  */
 
+/**
+ * Defines Java extensions to the GSS-API and an implementation of the SASL
+ * GSSAPI mechanism.
+ */
 module jdk.security.jgss {
     requires public java.security.jgss;
     requires java.logging;
--- a/jdk/test/Makefile	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/Makefile	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 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
@@ -185,6 +185,9 @@
 ( \
   jtregExitCode=$$? && \
   _summary="$(SUMMARY_TXT)"; \
+  if [ $${jtregExitCode} = 1 ] ; then \
+    jtregExitCode=0; \
+  fi; \
   $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
   $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
   if [ -r "$${_summary}" ] ; then \
--- a/jdk/test/ProblemList.txt	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/ProblemList.txt	Wed Jul 05 22:06:46 2017 +0200
@@ -211,6 +211,8 @@
 
 java/rmi/transport/dgcDeadLock/DGCDeadLock.java                 8029360 macosx-all
 
+sun/rmi/runtime/Log/6409194/NoConsoleOutput.java                8164124 windows-all
+
 ############################################################################
 
 # jdk_security
--- a/jdk/test/com/sun/crypto/provider/KeyFactory/TestProviderLeak.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/com/sun/crypto/provider/KeyFactory/TestProviderLeak.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -53,7 +53,20 @@
     // or throws out TimeoutException.
     private static final int RESERVATION = 3;
     // The maximum time, 5 seconds, to wait for each iteration.
-    private static final int TIME_OUT = 5;
+    private static final int TIME_OUT;
+    static {
+        int timeout = 5;
+        try {
+            double timeoutFactor = Double.parseDouble(
+                    System.getProperty("test.timeout.factor", "1.0"));
+            timeout = (int) (timeout * timeoutFactor);
+        } catch (Exception e) {
+            System.out.println("Warning: " + e);
+        }
+        TIME_OUT = timeout;
+        System.out.println("Timeout for each iteration is "
+                + TIME_OUT + " seconds");
+    }
 
     private static Deque<byte []> eatupMemory() throws Exception {
         dumpMemoryStats("Before memory allocation");
--- a/jdk/test/com/sun/jdi/CatchPatternTest.sh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/com/sun/jdi/CatchPatternTest.sh	Wed Jul 05 22:06:46 2017 +0200
@@ -87,7 +87,12 @@
    cmd stop in ${classname}.partTwo
    runToBkpt
    cmd ignore uncaught java.lang.Throwable
-   cmd catch all java.lang.I*
+   # Instead of matching java.lang.I* we use two more specific
+   # patterns here. The reason is to avoid matching IncompatibleClassChangeError
+   # (or the subclass NoSuchMethodError) thrown by the
+   # java.lang.invoke infrastructure.
+   cmd catch all java.lang.Il*
+   cmd catch all java.lang.Ind*
    cmd cont
    cmd cont
    cmd cont
--- a/jdk/test/com/sun/jdi/ClassesByName2Test.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/com/sun/jdi/ClassesByName2Test.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, 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
@@ -28,8 +28,7 @@
  *
  *  @author Tim Bell (based on ClassesByName by Robert Field)
  *
- *  @modules java.corba
- *           jdk.jdi
+ *  @modules jdk.jdi
  *  @run build TestScaffold VMConnection TargetListener TargetAdapter
  *  @run compile -g ClassesByName2Test.java
  *  @run driver ClassesByName2Test
@@ -70,10 +69,14 @@
                 };
 
             Thread two = new Thread ("TWO") {
-                    public void run () {
-                        javax.rmi.CORBA.Util.getCodebase(this.getClass());
+                public void run () {
+                    try {
+                        String s = String.format("%02x", 0xff);
+                    } catch (Exception e) {
+                        e.printStackTrace();
                     }
-                };
+                }
+            };
 
             two.start();
             one.start();
--- a/jdk/test/com/sun/net/ssl/SSLSecurity/ProviderTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/com/sun/net/ssl/SSLSecurity/ProviderTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4667976
+ * @bug 4667976 8130181
  * @modules java.base/com.sun.net.ssl
  * @compile JavaxSSLContextImpl.java ComSSLContextImpl.java
  *      JavaxTrustManagerFactoryImpl.java ComTrustManagerFactoryImpl.java
@@ -85,7 +85,7 @@
 
     public MyProvider()
     {
-        super("BRAD", 1.0, info);
+        super("BRAD", "1.0", info);
 
         AccessController.doPrivileged(new java.security.PrivilegedAction() {
             public Object run() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Container/MoveToOtherScreenTest/MoveToOtherScreenTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,88 @@
+/*
+ * 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 javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+import java.awt.Canvas;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.lang.reflect.InvocationTargetException;
+
+
+
+/* @test
+   @bug 8160696
+   @summary IllegalArgumentException: adding a component to a container on a different GraphicsDevice
+   @author Mikhail Cherkasov
+   @run main MoveToOtherScreenTest
+   @key headful
+*/
+public class MoveToOtherScreenTest {
+
+    private static volatile boolean twoDisplays = true;
+    private static final Canvas canvas = new Canvas();
+    private static final Frame[] frms = new JFrame[2];
+
+    public static void main(String[] args) throws InterruptedException, InvocationTargetException {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                GraphicsEnvironment ge = GraphicsEnvironment.
+                        getLocalGraphicsEnvironment();
+                GraphicsDevice[] gds = ge.getScreenDevices();
+                if (gds.length < 2) {
+                    System.out.println("Test requires at least 2 displays");
+                    twoDisplays = false;
+                    return;
+                }
+                for (int i = 0; i < 2; i++) {
+                    GraphicsConfiguration conf = gds[i].getConfigurations()[0];
+                    JFrame frm = new JFrame("Frame " + i);
+                    frm.setLocation(conf.getBounds().x, 0); // On first screen
+                    frm.setSize(new Dimension(400, 400));
+                    frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                    frm.setVisible(true);
+                    frms[i] = frm;
+                }
+                canvas.setBackground(Color.red);
+                frms[0].add(canvas);
+            }
+        });
+        if(!twoDisplays){
+           return;
+        }
+        Thread.sleep(200);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                frms[1].add(canvas);
+            }
+        });
+        for (Frame frm : frms) {
+            frm.dispose();
+        }
+    }
+}
--- a/jdk/test/java/awt/Modal/ToBack/ToBackModeless5Test.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModeless5Test.java	Wed Jul 05 22:06:46 2017 +0200
@@ -26,7 +26,7 @@
 /*
  * @test
  * @key headful
- * @bug 8054143
+ * @bug 8054143 8163583
  * @summary Check if toBack method works correctly for a modeless dialog
  *          having a visible Frame constructor.
  *
--- a/jdk/test/java/awt/Modal/ToBack/ToBackModeless6Test.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModeless6Test.java	Wed Jul 05 22:06:46 2017 +0200
@@ -26,7 +26,7 @@
 /*
  * @test
  * @key headful
- * @bug 8054143
+ * @bug 8054143 8163583
  * @summary Check if toBack method works correctly for a modeless dialog
  *          having a visible Dialog constructor.
  *
--- a/jdk/test/java/awt/Modal/ToBack/ToBackNonModal5Test.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal5Test.java	Wed Jul 05 22:06:46 2017 +0200
@@ -25,7 +25,7 @@
 /*
  * @test
  * @key headful
- * @bug 8054143
+ * @bug 8054143 8163583
  * @summary Check if toBack method works correctly for a non-modal dialog
  *          having a visible Frame constructor.
  *
--- a/jdk/test/java/awt/Modal/ToBack/ToBackNonModal6Test.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal6Test.java	Wed Jul 05 22:06:46 2017 +0200
@@ -25,7 +25,7 @@
 /*
  * @test
  * @key headful
- * @bug 8054143
+ * @bug 8054143 8163583
  * @summary Check if toBack method works correctly for a non-modal dialog
  *          having a visible Dialog constructor.
  *
--- a/jdk/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -22,17 +22,25 @@
  */
 
 /*
- @test
- @key headful
-  @bug 8007220
-  @summary Reference to the popup leaks after the TrayIcon is removed
-  @author Petr Pchelko
+  @test
+  @key headful
+  @bug 8007220 8039081
+  @summary Reference to the popup leaks after the TrayIcon is removed.
+  @requires os.family != "windows"
   @library ../../../../lib/testlibrary/
   @build ExtendedRobot
   @run main/othervm -Xmx50m PopupMenuLeakTest
  */
 
-import java.awt.*;
+import java.awt.AWTException;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.MenuItem;
+import java.awt.PopupMenu;
+import java.awt.RenderingHints;
+import java.awt.SystemTray;
+import java.awt.TrayIcon;
 import javax.swing.SwingUtilities;
 
 import java.awt.image.BufferedImage;
@@ -45,7 +53,6 @@
     static final AtomicReference<WeakReference<TrayIcon>> iconWeakReference = new AtomicReference<>();
     static final AtomicReference<WeakReference<PopupMenu>> popupWeakReference = new AtomicReference<>();
     static ExtendedRobot robot;
-
     public static void main(String[] args) throws Exception {
         robot = new ExtendedRobot();
         SwingUtilities.invokeAndWait(PopupMenuLeakTest::createSystemTrayIcon);
@@ -55,8 +62,8 @@
         sleep();
         SwingUtilities.invokeAndWait(PopupMenuLeakTest::removeIcon);
         sleep();
+        assertCollected(iconWeakReference.get(), "Failed, reference to tray icon not collected");
         assertCollected(popupWeakReference.get(), "Failed, reference to popup not collected");
-        assertCollected(iconWeakReference.get(), "Failed, reference to tray icon not collected");
     }
 
     private static void addNotifyPopup() {
@@ -78,12 +85,17 @@
     private static void assertCollected(WeakReference<?> reference, String message) {
         java.util.List<byte[]> bytes = new ArrayList<>();
         for (int i = 0; i < 5; i ++) {
+            if (reference.get() == null) {
+                // reference is collected, avoid OOMs.
+                break;
+            }
             try {
                 while (true) {
-                    bytes.add(new byte[1024]);
+                    bytes.add(new byte[4096]);
                 }
             } catch (OutOfMemoryError err) {
-                bytes = new ArrayList<>();
+                bytes.clear();
+                causeGC();
             }
         }
         if (reference.get() != null) {
@@ -91,6 +103,13 @@
         }
     }
 
+    private static void causeGC() {
+        System.gc();
+        System.runFinalization();
+        robot.delay(1000);
+    }
+
+
     private static void createSystemTrayIcon() {
         final TrayIcon trayIcon = new TrayIcon(createTrayIconImage());
         trayIcon.setImageAutoSize(true);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/8159696/UnloadClassBeanInfo.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,78 @@
+/*
+ * 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 java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.MethodDescriptor;
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.Arrays;
+
+/**
+ * @test
+ * @bug 8159696
+ * @library /javax/swing/regtesthelpers
+ * @compile ./stub/Stub.java
+ * @run main/othervm -mx32M UnloadClassBeanInfo
+ */
+public class UnloadClassBeanInfo {
+
+    private static URLClassLoader loader;
+
+    public static void main(final String[] args) throws Exception {
+        Class cl = getStub();
+        System.out.println("cl.getClassLoader() = " + cl.getClassLoader());
+        final BeanInfo beanInfo = Introspector.getBeanInfo(cl, Object.class);
+        MethodDescriptor[] mds = beanInfo.getMethodDescriptors();
+        System.out.println("mds = " + Arrays.toString(mds));
+        loader.close();
+        loader=null;
+        cl=null;
+        Util.generateOOME();
+        mds = beanInfo.getMethodDescriptors();
+        System.out.println("mds = " + Arrays.toString(mds));
+    }
+
+    /**
+     * The Stub class is compiled by jtreg, but we want to move it so it is not
+     * on the application classpath. We want to load it through a separate
+     * classloader.
+     */
+    static Class<?> getStub() throws Exception {
+        final String testclasses = System.getProperty("test.classes");
+        final File subdir = new File(testclasses, "stub");
+        subdir.mkdir();
+
+        final Path src = Paths.get(testclasses, "Stub.class");
+        final Path dest = subdir.toPath().resolve("Stub.class");
+        Files.move(src, dest, StandardCopyOption.REPLACE_EXISTING);
+
+        loader = new URLClassLoader(new URL[]{subdir.toURL()});
+        return Class.forName("Stub", true, loader);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/8159696/stub/Stub.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+public final class Stub {
+
+    public void test() {
+
+    }
+}
--- a/jdk/test/java/lang/StackWalker/VerifyStackTrace.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/lang/StackWalker/VerifyStackTrace.java	Wed Jul 05 22:06:46 2017 +0200
@@ -205,8 +205,12 @@
                     .replaceAll("java.base@(\\d+\\.){0,3}(\\d+)/", "java.base/")
                     .replaceAll("/[0-9]+\\.run", "/xxxxxxxx.run")
                     .replaceAll("/[0-9]+\\.invoke", "/xxxxxxxx.invoke")
+                    // DMHs may or may not be pre-generated, making frames differ
                     .replaceAll("DirectMethodHandle\\$Holder", "LambdaForm\\$DMH")
                     .replaceAll("DMH\\.invoke", "DMH/xxxxxxxx.invoke")
+                    // invoke frames may or may not have basic method type
+                    // information encoded for diagnostic purposes
+                    .replaceAll("xx\\.invoke([A-Za-z]*)_[A-Z]+_[A-Z]", "xx.invoke$1")
                     .replaceAll("\\$[0-9]+", "\\$??");
         } else {
             return produced;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/CountedLoopIterationCountsTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,90 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 8164102
+ * @run main/othervm -ea -esa test.java.lang.invoke.CountedLoopIterationCountsTest
+ */
+
+package test.java.lang.invoke;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+
+public class CountedLoopIterationCountsTest {
+
+    public static void main(String[] args) throws Throwable {
+        run(1, -10, 0);
+        run(1, 0, 0);
+        run(Integer.MAX_VALUE - 1, Integer.MIN_VALUE + 10, 0);
+        run(Integer.MIN_VALUE, Integer.MIN_VALUE + 4, 4);
+        run(Integer.MAX_VALUE - 2, Integer.MAX_VALUE - 1, 1);
+        run(Integer.MAX_VALUE - 1, 0, 0);
+        run(Integer.MAX_VALUE - 1, 10, 0);
+        run(Integer.MAX_VALUE - 1, -10, 0);
+        run(Integer.MAX_VALUE, Integer.MIN_VALUE + 10, 0);
+        run(Integer.MAX_VALUE - 1, Integer.MAX_VALUE, 1);
+        run(Integer.MAX_VALUE, Integer.MAX_VALUE, 0);
+
+        if (failed) {
+            throw new AssertionError("one or more tests failed");
+        }
+    }
+
+    static boolean failed = false;
+
+    private static void run(int start, int end, int expectedIterations) throws Throwable {
+        System.out.println("run from " + start + " to " + end);
+        MethodHandle loop = MethodHandles.countedLoop(
+                MethodHandles.constant(int.class, start), // iterate from given start (inclusive) ...
+                MethodHandles.constant(int.class, end),   // ... to given end (exclusive)
+                MH_m1,                                    // initialise loop variable to -1
+                MH_step);                                 // increment loop counter by one in each iteration
+        // The loop variable's value, and hence the loop result, will be "number of iterations" minus one.
+        int r = (int) loop.invoke();
+        if (r + 1 != expectedIterations) {
+            System.out.println("expected " + expectedIterations + " iterations, but got " + r);
+            failed = true;
+        }
+    }
+
+    static int step(int counter, int stepCount) {
+        return stepCount + 1;
+    }
+
+    static final MethodHandle MH_m1;
+    static final MethodHandle MH_step;
+    static {
+        try {
+            MH_m1 = MethodHandles.constant(int.class, -1);
+            MH_step = MethodHandles.lookup().findStatic(CountedLoopIterationCountsTest.class, "step",
+                    MethodType.methodType(int.class, int.class, int.class));
+        } catch (Throwable t) {
+            throw new ExceptionInInitializerError(t);
+        }
+    }
+
+}
--- a/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,7 +23,6 @@
 
 /*
  * @test LFSingleThreadCachingTest
- * @ignore 8129523
  * @bug 8046703
  * @key randomness
  * @summary Test verifies that lambda forms are cached when run with single thread
@@ -33,7 +32,7 @@
  * @build LambdaFormTestCase
  * @build LFCachingTestCase
  * @build LFSingleThreadCachingTest
- * @run main/othervm LFSingleThreadCachingTest
+ * @run main/othervm -XX:ReservedCodeCacheSize=128m LFSingleThreadCachingTest
  */
 
 import java.lang.invoke.MethodHandle;
--- a/jdk/test/java/lang/reflect/ClassLoaderValue/Driver.java	Thu Aug 18 21:34:24 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * 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 8152115
- * @summary functional and concurrency test for ClassLoaderValue
- * @build java.base/java.lang.reflect.ClassLoaderValueTest
- * @run main Driver
- */
-public class Driver {
-    public static void main(String[] args) throws Exception {
-        java.lang.reflect.ClassLoaderValueTest.main(args);
-    }
-}
--- a/jdk/test/java/lang/reflect/ClassLoaderValue/java.base/java/lang/reflect/ClassLoaderValueTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,249 +0,0 @@
-/*
- * 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.
- */
-
-package java.lang.reflect;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * Functional and concurrency test for ClassLoaderValue
- *
- * @author Peter Levart
- */
-public class ClassLoaderValueTest {
-
-    @SuppressWarnings("unchecked")
-    public static void main(String[] args) throws Exception {
-
-        ClassLoaderValue[] clvs = {new ClassLoaderValue<>(),
-                                   new ClassLoaderValue<>()};
-
-        ClassLoader[] lds = {ClassLoader.getSystemClassLoader(),
-                             ClassLoader.getPlatformClassLoader(),
-                             null /* bootstrap class loader */};
-
-        Integer[] keys = new Integer[32];
-        for (int i = 0; i < keys.length; i++) {
-            keys[i] = i + 128;
-        }
-
-        try (AutoCloseable cleanup = () -> {
-            for (ClassLoaderValue<Integer> clv : clvs) {
-                for (ClassLoader ld : lds) {
-                    clv.removeAll(ld);
-                }
-            }
-        }) {
-            // 1st just one sequential pass of single-threaded validation
-            // which is easier to debug if it fails...
-            for (ClassLoaderValue<Integer> clv : clvs) {
-                for (ClassLoader ld : lds) {
-                    writeValidateOps(clv, ld, keys);
-                }
-            }
-            for (ClassLoaderValue<Integer> clv : clvs) {
-                for (ClassLoader ld : lds) {
-                    readValidateOps(clv, ld, keys);
-                }
-            }
-
-            // 2nd the same in concurrent setting that also validates
-            // failure-isolation between threads and data-isolation between
-            // regions - (ClassLoader, ClassLoaderValue) pairs - of the storage
-            testConcurrentIsolation(clvs, lds, keys, TimeUnit.SECONDS.toMillis(3));
-        }
-    }
-
-    static void writeValidateOps(ClassLoaderValue<Integer> clv,
-                                 ClassLoader ld,
-                                 Object[] keys) {
-        for (int i = 0; i < keys.length; i++) {
-            Object k = keys[i];
-            Integer v1 = i;
-            Integer v2 = i + 333;
-            Integer pv;
-            boolean success;
-
-            pv = clv.sub(k).putIfAbsent(ld, v1);
-            assertEquals(pv, null);
-            assertEquals(clv.sub(k).get(ld), v1);
-
-            pv = clv.sub(k).putIfAbsent(ld, v2);
-            assertEquals(pv, v1);
-            assertEquals(clv.sub(k).get(ld), v1);
-
-            success = clv.sub(k).remove(ld, v2);
-            assertEquals(success, false);
-            assertEquals(clv.sub(k).get(ld), v1);
-
-            success = clv.sub(k).remove(ld, v1);
-            assertEquals(success, true);
-            assertEquals(clv.sub(k).get(ld), null);
-
-            pv = clv.sub(k).putIfAbsent(ld, v2);
-            assertEquals(pv, null);
-            assertEquals(clv.sub(k).get(ld), v2);
-
-            pv = clv.sub(k).computeIfAbsent(ld, (_ld, _clv) -> v1);
-            assertEquals(pv, v2);
-            assertEquals(clv.sub(k).get(ld), v2);
-
-            success = clv.sub(k).remove(ld, v1);
-            assertEquals(success, false);
-            assertEquals(clv.sub(k).get(ld), v2);
-
-            success = clv.sub(k).remove(ld, v2);
-            assertEquals(success, true);
-            assertEquals(clv.sub(k).get(ld), null);
-
-            pv = clv.sub(k).computeIfAbsent(ld, (_ld, clv_k) -> {
-                try {
-                    // nested get for same key should throw
-                    clv_k.get(_ld);
-                    throw new AssertionError("Unexpected code path");
-                } catch (IllegalStateException e) {
-                    // expected
-                }
-                try {
-                    // nested putIfAbsent for same key should throw
-                    clv_k.putIfAbsent(_ld, v1);
-                    throw new AssertionError("Unexpected code path");
-                } catch (IllegalStateException e) {
-                    // expected
-                }
-                // nested remove for for same key and any value (even null)
-                // should return false
-                assertEquals(clv_k.remove(_ld, null), false);
-                assertEquals(clv_k.remove(_ld, v1), false);
-                assertEquals(clv_k.remove(_ld, v2), false);
-                try {
-                    // nested computeIfAbsent for same key should throw
-                    clv_k.computeIfAbsent(_ld, (__ld, _clv_k) -> v1);
-                    throw new AssertionError("Unexpected code path");
-                } catch (IllegalStateException e) {
-                    // expected
-                }
-                // if everything above has been handled, we should succeed...
-                return v2;
-            });
-            // ... and the result should be reflected in the CLV
-            assertEquals(pv, v2);
-            assertEquals(clv.sub(k).get(ld), v2);
-
-            success = clv.sub(k).remove(ld, v2);
-            assertEquals(success, true);
-            assertEquals(clv.sub(k).get(ld), null);
-
-            try {
-                clv.sub(k).computeIfAbsent(ld, (_ld, clv_k) -> {
-                    throw new UnsupportedOperationException();
-                });
-                throw new AssertionError("Unexpected code path");
-            } catch (UnsupportedOperationException e) {
-                // expected
-            }
-            assertEquals(clv.sub(k).get(ld), null);
-        }
-    }
-
-    static void readValidateOps(ClassLoaderValue<Integer> clv,
-                                ClassLoader ld,
-                                Object[] keys) {
-        for (int i = 0; i < keys.length; i++) {
-            Object k = keys[i];
-            Integer v1 = i;
-            Integer v2 = i + 333;
-            Integer rv = clv.sub(k).get(ld);
-            if (!(rv == null || rv.equals(v1) || rv.equals(v2))) {
-                throw new AssertionError("Unexpected value: " + rv +
-                                         ", expected one of: null, " + v1 + ", " + v2);
-            }
-        }
-    }
-
-    static void testConcurrentIsolation(ClassLoaderValue<Integer>[] clvs,
-                                        ClassLoader[] lds,
-                                        Object[] keys,
-                                        long millisRuntime) {
-        ExecutorService exe = Executors.newCachedThreadPool();
-        List<Future<?>> futures = new ArrayList<>();
-        AtomicBoolean stop = new AtomicBoolean();
-        for (ClassLoaderValue<Integer> clv : clvs) {
-            for (ClassLoader ld : lds) {
-                // submit a task that exercises a mix of modifying
-                // and reading-validating operations in an isolated
-                // part of the storage. If isolation is violated,
-                // validation operations are expected to fail.
-                futures.add(exe.submit(() -> {
-                    do {
-                        writeValidateOps(clv, ld, keys);
-                    } while (!stop.get());
-                }));
-                // submit a task that just reads from the same part of
-                // the storage as above task. It should not disturb
-                // above task in any way and this task should never
-                // exhibit any failure although above task produces
-                // regular failures during lazy computation
-                futures.add(exe.submit(() -> {
-                    do {
-                        readValidateOps(clv, ld, keys);
-                    } while (!stop.get());
-                }));
-            }
-        }
-        // wait for some time
-        try {
-            Thread.sleep(millisRuntime);
-        } catch (InterruptedException e) {
-            throw new AssertionError(e);
-        }
-        // stop tasks
-        stop.set(true);
-        // collect results
-        AssertionError error = null;
-        for (Future<?> future : futures) {
-            try {
-                future.get();
-            } catch (InterruptedException | ExecutionException e) {
-                if (error == null) error = new AssertionError("Failure");
-                error.addSuppressed(e);
-            }
-        }
-        exe.shutdown();
-        if (error != null) throw error;
-    }
-
-    static void assertEquals(Object actual, Object expected) {
-        if (!Objects.equals(actual, expected)) {
-            throw new AssertionError("Expected: " + expected + ", actual: " + actual);
-        }
-    }
-}
--- a/jdk/test/java/nio/file/Files/probeContentType/Basic.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/nio/file/Files/probeContentType/Basic.java	Wed Jul 05 22:06:46 2017 +0200
@@ -184,7 +184,7 @@
             "webm"
         };
         String[][] expectedTypes = new String[][] {
-            {"audio/aac", "audio/x-aac"},
+            {"audio/aac", "audio/x-aac", "audio/vnd.dlna.adts"},
             {"audio/flac", "audio/x-flac"},
             {"image/jpeg"},
             {"audio/mpeg"},
--- a/jdk/test/java/security/KeyFactory/Failover.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/KeyFactory/Failover.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 4894125 7054918
+ * @bug 4894125 7054918 8130181
  * @library ../testlibrary
  * @summary test that failover for KeyFactory works
  * @author Andreas Sterbenz
@@ -96,14 +96,14 @@
 
     private static class ProviderPass extends Provider {
         ProviderPass() {
-            super("Pass", 1.0d, "Pass");
+            super("Pass", "1.0", "Pass");
             put("KeyFactory.FOO" , "Failover$KeyFactoryPass");
         }
     }
 
     private static class ProviderFail extends Provider {
         ProviderFail() {
-            super("Fail", 1.0d, "Fail");
+            super("Fail", "1.0", "Fail");
             put("KeyFactory.FOO" , "Failover$KeyFactoryFail");
             put("KeyFactory.DSA" , "Failover$KeyFactoryFail");
         }
--- a/jdk/test/java/security/KeyPairGenerator/Failover.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/KeyPairGenerator/Failover.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 4894125 7054918
+ * @bug 4894125 7054918 8130181
  * @library ../testlibrary
  * @summary test that failover for KeyPairGenerator works
  * @author Andreas Sterbenz
@@ -110,14 +110,14 @@
 
     private static class ProviderPass extends Provider {
         ProviderPass() {
-            super("Pass", 1.0d, "Pass");
+            super("Pass", "1.0", "Pass");
             put("KeyPairGenerator.FOO" , "Failover$KeyPairGeneratorPass");
         }
     }
 
     private static class ProviderFail extends Provider {
         ProviderFail() {
-            super("Fail", 1.0d, "Fail");
+            super("Fail", "1.0", "Fail");
             put("KeyPairGenerator.FOO" , "Failover$KeyPairGeneratorFail");
             put("KeyPairGenerator.DSA" , "Failover$KeyPairGeneratorFail");
             put("KeyPairGenerator.RSA" , "Failover$KeyPairGeneratorFail");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/KeyPairGenerator/FinalizeHalf.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,90 @@
+/*
+ * 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 8163896
+ * @summary Finalizing one key of a KeyPair invalidates the other key
+ */
+
+import java.security.Key;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.NoSuchAlgorithmException;
+import java.security.Provider;
+import java.security.ProviderException;
+import java.security.Security;
+import java.util.function.Consumer;
+import java.util.ArrayList;
+import java.util.List;
+
+public class FinalizeHalf {
+
+    static int failures = 0;
+
+    public static void main(String[] args) throws Throwable {
+        List<Consumer<Key>> methods = new ArrayList<>();
+        methods.add((Key k) -> k.getEncoded());
+        methods.add((Key k) -> k.toString());
+
+        for (String algo : new String[] {"DiffieHellman", "DSA", "RSA"}) {
+            for (Provider provider : Security.getProviders()) {
+                for (boolean priv : new boolean[] {true, false}) {
+                    for (Consumer<Key> method : methods) {
+                        test(algo, provider, priv, method);
+                    }
+                }
+            }
+        }
+
+        if (failures > 0) {
+            throw new RuntimeException(failures + " test(s) failed.");
+        }
+    }
+
+    static void test(String algo, Provider provider, boolean priv,
+            Consumer<Key> method) throws Exception {
+        KeyPairGenerator generator;
+        try {
+            generator = KeyPairGenerator.getInstance(algo, provider);
+        } catch (NoSuchAlgorithmException nsae) {
+            return;
+        }
+
+        System.out.println("Checking " + provider.getName() + ", " + algo);
+
+        KeyPair pair = generator.generateKeyPair();
+        Key key = priv ? pair.getPrivate() : pair.getPublic();
+
+        pair = null;
+        for (int i = 0; i < 32; ++i) {
+            System.gc();
+        }
+
+        try {
+            method.accept(key);
+        } catch (ProviderException pe) {
+            failures++;
+        }
+    }
+}
--- a/jdk/test/java/security/KeyStore/EntryMethods.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/KeyStore/EntryMethods.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test 1.5, 03/06/24
- * @bug 4850376 8130850
+ * @bug 4850376 8130850 8130181
  * @summary Provide generic storage KeyStore storage facilities
  */
 
@@ -65,7 +65,7 @@
     public static class FooEntry implements KeyStore.Entry { }
 
     public EntryMethods() throws Exception {
-        super("EntryMethods", 0.0, "EntryMethods");
+        super("EntryMethods", "0.0", "EntryMethods");
 
         pre15fis = new FileInputStream
             (System.getProperty("test.src") + "/EntryMethods.pre15.keystore");
--- a/jdk/test/java/security/KeyStore/KeyStoreBuilder.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/KeyStore/KeyStoreBuilder.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 4938922 4961104 5071293 6236533
+ * @bug 4938922 4961104 5071293 6236533 8130181
  * @summary verify that the KeyStore.Builder API works
  * @author Andreas Sterbenz
  */
@@ -219,7 +219,7 @@
 
     private static class MyProvider extends Provider {
         MyProvider() {
-            super("My", 1.0d, null);
+            super("My", "1.0", null);
             put("KeyStore.My", "KeyStoreBuilder$MyKeyStoreSpi");
         }
     }
--- a/jdk/test/java/security/Policy/GetInstance/GetInstanceProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/Policy/GetInstance/GetInstanceProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -27,7 +27,7 @@
 
     public GetInstanceProvider() {
         super("GetInstanceProvider",
-                1,
+                "1",
                 "GetInstanceProvider: Policy.GetInstancePolicySpi");
 
         AccessController.doPrivileged(new PrivilegedAction() {
--- a/jdk/test/java/security/Provider/CaseSensitiveServices.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/Provider/CaseSensitiveServices.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 5097015
+ * @bug 5097015 8130181
  * @summary make sure we correctly treat Provider string entries as case insensitive
  * @author Andreas Sterbenz
  */
@@ -33,7 +33,7 @@
 
 public class CaseSensitiveServices extends Provider {
     CaseSensitiveServices() {
-        super("Foo", 1.0d, null);
+        super("Foo", "1.0", null);
         put("MessageDigest.Foo", "com.Foo");
         put("mESSAGEdIGEST.fOO xYz", "aBc");
         put("ALg.aliaS.MESSAGEdigest.Fu", "FoO");
--- a/jdk/test/java/security/Provider/ChangeProviders.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/Provider/ChangeProviders.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4856968 7054918
+ * @bug 4856968 7054918 8130181
  * @library ../testlibrary
  * @summary make sure add/insert/removeProvider() work correctly
  * @author Andreas Sterbenz
@@ -36,7 +36,7 @@
 public class ChangeProviders extends Provider {
 
     private ChangeProviders() {
-        super("Foo", 47.23d, "none");
+        super("Foo", "47.23", "none");
     }
 
     private static int plen() {
--- a/jdk/test/java/security/Provider/Equals.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/Provider/Equals.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 4918769
+ * @bug 4918769 8130181
  * @summary make sure Provider.equals() behaves as expected with the id attributes
  * @author Andreas Sterbenz
  */
@@ -33,9 +33,9 @@
 public class Equals {
 
     public static void main(String[] args) throws Exception {
-        Provider p1 = new P1("foo", 1.0d, "foo");
-        Provider p1b = new P1("foo", 1.0d, "foo");
-        Provider p2 = new P2("foo", 1.0d, "foo");
+        Provider p1 = new P1("foo", "1.0", "foo");
+        Provider p1b = new P1("foo", "1.0", "foo");
+        Provider p2 = new P2("foo", "1.0", "foo");
         System.out.println(p1.entrySet());
         if (p1.equals(p2)) {
             throw new Exception("Objects are equal");
@@ -55,13 +55,13 @@
     }
 
     private static class P1 extends Provider {
-        P1(String name, double version, String info) {
+        P1(String name, String version, String info) {
             super(name, version, info);
         }
     }
 
     private static class P2 extends Provider {
-        P2(String name, double version, String info) {
+        P2(String name, String version, String info) {
             super(name, version, info);
         }
     }
--- a/jdk/test/java/security/Provider/GetInstance.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/Provider/GetInstance.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4856968 7054918
+ * @bug 4856968 7054918 8130181
  * @library ../testlibrary
  * @summary make sure getInstance() works correctly, including failover
  *   and delayed provider selection for Signatures
@@ -137,7 +137,7 @@
 
     public static class FooProvider extends Provider {
         FooProvider() {
-            super("foo", 1.0d, "none");
+            super("foo", "1.0", "none");
             put("MessageDigest.foo", "GetInstance$FooDigest");
             put("CertStore.foo",     "GetInstance$FooStore");
             put("Signature.foo",     "GetInstance$FooSignatureSpi");
@@ -151,7 +151,7 @@
 
     public static class BarProvider extends Provider {
         BarProvider() {
-            super("bar", 1.0d, "none");
+            super("bar", "1.0", "none");
             // all entries invalid for failover
             put("MessageDigest.bar", "GetInstance$FooKey");
             put("Signature.bar",     "GetInstance$FooKey");
@@ -164,7 +164,7 @@
 
     public static class BazProvider extends Provider {
         BazProvider() {
-            super("baz", 1.0d, "none");
+            super("baz", "1.0", "none");
             put("MessageDigest.bar", "GetInstance$FooDigest");
             put("CertStore.bar",     "GetInstance$FooStore");
             put("Signature.bar",     "GetInstance$FooSignatureSpi");
--- a/jdk/test/java/security/Provider/ProviderInfoCheck.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/Provider/ProviderInfoCheck.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6455351
+ * @bug 6455351 8130181
  * @summary Make sure the Provider.info entries have the correct values
  * after going through serialization/deserialization.
  * @author Valerie Peng
@@ -68,18 +68,17 @@
         if (!p.getClass().getName().equalsIgnoreCase(value)) {
             throw new Exception("Test Failed: incorrect className!");
         }
-        double dvalue =
-            Double.parseDouble((String) p.get("Provider.id version"));
-        if ((SampleProvider.VERSION != dvalue) ||
-            p.getVersion() != dvalue) {
-            throw new Exception("Test Failed: incorrect version!");
+        value = (String) p.get("Provider.id version");
+        if (!SampleProvider.VERSION.equalsIgnoreCase(value) ||
+            p.getVersionStr() != value) {
+            throw new Exception("Test Failed: incorrect versionStr!");
         }
         System.out.println("Test Passed");
     }
 
     private static class SampleProvider extends Provider {
         static String NAME = "Sample";
-        static double VERSION = 1.1d;
+        static String VERSION = "1.1";
         static String INFO = "Good for nothing";
         SampleProvider() {
             super(NAME, VERSION, INFO);
--- a/jdk/test/java/security/Provider/RemoveProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/Provider/RemoveProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4190873 7054918
+ * @bug 4190873 7054918 8130181
  * @library ../testlibrary
  * @summary Make sure provider instance can be removed from list of registered
  * providers, and "entrySet", "keySet", and "values" methods don't loop
@@ -46,11 +46,11 @@
     public static void main0(String[] args) throws Exception {
 
         // Add provider 1
-        Provider p1 = new MyProvider("name1",1,"");
+        Provider p1 = new MyProvider("name1","1","");
         Security.addProvider(p1);
 
         // Add provider 2
-        Provider p2 = new MyProvider("name2",1,"");
+        Provider p2 = new MyProvider("name2","1","");
         Security.addProvider(p2);
 
         // List all providers
@@ -183,7 +183,7 @@
 }
 
 class MyProvider extends Provider {
-    public MyProvider(String name, double version, String info) {
+    public MyProvider(String name, String version, String info) {
         super(name, version, info);
         put("Signature", name+".signature");
         put("Digest", name+".digest");
--- a/jdk/test/java/security/Provider/SupportsParameter.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/Provider/SupportsParameter.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 4911081
+ * @bug 4911081 8130181
  * @summary verify that Provider.Service.supportsParameter() works
  * @author Andreas Sterbenz
  */
@@ -104,7 +104,7 @@
 
     private static class MyProvider extends Provider {
         MyProvider() {
-            super("MyProvider", 1.0d, "MyProvider");
+            super("MyProvider", "1.0", "MyProvider");
 
             put("Signature.DSA0", "foo.DSA0");
 
--- a/jdk/test/java/security/Provider/TestSecurityProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/Provider/TestSecurityProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -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,7 +30,7 @@
 public final class TestSecurityProvider extends Provider {
 
     public TestSecurityProvider() {
-        super("TEST", 1.0d, "Test Security provider");
+        super("TEST", "1.0", "Test Security provider");
         System.out.println(String.format("TEST Security provider loaded"
                 + " successfully : %s", this.toString()));
     }
@@ -38,7 +38,7 @@
     @Override
     public String toString() {
         return "TestSecurityProvider [getName()=" + getName()
-                + ", getVersion()=" + getVersion() + ", getInfo()="
+                + ", getVersion()=" + getVersionStr() + ", getInfo()="
                 + getInfo() + ", toString()=" + super.toString() + "]";
     }
 
--- a/jdk/test/java/security/Provider/Turkish.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/Provider/Turkish.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 6220064 7054918
+ * @bug 6220064 7054918 8130181
  * @summary make sure everything works ok in the Turkish local (dotted/dotless i problem)
  * @author Andreas Sterbenz
  */
@@ -107,7 +107,7 @@
 
     private static class TProvider extends Provider {
         TProvider(String name) {
-            super(name, 1.0d, null);
+            super(name, "1.0", null);
             put("Signature.MD5withRSA", "com.foo.Sig");
             put("Alg.Alias.Signature.MD5RSA", "MD5withRSA");
             put("sIGNATURE.shaWITHrsa", "com.foo.Sig");
--- a/jdk/test/java/security/SecureClassLoader/DefineClass.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/SecureClassLoader/DefineClass.java	Wed Jul 05 22:06:46 2017 +0200
@@ -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
@@ -54,7 +54,7 @@
 
 /*
  * @test
- * @bug 6826789 8131486
+ * @bug 6826789 8131486 8130181
  * @summary Make sure equivalent ProtectionDomains are granted the same
  *          permissions when the CodeSource URLs are different but resolve
  *          to the same ip address after name service resolution.
@@ -194,7 +194,7 @@
 
     private static class TestProvider extends Provider {
         TestProvider() {
-            super("Test8131486", 0.0, "For testing only");
+            super("Test8131486", "0.0", "For testing only");
             putService(new Provider.Service(this, "KeyStore", "Test8131486",
                        "DefineClass$TestKeyStore", null, null));
         }
--- a/jdk/test/java/security/Security/AddProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/Security/AddProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8001319
+ * @bug 8001319 8130181
  * @summary check that SecurityPermission insertProvider permission is enforced
  *          correctly
  * @run main/othervm/policy=AddProvider.policy.1 AddProvider 1
@@ -53,7 +53,7 @@
 
     private static class TestProvider extends Provider {
         TestProvider(String name) {
-            super(name, 0.0, "Not for use in production systems!");
+            super(name, "0.0", "Not for use in production systems!");
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/Security/ClassLoader/DeprivilegedModuleLoaderTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,90 @@
+/*
+ * 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 java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import javax.security.auth.kerberos.KeyTab;
+import javax.xml.crypto.KeySelectorException;
+import javax.xml.crypto.dsig.XMLSignatureFactory;
+import com.sun.security.auth.callback.TextCallbackHandler;
+import com.sun.security.jgss.AuthorizationDataEntry;
+
+/*
+ * @test
+ * @bug 8159964
+ * @summary Classes from deprivileged modules should get loaded through
+ *          Platform Classloader.
+ * @run main DeprivilegedModuleLoaderTest
+ */
+public class DeprivilegedModuleLoaderTest {
+
+    public static void main(String[] args) {
+
+        boolean pass = true;
+        List<Class<?>> classes = getDeprivilegedClasses();
+        for (Class<?> cls : classes) {
+            try {
+                pass &= testPlatformClassLoader(cls);
+            } catch (Exception exc) {
+                exc.printStackTrace(System.out);
+                pass = false;
+            }
+        }
+
+        if (!pass) {
+            throw new RuntimeException("Atleast one test failed.");
+        }
+    }
+
+    private static List<Class<?>> getDeprivilegedClasses() {
+
+        List<Class<?>> classes = new ArrayList<Class<?>>();
+        // Test from java.xml.crypto/javax/xml/crypto/dsig package
+        classes.add(XMLSignatureFactory.class);
+        // Test from java.xml.crypto/javax/xml/crypto package
+        classes.add(KeySelectorException.class);
+        // Test From java.security.jgss/javax/security/auth/kerberos package
+        classes.add(KeyTab.class);
+        // Test from jdk.security.jgss/com/sun/security/jgss package
+        classes.add(AuthorizationDataEntry.class);
+        // Test from jdk.security.auth/com/sun/security/auth/callback package
+        classes.add(TextCallbackHandler.class);
+        return classes;
+    }
+
+    private static boolean testPlatformClassLoader(Class<?> cls) {
+
+        ClassLoader loader = cls.getClassLoader();
+        if (loader == null) {
+            throw new RuntimeException(String.format(
+                    "Loaded through Bootstrap Classloader: '%s'", cls));
+        } else if (!loader.toString().contains("PlatformClassLoader")) {
+            throw new RuntimeException(String.format(
+                    "Not loaded through Platform ClassLoader: '%s'", cls));
+        }
+        System.out.println(String.format(
+                "Pass: '%s' get loaded through PlatformClassLoader", cls));
+        return true;
+    }
+}
--- a/jdk/test/java/security/Security/ClassLoaderDeadlock/provider/HashProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/Security/ClassLoaderDeadlock/provider/HashProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -27,7 +27,7 @@
 
 public final class HashProvider extends Provider {
     public HashProvider() {
-        super("HashProvider", 1.0d, "");
+        super("HashProvider", "1.0", "");
         // register all algorithms from the following providers into this provider
         // the security framework will try to load them via the classloader of this provider
         addAlgorithms("SunRsaSign");
--- a/jdk/test/java/security/Security/SynchronizedAccess.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/Security/SynchronizedAccess.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4162583 7054918
+ * @bug 4162583 7054918 8130181
  * @library ../testlibrary
  * @summary Make sure Provider api implementations are synchronized properly
  */
@@ -61,7 +61,7 @@
     public void run() {
         Provider[] provs = new Provider[10];
         for (int i=0; i < provs.length; i++)
-            provs[i] = new MyProvider("name"+i, 1, "test");
+            provs[i] = new MyProvider("name"+i, "1", "test");
 
         int rounds = 20;
         while (rounds-- > 0) {
@@ -86,7 +86,7 @@
 }
 
 class MyProvider extends Provider {
-    public MyProvider(String name, double version, String info) {
+    public MyProvider(String name, String version, String info) {
         super(name, version, info);
         put("Signature.sigalg", "sigimpl");
     }
--- a/jdk/test/java/security/Security/removing/RemoveProviderByIdentity.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/Security/removing/RemoveProviderByIdentity.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4208414
+ * @bug 4208414 8130181
  * @summary Providers should be removed "by-identity" - not "by-value"
  */
 
@@ -34,7 +34,7 @@
     public static void main(String[] args) throws Exception {
         String PROVIDER_NAME = "myprovider";
 
-        Security.addProvider(new MyProvider(PROVIDER_NAME, 1, "test"));
+        Security.addProvider(new MyProvider(PROVIDER_NAME, "1", "test"));
         if (Security.getProvider(PROVIDER_NAME) == null)
             throw new Exception("provider not registered");
 
@@ -45,7 +45,7 @@
 }
 
 class MyProvider extends Provider {
-    public MyProvider(String name, double version, String info) {
+    public MyProvider(String name, String version, String info) {
         super(name, version, info);
         put("Signature.sigalg", "sigimpl");
     }
--- a/jdk/test/java/security/Signature/SignatureGetAlgorithm.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/Signature/SignatureGetAlgorithm.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -27,7 +27,7 @@
 
 /*
  * @test
- * @bug 8014620
+ * @bug 8014620 8130181
  * @summary Signature.getAlgorithm return null in special case
  * @run main/othervm SignatureGetAlgorithm
  * @author youdwei
@@ -49,7 +49,7 @@
 
     public static class TestProvider extends Provider {
         TestProvider() {
-            super("testSignatureGetAlgorithm", 1.0, "test Signatures");
+            super("testSignatureGetAlgorithm", "1.0", "test Signatures");
             put("Signature.MySignatureAlg",
                 "SignatureGetAlgorithm$MySignatureAlg");
         }
--- a/jdk/test/java/security/cert/CertPathBuilder/StubProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/cert/CertPathBuilder/StubProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 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
@@ -23,14 +23,14 @@
 
 /*
  *
- * @bug 4408997
+ * @bug 4408997 8130181
  * Used by GetInstance test.
  */
 import java.security.Provider;
 
 public class StubProvider extends Provider {
     public StubProvider() {
-        super( "StubProvider", 1.1, "No Info");
+        super( "StubProvider", "1.1", "No Info");
         put("CertPathBuilder.PKIX", "StubProviderImpl");
     }
 }
--- a/jdk/test/java/security/testlibrary/SimpleOCSPServer.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/security/testlibrary/SimpleOCSPServer.java	Wed Jul 05 22:06:46 2017 +0200
@@ -64,6 +64,8 @@
     private static final SimpleDateFormat utcDateFmt =
             new SimpleDateFormat("MMM dd yyyy, HH:mm:ss z");
 
+    static final int FREE_PORT = 0;
+
     // CertStatus values
     public static enum CertStatus {
         CERT_STATUS_GOOD,
@@ -88,7 +90,8 @@
     private volatile boolean started = false;
     private volatile boolean serverReady = false;
     private volatile boolean receivedShutdown = false;
-    private long delayMsec = 0;
+    private volatile boolean acceptConnections = true;
+    private volatile long delayMsec = 0;
 
     // Fields used in the generation of responses
     private long nextUpdateInterval = -1;
@@ -116,7 +119,7 @@
      */
     public SimpleOCSPServer(KeyStore ks, String password, String issuerAlias,
             String signerAlias) throws GeneralSecurityException, IOException {
-        this(null, 0, ks, password, issuerAlias, signerAlias);
+        this(null, FREE_PORT, ks, password, issuerAlias, signerAlias);
     }
 
     /**
@@ -230,6 +233,15 @@
                     while (!receivedShutdown) {
                         try {
                             Socket newConnection = servSocket.accept();
+                            if (!acceptConnections) {
+                                try {
+                                    log("Reject connection");
+                                    newConnection.close();
+                                } catch (IOException e) {
+                                    // ignore
+                                }
+                                continue;
+                            }
                             threadPool.submit(new OcspHandler(newConnection));
                         } catch (SocketTimeoutException timeout) {
                             // Nothing to do here.  If receivedShutdown
@@ -257,6 +269,23 @@
     }
 
     /**
+     * Make the OCSP server reject incoming connections.
+     */
+    public synchronized void rejectConnections() {
+        log("Reject OCSP connections");
+        acceptConnections = false;
+    }
+
+    /**
+     * Make the OCSP server accept incoming connections.
+     */
+    public synchronized void acceptConnections() {
+        log("Accept OCSP connections");
+        acceptConnections = true;
+    }
+
+
+    /**
      * Stop the OCSP server.
      */
     public synchronized void stop() {
@@ -499,13 +528,11 @@
      * on the incoming request.
      */
     public void setDelay(long delayMillis) {
-        if (!started) {
-            delayMsec = delayMillis > 0 ? delayMillis : 0;
-            if (delayMsec > 0) {
-                log("OCSP latency set to " + delayMsec + " milliseconds.");
-            } else {
-                log("OCSP latency disabled");
-            }
+        delayMsec = delayMillis > 0 ? delayMillis : 0;
+        if (delayMsec > 0) {
+            log("OCSP latency set to " + delayMsec + " milliseconds.");
+        } else {
+            log("OCSP latency disabled");
         }
     }
 
--- a/jdk/test/java/text/Format/DateFormat/Bug4322313.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/text/Format/DateFormat/Bug4322313.java	Wed Jul 05 22:06:46 2017 +0200
@@ -158,7 +158,8 @@
 
         try {
             for (int i=0; i < locs.length; i++) {
-                Locale.setDefault(locs[i]);
+                Locale locale = locs[i];
+                Locale.setDefault(locale);
 
                 for (int j=0; j < formats.length; j++) {
                     TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
@@ -174,7 +175,7 @@
                         catch (Exception e) {
                             err = true;
                             System.err.println("\tParse  Error [Locale=" +
-                                Locale.getDefault() + ", " + formats[j] +
+                                locale + ", " + formats[j] +
                                 "/\"" + valids[k][0] +
                                 "\"] Unexpected Exception occurred: " + e);
                             continue;
@@ -184,7 +185,7 @@
                         if (offset != ((Integer)valids[k][4]).intValue()) {
                             err = true;
                             System.err.println("\tParse  Error [Locale=" +
-                                Locale.getDefault() + ", " + formats[j] +
+                                locale + ", " + formats[j] +
                                 "/\"" + valids[k][0] +
                                 "\"] invalid index: expected:" + valids[k][4] +
                                 ", got:" + offset);
@@ -193,14 +194,14 @@
                         if (date.getTime() != ((Long)valids[k][1]).longValue()) {
                             err = true;
                             System.err.println("\tParse  Error [Locale=" +
-                                Locale.getDefault() + ", " + formats[j] +
+                                locale + ", " + formats[j] +
                                 "/\"" + valids[k][0] +
                                 "\"] expected:" + valids[k][1] +
                                 ", got:" + date.getTime() + ", " + date);
                         } else {
 /*
                             logln("\tParse  Okay  [Locale=" +
-                                Locale.getDefault() + ", " + formats[j] +
+                                locale) + ", " + formats[j] +
                                 "/\"" + valids[k][0] +
                                 "\"] expected:" + valids[k][1] +
                                 ", got:" + date.getTime() + ", " + date);
@@ -212,7 +213,7 @@
                             catch (Exception e) {
                                 err = true;
                                 System.err.println("\tParse  Error [Locale=" +
-                                    Locale.getDefault() + ", " + formats[j] +
+                                    locale + ", " + formats[j] +
                                     "/\"" + valids[k][0] +
                                     "\"] Unexpected Exception occurred: " + e);
                                 continue;
@@ -245,14 +246,14 @@
                                   expected.equals("GMT+00:00"))) {
                                 err = true;
                                 System.err.println("\tFormat Error [Locale=" +
-                                    Locale.getDefault() + ", " +
+                                    locale + ", " +
                                     formats[j] + "/\"" + valids[k][0] +
                                     "\"] expected:" + valids[k][2+j] +
                                     ", got:" + s + ", " + date);
                             } else {
 /*
                                 logln("\tFormat Okay  [Locale=" +
-                                    Locale.getDefault() + ", " +
+                                    locale + ", " +
                                     formats[j] + "/\"" + valids[k][0] +
                                     "\"] expected:" + valids[k][2+j] +
                                     ", got:" + s + ", " + date);
@@ -271,7 +272,7 @@
                             if (date != null) {
                                 err = true;
                                 System.err.println("\tParse  Error [Locale=" +
-                                    Locale.getDefault() + ", " + formats[j] +
+                                    locale + ", " + formats[j] +
                                     "/\"" + invalids[k][0] +
                                     "\"] expected:null , got:" + date);
                             }
@@ -279,14 +280,14 @@
                             if (offset != ((Integer)invalids[k][1]).intValue()) {
                                 err = true;
                                 System.err.println("\tParse  Error [Locale=" +
-                                    Locale.getDefault() + ", " + formats[j] +
+                                    locale + ", " + formats[j] +
                                     "/\"" + invalids[k][0] +
                                     "\"] incorrect offset. expected:" +
                                     invalids[k][1] + ", got: " + offset);
                             } else {
 /*
                                 logln("\tParse  Okay  [Locale=" +
-                                    Locale.getDefault() + ", " + formats[j] +
+                                    locale + ", " + formats[j] +
                                     "/\"" + invalids[k][0] +
                                     "\"] correct offset: " + offset);
 */
@@ -295,7 +296,7 @@
                         catch (Exception e) {
                             err = true;
                             System.err.println("\tParse  Error [Locale=" +
-                                Locale.getDefault() + ", " + formats[j] +
+                                locale + ", " + formats[j] +
                                 "/\"" + invalids[k][0] +
                                 "\"] Unexpected Exception occurred: " + e);
                         }
@@ -315,14 +316,14 @@
                             if (offset != ((Integer)invalids[k][1]).intValue()) {
                                 err = true;
                                 System.err.println("\tParse  Error [Locale=" +
-                                    Locale.getDefault() + ", " + formats[j] +
+                                    locale + ", " + formats[j] +
                                     "/\"" + invalids[k][0] +
                                     "\"] Expected exception occurred with an incorrect offset. expected:" +
                                     invalids[k][1] + ", got: " + offset);
                             } else {
 /*
                                 logln("\tParse  Okay  [Locale=" +
-                                    Locale.getDefault() + ", " + formats[j] +
+                                    locale + ", " + formats[j] +
                                     "/\"" + invalids[k][0] +
                                     "\"] Expected exception occurred with an correct offset: "
                                     + offset);
@@ -332,7 +333,7 @@
                         catch (Exception e) {
                             err = true;
                             System.err.println("\tParse  Error [Locale=" +
-                                Locale.getDefault() + ", " + formats[j] +
+                                locale + ", " + formats[j] +
                                 "/\"" + invalids[k][0] +
                                 "\"] Invalid exception occurred: " + e);
                         }
@@ -340,7 +341,7 @@
                             if (!correctParseException) {
                                 err = true;
                                 System.err.println("\tParse  Error: [Locale=" +
-                                    Locale.getDefault() + ", " + formats[j] +
+                                    locale + ", " + formats[j] +
                                     "/\"" + invalids[k][0] +
                                     "\"] Expected exception didn't occur.");
                             }
--- a/jdk/test/java/text/Format/DateFormat/Bug4407042.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/text/Format/DateFormat/Bug4407042.java	Wed Jul 05 22:06:46 2017 +0200
@@ -26,6 +26,7 @@
  * @bug 4407042
  * @summary Make sure that cloned SimpleDateFormat objects work
  * independently in multiple threads.
+ * @library /java/text/testlib
  * @run main Bug4407042 10
  */
 
@@ -44,8 +45,9 @@
 
     void test() {
         Locale locale = Locale.getDefault();
-        if (locale.equals(new Locale("th", "TH")) ||
-            locale.equals(new Locale("hi", "IN"))) {
+        if (!TestUtils.usesAsciiDigits(locale)
+                || !TestUtils.usesGregorianCalendar(locale)) {
+            System.out.println("Skipping this test because locale is " + locale);
             return;
         }
 
--- a/jdk/test/java/text/Format/DateFormat/Bug4845901.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/text/Format/DateFormat/Bug4845901.java	Wed Jul 05 22:06:46 2017 +0200
@@ -27,6 +27,8 @@
  * @summary Make sure that SimpleDateFormat.parse() can distinguish
  * the same time zone abbreviation for standard and daylight saving
  * time.
+ * @library /java/text/testlib
+ * @run main Bug4845901
  */
 
 import java.util.*;
@@ -34,6 +36,12 @@
 
 public class Bug4845901 {
     public static void main (String args[]) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            System.out.println("Skipping this test because locale is " + locale);
+            return;
+        }
+
         TimeZone savedTZ = TimeZone.getDefault();
         TimeZone.setDefault(TimeZone.getTimeZone("Australia/Sydney"));
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss.SSS z");
--- a/jdk/test/java/text/Format/DateFormat/Bug6530336.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/text/Format/DateFormat/Bug6530336.java	Wed Jul 05 22:06:46 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 6530336 6537997 8008577
+ * @library /java/text/testlib
  * @run main/othervm -Djava.locale.providers=COMPAT,SPI Bug6530336
  */
 
@@ -43,7 +44,6 @@
 
         try {
             Locale locales[] = Locale.getAvailableLocales();
-            Locale locale_Japan = new Locale("ja", "JP", "JP");
             TimeZone timezone_LA = TimeZone.getTimeZone("America/Los_Angeles");
             TimeZone.setDefault(timezone_LA);
 
@@ -60,12 +60,12 @@
             Date[] dates = new Date[2];
 
             for (int i = 0; i < locales.length; i++) {
-                if (locales[i].getLanguage().equals("th") ||
-                    locales[i].equals(locale_Japan)) {
+                Locale locale = locales[i];
+                if (!TestUtils.usesGregorianCalendar(locale)) {
                     continue;
                 }
 
-                Locale.setDefault(locales[i]);
+                Locale.setDefault(locale);
 
                 for (int j = 0; j < timezones.length; j++) {
                     Calendar cal = Calendar.getInstance(timezones[j]);
@@ -83,7 +83,7 @@
 
                     if (!expected[j].equals(date_LA)) {
                         System.err.println("Got wrong Pacific time (" +
-                            date_LA + ") for (" + date + ") in " + locales[i] +
+                            date_LA + ") for (" + date + ") in " + locale +
                             " in " + timezones[j] +
                             ".\nExpected=" + expected[j]);
                         err = true;
--- a/jdk/test/java/text/Format/DateFormat/DateFormatRegression.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/text/Format/DateFormat/DateFormatRegression.java	Wed Jul 05 22:06:46 2017 +0200
@@ -72,7 +72,6 @@
     }
 
     public void Test4052408() {
-
         DateFormat fmt = DateFormat.getDateTimeInstance(DateFormat.SHORT,
                                                         DateFormat.SHORT, Locale.US);
         Date date = new Date(97, Calendar.MAY, 3, 8, 55);
@@ -164,7 +163,9 @@
     }
 
     public void Test4059917() {
-        if (Locale.getDefault().equals(new Locale("hi", "IN"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesAsciiDigits(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
@@ -621,25 +622,6 @@
         }
     }
 
-    /*
-      Synopsis: Chinese time zone CTT is not recogonized correctly.
-      Description: Platform Chinese Windows 95 - ** Time zone set to CST **
-      */
-    public void Test4108407() {
-
-        long l = System.currentTimeMillis();
-        logln("user.timezone = " + System.getProperty("user.timezone", "?"));
-        logln("Time Zone :" +
-                           DateFormat.getDateInstance().getTimeZone().getID());
-        logln("Default format :" +
-                           DateFormat.getDateInstance().format(new Date(l)));
-        logln("Full format :" +
-                           DateFormat.getDateInstance(DateFormat.FULL).format(new
-                                                                              Date(l)));
-        logln("*** Set host TZ to CST ***");
-        logln("*** THE RESULTS OF THIS TEST MUST BE VERIFIED MANUALLY ***");
-    }
-
     /**
      * SimpleDateFormat won't parse "GMT"
      */
--- a/jdk/test/java/text/Format/DateFormat/bug4358730.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/text/Format/DateFormat/bug4358730.java	Wed Jul 05 22:06:46 2017 +0200
@@ -47,23 +47,17 @@
     };
     int[] year = {2, 20, 200, 2000};
 
-    SimpleDateFormat sdf = new SimpleDateFormat();
     int datasize = data.length;
     int nPatterns = data[0].length;
 
     public void Test4358730() {
-        Locale locale = Locale.getDefault();
-        if (locale.equals(new Locale("th", "TH")) ||
-            locale.equals(new Locale("hi", "IN"))) {
-            return;
-        }
-
         TimeZone saveZone = TimeZone.getDefault();
         Locale saveLocale = Locale.getDefault();
 
         try {
             TimeZone.setDefault(TimeZone.getTimeZone("PST"));
             Locale.setDefault(new Locale("en", "US"));
+            SimpleDateFormat sdf = new SimpleDateFormat();
 
             for (int i = 0; i < datasize; i++) {
                 Date d = new Date(year[i]-1900, 10, 15);
--- a/jdk/test/java/text/Format/MessageFormat/MessageRegression.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/text/Format/MessageFormat/MessageRegression.java	Wed Jul 05 22:06:46 2017 +0200
@@ -28,6 +28,7 @@
  * 4142938 4169959 4232154 4293229
  * @summary Regression tests for MessageFormat and associated classes
  * @library /java/text/testlib
+ * @run main MessageRegression
  */
 /*
 (C) Copyright Taligent, Inc. 1996 - All Rights Reserved
@@ -121,14 +122,15 @@
      * More robust message formats.
      */
     public void Test4031438() {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesAsciiDigits(locale)) {
+            logln("Skipping this test because locale is " + locale);
+            return;
+        }
+
         String pattern1 = "Impossible {1} has occurred -- status code is {0} and message is {2}.";
         String pattern2 = "Double '' Quotes {0} test and quoted '{1}' test plus 'other {2} stuff'.";
 
-        // If the current locale is hi_IN, skip this test case.
-        if (Locale.getDefault().equals(new Locale("hi", "IN"))) {
-            return;
-        }
-
         MessageFormat messageFormatter = new MessageFormat("");
 
         try {
--- a/jdk/test/java/text/Format/NumberFormat/NumberRegression.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/text/Format/NumberFormat/NumberRegression.java	Wed Jul 05 22:06:46 2017 +0200
@@ -32,7 +32,7 @@
  * 4217661 4243011 4243108 4330377 4233840 4241880 4833877 8008577
  * @summary Regression tests for NumberFormat and associated classes
  * @library /java/text/testlib
- * @build IntlTest HexDumpReader
+ * @build IntlTest HexDumpReader TestUtils
  * @modules java.base/sun.util.resources
  * @compile -XDignore.symbol.file NumberRegression.java
  * @run main/othervm -Djava.locale.providers=COMPAT,SPI NumberRegression
@@ -100,6 +100,12 @@
      */
 
     public void Test4088161 (){
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesAsciiDigits(locale)) {
+            logln("Skipping this test because locale is " + locale);
+            return;
+        }
+
         DecimalFormat df = new DecimalFormat();
         double d = 100;
         df.setMinimumFractionDigits(0);
@@ -114,8 +120,7 @@
         FieldPosition fp2 = new FieldPosition(0);
         logln("maxFractionDigits = " + df.getMaximumFractionDigits());
         df.format(d, sBuf2, fp2);
-        String expected = Locale.getDefault().equals(new Locale("hi", "IN")) ?
-                              "\u0967\u0966\u0966" : "100";
+        String expected = "100";
         if (!sBuf2.toString().equals(expected))
             errln(" format(d) = '" + sBuf2 + "'");
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/testlib/TestUtils.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,74 @@
+/*
+ * 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 java.text.DecimalFormatSymbols;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+
+import java.util.Locale.Builder;
+
+/**
+ * TestUtils provides utility methods to get a locale-dependent attribute.
+ * For example,
+ *   - whether or not a non-Gregorian calendar is used
+ *   - whether or not non-ASCII digits are used
+ *
+ * This class was developed to help testing for internationalization &
+ * localization and is not versatile.
+ */
+public class TestUtils {
+
+    /**
+     * Returns true if the give locale uses Gregorian calendar.
+     */
+    public static boolean usesGregorianCalendar(Locale locale) {
+        return Calendar.getInstance(locale).getClass() == GregorianCalendar.class;
+    }
+
+    /**
+     * Returns true if the given locale uses ASCII digits.
+     */
+    public static boolean usesAsciiDigits(Locale locale) {
+        return DecimalFormatSymbols.getInstance(locale).getZeroDigit() == '0';
+    }
+
+    /**
+     * Returns true if the given locale has a special variant which is treated
+     * as ill-formed in BCP 47.
+     *
+     * BCP 47 requires a variant subtag to be 5 to 8 alphanumerics or a
+     * single numeric followed by 3 alphanumerics.
+     * However, note that this methods doesn't check a variant so rigorously
+     * because this is a utility method for testing. Intended special variants
+     * are: JP, NY, and TH, which can be commonly provided by
+     * Locale.getAvailableLocales().
+     *
+     */
+    public static boolean hasSpecialVariant(Locale locale) {
+        String variant = locale.getVariant();
+        return !variant.isEmpty()
+                   && "JP".equals(variant) || "NY".equals(variant) || "TH".equals(variant);
+    }
+
+}
--- a/jdk/test/java/util/Calendar/CalendarLimitTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/util/Calendar/CalendarLimitTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -24,8 +24,8 @@
 /**
  * @test
  * @bug 4033662
+ * @summary test for limit on Calendar
  * @library /java/text/testlib
- * @summary test for limit on Calendar
  * @run main CalendarLimitTest -verbose
  */
 
@@ -62,6 +62,12 @@
     static long ORIGIN; // This is the *approximate* point at which BC switches to AD
 
     public static void main(String argv[]) throws Exception {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            System.out.println("Skipping this test because locale is " + locale);
+            return;
+        }
+
         new CalendarLimitTest().run(argv);
     }
 
--- a/jdk/test/java/util/Calendar/CalendarRegression.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/util/Calendar/CalendarRegression.java	Wed Jul 05 22:06:46 2017 +0200
@@ -32,6 +32,7 @@
  * 4652815 4652830 4740554 4936355 4738710 4633646 4846659 4822110 4960642
  * 4973919 4980088 4965624 5013094 5006864 8152077
  * @library /java/text/testlib
+ * @run main CalendarRegression
  */
 
 import java.lang.reflect.*;
@@ -531,6 +532,12 @@
     }
 
     public void Test4100311() {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
+            return;
+        }
+
         GregorianCalendar cal = (GregorianCalendar)Calendar.getInstance();
         cal.set(Calendar.YEAR, 1997);
         cal.set(Calendar.DAY_OF_YEAR, 1);
@@ -541,7 +548,9 @@
     }
 
     public void Test4103271() {
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
@@ -768,6 +777,12 @@
     }
 
     public void Test4114578() {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
+            return;
+        }
+
         int ONE_HOUR = 60*60*1000;
         TimeZone saveZone = TimeZone.getDefault();
         boolean fail = false;
@@ -847,6 +862,12 @@
      * Check isLeapYear for BC years.
      */
     public void Test4125881() {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
+            return;
+        }
+
         GregorianCalendar cal = (GregorianCalendar) Calendar.getInstance();
         DateFormat fmt = new SimpleDateFormat("MMMM d, yyyy G");
         cal.clear();
@@ -865,7 +886,9 @@
      * at 45 BC, and not have leap years before then).
      */
     public void Test4125892() {
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
@@ -1276,7 +1299,9 @@
      * This bug relies on the TimeZone bug 4173604 to also be fixed.
      */
     public void Test4173516() {
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
@@ -1755,7 +1780,10 @@
      * get(int) changes internal states of a Calendar.
      */
     public void Test4685354() {
-        if (Locale.getDefault().equals(new Locale("hi", "IN"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesAsciiDigits(locale)
+                || !TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
@@ -1860,8 +1888,9 @@
      * get(int) changes internal states of a Calendar.
      */
     public void Test4655637() {
-        // Skip this test case if it's Thai locale
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
--- a/jdk/test/java/util/Calendar/CalendarTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/util/Calendar/CalendarTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -24,8 +24,9 @@
 /**
  * @test
  * @bug 4064654 4374886 4984320 4984574 4944795
+ * @summary test for Calendar
  * @library /java/text/testlib
- * @summary test for Calendar
+ * @run main CalendarTest
  * @key randomness
  */
 
@@ -203,7 +204,9 @@
     }
 
     public void TestGenericAPI() {
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
@@ -559,7 +562,9 @@
 
     // Test the behavior of GMT vs. local time
     public void TestGMTvsLocal4064654() {
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
@@ -875,10 +880,6 @@
     // Verify that the fields are as expected (mostly zero) at the epoch start.
     // Note that we adjust for the default timezone to get most things to zero.
     public void TestEpochStartFields() {
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
-            return;
-        }
-
         String[][] lt = {
           {"en", "US", "US/Pacific"},        /* First day = 1, Minimum day = 1 */
           {"en", "US", "America/Anchorage"}, /* First day = 1, Minimum day = 1 */
--- a/jdk/test/java/util/Calendar/bug4409072.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/util/Calendar/bug4409072.java	Wed Jul 05 22:06:46 2017 +0200
@@ -26,6 +26,7 @@
  * @bug 4409072
  * @summary tests for set(), add(), and roll() with various week parameters.
  * @library /java/text/testlib
+ * @run main bug4409072
  */
 
 import  java.util.*;
@@ -41,7 +42,9 @@
      * (e.g. add(), roll(), set())
      */
     public void Test4409072() {
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
             return;
         }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Date/Bug8135055.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,47 @@
+/*
+ * 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 8135055
+ * @summary Test java.sql.TimeStamp instance should come after java.util.Date
+ * if Nanos component of TimeStamp is not equal to 0 milliseconds.
+*/
+import java.sql.Timestamp;
+import java.util.Date;
+
+public class Bug8135055 {
+
+    public static void main(String[] args) throws InterruptedException {
+        for (int i = 0; i < 1000; i++) {
+            Date d = new Date();
+            Timestamp ts = new Timestamp(d.getTime());
+            if (d.after(ts)) {
+                throw new RuntimeException("date with time " + d.getTime()
+                        + " should not be after TimeStamp , Nanos component of "
+                                + "TimeStamp is " +ts.getNanos());
+            }
+            Thread.sleep(1);
+        }
+    }
+}
--- a/jdk/test/java/util/Locale/LocaleCategory.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/util/Locale/LocaleCategory.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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,6 +30,11 @@
 
     public static void main(String[] args) {
         Locale reservedLocale = Locale.getDefault();
+        if (TestUtils.hasSpecialVariant(reservedLocale)) {
+            System.out.println("Skipping this test because locale is " + reservedLocale);
+            return;
+        }
+
         try {
             Locale.Builder builder = new Locale.Builder();
 
--- a/jdk/test/java/util/Locale/LocaleCategory.sh	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/util/Locale/LocaleCategory.sh	Wed Jul 05 22:06:46 2017 +0200
@@ -26,7 +26,8 @@
 # @bug 4700857 6997928 7079486
 # @summary tests for Locale.getDefault(Locale.Category) and
 #    Locale.setDefault(Locale.Category, Locale)
-# @build LocaleCategory
+# @library /java/text/testlib
+# @build LocaleCategory TestUtils
 # @run shell/timeout=600 LocaleCategory.sh
 
 if [ "${TESTSRC}" = "" ]
@@ -46,7 +47,9 @@
   echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   exit 1
 fi
+
 echo "TESTCLASSES=${TESTCLASSES}"
+echo "TESTCLASSPATH=${TESTCLASSPATH}"
 echo "CLASSPATH=${CLASSPATH}"
 
 # set platform-dependent variables
@@ -69,7 +72,7 @@
 # test user.xxx.display user.xxx.format properties
 
 # run
-RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} -Duser.language.display=ja -Duser.language.format=zh LocaleCategory"
+RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSPATH} -Duser.language.display=ja -Duser.language.format=zh LocaleCategory"
 
 echo ${RUNCMD}
 ${RUNCMD}
@@ -85,7 +88,7 @@
 # test user.xxx properties overriding user.xxx.display/format
 
 # run
-RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} -Duser.language=en -Duser.language.display=ja -Duser.language.format=zh LocaleCategory"
+RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSPATH} -Duser.language=en -Duser.language.display=ja -Duser.language.format=zh LocaleCategory"
 
 echo ${RUNCMD}
 ${RUNCMD}
--- a/jdk/test/java/util/TimeZone/Bug4322313.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/util/TimeZone/Bug4322313.java	Wed Jul 05 22:06:46 2017 +0200
@@ -90,7 +90,9 @@
             TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
 
             for (int i = 0; i < locs.length; i++) {
-                Locale.setDefault(locs[i]);
+                Locale locale = locs[i];
+                Locale.setDefault(locale);
+
 
                 /* Okay case */
                 for (int k = 0; k < VALIDS.length; k++) {
@@ -100,12 +102,12 @@
                     if (!tz.getID().equals(VALIDS[k][2])) {
                         err = true;
                         System.err.println("\tFailed [Locale=" +
-                                           Locale.getDefault() + ", \"" + VALIDS[k][0] +
+                                           locale + ", \"" + VALIDS[k][0] +
                                            "\"] Invalid TimeZone ID, expected:" +
                                            VALIDS[k][2] + ", got:" + tz.getID() + ", " + tz);
                     } else {
                         logln("\tPassed [Locale=" +
-                              Locale.getDefault() + ", \"" + VALIDS[k][0] +
+                              locale + ", \"" + VALIDS[k][0] +
                               "\"] Valid TimeZone ID, got:" + VALIDS[k][2]);
                     }
 
@@ -113,12 +115,12 @@
                     if (offset != (int)VALIDS[k][1]) {
                         err = true;
                         System.err.println("\tFailed [Locale=" +
-                                           Locale.getDefault() + ", \"" + VALIDS[k][0] +
+                                           locale + ", \"" + VALIDS[k][0] +
                                            "\"] Invalid RawOffset, expected:" + VALIDS[k][1] +
                                            ", got:" + offset + ", " + tz);
                     } else {
                         logln("\tPassed [Locale=" +
-                              Locale.getDefault() + ", \"" + VALIDS[k][0] +
+                              locale + ", \"" + VALIDS[k][0] +
                               "\"] Vaild RawOffset, got:" + offset);
                     }
 
@@ -126,12 +128,12 @@
                     if (offset != 0) {
                         err = true;
                         System.err.println("\tFailed [Locale=" +
-                                           Locale.getDefault() + ", \"" + VALIDS[k][0] +
+                                           locale + ", \"" + VALIDS[k][0] +
                                            "\"] DSTSavings should be zero, got:" + offset +
                                            ", " + tz);
                     } else {
                         logln("\tPassed [Locale=" +
-                              Locale.getDefault() + ", \"" + VALIDS[k][0] +
+                              locale + ", \"" + VALIDS[k][0] +
                               "\"] DSTSavings is zero.");
                     }
                 }
@@ -144,12 +146,12 @@
                     if (!tz.getID().equals("GMT")) {
                         err = true;
                         System.err.println("\tFailed [Locale=" +
-                                           Locale.getDefault() + ", \"" + INVALIDS[k] +
+                                           locale + ", \"" + INVALIDS[k] +
                                            "\"] Invalid TimeZone ID, expected:GMT, got:" +
                                            tz.getID() + ", " + tz);
                     } else {
                         logln("\tPassed [Locale=" +
-                              Locale.getDefault() + ", \"" + INVALIDS[k] +
+                              locale + ", \"" + INVALIDS[k] +
                               "\"] Valid TimeZone ID, got:" + tz.getID());
                     }
 
@@ -157,12 +159,12 @@
                     if (offset != 0) {
                         err = true;
                         System.err.println("\tFailed [Locale=" +
-                                           Locale.getDefault() + ", \"" + INVALIDS[k] +
+                                           locale + ", \"" + INVALIDS[k] +
                                            "\"] RawOffset should be zero, got:" + offset +
                                            ", " + tz);
                     } else {
                         logln("\tPassed [Locale=" +
-                              Locale.getDefault() + ", \"" + INVALIDS[k] +
+                              locale + ", \"" + INVALIDS[k] +
                               "\"] RawOffset is zero.");
                     }
 
@@ -170,12 +172,12 @@
                     if (offset != 0) {
                         err = true;
                         System.err.println("\tFailed [Locale=" +
-                                           Locale.getDefault() + ", \"" + INVALIDS[k] +
+                                           locale + ", \"" + INVALIDS[k] +
                                            "\"] DSTSavings should be zero, got:" + offset +
                                            ", " + tz);
                     } else {
                         logln("\tPassed [Locale=" +
-                              Locale.getDefault() + ", \"" + INVALIDS[k] +
+                              locale + ", \"" + INVALIDS[k] +
                               "\"] DSTSavings is zero.");
                     }
                 }
@@ -189,25 +191,25 @@
                     if (!normalizedID.equals(s)) {
                         err = true;
                         System.err.println("getDisplayName returned unexpected name: " + s +
-                                           " in " + Locale.getDefault());
+                                           " in " + locale);
                     }
                     s = tz.getDisplayName(true, tz.SHORT);
                     if (!normalizedID.equals(s)) {
                         err = true;
                         System.err.println("getDisplayName returned unexpected name: " + s +
-                                           " in " + Locale.getDefault());
+                                           " in " + locale);
                     }
                     s = tz.getDisplayName(false, tz.LONG);
                     if (!normalizedID.equals(s)) {
                         err = true;
                         System.err.println("getDisplayName returned unexpected name: " + s +
-                                           " in " + Locale.getDefault());
+                                           " in " + locale);
                     }
                     s = tz.getDisplayName(false, tz.SHORT);
                     if (!normalizedID.equals(s)) {
                         err = true;
                         System.err.println("getDisplayName returned unexpected name: " + s +
-                                           " in " + Locale.getDefault());
+                                           " in " + locale);
                     }
                 }
             }
--- a/jdk/test/java/util/TimeZone/TimeZoneRegression.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/java/util/TimeZone/TimeZoneRegression.java	Wed Jul 05 22:06:46 2017 +0200
@@ -40,15 +40,6 @@
         new TimeZoneRegression().run(args);
     }
 
-    public void Test4052967() {
-        logln("*** CHECK TIMEZONE AGAINST HOST OS SETTING ***");
-        String id = TimeZone.getDefault().getID();
-        logln("user.timezone: " + System.getProperty("user.timezone", "<not set>"));
-        logln("TimeZone.getDefault().getID(): " + id);
-        logln(new Date().toString());
-        logln("*** THE RESULTS OF THIS TEST MUST BE VERIFIED MANUALLY ***");
-    }
-
     public void Test4073209() {
         TimeZone z1 = TimeZone.getTimeZone("PST");
         TimeZone z2 = TimeZone.getTimeZone("PST");
@@ -167,11 +158,14 @@
     }
 
     public void Test4109314() {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
+            return;
+        }
+
         // test both SimpleTimeZone and ZoneInfo objects.
         // @since 1.4
-        if (Locale.getDefault().equals(new Locale("th", "TH"))) {
-            return;
-        }
         sub4109314(getPST());
         sub4109314(TimeZone.getTimeZone("PST"));
     }
@@ -291,6 +285,12 @@
      * When you fix these two problems, the test passes, as expected.
      */
     public void Test4126678() {
+        Locale locale = Locale.getDefault();
+        if (!TestUtils.usesGregorianCalendar(locale)) {
+            logln("Skipping this test because locale is " + locale);
+            return;
+        }
+
         // Note: this test depends on the PST time zone.
         TimeZone initialZone = TimeZone.getDefault();
 
--- a/jdk/test/javax/crypto/JceSecurity/MyProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/javax/crypto/JceSecurity/MyProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -23,7 +23,7 @@
 
 /*
  * test
- * @bug 6377058
+ * @bug 6377058 8130181
  * @summary SunJCE depends on sun.security.provider.SignatureImpl
  * behaviour, BC can't load into 1st slot.
  * @author Brad R. Wetmore
@@ -34,7 +34,7 @@
 public class MyProvider extends Provider {
 
     public MyProvider() {
-        super("MyProvider", 1.0, "CertImpl");
+        super("MyProvider", "1.0", "CertImpl");
         put("CertificateFactory.X.509", "MyCertificateFactory");
     }
 }
--- a/jdk/test/javax/crypto/SecretKeyFactory/Provider1.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/javax/crypto/SecretKeyFactory/Provider1.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -23,7 +23,7 @@
 
 /*
  * test
- * @bug 6370923
+ * @bug 6370923 8130181
  * @summary SecretKeyFactory failover does not work
  * @author Brad R. Wetmore
  */
@@ -35,7 +35,7 @@
 public class Provider1 extends Provider {
 
     public Provider1() {
-        super("Provider1", 1.0, "SecretKeyFactory");
+        super("Provider1", "1.0", "SecretKeyFactory");
         System.out.println("Creating Provider1");
         put("SecretKeyFactory.DUMMY", "com.p1.P1SecretKeyFactory");
     }
--- a/jdk/test/javax/crypto/SecretKeyFactory/Provider2.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/javax/crypto/SecretKeyFactory/Provider2.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -23,7 +23,7 @@
 
 /*
  * test
- * @bug 6370923
+ * @bug 6370923 8130181
  * @summary SecretKeyFactory failover does not work
  * @author Brad R. Wetmore
  */
@@ -35,7 +35,7 @@
 public class Provider2 extends Provider {
 
     public Provider2() {
-        super("Provider2", 1.0, "SecretKeyFactory");
+        super("Provider2", "1.0", "SecretKeyFactory");
         System.out.println("Creating Provider2");
         put("SecretKeyFactory.DUMMY", "com.p2.P2SecretKeyFactory");
     }
--- a/jdk/test/javax/imageio/plugins/shared/RepeatingWriteTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/javax/imageio/plugins/shared/RepeatingWriteTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -25,7 +25,6 @@
  * @test
  *
  * @bug     8144991 8150154
- * @ignore  8150154
  * @author  a.stepanov
  * @summary Check if repeating image writing doesn't fail
  *          (particularly, no AIOOB occurs)
@@ -103,17 +102,18 @@
         reader.setInput(iis);
         BufferedImage img = reader.read(0);
         Color c = new Color(img.getRGB(szRef / 2, szRef / 2));
-
         int w = img.getWidth(), h = img.getHeight();
 
         if (w != szRef || h != szRef) {
             throw new ImageCheckException(fileName +
-                ": invalid image size " + w + " x " + h);
+                ": invalid image size " + w + " x " + h +
+                " expected " + szRef + " x " + szRef);
         }
 
         if (!c.equals(cRef)) {
             throw new ImageCheckException(fileName +
-                ": invalid image color " + c);
+                ": invalid image color " + c +
+                " expected " + cRef);
         }
     }
 
@@ -128,6 +128,14 @@
             return;
         }
 
+        // If JDK-8163323 is fixed this if block should be removed.
+        if (format.equals("tiff")
+            && (NAMES[i].equals("TYPE_USHORT_555_RGB")
+                 || NAMES[i].equals("TYPE_USHORT_565_RGB"))
+                && (NAMES[j].equals("TYPE_USHORT_555_RGB")
+                    || NAMES[j].equals("TYPE_USHORT_565_RGB"))) {
+            return;
+        }
 
         String f1 = "test-1-" + NAMES[i] + "." + format;
         String f2 = "test-2-" + NAMES[j] + "." + format;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/tiff/BogusSecondImageTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,196 @@
+/*
+ * 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 8145014
+ * @summary Verify reader correctly fails for zero-entry IFDs and EOFs
+ *          encountered in locateImage().
+ */
+
+import java.awt.Image;
+import java.awt.image.*;
+import java.io.*;
+import java.util.Iterator;
+import javax.imageio.*;
+import javax.imageio.stream.*;
+
+public class BogusSecondImageTest {
+    public static void main(String[] args) throws Throwable {
+        int failures = 0;
+
+        try {
+            testZeroEntryIFD();
+        } catch (Exception e) {
+            System.out.printf("Failed testZeroEntryIFD: %s%n", e);
+            failures++;
+        }
+
+        try {
+            testOutOfStreamIFD();
+        } catch (Exception e) {
+            System.out.printf("Failed testOutOfStreamIFD: %s%n", e);
+            failures++;
+        }
+
+        if (failures == 0) {
+            System.out.println("Test succeeded");
+        } else {
+            throw new RuntimeException
+                ("Test failed with " + failures + " errors");
+        }
+    }
+
+    private static void testZeroEntryIFD() throws Exception {
+        // Create an image.
+        File f = createImageFile();
+
+        ImageOutputStream s = new FileImageOutputStream(f);
+        long length = s.length();
+
+        // Skip the endianness and magic number
+        s.skipBytes(4);
+
+        // Read and seek to offset of 0th IFD
+        long ifd0 = s.readUnsignedInt();
+        s.seek(ifd0);
+
+        // Read number of 0th IFD entries and skip over them
+        int entries0 = s.readUnsignedShort();
+        s.skipBytes(12*entries0);
+
+        // Write the offset of the 1st IFD as the current file length
+        s.write((int)length);
+
+        // Seek to the 1st IFD and write a zero entry count to it
+        s.seek(length);
+        s.writeShort(0);
+        s.close();
+
+        try {
+            Load(f);
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            f.delete();
+        }
+    }
+
+    private static void testOutOfStreamIFD() throws Exception {
+        // Create an image.
+        File f = createImageFile();
+        ImageOutputStream s = new FileImageOutputStream(f);
+        long length = s.length();
+
+        // Skip the endianness and magic number
+        s.skipBytes(4);
+
+        // Read and seek to offset of 0th IFD
+        long ifd0 = s.readUnsignedInt();
+        s.seek(ifd0);
+
+        // Read number of 0th IFD entries and skip over them
+        int entries0 = s.readUnsignedShort();
+        s.skipBytes(12*entries0);
+
+        // Write the offset of the 1st IFD as the current file length + 7
+        s.write((int)length + 7);
+        s.close();
+
+        try {
+            Load(f);
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            f.delete();
+        }
+    }
+
+    private static File createImageFile() throws Exception {
+        BufferedImage im =
+        new BufferedImage(100, 100, BufferedImage.TYPE_BYTE_GRAY);
+        File f = File.createTempFile("BogusSecondImage", "tif", new File("."));
+        f.deleteOnExit();
+        if (!ImageIO.write(im, "TIFF", f)) {
+            throw new RuntimeException("Failed to write " + f);
+        }
+        return f;
+    }
+
+    private final static boolean printTrace = false;
+
+    public static void Load(File file) {
+        if (!file.exists()) {
+            throw new IllegalArgumentException(file + " does not exist");
+        } else if (!file.isFile()) {
+            throw new IllegalArgumentException(file + " is not a regular file");
+        } else if (!file.canRead()) {
+            throw new IllegalArgumentException(file + " cannot be read");
+        }
+
+        ImageInputStream input = null;
+        try {
+            input = ImageIO.createImageInputStream(file);
+        } catch (Throwable e) {
+            System.err.println("NOK: createImageInputStream()\t" + e.getMessage());
+            if (printTrace) { e.printStackTrace(); }
+            return;
+        }
+
+        Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName("TIFF");
+        if (!readers.hasNext()) { throw new RuntimeException("No readers available for TIFF"); }
+        ImageReader reader = readers.next();
+        reader.setInput(input);
+
+        Image images[] = null;
+        int numImages = 0;
+
+        int failures = 0;
+        try {
+            numImages = reader.getNumImages(true);
+            images = new Image[numImages];
+        } catch (Throwable e) {
+            failures++;
+            System.err.println("NOK: getNumImages()\t" + e.getMessage());
+            if (printTrace) { e.printStackTrace(); }
+        }
+        System.out.printf("numImages %d%n", numImages);
+
+        for (int i = 0; i < numImages; i++) {
+            System.out.printf("reading image %d%n", i);
+            try {
+                images[i] = reader.read(i);
+            } catch (Throwable e) {
+                failures++;
+                System.err.println("NOK: read()\t" + e.getMessage());
+                if (printTrace) { e.printStackTrace(); }
+            }
+        }
+
+        if (failures == 0) {
+            System.err.println("OK");
+        } else {
+            throw new RuntimeException("NOK");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/tiff/IFDTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,99 @@
+/*
+ * 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     8152966
+ * @summary Verify that casting of TIFFDirectory to TIFFIFD has been fixed.
+ */
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.io.*;
+import javax.imageio.*;
+import javax.imageio.metadata.*;
+import javax.imageio.stream.*;
+
+
+import javax.imageio.plugins.tiff.*;
+
+
+public class IFDTest {
+
+    private ImageWriter getTIFFWriter() {
+
+        java.util.Iterator<ImageWriter> writers =
+            ImageIO.getImageWritersByFormatName("TIFF");
+        if (!writers.hasNext()) {
+            throw new RuntimeException("No readers available for TIFF format");
+        }
+        return writers.next();
+    }
+
+    private void writeImage() throws Exception {
+
+        File file = File.createTempFile("IFDTest", "tif", new File("."));
+        file.deleteOnExit();
+
+        OutputStream s = new BufferedOutputStream(
+            new FileOutputStream("test.tiff"));
+        try (ImageOutputStream ios = ImageIO.createImageOutputStream(s)) {
+
+            ImageWriter writer = getTIFFWriter();
+            writer.setOutput(ios);
+
+            BufferedImage img = new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB);
+            Graphics g = img.getGraphics();
+            g.setColor(Color.GRAY);
+            g.fillRect(0, 0, 20, 20);
+            g.dispose();
+
+            IIOMetadata metadata = writer.getDefaultImageMetadata(
+                new ImageTypeSpecifier(img), writer.getDefaultWriteParam());
+
+            TIFFDirectory dir = TIFFDirectory.createFromMetadata(metadata);
+
+            int type = TIFFTag.TIFF_IFD_POINTER;
+            int nTag = ExifParentTIFFTagSet.TAG_EXIF_IFD_POINTER;
+            TIFFTag tag = new TIFFTag("Exif IFD", nTag, 1 << type);
+            TIFFTagSet sets[] = {ExifTIFFTagSet.getInstance()};
+
+            TIFFField f = new TIFFField(tag, type, 42L, new TIFFDirectory(sets, tag));
+            dir.addTIFFField(f);
+
+            writer.write(new IIOImage(img, null, dir.getAsMetadata()));
+
+            ios.flush();
+            writer.dispose();
+        } finally {
+            s.close();
+            file.delete();
+        }
+    }
+
+
+    public static void main(String[] args) throws Exception {
+        (new IFDTest()).writeImage();
+    }
+}
--- a/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java	Wed Jul 05 22:06:46 2017 +0200
@@ -119,20 +119,22 @@
             System.setProperty("javax.net.debug", "ssl");
         }
 
-        // Create the PKI we will use for the test and start the OCSP servers
-        createPKI();
+        try {
+            // Create the PKI we will use for the test and start the OCSP servers
+            createPKI();
 
-        testAllDefault();
-        testPKIXParametersRevEnabled();
-        testRevokedCertificate();
-        testHardFailFallback();
-        testSoftFailFallback();
-        testLatencyNoStaple(false);
-        testLatencyNoStaple(true);
-
-        // shut down the OCSP responders before finishing the test
-        intOcsp.stop();
-        rootOcsp.stop();
+            testAllDefault();
+            testPKIXParametersRevEnabled();
+            testRevokedCertificate();
+            testHardFailFallback();
+            testSoftFailFallback();
+            testLatencyNoStaple(false);
+            testLatencyNoStaple(true);
+        } finally {
+            // shut down the OCSP responders before finishing the test
+            intOcsp.stop();
+            rootOcsp.stop();
+        }
     }
 
     /**
@@ -281,11 +283,9 @@
         ServerParameters servParams = new ServerParameters();
         serverReady = false;
 
-        // Stop the OCSP responders and give a 1 second delay before
-        // running the test.
-        intOcsp.stop();
-        rootOcsp.stop();
-        Thread.sleep(1000);
+        // make OCSP responders reject connections
+        intOcsp.rejectConnections();
+        rootOcsp.rejectConnections();
 
         System.out.println("=======================================");
         System.out.println("Stapling enbled in client and server,");
@@ -315,9 +315,9 @@
         System.out.println("                 PASS");
         System.out.println("=======================================\n");
 
-        // Start the OCSP responders up again
-        intOcsp.start();
-        rootOcsp.start();
+        // Make OCSP responders accept connections
+        intOcsp.acceptConnections();
+        rootOcsp.acceptConnections();
 
         // Wait 5 seconds for server ready
         for (int i = 0; (i < 100 && (!intOcsp.isServerReady() || !rootOcsp.isServerReady())); i++) {
@@ -338,11 +338,9 @@
         ServerParameters servParams = new ServerParameters();
         serverReady = false;
 
-        // Stop the OCSP responders and give a 1 second delay before
-        // running the test.
-        intOcsp.stop();
-        rootOcsp.stop();
-        Thread.sleep(1000);
+        // make OCSP responders reject connections
+        intOcsp.rejectConnections();
+        rootOcsp.rejectConnections();
 
         System.out.println("=======================================");
         System.out.println("Stapling enbled in client and server,");
@@ -372,9 +370,9 @@
         System.out.println("                 PASS");
         System.out.println("=======================================\n");
 
-        // Start the OCSP responders up again
-        intOcsp.start();
-        rootOcsp.start();
+        // Make OCSP responders accept connections
+        intOcsp.acceptConnections();
+        rootOcsp.acceptConnections();
 
         // Wait 5 seconds for server ready
         for (int i = 0; (i < 100 && (!intOcsp.isServerReady() || !rootOcsp.isServerReady())); i++) {
@@ -401,15 +399,10 @@
         ServerParameters servParams = new ServerParameters();
         serverReady = false;
 
-        // Stop the OCSP responders and give a 1 second delay before
-        // running the test.
-        intOcsp.stop();
-        rootOcsp.stop();
-        Thread.sleep(1000);
+        // Give a 1 second delay before running the test.
         intOcsp.setDelay(3000);
         rootOcsp.setDelay(3000);
-        rootOcsp.start();
-        intOcsp.start();
+        Thread.sleep(1000);
 
         // Wait 5 seconds for server ready
         for (int i = 0; (i < 100 && (!intOcsp.isServerReady() || !rootOcsp.isServerReady())); i++) {
@@ -458,13 +451,9 @@
         System.out.println("========================================\n");
 
         // Remove the OCSP responder latency
-        intOcsp.stop();
-        rootOcsp.stop();
-        Thread.sleep(1000);
         intOcsp.setDelay(0);
         rootOcsp.setDelay(0);
-        rootOcsp.start();
-        intOcsp.start();
+        Thread.sleep(1000);
 
         // Wait 5 seconds for server ready
         for (int i = 0; (i < 100 && (!intOcsp.isServerReady() || !rootOcsp.isServerReady())); i++) {
@@ -676,6 +665,7 @@
                          * Release the client, if not active already...
                          */
                         System.err.println("Server died...");
+                        e.printStackTrace(System.err);
                         serverReady = true;
                         serverException = e;
                     }
--- a/jdk/test/javax/net/ssl/sanity/pluggability/CheckSSLContextExport.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/javax/net/ssl/sanity/pluggability/CheckSSLContextExport.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4635454 6208022
+ * @bug 4635454 6208022 8130181
  * @summary Check pluggability of SSLContext class.
  */
 import java.security.*;
@@ -34,7 +34,7 @@
     private static String info = "test provider for JSSE pluggability";
 
     public CheckSSLContextExport(String protocols[]) {
-        super("TestJSSEPluggability", 1.0, info);
+        super("TestJSSEPluggability", "1.0", info);
         for (int i=0; i<protocols.length; i++) {
             put("SSLContext." + protocols[i], "MySSLContextImpl");
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/print/attribute/ServiceDlgPageRangeTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,170 @@
+/*
+ * 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 5080098
+ * @summary Verify if PageRanges option is disabled for Non service-formatted
+ *          flavors.
+ * @run main/manual ServiceDlgPageRangeTest
+ */
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import javax.print.DocFlavor;
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.ServiceUI;
+import javax.print.attribute.Attribute;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.standard.PageRanges;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+public class ServiceDlgPageRangeTest {
+
+    private static Thread mainThread;
+    private static boolean testPassed;
+    private static boolean testGeneratedInterrupt;
+    private static DocFlavor flavor = DocFlavor.INPUT_STREAM.JPEG;
+    private static PrintService services[];
+
+    /**
+     * Starts the application.
+     */
+    public static void printTest() {
+
+        System.out.println("\nDefault print service: " +
+                              PrintServiceLookup.lookupDefaultPrintService());
+        System.out.println("is flavor: "+flavor+" supported? "+
+                                     services[0].isDocFlavorSupported(flavor));
+        System.out.println("is Page Ranges category supported? "+
+                   services[0].isAttributeCategorySupported(PageRanges.class));
+        System.out.println("is PageRanges[2] value supported ? "+
+                   services[0].isAttributeValueSupported(
+                                             new PageRanges(2), flavor, null));
+
+        HashPrintRequestAttributeSet prSet = new HashPrintRequestAttributeSet();
+        //prSet.add(new PageRanges(2));
+        PrintService selService = ServiceUI.printDialog(null, 200, 200,
+                                          services, services[0], flavor, prSet);
+
+        System.out.println("\nSelected Values\n");
+        Attribute attr[] = prSet.toArray();
+        for (int x = 0; x < attr.length; x ++) {
+            System.out.println("Attribute: " + attr[x].getName() +
+                                                        " Value: " + attr[x]);
+        }
+    }
+
+    /**
+     * Starts the application.
+     */
+    public static void main(java.lang.String[] args) throws Exception {
+        services = PrintServiceLookup.lookupPrintServices(flavor,  null);
+
+        if (services.length == 0) {
+            System.out.println("No print service found!!");
+            return;
+        }
+        SwingUtilities.invokeAndWait(() -> {
+            doTest(ServiceDlgPageRangeTest::printTest);
+        });
+        mainThread = Thread.currentThread();
+        try {
+            Thread.sleep(600000);
+        } catch (InterruptedException e) {
+            if (!testPassed && testGeneratedInterrupt) {
+                throw new RuntimeException("PageRanges option is not disabled "
+                        + "for for Non serv-formatted flvrs");
+            }
+        }
+        if (!testGeneratedInterrupt) {
+            throw new RuntimeException("user has not executed the test");
+        }
+    }
+
+    public static synchronized void pass() {
+        testPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    public static synchronized void fail() {
+        testPassed = false;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    private static void doTest(Runnable action) {
+        String description
+                = " Visual inspection of print dialog is required.\n"
+                + " A print dialog will be shown.\n "
+                + " Please verify Pages(From/To) option is disabled.\n"
+                + " Press Cancel to close the print dialog.\n"
+                + " If Pages(From/To) option is disabled, press PASS else press FAIL";
+
+        final JDialog dialog = new JDialog();
+        dialog.setTitle("printSelectionTest");
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+        final JButton testButton = new JButton("Start Test");
+        final JButton passButton = new JButton("PASS");
+        passButton.setEnabled(false);
+        passButton.addActionListener((e) -> {
+            dialog.dispose();
+            pass();
+        });
+        final JButton failButton = new JButton("FAIL");
+        failButton.setEnabled(false);
+        failButton.addActionListener((e) -> {
+            dialog.dispose();
+            fail();
+        });
+        testButton.addActionListener((e) -> {
+            testButton.setEnabled(false);
+            action.run();
+            passButton.setEnabled(true);
+            failButton.setEnabled(true);
+        });
+        JPanel mainPanel = new JPanel(new BorderLayout());
+        mainPanel.add(textArea, BorderLayout.CENTER);
+        JPanel buttonPanel = new JPanel(new FlowLayout());
+        buttonPanel.add(testButton);
+        buttonPanel.add(passButton);
+        buttonPanel.add(failButton);
+        mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+        dialog.add(mainPanel);
+        dialog.pack();
+        dialog.setVisible(true);
+        dialog.addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent e) {
+                System.out.println("main dialog closing");
+                testGeneratedInterrupt = false;
+                mainThread.interrupt();
+            }
+        });
+    }
+}
--- a/jdk/test/javax/security/auth/login/Configuration/GetInstanceProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/javax/security/auth/login/Configuration/GetInstanceProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -27,7 +27,7 @@
 
     public GetInstanceProvider() {
         super("GetInstanceProvider",
-                1,
+                "1",
                 "GetInstanceProvider: Configuration.GetInstanceConfigSpi");
 
         AccessController.doPrivileged(new PrivilegedAction() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JList/8161483/Bug8161483.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,104 @@
+/*
+ * 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 8161483
+ * @summary Implement AccessibleAction in JList.AccessibleJList.AccessibleJListChild
+ * @run main Bug8161483
+ */
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleSelection;
+import javax.swing.DefaultListModel;
+import javax.swing.JFrame;
+import javax.swing.JList;
+import javax.swing.SwingUtilities;
+
+public class Bug8161483 extends JFrame {
+
+    private static JFrame frame;
+    private static volatile Exception exception = null;
+    private JList<String> countryList;
+
+    public static void main(String args[]) throws Exception {
+        try {
+            SwingUtilities.invokeAndWait(() -> {
+                DefaultListModel<String> listModel = new DefaultListModel<>();
+                listModel.addElement("one");
+                listModel.addElement("two");
+                listModel.addElement("three");
+                JList<String> list = new JList<>(listModel);
+                frame = new JFrame();
+                frame.add(list);
+                frame.pack();
+                try {
+                    AccessibleContext acList = list.getAccessibleContext();
+                    Accessible accChild = acList.getAccessibleChild(1);
+                    AccessibleContext acChild = accChild.getAccessibleContext();
+                    AccessibleAction aa = acChild.getAccessibleAction();
+                    int c = aa.getAccessibleActionCount();
+                    if (c != 1) {
+                        throw new RuntimeException("getAccessibleActionCount is not 1");
+                    }
+                    String s = aa.getAccessibleActionDescription(0);
+                    if (!s.equals("click")) {
+                        throw new RuntimeException("getAccessibleActionDescription is not click");
+                    }
+                    boolean b = aa.doAccessibleAction(0);
+                    if (!b) {
+                        throw new RuntimeException("doAccessibleAction did not return true");
+                    }
+                    AccessibleSelection as = acList.getAccessibleSelection();
+                    int asc = as.getAccessibleSelectionCount();
+                    if (asc != 1) {
+                        throw new RuntimeException("getAccessibleSelectionCount is not 1");
+                    }
+                    boolean isSelected = as.isAccessibleChildSelected(0);
+                    if (isSelected) {
+                        throw new RuntimeException("isAccessibleChildSelected(0) did not return false");
+                    }
+                    isSelected = as.isAccessibleChildSelected(1);
+                    if (!isSelected) {
+                        throw new RuntimeException("isAccessibleChildSelected(1) did not return true");
+                    }
+                } catch (Exception e) {
+                    exception = e;
+                }
+            });
+            if (exception != null) {
+                System.out.println("Test failed: " + exception.getMessage());
+                throw exception;
+            } else {
+                System.out.println("Test passed.");
+            }
+        } finally {
+            SwingUtilities.invokeAndWait(() -> {
+                frame.dispose();
+            });
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JProgressBar/8161664/ProgressBarMemoryLeakTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,108 @@
+/*
+ * 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 8161664
+ * @summary Memory leak in com.apple.laf.AquaProgressBarUI: removed progress bar still referenced
+ * @library ../../regtesthelpers
+ * @build Util
+ * @key headful
+ * @run main/timeout=300/othervm -Xmx16m ProgressBarMemoryLeakTest
+ */
+import java.awt.EventQueue;
+import java.lang.ref.WeakReference;
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+
+public class ProgressBarMemoryLeakTest {
+
+  private static JFrame sFrame;
+  private static WeakReference<JProgressBar> sProgressBar;
+
+  public static void main(String[] args) throws Exception {
+    UIManager.LookAndFeelInfo[] installedLookAndFeels = UIManager.getInstalledLookAndFeels();
+    for ( UIManager.LookAndFeelInfo installedLookAndFeel : installedLookAndFeels ) {
+      executeTestCase(installedLookAndFeel.getClassName());
+    }
+  }
+
+  private static void executeTestCase(String lookAndFeelString) throws Exception{
+    if (tryLookAndFeel(lookAndFeelString)) {
+      EventQueue.invokeAndWait( new Runnable() {
+        @Override
+        public void run() {
+          showUI();
+        }
+      } );
+      EventQueue.invokeAndWait( new Runnable() {
+        @Override
+        public void run() {
+          disposeUI();
+        }
+      } );
+      Util.generateOOME();
+      JProgressBar progressBar = sProgressBar.get();
+      if ( progressBar != null ) {
+        throw new RuntimeException( "Progress bar (using L&F: " + lookAndFeelString + ") should have been GC-ed" );
+      }
+    }
+  }
+
+  private static void showUI(){
+    sFrame = new JFrame();
+
+    JProgressBar progressBar = new JProgressBar();
+    progressBar.setVisible(false);
+    progressBar.setIndeterminate(false);
+    progressBar.setIndeterminate(true);
+    progressBar.setIndeterminate(false);
+    progressBar.setValue(10);
+    progressBar.setString("Progress");
+
+    sFrame.add(progressBar);
+
+    sProgressBar = new WeakReference<>(progressBar);
+
+    sFrame.setSize(200,200);
+    sFrame.setVisible(true);
+  }
+
+  private static void disposeUI(){
+    sFrame.setContentPane(new JPanel());
+    sFrame.dispose();
+    sFrame = null;
+  }
+
+  private static boolean tryLookAndFeel(String lookAndFeelString) throws Exception {
+    try {
+      UIManager.setLookAndFeel(lookAndFeelString);
+    } catch (UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException | IllegalAccessException e) {
+      return false;
+    }
+    return true;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JSlider/8162856/MetalHiDPISliderThumbTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,147 @@
+/*
+ * 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 java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import javax.swing.JSlider;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+
+/*
+ * @test
+ * @bug 8162856
+ * @summary Bad rendering of Swing UI controls with Metal L&F on HiDPI display
+ * @run main MetalHiDPISliderThumbTest
+ */
+public class MetalHiDPISliderThumbTest {
+
+    public static void main(String[] args) throws Exception {
+
+        SwingUtilities.invokeAndWait(() -> {
+
+            try {
+                UIManager.setLookAndFeel(new MetalLookAndFeel());
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+
+            if (!testSliderThumb(true)) {
+                throw new RuntimeException("Horizontal Slider Thumb is not scaled!");
+            }
+
+            if (!testSliderThumb(false)) {
+                throw new RuntimeException("Vertical Slider Thumb is not scaled!");
+            }
+        });
+    }
+
+    private static boolean testSliderThumb(boolean horizontal) {
+        int scale = 3;
+
+        int w = horizontal ? 100 : 20;
+        int h = horizontal ? 20 : 100;
+
+        JSlider testSlider = new JSlider();
+        testSlider.setSize(w, h);
+        Dimension size = new Dimension(w, h);
+        testSlider.setPreferredSize(size);
+        testSlider.setMinimumSize(size);
+        testSlider.setMaximumSize(size);
+        testSlider.setOrientation(horizontal ? JSlider.HORIZONTAL : JSlider.VERTICAL);
+
+        int sw = scale * w;
+        int sh = scale * h;
+
+        final BufferedImage img = new BufferedImage(sw, sh, BufferedImage.TYPE_INT_RGB);
+
+        Graphics2D g = img.createGraphics();
+        g.scale(scale, scale);
+        testSlider.paint(g);
+        g.dispose();
+
+        if (horizontal) {
+            int y = sh / 2;
+
+            int xMin = 0;
+            int rgb = img.getRGB(xMin, y);
+            for (int i = 0; i < sw; i++) {
+                if (img.getRGB(i, y) != rgb) {
+                    xMin = i;
+                    break;
+                }
+            }
+
+            int xMax = sw - 1;
+            rgb = img.getRGB(xMax, y);
+            for (int i = sw - 1; i > 0; i--) {
+                if (img.getRGB(i, y) != rgb) {
+                    xMax = i;
+                    break;
+                }
+            }
+
+            int d = 3 * scale;
+            int xc = (xMin + xMax) / 2 - d;
+            rgb = img.getRGB(xc, y);
+
+            for (int x = xMin + d; x < xc; x++) {
+                if (img.getRGB(x, y) != rgb) {
+                    return true;
+                }
+            }
+        } else {
+            int x = sw / 2;
+
+            int yMin = 0;
+            int rgb = img.getRGB(x, yMin);
+            for (int i = 0; i < sh; i++) {
+                if (img.getRGB(x, i) != rgb) {
+                    yMin = i;
+                    break;
+                }
+            }
+
+            int yMax = sh - 1;
+            rgb = img.getRGB(x, yMax);
+            for (int i = sh - 1; i > 0; i--) {
+                if (img.getRGB(x, i) != rgb) {
+                    yMax = i;
+                    break;
+                }
+            }
+
+            int d = 3 * scale;
+            int yc = (yMin + yMax) / 2 - d;
+            rgb = img.getRGB(x, yc);
+
+            for (int y = yMin + d; y < yc; y++) {
+                if (img.getRGB(x, y) != rgb) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/metal/MetalIcons/MetalHiDPIIconsTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,136 @@
+/*
+ * 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 8160986
+ * @summary Bad rendering of Swing UI controls with Metal L&F on HiDPI display
+ * @run main/manual MetalHiDPIIconsTest
+ */
+import java.awt.Color;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+public class MetalHiDPIIconsTest {
+
+    private static volatile boolean testResult = false;
+    private static volatile CountDownLatch countDownLatch;
+    private static final String INSTRUCTIONS = "INSTRUCTIONS:\n"
+            + "Verify that icons are painted smoothly for standard Swing UI controls.\n\n"
+            + "If the display does not support HiDPI mode press PASS.\n\n"
+            + "1. Run the SwingSet2 demo on HiDPI Display.\n"
+            + "2. Select Metal Look and Feel\n"
+            + "3. Check that the icons are painted smoothly on Swing UI controls like:\n"
+            + "  - JRadioButton\n"
+            + "  - JCheckBox\n"
+            + "  - JComboBox\n"
+            + "  - JScrollPane (vertical and horizontal scroll bars)\n"
+            + "and others...\n\n"
+            + "If so, press PASS, else press FAIL.\n";
+
+    public static void main(String args[]) throws Exception {
+        countDownLatch = new CountDownLatch(1);
+
+        SwingUtilities.invokeLater(MetalHiDPIIconsTest::createUI);
+        countDownLatch.await(15, TimeUnit.MINUTES);
+
+        if (!testResult) {
+            throw new RuntimeException("Test fails!");
+        }
+    }
+
+    private static void createUI() {
+
+        final JFrame mainFrame = new JFrame("Metal L&F icons test");
+        GridBagLayout layout = new GridBagLayout();
+        JPanel mainControlPanel = new JPanel(layout);
+        JPanel resultButtonPanel = new JPanel(layout);
+
+        GridBagConstraints gbc = new GridBagConstraints();
+
+        JTextArea instructionTextArea = new JTextArea();
+        instructionTextArea.setText(INSTRUCTIONS);
+        instructionTextArea.setEditable(false);
+        instructionTextArea.setBackground(Color.white);
+
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+        gbc.fill = GridBagConstraints.HORIZONTAL;
+        mainControlPanel.add(instructionTextArea, gbc);
+
+        JButton passButton = new JButton("Pass");
+        passButton.setActionCommand("Pass");
+        passButton.addActionListener((ActionEvent e) -> {
+            testResult = true;
+            mainFrame.dispose();
+            countDownLatch.countDown();
+
+        });
+
+        JButton failButton = new JButton("Fail");
+        failButton.setActionCommand("Fail");
+        failButton.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                mainFrame.dispose();
+                countDownLatch.countDown();
+            }
+        });
+
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+        resultButtonPanel.add(passButton, gbc);
+
+        gbc.gridx = 1;
+        gbc.gridy = 0;
+        resultButtonPanel.add(failButton, gbc);
+
+        gbc.gridx = 0;
+        gbc.gridy = 1;
+        mainControlPanel.add(resultButtonPanel, gbc);
+
+        mainFrame.add(mainControlPanel);
+        mainFrame.pack();
+
+        mainFrame.addWindowListener(new WindowAdapter() {
+
+            @Override
+            public void windowClosing(WindowEvent e) {
+                mainFrame.dispose();
+                countDownLatch.countDown();
+            }
+        });
+        mainFrame.setVisible(true);
+    }
+}
--- a/jdk/test/javax/xml/crypto/dsig/TransformService/NullParent.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/javax/xml/crypto/dsig/TransformService/NullParent.java	Wed Jul 05 22:06:46 2017 +0200
@@ -26,6 +26,7 @@
  * @bug 8022120
  * @summary check that the init and marshalParams methods throw
  *          NullPointerException when the parent parameter is null
+ * @run main/othervm/java.security.policy==test.policy NullParent
  */
 
 import javax.xml.crypto.dsig.CanonicalizationMethod;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/crypto/dsig/TransformService/test.policy	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,3 @@
+grant {
+
+};
--- a/jdk/test/javax/xml/crypto/dsig/keyinfo/KeyInfo/Marshal.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/javax/xml/crypto/dsig/keyinfo/KeyInfo/Marshal.java	Wed Jul 05 22:06:46 2017 +0200
@@ -27,7 +27,7 @@
  * @summary Test that KeyInfo.marshal works correctly
  * @modules java.xml.crypto/org.jcp.xml.dsig.internal.dom
  * @compile -XDignore.symbol.file Marshal.java
- * @run main Marshal
+ * @run main/othervm/java.security.policy==test.policy Marshal
  * @author Sean Mullan
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/crypto/dsig/keyinfo/KeyInfo/test.policy	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,3 @@
+grant {
+    permission java.lang.RuntimePermission "accessClassInPackage.org.jcp.xml.dsig.internal.dom";
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/internal/loader/ClassLoaderValue/ClassLoaderValueTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,251 @@
+/*
+ * 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.internal.loader.ClassLoaderValue;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * @test
+ * @bug 8152115
+ * @summary functional and concurrency test for ClassLoaderValue
+ * @modules java.base/jdk.internal.loader
+ * @author Peter Levart
+ */
+public class ClassLoaderValueTest {
+
+    @SuppressWarnings("unchecked")
+    public static void main(String[] args) throws Exception {
+
+        ClassLoaderValue[] clvs = {new ClassLoaderValue<>(),
+                                   new ClassLoaderValue<>()};
+
+        ClassLoader[] lds = {ClassLoader.getSystemClassLoader(),
+                             ClassLoader.getPlatformClassLoader(),
+                             null /* bootstrap class loader */};
+
+        Integer[] keys = new Integer[32];
+        for (int i = 0; i < keys.length; i++) {
+            keys[i] = i + 128;
+        }
+
+        try (AutoCloseable cleanup = () -> {
+            for (ClassLoaderValue<Integer> clv : clvs) {
+                for (ClassLoader ld : lds) {
+                    clv.removeAll(ld);
+                }
+            }
+        }) {
+            // 1st just one sequential pass of single-threaded validation
+            // which is easier to debug if it fails...
+            for (ClassLoaderValue<Integer> clv : clvs) {
+                for (ClassLoader ld : lds) {
+                    writeValidateOps(clv, ld, keys);
+                }
+            }
+            for (ClassLoaderValue<Integer> clv : clvs) {
+                for (ClassLoader ld : lds) {
+                    readValidateOps(clv, ld, keys);
+                }
+            }
+
+            // 2nd the same in concurrent setting that also validates
+            // failure-isolation between threads and data-isolation between
+            // regions - (ClassLoader, ClassLoaderValue) pairs - of the storage
+            testConcurrentIsolation(clvs, lds, keys, TimeUnit.SECONDS.toMillis(3));
+        }
+    }
+
+    static void writeValidateOps(ClassLoaderValue<Integer> clv,
+                                 ClassLoader ld,
+                                 Object[] keys) {
+        for (int i = 0; i < keys.length; i++) {
+            Object k = keys[i];
+            Integer v1 = i;
+            Integer v2 = i + 333;
+            Integer pv;
+            boolean success;
+
+            pv = clv.sub(k).putIfAbsent(ld, v1);
+            assertEquals(pv, null);
+            assertEquals(clv.sub(k).get(ld), v1);
+
+            pv = clv.sub(k).putIfAbsent(ld, v2);
+            assertEquals(pv, v1);
+            assertEquals(clv.sub(k).get(ld), v1);
+
+            success = clv.sub(k).remove(ld, v2);
+            assertEquals(success, false);
+            assertEquals(clv.sub(k).get(ld), v1);
+
+            success = clv.sub(k).remove(ld, v1);
+            assertEquals(success, true);
+            assertEquals(clv.sub(k).get(ld), null);
+
+            pv = clv.sub(k).putIfAbsent(ld, v2);
+            assertEquals(pv, null);
+            assertEquals(clv.sub(k).get(ld), v2);
+
+            pv = clv.sub(k).computeIfAbsent(ld, (_ld, _clv) -> v1);
+            assertEquals(pv, v2);
+            assertEquals(clv.sub(k).get(ld), v2);
+
+            success = clv.sub(k).remove(ld, v1);
+            assertEquals(success, false);
+            assertEquals(clv.sub(k).get(ld), v2);
+
+            success = clv.sub(k).remove(ld, v2);
+            assertEquals(success, true);
+            assertEquals(clv.sub(k).get(ld), null);
+
+            pv = clv.sub(k).computeIfAbsent(ld, (_ld, clv_k) -> {
+                try {
+                    // nested get for same key should throw
+                    clv_k.get(_ld);
+                    throw new AssertionError("Unexpected code path");
+                } catch (IllegalStateException e) {
+                    // expected
+                }
+                try {
+                    // nested putIfAbsent for same key should throw
+                    clv_k.putIfAbsent(_ld, v1);
+                    throw new AssertionError("Unexpected code path");
+                } catch (IllegalStateException e) {
+                    // expected
+                }
+                // nested remove for for same key and any value (even null)
+                // should return false
+                assertEquals(clv_k.remove(_ld, null), false);
+                assertEquals(clv_k.remove(_ld, v1), false);
+                assertEquals(clv_k.remove(_ld, v2), false);
+                try {
+                    // nested computeIfAbsent for same key should throw
+                    clv_k.computeIfAbsent(_ld, (__ld, _clv_k) -> v1);
+                    throw new AssertionError("Unexpected code path");
+                } catch (IllegalStateException e) {
+                    // expected
+                }
+                // if everything above has been handled, we should succeed...
+                return v2;
+            });
+            // ... and the result should be reflected in the CLV
+            assertEquals(pv, v2);
+            assertEquals(clv.sub(k).get(ld), v2);
+
+            success = clv.sub(k).remove(ld, v2);
+            assertEquals(success, true);
+            assertEquals(clv.sub(k).get(ld), null);
+
+            try {
+                clv.sub(k).computeIfAbsent(ld, (_ld, clv_k) -> {
+                    throw new UnsupportedOperationException();
+                });
+                throw new AssertionError("Unexpected code path");
+            } catch (UnsupportedOperationException e) {
+                // expected
+            }
+            assertEquals(clv.sub(k).get(ld), null);
+        }
+    }
+
+    static void readValidateOps(ClassLoaderValue<Integer> clv,
+                                ClassLoader ld,
+                                Object[] keys) {
+        for (int i = 0; i < keys.length; i++) {
+            Object k = keys[i];
+            Integer v1 = i;
+            Integer v2 = i + 333;
+            Integer rv = clv.sub(k).get(ld);
+            if (!(rv == null || rv.equals(v1) || rv.equals(v2))) {
+                throw new AssertionError("Unexpected value: " + rv +
+                                         ", expected one of: null, " + v1 + ", " + v2);
+            }
+        }
+    }
+
+    static void testConcurrentIsolation(ClassLoaderValue<Integer>[] clvs,
+                                        ClassLoader[] lds,
+                                        Object[] keys,
+                                        long millisRuntime) {
+        ExecutorService exe = Executors.newCachedThreadPool();
+        List<Future<?>> futures = new ArrayList<>();
+        AtomicBoolean stop = new AtomicBoolean();
+        for (ClassLoaderValue<Integer> clv : clvs) {
+            for (ClassLoader ld : lds) {
+                // submit a task that exercises a mix of modifying
+                // and reading-validating operations in an isolated
+                // part of the storage. If isolation is violated,
+                // validation operations are expected to fail.
+                futures.add(exe.submit(() -> {
+                    do {
+                        writeValidateOps(clv, ld, keys);
+                    } while (!stop.get());
+                }));
+                // submit a task that just reads from the same part of
+                // the storage as above task. It should not disturb
+                // above task in any way and this task should never
+                // exhibit any failure although above task produces
+                // regular failures during lazy computation
+                futures.add(exe.submit(() -> {
+                    do {
+                        readValidateOps(clv, ld, keys);
+                    } while (!stop.get());
+                }));
+            }
+        }
+        // wait for some time
+        try {
+            Thread.sleep(millisRuntime);
+        } catch (InterruptedException e) {
+            throw new AssertionError(e);
+        }
+        // stop tasks
+        stop.set(true);
+        // collect results
+        AssertionError error = null;
+        for (Future<?> future : futures) {
+            try {
+                future.get();
+            } catch (InterruptedException | ExecutionException e) {
+                if (error == null) error = new AssertionError("Failure");
+                error.addSuppressed(e);
+            }
+        }
+        exe.shutdown();
+        if (error != null) throw error;
+    }
+
+    static void assertEquals(Object actual, Object expected) {
+        if (!Objects.equals(actual, expected)) {
+            throw new AssertionError("Expected: " + expected + ", actual: " + actual);
+        }
+    }
+}
--- a/jdk/test/jdk/security/jarsigner/Function.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/jdk/security/jarsigner/Function.java	Wed Jul 05 22:06:46 2017 +0200
@@ -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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8056174
+ * @bug 8056174 8130181
  * @summary test the functions of JarSigner API
  * @modules java.base/sun.security.tools.keytool
  *          jdk.jartool
@@ -145,7 +145,7 @@
 
     public static class MyProvider extends Provider {
         MyProvider() {
-            super("MY", 1.0d, null);
+            super("MY", "1.0", null);
             put("MessageDigest.Five", Five.class.getName());
             put("Signature.SHA1WithRSA", SHA1WithRSA.class.getName());
         }
--- a/jdk/test/sun/java2d/marlin/ArrayCacheSizeTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/sun/java2d/marlin/ArrayCacheSizeTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -21,7 +21,7 @@
  * questions.
  */
 
-import sun.java2d.marlin.ArrayCache;
+import sun.java2d.marlin.ArrayCacheConst;
 
 /*
  * @test
@@ -72,7 +72,7 @@
     private static void testNewSize(final int curSize,
                                     final int needSize) {
 
-        int size = ArrayCache.getNewSize(curSize, needSize);
+        int size = ArrayCacheConst.getNewSize(curSize, needSize);
 
         System.out.println("getNewSize(" + curSize + ", " + needSize
             + ") = " + size);
@@ -118,7 +118,7 @@
     private static void testNewLargeSize(final long curSize,
                                          final long needSize) {
 
-        long size = ArrayCache.getNewLargeSize(curSize, needSize);
+        long size = ArrayCacheConst.getNewLargeSize(curSize, needSize);
 
         System.out.println("getNewLargeSize(" + curSize + ", " + needSize
             + ") = " + size);
--- a/jdk/test/sun/misc/URLClassPath/ClassnameCharTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/sun/misc/URLClassPath/ClassnameCharTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -103,16 +103,60 @@
 
     //--------------------- Infrastructure ---------------------------
     static volatile int passed = 0, failed = 0;
-    static boolean pass() {passed++; return true;}
-    static boolean fail() {failed++; server.stop(0); Thread.dumpStack(); return false;}
-    static boolean fail(String msg) {System.out.println(msg); return fail();}
-    static void unexpected(Throwable t) {failed++; server.stop(0); t.printStackTrace();}
-    static boolean check(boolean cond) {if (cond) pass(); else fail(); return cond;}
+
+    static boolean pass() {
+        passed++;
+        return true;
+    }
+
+    static boolean fail() {
+        failed++;
+        if (server != null) {
+            server.stop(0);
+        }
+        Thread.dumpStack();
+        return false;
+    }
+
+    static boolean fail(String msg) {
+        System.out.println(msg);
+        return fail();
+    }
+
+    static void unexpected(Throwable t) {
+        failed++;
+        if (server != null) {
+            server.stop(0);
+        }
+        t.printStackTrace();
+    }
+
+    static boolean check(boolean cond) {
+        if (cond) {
+            pass();
+        } else {
+            fail();
+        }
+        return cond;
+    }
+
     static boolean equal(Object x, Object y) {
-        if (x == null ? y == null : x.equals(y)) return pass();
-        else return fail(x + " not equal to " + y);}
+        if (x == null ? y == null : x.equals(y)) {
+            return pass();
+        } else {
+            return fail(x + " not equal to " + y);
+        }
+    }
+
     public static void main(String[] args) throws Throwable {
-        try {realMain(args);} catch (Throwable t) {unexpected(t);}
+        try {
+            realMain(args);
+        } catch (Throwable t) {
+            unexpected(t);
+        }
         System.out.println("\nPassed = " + passed + " failed = " + failed);
-        if (failed > 0) throw new AssertionError("Some tests failed");}
+        if (failed > 0) {
+            throw new AssertionError("Some tests failed");
+        }
+    }
 }
--- a/jdk/test/sun/security/krb5/auto/Basic.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/sun/security/krb5/auto/Basic.java	Wed Jul 05 22:06:46 2017 +0200
@@ -23,10 +23,13 @@
 
 /*
  * @test
- * @bug 7152176
+ * @bug 7152176 8164437
  * @summary More krb5 tests
  * @compile -XDignore.symbol.file Basic.java
- * @run main/othervm Basic
+ * @run main/othervm
+ *      Basic jdk.security.jgss
+ * @run main/othervm --limit-modules java.security.jgss,jdk.security.auth
+ *      Basic java.security.jgss
  */
 
 import sun.security.jgss.GSSUtil;
@@ -60,5 +63,12 @@
         b.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
 
         Context.handshake(s2, b);
+
+        // Bonus test for 8164437.
+        String moduleName = c.x().getClass().getModule().getName();
+        if (!moduleName.equals(args[0])) {
+            throw new Exception("Expected: " + args[0]
+                    + ". Actual: " + moduleName);
+        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/CommMatcher.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,86 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Matches the krb5 debug output:
+ * >>> KDCCommunication: kdc=host UDP:11555, timeout=100,Attempt =1, #bytes=138
+ *
+ * Example:
+ *   CommMatcher cm = new CommMatcher();
+ *   cm.addPort(12345).addPort(23456);
+ *   for (String line : debugOutput) {
+ *       if (cm.match(line)) {
+ *           println("KDC: %c, %s, Timeout: %d\n",
+ *              cm.kdc(), cm.protocol(), cm.timeout());
+ *       }
+ *   }
+ */
+public class CommMatcher {
+
+    static final Pattern re = Pattern.compile(
+            ">>> KDCCommunication: kdc=\\S+ (TCP|UDP):(\\d+), " +
+                    "timeout=(\\d+),Attempt\\s*=(\\d+)");
+
+    List<Integer> kdcPorts = new ArrayList<>();
+    Matcher matcher;
+
+    /**
+     * Add KDC ports one by one. The 1st KDC will be 'a' in {@link #kdc()},
+     * 2nd is 'b', etc, etc.
+     */
+    public CommMatcher addPort(int port) {
+        if (port > 0) {
+            kdcPorts.add(port);
+        } else {
+            kdcPorts.clear();
+        }
+        return this;
+    }
+
+    public boolean match(String line) {
+        matcher = re.matcher(line);
+        return matcher.find();
+    }
+
+    public String protocol() {
+        return matcher.group(1);
+    }
+
+    public char kdc() {
+        int port = Integer.parseInt(matcher.group(2));
+        return (char)(kdcPorts.indexOf(port) + 'a');
+    }
+
+    public int timeout() {
+        return BadKdc.toSymbolicSec(Integer.parseInt(matcher.group(3)));
+    }
+
+    public int attempt() {
+        return Integer.parseInt(matcher.group(4));
+    }
+}
--- a/jdk/test/sun/security/krb5/auto/MaxRetries.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/sun/security/krb5/auto/MaxRetries.java	Wed Jul 05 22:06:46 2017 +0200
@@ -30,6 +30,7 @@
  * @summary support max_retries in krb5.conf
  */
 
+import javax.security.auth.login.LoginException;
 import java.io.*;
 import java.net.DatagramSocket;
 import java.security.Security;
@@ -37,46 +38,86 @@
 public class MaxRetries {
 
     static int idlePort = -1;
+    static CommMatcher cm = new CommMatcher();
 
     public static void main(String[] args)
             throws Exception {
 
         System.setProperty("sun.security.krb5.debug", "true");
-        new OneKDC(null).writeJAASConf();
+        OneKDC kdc = new OneKDC(null).writeJAASConf();
 
         // An idle UDP socket to prevent PortUnreachableException
         DatagramSocket ds = new DatagramSocket();
         idlePort = ds.getLocalPort();
 
+        cm.addPort(idlePort);
+        cm.addPort(kdc.getPort());
+
         System.setProperty("java.security.krb5.conf", "alternative-krb5.conf");
 
-        // For tryLast
         Security.setProperty("krb5.kdc.bad.policy", "trylast");
+
+        // We always make the real timeout to be 1 second
+        BadKdc.setRatio(0.25f);
         rewriteMaxRetries(4);
-        test1(4000, 6);         // 1 1 1 1 2 2
-        test1(4000, 2);         // 2 2
 
+        // Explanation: In this case, max_retries=4 and timeout=4s.
+        // For AS-REQ without preauth, we will see 4 4s timeout on kdc#1
+        // ("a4" repeat 4 times), and one 4s timeout on kdc#2 ("b4"). For
+        // AS-REQ with preauth, one 4s timeout on kdc#2 (second "b4").
+        // we tolerate 4 real timeout on kdc#2, so make it "(b4){2,6}".
+        test1("a4a4a4a4b4b4", "a4a4a4a4(b4){2,6}");
+        test1("b4b4", "(b4){2,6}");
+
+        BadKdc.setRatio(1f);
         rewriteMaxRetries(1);
-        test1(1000, 3);         // 1 2 2
-        test1(1000, 2);         // 2 2
+        // Explanation: Since max_retries=1 only, we could fail in 1st or 2nd
+        // AS-REQ to kdc#2.
+        String actual = test1("a1b1b1", "(a1b1b1|a1b1x|a1b1b1x)");
+        if (actual.endsWith("x")) {
+            // If 1st attempt fails, all bads are back available
+            test1("a1b1b1", "(a1b1b1|a1b1x|a1b1b1x)");
+        } else {
+            test1("b1b1", "(b1b1|b1x|b1b1x)");
+        }
 
+        BadKdc.setRatio(0.2f);
         rewriteMaxRetries(-1);
-        test1(5000, 4);         // 1 1 2 2
-        test1(5000, 2);         // 2 2
+        test1("a5a5a5b5b5", "a5a5a5(b5){2,4}");
+        test1("b5b5", "(b5){2,4}");
 
-        // For tryLess
-        Security.setProperty("krb5.kdc.bad.policy", "tryless:1," + BadKdc.toReal(5000));
+        BadKdc.setRatio(0.25f);
+        Security.setProperty("krb5.kdc.bad.policy",
+                "tryless:1,1000");
         rewriteMaxRetries(4);
-        test1(4000, 7);         // 1 1 1 1 2 1 2
-        test1(4000, 4);         // 1 2 1 2
+        test1("a4a4a4a4b4a4b4", "a4a4a4a4(b4){1,3}a4(b4){1,3}");
+        test1("a4b4a4b4", "a4(b4){1,3}a4(b4){1,3}");
 
+        BadKdc.setRatio(1f);
         rewriteMaxRetries(1);
-        test1(1000, 4);         // 1 2 1 2
-        test1(1000, 4);         // 1 2 1 2
+        actual = test1("a1b1a1b1", "(a1b1|a1b1x|a1b1a1b1|a1b1a1b1x)");
+        if (actual.endsWith("x")) {
+            test1("a1b1a1b1", "(a1b1|a1b1x|a1b1a1b1|a1b1a1b1x)");
+        } else {
+            test1("a1b1a1b1", "(a1b1|a1b1x|a1b1a1b1|a1b1a1b1x)");
+        }
+
+        BadKdc.setRatio(.2f);
+        rewriteMaxRetries(-1);
+        test1("a5a5a5b5a5b5", "a5a5a5(b5){1,2}a5(b5){1,2}");
+        test1("a5b5a5b5", "a5(b5){1,2}a5(b5){1,2}");
 
-        rewriteMaxRetries(-1);
-        test1(5000, 5);         // 1 1 2 1 2
-        test1(5000, 4);         // 1 2 1 2
+        BadKdc.setRatio(1f);
+        rewriteMaxRetries(2);
+        if (BadKdc.toReal(2000) > 1000) {
+            // Explanation: if timeout is longer than 1s in tryLess,
+            // we will see "a1" at 2nd kdc#1 access
+            test1("a2a2b2a1b2", "a2a2(b2){1,2}a1(b2){1,2}");
+        } else {
+            test1("a2a2b2a2b2", "a2a2(b2){1,2}a2(b2){1,2}");
+        }
+
+        BadKdc.setRatio(1f);
 
         rewriteUdpPrefLimit(-1, -1);    // default, no limit
         test2("UDP");
@@ -95,32 +136,52 @@
 
     /**
      * One round of test for max_retries and timeout.
-     * @param timeout the expected timeout
-     * @param count the expected total try
+     *
+     * @param exact the expected exact match, where no timeout
+     *              happens for real KDCs
+     * @param relaxed the expected relaxed match, where some timeout
+     *                could happen for real KDCs
+     * @return the actual result
      */
-    private static void test1(int timeout, int count) throws Exception {
-        String timeoutTag = "timeout=" + BadKdc.toReal(timeout);
+    private static String test1(String exact, String relaxed) throws Exception {
         ByteArrayOutputStream bo = new ByteArrayOutputStream();
         PrintStream oldout = System.out;
         System.setOut(new PrintStream(bo));
-        Context c = Context.fromJAAS("client");
+        boolean failed = false;
+        long start = System.nanoTime();
+        try {
+            Context c = Context.fromJAAS("client");
+        } catch (LoginException e) {
+            failed = true;
+        }
         System.setOut(oldout);
 
         String[] lines = new String(bo.toByteArray()).split("\n");
-        System.out.println("----------------- TEST (" + timeout + "," +
-                count + ") -----------------");
+        System.out.println("----------------- TEST (" + exact
+                + ") -----------------");
+
+        // Result, a series of timeout + kdc#
+        StringBuilder sb = new StringBuilder();
         for (String line: lines) {
-            if (line.startsWith(">>> KDCCommunication")) {
+            if (cm.match(line)) {
                 System.out.println(line);
-                if (line.indexOf(timeoutTag) < 0) {
-                    throw new Exception("Wrong timeout value" + timeoutTag);
-                }
-                count--;
+                sb.append(cm.kdc()).append(cm.timeout());
             }
         }
-        if (count != 0) {
-            throw new Exception("Retry count is " + count + " less");
+        if (failed) {
+            sb.append("x");
         }
+        System.out.println("Time: " + (System.nanoTime() - start) / 1000000000d);
+        String actual = sb.toString();
+        System.out.println("Actual: " + actual);
+        if (actual.equals(exact)) {
+            System.out.println("Exact match: " + exact);
+        } else if (actual.matches(relaxed)) {
+            System.out.println("!!!! Tolerant match: " + relaxed);
+        } else {
+            throw new Exception("Match neither " + exact + " nor " + relaxed);
+        }
+        return actual;
     }
 
     /**
@@ -138,11 +199,11 @@
         String[] lines = new String(bo.toByteArray()).split("\n");
         System.out.println("----------------- TEST -----------------");
         for (String line: lines) {
-            if (line.startsWith(">>> KDCCommunication")) {
+            if (cm.match(line)) {
                 System.out.println(line);
                 count--;
-                if (line.indexOf(proto) < 0) {
-                    throw new Exception("Wrong timeout value");
+                if (!cm.protocol().equals(proto)) {
+                    throw new Exception("Wrong protocol value");
                 }
             }
         }
@@ -165,6 +226,7 @@
             }
             if (s.startsWith("[realms]")) {
                 // Reconfig global setting
+                fw.write("kdc_timeout = 5000\n");
                 if (global != -1) {
                     fw.write("udp_preference_limit = " + global + "\n");
                 }
@@ -183,7 +245,8 @@
 
     /**
      * Set max_retries and timeout value for realm. The global value is always
-     * 2 and 5000.
+     * 3 and 5000.
+     *
      * @param value max_retries and timeout/1000 for a realm, -1 means none.
      */
     private static void rewriteMaxRetries(int value) throws Exception {
@@ -196,7 +259,7 @@
             }
             if (s.startsWith("[realms]")) {
                 // Reconfig global setting
-                fw.write("max_retries = 2\n");
+                fw.write("max_retries = 3\n");
                 fw.write("kdc_timeout = " + BadKdc.toReal(5000) + "\n");
             } else if (s.trim().startsWith("kdc = ")) {
                 if (value != -1) {
--- a/jdk/test/sun/security/provider/SecureRandom/AbstractDrbg/SpecTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/sun/security/provider/SecureRandom/AbstractDrbg/SpecTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 8051408 8157308
+ * @bug 8051408 8157308 8130181
  * @modules java.base/sun.security.provider
  * @build java.base/sun.security.provider.S
  * @run main SpecTest
@@ -46,7 +46,7 @@
 
         // getInstance from a provider.
 
-        Provider p = new All("A", 0, "");
+        Provider p = new All("A", "0", "");
         byte[] bytes = new byte[100];
 
         // A non-DRBG
@@ -123,9 +123,9 @@
 
         // getInstance from competitive providers.
 
-        Provider l = new Legacy("L", 0, "");
-        Provider w = new Weak("W", 0, "");
-        Provider s = new Strong("S", 0, "");
+        Provider l = new Legacy("L", "0", "");
+        Provider w = new Weak("W", "0", "");
+        Provider s = new Strong("S", "0", "");
 
         Security.addProvider(l);
         Security.addProvider(w);
@@ -173,7 +173,7 @@
     }
 
     public static class All extends Provider {
-        protected All(String name, double version, String info) {
+        protected All(String name, String version, String info) {
             super(name, version, info);
             put("SecureRandom.S1", S.S1.class.getName());
             put("SecureRandom.S2", S.S2.class.getName());
@@ -183,21 +183,21 @@
 
     // Providing S with no params support
     public static class Legacy extends Provider {
-        protected Legacy(String name, double version, String info) {
+        protected Legacy(String name, String version, String info) {
             super(name, version, info);
             put("SecureRandom.S", S.S1.class.getName());
         }
     }
 
     public static class Weak extends Provider {
-        protected Weak(String name, double version, String info) {
+        protected Weak(String name, String version, String info) {
             super(name, version, info);
             put("SecureRandom.S", S.S2.class.getName());
         }
     }
 
     public static class Strong extends Provider {
-        protected Strong(String name, double version, String info) {
+        protected Strong(String name, String version, String info) {
             super(name, version, info);
             put("SecureRandom.S", S.S3.class.getName());
         }
--- a/jdk/test/sun/security/tools/jarsigner/alt/test.dummy/org/test/dummy/DummyProvider.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/alt/test.dummy/org/test/dummy/DummyProvider.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -27,7 +27,7 @@
 
 public class DummyProvider extends Provider {
     public DummyProvider() {
-        super("Dummy", 0.1, "Dummy Provider with nothing");
+        super("Dummy", "0.1", "Dummy Provider with nothing");
     }
 
     @Override
@@ -36,7 +36,7 @@
     }
 
     private DummyProvider(String arg) {
-        super("Dummy", 0.2, "Dummy Provider with " + arg);
+        super("Dummy", "0.2", "Dummy Provider with " + arg);
         //
         // KeyStore
         //
--- a/jdk/test/sun/security/tools/keytool/StartDateTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/sun/security/tools/keytool/StartDateTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -49,23 +49,31 @@
 
         new File("jks").delete();
 
-        run("-keystore jks -storetype jks -storepass changeit -keypass changeit -alias me " +
-                "-keyalg rsa -genkeypair -dname CN=Haha -startdate +1y");
-        cal.setTime(getIssueDate());
+        run("one", "+1y");
+        cal.setTime(getIssueDate("one"));
         System.out.println(cal);
         if (cal.get(Calendar.YEAR) != year + 1) {
             throw new Exception("Function check #1 fails");
         }
 
-        run("-keystore jks -storetype jks -storepass changeit -keypass changeit -alias me " +
-                "-selfcert -startdate +1m");
-        cal.setTime(getIssueDate());
+        run("two", "+1m");
+        cal.setTime(getIssueDate("two"));
         System.out.println(cal);
         if (cal.get(Calendar.MONTH) != (month + 1) % 12) {
             throw new Exception("Function check #2 fails");
         }
 
-        new File("jks").delete();
+        run("three", "2009/10/11 12:34:56");
+        cal.setTime(getIssueDate("three"));
+        System.out.println(cal);
+        if (cal.get(Calendar.YEAR) != 2009 ||
+                cal.get(Calendar.MONTH) != Calendar.OCTOBER ||
+                cal.get(Calendar.DAY_OF_MONTH) != 11 ||
+                cal.get(Calendar.HOUR_OF_DAY) != 12 ||
+                cal.get(Calendar.MINUTE) != 34 ||
+                cal.get(Calendar.SECOND) != 56) {
+            throw new Exception("Function check #3 fails");
+        }
 
         // Part 2: Test format
         Method m = sun.security.tools.keytool.Main.class.getDeclaredMethod(
@@ -129,16 +137,23 @@
         }
     }
 
-    static void run(String s) throws Exception {
-        sun.security.tools.keytool.Main.main((s+" -debug").split(" "));
+    // The keytool command line template, alias and startdate TBD
+    static String[] cmd = ("-alias tbd -startdate tbd -keystore jks " +
+            "-storetype jks -storepass changeit -keypass changeit " +
+            "-keyalg rsa -genkeypair -dname CN=Haha -debug").split(" ");
+
+    static void run(String alias, String startDate) throws Exception {
+        cmd[1] = alias;
+        cmd[3] = startDate;
+        sun.security.tools.keytool.Main.main(cmd);
     }
 
-    static Date getIssueDate() throws Exception {
+    static Date getIssueDate(String alias) throws Exception {
         KeyStore ks = KeyStore.getInstance("jks");
         try (FileInputStream fis = new FileInputStream("jks")) {
             ks.load(fis, "changeit".toCharArray());
         }
-        X509Certificate cert = (X509Certificate)ks.getCertificate("me");
+        X509Certificate cert = (X509Certificate)ks.getCertificate(alias);
         return cert.getNotBefore();
     }
 }
--- a/jdk/test/sun/security/x509/AlgorithmId/ExtensibleAlgorithmId.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/sun/security/x509/AlgorithmId/ExtensibleAlgorithmId.java	Wed Jul 05 22:06:46 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4162868
+ * @bug 4162868 8130181
  * @modules java.base/sun.security.x509
  * @run main/othervm ExtensibleAlgorithmId
  * @summary Algorithm Name-to-OID mapping needs to be made extensible.
@@ -51,7 +51,7 @@
 class TestProvider extends Provider {
 
     public TestProvider() {
-        super("Dummy", 1.0, "XYZ algorithm");
+        super("Dummy", "1.0", "XYZ algorithm");
 
         AccessController.doPrivileged(new PrivilegedAction() {
             public Object run() {
--- a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java	Thu Aug 18 21:34:24 2016 +0000
+++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java	Wed Jul 05 22:06:46 2017 +0200
@@ -40,6 +40,7 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Arrays;
+import java.util.Optional;
 import jdk.testlibrary.JDKToolLauncher;
 import jdk.testlibrary.Utils;
 import jdk.testlibrary.OutputAnalyzer;
@@ -106,12 +107,45 @@
         }
     }
 
+    public static void launchJStack() throws IOException {
+
+        if (Platform.isOSX()) {
+            // Coredump stackwalking is not implemented for Darwin
+            System.out.println("This test is not expected to work on OS X. Skipping");
+            return;
+        }
+
+        System.out.println("Starting LingeredApp");
+        try {
+            theApp = LingeredApp.startApp(Arrays.asList("-Xmx256m"));
+
+            System.out.println("Starting jstack against " + theApp.getPid());
+            JDKToolLauncher launcher = createSALauncher();
+
+            launcher.addToolArg("jstack");
+            launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
+
+            ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
+            OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);;
+            output.shouldContain("No deadlocks found");
+            output.shouldNotContain("illegal bci");
+            output.shouldNotContain("AssertionFailure");
+            output.shouldHaveExitValue(0);
+
+        } catch (Exception ex) {
+            throw new RuntimeException("Test ERROR " + ex, ex);
+        } finally {
+            LingeredApp.stopApp(theApp);
+        }
+    }
+
     /**
      *
      * @param vmArgs  - vm and java arguments to launch test app
      * @return exit code of tool
      */
-    public static void launch(String expectedMessage, List<String> toolArgs)
+    public static void launch(String expectedMessage,
+                 Optional<String> unexpectedMessage, List<String> toolArgs)
         throws IOException {
 
         System.out.println("Starting LingeredApp");
@@ -131,6 +165,7 @@
             processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
             OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);;
             output.shouldContain(expectedMessage);
+            unexpectedMessage.ifPresent(output::shouldNotContain);
             output.shouldHaveExitValue(0);
 
         } catch (Exception ex) {
@@ -140,20 +175,12 @@
         }
     }
 
-    public static void launch(String expectedMessage, String... toolArgs)
+    public static void launch(String expectedMessage,
+                              String unexpectedMessage, String... toolArgs)
         throws IOException {
 
-        launch(expectedMessage, Arrays.asList(toolArgs));
-    }
-
-    public static void launchNotOSX(String expectedMessage, String... toolArgs)
-        throws IOException {
-
-        if (Platform.isOSX()) {
-            // Coredump stackwalking is not implemented for Darwin
-            System.out.println("This test is not expected to work on OS X. Skipping");
-            return;
-        }
+        launch(expectedMessage, Optional.ofNullable(unexpectedMessage),
+                                                       Arrays.asList(toolArgs));
     }
 
     public static void testHeapDump() throws IOException {
@@ -164,7 +191,7 @@
         }
         dump.deleteOnExit();
 
-        launch("heap written to", "jmap",
+        launch("heap written to", null, "jmap",
                "--binaryheap", "--dumpfile=" + dump.getAbsolutePath());
 
         assertTrue(dump.exists() && dump.isFile(),
@@ -182,11 +209,12 @@
 
         launchCLHSDB();
 
-        launch("compiler detected", "jmap", "--clstats");
-        launchNotOSX("No deadlocks found", "jstack");
-        launch("compiler detected", "jmap");
-        launch("Java System Properties", "jinfo");
-        launch("java.threads", "jsnap");
+        launch("compiler detected", null, "jmap", "--clstats");
+        launchJStack();
+        launch("compiler detected", null, "jmap");
+        launch("Java System Properties",
+               "System Properties info not available", "jinfo");
+        launch("java.threads", null, "jsnap");
 
         testHeapDump();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/util/locale/provider/Bug8163350.java	Wed Jul 05 22:06:46 2017 +0200
@@ -0,0 +1,45 @@
+/*
+ * 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 8163350
+ * @modules java.base/sun.util.locale.provider
+ * @summary Test FALLBACK provider is not in adapter preference list when
+ * COMPAT is specified with System Property java.locale.providers.
+ * @run main/othervm  -Djava.locale.providers=COMPAT Bug8163350
+ */
+import java.util.List;
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.LocaleProviderAdapter.Type;
+
+public class Bug8163350 {
+
+    public static void main(String[] args) {
+        List<Type> preferenceList = LocaleProviderAdapter.getAdapterPreference();
+        if (preferenceList.contains(Type.FALLBACK)) {
+            throw new RuntimeException("FALLBACK Provider should not be returned in "
+                    + "adapter list " + preferenceList);
+        }
+    }
+}
--- a/make/common/Modules.gmk	Thu Aug 18 21:34:24 2016 +0000
+++ b/make/common/Modules.gmk	Wed Jul 05 22:06:46 2017 +0200
@@ -229,6 +229,7 @@
 	                       sub(/public/, ""); \
 	                       sub(/\/\/.*/, ""); \
 	                       sub(/\/\*.*\*\//, ""); \
+	                       gsub(/^ +\*.*/, ""); \
 	                       gsub(/ /, ""); \
 	                       printf(" %s", $$0) } \
 	          END        { printf("\n") }' $m \