Merge
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index 0494bf5..7c912d8 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -159,3 +159,4 @@
 5285317ebb4e8e4f6d8d52b5616fa801e2ea844d jdk8-b35
 6a6ba0a07f33d37a2f97b1107e60c6a9a69ec84d jdk8-b36
 b2972095a4b1e2a97409b7c3df61f3b263a5ce14 jdk8-b37
+d939bd0ab13c16647ffa38cc4b64fb31b7d44e10 jdk8-b38
diff --git a/corba/.hgtags b/corba/.hgtags
index 77f6215..ec31f64 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -159,3 +159,4 @@
 e3d735914edd0a621b16bb85417423f8e6af5d51 jdk8-b35
 a5a61f259961a7f46b002e5cc50b4a9bf86927b6 jdk8-b36
 83fac66442cf680bb59ec9e3a71cc4729322b595 jdk8-b37
+b8cbfb31139f820e5e094ba71449e58159fbe22e jdk8-b38
diff --git a/get_source.sh b/get_source.sh
index bc609b3..24dca4a 100644
--- a/get_source.sh
+++ b/get_source.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2012, 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,7 +26,7 @@
 #
 
 # Get clones of all nested repositories
-sh ./make/scripts/hgforest.sh clone
+sh ./make/scripts/hgforest.sh clone $*
 
 # Update all existing repositories to the latest sources
 sh ./make/scripts/hgforest.sh pull -u
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 8022f29..ae16a34 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -244,3 +244,5 @@
 50b4400ca1ecb2ac2fde35f5e53ec8f04b86be7f jdk8-b36
 bfcf92bfefb82da00f7fdbf0d9273feaa0a9456d jdk8-b37
 7d5ec8bf38d1b12e0e09ec381f10976b8beede3b hs24-b09
+637c3f5f068f88fb9ec9c5867341cf59fd5ebedc jdk8-b38
+73147e6c48813b5fee904aa33f79a77103250ff4 hs24-b10
diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version
index 3f3c7dc..dba5ab4 100644
--- a/hotspot/make/hotspot_version
+++ b/hotspot/make/hotspot_version
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=24
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=09
+HS_BUILD_NUMBER=10
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
diff --git a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
index b006240..a7cc42e 100644
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
@@ -1462,7 +1462,11 @@
       break;
 
     case Bytecodes::_l2i:
+#ifdef _LP64
+      __ movl(dest->as_register(), src->as_register_lo());
+#else
       move_regs(src->as_register_lo(), dest->as_register());
+#endif
       break;
 
     case Bytecodes::_i2b:
diff --git a/hotspot/src/os/windows/vm/jvm_windows.h b/hotspot/src/os/windows/vm/jvm_windows.h
index a45f86c..9103982 100644
--- a/hotspot/src/os/windows/vm/jvm_windows.h
+++ b/hotspot/src/os/windows/vm/jvm_windows.h
@@ -59,7 +59,7 @@
 
 #include <Tlhelp32.h>
 
-typedef unsigned int socklen_t;
+typedef int socklen_t;
 
 // #include "jni.h"
 
diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp
index de38c6c..c607905 100644
--- a/hotspot/src/os/windows/vm/os_windows.cpp
+++ b/hotspot/src/os/windows/vm/os_windows.cpp
@@ -4820,99 +4820,92 @@
   return (struct hostent*)os::WinSock2Dll::gethostbyname(name);
 }
 
-
 int os::socket_close(int fd) {
-  ShouldNotReachHere();
-  return 0;
+  return ::closesocket(fd);
 }
 
 int os::socket_available(int fd, jint *pbytes) {
-  ShouldNotReachHere();
-  return 0;
+  int ret = ::ioctlsocket(fd, FIONREAD, (u_long*)pbytes);
+  return (ret < 0) ? 0 : 1;
 }
 
 int os::socket(int domain, int type, int protocol) {
-  ShouldNotReachHere();
-  return 0;
+  return ::socket(domain, type, protocol);
 }
 
 int os::listen(int fd, int count) {
-  ShouldNotReachHere();
-  return 0;
+  return ::listen(fd, count);
 }
 
 int os::connect(int fd, struct sockaddr* him, socklen_t len) {
-  ShouldNotReachHere();
-  return 0;
+  return ::connect(fd, him, len);
 }
 
 int os::accept(int fd, struct sockaddr* him, socklen_t* len) {
-  ShouldNotReachHere();
-  return 0;
+  return ::accept(fd, him, len);
 }
 
 int os::sendto(int fd, char* buf, size_t len, uint flags,
                struct sockaddr* to, socklen_t tolen) {
-  ShouldNotReachHere();
-  return 0;
+
+  return ::sendto(fd, buf, (int)len, flags, to, tolen);
 }
 
 int os::recvfrom(int fd, char *buf, size_t nBytes, uint flags,
                  sockaddr* from, socklen_t* fromlen) {
-  ShouldNotReachHere();
-  return 0;
+
+  return ::recvfrom(fd, buf, (int)nBytes, flags, from, fromlen);
 }
 
 int os::recv(int fd, char* buf, size_t nBytes, uint flags) {
-  ShouldNotReachHere();
-  return 0;
+  return ::recv(fd, buf, (int)nBytes, flags);
 }
 
 int os::send(int fd, char* buf, size_t nBytes, uint flags) {
-  ShouldNotReachHere();
-  return 0;
+  return ::send(fd, buf, (int)nBytes, flags);
 }
 
 int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) {
-  ShouldNotReachHere();
-  return 0;
+  return ::send(fd, buf, (int)nBytes, flags);
 }
 
 int os::timeout(int fd, long timeout) {
-  ShouldNotReachHere();
-  return 0;
+  fd_set tbl;
+  struct timeval t;
+
+  t.tv_sec  = timeout / 1000;
+  t.tv_usec = (timeout % 1000) * 1000;
+
+  tbl.fd_count    = 1;
+  tbl.fd_array[0] = fd;
+
+  return ::select(1, &tbl, 0, 0, &t);
 }
 
 int os::get_host_name(char* name, int namelen) {
-  ShouldNotReachHere();
-  return 0;
+  return ::gethostname(name, namelen);
 }
 
 int os::socket_shutdown(int fd, int howto) {
-  ShouldNotReachHere();
-  return 0;
+  return ::shutdown(fd, howto);
 }
 
 int os::bind(int fd, struct sockaddr* him, socklen_t len) {
-  ShouldNotReachHere();
-  return 0;
+  return ::bind(fd, him, len);
 }
 
 int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len) {
-  ShouldNotReachHere();
-  return 0;
+  return ::getsockname(fd, him, len);
 }
 
 int os::get_sock_opt(int fd, int level, int optname,
                      char* optval, socklen_t* optlen) {
-  ShouldNotReachHere();
-  return 0;
+  return ::getsockopt(fd, level, optname, optval, optlen);
 }
 
 int os::set_sock_opt(int fd, int level, int optname,
                      const char* optval, socklen_t optlen) {
-  ShouldNotReachHere();
-  return 0;
+  return ::setsockopt(fd, level, optname, optval, optlen);
 }
 
 
diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp
index c7ea5b5..f24610c 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp
@@ -3355,7 +3355,8 @@
                                                 static_field_size,
                                                 total_oop_map_count,
                                                 access_flags,
-                                                rt, CHECK_(nullHandle));
+                                                rt, host_klass,
+                                                CHECK_(nullHandle));
     instanceKlassHandle this_klass (THREAD, ik);
 
     assert(this_klass->static_field_size() == static_field_size, "sanity");
diff --git a/hotspot/src/share/vm/memory/oopFactory.cpp b/hotspot/src/share/vm/memory/oopFactory.cpp
index fcac438..0dd6206 100644
--- a/hotspot/src/share/vm/memory/oopFactory.cpp
+++ b/hotspot/src/share/vm/memory/oopFactory.cpp
@@ -128,11 +128,12 @@
                                        int static_field_size,
                                        unsigned int nonstatic_oop_map_count,
                                        AccessFlags access_flags,
-                                       ReferenceType rt, TRAPS) {
+                                       ReferenceType rt,
+                                       KlassHandle host_klass, TRAPS) {
   instanceKlassKlass* ikk = instanceKlassKlass::cast(Universe::instanceKlassKlassObj());
   return ikk->allocate_instance_klass(name, vtable_len, itable_len,
                                       static_field_size, nonstatic_oop_map_count,
-                                      access_flags, rt, CHECK_NULL);
+                                      access_flags, rt, host_klass, CHECK_NULL);
 }
 
 
diff --git a/hotspot/src/share/vm/memory/oopFactory.hpp b/hotspot/src/share/vm/memory/oopFactory.hpp
index 61faf8e..38de1a4 100644
--- a/hotspot/src/share/vm/memory/oopFactory.hpp
+++ b/hotspot/src/share/vm/memory/oopFactory.hpp
@@ -78,7 +78,8 @@
                                            int static_field_size,
                                            unsigned int nonstatic_oop_map_count,
                                            AccessFlags access_flags,
-                                           ReferenceType rt, TRAPS);
+                                           ReferenceType rt,
+                                           KlassHandle host_klass, TRAPS);
 
   // Methods
 private:
diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp
index 33b56cf..f81c293 100644
--- a/hotspot/src/share/vm/memory/space.hpp
+++ b/hotspot/src/share/vm/memory/space.hpp
@@ -880,10 +880,17 @@
   void object_iterate_mem(MemRegion mr, UpwardsObjectClosure* cl);
   // iterates on objects up to the safe limit
   HeapWord* object_iterate_careful(ObjectClosureCareful* cl);
-  inline HeapWord* concurrent_iteration_safe_limit();
+  HeapWord* concurrent_iteration_safe_limit() {
+    assert(_concurrent_iteration_safe_limit <= top(),
+           "_concurrent_iteration_safe_limit update missed");
+    return _concurrent_iteration_safe_limit;
+  }
   // changes the safe limit, all objects from bottom() to the new
   // limit should be properly initialized
-  inline void set_concurrent_iteration_safe_limit(HeapWord* new_limit);
+  void set_concurrent_iteration_safe_limit(HeapWord* new_limit) {
+    assert(new_limit <= top(), "uninitialized objects in the safe range");
+    _concurrent_iteration_safe_limit = new_limit;
+  }
 
 #ifndef SERIALGC
   // In support of parallel oop_iterate.
diff --git a/hotspot/src/share/vm/memory/space.inline.hpp b/hotspot/src/share/vm/memory/space.inline.hpp
index 7d62476..07e6127 100644
--- a/hotspot/src/share/vm/memory/space.inline.hpp
+++ b/hotspot/src/share/vm/memory/space.inline.hpp
@@ -67,17 +67,4 @@
   return _offsets.block_start(p);
 }
 
-inline HeapWord* ContiguousSpace::concurrent_iteration_safe_limit()
-{
-  assert(_concurrent_iteration_safe_limit <= top(),
-         "_concurrent_iteration_safe_limit update missed");
-  return _concurrent_iteration_safe_limit;
-}
-
-inline void ContiguousSpace::set_concurrent_iteration_safe_limit(HeapWord* new_limit)
-{
-  assert(new_limit <= top(), "uninitialized objects in the safe range");
-  _concurrent_iteration_safe_limit = new_limit;
-}
-
 #endif // SHARE_VM_MEMORY_SPACE_INLINE_HPP
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
index aa5f776..794a7e2 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
@@ -1862,7 +1862,7 @@
       if (impl != NULL) {
         if (!is_alive->do_object_b(impl)) {
           // remove this guy
-          *start_of_implementor() = NULL;
+          *adr_implementor() = NULL;
         }
       }
     } else {
diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp
index 3126637..dd42bce 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp
@@ -78,6 +78,7 @@
 //      The embedded nonstatic oop-map blocks are short pairs (offset, length)
 //      indicating where oops are located in instances of this klass.
 //    [EMBEDDED implementor of the interface] only exist for interface
+//    [EMBEDDED host klass        ] only exist for an anonymous class (JSR 292 enabled)
 
 
 // forward declaration for class -- see below for definition
@@ -176,10 +177,6 @@
   oop             _class_loader;
   // Protection domain.
   oop             _protection_domain;
-  // Host class, which grants its access privileges to this class also.
-  // This is only non-null for an anonymous class (JSR 292 enabled).
-  // The host class is either named, or a previously loaded anonymous class.
-  klassOop        _host_klass;
   // Class signers.
   objArrayOop     _signers;
   // The InnerClasses attribute and EnclosingMethod attribute. The
@@ -234,9 +231,13 @@
   int             _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
 
   bool            _is_marked_dependent;  // used for marking during flushing and deoptimization
-  bool            _rewritten;            // methods rewritten.
-  bool            _has_nonstatic_fields; // for sizing with UseCompressedOops
-  bool            _should_verify_class;  // allow caching of preverification
+  enum {
+    _misc_rewritten            = 1 << 0, // methods rewritten.
+    _misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops
+    _misc_should_verify_class  = 1 << 2, // allow caching of preverification
+    _misc_is_anonymous         = 1 << 3  // has embedded _inner_classes field
+  };
+  u2              _misc_flags;
   u2              _minor_version;        // minor version number of class file
   u2              _major_version;        // major version number of class file
   Thread*         _init_thread;          // Pointer to current thread doing initialization (to handle recusive initialization)
@@ -276,13 +277,29 @@
   //     NULL: no implementor.
   //     A klassOop that's not itself: one implementor.
   //     Itsef: more than one implementors.
+  // embedded host klass follows here
+  //   The embedded host klass only exists in an anonymous class for
+  //   dynamic language support (JSR 292 enabled). The host class grants
+  //   its access privileges to this class also. The host class is either
+  //   named, or a previously loaded anonymous class. A non-anonymous class
+  //   or an anonymous class loaded through normal classloading does not
+  //   have this embedded field.
+  //
 
   friend class instanceKlassKlass;
   friend class SystemDictionary;
 
  public:
-  bool has_nonstatic_fields() const        { return _has_nonstatic_fields; }
-  void set_has_nonstatic_fields(bool b)    { _has_nonstatic_fields = b; }
+  bool has_nonstatic_fields() const        {
+    return (_misc_flags & _misc_has_nonstatic_fields) != 0;
+  }
+  void set_has_nonstatic_fields(bool b)    {
+    if (b) {
+      _misc_flags |= _misc_has_nonstatic_fields;
+    } else {
+      _misc_flags &= ~_misc_has_nonstatic_fields;
+    }
+  }
 
   // field sizes
   int nonstatic_field_size() const         { return _nonstatic_field_size; }
@@ -335,7 +352,7 @@
   int java_fields_count() const           { return (int)_java_fields_count; }
 
   // Number of fields including any injected fields
-  int all_fields_count() const            { return _fields->length() / sizeof(FieldInfo::field_slots); }
+  int all_fields_count() const            { return _fields->length() / FieldInfo::field_slots; }
 
   typeArrayOop fields() const              { return _fields; }
 
@@ -396,11 +413,19 @@
   bool is_in_error_state() const           { return _init_state == initialization_error; }
   bool is_reentrant_initialization(Thread *thread)  { return thread == _init_thread; }
   ClassState  init_state()                 { return (ClassState)_init_state; }
-  bool is_rewritten() const                { return _rewritten; }
+  bool is_rewritten() const                { return (_misc_flags & _misc_rewritten) != 0; }
 
   // defineClass specified verification
-  bool should_verify_class() const         { return _should_verify_class; }
-  void set_should_verify_class(bool value) { _should_verify_class = value; }
+  bool should_verify_class() const         {
+    return (_misc_flags & _misc_should_verify_class) != 0;
+  }
+  void set_should_verify_class(bool value) {
+    if (value) {
+      _misc_flags |= _misc_should_verify_class;
+    } else {
+      _misc_flags &= ~_misc_should_verify_class;
+    }
+  }
 
   // marking
   bool is_marked_dependent() const         { return _is_marked_dependent; }
@@ -469,9 +494,30 @@
   void set_protection_domain(oop pd)       { oop_store((oop*) &_protection_domain, pd); }
 
   // host class
-  oop host_klass() const                   { return _host_klass; }
-  void set_host_klass(oop host)            { oop_store((oop*) &_host_klass, host); }
-  bool is_anonymous() const                { return _host_klass != NULL; }
+  oop host_klass() const                   {
+    oop* hk = adr_host_klass();
+    if (hk == NULL) {
+      return NULL;
+    } else {
+      return *hk;
+    }
+  }
+  void set_host_klass(oop host)            {
+    assert(is_anonymous(), "not anonymous");
+    oop* addr = adr_host_klass();
+    assert(addr != NULL, "no reversed space");
+    oop_store(addr, host);
+  }
+  bool is_anonymous() const                {
+    return (_misc_flags & _misc_is_anonymous) != 0;
+  }
+  void set_is_anonymous(bool value)        {
+    if (value) {
+      _misc_flags |= _misc_is_anonymous;
+    } else {
+      _misc_flags &= ~_misc_is_anonymous;
+    }
+  }
 
   // signers
   objArrayOop signers() const              { return _signers; }
@@ -651,7 +697,7 @@
   // Access to the implementor of an interface.
   klassOop implementor() const
   {
-    klassOop* k = start_of_implementor();
+    klassOop* k = (klassOop*)adr_implementor();
     if (k == NULL) {
       return NULL;
     } else {
@@ -661,7 +707,7 @@
 
   void set_implementor(klassOop k) {
     assert(is_interface(), "not interface");
-    oop* addr = (oop*)start_of_implementor();
+    oop* addr = adr_implementor();
     oop_store_without_check(addr, k);
   }
 
@@ -717,9 +763,11 @@
   {
     return object_size(align_object_offset(vtable_length()) +
                        align_object_offset(itable_length()) +
-                       (is_interface() ?
-                        (align_object_offset(nonstatic_oop_map_size()) + (int)sizeof(klassOop)/HeapWordSize) :
-                        nonstatic_oop_map_size()));
+                       ((is_interface() || is_anonymous()) ?
+                         align_object_offset(nonstatic_oop_map_size()) :
+                         nonstatic_oop_map_size()) +
+                       (is_interface() ? (int)sizeof(klassOop)/HeapWordSize : 0) +
+                       (is_anonymous() ? (int)sizeof(klassOop)/HeapWordSize : 0));
   }
   static int vtable_start_offset()    { return header_size(); }
   static int vtable_length_offset()   { return oopDesc::header_size() + offset_of(instanceKlass, _vtable_len) / HeapWordSize; }
@@ -737,15 +785,29 @@
     return (OopMapBlock*)(start_of_itable() + align_object_offset(itable_length()));
   }
 
-  klassOop* start_of_implementor() const {
+  oop* adr_implementor() const {
     if (is_interface()) {
-      return (klassOop*)(start_of_nonstatic_oop_maps() +
-                         nonstatic_oop_map_count());
+      return (oop*)(start_of_nonstatic_oop_maps() +
+                    nonstatic_oop_map_count());
     } else {
       return NULL;
     }
   };
 
+  oop* adr_host_klass() const {
+    if (is_anonymous()) {
+      oop* adr_impl = adr_implementor();
+      if (adr_impl != NULL) {
+        return adr_impl + 1;
+      } else {
+        return (oop*)(start_of_nonstatic_oop_maps() +
+                      nonstatic_oop_map_count());
+      }
+    } else {
+      return NULL;
+    }
+  }
+
   // Allocation profiling support
   juint alloc_size() const            { return _alloc_count * size_helper(); }
   void set_alloc_size(juint n)        {}
@@ -819,7 +881,7 @@
 #else
   void set_init_state(ClassState state) { _init_state = (u1)state; }
 #endif
-  void set_rewritten()                  { _rewritten = true; }
+  void set_rewritten()                  { _misc_flags |= _misc_rewritten; }
   void set_init_thread(Thread *thread)  { _init_thread = thread; }
 
   u2 idnum_allocated_count() const      { return _idnum_allocated_count; }
@@ -852,10 +914,8 @@
   oop* adr_constants() const         { return (oop*)&this->_constants;}
   oop* adr_class_loader() const      { return (oop*)&this->_class_loader;}
   oop* adr_protection_domain() const { return (oop*)&this->_protection_domain;}
-  oop* adr_host_klass() const        { return (oop*)&this->_host_klass;}
   oop* adr_signers() const           { return (oop*)&this->_signers;}
   oop* adr_inner_classes() const     { return (oop*)&this->_inner_classes;}
-  oop* adr_implementor() const       { return (oop*)start_of_implementor(); }
   oop* adr_methods_jmethod_ids() const             { return (oop*)&this->_methods_jmethod_ids;}
   oop* adr_methods_cached_itable_indices() const   { return (oop*)&this->_methods_cached_itable_indices;}
   oop* adr_class_annotations() const   { return (oop*)&this->_class_annotations;}
diff --git a/hotspot/src/share/vm/oops/instanceKlassKlass.cpp b/hotspot/src/share/vm/oops/instanceKlassKlass.cpp
index 808b6e5..12ea223 100644
--- a/hotspot/src/share/vm/oops/instanceKlassKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlassKlass.cpp
@@ -103,7 +103,9 @@
   MarkSweep::mark_and_push(ik->adr_class_loader());
   MarkSweep::mark_and_push(ik->adr_inner_classes());
   MarkSweep::mark_and_push(ik->adr_protection_domain());
-  MarkSweep::mark_and_push(ik->adr_host_klass());
+  if (ik->adr_host_klass() != NULL) {
+    MarkSweep::mark_and_push(ik->adr_host_klass());
+  }
   MarkSweep::mark_and_push(ik->adr_signers());
   MarkSweep::mark_and_push(ik->adr_class_annotations());
   MarkSweep::mark_and_push(ik->adr_fields_annotations());
@@ -139,7 +141,9 @@
   PSParallelCompact::mark_and_push(cm, ik->adr_class_loader());
   PSParallelCompact::mark_and_push(cm, ik->adr_inner_classes());
   PSParallelCompact::mark_and_push(cm, ik->adr_protection_domain());
-  PSParallelCompact::mark_and_push(cm, ik->adr_host_klass());
+  if (ik->adr_host_klass() != NULL) {
+    PSParallelCompact::mark_and_push(cm, ik->adr_host_klass());
+  }
   PSParallelCompact::mark_and_push(cm, ik->adr_signers());
   PSParallelCompact::mark_and_push(cm, ik->adr_class_annotations());
   PSParallelCompact::mark_and_push(cm, ik->adr_fields_annotations());
@@ -177,10 +181,12 @@
   blk->do_oop(ik->adr_constants());
   blk->do_oop(ik->adr_class_loader());
   blk->do_oop(ik->adr_protection_domain());
-  blk->do_oop(ik->adr_host_klass());
+  if (ik->adr_host_klass() != NULL) {
+    blk->do_oop(ik->adr_host_klass());
+  }
   blk->do_oop(ik->adr_signers());
   blk->do_oop(ik->adr_inner_classes());
-  if (ik->is_interface()) {
+  if (ik->adr_implementor() != NULL) {
     blk->do_oop(ik->adr_implementor());
   }
   blk->do_oop(ik->adr_class_annotations());
@@ -227,15 +233,13 @@
   adr = ik->adr_protection_domain();
   if (mr.contains(adr)) blk->do_oop(adr);
   adr = ik->adr_host_klass();
-  if (mr.contains(adr)) blk->do_oop(adr);
+  if (adr != NULL && mr.contains(adr)) blk->do_oop(adr);
   adr = ik->adr_signers();
   if (mr.contains(adr)) blk->do_oop(adr);
   adr = ik->adr_inner_classes();
   if (mr.contains(adr)) blk->do_oop(adr);
-  if (ik->is_interface()) {
-    adr = ik->adr_implementor();
-    if (mr.contains(adr)) blk->do_oop(adr);
-  }
+  adr = ik->adr_implementor();
+  if (adr != NULL && mr.contains(adr)) blk->do_oop(adr);
   adr = ik->adr_class_annotations();
   if (mr.contains(adr)) blk->do_oop(adr);
   adr = ik->adr_fields_annotations();
@@ -270,10 +274,12 @@
   MarkSweep::adjust_pointer(ik->adr_constants());
   MarkSweep::adjust_pointer(ik->adr_class_loader());
   MarkSweep::adjust_pointer(ik->adr_protection_domain());
-  MarkSweep::adjust_pointer(ik->adr_host_klass());
+  if (ik->adr_host_klass() != NULL) {
+    MarkSweep::adjust_pointer(ik->adr_host_klass());
+  }
   MarkSweep::adjust_pointer(ik->adr_signers());
   MarkSweep::adjust_pointer(ik->adr_inner_classes());
-  if (ik->is_interface()) {
+  if (ik->adr_implementor() != NULL) {
     MarkSweep::adjust_pointer(ik->adr_implementor());
   }
   MarkSweep::adjust_pointer(ik->adr_class_annotations());
@@ -302,7 +308,7 @@
   }
 
   oop* hk_addr = ik->adr_host_klass();
-  if (PSScavenge::should_scavenge(hk_addr)) {
+  if (hk_addr != NULL && PSScavenge::should_scavenge(hk_addr)) {
     pm->claim_or_forward_depth(hk_addr);
   }
 
@@ -328,9 +334,13 @@
   for (oop* cur_oop = beg_oop; cur_oop < end_oop; ++cur_oop) {
     PSParallelCompact::adjust_pointer(cur_oop);
   }
-  if (ik->is_interface()) {
+  // embedded oops
+  if (ik->adr_implementor() != NULL) {
     PSParallelCompact::adjust_pointer(ik->adr_implementor());
   }
+  if (ik->adr_host_klass() != NULL) {
+    PSParallelCompact::adjust_pointer(ik->adr_host_klass());
+  }
 
   OopClosure* closure = PSParallelCompact::adjust_root_pointer_closure();
   iterate_c_heap_oops(ik, closure);
@@ -346,16 +356,23 @@
                                             int static_field_size,
                                             unsigned nonstatic_oop_map_count,
                                             AccessFlags access_flags,
-                                            ReferenceType rt, TRAPS) {
+                                            ReferenceType rt,
+                                            KlassHandle host_klass, TRAPS) {
 
   const int nonstatic_oop_map_size =
     instanceKlass::nonstatic_oop_map_size(nonstatic_oop_map_count);
   int size = align_object_offset(vtable_len) + align_object_offset(itable_len);
-  if (access_flags.is_interface()) {
-    size += align_object_offset(nonstatic_oop_map_size) + (int)sizeof(klassOop)/HeapWordSize;
+  if (access_flags.is_interface() || !host_klass.is_null()) {
+    size += align_object_offset(nonstatic_oop_map_size);
   } else {
     size += nonstatic_oop_map_size;
   }
+  if (access_flags.is_interface()) {
+    size += (int)sizeof(klassOop)/HeapWordSize;
+  }
+  if (!host_klass.is_null()) {
+    size += (int)sizeof(klassOop)/HeapWordSize;
+  }
   size = instanceKlass::object_size(size);
 
   // Allocation
@@ -389,6 +406,7 @@
     ik->set_static_field_size(static_field_size);
     ik->set_nonstatic_oop_map_size(nonstatic_oop_map_size);
     ik->set_access_flags(access_flags);
+    ik->set_is_anonymous(!host_klass.is_null());
     assert(k()->size() == size, "wrong size for object");
 
     ik->set_array_klasses(NULL);
@@ -401,7 +419,6 @@
     ik->set_constants(NULL);
     ik->set_class_loader(NULL);
     ik->set_protection_domain(NULL);
-    ik->set_host_klass(NULL);
     ik->set_signers(NULL);
     ik->set_source_file_name(NULL);
     ik->set_source_debug_extension(NULL);
@@ -503,7 +520,9 @@
   st->print(BULLET"constants:         "); ik->constants()->print_value_on(st);         st->cr();
   st->print(BULLET"class loader:      "); ik->class_loader()->print_value_on(st);      st->cr();
   st->print(BULLET"protection domain: "); ik->protection_domain()->print_value_on(st); st->cr();
-  st->print(BULLET"host class:        "); ik->host_klass()->print_value_on(st);        st->cr();
+  if (ik->host_klass() != NULL) {
+    st->print(BULLET"host class:        "); ik->host_klass()->print_value_on(st);        st->cr();
+  }
   st->print(BULLET"signers:           "); ik->signers()->print_value_on(st);           st->cr();
   if (ik->source_file_name() != NULL) {
     st->print(BULLET"source file:       ");
diff --git a/hotspot/src/share/vm/oops/instanceKlassKlass.hpp b/hotspot/src/share/vm/oops/instanceKlassKlass.hpp
index ced9451..e360d13 100644
--- a/hotspot/src/share/vm/oops/instanceKlassKlass.hpp
+++ b/hotspot/src/share/vm/oops/instanceKlassKlass.hpp
@@ -48,6 +48,7 @@
                                    unsigned int nonstatic_oop_map_count,
                                    AccessFlags access_flags,
                                    ReferenceType rt,
+                                   KlassHandle host_klass,
                                    TRAPS);
 
   // Casting from klassOop
diff --git a/hotspot/src/share/vm/opto/callGenerator.cpp b/hotspot/src/share/vm/opto/callGenerator.cpp
index 6455c81..2615321 100644
--- a/hotspot/src/share/vm/opto/callGenerator.cpp
+++ b/hotspot/src/share/vm/opto/callGenerator.cpp
@@ -137,6 +137,7 @@
   }
 
   CallStaticJavaNode *call = new (kit.C, tf()->domain()->cnt()) CallStaticJavaNode(tf(), target, method(), kit.bci());
+  _call_node = call;  // Save the call node in case we need it later
   if (!is_static) {
     // Make an explicit receiver null_check as part of this call.
     // Since we share a map with the caller, his JVMS gets adjusted.
@@ -155,7 +156,6 @@
   kit.set_edges_for_java_call(call, false, _separate_io_proj);
   Node* ret = kit.set_results_for_java_call(call, _separate_io_proj);
   kit.push_node(method()->return_type()->basic_type(), ret);
-  _call_node = call;  // Save the call node in case we need it later
   return kit.transfer_exceptions_into_jvms();
 }
 
diff --git a/hotspot/src/share/vm/opto/stringopts.cpp b/hotspot/src/share/vm/opto/stringopts.cpp
index f3220f2..496e7a8 100644
--- a/hotspot/src/share/vm/opto/stringopts.cpp
+++ b/hotspot/src/share/vm/opto/stringopts.cpp
@@ -897,8 +897,8 @@
 }
 
 Node* PhaseStringOpts::fetch_static_field(GraphKit& kit, ciField* field) {
-  const TypeKlassPtr* klass_type = TypeKlassPtr::make(field->holder());
-  Node* klass_node = __ makecon(klass_type);
+  const TypeInstPtr* mirror_type = TypeInstPtr::make(field->holder()->java_mirror());
+  Node* klass_node = __ makecon(mirror_type);
   BasicType bt = field->layout_type();
   ciType* field_klass = field->type();
 
@@ -913,6 +913,7 @@
       // and may yield a vacuous result if the field is of interface type.
       type = TypeOopPtr::make_from_constant(con, true)->isa_oopptr();
       assert(type != NULL, "field singleton type must be consistent");
+      return __ makecon(type);
     } else {
       type = TypeOopPtr::make_from_klass(field_klass->as_klass());
     }
@@ -922,7 +923,7 @@
 
   return kit.make_load(NULL, kit.basic_plus_adr(klass_node, field->offset_in_bytes()),
                        type, T_OBJECT,
-                       C->get_alias_index(klass_type->add_offset(field->offset_in_bytes())));
+                       C->get_alias_index(mirror_type->add_offset(field->offset_in_bytes())));
 }
 
 Node* PhaseStringOpts::int_stringSize(GraphKit& kit, Node* arg) {
diff --git a/hotspot/src/share/vm/opto/superword.cpp b/hotspot/src/share/vm/opto/superword.cpp
index d1d1e1c..28c4cfe 100644
--- a/hotspot/src/share/vm/opto/superword.cpp
+++ b/hotspot/src/share/vm/opto/superword.cpp
@@ -1221,12 +1221,11 @@
       return opd; // input is matching vector
     }
     assert(!opd->is_VectorStore(), "such vector is not expected here");
-    // Convert scalar input to vector. Use p0's type because it's container
-    // maybe smaller than the operand's container.
-    const Type* opd_t = velt_type(!in_bb(opd) ? p0 : opd);
-    const Type* p0_t  = velt_type(p0);
-    if (p0_t->higher_equal(opd_t)) opd_t = p0_t;
-    VectorNode* vn    = VectorNode::scalar2vector(_phase->C, opd, vlen, opd_t);
+    // Convert scalar input to vector with the same number of elements as
+    // p0's vector. Use p0's type because size of operand's container in
+    // vector should match p0's size regardless operand's size.
+    const Type* p0_t = velt_type(p0);
+    VectorNode* vn = VectorNode::scalar2vector(_phase->C, opd, vlen, p0_t);
 
     _phase->_igvn.register_new_node_with_optimizer(vn);
     _phase->set_ctrl(vn, _phase->get_ctrl(opd));
@@ -1234,14 +1233,15 @@
   }
 
   // Insert pack operation
-  const Type* opd_t = velt_type(!in_bb(opd) ? p0 : opd);
-  PackNode* pk = PackNode::make(_phase->C, opd, opd_t);
+  const Type* p0_t = velt_type(p0);
+  PackNode* pk = PackNode::make(_phase->C, opd, p0_t);
+  DEBUG_ONLY( const BasicType opd_bt = opd->bottom_type()->basic_type(); )
 
   for (uint i = 1; i < vlen; i++) {
     Node* pi = p->at(i);
     Node* in = pi->in(opd_idx);
     assert(my_pack(in) == NULL, "Should already have been unpacked");
-    assert(opd_t == velt_type(!in_bb(in) ? pi : in), "all same type");
+    assert(opd_bt == in->bottom_type()->basic_type(), "all same type");
     pk->add_opd(in);
   }
   _phase->_igvn.register_new_node_with_optimizer(pk);
diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp
index 02d1057..474090a 100644
--- a/hotspot/src/share/vm/runtime/globals.cpp
+++ b/hotspot/src/share/vm/runtime/globals.cpp
@@ -148,6 +148,8 @@
     st->print("-XX:%s=" UINTX_FORMAT, name, get_uintx());
   } else if (is_uint64_t()) {
     st->print("-XX:%s=" UINT64_FORMAT, name, get_uint64_t());
+  } else if (is_double()) {
+    st->print("-XX:%s=%f", name, get_double());
   } else if (is_ccstr()) {
     st->print("-XX:%s=", name);
     const char* cp = get_ccstr();
diff --git a/hotspot/test/compiler/7070134/Stemmer.java b/hotspot/test/compiler/7070134/Stemmer.java
index c7edb75..49484f9 100644
--- a/hotspot/test/compiler/7070134/Stemmer.java
+++ b/hotspot/test/compiler/7070134/Stemmer.java
@@ -13,7 +13,18 @@
        Porter, 1980, An algorithm for suffix stripping, Program, Vol. 14,
        no. 3, pp 130-137,
 
-   See also http://www.tartarus.org/~martin/PorterStemmer
+   http://www.tartarus.org/~martin/PorterStemmer
+
+   The software is completely free for any purpose, unless notes at the head
+   of the program text indicates otherwise (which is rare). In any case,
+   the notes about licensing are never more restrictive than the BSD License.
+
+   In every case where the software is not written by me (Martin Porter),
+   this licensing arrangement has been endorsed by the contributor, and it is
+   therefore unnecessary to ask the contributor again to confirm it.
+
+   I have not asked any contributors (or their employers, if they have them)
+   for proofs that they have the right to distribute their software in this way.
 
    History:
 
diff --git a/hotspot/test/compiler/7160610/Test7160610.java b/hotspot/test/compiler/7160610/Test7160610.java
new file mode 100644
index 0000000..62b2e6e
--- /dev/null
+++ b/hotspot/test/compiler/7160610/Test7160610.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012, 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 7160610
+ * @summary Unknown Native Code compilation issue.
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill Test7160610
+ */
+
+public class Test7160610 {
+  private static final byte[] BYTE_ARRAY = new byte[7];
+  private static int[] anIntArray1190 = new int[32768];
+  private static int[] anIntArray1191 = new int[32768];
+
+  public static void main(String arg[]) {
+    int i = 256;
+    for(int j = BYTE_ARRAY[2]; j < anIntArray1190.length; j++) {
+      anIntArray1190[j] = BYTE_ARRAY[2];
+    }
+
+    for(int k = BYTE_ARRAY[2]; (k ^ BYTE_ARRAY[1]) > -5001; k++) {
+      int i1 = (int)(Math.random() * 128D * (double)i);
+      anIntArray1190[i1] = (int)(Math.random() * 256D);
+    }
+
+    for(int l = BYTE_ARRAY[2]; (l ^ BYTE_ARRAY[1]) > -21; l++) {
+      for(int j1 = BYTE_ARRAY[0]; j1 < i + -BYTE_ARRAY[0]; j1++) {
+        for(int k1 = BYTE_ARRAY[0]; (k1 ^ BYTE_ARRAY[1]) > -128; k1++) {
+          int l1 = k1 - -(j1 << 0x26cb6487);
+          anIntArray1191[l1] = (anIntArray1190[l1 + -BYTE_ARRAY[0]] - -anIntArray1190[l1 - -BYTE_ARRAY[0]] - -anIntArray1190[-128 + l1] - -anIntArray1190[128 + l1]) / BYTE_ARRAY[6];
+        }
+      }
+      int ai[] = anIntArray1190;
+      anIntArray1190 = anIntArray1191;
+      anIntArray1191 = ai;
+    }
+  }
+
+  static {
+    BYTE_ARRAY[6] = 4;
+    BYTE_ARRAY[5] = 5;
+    BYTE_ARRAY[4] = 3;
+    BYTE_ARRAY[3] = 2;
+    BYTE_ARRAY[2] = 0;
+    BYTE_ARRAY[1] = -1;
+    BYTE_ARRAY[0] = 1;
+  }
+}
diff --git a/hotspot/test/runtime/7167069/PrintAsFlag.java b/hotspot/test/runtime/7167069/PrintAsFlag.java
new file mode 100644
index 0000000..bf8747e
--- /dev/null
+++ b/hotspot/test/runtime/7167069/PrintAsFlag.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ */
+
+/*
+ * Note that in the run command below the only important flag is PrintCommandLineFlags.
+ * The others are just flags of all types; bool, intx, uintx, uint64_t, double and ccstr.
+ *
+ * @test PrintAsFlag
+ * @summary verify that Flag::print_as_flag() works correctly. This is used by "jinfo -flag" and -XX:+PrintCommandLineFlags.
+ * @run main/othervm -XX:+PrintCommandLineFlags -XX:-ShowMessageBoxOnError -XX:BiasedLockingStartupDelay=4000 -XX:ParallelGCThreads=4 -XX:MaxRAM=1G -XX:CMSSmallCoalSurplusPercent=1.05 -XX:ErrorFile="file" PrintAsFlag
+ */
+
+public class PrintAsFlag {
+  public static void main(String... args) {
+    System.out.printf("Done");
+  }
+}
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index 60e8272..c8892c3 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -159,3 +159,4 @@
 e187f3ede64965dc2979df9a211107cd3d38eacb jdk8-b35
 cfd288fe1d3e2b700838342e70d71d44ac991af5 jdk8-b36
 90204bfab4e2bed402badcc997cbf8446ab5669f jdk8-b37
+5bbe0cb6f2f2d7ce292da77bf4fa9d618d770a78 jdk8-b38
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index 30267c2..6513a49 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -159,3 +159,4 @@
 e8afc16522e190cb93c66bcb15d6fba0fe9e6833 jdk8-b35
 89b36c658e39f0a2957be55453a3a3befd9c8a6b jdk8-b36
 b05a948db1b6c933c980f24e4dc8fd897b7cf4ef jdk8-b37
+ac1ba3b56775e3cdcd91b7a48793b59f6a3c18b5 jdk8-b38
diff --git a/jdk/.hgtags b/jdk/.hgtags
index dbcbbd5..296cc4b 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -159,3 +159,4 @@
 2e3e1356ffbddb2ae95c08da72830ba9ab8b3181 jdk8-b35
 45da9cb055ee258dc09e69c1718e27eadea38e45 jdk8-b36
 9e82ac15ab80370d6e021aea7b98c7c9626adb5e jdk8-b37
+c45f3509a70796c54b48f32910d1caf435763416 jdk8-b38
diff --git a/jdk/make/common/Release.gmk b/jdk/make/common/Release.gmk
index d8ec1b7..4d8ddb1 100644
--- a/jdk/make/common/Release.gmk
+++ b/jdk/make/common/Release.gmk
@@ -156,6 +156,7 @@
         jstack.1           \
         jstat.1            \
         jstatd.1           \
+        jvisualvm.1        \
 	native2ascii.1     \
 	rmic.1             \
         schemagen.1        \
@@ -1311,8 +1312,8 @@
 	@$(java-vm-cleanup)
 
 # Clean up names in the messages printed out
-CAT_FILTER = $(SED) -e "s@$(JDK_IMAGE_DIR)@JDK_IMAGE@g" \
-	            -e "s@$(JRE_IMAGE_DIR)@JRE_IMAGE@g"
+CAT_FILTER = $(SED) -e "s|$(JDK_IMAGE_DIR)|JDK_IMAGE|g" \
+	            -e "s|$(JRE_IMAGE_DIR)|JRE_IMAGE|g"
 
 # Report on the jre image comparison
 compare-image-jre: $(TEMP_PREV_JRE_COMPARISON)
diff --git a/langtools/.hgtags b/langtools/.hgtags
index 82ba71b..e3d8e55 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -159,3 +159,4 @@
 defd666a786334465496c8901fa302b779c7e045 jdk8-b35
 94bbaa67686f44a124cd16fd9f1e8a6a3f684d2d jdk8-b36
 5891b38985e8b2502296fc29e726b527d03116d2 jdk8-b37
+1f224f160aa852c9541380735a27a3439dfb7217 jdk8-b38
diff --git a/make/scripts/hgforest.sh b/make/scripts/hgforest.sh
index 7834826..515f1b5 100644
--- a/make/scripts/hgforest.sh
+++ b/make/scripts/hgforest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,8 @@
 #
 
 # Shell script for a fast parallel forest command
+command="$1"
+pull_extra_base="$2"
 
 tmp=/tmp/forest.$$
 rm -f -r ${tmp}
@@ -35,40 +37,58 @@
 
 # Only look in specific locations for possible forests (avoids long searches)
 pull_default=""
-if [ "$1" = "clone" -o "$1" = "fclone" ] ; then
+repos=""
+repos_extra=""
+if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then
   subrepos="corba jaxp jaxws langtools jdk hotspot"
   if [ -f .hg/hgrc ] ; then
     pull_default=`hg paths default`
+    if [ "${pull_default}" = "" ] ; then
+      echo "ERROR: Need initial clone with 'hg paths default' defined"
+      exit 1
+    fi
   fi
   if [ "${pull_default}" = "" ] ; then
-    echo "ERROR: Need initial clone with 'hg paths default' defined"
+    echo "ERROR: Need initial repository to use this script"
     exit 1
   fi
-  repos=""
   for i in ${subrepos} ; do
     if [ ! -f ${i}/.hg/hgrc ] ; then
       repos="${repos} ${i}"
     fi
   done
+  if [ "${pull_extra_base}" != "" ] ; then
+    subrepos_extra="jdk/src/closed jdk/make/closed jdk/test/closed hotspot/src/closed hotspot/test/closed deploy install sponsors pubs"
+    pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'`
+    pull_extra="${pull_extra_base}/${pull_default_tail}"
+    for i in ${subrepos_extra} ; do
+      if [ ! -f ${i}/.hg/hgrc ] ; then
+        repos_extra="${repos_extra} ${i}"
+      fi
+    done
+  fi
   at_a_time=2
+  # Any repos to deal with?
+  if [ "${repos}" = "" -a "${repos_extra}" = "" ] ; then
+    echo "No repositories to clone."
+    exit
+  fi
 else
   hgdirs=`ls -d ./.hg ./*/.hg ./*/*/.hg ./*/*/*/.hg ./*/*/*/*/.hg 2>/dev/null`
   # Derive repository names from the .hg directory locations
-  repos=""
   for i in ${hgdirs} ; do
     repos="${repos} `echo ${i} | sed -e 's@/.hg$@@'`"
   done
   at_a_time=8
+  # Any repos to deal with?
+  if [ "${repos}" = "" ] ; then
+    echo "No repositories to process."
+    exit
+  fi
 fi
 
-# Any repos to deal with?
-if [ "${repos}" = "" ] ; then
-  echo "No repositories to process."
-  exit
-fi
-
-# Echo out what repositories we will process
-echo "# Repos: ${repos}"
+# Echo out what repositories we will clone
+echo "# Repos: ${repos} ${repos_extra}"
 
 # Run the supplied command on all repos in parallel, save output until end
 n=0
@@ -77,8 +97,8 @@
   n=`expr ${n} '+' 1`
   (
     (
-      if [ "$1" = "clone" -o "$1" = "fclone" ] ; then
-        cline="hg $* ${pull_default}/${i} ${i}"
+      if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then
+        cline="hg clone ${pull_default}/${i} ${i}"
         echo "# ${cline}"
         ( eval "${cline}" )
       else
@@ -92,6 +112,22 @@
     sleep 5
   fi
 done
+if [ "${repos_extra}" != "" ] ; then
+  for i in ${repos_extra} ; do
+    echo "Starting on ${i}"
+    n=`expr ${n} '+' 1`
+    (
+      (
+          cline="hg clone ${pull_extra}/${i} ${i}"
+          echo "# ${cline}"
+          ( eval "${cline}" )
+        echo "# exit code $?"
+      ) > ${tmp}/repo.${n} 2>&1 ; cat ${tmp}/repo.${n} ) &
+    if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then
+      sleep 5
+    fi
+  done
+fi
 
 # Wait for all hg commands to complete
 wait