Merge
authorcoleenp
Wed, 15 Nov 2017 08:25:28 -0500
changeset 47896 7092940fbaff
parent 47895 a879c04d61ea (current diff)
parent 47893 ef2e9b041e32 (diff)
child 47897 eb3696e0c6d8
child 47903 7f22774a5f42
Merge
make/mapfiles/libextnet/mapfile-vers
src/hotspot/share/gc/g1/g1MarkSweep.cpp
src/hotspot/share/gc/g1/g1MarkSweep.hpp
src/hotspot/share/gc/g1/g1MarkSweep_ext.cpp
src/hotspot/share/gc/g1/g1RemSet.inline.hpp
src/hotspot/share/gc/g1/g1SerialFullCollector.cpp
src/hotspot/share/gc/g1/g1SerialFullCollector.hpp
test/hotspot/jtreg/TEST.groups
--- a/.hgtags	Wed Nov 15 08:14:56 2017 -0500
+++ b/.hgtags	Wed Nov 15 08:25:28 2017 -0500
@@ -455,3 +455,4 @@
 92f08900cb3c0d694e5c529a676c1c9e5909193f jdk-10+28
 a6e591e12f122768f675428e1e5a838fd0e9c7ec jdk-10+29
 8fee80b92e65149f7414250fd5e34b6f35d417b4 jdk-10+30
+e6278add9ff28fab70fe1cc4c1d65f7363dc9445 jdk-10+31
--- a/make/CreateJmods.gmk	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/CreateJmods.gmk	Wed Nov 15 08:25:28 2017 -0500
@@ -80,8 +80,8 @@
 endif
 
 LEGAL_NOTICES := \
-    $(SUPPORT_OUTPUTDIR)/modules_legal/java.base \
-    $(call FindModuleLegalDirs, $(MODULE)) \
+    $(call uniq, $(SUPPORT_OUTPUTDIR)/modules_legal/java.base \
+    $(call FindModuleLegalDirs, $(MODULE))) \
     #
 
 LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES))
--- a/make/common/Modules.gmk	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/common/Modules.gmk	Wed Nov 15 08:25:28 2017 -0500
@@ -409,8 +409,10 @@
 # $1 - Module to find legal dirs for
 FindModuleLegalDirs = \
     $(strip $(wildcard \
-        $(addsuffix /$(strip $1), $(IMPORT_MODULES_LEGAL)) \
-        $(foreach sub, $(LEGAL_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS)))))
+        $(addsuffix /$(strip $1), $(SUPPORT_OUTPUTDIR)/modules_legal \
+            $(IMPORT_MODULES_LEGAL)) \
+        $(foreach sub, $(LEGAL_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS))) \
+    ))
 
 ################################################################################
 
--- a/make/data/tzdata/VERSION	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/data/tzdata/VERSION	Wed Nov 15 08:25:28 2017 -0500
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2017b
+tzdata2017c
--- a/make/data/tzdata/africa	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/data/tzdata/africa	Wed Nov 15 08:25:28 2017 -0500
@@ -49,7 +49,7 @@
 #
 # For data circa 1899, a common source is:
 # Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
-# http://www.jstor.org/stable/1774359
+# https://www.jstor.org/stable/1774359
 #
 # A reliable and entertaining source about time zones is
 # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
@@ -241,7 +241,7 @@
 # saving time in Egypt will end in the night of 2007-09-06 to 2007-09-07.
 # From Jesper Nørgaard Welen (2007-08-15): [The following agree:]
 # http://www.nentjes.info/Bill/bill5.htm
-# http://www.timeanddate.com/worldclock/city.html?n=53
+# https://www.timeanddate.com/worldclock/city.html?n=53
 # From Steffen Thorsen (2007-09-04): The official information...:
 # http://www.sis.gov.eg/En/EgyptOnline/Miscellaneous/000002/0207000000000000001580.htm
 Rule	Egypt	2007	only	-	Sep	Thu>=1	24:00	0	-
@@ -279,8 +279,8 @@
 # timeanddate[2] and another site I've found[3] also support that.
 #
 # [1] https://bugzilla.redhat.com/show_bug.cgi?id=492263
-# [2] http://www.timeanddate.com/worldclock/clockchange.html?n=53
-# [3] http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
+# [2] https://www.timeanddate.com/worldclock/clockchange.html?n=53
+# [3] https://wwp.greenwichmeantime.com/time-zone/africa/egypt/
 
 # From Arthur David Olson (2009-04-20):
 # In 2009 (and for the next several years), Ramadan ends before the fourth
@@ -290,10 +290,10 @@
 # From Steffen Thorsen (2009-08-11):
 # We have been able to confirm the August change with the Egyptian Cabinet
 # Information and Decision Support Center:
-# http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html
+# https://www.timeanddate.com/news/time/egypt-dst-ends-2009.html
 #
 # The Middle East News Agency
-# http://www.mena.org.eg/index.aspx
+# https://www.mena.org.eg/index.aspx
 # also reports "Egypt starts winter time on August 21"
 # today in article numbered "71, 11/08/2009 12:25 GMT."
 # Only the title above is available without a subscription to their service,
@@ -343,7 +343,7 @@
 # Thursday of April....  Clocks will still be turned back for Ramadan, but
 # dates not yet announced....
 # http://almogaz.com/news/weird-news/2015/04/05/1947105 ...
-# http://www.timeanddate.com/news/time/egypt-starts-dst-2015.html
+# https://www.timeanddate.com/news/time/egypt-starts-dst-2015.html
 
 # From Ahmed Nazmy (2015-04-20):
 # Egypt's ministers cabinet just announced ... that it will cancel DST at
@@ -470,11 +470,11 @@
 
 # From Even Scharning (2012-11-10):
 # Libya set their time one hour back at 02:00 on Saturday November 10.
-# http://www.libyaherald.com/2012/11/04/clocks-to-go-back-an-hour-on-saturday/
+# https://www.libyaherald.com/2012/11/04/clocks-to-go-back-an-hour-on-saturday/
 # Here is an official source [in Arabic]: http://ls.ly/fb6Yc
 #
 # Steffen Thorsen forwarded a translation (2012-11-10) in
-# http://mm.icann.org/pipermail/tz/2012-November/018451.html
+# https://mm.icann.org/pipermail/tz/2012-November/018451.html
 #
 # From Tim Parenti (2012-11-11):
 # Treat the 2012-11-10 change as a zone change from UTC+2 to UTC+1.
@@ -485,7 +485,7 @@
 # From Even Scharning (2013-10-25):
 # The scheduled end of DST in Libya on Friday, October 25, 2013 was
 # cancelled yesterday....
-# http://www.libyaherald.com/2013/10/24/correction-no-time-change-tomorrow/
+# https://www.libyaherald.com/2013/10/24/correction-no-time-change-tomorrow/
 #
 # From Paul Eggert (2013-10-25):
 # For now, assume they're reverting to the pre-2012 rules of permanent UT +02.
@@ -538,7 +538,7 @@
 # basis....
 # It seems that Mauritius observed daylight saving time from 1982-10-10 to
 # 1983-03-20 as well, but that was not successful....
-# http://www.timeanddate.com/news/time/mauritius-daylight-saving-time.html
+# https://www.timeanddate.com/news/time/mauritius-daylight-saving-time.html
 
 # From Alex Krivenyshev (2008-06-25):
 # http://economicdevelopment.gov.mu/portal/site/Mainhomepage/menuitem.a42b24128104d9845dabddd154508a0c/?content_id=0a7cee8b5d69a110VgnVCM1000000a04a8c0RCRD
@@ -606,7 +606,7 @@
 # http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-%C3%A9conomie-d-%C3%A9nergie-de-l-heure-d-%C3%A9t%C3%A9-ont-%C3%A9t%C3%A9-atteints-
 #
 # Our wrap-up:
-# http://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html
+# https://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html
 
 # From Arthur David Olson (2009-07-11):
 # The "mauritius-dst-will-not-repeat" wrapup includes this:
@@ -638,7 +638,7 @@
 # be one hour ahead of GMT between 1 June and 27 September, according to
 # Communication Minister and Government Spokesman, Khalid Naciri...."
 #
-# http://www.worldtimezone.net/dst_news/dst_news_morocco01.html
+# http://www.worldtimezone.com/dst_news/dst_news_morocco01.html
 # http://en.afrik.com/news11892.html
 
 # From Alex Krivenyshev (2008-05-09):
@@ -651,7 +651,7 @@
 
 # From Patrice Scattolin (2008-05-09):
 # According to this article:
-# http://www.avmaroc.com/actualite/heure-dete-comment-a127896.html
+# https://www.avmaroc.com/actualite/heure-dete-comment-a127896.html
 # (and republished here: <http://www.actu.ma/heure-dete-comment_i127896_0.html>)
 # the changes occur at midnight:
 #
@@ -673,7 +673,7 @@
 # posted in English).
 #
 # The following Google query will generate many relevant hits:
-# http://www.google.com/search?hl=en&q=Conseil+de+gouvernement+maroc+heure+avance&btnG=Search
+# https://www.google.com/search?hl=en&q=Conseil+de+gouvernement+maroc+heure+avance&btnG=Search
 
 # From Steffen Thorsen (2008-08-27):
 # Morocco will change the clocks back on the midnight between August 31
@@ -684,7 +684,7 @@
 # http://www.menara.ma/fr/Actualites/Maroc/Societe/ci.retour_a_l_heure_gmt_a_partir_du_dimanche_31_aout_a_minuit_officiel_.default
 #
 # We have some further details posted here:
-# http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html
+# https://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html
 
 # From Steffen Thorsen (2009-03-17):
 # Morocco will observe DST from 2009-06-01 00:00 to 2009-08-21 00:00 according
@@ -694,7 +694,7 @@
 # (French)
 #
 # Our summary:
-# http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html
+# https://www.timeanddate.com/news/time/morocco-starts-dst-2009.html
 
 # From Alexander Krivenyshev (2009-03-17):
 # Here is a link to official document from Royaume du Maroc Premier Ministre,
@@ -717,7 +717,7 @@
 # http://www.lavieeco.com/actualites/4099-le-maroc-passera-a-l-heure-d-ete-gmt1-le-2-mai.html
 # (French)
 # Our page:
-# http://www.timeanddate.com/news/time/morocco-starts-dst-2010.html
+# https://www.timeanddate.com/news/time/morocco-starts-dst-2010.html
 
 # From Dan Abitol (2011-03-30):
 # ...Rules for Africa/Casablanca are the following (24h format)
@@ -734,7 +734,7 @@
 # They said that the decision was already taken.
 #
 # More articles in the press
-# http://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-leve.html
+# https://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-leve.html
 # http://www.lematin.ma/Actualite/Express/Article.asp?id=148923
 # http://www.lavieeco.com/actualite/Le-Maroc-passe-sur-GMT%2B1-a-partir-de-dim
 
@@ -826,7 +826,7 @@
 # 1433 (18 April 2012) and the decision of the Head of Government of
 # 16 N. 3-29-15 Chaaban 1435 (4 June 2015).
 # Source (french):
-# http://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/
+# https://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/
 #
 # From Milamber (2015-06-09):
 # http://www.mmsp.gov.ma/fr/actualites.aspx?id=863
@@ -835,7 +835,7 @@
 # [The gov.ma announcement] would (probably) make the switch on 2015-07-19 go
 # from 03:00 to 04:00 rather than from 02:00 to 03:00, as in the patch....
 # I think the patch is correct and the quoted text is wrong; the text in
-# <http://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/> agrees
+# <https://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/> agrees
 # with the patch.
 
 # From Paul Eggert (2015-06-08):
@@ -960,9 +960,17 @@
 Link Africa/Maputo Africa/Lubumbashi	# E Dem. Rep. of Congo
 Link Africa/Maputo Africa/Lusaka	# Zambia
 
+
 # Namibia
-# The 1994-04-03 transition is from Shanks & Pottenger.
-# Shanks & Pottenger report no DST after 1998-04; go with IATA.
+
+# From Arthur David Olson (2017-08-09):
+# The text of the "Namibia Time Act, 1994" is available online at
+# www.lac.org.na/laws/1994/811.pdf
+# and includes this nugget:
+# Notwithstanding the provisions of subsection (2) of section 1, the
+# first winter period after the commencement of this Act shall
+# commence at OOhOO on Monday 21 March 1994 and shall end at 02h00 on
+# Sunday 4 September 1994.
 
 # From Petronella Sibeene (2007-03-30):
 # http://allafrica.com/stories/200703300178.html
@@ -978,19 +986,30 @@
 # observes Botswana time, we have no details about historical practice.
 # In the meantime people there can use Africa/Gaborone.
 # See: Immanuel S. The Namibian. 2017-02-23.
-# http://www.namibian.com.na/51480/read/Time-change-divides-lawmakers
+# https://www.namibian.com.na/51480/read/Time-change-divides-lawmakers
+
+# From Steffen Thorsen (2017-08-09):
+# Namibia is going to change their time zone to what is now their DST:
+# https://www.newera.com.na/2017/02/23/namibias-winter-time-might-be-repealed/
+# This video is from the government decision:
+# https://www.nbc.na/news/na-passes-namibia-time-bill-repealing-1994-namibia-time-act.8665
+# We have made the assumption so far that they will change their time zone at
+# the same time they would normally start DST, the first Sunday in September:
+# https://www.timeanddate.com/news/time/namibia-new-time-zone.html
 
 # RULE	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-Rule	Namibia	1994	max	-	Sep	Sun>=1	2:00	1:00	S
-Rule	Namibia	1995	max	-	Apr	Sun>=1	2:00	0	-
+Rule	Namibia	1994	only	-	Mar	21	0:00	0	-
+Rule	Namibia	1994	2016	-	Sep	Sun>=1	2:00	1:00	S
+Rule	Namibia	1995	2017	-	Apr	Sun>=1	2:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Windhoek	1:08:24 -	LMT	1892 Feb 8
 			1:30	-	+0130	1903 Mar
 			2:00	-	SAST	1942 Sep 20  2:00
 			2:00	1:00	SAST	1943 Mar 21  2:00
 			2:00	-	SAST	1990 Mar 21 # independence
-			2:00	-	CAT	1994 Apr  3
-			1:00	Namibia	WA%sT
+			2:00	-	CAT	1994 Mar 21  0:00
+			1:00	Namibia	WA%sT	2017 Sep  3  2:00
+			2:00	-	CAT
 
 # Niger
 # See Africa/Lagos.
@@ -1077,14 +1096,24 @@
 # no information
 
 # Sudan
-#
+
 # From <http://www.sunanews.net/sn13jane.html>
 # Sudan News Agency (2000-01-13),
 # also reported by Michaël De Beukelaer-Dossche via Steffen Thorsen:
 # Clocks will be moved ahead for 60 minutes all over the Sudan as of noon
 # Saturday....  This was announced Thursday by Caretaker State Minister for
 # Manpower Abdul-Rahman Nur-Eddin.
+
+# From Ahmed Atyya, National Telecommunications Corp. (NTC), Sudan (2017-10-17):
+# ... the Republic of Sudan is going to change the time zone from (GMT+3:00)
+# to (GMT+ 2:00) starting from Wednesday 1 November 2017.
 #
+# From Paul Eggert (2017-10-18):
+# A scanned copy (in Arabic) of Cabinet Resolution No. 352 for the
+# year 2017 can be found as an attachment in email today from Yahia
+# Abdalla of NTC, archived at:
+# https://mm.icann.org/pipermail/tz/2017-October/025333.html
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Sudan	1970	only	-	May	 1	0:00	1:00	S
 Rule	Sudan	1970	1985	-	Oct	15	0:00	0	-
@@ -1093,10 +1122,14 @@
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Khartoum	2:10:08 -	LMT	1931
 			2:00	Sudan	CA%sT	2000 Jan 15 12:00
-			3:00	-	EAT
+			3:00	-	EAT	2017 Nov  1
+			2:00	-	CAT
 
 # South Sudan
-Link Africa/Khartoum Africa/Juba
+# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
+Zone	Africa/Juba	2:06:28 -	LMT	1931
+			2:00	Sudan	CA%sT	2000 Jan 15 12:00
+			3:00	-	EAT
 
 # Swaziland
 # See Africa/Johannesburg.
@@ -1134,11 +1167,11 @@
 # According to several news sources, Tunisia will not observe DST this year.
 # (Arabic)
 # http://www.elbashayer.com/?page=viewn&nid=42546
-# http://www.babnet.net/kiwidetail-15295.asp
+# https://www.babnet.net/kiwidetail-15295.asp
 #
 # We have also confirmed this with the US embassy in Tunisia.
 # We have a wrap-up about this on the following page:
-# http://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html
+# https://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html
 
 # From Alexander Krivenyshev (2009-03-17):
 # Here is a link to Tunis Afrique Presse News Agency
--- a/make/data/tzdata/antarctica	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/data/tzdata/antarctica	Wed Nov 15 08:25:28 2017 -0500
@@ -49,7 +49,7 @@
 # Heard Island, McDonald Islands (uninhabited)
 #	previously sealers and scientific personnel wintered
 #	Margaret Turner reports
-#	http://web.archive.org/web/20021204222245/http://www.dstc.qut.edu.au/DST/marg/daylight.html
+#	https://web.archive.org/web/20021204222245/http://www.dstc.qut.edu.au/DST/marg/daylight.html
 #	(1999-09-30) that they're UT +05, with no DST;
 #	presumably this is when they have visitors.
 #
@@ -70,7 +70,7 @@
 # http://www.aad.gov.au/default.asp?casid=37079
 #
 # We have more background information here:
-# http://www.timeanddate.com/news/time/antarctica-new-times.html
+# https://www.timeanddate.com/news/time/antarctica-new-times.html
 
 # From Steffen Thorsen (2010-03-10):
 # We got these changes from the Australian Antarctic Division: ...
@@ -85,7 +85,7 @@
 # - Mawson station stays on UTC+5.
 #
 # Background:
-# http://www.timeanddate.com/news/time/antartica-time-changes-2010.html
+# https://www.timeanddate.com/news/time/antartica-time-changes-2010.html
 
 # From Steffen Thorsen (2016-10-28):
 # Australian Antarctica Division informed us that Casey changed time
@@ -168,7 +168,7 @@
 #
 # year-round base in the main continent
 # Dumont d'Urville, Île des Pétrels, -6640+14001, since 1956-11
-# <http://en.wikipedia.org/wiki/Dumont_d'Urville_Station> (2005-12-05)
+# <https://en.wikipedia.org/wiki/Dumont_d'Urville_Station> (2005-12-05)
 #
 # Another base at Port-Martin, 50km east, began operation in 1947.
 # It was destroyed by fire on 1952-01-14.
--- a/make/data/tzdata/asia	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/data/tzdata/asia	Wed Nov 15 08:25:28 2017 -0500
@@ -49,7 +49,7 @@
 #
 # For data circa 1899, a common source is:
 # Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
-# http://www.jstor.org/stable/1774359
+# https://www.jstor.org/stable/1774359
 #
 # For Russian data circa 1919, a source is:
 # Byalokoz EL. New Counting of Time in Russia since July 1, 1919.
@@ -98,8 +98,8 @@
 Rule RussiaAsia	1981	1984	-	Apr	1	 0:00	1:00	S
 Rule RussiaAsia	1981	1983	-	Oct	1	 0:00	0	-
 Rule RussiaAsia	1984	1995	-	Sep	lastSun	 2:00s	0	-
-Rule RussiaAsia	1985	2011	-	Mar	lastSun	 2:00s	1:00	S
-Rule RussiaAsia	1996	2011	-	Oct	lastSun	 2:00s	0	-
+Rule RussiaAsia	1985	2010	-	Mar	lastSun	 2:00s	1:00	S
+Rule RussiaAsia	1996	2010	-	Oct	lastSun	 2:00s	0	-
 
 # Afghanistan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -132,13 +132,17 @@
 # or
 # (brief)
 # http://www.worldtimezone.com/dst_news/dst_news_armenia03.html
+# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
+Rule Armenia	2011	only	-	Mar	lastSun	 2:00s	1:00	S
+Rule Armenia	2011	only	-	Oct	lastSun	 2:00s	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Yerevan	2:58:00 -	LMT	1924 May  2
 			3:00	-	+03	1957 Mar
 			4:00 RussiaAsia +04/+05	1991 Mar 31  2:00s
 			3:00 RussiaAsia	+03/+04	1995 Sep 24  2:00s
 			4:00	-	+04	1997
-			4:00 RussiaAsia	+04/+05
+			4:00 RussiaAsia	+04/+05	2011
+			4:00	Armenia	+04/+05
 
 # Azerbaijan
 
@@ -150,7 +154,7 @@
 # From Steffen Thorsen (2016-03-17):
 # ... the Azerbaijani Cabinet of Ministers has cancelled switching to
 # daylight saving time....
-# http://www.azernews.az/azerbaijan/94137.html
+# https://www.azernews.az/azerbaijan/94137.html
 # http://vestnikkavkaza.net/news/Azerbaijani-Cabinet-of-Ministers-cancels-daylight-saving-time.html
 # http://en.apa.az/xeber_azerbaijan_abolishes_daylight_savings_ti_240862.html
 
@@ -191,11 +195,11 @@
 # the 19th and 20th, and they have not set the end date yet.
 #
 # Some sources:
-# http://in.reuters.com/article/southAsiaNews/idINIndia-40017620090601
+# https://in.reuters.com/article/southAsiaNews/idINIndia-40017620090601
 # http://bdnews24.com/details.php?id=85889&cid=2
 #
 # Our wrap-up:
-# http://www.timeanddate.com/news/time/bangladesh-daylight-saving-2009.html
+# https://www.timeanddate.com/news/time/bangladesh-daylight-saving-2009.html
 
 # From A. N. M. Kamrus Saadat (2009-06-15):
 # Finally we've got the official mail regarding DST start time where DST start
@@ -281,9 +285,15 @@
 
 # Milne says 6:24:40 was the meridian of the time ball observatory at Rangoon.
 
+# From Paul Eggert (2017-04-20):
+# Page 27 of Reed & Low (cited for Asia/Kolkata) says "Rangoon local time is
+# used upon the railways and telegraphs of Burma, and is 6h. 24m. 47s. ahead
+# of Greenwich."  This refers to the period before Burma's transition to +0630,
+# a transition for which Shanks is the only source.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Yangon	6:24:40 -	LMT	1880        # or Rangoon
-			6:24:40	-	RMT	1920        # Rangoon Mean Time?
+Zone	Asia/Yangon	6:24:47 -	LMT	1880        # or Rangoon
+			6:24:47	-	RMT	1920        # Rangoon local time
 			6:30	-	+0630	1942 May
 			9:00	-	+09	1945 May  3
 			6:30	-	+0630
@@ -340,7 +350,7 @@
 #
 # From Jesper Nørgaard Welen (2006-07-14):
 # I have investigated the timezones around 1970 on the
-# http://www.astro.com/atlas site [with provinces and county
+# https://www.astro.com/atlas site [with provinces and county
 # boundaries summarized below]....  A few other exceptions were two
 # counties on the Sichuan side of the Xizang-Sichuan border,
 # counties Dege and Baiyu which lies on the Sichuan side and are
@@ -492,7 +502,7 @@
 
 # From David Cochrane (2014-03-26):
 # Just a confirmation that Ürümqi time was implemented in Ürümqi on 1 Feb 1986:
-# http://content.time.com/time/magazine/article/0,9171,960684,00.html
+# https://content.time.com/time/magazine/article/0,9171,960684,00.html
 
 # From Luther Ma (2014-04-22):
 # I have interviewed numerous people of various nationalities and from
@@ -649,7 +659,7 @@
 # (both in Okinawa) adopt the Western Standard Time which is based on
 # 120E. The adoption began from Jan 1, 1896. The original text can be
 # found on Wikisource:
-# http://ja.wikisource.org/wiki/標準時ニ關スル件_(公布時)
+# https://ja.wikisource.org/wiki/標準時ニ關スル件_(公布時)
 # ... This could be the first adoption of time zone in Taiwan, because
 # during the Qing Dynasty, it seems that there was no time zone
 # declared officially.
@@ -662,7 +672,7 @@
 # territory, including later occupations, adopt Japan Central Time
 # (UTC+9). The adoption began on Oct 1, 1937. The original text can
 # be found on Wikisource:
-# http://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件
+# https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件
 #
 # That is, the time zone of Taipei switched to UTC+9 on Oct 1, 1937.
 
@@ -798,6 +808,12 @@
 # Looks like the time zone split in Cyprus went through last night.
 # http://cyprus-mail.com/2016/10/30/cyprus-new-division-two-time-zones-now-reality/
 
+# From Paul Eggert (2017-10-18):
+# Northern Cyprus will reinstate winter time on October 29, thus
+# staying in sync with the rest of Cyprus.  See: Anastasiou A.
+# Cyprus to remain united in time.  Cyprus Mail 2017-10-17.
+# https://cyprus-mail.com/2017/10/17/cyprus-remain-united-time/
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Cyprus	1975	only	-	Apr	13	0:00	1:00	S
 Rule	Cyprus	1975	only	-	Oct	12	0:00	0	-
@@ -815,7 +831,8 @@
 Zone	Asia/Famagusta	2:15:48	-	LMT	1921 Nov 14
 			2:00	Cyprus	EE%sT	1998 Sep
 			2:00	EUAsia	EE%sT	2016 Sep  8
-			3:00	-	+03
+			3:00	-	+03	2017 Oct 29 1:00u
+			2:00	EUAsia	EE%sT
 
 # Classically, Cyprus belongs to Asia; e.g. see Herodotus, Histories, I.72.
 # However, for various reasons many users expect to find it under Europe.
@@ -875,7 +892,7 @@
 
 # From João Carrascalão, brother of the former governor of East Timor, in
 # East Timor may be late for its millennium
-# <http://etan.org/et99c/december/26-31/30ETMAY.htm> (1999-12-26/31):
+# <https://etan.org/et99c/december/26-31/30ETMAY.htm> (1999-12-26/31):
 # Portugal tried to change the time forward in 1974 because the sun
 # rises too early but the suggestion raised a lot of problems with the
 # Timorese and I still don't think it would work today because it
@@ -903,21 +920,62 @@
 # India
 
 # From Ian P. Beacock, in "A brief history of (modern) time", The Atlantic
-# http://www.theatlantic.com/technology/archive/2015/12/the-creation-of-modern-time/421419/
+# https://www.theatlantic.com/technology/archive/2015/12/the-creation-of-modern-time/421419/
 # (2015-12-22):
 # In January 1906, several thousand cotton-mill workers rioted on the
 # outskirts of Bombay....  They were protesting the proposed abolition of
 # local time in favor of Indian Standard Time....  Journalists called this
 # dispute the "Battle of the Clocks."  It lasted nearly half a century.
 
+# From Paul Eggert (2017-04-20):
+# Good luck trying to nail down old timekeeping records in India.
+# "... in the nineteenth century ... Madras Observatory took its magnetic
+# measurements on Göttingen time, its meteorological measurements on Madras
+# (local) time, dropped its time ball on Greenwich (ocean navigator's) time,
+# and distributed civil (local time)." -- Bartky IR. Selling the true time:
+# 19th-century timekeeping in america. Stanford U Press (2000), 247 note 19.
+# "A more potent cause of resistance to the general adoption of the present
+# standard time lies in the fact that it is Madras time.  The citizen of
+# Bombay, proud of being 'primus in Indis' and of Calcutta, equally proud of
+# his city being the Capital of India, and - for a part of the year - the Seat
+# of the Supreme Government, alike look down on Madras, and refuse to change
+# the time they are using, for that of what they regard as a benighted
+# Presidency; while Madras, having for long given the standard time to the
+# rest of India, would resist the adoption of any other Indian standard in its
+# place." -- Oldham RD. On Time in India: a suggestion for its improvement.
+# Proceedings of the Asiatic Society of Bengal (April 1899), 49-55.
+#
+# "In 1870 ... Madras time - 'now used by the telegraph and regulated from the
+# only government observatory' - was suggested as a standard railway time,
+# first to be adopted on the Great Indian Peninsular Railway (GIPR)....
+# Calcutta, Bombay, and Karachi, were to be allowed to continue with their
+# local time for civil purposes." - Prasad R. Tracks of Change: Railways and
+# Everyday Life in Colonial India. Cambridge University Press (2016), 145.
+#
+# Reed S, Low F. The Indian Year Book 1936-37. Bennett, Coleman, pp 27-8.
+# https://archive.org/details/in.ernet.dli.2015.282212
+# This lists +052110 as Madras local time used in railways, and says that on
+# 1906-01-01 railways and telegraphs in India switched to +0530.  Some
+# municipalities retained their former time, and the time in Calcutta
+# continued to depend on whether you were at the railway station or at
+# government offices.  Government time was at +055320 (according to Shanks) or
+# at +0554 (according to the Indian Year Book).  Railway time is more
+# appropriate for our purposes, as it was better documented, it is what we do
+# elsewhere (e.g., Europe/London before 1880), and after 1906 it was
+# consistent in the region now identified by Asia/Kolkata.  So, use railway
+# time for 1870-1941.  Shanks is our only (and dubious) source for the
+# 1941-1945 data.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Kolkata	5:53:28 -	LMT	1880        # Kolkata
-			5:53:20	-	HMT	1941 Oct    # Howrah Mean Time?
-			6:30	-	+0630	1942 May 15
+Zone	Asia/Kolkata	5:53:28 -	LMT	1854 Jun 28 # Kolkata
+			5:53:20	-	HMT	1870	    # Howrah Mean Time?
+			5:21:10	-	MMT	1906 Jan  1 # Madras local time
+			5:30	-	IST	1941 Oct
+			5:30	1:00	+0630	1942 May 15
 			5:30	-	IST	1942 Sep
 			5:30	1:00	+0630	1945 Oct 15
 			5:30	-	IST
-# The following are like Asia/Kolkata:
+# Since 1970 the following are like Asia/Kolkata:
 #	Andaman Is
 #	Lakshadweep (Laccadive, Minicoy and Amindivi Is)
 #	Nicobar Is
@@ -1059,7 +1117,7 @@
 # From Reuters (2007-09-16), with a heads-up from Jesper Nørgaard Welen:
 # ... the Guardian Council ... approved a law on Sunday to re-introduce
 # daylight saving time ...
-# http://uk.reuters.com/article/oilRpt/idUKBLA65048420070916
+# https://uk.reuters.com/article/oilRpt/idUKBLA65048420070916
 #
 # From Roozbeh Pournader (2007-11-05):
 # This is quoted from Official Gazette of the Islamic Republic of
@@ -1158,7 +1216,7 @@
 # http://www.aswataliraq.info/look/article.tpl?id=2047&IdLanguage=17&IdPublication=4&NrArticle=71743&NrIssue=1&NrSection=10
 #
 # We have published a short article in English about the change:
-# http://www.timeanddate.com/news/time/iraq-dumps-daylight-saving.html
+# https://www.timeanddate.com/news/time/iraq-dumps-daylight-saving.html
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Iraq	1982	only	-	May	1	0:00	1:00	D
@@ -1466,12 +1524,12 @@
 # From Yu-Cheng Chuang (2013-07-12):
 # ...the Meiji Emperor announced Ordinance No. 167 of Meiji Year 28 "The clause
 # about standard time" ... The adoption began from Jan 1, 1896.
-# http://ja.wikisource.org/wiki/標準時ニ關スル件_(公布時)
+# https://ja.wikisource.org/wiki/標準時ニ關スル件_(公布時)
 #
 # ...the Showa Emperor announced Ordinance No. 529 of Showa Year 12 ... which
 # means the whole Japan territory, including later occupations, adopt Japan
 # Central Time (UTC+9). The adoption began on Oct 1, 1937.
-# http://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件
+# https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Tokyo	9:18:59	-	LMT	1887 Dec 31 15:00u
@@ -1533,7 +1591,7 @@
 # Official, in Arabic:
 # http://www.petra.gov.jo/public_news/Nws_NewsDetails.aspx?Menu_ID=&Site_Id=2&lang=1&NewsID=133230&CatID=14
 # ... Our background/permalink about it
-# http://www.timeanddate.com/news/time/jordan-reverses-dst-decision.html
+# https://www.timeanddate.com/news/time/jordan-reverses-dst-decision.html
 # ...
 # http://www.petra.gov.jo/Public_News/Nws_NewsDetails.aspx?lang=2&site_id=1&NewsID=133313&Type=P
 # ... says midnight for the coming one and 1:00 for the ones in the future
@@ -1891,9 +1949,9 @@
 # between 1987 and 1988 ...
 
 # From Sanghyuk Jung (2014-10-29):
-# http://mm.icann.org/pipermail/tz/2014-October/021830.html
+# https://mm.icann.org/pipermail/tz/2014-October/021830.html
 # According to the Korean Wikipedia
-# http://ko.wikipedia.org/wiki/한국_표준시
+# https://ko.wikipedia.org/wiki/한국_표준시
 # [oldid=12896437 2014-09-04 08:03 UTC]
 # DST in Republic of Korea was as follows....  And I checked old
 # newspapers in Korean, all articles correspond with data in Wikipedia.
@@ -2115,7 +2173,7 @@
 # +08:00 instead. Different sources appear to disagree with the tz
 # database on this, e.g.:
 #
-# http://www.timeanddate.com/worldclock/city.html?n=1026
+# https://www.timeanddate.com/worldclock/city.html?n=1026
 # http://www.worldtimeserver.com/current_time_in_MN.aspx
 #
 # both say GMT+08:00.
@@ -2245,7 +2303,7 @@
 # help reduce load shedding by approving the closure of commercial centres at
 # 9pm and moving clocks forward by one hour for the next three months. ...."
 #
-# http://www.worldtimezone.net/dst_news/dst_news_pakistan01.html
+# http://www.worldtimezone.com/dst_news/dst_news_pakistan01.html
 # http://www.dailytimes.com.pk/default.asp?page=2008%5C05%5C15%5Cstory_15-5-2008_pg1_4
 
 # From Arthur David Olson (2008-05-19):
@@ -2311,7 +2369,7 @@
 #
 # We have confirmed this year's end date with both with the Ministry of
 # Water and Power and the Pakistan Electric Power Company:
-# http://www.timeanddate.com/news/time/pakistan-ends-dst09.html
+# https://www.timeanddate.com/news/time/pakistan-ends-dst09.html
 
 # From Christoph Göhre (2009-10-01):
 # [T]he German Consulate General in Karachi reported me today that Pakistan
@@ -2493,7 +2551,7 @@
 #
 # We are not sure if Gaza will do the same, last year they had a different
 # end date, we will keep this page updated:
-# http://www.timeanddate.com/news/time/westbank-gaza-dst-2009.html
+# https://www.timeanddate.com/news/time/westbank-gaza-dst-2009.html
 
 # From Alexander Krivenyshev (2009-09-02):
 # Seems that Gaza Strip will go back to Winter Time same date as West Bank.
@@ -2531,7 +2589,7 @@
 # the clocks were set back one hour at 2010-08-11 00:00:00 local time in
 # Gaza and the West Bank.
 # Some more background info:
-# http://www.timeanddate.com/news/time/westbank-gaza-end-dst-2010.html
+# https://www.timeanddate.com/news/time/westbank-gaza-end-dst-2010.html
 
 # From Steffen Thorsen (2011-08-26):
 # Gaza and the West Bank did go back to standard time in the beginning of
@@ -2541,7 +2599,7 @@
 #
 # http://www.maannews.net/eng/ViewDetails.aspx?ID=416217
 # Additional info:
-# http://www.timeanddate.com/news/time/palestine-dst-2011.html
+# https://www.timeanddate.com/news/time/palestine-dst-2011.html
 
 # From Alexander Krivenyshev (2011-08-27):
 # According to the article in The Jerusalem Post:
@@ -2551,7 +2609,7 @@
 # The Hamas government said on Saturday that it won't observe summertime after
 # the Muslim feast of Id al-Fitr, which begins on Tuesday..."
 # ...
-# http://www.jpost.com/MiddleEast/Article.aspx?id=235650
+# https://www.jpost.com/MiddleEast/Article.aspx?id=235650
 # http://www.worldtimezone.com/dst_news/dst_news_gazastrip05.html
 # The rules for Egypt are stolen from the 'africa' file.
 
@@ -2572,7 +2630,7 @@
 # http://safa.ps/details/news/74352/%D8%A8%D8%AF%D8%A1-%D8%A7%D9%84%D8%AA%D9%88%D9%82%D9%8A%D8%AA-%D8%A7%D9%84%D8%B5%D9%8A%D9%81%D9%8A-%D8%A8%D8%A7%D9%84%D8%B6%D9%81%D8%A9-%D9%88%D8%BA%D8%B2%D8%A9-%D9%84%D9%8A%D9%84%D8%A9-%D8%A7%D9%84%D8%AC%D9%85%D8%B9%D8%A9.html
 #
 # Our brief summary:
-# http://www.timeanddate.com/news/time/gaza-west-bank-dst-2012.html
+# https://www.timeanddate.com/news/time/gaza-west-bank-dst-2012.html
 
 # From Steffen Thorsen (2013-03-26):
 # The following news sources tells that Palestine will "start daylight saving
@@ -2592,11 +2650,11 @@
 
 # From Steffen Thorsen (2015-03-03):
 # Sources such as http://www.alquds.com/news/article/view/id/548257
-# and http://www.raya.ps/ar/news/890705.html say Palestine areas will
+# and https://www.raya.ps/ar/news/890705.html say Palestine areas will
 # start DST on 2015-03-28 00:00 which is one day later than expected.
 #
 # From Paul Eggert (2015-03-03):
-# http://www.timeanddate.com/time/change/west-bank/ramallah?year=2014
+# https://www.timeanddate.com/time/change/west-bank/ramallah?year=2014
 # says that the fall 2014 transition was Oct 23 at 24:00.
 
 # From Hannah Kreitem (2016-03-09):
@@ -2620,8 +2678,8 @@
 #
 # From Paul Eggert (2016-10-19):
 # It's also consistent with predictions in the following URLs today:
-# http://www.timeanddate.com/time/change/gaza-strip/gaza
-# http://www.timeanddate.com/time/change/west-bank/hebron
+# https://www.timeanddate.com/time/change/gaza-strip/gaza
+# https://www.timeanddate.com/time/change/west-bank/hebron
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule EgyptAsia	1957	only	-	May	10	0:00	1:00	S
@@ -2684,7 +2742,7 @@
 # Philippines, issued a proclamation announcing that 1844-12-30 was to
 # be immediately followed by 1845-01-01; see R.H. van Gent's
 # History of the International Date Line
-# http://www.staff.science.uu.nl/~gent0113/idl/idl_philippines.htm
+# https://www.staff.science.uu.nl/~gent0113/idl/idl_philippines.htm
 # The rest of the data entries are from Shanks & Pottenger.
 
 # From Jesper Nørgaard Welen (2006-04-26):
@@ -2948,7 +3006,7 @@
 # We have not found any sources saying anything about when DST ends this year.
 #
 # Our summary
-# http://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html
+# https://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html
 
 # From Steffen Thorsen (2009-10-27):
 # The Syrian Arab News Network on 2009-09-29 reported that Syria will
@@ -2975,7 +3033,7 @@
 # http://www.sana.sy/ara/2/2012/03/26/408215.htm
 #
 # Our brief summary:
-# http://www.timeanddate.com/news/time/syria-dst-2012.html
+# https://www.timeanddate.com/news/time/syria-dst-2012.html
 
 # From Arthur David Olson (2012-03-27):
 # Assume last Friday in March going forward XXX.
@@ -3058,7 +3116,7 @@
 # is quoted verbatim in:
 # http://www.thoigian.com.vn/?mPage=P80D01
 # is translated by Brian Inglis in:
-# http://mm.icann.org/pipermail/tz/2014-October/021654.html
+# https://mm.icann.org/pipermail/tz/2014-October/021654.html
 # and is the basis for the information below.
 #
 # The 1906 transition was effective July 1 and standardized Indochina to
--- a/make/data/tzdata/australasia	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/data/tzdata/australasia	Wed Nov 15 08:25:28 2017 -0500
@@ -316,7 +316,7 @@
 # http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=1096:3310-cabinet-approves-change-in-daylight-savings-dates&catid=49:cabinet-releases&Itemid=166
 #
 # A bit more background info here:
-# http://www.timeanddate.com/news/time/fiji-dst-ends-march-2010.html
+# https://www.timeanddate.com/news/time/fiji-dst-ends-march-2010.html
 
 # From Alexander Krivenyshev (2010-10-24):
 # According to Radio Fiji and Fiji Times online, Fiji will end DST 3
@@ -380,9 +380,12 @@
 # clocks go forward an hour at 2am to 3am....  Daylight Saving will
 # end at 3.00am on Sunday 15th January 2017."
 
-# From Paul Eggert (2016-10-03):
-# For now, guess DST from 02:00 the first Sunday in November to
-# 03:00 the third Sunday in January.  Although ad hoc, it matches
+# From Paul Eggert (2017-08-21):
+# Dominic Fok writes (2017-08-20) that DST ends 2018-01-14, citing
+# Extraordinary Government of Fiji Gazette Supplement No. 21 (2017-08-27),
+# [Legal Notice No. 41] of an order of the previous day by J Usamate.
+# For now, guess DST from 02:00 the first Sunday in November to 03:00
+# the first Sunday on or after January 14.  Although ad hoc, it matches
 # transitions since late 2014 and seems more likely to match future
 # practice than guessing no DST.
 
@@ -396,7 +399,7 @@
 Rule	Fiji	2012	2013	-	Jan	Sun>=18	3:00	0	-
 Rule	Fiji	2014	only	-	Jan	Sun>=18	2:00	0	-
 Rule	Fiji	2014	max	-	Nov	Sun>=1	2:00	1:00	S
-Rule	Fiji	2015	max	-	Jan	Sun>=15	3:00	0	-
+Rule	Fiji	2015	max	-	Jan	Sun>=14	3:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fiji	11:55:44 -	LMT	1915 Oct 26 # Suva
 			12:00	Fiji	+12/+13
@@ -580,7 +583,7 @@
 # The World War II entries below are instead based on Arawa-Kieta.
 # The Japanese occupied Kieta in July 1942,
 # according to the Pacific War Online Encyclopedia
-# http://pwencycl.kgbudge.com/B/o/Bougainville.htm
+# https://pwencycl.kgbudge.com/B/o/Bougainville.htm
 # and seem to have controlled it until their 1945-08-21 surrender.
 #
 # The Autonomous Region of Bougainville switched from UT +10 to +11
@@ -602,7 +605,7 @@
 			-8:00	-	-08
 
 # American Samoa
-Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1879 Jul  5
+Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1892 Jul  5
 			-11:22:48 -	LMT	1911
 			-11:00	-	SST	            # S=Samoa
 Link Pacific/Pago_Pago Pacific/Midway # in US minor outlying islands
@@ -618,7 +621,7 @@
 # Sunday of April 2011."
 #
 # Background info:
-# http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
+# https://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
 #
 # Samoa's Daylight Saving Time Act 2009 is available here, but does not
 # contain any dates:
@@ -682,7 +685,7 @@
 Rule	WS	2012	max	-	Apr	Sun>=1	4:00	0	S
 Rule	WS	2012	max	-	Sep	lastSun	3:00	1	D
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
+Zone Pacific/Apia	 12:33:04 -	LMT	1892 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	-1130	1950
 			-11:00	WS	-11/-10	2011 Dec 29 24:00
@@ -709,7 +712,7 @@
 # From Paul Eggert (2012-07-25)
 # A Google Books snippet of Appendix to the Journals of the House of
 # Representatives of New Zealand, Session 1948,
-# <http://books.google.com/books?id=ZaVCAQAAIAAJ>, page 65, says Tokelau
+# <https://books.google.com/books?id=ZaVCAQAAIAAJ>, page 65, says Tokelau
 # was "11 hours slow on G.M.T."  Go with Thorsen and assume Shanks & Pottenger
 # are off by an hour starting in 1901.
 
@@ -724,8 +727,8 @@
 Rule	Tonga	2000	only	-	Mar	19	2:00s	0	-
 Rule	Tonga	2000	2001	-	Nov	Sun>=1	2:00	1:00	S
 Rule	Tonga	2001	2002	-	Jan	lastSun	2:00	0	-
-Rule	Tonga	2016	max	-	Nov	Sun>=1	2:00	1:00	S
-Rule	Tonga	2017	max	-	Jan	Sun>=15	3:00	0	-
+Rule	Tonga	2016	only	-	Nov	Sun>=1	2:00	1:00	S
+Rule	Tonga	2017	only	-	Jan	Sun>=15	3:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Pacific/Tongatapu	12:19:20 -	LMT	1901
 			12:20	-	+1220	1941
@@ -779,7 +782,7 @@
 # Operation Fishbowl shot (Tightrope, 1962-11-04).... [See] Herman Hoerlin,
 # "The United States High-Altitude Test Experience: A Review Emphasizing the
 # Impact on the Environment", Los Alamos LA-6405, Oct 1976.
-# http://www.fas.org/sgp/othergov/doe/lanl/docs1/00322994.pdf
+# https://www.fas.org/sgp/othergov/doe/lanl/docs1/00322994.pdf
 # See the table on page 4 where he lists GMT and local times for the tests; a
 # footnote for the JI tests reads that local time is "JI time = Hawaii Time
 # Minus One Hour".
@@ -845,7 +848,7 @@
 #
 # For data circa 1899, a common source is:
 # Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
-# http://www.jstor.org/stable/1774359
+# https://www.jstor.org/stable/1774359
 #
 # A reliable and entertaining source about time zones is
 # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
@@ -992,7 +995,7 @@
 #   AEST ACST AWST AEDT ACDT
 #
 #   Parliamentary Library (2008-11-10)
-#   http://www.aph.gov.au/binaries/library/pubs/rp/2008-09/09rp14.pdf
+#   https://www.aph.gov.au/binaries/library/pubs/rp/2008-09/09rp14.pdf
 #   EST CST WST preferred for standard time; AEST AEDT ACST ACDT also used
 #
 #   The Transport Safety Bureau has an extensive series of accident reports,
@@ -1028,13 +1031,13 @@
 #
 # NSW (including LHI and Broken Hill):
 # Standard Time Act 1987 (updated 1995-04-04)
-# http://www.austlii.edu.au/au/legis/nsw/consol_act/sta1987137/index.html
+# https://www.austlii.edu.au/au/legis/nsw/consol_act/sta1987137/index.html
 # ACT
 # Standard Time and Summer Time Act 1972
-# http://www.austlii.edu.au/au/legis/act/consol_act/stasta1972279/index.html
+# https://www.austlii.edu.au/au/legis/act/consol_act/stasta1972279/index.html
 # SA
 # Standard Time Act, 1898
-# http://www.austlii.edu.au/au/legis/sa/consol_act/sta1898137/index.html
+# https://www.austlii.edu.au/au/legis/sa/consol_act/sta1898137/index.html
 
 # From David Grosz (2005-06-13):
 # It was announced last week that Daylight Saving would be extended by
@@ -1329,7 +1332,7 @@
 # http://abc.net.au/news/regionals/neweng/monthly/regeng-22jul1999-1.htm
 # (1999-07-22).  For now, we'll wait to see if this really happens.
 #
-# Victoria will following NSW.  See:
+# Victoria will follow NSW.  See:
 # Vic to extend daylight saving (1999-07-28)
 # http://abc.net.au/local/news/olympics/1999/07/item19990728112314_1.htm
 #
@@ -1432,7 +1435,7 @@
 # the ACT for all 52 weeks of the year...
 #
 # We have a wrap-up here:
-# http://www.timeanddate.com/news/time/south-australia-extends-dst.html
+# https://www.timeanddate.com/news/time/south-australia-extends-dst.html
 ###############################################################################
 
 # New Zealand
@@ -1486,7 +1489,7 @@
 # From Paul Eggert (2014-07-14):
 # Chatham Island time was formally standardized on 1957-01-01 by
 # New Zealand's Standard Time Amendment Act 1956 (1956-10-26).
-# http://www.austlii.edu.au/nz/legis/hist_act/staa19561956n100244.pdf
+# https://www.austlii.edu.au/nz/legis/hist_act/staa19561956n100244.pdf
 # According to Google Books snippet view, a speaker in the New Zealand
 # parliamentary debates in 1956 said "Clause 78 makes provision for standard
 # time in the Chatham Islands.  The time there is 45 minutes in advance of New
@@ -1601,7 +1604,7 @@
 # the Norfolk Island Museum and the Australian Bureau of Meteorology's
 # Norfolk Island station, and found no record of Norfolk observing DST
 # other than in 1974/5.  See:
-# http://www.timeanddate.com/time/australia/norfolk-island.html
+# https://www.timeanddate.com/time/australia/norfolk-island.html
 
 # Pitcairn
 
@@ -1629,11 +1632,13 @@
 
 # (Western) Samoa and American Samoa
 
-# Howse writes (p 153, citing p 10 of the 1883-11-18 New York Herald)
-# that in 1879 the King of Samoa decided to change
+# Howse writes (p 153) that after the 1879 standardization on Antipodean
+# time by the British governor of Fiji, the King of Samoa decided to change
 # "the date in his kingdom from the Antipodean to the American system,
 # ordaining - by a masterpiece of diplomatic flattery - that
 # the Fourth of July should be celebrated twice in that year."
+# This happened in 1892, according to the Evening News (Sydney) of 1892-07-20.
+# https://www.staff.science.uu.nl/~gent0113/idl/idl.htm
 
 # Although Shanks & Pottenger says they both switched to UT -11:30
 # in 1911, and to -11 in 1950. many earlier sources give -11
@@ -1644,6 +1649,7 @@
 # day in 2011.  Assume also that the Samoas follow the US and New
 # Zealand's "ST"/"DT" style of daylight-saving abbreviations.
 
+
 # Tonga
 
 # From Paul Eggert (1996-01-22):
@@ -1738,6 +1744,15 @@
 # Assume Tonga will observe DST from the first Sunday in November at 02:00
 # through the third Sunday in January at 03:00, like Fiji, for now.
 
+# From David Wade (2017-10-18):
+# In August government was disolved by the King.  The current prime minister
+# continued in office in care taker mode.  It is easy to see that few
+# decisions will be made until elections 16th November.
+#
+# From Paul Eggert (2017-10-18):
+# For now, guess that DST is discontinued.  That's what the IATA is guessing.
+
+
 # Wake
 
 # From Vernice Anderson, Personal Secretary to Philip Jessup,
@@ -1750,7 +1765,7 @@
 # making calculation of time in Washington difficult if not almost
 # impossible.
 #
-# http://www.trumanlibrary.org/wake/meeting.htm
+# https://www.trumanlibrary.org/oralhist/andrsonv.htm
 
 # From Paul Eggert (2003-03-23):
 # We have no other report of DST in Wake Island, so omit this info for now.
@@ -1778,7 +1793,7 @@
 # an international standard, there are some places on the high seas where the
 # correct date is ambiguous.
 
-# From Wikipedia <http://en.wikipedia.org/wiki/Time_zone> (2005-08-31):
+# From Wikipedia <https://en.wikipedia.org/wiki/Time_zone> (2005-08-31):
 # Before 1920, all ships kept local apparent time on the high seas by setting
 # their clocks at night or at the morning sight so that, given the ship's
 # speed and direction, it would be 12 o'clock when the Sun crossed the ship's
--- a/make/data/tzdata/backward	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/data/tzdata/backward	Wed Nov 15 08:25:28 2017 -0500
@@ -84,7 +84,9 @@
 Link	America/Manaus		Brazil/West
 Link	America/Halifax		Canada/Atlantic
 Link	America/Winnipeg	Canada/Central
-Link	America/Regina		Canada/East-Saskatchewan
+# This line is commented out, as the name exceeded the 14-character limit
+# and was an unused misnomer.
+#Link	America/Regina		Canada/East-Saskatchewan
 Link	America/Toronto		Canada/Eastern
 Link	America/Edmonton	Canada/Mountain
 Link	America/St_Johns	Canada/Newfoundland
--- a/make/data/tzdata/europe	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/data/tzdata/europe	Wed Nov 15 08:25:28 2017 -0500
@@ -60,14 +60,14 @@
 #	[PDF] (1914-03)
 #
 #	Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
-#	<http://www.jstor.org/stable/1774359>.  He writes:
+#	<https://www.jstor.org/stable/1774359>.  He writes:
 #	"It is requested that corrections and additions to these tables
 #	may be sent to Mr. John Milne, Royal Geographical Society,
 #	Savile Row, London."  Nowadays please email them to tz@iana.org.
 #
 #	Byalokoz EL. New Counting of Time in Russia since July 1, 1919.
 #	This Russian-language source was consulted by Vladimir Karpinsky; see
-#	http://mm.icann.org/pipermail/tz/2014-August/021320.html
+#	https://mm.icann.org/pipermail/tz/2014-August/021320.html
 #	The full Russian citation is:
 #	Бялокоз, Евгений Людвигович. Новый счет времени в течении суток
 #	введенный декретом Совета народных комиссаров для всей России с 1-го
@@ -210,7 +210,7 @@
 # foundations of civilization throughout the world.
 #	-- "A Silent Toast to William Willett", Pictorial Weekly;
 #	republished in Finest Hour (Spring 2002) 1(114):26
-#	http://www.winstonchurchill.org/images/finesthour/Vol.01%20No.114.pdf
+#	https://www.winstonchurchill.org/publications/finest-hour/finest-hour-114/a-silent-toast-to-william-willett-by-winston-s-churchill
 
 # From Paul Eggert (2015-08-08):
 # The OED Supplement says that the English originally said "Daylight Saving"
@@ -248,8 +248,8 @@
 # official designation; the reply of the 21st was that there wasn't
 # but he couldn't think of anything better than the "Double British
 # Summer Time" that the BBC had been using informally.
-# http://www.polyomino.org.uk/british-time/bbc-19410418.png
-# http://www.polyomino.org.uk/british-time/ho-19410421.png
+# https://www.polyomino.org.uk/british-time/bbc-19410418.png
+# https://www.polyomino.org.uk/british-time/ho-19410421.png
 
 # From Sir Alexander Maxwell in the above-mentioned letter (1941-04-21):
 # [N]o official designation has as far as I know been adopted for the time
@@ -266,13 +266,13 @@
 # the history of summer time legislation in the United Kingdom.
 # Since 1998 Joseph S. Myers has been updating
 # and extending this list, which can be found in
-# http://www.polyomino.org.uk/british-time/
+# https://www.polyomino.org.uk/british-time/
 
 # From Joseph S. Myers (1998-01-06):
 #
 # The legal time in the UK outside of summer time is definitely GMT, not UTC;
 # see Lord Tanlaw's speech
-# http://www.publications.parliament.uk/pa/ld199798/ldhansrd/vo970611/text/70611-10.htm#70611-10_head0
+# https://www.publications.parliament.uk/pa/ld199798/ldhansrd/vo970611/text/70611-10.htm#70611-10_head0
 # (Lords Hansard 11 June 1997 columns 964 to 976).
 
 # From Paul Eggert (2006-03-22):
@@ -318,7 +318,7 @@
 # Irish 'public feeling (was) outraged by forcing of English time on us'."
 # -- Parsons M. Dublin lost its time zone - and 25 minutes - after 1916 Rising.
 # Irish Times 2014-10-27.
-# http://www.irishtimes.com/news/politics/dublin-lost-its-time-zone-and-25-minutes-after-1916-rising-1.1977411
+# https://www.irishtimes.com/news/politics/dublin-lost-its-time-zone-and-25-minutes-after-1916-rising-1.1977411
 
 # From Joseph S. Myers (2005-01-26):
 # Irish laws are available online at <http://www.irishstatutebook.ie>.
@@ -371,6 +371,12 @@
 # Justice (tel +353 1 678 9711) who confirmed to me that the correct name is
 # "Irish Summer Time", abbreviated to "IST".
 
+# Michael Deckers (2017-06-01) gave the following URLs for Ireland's
+# Summer Time Act, 1925 and Summer Time Orders, 1926 and 1947:
+# http://www.irishstatutebook.ie/eli/1925/act/8/enacted/en/print.html
+# http://www.irishstatutebook.ie/eli/1926/sro/919/made/en/print.html
+# http://www.irishstatutebook.ie/eli/1947/sro/71/made/en/print.html
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 # Summer Time Act, 1916
 Rule	GB-Eire	1916	only	-	May	21	2:00s	1:00	BST
@@ -495,14 +501,14 @@
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Europe/Dublin	-0:25:00 -	LMT	1880 Aug  2
-			-0:25:21 -	DMT	1916 May 21  2:00 # Dublin MT
+			-0:25:21 -	DMT	1916 May 21  2:00s # Dublin MT
 			-0:25:21 1:00	IST	1916 Oct  1  2:00s
 			 0:00	GB-Eire	%s	1921 Dec  6 # independence
-			 0:00	GB-Eire	GMT/IST	1940 Feb 25  2:00
-			 0:00	1:00	IST	1946 Oct  6  2:00
-			 0:00	-	GMT	1947 Mar 16  2:00
-			 0:00	1:00	IST	1947 Nov  2  2:00
-			 0:00	-	GMT	1948 Apr 18  2:00
+			 0:00	GB-Eire	GMT/IST	1940 Feb 25  2:00s
+			 0:00	1:00	IST	1946 Oct  6  2:00s
+			 0:00	-	GMT	1947 Mar 16  2:00s
+			 0:00	1:00	IST	1947 Nov  2  2:00s
+			 0:00	-	GMT	1948 Apr 18  2:00s
 			 0:00	GB-Eire	GMT/IST	1968 Oct 27
 			 1:00	-	IST	1971 Oct 31  2:00u
 			 0:00	GB-Eire	GMT/IST	1996
@@ -648,7 +654,7 @@
 # Council of Ministers of the USSR from 1989-03-14 No. 227.
 #
 # I did not find full texts of these acts.  For the 1989 one we have
-# title at http://base.garant.ru/70754136/ :
+# title at https://base.garant.ru/70754136/ :
 # "About change in calculation of time on the territories of
 # Lithuanian SSR, Latvian SSR and Estonian SSR, Astrakhan,
 # Kaliningrad, Kirov, Kuybyshev, Ulyanovsk and Uralsk oblasts".
@@ -679,7 +685,7 @@
 # http://bmockbe.ru/events/?ID=7583
 #
 # Medvedev signed a law on the calculation of the time (in russian):
-# http://www.regnum.ru/news/polit/1413906.html
+# https://www.regnum.ru/news/polit/1413906.html
 
 # From Arthur David Olson (2011-06-15):
 # Take "abolishing daylight saving time" to mean that time is now considered
@@ -806,7 +812,7 @@
 # Sources (Russian language):
 # http://www.belta.by/ru/all_news/society/V-Belarusi-otmenjaetsja-perexod-na-sezonnoe-vremja_i_572952.html
 # http://naviny.by/rubrics/society/2011/09/16/ic_articles_116_175144/
-# http://news.tut.by/society/250578.html
+# https://news.tut.by/society/250578.html
 #
 # From Alexander Bokovoy (2014-10-09):
 # Belarussian government decided against changing to winter time....
@@ -1127,7 +1133,7 @@
 # for their standard and summer times. He says no, they use "suveaeg"
 # (summer time) and "talveaeg" (winter time).
 
-# From The Baltic Times <http://www.baltictimes.com/> (1999-09-09)
+# From The Baltic Times <https://www.baltictimes.com/> (1999-09-09)
 # via Steffen Thorsen:
 # This year will mark the last time Estonia shifts to summer time,
 # a council of the ruling coalition announced Sept. 6....
@@ -1179,7 +1185,7 @@
 # This is documented in Heikki Oja: Aikakirja 2007, published by The Almanac
 # Office of University of Helsinki, ISBN 952-10-3221-9, available online (in
 # Finnish) at
-# http://almanakka.helsinki.fi/aikakirja/Aikakirja2007kokonaan.pdf
+# https://almanakka.helsinki.fi/aikakirja/Aikakirja2007kokonaan.pdf
 #
 # Page 105 (56 in PDF version) has a handy table of all past daylight savings
 # transitions. It is easy enough to interpret without Finnish skills.
@@ -1192,7 +1198,7 @@
 
 # From Konstantin Hyppönen (2014-06-13):
 # [Heikki Oja's book Aikakirja 2013]
-# http://almanakka.helsinki.fi/images/aikakirja/Aikakirja2013kokonaan.pdf
+# https://almanakka.helsinki.fi/images/aikakirja/Aikakirja2013kokonaan.pdf
 # pages 104-105, including a scan from a newspaper published on Apr 2 1942
 # say that ... [o]n Apr 2 1942, 24 o'clock (which means Apr 3 1942,
 # 00:00), clocks were moved one hour forward. The newspaper
@@ -1322,7 +1328,7 @@
 
 # From Jörg Schilling (2002-10-23):
 # In 1945, Berlin was switched to Moscow Summer time (GMT+4) by
-# http://www.dhm.de/lemo/html/biografien/BersarinNikolai/
+# https://www.dhm.de/lemo/html/biografien/BersarinNikolai/
 # General [Nikolai] Bersarin.
 
 # From Paul Eggert (2003-03-08):
@@ -1547,7 +1553,7 @@
 # From Paul Eggert (2016-10-27):
 # Go with INRiM for DST rules, except as corrected by Inglis for 1944
 # for the Kingdom of Italy.  This is consistent with Renzo Baldini.
-# Model Rome's occupation by using using C-Eur rules from 1943-09-10
+# Model Rome's occupation by using C-Eur rules from 1943-09-10
 # to 1944-06-04; although Rome was an open city during this period, it
 # was effectively controlled by Germany.
 #
@@ -1862,14 +1868,14 @@
 # Following Moldova and neighboring Ukraine- Transnistria (Pridnestrovie)-
 # Tiraspol will go back to winter time on October 30, 2011.
 # News from Moldova (in russian):
-# http://ru.publika.md/link_317061.html
+# https://ru.publika.md/link_317061.html
 
 # From Roman Tudos (2015-07-02):
 # http://lex.justice.md/index.php?action=view&view=doc&lang=1&id=355077
 # From Paul Eggert (2015-07-01):
 # The abovementioned official link to IGO1445-868/2014 states that
 # 2014-10-26's fallback transition occurred at 03:00 local time.  Also,
-# http://www.trm.md/en/social/la-30-martie-vom-trece-la-ora-de-vara
+# https://www.trm.md/en/social/la-30-martie-vom-trece-la-ora-de-vara
 # says the 2014-03-30 spring-forward transition was at 02:00 local time.
 # Guess that since 1997 Moldova has switched one hour before the EU.
 
@@ -1941,7 +1947,7 @@
 # Amsterdam mean time.
 
 # The data entries before 1945 are taken from
-# http://www.staff.science.uu.nl/~gent0113/wettijd/wettijd.htm
+# https://www.staff.science.uu.nl/~gent0113/wettijd/wettijd.htm
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Neth	1916	only	-	May	 1	0:00	1:00	NST	# Netherlands Summer Time
@@ -2022,7 +2028,7 @@
 # so it must have diverged from Oslo time during the war, as Oslo was
 # keeping Berlin time.
 #
-# <http://home.no.net/janmayen/history.htm> says that the meteorologists
+# <https://www.jan-mayen.no/history.htm> says that the meteorologists
 # burned down their station in 1940 and left the island, but returned in
 # 1941 with a small Norwegian garrison and continued operations despite
 # frequent air attacks from Germans.  In 1943 the Americans established a
@@ -2060,7 +2066,7 @@
 Rule	Poland	1945	only	-	Nov	 1	0:00	0	-
 # For 1946 on the source is Kazimierz Borkowski,
 # Toruń Center for Astronomy, Dept. of Radio Astronomy, Nicolaus Copernicus U.,
-# http://www.astro.uni.torun.pl/~kb/Artykuly/U-PA/Czas2.htm#tth_tAb1
+# https://www.astro.uni.torun.pl/~kb/Artykuly/U-PA/Czas2.htm#tth_tAb1
 # Thanks to Przemysław Augustyniak (2005-05-28) for this reference.
 # He also gives these further references:
 # Mon Pol nr 13, poz 162 (1995) <http://www.abc.com.pl/serwis/mp/1995/0162.htm>
@@ -2094,7 +2100,7 @@
 #
 # From Paul Eggert (2014-08-11), after a heads-up from Stephen Colebourne:
 # According to a Portuguese decree (1911-05-26)
-# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf
+# https://dre.pt/application/dir/pdf1sdip/1911/05/12500/23132313.pdf
 # Lisbon was at -0:36:44.68, but switched to GMT on 1912-01-01 at 00:00.
 # Round the old offset to -0:36:45.  This agrees with Willett but disagrees
 # with Shanks, who says the transition occurred on 1911-05-24 at 00:00 for
@@ -2276,7 +2282,7 @@
 # 2011 No. 725" and contains no other dates or "effective date" information.
 #
 # Another source is
-# http://www.rg.ru/2011/09/06/chas-zona-dok.html
+# https://rg.ru/2011/09/06/chas-zona-dok.html
 # which, according to translate.google.com, begins "Resolution of the
 # Government of the Russian Federation on August 31, 2011 N 725" and also
 # contains "Date first official publication: September 6, 2011 Posted on:
@@ -2284,7 +2290,7 @@
 # does not contain any "effective date" information.
 #
 # Another source is
-# http://en.wikipedia.org/wiki/Oymyakonsky_District#cite_note-RuTime-7
+# https://en.wikipedia.org/wiki/Oymyakonsky_District#cite_note-RuTime-7
 # which, in note 8, contains "Resolution No. 725 of August 31, 2011...
 # Effective as of after 7 days following the day of the official publication"
 # but which does not contain any reference to September 6, 2011.
@@ -2320,7 +2326,7 @@
 # http://itar-tass.com/obschestvo/1333711
 # http://www.pravo.gov.ru:8080/page.aspx?111660
 # http://www.kremlin.ru/acts/46279
-# From October 26, 2014 the new Russian time zone map will looks like this:
+# From October 26, 2014 the new Russian time zone map will look like this:
 # http://www.worldtimezone.com/dst_news/dst_news_russia-map-2014-07.html
 
 # From Paul Eggert (2006-03-22):
@@ -2367,7 +2373,7 @@
 # with maintenance only and represent our best guesses as to which regions
 # are covered by each zone.  They are not meant to be taken as an authoritative
 # listing.  The region codes listed come from
-# http://en.wikipedia.org/w/?title=Federal_subjects_of_Russia&oldid=611810498
+# https://en.wikipedia.org/w/?title=Federal_subjects_of_Russia&oldid=611810498
 # and are used for convenience only; no guarantees are made regarding their
 # future stability.  ISO 3166-2:RU codes are also listed for first-level
 # divisions where available.
@@ -2532,7 +2538,7 @@
 # http://www.kaliningradka.ru/site_pc/cherez/index.php?ELEMENT_ID=40091
 # says that Kaliningrad decided not to be an exception 2 days before the
 # 1991-03-31 switch and one person at
-# http://izhevsk.ru/forum_light_message/50/682597-m8369040.html
+# https://izhevsk.ru/forum_light_message/50/682597-m8369040.html
 # says he remembers that Samara opted out of the 1992-01-19 exception
 # 2 days before the switch.
 #
@@ -2604,7 +2610,7 @@
 			 3:00	-	MSK	1997 Mar lastSun  1:00u
 # From Alexander Krivenyshev (2014-03-17):
 # time change at 2:00 (2am) on March 30, 2014
-# http://vz.ru/news/2014/3/17/677464.html
+# https://vz.ru/news/2014/3/17/677464.html
 # From Paul Eggert (2014-03-30):
 # Simferopol and Sevastopol reportedly changed their central town clocks
 # late the previous day, but this appears to have been ceremonial
@@ -2787,7 +2793,7 @@
 # suggests that Altai Republic transitioned to Moscow+3 on
 # 1995-05-28.
 #
-# http://regnum.ru/news/society/1957270.html
+# https://regnum.ru/news/society/1957270.html
 # has some historical data for Altai Krai:
 # before 1957: west part on UTC+6, east on UTC+7
 # after 1957: UTC+7
@@ -3161,8 +3167,8 @@
 # districts, but have very similar populations.  In fact, Wikipedia currently
 # lists them both as having 3528 people, exactly 1668 males and 1860 females
 # each!  (Yikes!)
-# http://en.wikipedia.org/w/?title=Srednekolymsky_District&oldid=603435276
-# http://en.wikipedia.org/w/?title=Verkhnekolymsky_District&oldid=594378493
+# https://en.wikipedia.org/w/?title=Srednekolymsky_District&oldid=603435276
+# https://en.wikipedia.org/w/?title=Verkhnekolymsky_District&oldid=594378493
 # Assume this is a mistake, albeit an amusing one.
 #
 # Looking at censuses, the populations of the two municipalities seem to have
@@ -3483,7 +3489,7 @@
 #
 # From Alois Treindl (2013-09-11):
 # The Federal regulations say
-# http://www.admin.ch/opc/de/classified-compilation/20071096/index.html
+# https://www.admin.ch/opc/de/classified-compilation/20071096/index.html
 # ... the meridian for Bern mean time ... is 7 degrees 26' 22.50".
 # Expressed in time, it is 0h29m45.5s.
 
@@ -3560,9 +3566,9 @@
 # According to the articles linked below, Turkey will change into summer
 # time zone (GMT+3) on March 28, 2011 at 3:00 a.m. instead of March 27.
 # This change is due to a nationwide exam on 27th.
-# http://www.worldbulletin.net/?aType=haber&ArticleID=70872
+# https://www.worldbulletin.net/?aType=haber&ArticleID=70872
 # Turkish:
-# http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373
+# https://www.hurriyet.com.tr/yaz-saati-uygulamasi-bir-gun-ileri-alindi-17230464
 
 # From Faruk Pasin (2014-02-14):
 # The DST for Turkey has been changed for this year because of the
@@ -3698,7 +3704,7 @@
 # http://www.segodnya.ua/news/14290482.html
 #
 # Deputies cancelled the winter time (in Russian)
-# http://www.pravda.com.ua/rus/news/2011/09/20/6600616/
+# https://www.pravda.com.ua/rus/news/2011/09/20/6600616/
 #
 # From Philip Pizzey (2011-10-18):
 # Today my Ukrainian colleagues have informed me that the
--- a/make/data/tzdata/leapseconds	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/data/tzdata/leapseconds	Wed Nov 15 08:25:28 2017 -0500
@@ -26,19 +26,18 @@
 # This file is in the public domain.
 
 # This file is generated automatically from the data in the public-domain
-# leap-seconds.list file available from most NIST time servers.
-# If the URL <ftp://time.nist.gov/pub/leap-seconds.list> does not work,
-# you should be able to pick up leap-seconds.list from a secondary NIST server.
-# See <http://tf.nist.gov/tf-cgi/servers.cgi> for a list of secondary servers.
+# leap-seconds.list file, which is copied from:
+# ftp://ftp.nist.gov/pub/time/leap-seconds.list
 # For more about leap-seconds.list, please see
 # The NTP Timescale and Leap Seconds
-# http://www.eecis.udel.edu/~mills/leap.html
+# https://www.eecis.udel.edu/~mills/leap.html
 
 # The International Earth Rotation and Reference Systems Service
 # periodically uses leap seconds to keep UTC to within 0.9 s of UT1
 # (which measures the true angular orientation of the earth in space); see
-# Terry J Quinn, The BIPM and the accurate measure of time,
-# Proc IEEE 79, 7 (July 1991), 894-905 <http://dx.doi.org/10.1109/5.84965>.
+# Levine J. Coordinated Universal Time and the leap second.
+# URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995
+# http://ieeexplore.ieee.org/document/7909995/
 # There were no leap seconds before 1972, because the official mechanism
 # accounting for the discrepancy between atomic time and the earth's rotation
 # did not exist until the early 1970s.
@@ -81,5 +80,5 @@
 Leap	2015	Jun	30	23:59:60	+	S
 Leap	2016	Dec	31	23:59:60	+	S
 
-#	Updated through IERS Bulletin C53
-#	File expires on:  28 December 2017
+#	Updated through IERS Bulletin C54
+#	File expires on:  28 June 2018
--- a/make/data/tzdata/northamerica	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/data/tzdata/northamerica	Wed Nov 15 08:25:28 2017 -0500
@@ -128,10 +128,13 @@
 # Last night I heard part of a rebroadcast of a 1945 Arch Oboler radio drama.
 # In the introduction, Oboler spoke of "Eastern Peace Time."
 # An AltaVista search turned up:
-# http://rowayton.org/rhs/hstaug45.html
+# https://web.archive.org/web/20000926032210/http://rowayton.org/rhs/hstaug45.html
 # "When the time is announced over the radio now, it is 'Eastern Peace
 # Time' instead of the old familiar 'Eastern War Time.'  Peace is wonderful."
 # (August 1945) by way of confirmation.
+#
+# From Paul Eggert (2017-09-23):
+# This was the V-J Day issue of the Clamdigger, a Rowayton, CT newsletter.
 
 # From Joseph Gallant citing
 # George H. Douglas, _The Early Days of Radio Broadcasting_ (1987):
@@ -280,7 +283,7 @@
 # HST and HDT are standardized abbreviations for Hawaii-Aleutian
 # standard and daylight times.  See section 9.47 (p 234) of the
 # U.S. Government Printing Office Style Manual (2008)
-# http://www.gpo.gov/fdsys/pkg/GPO-STYLEMANUAL-2008/pdf/GPO-STYLEMANUAL-2008.pdf
+# https://www.gpo.gov/fdsys/pkg/GPO-STYLEMANUAL-2008/pdf/GPO-STYLEMANUAL-2008.pdf
 
 # From Arthur David Olson, 2005-08-09
 # The following was signed into law on 2005-08-08.
@@ -369,7 +372,7 @@
 # western Tennessee, most of Texas, Wisconsin
 
 # From Larry M. Smith (2006-04-26) re Wisconsin:
-# http://www.legis.state.wi.us/statutes/Stat0175.pdf ...
+# https://docs.legis.wisconsin.gov/statutes/statutes/175.pdf
 # is currently enforced at the 01:00 time of change.  Because the local
 # "bar time" in the state corresponds to 02:00, a number of citations
 # are issued for the "sale of class 'B' alcohol after prohibited
@@ -378,7 +381,7 @@
 # From Douglas R. Bomberg (2007-03-12):
 # Wisconsin has enacted (nearly eleventh-hour) legislation to get WI
 # Statue 175 closer in synch with the US Congress' intent....
-# http://www.legis.state.wi.us/2007/data/acts/07Act3.pdf
+# https://docs.legis.wisconsin.gov/2007/related/acts/3
 
 # From an email administrator of the City of Fort Pierre, SD (2015-12-21):
 # Fort Pierre is technically located in the Mountain time zone as is
@@ -425,7 +428,7 @@
 # ...it appears that Mercer County, North Dakota, changed from the
 # mountain time zone to the central time zone at the last transition from
 # daylight-saving to standard time (on Nov. 7, 2010):
-# http://www.gpo.gov/fdsys/pkg/FR-2010-09-29/html/2010-24376.htm
+# https://www.gpo.gov/fdsys/pkg/FR-2010-09-29/html/2010-24376.htm
 # http://www.bismarcktribune.com/news/local/article_1eb1b588-c758-11df-b472-001cc4c03286.html
 
 # From Andy Lipscomb (2011-01-24):
@@ -476,7 +479,7 @@
 # legal time, and is not part of the data here.)  See:
 # Ross SA. An energy crisis from the past: Northern California in 1948.
 # Working Paper No. 8, Institute of Governmental Studies, UC Berkeley,
-# 1973-11.  http://escholarship.org/uc/item/8x22k30c
+# 1973-11.  https://escholarship.org/uc/item/8x22k30c
 #
 # In another measure to save electricity, DST was instituted from 1948-03-14
 # at 02:01 to 1949-01-16 at 02:00, with the governor having the option to move
@@ -497,8 +500,8 @@
 # which established DST from April's last Sunday at 01:00 until September's
 # last Sunday at 02:00. This was amended by 1962's Proposition 6, which changed
 # the fall-back date to October's last Sunday. See:
-# http://repository.uchastings.edu/cgi/viewcontent.cgi?article=1501&context=ca_ballot_props
-# http://repository.uchastings.edu/cgi/viewcontent.cgi?article=1636&context=ca_ballot_props
+# https://repository.uchastings.edu/cgi/viewcontent.cgi?article=1501&context=ca_ballot_props
+# https://repository.uchastings.edu/cgi/viewcontent.cgi?article=1636&context=ca_ballot_props
 #
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
 Rule	CA	1948	only	-	Mar	14	2:01	1:00	D
@@ -515,20 +518,31 @@
 # Alaska
 # AK%sT is the modern abbreviation for -09 per USNO.
 #
-# From Paul Eggert (2001-05-30):
+# From Paul Eggert (2017-06-15):
 # Howse writes that Alaska switched from the Julian to the Gregorian calendar,
 # and from east-of-GMT to west-of-GMT days, when the US bought it from Russia.
-# This was on 1867-10-18, a Friday; the previous day was 1867-10-06 Julian,
-# also a Friday.  Include only the time zone part of this transition,
-# ignoring the switch from Julian to Gregorian, since we can't represent
-# the Julian calendar.
+# On Friday, 1867-10-18 (Gregorian), at precisely 15:30 local time, the
+# Russian forts and fleet at Sitka fired salutes to mark the ceremony of
+# formal transfer.  See the Sacramento Daily Union (1867-11-14), p 3, col 2.
+# https://cdnc.ucr.edu/cgi-bin/cdnc?a=d&d=SDU18671114.2.12.1
+# Sitka workers did not change their calendars until Sunday, 1867-10-20,
+# and so celebrated two Sundays that week.  See: Ahllund T (tr Hallamaa P).
+# From the memoirs of a Finnish workman. Alaska History. 2006 Fall;21(2):1-25.
+# http://alaskahistoricalsociety.org/wp-content/uploads/2016/12/Ahllund-2006-Memoirs-of-a-Finnish-Workman.pdf
+# Include only the time zone part of this transition, ignoring the switch
+# from Julian to Gregorian, since we can't represent the Julian calendar.
 #
-# As far as we know, none of the exact locations mentioned below were
+# As far as we know, of the locations mentioned below only Sitka was
 # permanently inhabited in 1867 by anyone using either calendar.
-# (Yakutat was colonized by the Russians in 1799, but the settlement
-# was destroyed in 1805 by a Yakutat-kon war party.)  However, there
-# were nearby inhabitants in some cases and for our purposes perhaps
-# it's best to simply use the official transition.
+# (Yakutat was colonized by the Russians in 1799, but the settlement was
+# destroyed in 1805 by a Yakutat-kon war party.)  Many of Alaska's inhabitants
+# were unaware of the US acquisition of Alaska, much less of any calendar or
+# time change.  However, the Russian-influenced part of Alaska did observe
+# Russian time, and it is more accurate to model this than to ignore it.
+# The database format requires an exact transition time; use the Russian
+# salute as a somewhat-arbitrary time for the formal transfer of control for
+# all of Alaska.  Sitka's UTC offset is -9:01:13; adjust its 15:30 to the
+# local times of other Alaskan locations so that they change simultaneously.
 
 # From Paul Eggert (2014-07-18):
 # One opinion of the early-1980s turmoil in Alaska over time zones and
@@ -581,10 +595,10 @@
 # It seems Metlakatla did go off PST on Sunday, November 1, changing
 # their time to AKST and are going to follow Alaska's DST, switching
 # between AKST and AKDT from now on....
-# http://www.krbd.org/2015/10/30/annette-island-times-they-are-a-changing/
+# https://www.krbd.org/2015/10/30/annette-island-times-they-are-a-changing/
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone America/Juneau	 15:02:19 -	LMT	1867 Oct 18
+Zone America/Juneau	 15:02:19 -	LMT	1867 Oct 19 15:33:32
 			 -8:57:41 -	LMT	1900 Aug 20 12:00
 			 -8:00	-	PST	1942
 			 -8:00	US	P%sT	1946
@@ -594,7 +608,7 @@
 			 -8:00	US	P%sT	1983 Oct 30  2:00
 			 -9:00	US	Y%sT	1983 Nov 30
 			 -9:00	US	AK%sT
-Zone America/Sitka	 14:58:47 -	LMT	1867 Oct 18
+Zone America/Sitka	 14:58:47 -	LMT	1867 Oct 19 15:30
 			 -9:01:13 -	LMT	1900 Aug 20 12:00
 			 -8:00	-	PST	1942
 			 -8:00	US	P%sT	1946
@@ -602,7 +616,7 @@
 			 -8:00	US	P%sT	1983 Oct 30  2:00
 			 -9:00	US	Y%sT	1983 Nov 30
 			 -9:00	US	AK%sT
-Zone America/Metlakatla	 15:13:42 -	LMT	1867 Oct 18
+Zone America/Metlakatla	 15:13:42 -	LMT	1867 Oct 19 15:44:55
 			 -8:46:18 -	LMT	1900 Aug 20 12:00
 			 -8:00	-	PST	1942
 			 -8:00	US	P%sT	1946
@@ -610,14 +624,14 @@
 			 -8:00	US	P%sT	1983 Oct 30  2:00
 			 -8:00	-	PST	2015 Nov  1  2:00
 			 -9:00	US	AK%sT
-Zone America/Yakutat	 14:41:05 -	LMT	1867 Oct 18
+Zone America/Yakutat	 14:41:05 -	LMT	1867 Oct 19 15:12:18
 			 -9:18:55 -	LMT	1900 Aug 20 12:00
 			 -9:00	-	YST	1942
 			 -9:00	US	Y%sT	1946
 			 -9:00	-	YST	1969
 			 -9:00	US	Y%sT	1983 Nov 30
 			 -9:00	US	AK%sT
-Zone America/Anchorage	 14:00:24 -	LMT	1867 Oct 18
+Zone America/Anchorage	 14:00:24 -	LMT	1867 Oct 19 14:31:37
 			 -9:59:36 -	LMT	1900 Aug 20 12:00
 			-10:00	-	AST	1942
 			-10:00	US	A%sT	1967 Apr
@@ -625,7 +639,7 @@
 			-10:00	US	AH%sT	1983 Oct 30  2:00
 			 -9:00	US	Y%sT	1983 Nov 30
 			 -9:00	US	AK%sT
-Zone America/Nome	 12:58:21 -	LMT	1867 Oct 18
+Zone America/Nome	 12:58:22 -	LMT	1867 Oct 19 13:29:35
 			-11:01:38 -	LMT	1900 Aug 20 12:00
 			-11:00	-	NST	1942
 			-11:00	US	N%sT	1946
@@ -634,7 +648,7 @@
 			-11:00	US	B%sT	1983 Oct 30  2:00
 			 -9:00	US	Y%sT	1983 Nov 30
 			 -9:00	US	AK%sT
-Zone America/Adak	 12:13:21 -	LMT	1867 Oct 18
+Zone America/Adak	 12:13:22 -	LMT	1867 Oct 19 12:44:35
 			-11:46:38 -	LMT	1900 Aug 20 12:00
 			-11:00	-	NST	1942
 			-11:00	US	N%sT	1946
@@ -670,7 +684,7 @@
 # "Hawaiian Time" by Robert C. Schmitt and Doak C. Cox appears on pages 207-225
 # of volume 26 of The Hawaiian Journal of History (1992). As of 2010-12-09,
 # the article is available at
-# http://evols.library.manoa.hawaii.edu/bitstream/10524/239/2/JL26215.pdf
+# https://evols.library.manoa.hawaii.edu/bitstream/10524/239/2/JL26215.pdf
 # and indicates that standard time was adopted effective noon, January
 # 13, 1896 (page 218), that in "1933, the Legislature decreed daylight
 # saving for the period between the last Sunday of each April and the
@@ -769,7 +783,7 @@
 # Indiana
 #
 # For a map of Indiana's time zone regions, see:
-# http://en.wikipedia.org/wiki/Time_in_Indiana
+# https://en.wikipedia.org/wiki/Time_in_Indiana
 #
 # From Paul Eggert (2007-08-17):
 # Since 1970, most of Indiana has been like America/Indiana/Indianapolis,
@@ -996,7 +1010,7 @@
 # From Paul Eggert (2001-07-16):
 # The final rule was published in the
 # Federal Register 65, 160 (2000-08-17), pp 50154-50158.
-# http://frwebgate.access.gpo.gov/cgi-bin/getdoc.cgi?dbname=2000_register&docid=fr17au00-22
+# https://www.gpo.gov/fdsys/pkg/FR-2000-08-17/html/00-20854.htm
 #
 Zone America/Kentucky/Monticello -5:39:24 - LMT	1883 Nov 18 12:20:36
 			-6:00	US	C%sT	1946
@@ -1022,7 +1036,7 @@
 # West Wendover, NV officially switched from Pacific to mountain time on
 # 1999-10-31.  See the
 # Federal Register 64, 203 (1999-10-21), pp 56705-56707.
-# http://frwebgate.access.gpo.gov/cgi-bin/getdoc.cgi?dbname=1999_register&docid=fr21oc99-15
+# https://www.gpo.gov/fdsys/pkg/FR-1999-10-21/html/99-27240.htm
 # However, the Federal Register says that West Wendover already operated
 # on mountain time, and the rule merely made this official;
 # hence a separate tz entry is not needed.
@@ -1052,12 +1066,23 @@
 # one hour in 1914."  This change is not in Shanks.  We have no more
 # info, so omit this for now.
 #
+# From Paul Eggert (2017-07-26):
+# Although Shanks says Detroit observed DST in 1967 from 06-14 00:01
+# until 10-29 00:01, I now see multiple reports that this is incorrect.
+# For example, according to a 50-year anniversary report about the 1967
+# Detroit riots and a major-league doubleheader on 1967-07-23, "By the time
+# the last fly ball of the doubleheader settled into the glove of leftfielder
+# Lenny Green, it was after 7 p.m.  Detroit did not observe daylight saving
+# time, so light was already starting to fail.  Twilight was made even deeper
+# by billowing columns of smoke that ascended in an unbroken wall north of the
+# ballpark."  See: Dow B. Detroit '67: As violence unfolded, Tigers played two
+# at home vs. Yankees. Detroit Free Press 2017-07-23.
+# https://www.freep.com/story/sports/mlb/tigers/2017/07/23/detroit-tigers-1967-riot-new-york-yankees/499951001/
+#
 # Most of Michigan observed DST from 1973 on, but was a bit late in 1975.
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
 Rule	Detroit	1948	only	-	Apr	lastSun	2:00	1:00	D
 Rule	Detroit	1948	only	-	Sep	lastSun	2:00	0	S
-Rule	Detroit	1967	only	-	Jun	14	2:00	1:00	D
-Rule	Detroit	1967	only	-	Oct	lastSun	2:00	0	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Detroit	-5:32:11 -	LMT	1905
 			-6:00	-	CST	1915 May 15  2:00
@@ -1121,7 +1146,7 @@
 #	[PDF] (1914-03)
 #
 #	Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
-#	<http://www.jstor.org/stable/1774359>.
+#	<https://www.jstor.org/stable/1774359>.
 #
 # See the 'europe' file for Greenland.
 
@@ -1167,19 +1192,19 @@
 # The British Columbia government announced yesterday that it will
 # adjust daylight savings next year to align with changes in the
 # U.S. and the rest of Canada....
-# http://www2.news.gov.bc.ca/news_releases_2005-2009/2006AG0014-000330.htm
+# https://archive.news.gov.bc.ca/releases/news_releases_2005-2009/2006AG0014-000330.htm
 # ...
 # Nova Scotia
 # Daylight saving time will be extended by four weeks starting in 2007....
-# http://www.gov.ns.ca/just/regulations/rg2/2006/ma1206.pdf
+# https://www.novascotia.ca/just/regulations/rg2/2006/ma1206.pdf
 #
 # [For New Brunswick] the new legislation dictates that the time change is to
 # be done at 02:00 instead of 00:01.
-# http://www.gnb.ca/0062/acts/BBA-2006/Chap-19.pdf
+# https://www.gnb.ca/0062/acts/BBA-2006/Chap-19.pdf
 # ...
 # Manitoba has traditionally changed the clock every fall at 03:00.
 # As of 2006, the transition is to take place one hour earlier at 02:00.
-# http://web2.gov.mb.ca/laws/statutes/ccsm/o030e.php
+# https://web2.gov.mb.ca/laws/statutes/ccsm/o030e.php
 # ...
 # [Alberta, Ontario, Quebec] will follow US rules.
 # http://www.qp.gov.ab.ca/documents/spring/CH03_06.CFM
@@ -1193,7 +1218,7 @@
 # http://www.hoa.gov.nl.ca/hoa/bills/Bill0634.htm
 # ...
 # Yukon
-# http://www.gov.yk.ca/legislation/regs/oic2006_127.pdf
+# https://www.gov.yk.ca/legislation/regs/oic2006_127.pdf
 # ...
 # N.W.T. will follow US rules.  Whoever maintains the government web site
 # does not seem to believe in bookmarks.  To see the news release, click the
@@ -1214,8 +1239,8 @@
 # time and daylight saving time arrangements in Canada circa 1998.
 #
 # National Research Council Canada maintains info about time zones and DST.
-# http://www.nrc-cnrc.gc.ca/eng/services/time/time_zones.html
-# http://www.nrc-cnrc.gc.ca/eng/services/time/faq/index.html#Q5
+# https://www.nrc-cnrc.gc.ca/eng/services/time/time_zones.html
+# https://www.nrc-cnrc.gc.ca/eng/services/time/faq/index.html#Q5
 # Its unofficial information is often taken from Matthews and Vincent.
 
 # From Paul Eggert (2006-06-27):
@@ -1252,11 +1277,13 @@
 
 # Newfoundland and Labrador
 
-# From Paul Eggert (2000-10-02):
-# Matthews and Vincent (1998) write that Labrador should use NST/NDT,
-# but the only part of Labrador that follows the rules is the
-# southeast corner, including Port Hope Simpson and Mary's Harbour,
-# but excluding, say, Black Tickle.
+# From Paul Eggert (2017-10-14):
+# Legally Labrador should observe Newfoundland time; see:
+# McLeod J. Labrador time - legal or not? St. John's Telegram, 2017-10-07
+# http://www.thetelegram.com/news/local/labrador-time--legal-or-not-154860/
+# Matthews and Vincent (1998) write that the only part of Labrador
+# that follows the rules is the southeast corner, including Port Hope
+# Simpson and Mary's Harbour, but excluding, say, Black Tickle.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	StJohns	1917	only	-	Apr	 8	2:00	1:00	D
@@ -1456,7 +1483,7 @@
 # http://www.justice.gouv.qc.ca/english/publications/generale/temps-minganie-a.htm
 # that the coastal strip from just east of Natashquan to Blanc-Sablon
 # observes Atlantic standard time all year round.
-# http://www.assnat.qc.ca/Media/Process.aspx?MediaId=ANQ.Vigie.Bll.DocumentGenerique_8845en
+# https://www.assnat.qc.ca/Media/Process.aspx?MediaId=ANQ.Vigie.Bll.DocumentGenerique_8845en
 # says this common practice was codified into law as of 2007.
 # For lack of better info, guess this practice began around 1970, contra to
 # Shanks & Pottenger who have this region observing AST/ADT.
@@ -1488,6 +1515,11 @@
 # earlier in June).
 #
 # Kenora, Ontario, was to abandon DST on 1914-06-01 (-05-21).
+#
+# From Paul Eggert (2017-07-08):
+# For more on Orillia, see: Daubs K. Bold attempt at daylight saving
+# time became a comic failure in Orillia. Toronto Star 2017-07-08.
+# https://www.thestar.com/news/insight/2017/07/08/bold-attempt-at-daylight-saving-time-became-a-comic-failure-in-orillia.html
 
 # From Paul Eggert (1997-10-17):
 # Mark Brader writes that an article in the 1997-10-14 Toronto Star
@@ -1979,7 +2011,7 @@
 #	* 1967. Paragraph 28(34)(g) of the Interpretation Act, S.C. 1967-68,
 #	c. 7 defines Yukon standard time as UTC-9....
 #	see Interpretation Act, R.S.C. 1985, c. I-21, s. 35(1).
-#	[http://canlii.ca/t/7vhg]
+#	[https://www.canlii.org/en/ca/laws/stat/rsc-1985-c-i-21/latest/rsc-1985-c-i-21.html]
 #	* C.O. 1973/214 switched Yukon to PST on 1973-10-28 00:00.
 #	* O.I.C. 1980/02 established DST.
 #	* O.I.C. 1987/056 changed DST to Apr firstSun 2:00 to Oct lastSun 2:00.
@@ -2044,7 +2076,7 @@
 #     hours behind Greenwich Time.
 #
 # * Yukon Standard Time defined as Pacific Standard Time, YCO 1973/214
-#   http://www.canlii.org/en/yk/laws/regu/yco-1973-214/latest/yco-1973-214.html
+#   https://www.canlii.org/en/yk/laws/regu/yco-1973-214/latest/yco-1973-214.html
 #   C.O. 1973/214 INTERPRETATION ACT ...
 #
 #     1. Effective October 28, 1973 Commissioner's Order 1967/59 is hereby
@@ -2059,7 +2091,7 @@
 #   http://? - no online source found
 #
 # * Yukon Daylight Saving Time, YOIC 1987/56
-#   http://www.canlii.org/en/yk/laws/regu/yoic-1987-56/latest/yoic-1987-56.html
+#   https://www.canlii.org/en/yk/laws/regu/yoic-1987-56/latest/yoic-1987-56.html
 #   O.I.C. 1987/056 INTERPRETATION ACT ...
 #
 #   In every year between
@@ -2071,7 +2103,7 @@
 #   Dated ... 9th day of March, A.D., 1987.
 #
 # * Yukon Daylight Saving Time 2006, YOIC 2006/127
-#   http://www.canlii.org/en/yk/laws/regu/yoic-2006-127/latest/yoic-2006-127.html
+#   https://www.canlii.org/en/yk/laws/regu/yoic-2006-127/latest/yoic-2006-127.html
 #   O.I.C. 2006/127 INTERPRETATION ACT ...
 #
 #     1. In Yukon each year the time for general purposes shall be 7 hours
@@ -2085,7 +2117,7 @@
 #     3. This order comes into force January 1, 2007.
 #
 # * Interpretation Act, RSY 2002, c 125
-# http://www.canlii.org/en/yk/laws/stat/rsy-2002-c-125/latest/rsy-2002-c-125.html
+# https://www.canlii.org/en/yk/laws/stat/rsy-2002-c-125/latest/rsy-2002-c-125.html
 
 # From Rives McDow (1999-09-04):
 # Nunavut ... moved ... to incorporate the whole territory into one time zone.
@@ -2128,7 +2160,7 @@
 
 # From Michaela Rodrigue, writing in the
 # Nunatsiaq News (1999-11-19):
-# http://www.nunatsiaq.com/archives/nunavut991130/nvt91119_17.html
+# http://www.nunatsiaqonline.ca/archives/nunavut991130/nvt91119_17.html
 # Clyde River, Pangnirtung and Sanikiluaq now operate with two time zones,
 # central - or Nunavut time - for government offices, and eastern time
 # for municipal offices and schools....  Igloolik [was similar but then]
@@ -2146,7 +2178,7 @@
 # Central Time and Southampton Island [in the Central zone] is not
 # required to use daylight savings.
 
-# From <http://www.nunatsiaq.com/archives/nunavut001130/nvt21110_02.html>
+# From <http://www.nunatsiaqonline.ca/archives/nunavut001130/nvt21110_02.html>
 # Nunavut now has two time zones (2000-11-10):
 # The Nunavut government would allow its employees in Kugluktuk and
 # Cambridge Bay to operate on central time year-round, putting them
@@ -2477,7 +2509,7 @@
 # http://gaceta.diputados.gob.mx/Gaceta/61/2009/dic/V2-101209.html
 #
 # Our page:
-# http://www.timeanddate.com/news/time/north-mexico-dst-change.html
+# https://www.timeanddate.com/news/time/north-mexico-dst-change.html
 
 # From Arthur David Olson (2010-01-20):
 # The page
@@ -2896,7 +2928,7 @@
 # http://www.nnc.cubaweb.cu/marzo-2008/cien-1-11-3-08.htm
 #
 # Some more background information is posted here:
-# http://www.timeanddate.com/news/time/cuba-starts-dst-march-16.html
+# https://www.timeanddate.com/news/time/cuba-starts-dst-march-16.html
 #
 # The article also says that Cuba has been observing DST since 1963,
 # while Shanks (and tzdata) has 1965 as the first date (except in the
@@ -2943,7 +2975,7 @@
 # http://granma.co.cu/2011/03/08/nacional/artic01.html
 #
 # Our info:
-# http://www.timeanddate.com/news/time/cuba-starts-dst-2011.html
+# https://www.timeanddate.com/news/time/cuba-starts-dst-2011.html
 #
 # From Steffen Thorsen (2011-10-30)
 # Cuba will end DST two weeks later this year. Instead of going back
@@ -2953,7 +2985,7 @@
 # http://www.radioangulo.cu/noticias/cuba/17105-cuba-restablecera-el-horario-del-meridiano-de-greenwich.html
 #
 # Our page:
-# http://www.timeanddate.com/news/time/cuba-time-changes-2011.html
+# https://www.timeanddate.com/news/time/cuba-time-changes-2011.html
 #
 # From Steffen Thorsen (2012-03-01)
 # According to Radio Reloj, Cuba will start DST on Midnight between March
@@ -2963,7 +2995,7 @@
 # http://www.radioreloj.cu/index.php/noticias-radio-reloj/71-miscelaneas/7529-cuba-aplicara-el-horario-de-verano-desde-el-1-de-abril
 #
 # Our info on it:
-# http://www.timeanddate.com/news/time/cuba-starts-dst-2012.html
+# https://www.timeanddate.com/news/time/cuba-starts-dst-2012.html
 
 # From Steffen Thorsen (2012-11-03):
 # Radio Reloj and many other sources report that Cuba is changing back
@@ -3158,8 +3190,8 @@
 # From Steffen Thorsen (2016-03-12):
 # Jean Antoine, editor of www.haiti-reference.com informed us that Haiti
 # are not going on DST this year.  Several other resources confirm this: ...
-# http://www.radiotelevisioncaraibes.com/presse/heure_d_t_pas_de_changement_d_heure_pr_vu_pour_cet_ann_e.html
-# http://www.vantbefinfo.com/changement-dheure-pas-pour-haiti/
+# https://www.radiotelevisioncaraibes.com/presse/heure_d_t_pas_de_changement_d_heure_pr_vu_pour_cet_ann_e.html
+# https://www.vantbefinfo.com/changement-dheure-pas-pour-haiti/
 # http://news.anmwe.com/haiti-lheure-nationale-ne-sera-ni-avancee-ni-reculee-cette-annee/
 
 # From Steffen Thorsen (2017-03-12):
@@ -3358,7 +3390,7 @@
 # Turks and Caicos
 #
 # From Chris Dunn in
-# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=415007
+# https://bugs.debian.org/415007
 # (2007-03-15): In the Turks & Caicos Islands (America/Grand_Turk) the
 # daylight saving dates for time changes have been adjusted to match
 # the recent U.S. change of dates.
@@ -3380,12 +3412,25 @@
 # "permanent daylight saving time" by one year....
 # http://tcweeklynews.com/time-change-to-go-ahead-this-november-p5437-127.htm
 #
+# From the Turks & Caicos Cabinet (2017-07-20), heads-up from Steffen Thorsen:
+# ... agreed to the reintroduction in TCI of Daylight Saving Time (DST)
+# during the summer months and Standard Time, also known as Local
+# Time, during the winter months with effect from April 2018 ...
+# https://www.gov.uk/government/news/turks-and-caicos-post-cabinet-meeting-statement--3
+#
+# From Paul Eggert (2017-08-26):
+# The date of effect of the spring 2018 change appears to be March 11,
+# which makes more sense.  See: Hamilton D. Time change back
+# by March 2018 for TCI. Magnetic Media. 2017-08-25.
+# http://magneticmediatv.com/2017/08/time-change-back-by-march-2018-for-tci/
+#
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Grand_Turk	-4:44:32 -	LMT	1890
 			-5:07:11 -	KMT	1912 Feb # Kingston Mean Time
 			-5:00	-	EST	1979
 			-5:00	US	E%sT	2015 Nov Sun>=1 2:00
-			-4:00	-	AST
+			-4:00	-	AST	2018 Mar 11 3:00
+			-5:00	US	E%sT
 
 # British Virgin Is
 # Virgin Is
--- a/make/data/tzdata/southamerica	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/data/tzdata/southamerica	Wed Nov 15 08:25:28 2017 -0500
@@ -45,7 +45,7 @@
 #
 # For data circa 1899, a common source is:
 # Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
-# http://www.jstor.org/stable/1774359
+# https://www.jstor.org/stable/1774359
 #
 # These tables use numeric abbreviations like -03 and -0330 for
 # integer hour and minute UTC offsets.  Although earlier editions used
@@ -288,8 +288,8 @@
 #
 # Es inminente que en San Luis atrasen una hora los relojes
 # (It is imminent in San Luis clocks one hour delay)
-# http://www.lagaceta.com.ar/nota/253414/Economia/Es-inminente-que-en-San-Luis-atrasen-una-hora-los-relojes.html
-# http://www.worldtimezone.net/dst_news/dst_news_argentina02.html
+# https://www.lagaceta.com.ar/nota/253414/Economia/Es-inminente-que-en-San-Luis-atrasen-una-hora-los-relojes.html
+# http://www.worldtimezone.com/dst_news/dst_news_argentina02.html
 
 # From Jesper Nørgaard Welen (2008-01-18):
 # The page of the San Luis provincial government
@@ -408,7 +408,7 @@
 # Perhaps San Luis operates on the legal fiction that it is at -04
 # with perpetual summer time, but ordinary usage typically seems to
 # just say it's at -03; see, for example,
-# http://es.wikipedia.org/wiki/Hora_oficial_argentina
+# https://es.wikipedia.org/wiki/Hora_oficial_argentina
 # We've documented similar situations as being plain changes to
 # standard time, so let's do that here too.  This does not change UTC
 # offsets, only tm_isdst and the time zone abbreviations.  One minor
@@ -739,7 +739,7 @@
 # (Portuguese)
 #
 # We have a written a short article about it as well:
-# http://www.timeanddate.com/news/time/brazil-dst-2008-2009.html
+# https://www.timeanddate.com/news/time/brazil-dst-2008-2009.html
 #
 # From Alexander Krivenyshev (2011-10-04):
 # State Bahia will return to Daylight savings time this year after 8 years off.
@@ -748,7 +748,7 @@
 
 # In Portuguese:
 # http://g1.globo.com/bahia/noticia/2011/10/governador-jaques-wagner-confirma-horario-de-verao-na-bahia.html
-# http://noticias.terra.com.br/brasil/noticias/0,,OI5390887-EI8139,00-Bahia+volta+a+ter+horario+de+verao+apos+oito+anos.html
+# https://noticias.terra.com.br/brasil/noticias/0,,OI5390887-EI8139,00-Bahia+volta+a+ter+horario+de+verao+apos+oito+anos.html
 
 # From Guilherme Bernardes Rodrigues (2011-10-07):
 # There is news in the media, however there is still no decree about it.
@@ -774,16 +774,16 @@
 
 # From Rodrigo Severo (2012-10-16):
 # Tocantins state will have DST.
-# http://noticias.terra.com.br/brasil/noticias/0,,OI6232536-EI306.html
+# https://noticias.terra.com.br/brasil/noticias/0,,OI6232536-EI306.html
 
 # From Steffen Thorsen (2013-09-20):
 # Tocantins in Brazil is very likely not to observe DST from October....
 # http://conexaoto.com.br/2013/09/18/ministerio-confirma-que-tocantins-esta-fora-do-horario-de-verao-em-2013-mas-falta-publicacao-de-decreto
 # We will keep this article updated when this is confirmed:
-# http://www.timeanddate.com/news/time/brazil-starts-dst-2013.html
+# https://www.timeanddate.com/news/time/brazil-starts-dst-2013.html
 
 # From Steffen Thorsen (2013-10-17):
-# http://www.timeanddate.com/news/time/acre-amazonas-change-time-zone.html
+# https://www.timeanddate.com/news/time/acre-amazonas-change-time-zone.html
 # Senator Jorge Viana announced that Acre will change time zone on November 10.
 # He did not specify the time of the change, nor if western parts of Amazonas
 # will change as well.
@@ -1099,18 +1099,18 @@
 # the following source, cited by Oscar van Vlijmen (2006-10-08):
 # [1] Chile Law
 # http://www.webexhibits.org/daylightsaving/chile.html
-# This contains a copy of a this official table:
+# This contains a copy of this official table:
 # Cambios en la hora oficial de Chile desde 1900 (retrieved 2008-03-30)
-# http://web.archive.org/web/20080330200901/http://www.horaoficial.cl/cambio.htm
+# https://web.archive.org/web/20080330200901/http://www.horaoficial.cl/cambio.htm
 # [1] needs several corrections, though.
 #
 # The first set of corrections is from:
 # [2] History of the Official Time of Chile
 # http://www.horaoficial.cl/ing/horaof_ing.html (retrieved 2012-03-06).  See:
-# http://web.archive.org/web/20120306042032/http://www.horaoficial.cl/ing/horaof_ing.html
+# https://web.archive.org/web/20120306042032/http://www.horaoficial.cl/ing/horaof_ing.html
 # This is an English translation of:
 # Historia de la hora oficial de Chile (retrieved 2012-10-24).  See:
-# http://web.archive.org/web/20121024234627/http://www.horaoficial.cl/horaof.htm
+# https://web.archive.org/web/20121024234627/http://www.horaoficial.cl/horaof.htm
 # A fancier Spanish version (requiring mouse-clicking) is at:
 # http://www.horaoficial.cl/historia_hora.html
 # Conflicts between [1] and [2] were resolved as follows:
@@ -1386,10 +1386,10 @@
 # Milne says the Central and South American Telegraph Company used -5:24:15.
 #
 # From Alois Treindl (2016-12-15):
-# http://www.elcomercio.com/actualidad/hora-sixto-1993.html
+# https://www.elcomercio.com/actualidad/hora-sixto-1993.html
 # ... Whether the law applied also to Galápagos, I do not know.
 # From Paul Eggert (2016-12-15):
-# http://www.elcomercio.com/afull/modificacion-husohorario-ecuador-presidentes-decreto.html
+# https://www.elcomercio.com/afull/modificacion-husohorario-ecuador-presidentes-decreto.html
 # This says President Sixto Durán Ballén signed decree No. 285, which
 # established DST from 1992-11-28 to 1993-02-05; it does not give transition
 # times.  The people called it "hora de Sixto" ("Sixto hour").  The change did
@@ -1801,7 +1801,7 @@
 # hours of presidential broadcasts, hours of lines,' quipped comedian
 # Jean Mary Curró ...". See: Cawthorne A, Kai D. Venezuela scraps
 # half-hour time difference set by Chavez. Reuters 2016-04-15 14:50 -0400
-# http://www.reuters.com/article/us-venezuela-timezone-idUSKCN0XC2BE
+# https://www.reuters.com/article/us-venezuela-timezone-idUSKCN0XC2BE
 #
 # From Matt Johnson (2016-04-20):
 # ... published in the official Gazette [2016-04-18], here:
--- a/make/data/tzdata/zone.tab	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/data/tzdata/zone.tab	Wed Nov 15 08:25:28 2017 -0500
@@ -209,7 +209,7 @@
 GD	+1203-06145	America/Grenada
 GE	+4143+04449	Asia/Tbilisi
 GF	+0456-05220	America/Cayenne
-GG	+4927-00232	Europe/Guernsey
+GG	+492717-0023210	Europe/Guernsey
 GH	+0533-00013	Africa/Accra
 GI	+3608-00521	Europe/Gibraltar
 GL	+6411-05144	America/Godthab	Greenland (most areas)
@@ -244,7 +244,7 @@
 IR	+3540+05126	Asia/Tehran
 IS	+6409-02151	Atlantic/Reykjavik
 IT	+4154+01229	Europe/Rome
-JE	+4912-00207	Europe/Jersey
+JE	+491101-0020624	Europe/Jersey
 JM	+175805-0764736	America/Jamaica
 JO	+3157+03556	Asia/Amman
 JP	+353916+1394441	Asia/Tokyo
--- a/make/hotspot/lib/JvmFeatures.gmk	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/hotspot/lib/JvmFeatures.gmk	Wed Nov 15 08:25:28 2017 -0500
@@ -153,7 +153,7 @@
   # like the old build, but it's probably not right.
   JVM_OPTIMIZATION :=
   JVM_CFLAGS_FEATURES += -O3 -flto
-  JVM_LDFLAGS_FEATURES += -O3 -flto -fwhole-program -fno-strict-aliasing
+  JVM_LDFLAGS_FEATURES += -O3 -flto -fuse-linker-plugin -fno-strict-aliasing
 endif
 
 ifeq ($(call check-jvm-feature, minimal), true)
--- a/make/lib/Lib-jdk.net.gmk	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/lib/Lib-jdk.net.gmk	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2016, 2017, 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
@@ -35,7 +35,7 @@
       SRC := $(TOPDIR)/src/jdk.net/solaris/native/libextnet, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/jdk.net, \
-      MAPFILE := $(TOPDIR)/make/mapfiles/libextnet/mapfile-vers, \
+      MAPFILE := $(TOPDIR)/make/mapfiles/libextnet/mapfile-solaris, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := -lsocket -lc -ljava, \
@@ -48,4 +48,25 @@
 endif
 
 
+ifeq ($(OPENJDK_TARGET_OS), linux)
+
+  $(eval $(call SetupNativeCompilation, BUILD_LIBEXTNET, \
+      LIBRARY := extnet, \
+      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+      SRC := $(TOPDIR)/src/jdk.net/linux/native/libextnet, \
+      OPTIMIZATION := LOW, \
+      CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/jdk.net, \
+      MAPFILE := $(TOPDIR)/make/mapfiles/libextnet/mapfile-linux, \
+      LDFLAGS := $(LDFLAGS_JDKLIB) \
+          $(call SET_SHARED_LIBRARY_ORIGIN), \
+      LIBS := -ljvm -ljava -lc, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libextnet, \
+  ))
+
+  $(BUILD_LIBEXTNET): $(call FindLib, java.base, java)
+
+  TARGETS += $(BUILD_LIBEXTNET)
+endif
+
+
 ################################################################################
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/mapfiles/libextnet/mapfile-linux	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2017, 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.
+#
+
+SUNWprivate_1.1 {
+	global:
+    	Java_jdk_net_LinuxSocketOptions_setQuickAck0;
+    	Java_jdk_net_LinuxSocketOptions_getQuickAck0;
+    	Java_jdk_net_LinuxSocketOptions_quickAckSupported0;
+	local:
+	    *;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/mapfiles/libextnet/mapfile-solaris	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2017, 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.
+#
+
+SUNWprivate_1.1 {
+	global:
+	    Java_jdk_net_SolarisSocketOptions_init;
+	    Java_jdk_net_SolarisSocketOptions_setFlowOption;
+	    Java_jdk_net_SolarisSocketOptions_getFlowOption;
+	    Java_jdk_net_SolarisSocketOptions_flowSupported;
+	local:
+	    *;
+};
--- a/make/mapfiles/libextnet/mapfile-vers	Wed Nov 15 08:14:56 2017 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +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.  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.
-#
-
-SUNWprivate_1.1 {
-	global:
-	    Java_jdk_net_SolarisSocketOptions_init;
-	    Java_jdk_net_SolarisSocketOptions_setFlowOption;
-	    Java_jdk_net_SolarisSocketOptions_getFlowOption;
-	    Java_jdk_net_SolarisSocketOptions_flowSupported;
-	local:
-	    *;
-};
--- a/make/test/JtregNativeHotspot.gmk	Wed Nov 15 08:14:56 2017 -0500
+++ b/make/test/JtregNativeHotspot.gmk	Wed Nov 15 08:25:28 2017 -0500
@@ -60,6 +60,7 @@
     $(TOPDIR)/test/hotspot/jtreg/runtime/SameObject \
     $(TOPDIR)/test/hotspot/jtreg/runtime/BoolReturn \
     $(TOPDIR)/test/hotspot/jtreg/runtime/noClassDefFoundMsg \
+    $(TOPDIR)/test/hotspot/jtreg/runtime/handshake \
     $(TOPDIR)/test/hotspot/jtreg/runtime/RedefineTests \
     $(TOPDIR)/test/hotspot/jtreg/compiler/floatingpoint/ \
     $(TOPDIR)/test/hotspot/jtreg/compiler/calls \
@@ -108,6 +109,7 @@
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libMAAThreadStart := -lc
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libAllowedFunctions := -lc
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libRedefineDoubleDelete := -lc
+    BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libHandshakeTransitionTest := -lc
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
--- a/src/hotspot/cpu/aarch64/globals_aarch64.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/aarch64/globals_aarch64.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2015, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -79,6 +79,8 @@
 // Clear short arrays bigger than one word in an arch-specific way
 define_pd_global(intx, InitArrayShortSize, BytesPerLong);
 
+define_pd_global(bool, ThreadLocalHandshakes, false);
+
 #if defined(COMPILER1) || defined(COMPILER2)
 define_pd_global(intx, InlineSmallCode,          1000);
 #endif
--- a/src/hotspot/cpu/arm/globals_arm.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/arm/globals_arm.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, 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
@@ -79,6 +79,8 @@
 
 define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong);
 
+define_pd_global(bool, ThreadLocalHandshakes, false);
+
 #define ARCH_FLAGS(develop, \
                    product, \
                    diagnostic, \
--- a/src/hotspot/cpu/ppc/globals_ppc.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/ppc/globals_ppc.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -83,6 +83,8 @@
 // 2x unrolled loop is shorter with more than 9 HeapWords.
 define_pd_global(intx, InitArrayShortSize, 9*BytesPerLong);
 
+define_pd_global(bool, ThreadLocalHandshakes, false);
+
 // Platform dependent flag handling: flags only defined on this platform.
 #define ARCH_FLAGS(develop, \
                    product, \
--- a/src/hotspot/cpu/s390/globals_s390.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/s390/globals_s390.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -85,6 +85,8 @@
 // 8146801 (Short Array Allocation): No performance work done here yet.
 define_pd_global(intx, InitArrayShortSize, 1*BytesPerLong);
 
+define_pd_global(bool, ThreadLocalHandshakes, false);
+
 #define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct, range, constraint, writeable) \
                                                                               \
   /* Reoptimize code-sequences of calls at runtime, e.g. replace an */        \
--- a/src/hotspot/cpu/sparc/c1_LIRAssembler_sparc.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/sparc/c1_LIRAssembler_sparc.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -35,6 +35,7 @@
 #include "gc/shared/collectedHeap.hpp"
 #include "nativeInst_sparc.hpp"
 #include "oops/objArrayKlass.hpp"
+#include "runtime/safepointMechanism.inline.hpp"
 #include "runtime/sharedRuntime.hpp"
 
 #define __ _masm->
@@ -1415,7 +1416,11 @@
   if (StackReservedPages > 0 && compilation()->has_reserved_stack_access()) {
     __ reserved_stack_check();
   }
-  __ set((intptr_t)os::get_polling_page(), L0);
+  if (SafepointMechanism::uses_thread_local_poll()) {
+    __ ld_ptr(Address(G2_thread, Thread::polling_page_offset()), L0);
+  } else {
+    __ set((intptr_t)os::get_polling_page(), L0);
+  }
   __ relocate(relocInfo::poll_return_type);
   __ ld_ptr(L0, 0, G0);
   __ ret();
@@ -1424,11 +1429,16 @@
 
 
 int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) {
-  __ set((intptr_t)os::get_polling_page(), tmp->as_register());
+  if (SafepointMechanism::uses_thread_local_poll()) {
+    __ ld_ptr(Address(G2_thread, Thread::polling_page_offset()), tmp->as_register());
+  } else {
+    __ set((intptr_t)os::get_polling_page(), tmp->as_register());
+  }
   if (info != NULL) {
     add_debug_info_for_branch(info);
   }
   int offset = __ offset();
+
   __ relocate(relocInfo::poll_type);
   __ ld_ptr(tmp->as_register(), 0, G0);
   return offset;
--- a/src/hotspot/cpu/sparc/c1_LIRGenerator_sparc.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/sparc/c1_LIRGenerator_sparc.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -33,6 +33,7 @@
 #include "ci/ciArray.hpp"
 #include "ci/ciObjArrayKlass.hpp"
 #include "ci/ciTypeArrayKlass.hpp"
+#include "runtime/safepointMechanism.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "vmreg_sparc.inline.hpp"
@@ -1304,7 +1305,7 @@
   if (x->is_safepoint()) {
     // increment backedge counter if needed
     increment_backedge_counter(state_for(x, x->state_before()), x->profiled_bci());
-    __ safepoint(new_register(T_INT), state_for(x, x->state_before()));
+    __ safepoint(safepoint_poll_register(), state_for(x, x->state_before()));
   }
 
   __ cmp(lir_cond(cond), left, right);
--- a/src/hotspot/cpu/sparc/globalDefinitions_sparc.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/sparc/globalDefinitions_sparc.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -52,4 +52,7 @@
 #define SUPPORT_RESERVED_STACK_AREA
 #endif
 
+// SPARC have implemented the local polling
+#define THREAD_LOCAL_POLL
+
 #endif // CPU_SPARC_VM_GLOBALDEFINITIONS_SPARC_HPP
--- a/src/hotspot/cpu/sparc/globals_sparc.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/sparc/globals_sparc.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -87,6 +87,8 @@
 
 define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong);
 
+define_pd_global(bool, ThreadLocalHandshakes, true);
+
 #define ARCH_FLAGS(develop, \
                    product, \
                    diagnostic, \
--- a/src/hotspot/cpu/sparc/interp_masm_sparc.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/sparc/interp_masm_sparc.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -36,6 +36,7 @@
 #include "prims/jvmtiThreadState.hpp"
 #include "runtime/basicLock.hpp"
 #include "runtime/biasedLocking.hpp"
+#include "runtime/safepointMechanism.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/thread.inline.hpp"
 #include "utilities/align.hpp"
@@ -95,12 +96,11 @@
   else                delayed()->nop();
 }
 
-
-void InterpreterMacroAssembler::dispatch_next(TosState state, int bcp_incr) {
+void InterpreterMacroAssembler::dispatch_next(TosState state, int bcp_incr, bool generate_poll) {
   // %%%% consider branching to a single shared dispatch stub (for each bcp_incr)
   assert_not_delayed();
   ldub( Lbcp, bcp_incr, Lbyte_code);               // load next bytecode
-  dispatch_Lbyte_code(state, Interpreter::dispatch_table(state), bcp_incr);
+  dispatch_Lbyte_code(state, Interpreter::dispatch_table(state), bcp_incr, true, generate_poll);
 }
 
 
@@ -261,15 +261,34 @@
 // common code to dispatch and dispatch_only
 // dispatch value in Lbyte_code and increment Lbcp
 
-void InterpreterMacroAssembler::dispatch_Lbyte_code(TosState state, address* table, int bcp_incr, bool verify) {
+void InterpreterMacroAssembler::dispatch_Lbyte_code(TosState state, address* table, int bcp_incr, bool verify, bool generate_poll) {
   verify_FPU(1, state);
   // %%%%% maybe implement +VerifyActivationFrameSize here
   //verify_thread(); //too slow; we will just verify on method entry & exit
   if (verify) interp_verify_oop(Otos_i, state, __FILE__, __LINE__);
   // dispatch table to use
   AddressLiteral tbl(table);
+  Label dispatch;
+
+  if (SafepointMechanism::uses_thread_local_poll() && generate_poll) {
+    AddressLiteral sfpt_tbl(Interpreter::safept_table(state));
+    Label no_safepoint;
+
+    if (tbl.value() != sfpt_tbl.value()) {
+      ldx(Address(G2_thread, Thread::polling_page_offset()), G3_scratch, 0);
+      // Armed page has poll_bit set, if poll bit is cleared just continue.
+      and3(G3_scratch, SafepointMechanism::poll_bit(), G3_scratch);
+
+      br_null_short(G3_scratch, Assembler::pt, no_safepoint);
+      set(sfpt_tbl, G3_scratch);
+      ba_short(dispatch);
+    }
+    bind(no_safepoint);
+  }
+
+  set(tbl, G3_scratch);                               // compute addr of table
+  bind(dispatch);
   sll(Lbyte_code, LogBytesPerWord, Lbyte_code);       // multiply by wordSize
-  set(tbl, G3_scratch);                               // compute addr of table
   ld_ptr(G3_scratch, Lbyte_code, G3_scratch);         // get entry addr
   jmp( G3_scratch, 0 );
   if (bcp_incr != 0)  delayed()->inc(Lbcp, bcp_incr);
--- a/src/hotspot/cpu/sparc/interp_masm_sparc.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/sparc/interp_masm_sparc.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -98,7 +98,7 @@
   void dispatch_epilog(TosState state, int step = 0);
   void dispatch_only(TosState state);
   void dispatch_normal(TosState state);
-  void dispatch_next(TosState state, int step = 0);
+  void dispatch_next(TosState state, int step = 0, bool generate_poll = false);
   void dispatch_next_noverify_oop(TosState state, int step = 0);
   void dispatch_via (TosState state, address* table);
 
@@ -113,7 +113,7 @@
                          bool install_monitor_exception = true);
 
  protected:
-  void dispatch_Lbyte_code(TosState state, address* table, int bcp_incr = 0, bool verify = true);
+  void dispatch_Lbyte_code(TosState state, address* table, int bcp_incr = 0, bool verify = true, bool generate_poll = false);
 
  public:
   // Super call_VM calls - correspond to MacroAssembler::call_VM(_leaf) calls
--- a/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -37,6 +37,8 @@
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/objectMonitor.hpp"
 #include "runtime/os.inline.hpp"
+#include "runtime/safepoint.hpp"
+#include "runtime/safepointMechanism.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "utilities/align.hpp"
@@ -236,6 +238,20 @@
 }
 
 
+void MacroAssembler::safepoint_poll(Label& slow_path, bool a, Register thread_reg, Register temp_reg) {
+  if (SafepointMechanism::uses_thread_local_poll()) {
+    ldx(Address(thread_reg, Thread::polling_page_offset()), temp_reg, 0);
+    // Armed page has poll bit set.
+    and3(temp_reg, SafepointMechanism::poll_bit(), temp_reg);
+    br_notnull(temp_reg, a, Assembler::pn, slow_path);
+  } else {
+    AddressLiteral sync_state(SafepointSynchronize::address_of_state());
+
+    load_contents(sync_state, temp_reg);
+    cmp(temp_reg, SafepointSynchronize::_not_synchronized);
+    br(Assembler::notEqual, a, Assembler::pn, slow_path);
+  }
+}
 
 void MacroAssembler::enter() {
   Unimplemented();
--- a/src/hotspot/cpu/sparc/macroAssembler_sparc.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/sparc/macroAssembler_sparc.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -986,6 +986,8 @@
   // Support for serializing memory accesses between threads
   void serialize_memory(Register thread, Register tmp1, Register tmp2);
 
+  void safepoint_poll(Label& slow_path, bool a, Register thread_reg, Register temp_reg);
+
   // Stack frame creation/removal
   void enter();
   void leave();
--- a/src/hotspot/cpu/sparc/sharedRuntime_sparc.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/sparc/sharedRuntime_sparc.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -2359,7 +2359,6 @@
   // Block, if necessary, before resuming in _thread_in_Java state.
   // In order for GC to work, don't clear the last_Java_sp until after blocking.
   { Label no_block;
-    AddressLiteral sync_state(SafepointSynchronize::address_of_state());
 
     // Switch thread to "native transition" state before reading the synchronization state.
     // This additional state is necessary because reading and testing the synchronization
@@ -2382,12 +2381,10 @@
         __ serialize_memory(G2_thread, G1_scratch, G3_scratch);
       }
     }
-    __ load_contents(sync_state, G3_scratch);
-    __ cmp(G3_scratch, SafepointSynchronize::_not_synchronized);
 
     Label L;
     Address suspend_state(G2_thread, JavaThread::suspend_flags_offset());
-    __ br(Assembler::notEqual, false, Assembler::pn, L);
+    __ safepoint_poll(L, false, G2_thread, G3_scratch);
     __ delayed()->ld(suspend_state, G3_scratch);
     __ cmp_and_br_short(G3_scratch, 0, Assembler::equal, Assembler::pt, no_block);
     __ bind(L);
@@ -3118,7 +3115,7 @@
   } else {
     // Make it look like we were called via the poll
     // so that frame constructor always sees a valid return address
-    __ ld_ptr(G2_thread, in_bytes(JavaThread::saved_exception_pc_offset()), O7);
+    __ ld_ptr(Address(G2_thread, JavaThread::saved_exception_pc_offset()), O7);
     __ sub(O7, frame::pc_return_offset, O7);
   }
 
@@ -3127,6 +3124,15 @@
   // setup last_Java_sp (blows G4)
   __ set_last_Java_frame(SP, noreg);
 
+  Register saved_O7 = O7->after_save();
+  if (!cause_return && SafepointMechanism::uses_thread_local_poll()) {
+    // Keep a copy of the return pc in L0 to detect if it gets modified
+    __ mov(saved_O7, L0);
+    // Adjust and keep a copy of our npc saved by the signal handler
+    __ ld_ptr(Address(G2_thread, JavaThread::saved_exception_npc_offset()), L1);
+    __ sub(L1, frame::pc_return_offset, L1);
+  }
+
   // call into the runtime to handle illegal instructions exception
   // Do not use call_VM_leaf, because we need to make a GC map at this call site.
   __ mov(G2_thread, O0);
@@ -3150,6 +3156,12 @@
   __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), O1);
   __ br_notnull_short(O1, Assembler::pn, pending);
 
+  if (!cause_return && SafepointMechanism::uses_thread_local_poll()) {
+    // If nobody modified our return pc then we must return to the npc which he saved in L1
+    __ cmp(saved_O7, L0);
+    __ movcc(Assembler::equal, false, Assembler::ptr_cc, L1, saved_O7);
+  }
+
   RegisterSaver::restore_live_registers(masm);
 
   // We are back the the original state on entry and ready to go.
--- a/src/hotspot/cpu/sparc/sparc.ad	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/sparc/sparc.ad	Wed Nov 15 08:25:28 2017 -0500
@@ -1206,7 +1206,11 @@
   Compile* C = ra_->C;
 
   if(do_polling() && ra_->C->is_method_compilation()) {
-    st->print("SETHI  #PollAddr,L0\t! Load Polling address\n\t");
+    if (SafepointMechanism::uses_global_page_poll()) {
+      st->print("SETHI  #PollAddr,L0\t! Load Polling address\n\t");
+    } else {
+      st->print("LDX    [R_G2 + #poll_offset],L0\t! Load local polling address\n\t");
+    }
     st->print("LDX    [L0],G0\t!Poll for Safepointing\n\t");
   }
 
@@ -1233,8 +1237,12 @@
 
   // If this does safepoint polling, then do it here
   if(do_polling() && ra_->C->is_method_compilation()) {
-    AddressLiteral polling_page(os::get_polling_page());
-    __ sethi(polling_page, L0);
+    if (SafepointMechanism::uses_thread_local_poll()) {
+      __ ld_ptr(Address(G2_thread, Thread::polling_page_offset()), L0);
+    } else {
+      AddressLiteral polling_page(os::get_polling_page());
+      __ sethi(polling_page, L0);
+    }
     __ relocate(relocInfo::poll_return_type);
     __ ld_ptr(L0, 0, G0);
   }
@@ -1266,6 +1274,7 @@
 }
 
 int MachEpilogNode::safepoint_offset() const {
+  assert(SafepointMechanism::uses_global_page_poll(), "sanity");
   assert( do_polling(), "no return for this epilog node");
   return MacroAssembler::insts_for_sethi(os::get_polling_page()) * BytesPerInstWord;
 }
--- a/src/hotspot/cpu/sparc/templateInterpreterGenerator_sparc.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/sparc/templateInterpreterGenerator_sparc.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -912,10 +912,8 @@
 
     Label L_slow_path;
     // If we need a safepoint check, generate full interpreter entry.
-    ExternalAddress state(SafepointSynchronize::address_of_state());
-    __ set(ExternalAddress(SafepointSynchronize::address_of_state()), O2);
-    __ set(SafepointSynchronize::_not_synchronized, O3);
-    __ cmp_and_br_short(O2, O3, Assembler::notEqual, Assembler::pt, L_slow_path);
+    __ safepoint_poll(L_slow_path, false, G2_thread, O2);
+    __ delayed()->nop();
 
     // Load parameters
     const Register crc   = O0; // initial crc
@@ -956,10 +954,9 @@
 
     Label L_slow_path;
     // If we need a safepoint check, generate full interpreter entry.
-    ExternalAddress state(SafepointSynchronize::address_of_state());
-    __ set(ExternalAddress(SafepointSynchronize::address_of_state()), O2);
-    __ set(SafepointSynchronize::_not_synchronized, O3);
-    __ cmp_and_br_short(O2, O3, Assembler::notEqual, Assembler::pt, L_slow_path);
+
+    __ safepoint_poll(L_slow_path, false, G2_thread, O2);
+    __ delayed()->nop();
 
     // Load parameters from the stack
     const Register crc    = O0; // initial crc
@@ -1397,7 +1394,6 @@
   // Block, if necessary, before resuming in _thread_in_Java state.
   // In order for GC to work, don't clear the last_Java_sp until after blocking.
   { Label no_block;
-    AddressLiteral sync_state(SafepointSynchronize::address_of_state());
 
     // Switch thread to "native transition" state before reading the synchronization state.
     // This additional state is necessary because reading and testing the synchronization
@@ -1420,11 +1416,9 @@
         __ serialize_memory(G2_thread, G1_scratch, G3_scratch);
       }
     }
-    __ load_contents(sync_state, G3_scratch);
-    __ cmp(G3_scratch, SafepointSynchronize::_not_synchronized);
 
     Label L;
-    __ br(Assembler::notEqual, false, Assembler::pn, L);
+    __ safepoint_poll(L, false, G2_thread, G3_scratch);
     __ delayed()->ld(G2_thread, JavaThread::suspend_flags_offset(), G3_scratch);
     __ cmp_and_br_short(G3_scratch, 0, Assembler::equal, Assembler::pt, no_block);
     __ bind(L);
--- a/src/hotspot/cpu/sparc/templateTable_sparc.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/sparc/templateTable_sparc.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1499,7 +1499,7 @@
     // Push returnAddress for "ret" on stack
     __ push_ptr(Otos_i);
     // And away we go!
-    __ dispatch_next(vtos);
+    __ dispatch_next(vtos, 0, true);
     return;
   }
 
@@ -1607,7 +1607,7 @@
   // continue with bytecode @ target
   // %%%%% Like Intel, could speed things up by moving bytecode fetch to code above,
   // %%%%% and changing dispatch_next to dispatch_only
-  __ dispatch_next(vtos);
+  __ dispatch_next(vtos, 0, true);
 }
 
 
@@ -1676,7 +1676,7 @@
   __ ld_ptr(Lmethod, Method::const_offset(), G3_scratch);
   __ add(G3_scratch, Otos_i, G3_scratch);
   __ add(G3_scratch, in_bytes(ConstMethod::codes_offset()), Lbcp);
-  __ dispatch_next(vtos);
+  __ dispatch_next(vtos, 0, true);
 }
 
 
@@ -1691,7 +1691,7 @@
   __ ld_ptr(Lmethod, Method::const_offset(), G3_scratch);
   __ add(G3_scratch, Otos_i, G3_scratch);
   __ add(G3_scratch, in_bytes(ConstMethod::codes_offset()), Lbcp);
-  __ dispatch_next(vtos);
+  __ dispatch_next(vtos, 0, true);
 }
 
 
@@ -1727,7 +1727,7 @@
   // continue execution
   __ bind(continue_execution);
   __ add(Lbcp, O2, Lbcp);
-  __ dispatch_next(vtos);
+  __ dispatch_next(vtos, 0, true);
 }
 
 
@@ -1779,7 +1779,7 @@
     __ bind(continue_execution);
   }
   __ add(Lbcp, O4, Lbcp);
-  __ dispatch_next(vtos);
+  __ dispatch_next(vtos, 0, true);
 }
 
 
@@ -1888,7 +1888,7 @@
 
   __ bind(continue_execution);
   __ add( Lbcp, Rj, Lbcp );
-  __ dispatch_next( vtos );
+  __ dispatch_next(vtos, 0, true);
 }
 
 
@@ -1914,6 +1914,18 @@
     __ bind(skip_register_finalizer);
   }
 
+  if (SafepointMechanism::uses_thread_local_poll() && _desc->bytecode() != Bytecodes::_return_register_finalizer) {
+    Label no_safepoint;
+    __ ldx(Address(G2_thread, Thread::polling_page_offset()), G3_scratch, 0);
+    __ btst(SafepointMechanism::poll_bit(), G3_scratch);
+    __ br(Assembler::zero, false, Assembler::pt, no_safepoint);
+    __ delayed()->nop();
+    __ push(state);
+    __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint));
+    __ pop(state);
+    __ bind(no_safepoint);
+  }
+
   // Narrow result if state is itos but result type is smaller.
   // Need to narrow in the return bytecode rather than in generate_return_entry
   // since compiled code callers expect the result to already be narrowed.
--- a/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -526,32 +526,57 @@
 
   // Note: we do not need to round double result; float result has the right precision
   // the poll sets the condition code, but no data registers
-  AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_return_type);
-
-  if (Assembler::is_polling_page_far()) {
-    __ lea(rscratch1, polling_page);
+
+  if (SafepointMechanism::uses_thread_local_poll()) {
+#ifdef _LP64
+    __ movptr(rscratch1, Address(r15_thread, Thread::polling_page_offset()));
     __ relocate(relocInfo::poll_return_type);
     __ testl(rax, Address(rscratch1, 0));
+#else
+    ShouldNotReachHere();
+#endif
   } else {
-    __ testl(rax, polling_page);
+    AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_return_type);
+
+    if (Assembler::is_polling_page_far()) {
+      __ lea(rscratch1, polling_page);
+      __ relocate(relocInfo::poll_return_type);
+      __ testl(rax, Address(rscratch1, 0));
+    } else {
+      __ testl(rax, polling_page);
+    }
   }
   __ ret(0);
 }
 
 
 int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) {
-  AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_type);
   guarantee(info != NULL, "Shouldn't be NULL");
   int offset = __ offset();
-  if (Assembler::is_polling_page_far()) {
-    __ lea(rscratch1, polling_page);
-    offset = __ offset();
+  if (SafepointMechanism::uses_thread_local_poll()) {
+#ifdef _LP64
+    __ movptr(rscratch1, Address(r15_thread, Thread::polling_page_offset()));
     add_debug_info_for_branch(info);
     __ relocate(relocInfo::poll_type);
+    address pre_pc = __ pc();
     __ testl(rax, Address(rscratch1, 0));
+    address post_pc = __ pc();
+    guarantee(pointer_delta(post_pc, pre_pc, 1) == 3, "must be exact length");
+#else
+    ShouldNotReachHere();
+#endif
   } else {
-    add_debug_info_for_branch(info);
-    __ testl(rax, polling_page);
+    AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_type);
+    if (Assembler::is_polling_page_far()) {
+      __ lea(rscratch1, polling_page);
+      offset = __ offset();
+      add_debug_info_for_branch(info);
+      __ relocate(relocInfo::poll_type);
+      __ testl(rax, Address(rscratch1, 0));
+    } else {
+      add_debug_info_for_branch(info);
+      __ testl(rax, polling_page);
+    }
   }
   return offset;
 }
--- a/src/hotspot/cpu/x86/globalDefinitions_x86.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/x86/globalDefinitions_x86.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, 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
@@ -65,4 +65,9 @@
 #define SUPPORT_RESERVED_STACK_AREA
 #endif
 
+#ifdef _LP64
+// X64 have implemented the local polling
+#define THREAD_LOCAL_POLL
+#endif
+
 #endif // CPU_X86_VM_GLOBALDEFINITIONS_X86_HPP
--- a/src/hotspot/cpu/x86/globals_x86.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/x86/globals_x86.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -97,6 +97,12 @@
 
 define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong);
 
+#ifdef _LP64
+define_pd_global(bool, ThreadLocalHandshakes, true);
+#else
+define_pd_global(bool, ThreadLocalHandshakes, false);
+#endif
+
 #define ARCH_FLAGS(develop, \
                    product, \
                    diagnostic, \
--- a/src/hotspot/cpu/x86/interp_masm_x86.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -35,6 +35,7 @@
 #include "prims/jvmtiThreadState.hpp"
 #include "runtime/basicLock.hpp"
 #include "runtime/biasedLocking.hpp"
+#include "runtime/safepointMechanism.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/thread.inline.hpp"
 
@@ -809,7 +810,8 @@
 
 void InterpreterMacroAssembler::dispatch_base(TosState state,
                                               address* table,
-                                              bool verifyoop) {
+                                              bool verifyoop,
+                                              bool generate_poll) {
   verify_FPU(1, state);
   if (VerifyActivationFrameSize) {
     Label L;
@@ -827,8 +829,24 @@
     verify_oop(rax, state);
   }
 #ifdef _LP64
+
+  Label no_safepoint, dispatch;
+  address* const safepoint_table = Interpreter::safept_table(state);
+  if (SafepointMechanism::uses_thread_local_poll() && table != safepoint_table && generate_poll) {
+    NOT_PRODUCT(block_comment("Thread-local Safepoint poll"));
+
+    testb(Address(r15_thread, Thread::polling_page_offset()), SafepointMechanism::poll_bit());
+
+    jccb(Assembler::zero, no_safepoint);
+    lea(rscratch1, ExternalAddress((address)safepoint_table));
+    jmpb(dispatch);
+  }
+
+  bind(no_safepoint);
   lea(rscratch1, ExternalAddress((address)table));
+  bind(dispatch);
   jmp(Address(rscratch1, rbx, Address::times_8));
+
 #else
   Address index(noreg, rbx, Address::times_ptr);
   ExternalAddress tbl((address)table);
@@ -837,8 +855,8 @@
 #endif // _LP64
 }
 
-void InterpreterMacroAssembler::dispatch_only(TosState state) {
-  dispatch_base(state, Interpreter::dispatch_table(state));
+void InterpreterMacroAssembler::dispatch_only(TosState state, bool generate_poll) {
+  dispatch_base(state, Interpreter::dispatch_table(state), true, generate_poll);
 }
 
 void InterpreterMacroAssembler::dispatch_only_normal(TosState state) {
@@ -850,12 +868,12 @@
 }
 
 
-void InterpreterMacroAssembler::dispatch_next(TosState state, int step) {
+void InterpreterMacroAssembler::dispatch_next(TosState state, int step, bool generate_poll) {
   // load next bytecode (load before advancing _bcp_register to prevent AGI)
   load_unsigned_byte(rbx, Address(_bcp_register, step));
   // advance _bcp_register
   increment(_bcp_register, step);
-  dispatch_base(state, Interpreter::dispatch_table(state));
+  dispatch_base(state, Interpreter::dispatch_table(state), true, generate_poll);
 }
 
 void InterpreterMacroAssembler::dispatch_via(TosState state, address* table) {
--- a/src/hotspot/cpu/x86/interp_masm_x86.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/x86/interp_masm_x86.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -49,7 +49,7 @@
                             bool check_exceptions);
 
   // base routine for all dispatches
-  void dispatch_base(TosState state, address* table, bool verifyoop = true);
+  void dispatch_base(TosState state, address* table, bool verifyoop = true, bool generate_poll = false);
 
  public:
   InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code),
@@ -184,12 +184,12 @@
   void dispatch_prolog(TosState state, int step = 0);
   void dispatch_epilog(TosState state, int step = 0);
   // dispatch via rbx (assume rbx is loaded already)
-  void dispatch_only(TosState state);
+  void dispatch_only(TosState state, bool generate_poll = false);
   // dispatch normal table via rbx (assume rbx is loaded already)
   void dispatch_only_normal(TosState state);
   void dispatch_only_noverify(TosState state);
   // load rbx from [_bcp_register + step] and dispatch via rbx
-  void dispatch_next(TosState state, int step = 0);
+  void dispatch_next(TosState state, int step = 0, bool generate_poll = false);
   // load rbx from [_bcp_register] and dispatch via rbx and table
   void dispatch_via (TosState state, address* table);
 
--- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -38,6 +38,8 @@
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/objectMonitor.hpp"
 #include "runtime/os.hpp"
+#include "runtime/safepoint.hpp"
+#include "runtime/safepointMechanism.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "runtime/thread.hpp"
@@ -3759,6 +3761,25 @@
   movl(as_Address(ArrayAddress(page, index)), tmp);
 }
 
+#ifdef _LP64
+void MacroAssembler::safepoint_poll(Label& slow_path, Register thread_reg, Register temp_reg) {
+  if (SafepointMechanism::uses_thread_local_poll()) {
+    testb(Address(r15_thread, Thread::polling_page_offset()), SafepointMechanism::poll_bit());
+    jcc(Assembler::notZero, slow_path); // handshake bit set implies poll
+  } else {
+    cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
+        SafepointSynchronize::_not_synchronized);
+    jcc(Assembler::notEqual, slow_path);
+  }
+}
+#else
+void MacroAssembler::safepoint_poll(Label& slow_path) {
+  cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
+      SafepointSynchronize::_not_synchronized);
+  jcc(Assembler::notEqual, slow_path);
+}
+#endif
+
 // Calls to C land
 //
 // When entering C land, the rbp, & rsp of the last Java frame have to be recorded
--- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -656,6 +656,12 @@
   // Support for serializing memory accesses between threads
   void serialize_memory(Register thread, Register tmp);
 
+#ifdef _LP64
+  void safepoint_poll(Label& slow_path, Register thread_reg, Register temp_reg);
+#else
+  void safepoint_poll(Label& slow_path);
+#endif
+
   void verify_tlab();
 
   // Biased locking support
--- a/src/hotspot/cpu/x86/nativeInst_x86.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/x86/nativeInst_x86.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -29,6 +29,7 @@
 #include "memory/allocation.hpp"
 #include "runtime/icache.hpp"
 #include "runtime/os.hpp"
+#include "runtime/safepointMechanism.hpp"
 
 // We have interfaces for the following instructions:
 // - NativeInstruction
@@ -678,6 +679,7 @@
   enum Intel_specific_constants {
     instruction_rex_prefix_mask = 0xF0,
     instruction_rex_prefix      = Assembler::REX,
+    instruction_rex_b_prefix    = Assembler::REX_B,
     instruction_code_memXregl   = 0x85,
     modrm_mask                  = 0x38, // select reg from the ModRM byte
     modrm_reg                   = 0x00  // rax
@@ -703,6 +705,16 @@
                                                           (ubyte_at(0) & 0xF0) == 0x70;  /* short jump */ }
 inline bool NativeInstruction::is_safepoint_poll() {
 #ifdef AMD64
+  if (SafepointMechanism::uses_thread_local_poll()) {
+    // We know that the poll must have a REX_B prefix since we enforce its source to be
+    // a rex-register and the destination to be rax.
+    const bool has_rex_prefix = ubyte_at(0) == NativeTstRegMem::instruction_rex_b_prefix;
+    const bool is_test_opcode = ubyte_at(1) == NativeTstRegMem::instruction_code_memXregl;
+    const bool is_rax_target = (ubyte_at(2) & NativeTstRegMem::modrm_mask) == NativeTstRegMem::modrm_reg;
+    if (has_rex_prefix && is_test_opcode && is_rax_target) {
+      return true;
+    }
+  }
   // Try decoding a near safepoint first:
   if (ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl &&
       ubyte_at(1) == 0x05) { // 00 rax 101
--- a/src/hotspot/cpu/x86/relocInfo_x86.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/x86/relocInfo_x86.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, 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 @@
 #include "oops/klass.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/safepoint.hpp"
+#include "runtime/safepointMechanism.hpp"
 
 
 void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) {
@@ -183,9 +184,12 @@
   typedef Assembler::WhichOperand WhichOperand;
   WhichOperand which = (WhichOperand) format();
 #if !INCLUDE_JVMCI
-  assert((which == Assembler::disp32_operand) == !Assembler::is_polling_page_far(), "format not set correctly");
+  if (SafepointMechanism::uses_global_page_poll()) {
+    assert((which == Assembler::disp32_operand) == !Assembler::is_polling_page_far(), "format not set correctly");
+  }
 #endif
   if (which == Assembler::disp32_operand) {
+    assert(SafepointMechanism::uses_global_page_poll(), "should only have generated such a poll if global polling enabled");
     address orig_addr = old_addr_for(addr(), src, dest);
     NativeInstruction* oni = nativeInstruction_at(orig_addr);
     int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
--- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -30,6 +30,7 @@
 #include "asm/macroAssembler.inline.hpp"
 #include "code/debugInfoRec.hpp"
 #include "code/icBuffer.hpp"
+#include "code/nativeInst.hpp"
 #include "code/vtableStubs.hpp"
 #include "interpreter/interpreter.hpp"
 #include "logging/log.hpp"
@@ -2474,15 +2475,13 @@
   // check for safepoint operation in progress and/or pending suspend requests
   {
     Label Continue;
-
-    __ cmp32(ExternalAddress((address)SafepointSynchronize::address_of_state()),
-             SafepointSynchronize::_not_synchronized);
-
-    Label L;
-    __ jcc(Assembler::notEqual, L);
+    Label slow_path;
+
+    __ safepoint_poll(slow_path, r15_thread, rscratch1);
+
     __ cmpl(Address(r15_thread, JavaThread::suspend_flags_offset()), 0);
     __ jcc(Assembler::equal, Continue);
-    __ bind(L);
+    __ bind(slow_path);
 
     // Don't use call_VM as it will see a possible pending exception and forward it
     // and never return here preventing us from clearing _last_native_pc down below.
@@ -3355,9 +3354,11 @@
   // sees an invalid pc.
 
   if (!cause_return) {
-    // overwrite the dummy value we pushed on entry
-    __ movptr(c_rarg0, Address(r15_thread, JavaThread::saved_exception_pc_offset()));
-    __ movptr(Address(rbp, wordSize), c_rarg0);
+    // Get the return pc saved by the signal handler and stash it in its appropriate place on the stack.
+    // Additionally, rbx is a callee saved register and we can look at it later to determine
+    // if someone changed the return address for us!
+    __ movptr(rbx, Address(r15_thread, JavaThread::saved_exception_pc_offset()));
+    __ movptr(Address(rbp, wordSize), rbx);
   }
 
   // Do the call
@@ -3387,11 +3388,38 @@
   // No exception case
   __ bind(noException);
 
+  Label no_adjust, bail;
+  if (SafepointMechanism::uses_thread_local_poll() && !cause_return) {
+    // If our stashed return pc was modified by the runtime we avoid touching it
+    __ cmpptr(rbx, Address(rbp, wordSize));
+    __ jccb(Assembler::notEqual, no_adjust);
+
+#ifdef ASSERT
+    // Verify the correct encoding of the poll we're about to skip.
+    // See NativeInstruction::is_safepoint_poll()
+    __ cmpb(Address(rbx, 0), NativeTstRegMem::instruction_rex_b_prefix);
+    __ jcc(Assembler::notEqual, bail);
+    __ cmpb(Address(rbx, 1), NativeTstRegMem::instruction_code_memXregl);
+    __ jcc(Assembler::notEqual, bail);
+    // Mask out the modrm bits
+    __ testb(Address(rbx, 2), NativeTstRegMem::modrm_mask);
+    // rax encodes to 0, so if the bits are nonzero it's incorrect
+    __ jcc(Assembler::notZero, bail);
+#endif
+    // Adjust return pc forward to step over the safepoint poll instruction
+    __ addptr(Address(rbp, wordSize), 3);
+  }
+
+  __ bind(no_adjust);
   // Normal exit, restore registers and exit.
   RegisterSaver::restore_live_registers(masm, save_vectors);
-
   __ ret(0);
 
+#ifdef ASSERT
+  __ bind(bail);
+  __ stop("Attempting to adjust pc to skip safepoint poll but the return point is not what we expected");
+#endif
+
   // Make sure all code is generated
   masm->flush();
 
--- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1141,14 +1141,17 @@
   // check for safepoint operation in progress and/or pending suspend requests
   {
     Label Continue;
-    __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
-             SafepointSynchronize::_not_synchronized);
+    Label slow_path;
 
-    Label L;
-    __ jcc(Assembler::notEqual, L);
+#ifndef _LP64
+    __ safepoint_poll(slow_path);
+#else
+    __ safepoint_poll(slow_path, r15_thread, rscratch1);
+#endif
+
     __ cmpl(Address(thread, JavaThread::suspend_flags_offset()), 0);
     __ jcc(Assembler::equal, Continue);
-    __ bind(L);
+    __ bind(slow_path);
 
     // Don't use call_VM as it will see a possible pending exception
     // and forward it and never return here preventing us from
--- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -190,11 +190,7 @@
     // c_rarg1: scratch (rsi on non-Win64, rdx on Win64)
 
     Label slow_path;
-    // If we need a safepoint check, generate full interpreter entry.
-    ExternalAddress state(SafepointSynchronize::address_of_state());
-    __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
-             SafepointSynchronize::_not_synchronized);
-    __ jcc(Assembler::notEqual, slow_path);
+    __ safepoint_poll(slow_path, r15_thread, rscratch1);
 
     // We don't generate local frame and don't align stack because
     // we call stub code and there is no safepoint on this path.
@@ -240,11 +236,7 @@
     // r13: senderSP must preserved for slow path, set SP to it on fast path
 
     Label slow_path;
-    // If we need a safepoint check, generate full interpreter entry.
-    ExternalAddress state(SafepointSynchronize::address_of_state());
-    __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
-             SafepointSynchronize::_not_synchronized);
-    __ jcc(Assembler::notEqual, slow_path);
+    __ safepoint_poll(slow_path, r15_thread, rscratch1);
 
     // We don't generate local frame and don't align stack because
     // we call stub code and there is no safepoint on this path.
--- a/src/hotspot/cpu/x86/templateTable_x86.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/x86/templateTable_x86.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -2084,7 +2084,7 @@
     __ addptr(rbcp, rdx);
     // jsr returns atos that is not an oop
     __ push_i(rax);
-    __ dispatch_only(vtos);
+    __ dispatch_only(vtos, true);
     return;
   }
 
@@ -2203,7 +2203,7 @@
   // rax: return bci for jsr's, unused otherwise
   // rbx: target bytecode
   // r13: target bcp
-  __ dispatch_only(vtos);
+  __ dispatch_only(vtos, true);
 
   if (UseLoopCounter) {
     if (ProfileInterpreter) {
@@ -2332,7 +2332,7 @@
   __ movptr(rbcp, Address(rax, Method::const_offset()));
   __ lea(rbcp, Address(rbcp, rbx, Address::times_1,
                       ConstMethod::codes_offset()));
-  __ dispatch_next(vtos);
+  __ dispatch_next(vtos, 0, true);
 }
 
 void TemplateTable::wide_ret() {
@@ -2343,7 +2343,7 @@
   __ get_method(rax);
   __ movptr(rbcp, Address(rax, Method::const_offset()));
   __ lea(rbcp, Address(rbcp, rbx, Address::times_1, ConstMethod::codes_offset()));
-  __ dispatch_next(vtos);
+  __ dispatch_next(vtos, 0, true);
 }
 
 void TemplateTable::tableswitch() {
@@ -2373,7 +2373,7 @@
   LP64_ONLY(__ movl2ptr(rdx, rdx));
   __ load_unsigned_byte(rbx, Address(rbcp, rdx, Address::times_1));
   __ addptr(rbcp, rdx);
-  __ dispatch_only(vtos);
+  __ dispatch_only(vtos, true);
   // handle default
   __ bind(default_case);
   __ profile_switch_default(rax);
@@ -2421,7 +2421,7 @@
   __ movl2ptr(rdx, rdx);
   __ load_unsigned_byte(rbx, Address(rbcp, rdx, Address::times_1));
   __ addptr(rbcp, rdx);
-  __ dispatch_only(vtos);
+  __ dispatch_only(vtos, true);
 }
 
 void TemplateTable::fast_binaryswitch() {
@@ -2525,7 +2525,7 @@
 
   __ load_unsigned_byte(rbx, Address(rbcp, j, Address::times_1));
   __ addptr(rbcp, j);
-  __ dispatch_only(vtos);
+  __ dispatch_only(vtos, true);
 
   // default case -> j = default offset
   __ bind(default_case);
@@ -2539,7 +2539,7 @@
 
   __ load_unsigned_byte(rbx, Address(rbcp, j, Address::times_1));
   __ addptr(rbcp, j);
-  __ dispatch_only(vtos);
+  __ dispatch_only(vtos, true);
 }
 
 void TemplateTable::_return(TosState state) {
@@ -2570,6 +2570,20 @@
   }
 #endif
 
+#ifdef _LP64
+  if (SafepointMechanism::uses_thread_local_poll() && _desc->bytecode() != Bytecodes::_return_register_finalizer) {
+    Label no_safepoint;
+    NOT_PRODUCT(__ block_comment("Thread-local Safepoint poll"));
+    __ testb(Address(r15_thread, Thread::polling_page_offset()), SafepointMechanism::poll_bit());
+    __ jcc(Assembler::zero, no_safepoint);
+    __ push(state);
+    __ call_VM(noreg, CAST_FROM_FN_PTR(address,
+                                    InterpreterRuntime::at_safepoint));
+    __ pop(state);
+    __ bind(no_safepoint);
+  }
+#endif
+
   // Narrow result if state is itos but result type is smaller.
   // Need to narrow in the return bytecode rather than in generate_return_entry
   // since compiled code callers expect the result to already be narrowed.
--- a/src/hotspot/cpu/x86/x86_64.ad	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/x86/x86_64.ad	Wed Nov 15 08:25:28 2017 -0500
@@ -317,6 +317,18 @@
 // Singleton class for TLS pointer
 reg_class ptr_r15_reg(R15, R15_H);
 
+// The registers which can be used for
+// a thread local safepoint poll
+// * R12 is reserved for heap base
+// * R13 cannot be encoded for addressing without an offset byte
+// * R15 is reserved for the JavaThread
+reg_class ptr_rex_reg(R8,  R8_H,
+                      R9,  R9_H,
+                      R10, R10_H,
+                      R11, R11_H,
+                      R14, R14_H);
+
+
 // Class for all long registers (excluding RSP)
 reg_class long_reg_with_rbp(RAX, RAX_H,
                             RDX, RDX_H,
@@ -566,7 +578,7 @@
 // it does if the polling page is more than disp32 away.
 bool SafePointNode::needs_polling_address_input()
 {
-  return Assembler::is_polling_page_far();
+  return SafepointMechanism::uses_thread_local_poll() || Assembler::is_polling_page_far();
 }
 
 //
@@ -938,7 +950,11 @@
   st->print_cr("popq   rbp");
   if (do_polling() && C->is_method_compilation()) {
     st->print("\t");
-    if (Assembler::is_polling_page_far()) {
+    if (SafepointMechanism::uses_thread_local_poll()) {
+      st->print_cr("movq   rscratch1, poll_offset[r15_thread] #polling_page_address\n\t"
+                   "testl  rax, [rscratch1]\t"
+                   "# Safepoint: poll for GC");
+    } else if (Assembler::is_polling_page_far()) {
       st->print_cr("movq   rscratch1, #polling_page_address\n\t"
                    "testl  rax, [rscratch1]\t"
                    "# Safepoint: poll for GC");
@@ -989,13 +1005,19 @@
 
   if (do_polling() && C->is_method_compilation()) {
     MacroAssembler _masm(&cbuf);
-    AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_return_type);
-    if (Assembler::is_polling_page_far()) {
-      __ lea(rscratch1, polling_page);
+    if (SafepointMechanism::uses_thread_local_poll()) {
+      __ movq(rscratch1, Address(r15_thread, Thread::polling_page_offset()));
       __ relocate(relocInfo::poll_return_type);
       __ testl(rax, Address(rscratch1, 0));
     } else {
-      __ testl(rax, polling_page);
+      AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_return_type);
+      if (Assembler::is_polling_page_far()) {
+        __ lea(rscratch1, polling_page);
+        __ relocate(relocInfo::poll_return_type);
+        __ testl(rax, Address(rscratch1, 0));
+      } else {
+        __ testl(rax, polling_page);
+      }
     }
   }
 }
@@ -3511,6 +3533,16 @@
   interface(REG_INTER);
 %}
 
+operand rex_RegP()
+%{
+  constraint(ALLOC_IN_RC(ptr_rex_reg));
+  match(RegP);
+  match(rRegP);
+
+  format %{ %}
+  interface(REG_INTER);
+%}
+
 operand rRegL()
 %{
   constraint(ALLOC_IN_RC(long_reg));
@@ -12060,7 +12092,7 @@
 // Safepoint Instructions
 instruct safePoint_poll(rFlagsReg cr)
 %{
-  predicate(!Assembler::is_polling_page_far());
+  predicate(!Assembler::is_polling_page_far() && SafepointMechanism::uses_global_page_poll());
   match(SafePoint);
   effect(KILL cr);
 
@@ -12076,7 +12108,7 @@
 
 instruct safePoint_poll_far(rFlagsReg cr, rRegP poll)
 %{
-  predicate(Assembler::is_polling_page_far());
+  predicate(Assembler::is_polling_page_far() && SafepointMechanism::uses_global_page_poll());
   match(SafePoint poll);
   effect(KILL cr, USE poll);
 
@@ -12090,6 +12122,26 @@
   ins_pipe(ialu_reg_mem);
 %}
 
+instruct safePoint_poll_tls(rFlagsReg cr, rex_RegP poll)
+%{
+  predicate(SafepointMechanism::uses_thread_local_poll());
+  match(SafePoint poll);
+  effect(KILL cr, USE poll);
+
+  format %{ "testl  rax, [$poll]\t"
+            "# Safepoint: poll for GC" %}
+  ins_cost(125);
+  size(3); /* setting an explicit size will cause debug builds to assert if size is incorrect */
+  ins_encode %{
+    __ relocate(relocInfo::poll_type);
+    address pre_pc = __ pc();
+    __ testl(rax, Address($poll$$Register, 0));
+    address post_pc = __ pc();
+    guarantee(pre_pc[0] == 0x41 && pre_pc[1] == 0x85, "must emit #rex test-ax [reg]");
+  %}
+  ins_pipe(ialu_reg_mem);
+%}
+
 // ============================================================================
 // Procedure Call/Return Instructions
 // Call Java Static Instruction
--- a/src/hotspot/cpu/zero/globals_zero.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/cpu/zero/globals_zero.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -81,6 +81,8 @@
 // No performance work done here yet.
 define_pd_global(bool, CompactStrings, false);
 
+define_pd_global(bool, ThreadLocalHandshakes, false);
+
 #define ARCH_FLAGS(develop, \
                    product, \
                    diagnostic, \
--- a/src/hotspot/os/aix/os_aix.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/os/aix/os_aix.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -3477,75 +3477,6 @@
     LoadedLibraries::print(tty);
   }
 
-  const int page_size = Aix::page_size();
-  const int map_size = page_size;
-
-  address map_address = (address) MAP_FAILED;
-  const int prot  = PROT_READ;
-  const int flags = MAP_PRIVATE|MAP_ANONYMOUS;
-
-  // Use optimized addresses for the polling page,
-  // e.g. map it to a special 32-bit address.
-  if (OptimizePollingPageLocation) {
-    // architecture-specific list of address wishes:
-    address address_wishes[] = {
-      // AIX: addresses lower than 0x30000000 don't seem to work on AIX.
-      // PPC64: all address wishes are non-negative 32 bit values where
-      // the lower 16 bits are all zero. we can load these addresses
-      // with a single ppc_lis instruction.
-      (address) 0x30000000, (address) 0x31000000,
-      (address) 0x32000000, (address) 0x33000000,
-      (address) 0x40000000, (address) 0x41000000,
-      (address) 0x42000000, (address) 0x43000000,
-      (address) 0x50000000, (address) 0x51000000,
-      (address) 0x52000000, (address) 0x53000000,
-      (address) 0x60000000, (address) 0x61000000,
-      (address) 0x62000000, (address) 0x63000000
-    };
-    int address_wishes_length = sizeof(address_wishes)/sizeof(address);
-
-    // iterate over the list of address wishes:
-    for (int i=0; i<address_wishes_length; i++) {
-      // Try to map with current address wish.
-      // AIX: AIX needs MAP_FIXED if we provide an address and mmap will
-      // fail if the address is already mapped.
-      map_address = (address) ::mmap(address_wishes[i] - (ssize_t)page_size,
-                                     map_size, prot,
-                                     flags | MAP_FIXED,
-                                     -1, 0);
-      trcVerbose("SafePoint Polling  Page address: %p (wish) => %p",
-                   address_wishes[i], map_address + (ssize_t)page_size);
-
-      if (map_address + (ssize_t)page_size == address_wishes[i]) {
-        // Map succeeded and map_address is at wished address, exit loop.
-        break;
-      }
-
-      if (map_address != (address) MAP_FAILED) {
-        // Map succeeded, but polling_page is not at wished address, unmap and continue.
-        ::munmap(map_address, map_size);
-        map_address = (address) MAP_FAILED;
-      }
-      // Map failed, continue loop.
-    }
-  } // end OptimizePollingPageLocation
-
-  if (map_address == (address) MAP_FAILED) {
-    map_address = (address) ::mmap(NULL, map_size, prot, flags, -1, 0);
-  }
-  guarantee(map_address != MAP_FAILED, "os::init_2: failed to allocate polling page");
-  os::set_polling_page(map_address);
-
-  if (!UseMembar) {
-    address mem_serialize_page = (address) ::mmap(NULL, Aix::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-    guarantee(mem_serialize_page != NULL, "mmap Failed for memory serialize page");
-    os::set_memory_serialize_page(mem_serialize_page);
-
-    trcVerbose("Memory Serialize  Page address: %p - %p, size %IX (%IB)",
-        mem_serialize_page, mem_serialize_page + Aix::page_size(),
-        Aix::page_size(), Aix::page_size());
-  }
-
   // initialize suspend/resume support - must do this before signal_sets_init()
   if (SR_initialize() != 0) {
     perror("SR_initialize failed");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os/aix/safepointMechanism_aix.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "logging/log.hpp"
+#include "runtime/globals.hpp"
+#include "runtime/os.hpp"
+#include "runtime/safepointMechanism.hpp"
+#include <sys/mman.h>
+
+void SafepointMechanism::pd_initialize() {
+  char* map_address = (char*)MAP_FAILED;
+  const size_t page_size = os::vm_page_size();
+  // Use optimized addresses for the polling page,
+  // e.g. map it to a special 32-bit address.
+  if (OptimizePollingPageLocation) {
+    // architecture-specific list of address wishes:
+    char* address_wishes[] = {
+        // AIX: addresses lower than 0x30000000 don't seem to work on AIX.
+        // PPC64: all address wishes are non-negative 32 bit values where
+        // the lower 16 bits are all zero. we can load these addresses
+        // with a single ppc_lis instruction.
+        (char*) 0x30000000, (char*) 0x31000000,
+        (char*) 0x32000000, (char*) 0x33000000,
+        (char*) 0x40000000, (char*) 0x41000000,
+        (char*) 0x42000000, (char*) 0x43000000,
+        (char*) 0x50000000, (char*) 0x51000000,
+        (char*) 0x52000000, (char*) 0x53000000,
+        (char*) 0x60000000, (char*) 0x61000000,
+        (char*) 0x62000000, (char*) 0x63000000
+    };
+    int address_wishes_length = sizeof(address_wishes)/sizeof(char*);
+
+    // iterate over the list of address wishes:
+    for (int i = 0; i < address_wishes_length; i++) {
+      // Try to map with current address wish.
+      // AIX: AIX needs MAP_FIXED if we provide an address and mmap will
+      // fail if the address is already mapped.
+      map_address = (char*) ::mmap(address_wishes[i] - (ssize_t)page_size,
+                                   page_size, PROT_READ,
+                                   MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED,
+                                   -1, 0);
+      log_debug(os)("SafePoint Polling  Page address: %p (wish) => %p",
+                    address_wishes[i], map_address + (ssize_t)page_size);
+
+      if (map_address + (ssize_t)page_size == address_wishes[i]) {
+        // Map succeeded and map_address is at wished address, exit loop.
+        break;
+      }
+
+      if (map_address != (char*)MAP_FAILED) {
+        // Map succeeded, but polling_page is not at wished address, unmap and continue.
+        ::munmap(map_address, page_size);
+        map_address = (char*)MAP_FAILED;
+      }
+      // Map failed, continue loop.
+    }
+  }
+  if (map_address == (char*)MAP_FAILED) {
+    map_address = os::reserve_memory(page_size, NULL, page_size);
+  }
+  guarantee(map_address != (char*)MAP_FAILED, "SafepointMechanism::pd_initialize: failed to allocate polling page");
+  os::set_polling_page((address)(map_address));
+}
--- a/src/hotspot/os/bsd/os_bsd.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/os/bsd/os_bsd.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -3391,20 +3391,6 @@
 
   os::Posix::init_2();
 
-  // Allocate a single page and mark it as readable for safepoint polling
-  address polling_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-  guarantee(polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page");
-
-  os::set_polling_page(polling_page);
-  log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(polling_page));
-
-  if (!UseMembar) {
-    address mem_serialize_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-    guarantee(mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
-    os::set_memory_serialize_page(mem_serialize_page);
-    log_info(os)("Memory Serialize Page address: " INTPTR_FORMAT, p2i(mem_serialize_page));
-  }
-
   // initialize suspend/resume support - must do this before signal_sets_init()
   if (SR_initialize() != 0) {
     perror("SR_initialize failed");
--- a/src/hotspot/os/linux/os_linux.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/os/linux/os_linux.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -4805,20 +4805,6 @@
 
   Linux::fast_thread_clock_init();
 
-  // Allocate a single page and mark it as readable for safepoint polling
-  address polling_page = (address) ::mmap(NULL, Linux::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-  guarantee(polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page");
-
-  os::set_polling_page(polling_page);
-  log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(polling_page));
-
-  if (!UseMembar) {
-    address mem_serialize_page = (address) ::mmap(NULL, Linux::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-    guarantee(mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
-    os::set_memory_serialize_page(mem_serialize_page);
-    log_info(os)("Memory Serialize Page address: " INTPTR_FORMAT, p2i(mem_serialize_page));
-  }
-
   // initialize suspend/resume support - must do this before signal_sets_init()
   if (SR_initialize() != 0) {
     perror("SR_initialize failed");
--- a/src/hotspot/os/solaris/os_solaris.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/os/solaris/os_solaris.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -2190,10 +2190,6 @@
 
 static int page_size = -1;
 
-// The mmap MAP_ALIGN flag is supported on Solaris 9 and later.  init_2() will
-// clear this var if support is not available.
-static bool has_map_align = true;
-
 int os::vm_page_size() {
   assert(page_size != -1, "must call os::init");
   return page_size;
@@ -2560,7 +2556,7 @@
 
   if (fixed) {
     flags |= MAP_FIXED;
-  } else if (has_map_align && (alignment_hint > (size_t) vm_page_size())) {
+  } else if (alignment_hint > (size_t) vm_page_size()) {
     flags |= MAP_ALIGN;
     addr = (char*) alignment_hint;
   }
@@ -4222,28 +4218,6 @@
   // try to enable extended file IO ASAP, see 6431278
   os::Solaris::try_enable_extended_io();
 
-  // Allocate a single page and mark it as readable for safepoint polling.  Also
-  // use this first mmap call to check support for MAP_ALIGN.
-  address polling_page = (address)Solaris::mmap_chunk((char*)page_size,
-                                                      page_size,
-                                                      MAP_PRIVATE | MAP_ALIGN,
-                                                      PROT_READ);
-  if (polling_page == NULL) {
-    has_map_align = false;
-    polling_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE,
-                                                PROT_READ);
-  }
-
-  os::set_polling_page(polling_page);
-  log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(polling_page));
-
-  if (!UseMembar) {
-    address mem_serialize_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE);
-    guarantee(mem_serialize_page != NULL, "mmap Failed for memory serialize page");
-    os::set_memory_serialize_page(mem_serialize_page);
-    log_info(os)("Memory Serialize Page address: " INTPTR_FORMAT, p2i(mem_serialize_page));
-  }
-
   // Check and sets minimum stack sizes against command line options
   if (Posix::set_minimum_stack_sizes() == JNI_ERR) {
     return JNI_ERR;
--- a/src/hotspot/os/windows/os_windows.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/os/windows/os_windows.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -2487,6 +2487,20 @@
     } // /EXCEPTION_ACCESS_VIOLATION
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
+    if (exception_code == EXCEPTION_IN_PAGE_ERROR) {
+      CompiledMethod* nm = NULL;
+      JavaThread* thread = (JavaThread*)t;
+      if (in_java) {
+        CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
+        nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
+      }
+      if ((thread->thread_state() == _thread_in_vm &&
+          thread->doing_unsafe_access()) ||
+          (nm != NULL && nm->has_unsafe_access())) {
+        return Handle_Exception(exceptionInfo, SharedRuntime::handle_unsafe_access(thread, (address)Assembler::locate_next_instruction(pc)));
+      }
+    }
+
     if (in_java) {
       switch (exception_code) {
       case EXCEPTION_INT_DIVIDE_BY_ZERO:
@@ -3911,27 +3925,6 @@
 
 // this is called _after_ the global arguments have been parsed
 jint os::init_2(void) {
-  // Allocate a single page and mark it as readable for safepoint polling
-  address polling_page = (address)VirtualAlloc(NULL, os::vm_page_size(), MEM_RESERVE, PAGE_READONLY);
-  guarantee(polling_page != NULL, "Reserve Failed for polling page");
-
-  address return_page  = (address)VirtualAlloc(polling_page, os::vm_page_size(), MEM_COMMIT, PAGE_READONLY);
-  guarantee(return_page != NULL, "Commit Failed for polling page");
-
-  os::set_polling_page(polling_page);
-  log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(polling_page));
-
-  if (!UseMembar) {
-    address mem_serialize_page = (address)VirtualAlloc(NULL, os::vm_page_size(), MEM_RESERVE, PAGE_READWRITE);
-    guarantee(mem_serialize_page != NULL, "Reserve Failed for memory serialize page");
-
-    return_page  = (address)VirtualAlloc(mem_serialize_page, os::vm_page_size(), MEM_COMMIT, PAGE_READWRITE);
-    guarantee(return_page != NULL, "Commit Failed for memory serialize page");
-
-    os::set_memory_serialize_page(mem_serialize_page);
-    log_info(os)("Memory Serialize Page address: " INTPTR_FORMAT, p2i(mem_serialize_page));
-  }
-
   // Setup Windows Exceptions
 
   // for debugging float code generation bugs
--- a/src/hotspot/os_cpu/linux_sparc/thread_linux_sparc.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/os_cpu/linux_sparc/thread_linux_sparc.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, 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
@@ -68,7 +68,7 @@
   address o_reg_temps(int i) { return (address)&_o_reg_temps[i]; }
 #endif
 
-  static int saved_exception_npc_offset_in_bytes() { return offset_of(JavaThread,_saved_exception_npc); }
+  static ByteSize saved_exception_npc_offset() { return byte_offset_of(JavaThread,_saved_exception_npc); }
 
   address  saved_exception_npc()             { return _saved_exception_npc; }
   void set_saved_exception_npc(address a)    { _saved_exception_npc = a; }
--- a/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -447,7 +447,7 @@
       // a fault inside compiled code, the interpreter, or a stub
 
       // Support Safepoint Polling
-      if ( sig == SIGSEGV && (address)info->si_addr == os::get_polling_page() ) {
+      if (sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) {
         stub = SharedRuntime::get_poll_stub(pc);
       }
 
--- a/src/hotspot/os_cpu/solaris_sparc/thread_solaris_sparc.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/os_cpu/solaris_sparc/thread_solaris_sparc.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -63,7 +63,7 @@
 
   static int o_reg_temps_offset_in_bytes() { return offset_of(JavaThread, _o_reg_temps); }
 
-  static int saved_exception_npc_offset_in_bytes() { return offset_of(JavaThread,_saved_exception_npc); }
+  static ByteSize saved_exception_npc_offset() { return byte_offset_of(JavaThread,_saved_exception_npc); }
 
   address  saved_exception_npc()             { return _saved_exception_npc; }
   void set_saved_exception_npc(address a)    { _saved_exception_npc = a; }
--- a/src/hotspot/share/ci/ciEnv.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/ci/ciEnv.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, 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
@@ -187,10 +187,6 @@
     }
   }
 
-  void ensure_metadata_alive(ciMetadata* m) {
-    _factory->ensure_metadata_alive(m);
-  }
-
   ciInstance* get_instance(oop o) {
     if (o == NULL) return NULL;
     return get_object(o)->as_instance();
--- a/src/hotspot/share/ci/ciInstanceKlass.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/ci/ciInstanceKlass.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -34,6 +34,9 @@
 #include "oops/oop.inline.hpp"
 #include "oops/fieldStreams.hpp"
 #include "runtime/fieldDescriptor.hpp"
+#if INCLUDE_ALL_GCS
+# include "gc/g1/g1SATBCardTableModRefBS.hpp"
+#endif
 
 // ciInstanceKlass
 //
@@ -41,6 +44,27 @@
 // whose Klass part in an InstanceKlass.
 
 // ------------------------------------------------------------------
+// ensure_metadata_alive
+//
+// Ensure that the metadata wrapped by the ciMetadata is kept alive by GC.
+// This is primarily useful for metadata which is considered as weak roots
+// by the GC but need to be strong roots if reachable from a current compilation.
+// InstanceKlass are created for both weak and strong metadata.  Ensuring this metadata
+// alive covers the cases where there are weak roots without performance cost.
+//
+static void ensure_metadata_alive(oop metadata_holder) {
+#if INCLUDE_ALL_GCS
+  if (!UseG1GC) {
+    return;
+  }
+  if (metadata_holder != NULL) {
+    G1SATBCardTableModRefBS::enqueue(metadata_holder);
+  }
+#endif
+}
+
+
+// ------------------------------------------------------------------
 // ciInstanceKlass::ciInstanceKlass
 //
 // Loaded instance klass.
@@ -64,6 +88,18 @@
   _has_injected_fields = -1;
   _implementor = NULL; // we will fill these lazily
 
+  oop holder = ik->klass_holder();
+  ensure_metadata_alive(holder);
+  if (ik->is_anonymous()) {
+    // Though ciInstanceKlass records class loader oop, it's not enough to keep
+    // VM anonymous classes alive (loader == NULL). Klass holder should be used instead.
+    // It is enough to record a ciObject, since cached elements are never removed
+    // during ciObjectFactory lifetime. ciObjectFactory itself is created for
+    // every compilation and lives for the whole duration of the compilation.
+    assert(holder != NULL, "holder of anonymous class is the mirror which is never null");
+    (void)CURRENT_ENV->get_object(holder);
+  }
+
   Thread *thread = Thread::current();
   if (ciObjectFactory::is_initialized()) {
     _loader = JNIHandles::make_local(thread, ik->class_loader());
--- a/src/hotspot/share/ci/ciMethodData.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/ci/ciMethodData.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -188,7 +188,6 @@
     Klass* k = data->as_ReceiverTypeData()->receiver(row);
     if (k != NULL) {
       ciKlass* klass = CURRENT_ENV->get_klass(k);
-      CURRENT_ENV->ensure_metadata_alive(klass);
       set_receiver(row, klass);
     }
   }
@@ -210,7 +209,6 @@
 void ciSpeculativeTrapData::translate_from(const ProfileData* data) {
   Method* m = data->as_SpeculativeTrapData()->method();
   ciMethod* ci_m = CURRENT_ENV->get_method(m);
-  CURRENT_ENV->ensure_metadata_alive(ci_m);
   set_method(ci_m);
 }
 
--- a/src/hotspot/share/ci/ciMethodData.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/ci/ciMethodData.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, 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
@@ -70,7 +70,6 @@
     Klass* v = TypeEntries::valid_klass(k);
     if (v != NULL) {
       ciKlass* klass = CURRENT_ENV->get_klass(v);
-      CURRENT_ENV->ensure_metadata_alive(klass);
       return with_status(klass, k);
     }
     return with_status(NULL, k);
--- a/src/hotspot/share/ci/ciObjectFactory.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/ci/ciObjectFactory.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -47,9 +47,6 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/fieldType.hpp"
 #include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
-# include "gc/g1/g1SATBCardTableModRefBS.hpp"
-#endif
 
 // ciObjectFactory
 //
@@ -363,19 +360,6 @@
 ciMetadata* ciObjectFactory::create_new_metadata(Metadata* o) {
   EXCEPTION_CONTEXT;
 
-  // Hold metadata from unloading by keeping it's holder alive.
-  if (_initialized && o->is_klass()) {
-    Klass* holder = ((Klass*)o);
-    if (holder->is_instance_klass() && InstanceKlass::cast(holder)->is_anonymous()) {
-      // Though ciInstanceKlass records class loader oop, it's not enough to keep
-      // VM anonymous classes alive (loader == NULL). Klass holder should be used instead.
-      // It is enough to record a ciObject, since cached elements are never removed
-      // during ciObjectFactory lifetime. ciObjectFactory itself is created for
-      // every compilation and lives for the whole duration of the compilation.
-      ciObject* h = get(holder->klass_holder());
-    }
-  }
-
   if (o->is_klass()) {
     Klass* k = (Klass*)o;
     if (k->is_instance_klass()) {
@@ -401,38 +385,6 @@
   return NULL;
 }
 
-// ------------------------------------------------------------------
-// ciObjectFactory::ensure_metadata_alive
-//
-// Ensure that the metadata wrapped by the ciMetadata is kept alive by GC.
-// This is primarily useful for metadata which is considered as weak roots
-// by the GC but need to be strong roots if reachable from a current compilation.
-//
-void ciObjectFactory::ensure_metadata_alive(ciMetadata* m) {
-  ASSERT_IN_VM; // We're handling raw oops here.
-
-#if INCLUDE_ALL_GCS
-  if (!UseG1GC) {
-    return;
-  }
-  Klass* metadata_owner_klass;
-  if (m->is_klass()) {
-    metadata_owner_klass = m->as_klass()->get_Klass();
-  } else if (m->is_method()) {
-    metadata_owner_klass = m->as_method()->get_Method()->constants()->pool_holder();
-  } else {
-    fatal("Not implemented for other types of metadata");
-    return;
-  }
-
-  oop metadata_holder = metadata_owner_klass->klass_holder();
-  if (metadata_holder != NULL) {
-    G1SATBCardTableModRefBS::enqueue(metadata_holder);
-  }
-
-#endif
-}
-
 //------------------------------------------------------------------
 // ciObjectFactory::get_unloaded_method
 //
--- a/src/hotspot/share/ci/ciObjectFactory.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/ci/ciObjectFactory.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, 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
@@ -73,8 +73,6 @@
   ciObject* create_new_object(oop o);
   ciMetadata* create_new_metadata(Metadata* o);
 
-  void ensure_metadata_alive(ciMetadata* m);
-
   static bool is_equal(NonPermObject* p, oop key) {
     return p->object()->get_oop() == key;
   }
--- a/src/hotspot/share/gc/g1/collectionSetChooser.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/collectionSetChooser.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, 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
@@ -247,8 +247,8 @@
       _g1(G1CollectedHeap::heap()), _hrclaimer(n_workers) {}
 
   void work(uint worker_id) {
-    ParKnownGarbageHRClosure parKnownGarbageCl(_hrSorted, _chunk_size);
-    _g1->heap_region_par_iterate(&parKnownGarbageCl, worker_id, &_hrclaimer);
+    ParKnownGarbageHRClosure par_known_garbage_cl(_hrSorted, _chunk_size);
+    _g1->heap_region_par_iterate_from_worker_offset(&par_known_garbage_cl, &_hrclaimer, worker_id);
   }
 };
 
--- a/src/hotspot/share/gc/g1/g1CardLiveData.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1CardLiveData.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -314,7 +314,7 @@
     G1CollectedHeap* g1h = G1CollectedHeap::heap();
     G1ConcurrentMark* cm = g1h->concurrent_mark();
     G1CreateLiveDataClosure cl(g1h, cm, cm->next_mark_bitmap(), _live_data);
-    g1h->heap_region_par_iterate(&cl, worker_id, &_hr_claimer);
+    g1h->heap_region_par_iterate_from_worker_offset(&cl, &_hr_claimer, worker_id);
   }
 };
 
@@ -381,7 +381,7 @@
   void work(uint worker_id) {
     G1FinalizeCardLiveDataClosure cl(G1CollectedHeap::heap(), _bitmap, _live_data);
 
-    G1CollectedHeap::heap()->heap_region_par_iterate(&cl, worker_id, &_hr_claimer);
+    G1CollectedHeap::heap()->heap_region_par_iterate_from_worker_offset(&cl, &_hr_claimer, worker_id);
   }
 };
 
@@ -560,7 +560,7 @@
                                    _mark_bitmap,
                                    _act_live_data,
                                    &_exp_live_data);
-    _g1h->heap_region_par_iterate(&cl, worker_id, &_hr_claimer);
+    _g1h->heap_region_par_iterate_from_worker_offset(&cl, &_hr_claimer, worker_id);
 
     Atomic::add(cl.failures(), &_failures);
   }
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -38,6 +38,7 @@
 #include "gc/g1/g1ConcurrentRefine.hpp"
 #include "gc/g1/g1ConcurrentRefineThread.hpp"
 #include "gc/g1/g1EvacStats.inline.hpp"
+#include "gc/g1/g1FullCollector.hpp"
 #include "gc/g1/g1FullGCScope.hpp"
 #include "gc/g1/g1GCPhaseTimes.hpp"
 #include "gc/g1/g1HeapSizingPolicy.hpp"
@@ -48,10 +49,9 @@
 #include "gc/g1/g1ParScanThreadState.inline.hpp"
 #include "gc/g1/g1Policy.hpp"
 #include "gc/g1/g1RegionToSpaceMapper.hpp"
-#include "gc/g1/g1RemSet.inline.hpp"
+#include "gc/g1/g1RemSet.hpp"
 #include "gc/g1/g1RootClosures.hpp"
 #include "gc/g1/g1RootProcessor.hpp"
-#include "gc/g1/g1SerialFullCollector.hpp"
 #include "gc/g1/g1StringDedup.hpp"
 #include "gc/g1/g1YCTypes.hpp"
 #include "gc/g1/g1YoungRemSetSamplingThread.hpp"
@@ -143,6 +143,12 @@
   reset_from_card_cache(start_idx, num_regions);
 }
 
+
+HeapRegion* G1CollectedHeap::new_heap_region(uint hrs_index,
+                                             MemRegion mr) {
+  return new HeapRegion(hrs_index, bot(), mr);
+}
+
 // Private methods.
 
 HeapRegion*
@@ -1155,7 +1161,6 @@
 
 void G1CollectedHeap::abort_refinement() {
   if (_hot_card_cache->use_cache()) {
-    _hot_card_cache->reset_card_counts();
     _hot_card_cache->reset_hot_cache();
   }
 
@@ -1199,6 +1204,10 @@
 }
 
 void G1CollectedHeap::print_heap_after_full_collection(G1HeapTransition* heap_transition) {
+  // Post collection logging.
+  // We should do this after we potentially resize the heap so
+  // that all the COMMIT / UNCOMMIT events are generated before
+  // the compaction events.
   print_hrm_post_compaction();
   heap_transition->print();
   print_heap_after_gc();
@@ -1221,23 +1230,18 @@
   gc_prologue(true);
   prepare_heap_for_full_collection();
 
-  G1SerialFullCollector serial(scope, ref_processor_stw());
-  serial.prepare_collection();
-  serial.collect();
-  serial.complete_collection();
+  G1FullCollector collector(scope, ref_processor_stw(), concurrent_mark()->next_mark_bitmap(), workers()->active_workers());
+  collector.prepare_collection();
+  collector.collect();
+  collector.complete_collection();
 
   prepare_heap_for_mutators();
 
   g1_policy()->record_full_collection_end();
   gc_epilogue(true);
 
-  // Post collection verification.
   verify_after_full_collection();
 
-  // Post collection logging.
-  // We should do this after we potentially resize the heap so
-  // that all the COMMIT / UNCOMMIT events are generated before
-  // the compaction events.
   print_heap_after_full_collection(scope->heap_transition());
 }
 
@@ -1269,10 +1273,10 @@
 }
 
 void G1CollectedHeap::resize_if_necessary_after_full_collection() {
-  // Include bytes that will be pre-allocated to support collections, as "used".
-  const size_t used_after_gc = used();
+  // Capacity, free and used after the GC counted as full regions to
+  // include the waste in the following calculations.
   const size_t capacity_after_gc = capacity();
-  const size_t free_after_gc = capacity_after_gc - used_after_gc;
+  const size_t used_after_gc = capacity_after_gc - unused_committed_regions_in_bytes();
 
   // This is enforced in arguments.cpp.
   assert(MinHeapFreeRatio <= MaxHeapFreeRatio,
@@ -1326,8 +1330,9 @@
     size_t expand_bytes = minimum_desired_capacity - capacity_after_gc;
 
     log_debug(gc, ergo, heap)("Attempt heap expansion (capacity lower than min desired capacity after Full GC). "
-                              "Capacity: " SIZE_FORMAT "B occupancy: " SIZE_FORMAT "B min_desired_capacity: " SIZE_FORMAT "B (" UINTX_FORMAT " %%)",
-                              capacity_after_gc, used_after_gc, minimum_desired_capacity, MinHeapFreeRatio);
+                              "Capacity: " SIZE_FORMAT "B occupancy: " SIZE_FORMAT "B live: " SIZE_FORMAT "B "
+                              "min_desired_capacity: " SIZE_FORMAT "B (" UINTX_FORMAT " %%)",
+                              capacity_after_gc, used_after_gc, used(), minimum_desired_capacity, MinHeapFreeRatio);
 
     expand(expand_bytes, _workers);
 
@@ -1337,8 +1342,9 @@
     size_t shrink_bytes = capacity_after_gc - maximum_desired_capacity;
 
     log_debug(gc, ergo, heap)("Attempt heap shrinking (capacity higher than max desired capacity after Full GC). "
-                              "Capacity: " SIZE_FORMAT "B occupancy: " SIZE_FORMAT "B min_desired_capacity: " SIZE_FORMAT "B (" UINTX_FORMAT " %%)",
-                              capacity_after_gc, used_after_gc, minimum_desired_capacity, MinHeapFreeRatio);
+                              "Capacity: " SIZE_FORMAT "B occupancy: " SIZE_FORMAT "B live: " SIZE_FORMAT "B "
+                              "maximum_desired_capacity: " SIZE_FORMAT "B (" UINTX_FORMAT " %%)",
+                              capacity_after_gc, used_after_gc, used(), maximum_desired_capacity, MaxHeapFreeRatio);
 
     shrink(shrink_bytes);
   }
@@ -1959,6 +1965,10 @@
   return _hrm.length() * HeapRegion::GrainBytes;
 }
 
+size_t G1CollectedHeap::unused_committed_regions_in_bytes() const {
+  return _hrm.total_free_bytes();
+}
+
 void G1CollectedHeap::reset_gc_time_stamps(HeapRegion* hr) {
   hr->reset_gc_time_stamp();
 }
@@ -2262,10 +2272,15 @@
   _hrm.iterate(cl);
 }
 
-void G1CollectedHeap::heap_region_par_iterate(HeapRegionClosure* cl,
-                                              uint worker_id,
-                                              HeapRegionClaimer *hrclaimer) const {
-  _hrm.par_iterate(cl, worker_id, hrclaimer);
+void G1CollectedHeap::heap_region_par_iterate_from_worker_offset(HeapRegionClosure* cl,
+                                                                 HeapRegionClaimer *hrclaimer,
+                                                                 uint worker_id) const {
+  _hrm.par_iterate(cl, hrclaimer, hrclaimer->offset_for_worker(worker_id));
+}
+
+void G1CollectedHeap::heap_region_par_iterate_from_start(HeapRegionClosure* cl,
+                                                         HeapRegionClaimer *hrclaimer) const {
+  _hrm.par_iterate(cl, hrclaimer, 0);
 }
 
 void G1CollectedHeap::collection_set_iterate(HeapRegionClosure* cl) {
@@ -2276,14 +2291,6 @@
   _collection_set.iterate_from(cl, worker_id, workers()->active_workers());
 }
 
-HeapRegion* G1CollectedHeap::next_compaction_region(const HeapRegion* from) const {
-  HeapRegion* result = _hrm.next_region_in_heap(from);
-  while (result != NULL && result->is_pinned()) {
-    result = _hrm.next_region_in_heap(result);
-  }
-  return result;
-}
-
 HeapWord* G1CollectedHeap::block_start(const void* addr) const {
   HeapRegion* hr = heap_region_containing(addr);
   return hr->block_start(addr);
@@ -2375,7 +2382,7 @@
   switch (vo) {
   case VerifyOption_G1UsePrevMarking: return is_obj_dead(obj, hr);
   case VerifyOption_G1UseNextMarking: return is_obj_ill(obj, hr);
-  case VerifyOption_G1UseMarkWord:    return !obj->is_gc_marked() && !hr->is_archive();
+  case VerifyOption_G1UseFullMarking: return is_obj_dead_full(obj, hr);
   default:                            ShouldNotReachHere();
   }
   return false; // keep some compilers happy
@@ -2386,10 +2393,7 @@
   switch (vo) {
   case VerifyOption_G1UsePrevMarking: return is_obj_dead(obj);
   case VerifyOption_G1UseNextMarking: return is_obj_ill(obj);
-  case VerifyOption_G1UseMarkWord: {
-    HeapRegion* hr = _hrm.addr_to_region((HeapWord*)obj);
-    return !obj->is_gc_marked() && !hr->is_archive();
-  }
+  case VerifyOption_G1UseFullMarking: return is_obj_dead_full(obj);
   default:                            ShouldNotReachHere();
   }
   return false; // keep some compilers happy
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1046,6 +1046,7 @@
   // The Concurrent Marking reference processor...
   ReferenceProcessor* ref_processor_cm() const { return _ref_processor_cm; }
 
+  size_t unused_committed_regions_in_bytes() const;
   virtual size_t capacity() const;
   virtual size_t used() const;
   // This should be called when we're not holding the heap lock. The
@@ -1181,6 +1182,8 @@
     return barrier_set_cast<G1SATBCardTableLoggingModRefBS>(barrier_set());
   }
 
+  G1HotCardCache* g1_hot_card_cache() const { return _hot_card_cache; }
+
   // Iteration functions.
 
   // Iterate over all objects, calling "cl.do_object" on each.
@@ -1207,15 +1210,18 @@
 
   inline HeapWord* bottom_addr_for_region(uint index) const;
 
-  // Iterate over the heap regions in parallel. Assumes that this will be called
-  // in parallel by a number of worker threads with distinct worker ids
-  // in the range passed to the HeapRegionClaimer. Applies "blk->doHeapRegion"
-  // to each of the regions, by attempting to claim the region using the
-  // HeapRegionClaimer and, if successful, applying the closure to the claimed
-  // region.
-  void heap_region_par_iterate(HeapRegionClosure* cl,
-                               uint worker_id,
-                               HeapRegionClaimer* hrclaimer) const;
+  // Two functions to iterate over the heap regions in parallel. Threads
+  // compete using the HeapRegionClaimer to claim the regions before
+  // applying the closure on them.
+  // The _from_worker_offset version uses the HeapRegionClaimer and
+  // the worker id to calculate a start offset to prevent all workers to
+  // start from the point.
+  void heap_region_par_iterate_from_worker_offset(HeapRegionClosure* cl,
+                                                  HeapRegionClaimer* hrclaimer,
+                                                  uint worker_id) const;
+
+  void heap_region_par_iterate_from_start(HeapRegionClosure* cl,
+                                          HeapRegionClaimer* hrclaimer) const;
 
   // Iterate over the regions (if any) in the current collection set.
   void collection_set_iterate(HeapRegionClosure* blk);
@@ -1226,8 +1232,6 @@
   // collection set regions.
   void collection_set_iterate_from(HeapRegionClosure *blk, uint worker_id);
 
-  HeapRegion* next_compaction_region(const HeapRegion* from) const;
-
   // Returns the HeapRegion that contains addr. addr must not be NULL.
   template <class T>
   inline HeapRegion* heap_region_containing(const T addr) const;
@@ -1391,6 +1395,9 @@
 
   inline bool is_obj_ill(const oop obj) const;
 
+  inline bool is_obj_dead_full(const oop obj, const HeapRegion* hr) const;
+  inline bool is_obj_dead_full(const oop obj) const;
+
   G1ConcurrentMark* concurrent_mark() const { return _cm; }
 
   // Refinement
@@ -1435,9 +1442,9 @@
 
   // Perform verification.
 
-  // vo == UsePrevMarking  -> use "prev" marking information,
+  // vo == UsePrevMarking -> use "prev" marking information,
   // vo == UseNextMarking -> use "next" marking information
-  // vo == UseMarkWord    -> use the mark word in the object header
+  // vo == UseFullMarking -> use "next" marking bitmap but no TAMS
   //
   // NOTE: Only the "prev" marking information is guaranteed to be
   // consistent most of the time, so most calls to this should use
@@ -1446,7 +1453,7 @@
   // vo == UseNextMarking, which is to verify the "next" marking
   // information at the end of remark.
   // Currently there is only one place where this is called with
-  // vo == UseMarkWord, which is to verify the marking during a
+  // vo == UseFullMarking, which is to verify the marking during a
   // full GC.
   void verify(VerifyOption vo);
 
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -264,6 +264,14 @@
   return is_obj_ill(obj, heap_region_containing(obj));
 }
 
+inline bool G1CollectedHeap::is_obj_dead_full(const oop obj, const HeapRegion* hr) const {
+   return !isMarkedNext(obj) && !hr->is_archive();
+}
+
+inline bool G1CollectedHeap::is_obj_dead_full(const oop obj) const {
+    return is_obj_dead_full(obj, heap_region_containing(obj));
+}
+
 inline void G1CollectedHeap::set_humongous_reclaim_candidate(uint region, bool value) {
   assert(_hrm.at(region)->is_starts_humongous(), "Must start a humongous object");
   _humongous_reclaim_candidates.set_candidate(region, value);
--- a/src/hotspot/share/gc/g1/g1CollectedHeap_ext.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap_ext.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, 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
@@ -37,11 +37,6 @@
   return false;
 }
 
-HeapRegion* G1CollectedHeap::new_heap_region(uint hrs_index,
-                                             MemRegion mr) {
-  return new HeapRegion(hrs_index, bot(), mr);
-}
-
 G1Policy* G1CollectedHeap::create_g1_policy(STWGCTimer* gc_timer) {
   return new G1DefaultPolicy(gc_timer);
 }
--- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -634,7 +634,7 @@
 
   void work(uint worker_id) {
     SuspendibleThreadSetJoiner sts_join(_suspendible);
-    G1CollectedHeap::heap()->heap_region_par_iterate(&_cl, worker_id, &_hr_claimer);
+    G1CollectedHeap::heap()->heap_region_par_iterate_from_worker_offset(&_cl, &_hr_claimer, worker_id);
   }
 
   bool is_complete() {
@@ -1140,7 +1140,7 @@
     HRRSCleanupTask hrrs_cleanup_task;
     G1NoteEndOfConcMarkClosure g1_note_end(_g1h, &local_cleanup_list,
                                            &hrrs_cleanup_task);
-    _g1h->heap_region_par_iterate(&g1_note_end, worker_id, &_hrclaimer);
+    _g1h->heap_region_par_iterate_from_worker_offset(&g1_note_end, &_hrclaimer, worker_id);
     assert(g1_note_end.complete(), "Shouldn't have yielded!");
 
     // Now update the lists
--- a/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
+#include "gc/g1/heapRegion.hpp"
 #include "memory/virtualspace.hpp"
 
 void G1CMBitMap::print_on_error(outputStream* st, const char* prefix) const {
@@ -65,3 +66,10 @@
   _bm.at_put_range(addr_to_offset(intersection.start()),
                    addr_to_offset(intersection.end()), false);
 }
+
+void G1CMBitMap::clear_region(HeapRegion* region) {
+ if (!region->is_empty()) {
+   MemRegion mr(region->bottom(), region->top());
+   clear_range(mr);
+ }
+}
--- a/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -28,6 +28,7 @@
 #include "gc/g1/g1RegionToSpaceMapper.hpp"
 #include "memory/allocation.hpp"
 #include "memory/memRegion.hpp"
+#include "oops/oopsHierarchy.hpp"
 #include "utilities/bitMap.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/macros.hpp"
@@ -35,6 +36,7 @@
 class G1CMBitMap;
 class G1CMTask;
 class G1ConcurrentMark;
+class HeapRegion;
 
 // Closure for iteration over bitmaps
 class G1CMBitMapClosure VALUE_OBJ_CLASS_SPEC {
@@ -96,6 +98,7 @@
   void initialize(MemRegion heap, G1RegionToSpaceMapper* storage);
 
   // Read marks
+  bool is_marked(oop obj) const;
   bool is_marked(HeapWord* addr) const {
     assert(_covered.contains(addr),
            "Address " PTR_FORMAT " is outside underlying space from " PTR_FORMAT " to " PTR_FORMAT,
@@ -120,9 +123,12 @@
   // Write marks.
   inline void mark(HeapWord* addr);
   inline void clear(HeapWord* addr);
+  inline void clear(oop obj);
   inline bool par_mark(HeapWord* addr);
+  inline bool par_mark(oop obj);
 
   void clear_range(MemRegion mr);
+  void clear_region(HeapRegion* hr);
 };
 
 #endif // SHARE_VM_GC_G1_G1CONCURRENTMARKBITMAP_HPP
--- a/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.inline.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.inline.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -83,4 +83,16 @@
   return _bm.par_set_bit(addr_to_offset(addr));
 }
 
+inline bool G1CMBitMap::par_mark(oop obj) {
+  return par_mark((HeapWord*) obj);
+}
+
+inline bool G1CMBitMap::is_marked(oop obj) const{
+  return is_marked((HeapWord*) obj);
+}
+
+inline void G1CMBitMap::clear(oop obj) {
+  clear((HeapWord*) obj);
+}
+
 #endif // SHARE_VM_GC_G1_G1CONCURRENTMARKBITMAP_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullCollector.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,245 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "code/codeCache.hpp"
+#include "gc/g1/g1CollectedHeap.hpp"
+#include "gc/g1/g1CollectorPolicy.hpp"
+#include "gc/g1/g1FullCollector.hpp"
+#include "gc/g1/g1FullGCAdjustTask.hpp"
+#include "gc/g1/g1FullGCCompactTask.hpp"
+#include "gc/g1/g1FullGCMarker.inline.hpp"
+#include "gc/g1/g1FullGCMarkTask.hpp"
+#include "gc/g1/g1FullGCPrepareTask.hpp"
+#include "gc/g1/g1FullGCReferenceProcessorExecutor.hpp"
+#include "gc/g1/g1FullGCScope.hpp"
+#include "gc/g1/g1OopClosures.hpp"
+#include "gc/g1/g1StringDedup.hpp"
+#include "gc/shared/gcTraceTime.inline.hpp"
+#include "gc/shared/preservedMarks.hpp"
+#include "gc/shared/referenceProcessor.hpp"
+#include "gc/shared/weakProcessor.hpp"
+#include "logging/log.hpp"
+#include "runtime/biasedLocking.hpp"
+#include "utilities/debug.hpp"
+
+static void clear_and_activate_derived_pointers() {
+#if COMPILER2_OR_JVMCI
+  DerivedPointerTable::clear();
+#endif
+}
+
+static void deactivate_derived_pointers() {
+#if COMPILER2_OR_JVMCI
+  DerivedPointerTable::set_active(false);
+#endif
+}
+
+static void update_derived_pointers() {
+#if COMPILER2_OR_JVMCI
+  DerivedPointerTable::update_pointers();
+#endif
+}
+
+G1FullCollector::G1FullCollector(G1FullGCScope* scope,
+                                 ReferenceProcessor* reference_processor,
+                                 G1CMBitMap* bitmap,
+                                 uint workers) :
+    _scope(scope),
+    _num_workers(workers),
+    _mark_bitmap(bitmap),
+    _oop_queue_set(_num_workers),
+    _array_queue_set(_num_workers),
+    _preserved_marks_set(true),
+    _reference_processor(reference_processor),
+    _serial_compaction_point(),
+    _is_alive(_mark_bitmap),
+    _is_alive_mutator(_reference_processor, &_is_alive) {
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
+
+  _preserved_marks_set.init(_num_workers);
+  _markers = NEW_C_HEAP_ARRAY(G1FullGCMarker*, _num_workers, mtGC);
+  _compaction_points = NEW_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _num_workers, mtGC);
+  for (uint i = 0; i < _num_workers; i++) {
+    _markers[i] = new G1FullGCMarker(i, _preserved_marks_set.get(i), mark_bitmap());
+    _compaction_points[i] = new G1FullGCCompactionPoint();
+    _oop_queue_set.register_queue(i, marker(i)->oop_stack());
+    _array_queue_set.register_queue(i, marker(i)->objarray_stack());
+  }
+}
+
+G1FullCollector::~G1FullCollector() {
+  for (uint i = 0; i < _num_workers; i++) {
+    delete _markers[i];
+    delete _compaction_points[i];
+  }
+  FREE_C_HEAP_ARRAY(G1FullGCMarker*, _markers);
+  FREE_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _compaction_points);
+}
+
+void G1FullCollector::prepare_collection() {
+  _reference_processor->enable_discovery();
+  _reference_processor->setup_policy(scope()->should_clear_soft_refs());
+
+  // When collecting the permanent generation Method*s may be moving,
+  // so we either have to flush all bcp data or convert it into bci.
+  CodeCache::gc_prologue();
+
+  // We should save the marks of the currently locked biased monitors.
+  // The marking doesn't preserve the marks of biased objects.
+  BiasedLocking::preserve_marks();
+
+  // Clear and activate derived pointer collection.
+  clear_and_activate_derived_pointers();
+}
+
+void G1FullCollector::collect() {
+  phase1_mark_live_objects();
+  verify_after_marking();
+
+  // Don't add any more derived pointers during later phases
+  deactivate_derived_pointers();
+
+  phase2_prepare_compaction();
+
+  phase3_adjust_pointers();
+
+  phase4_do_compaction();
+}
+
+void G1FullCollector::complete_collection() {
+  // Restore all marks.
+  restore_marks();
+
+  // When the pointers have been adjusted and moved, we can
+  // update the derived pointer table.
+  update_derived_pointers();
+
+  BiasedLocking::restore_marks();
+  CodeCache::gc_epilogue();
+  JvmtiExport::gc_epilogue();
+}
+
+void G1FullCollector::phase1_mark_live_objects() {
+  // Recursively traverse all live objects and mark them.
+  GCTraceTime(Info, gc, phases) info("Phase 1: Mark live objects", scope()->timer());
+
+  // Do the actual marking.
+  G1FullGCMarkTask marking_task(this);
+  run_task(&marking_task);
+
+  // Process references discovered during marking.
+  G1FullGCReferenceProcessingExecutor reference_processing(this);
+  reference_processing.execute(scope()->timer(), scope()->tracer());
+
+  // Weak oops cleanup.
+  {
+    GCTraceTime(Debug, gc, phases) trace("Phase 1: Weak Processing", scope()->timer());
+    WeakProcessor::weak_oops_do(&_is_alive, &do_nothing_cl);
+  }
+
+  // Class unloading and cleanup.
+  if (ClassUnloading) {
+    GCTraceTime(Debug, gc, phases) debug("Phase 1: Class Unloading and Cleanup", scope()->timer());
+    // Unload classes and purge the SystemDictionary.
+    bool purged_class = SystemDictionary::do_unloading(&_is_alive, scope()->timer());
+    G1CollectedHeap::heap()->complete_cleaning(&_is_alive, purged_class);
+  } else {
+    GCTraceTime(Debug, gc, phases) debug("Phase 1: String and Symbol Tables Cleanup", scope()->timer());
+    // If no class unloading just clean out strings and symbols.
+    G1CollectedHeap::heap()->partial_cleaning(&_is_alive, true, true, G1StringDedup::is_enabled());
+  }
+
+  scope()->tracer()->report_object_count_after_gc(&_is_alive);
+}
+
+void G1FullCollector::prepare_compaction_common() {
+  G1FullGCPrepareTask task(this);
+  run_task(&task);
+
+  // To avoid OOM when there is memory left.
+  if (!task.has_freed_regions()) {
+    task.prepare_serial_compaction();
+  }
+}
+
+void G1FullCollector::phase2_prepare_compaction() {
+  GCTraceTime(Info, gc, phases) info("Phase 2: Prepare for compaction", scope()->timer());
+  prepare_compaction_ext(); // Will call prepare_compaction_common() above.
+}
+
+void G1FullCollector::phase3_adjust_pointers() {
+  // Adjust the pointers to reflect the new locations
+  GCTraceTime(Info, gc, phases) info("Phase 3: Adjust pointers and remembered sets", scope()->timer());
+
+  G1FullGCAdjustTask task(this);
+  run_task(&task);
+}
+
+void G1FullCollector::phase4_do_compaction() {
+  // Compact the heap using the compaction queues created in phase 2.
+  GCTraceTime(Info, gc, phases) info("Phase 4: Compact heap", scope()->timer());
+  G1FullGCCompactTask task(this);
+  run_task(&task);
+
+  // Serial compact to avoid OOM when very few free regions.
+  if (serial_compaction_point()->has_regions()) {
+    task.serial_compaction();
+  }
+}
+
+void G1FullCollector::restore_marks() {
+  SharedRestorePreservedMarksTaskExecutor task_executor(G1CollectedHeap::heap()->workers());
+  _preserved_marks_set.restore(&task_executor);
+  _preserved_marks_set.reclaim();
+}
+
+void G1FullCollector::run_task(AbstractGangTask* task) {
+  G1CollectedHeap::heap()->workers()->run_task(task, _num_workers);
+}
+
+void G1FullCollector::verify_after_marking() {
+  if (!VerifyDuringGC) {
+    //Only do verification if VerifyDuringGC is set.
+    return;
+  }
+
+  HandleMark hm;  // handle scope
+#if COMPILER2_OR_JVMCI
+  DerivedPointerTableDeactivate dpt_deact;
+#endif
+  G1CollectedHeap::heap()->prepare_for_verify();
+  // Note: we can verify only the heap here. When an object is
+  // marked, the previous value of the mark word (including
+  // identity hash values, ages, etc) is preserved, and the mark
+  // word is set to markOop::marked_value - effectively removing
+  // any hash values from the mark word. These hash values are
+  // used when verifying the dictionaries and so removing them
+  // from the mark word can make verification of the dictionaries
+  // fail. At the end of the GC, the original mark word values
+  // (including hash values) are restored to the appropriate
+  // objects.
+  GCTraceTime(Info, gc, verify)("During GC (full)");
+  G1CollectedHeap::heap()->verify(VerifyOption_G1UseFullMarking);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullCollector.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+#ifndef SHARE_GC_G1_G1FULLCOLLECTOR_HPP
+#define SHARE_GC_G1_G1FULLCOLLECTOR_HPP
+
+#include "gc/g1/g1FullGCCompactionPoint.hpp"
+#include "gc/g1/g1FullGCMarker.hpp"
+#include "gc/g1/g1FullGCOopClosures.hpp"
+#include "gc/shared/preservedMarks.hpp"
+#include "gc/shared/referenceProcessor.hpp"
+#include "gc/shared/taskqueue.hpp"
+#include "memory/allocation.hpp"
+
+class AbstractGangTask;
+class G1CMBitMap;
+class G1FullGCMarker;
+class G1FullGCScope;
+class G1FullGCCompactionPoint;
+class ReferenceProcessor;
+
+// The G1FullCollector holds data associated with the current Full GC.
+class G1FullCollector : StackObj {
+  G1FullGCScope*            _scope;
+  uint                      _num_workers;
+  G1FullGCMarker**          _markers;
+  G1FullGCCompactionPoint** _compaction_points;
+  G1CMBitMap*               _mark_bitmap;
+  OopQueueSet               _oop_queue_set;
+  ObjArrayTaskQueueSet      _array_queue_set;
+  PreservedMarksSet         _preserved_marks_set;
+  ReferenceProcessor*       _reference_processor;
+  G1FullGCCompactionPoint   _serial_compaction_point;
+
+  G1IsAliveClosure          _is_alive;
+  ReferenceProcessorIsAliveMutator _is_alive_mutator;
+
+public:
+  G1FullCollector(G1FullGCScope* scope,
+                  ReferenceProcessor* reference_processor,
+                  G1CMBitMap* mark_bitmap,
+                  uint workers);
+  ~G1FullCollector();
+
+  void prepare_collection();
+  void collect();
+  void complete_collection();
+
+  G1FullGCScope*           scope() { return _scope; }
+  uint                     workers() { return _num_workers; }
+  G1FullGCMarker*          marker(uint id) { return _markers[id]; }
+  G1FullGCCompactionPoint* compaction_point(uint id) { return _compaction_points[id]; }
+  G1CMBitMap*              mark_bitmap() { return _mark_bitmap; }
+  OopQueueSet*             oop_queue_set() { return &_oop_queue_set; }
+  ObjArrayTaskQueueSet*    array_queue_set() { return &_array_queue_set; }
+  PreservedMarksSet*       preserved_mark_set() { return &_preserved_marks_set; }
+  ReferenceProcessor*      reference_processor() { return _reference_processor; }
+  G1FullGCCompactionPoint* serial_compaction_point() { return &_serial_compaction_point; }
+
+private:
+  void phase1_mark_live_objects();
+  void phase2_prepare_compaction();
+  void phase3_adjust_pointers();
+  void phase4_do_compaction();
+
+  void restore_marks();
+  void verify_after_marking();
+
+  void run_task(AbstractGangTask* task);
+
+  // Prepare compaction extension support.
+  void prepare_compaction_ext();
+  void prepare_compaction_common();
+};
+
+
+#endif // SHARE_GC_G1_G1FULLCOLLECTOR_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullCollector_ext.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/g1/g1FullCollector.hpp"
+
+void G1FullCollector::prepare_compaction_ext() {
+  prepare_compaction_common();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/g1/g1CollectedHeap.hpp"
+#include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
+#include "gc/g1/g1FullCollector.hpp"
+#include "gc/g1/g1FullGCAdjustTask.hpp"
+#include "gc/g1/g1FullGCCompactionPoint.hpp"
+#include "gc/g1/g1FullGCMarker.hpp"
+#include "gc/g1/g1FullGCOopClosures.inline.hpp"
+#include "gc/g1/heapRegion.inline.hpp"
+#include "gc/shared/gcTraceTime.inline.hpp"
+#include "gc/shared/referenceProcessor.hpp"
+#include "logging/log.hpp"
+#include "utilities/ticks.inline.hpp"
+
+class G1AdjustLiveClosure : public StackObj {
+  G1AdjustAndRebuildClosure* _adjust_closure;
+public:
+  G1AdjustLiveClosure(G1AdjustAndRebuildClosure* cl) :
+    _adjust_closure(cl) { }
+
+  size_t apply(oop object) {
+    _adjust_closure->update_compaction_delta(object);
+    return object->oop_iterate_size(_adjust_closure);
+  }
+};
+
+class G1AdjustRegionClosure : public HeapRegionClosure {
+  G1CMBitMap* _bitmap;
+  uint _worker_id;
+ public:
+  G1AdjustRegionClosure(G1CMBitMap* bitmap, uint worker_id) :
+    _bitmap(bitmap),
+    _worker_id(worker_id) { }
+
+  bool doHeapRegion(HeapRegion* r) {
+    G1AdjustAndRebuildClosure cl(_worker_id);
+    if (r->is_humongous()) {
+      oop obj = oop(r->humongous_start_region()->bottom());
+      cl.update_compaction_delta(obj);
+      obj->oop_iterate(&cl, MemRegion(r->bottom(), r->top()));
+    } else if (r->is_open_archive()) {
+      // Only adjust the open archive regions, the closed ones
+      // never change.
+      G1AdjustLiveClosure adjust(&cl);
+      r->apply_to_marked_objects(_bitmap, &adjust);
+      // Open archive regions will not be compacted and the marking information is
+      // no longer needed. Clear it here to avoid having to do it later.
+      _bitmap->clear_region(r);
+    } else {
+      G1AdjustLiveClosure adjust(&cl);
+      r->apply_to_marked_objects(_bitmap, &adjust);
+    }
+    return false;
+  }
+};
+
+G1FullGCAdjustTask::G1FullGCAdjustTask(G1FullCollector* collector) :
+    G1FullGCTask("G1 Adjust and Rebuild", collector),
+    _root_processor(G1CollectedHeap::heap(), collector->workers()),
+    _hrclaimer(collector->workers()),
+    _adjust(),
+    _adjust_string_dedup(NULL, &_adjust, G1StringDedup::is_enabled()) {
+  // Need cleared claim bits for the roots processing
+  ClassLoaderDataGraph::clear_claimed_marks();
+}
+
+void G1FullGCAdjustTask::work(uint worker_id) {
+  Ticks start = Ticks::now();
+  ResourceMark rm;
+
+  // Adjust preserved marks first since they are not balanced.
+  G1FullGCMarker* marker = collector()->marker(worker_id);
+  marker->preserved_stack()->adjust_during_full_gc();
+
+  // Adjust the weak_roots.
+  CLDToOopClosure adjust_cld(&_adjust);
+  CodeBlobToOopClosure adjust_code(&_adjust, CodeBlobToOopClosure::FixRelocations);
+  _root_processor.process_full_gc_weak_roots(&_adjust);
+
+  // Needs to be last, process_all_roots calls all_tasks_completed(...).
+  _root_processor.process_all_roots(
+      &_adjust,
+      &adjust_cld,
+      &adjust_code);
+
+  // Adjust string dedup if enabled.
+  if (G1StringDedup::is_enabled()) {
+    G1StringDedup::parallel_unlink(&_adjust_string_dedup, worker_id);
+  }
+
+  // Now adjust pointers region by region
+  G1AdjustRegionClosure blk(collector()->mark_bitmap(), worker_id);
+  G1CollectedHeap::heap()->heap_region_par_iterate_from_worker_offset(&blk, &_hrclaimer, worker_id);
+  log_task("Adjust and Rebuild task", worker_id, start);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCAdjustTask.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+#ifndef SHARE_GC_G1_G1FULLGCADJUSTTASK_HPP
+#define SHARE_GC_G1_G1FULLGCADJUSTTASK_HPP
+
+#include "gc/g1/g1FullGCOopClosures.hpp"
+#include "gc/g1/g1FullGCTask.hpp"
+#include "gc/g1/g1RootProcessor.hpp"
+#include "gc/g1/g1StringDedup.hpp"
+#include "gc/g1/heapRegionManager.hpp"
+#include "utilities/ticks.hpp"
+
+class G1CollectedHeap;
+
+class G1FullGCAdjustTask : public G1FullGCTask {
+  G1RootProcessor          _root_processor;
+  HeapRegionClaimer        _hrclaimer;
+  G1AdjustClosure          _adjust;
+  G1StringDedupUnlinkOrOopsDoClosure _adjust_string_dedup;
+
+public:
+  G1FullGCAdjustTask(G1FullCollector* collector);
+  void work(uint worker_id);
+};
+
+#endif // SHARE_GC_G1_G1FULLGCADJUSTTASK_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/g1/g1CollectedHeap.hpp"
+#include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
+#include "gc/g1/g1FullCollector.hpp"
+#include "gc/g1/g1FullGCCompactionPoint.hpp"
+#include "gc/g1/g1FullGCCompactTask.hpp"
+#include "gc/g1/heapRegion.inline.hpp"
+#include "gc/shared/gcTraceTime.inline.hpp"
+#include "logging/log.hpp"
+#include "utilities/ticks.inline.hpp"
+
+class G1ResetHumongousClosure : public HeapRegionClosure {
+  G1CMBitMap* _bitmap;
+
+public:
+  G1ResetHumongousClosure(G1CMBitMap* bitmap) :
+      _bitmap(bitmap) { }
+
+  bool doHeapRegion(HeapRegion* current) {
+    if (current->is_humongous()) {
+      if (current->is_starts_humongous()) {
+        oop obj = oop(current->bottom());
+        if (_bitmap->is_marked(obj)) {
+          // Clear bitmap and fix mark word.
+          _bitmap->clear(obj);
+          obj->init_mark();
+        } else {
+          assert(current->is_empty(), "Should have been cleared in phase 2.");
+        }
+      }
+      current->reset_during_compaction();
+    }
+    return false;
+  }
+};
+
+size_t G1FullGCCompactTask::G1CompactRegionClosure::apply(oop obj) {
+  size_t size = obj->size();
+  HeapWord* destination = (HeapWord*)obj->forwardee();
+  if (destination == NULL) {
+    // Object not moving
+    return size;
+  }
+
+  // copy object and reinit its mark
+  HeapWord* obj_addr = (HeapWord*) obj;
+  assert(obj_addr != destination, "everything in this pass should be moving");
+  Copy::aligned_conjoint_words(obj_addr, destination, size);
+  oop(destination)->init_mark();
+  assert(oop(destination)->klass() != NULL, "should have a class");
+
+  return size;
+}
+
+void G1FullGCCompactTask::compact_region(HeapRegion* hr) {
+  assert(!hr->is_humongous(), "Should be no humongous regions in compaction queue");
+  G1CompactRegionClosure compact(collector()->mark_bitmap());
+  hr->apply_to_marked_objects(collector()->mark_bitmap(), &compact);
+  // Once all objects have been moved the liveness information
+  // needs be cleared.
+  collector()->mark_bitmap()->clear_region(hr);
+  hr->complete_compaction();
+}
+
+void G1FullGCCompactTask::work(uint worker_id) {
+  Ticks start = Ticks::now();
+  GrowableArray<HeapRegion*>* compaction_queue = collector()->compaction_point(worker_id)->regions();
+  for (GrowableArrayIterator<HeapRegion*> it = compaction_queue->begin();
+       it != compaction_queue->end();
+       ++it) {
+    compact_region(*it);
+  }
+
+  G1ResetHumongousClosure hc(collector()->mark_bitmap());
+  G1CollectedHeap::heap()->heap_region_par_iterate_from_worker_offset(&hc, &_claimer, worker_id);
+  log_task("Compaction task", worker_id, start);
+}
+
+void G1FullGCCompactTask::serial_compaction() {
+  GCTraceTime(Debug, gc, phases) tm("Phase 4: Serial Compaction", collector()->scope()->timer());
+  GrowableArray<HeapRegion*>* compaction_queue = collector()->serial_compaction_point()->regions();
+  for (GrowableArrayIterator<HeapRegion*> it = compaction_queue->begin();
+       it != compaction_queue->end();
+       ++it) {
+    compact_region(*it);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCCompactTask.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+#ifndef SHARE_GC_G1_G1FULLGCCOMPACTTASK_HPP
+#define SHARE_GC_G1_G1FULLGCCOMPACTTASK_HPP
+
+#include "gc/g1/g1FullGCCompactionPoint.hpp"
+#include "gc/g1/g1FullGCScope.hpp"
+#include "gc/g1/g1FullGCTask.hpp"
+#include "gc/g1/g1StringDedup.hpp"
+#include "gc/g1/heapRegionManager.hpp"
+#include "gc/shared/referenceProcessor.hpp"
+#include "utilities/ticks.hpp"
+
+class G1CollectedHeap;
+class G1CMBitMap;
+
+class G1FullGCCompactTask : public G1FullGCTask {
+protected:
+  HeapRegionClaimer _claimer;
+
+private:
+  void compact_region(HeapRegion* hr);
+
+public:
+  G1FullGCCompactTask(G1FullCollector* collector) :
+    G1FullGCTask("G1 Compact Task", collector),
+    _claimer(collector->workers()) { }
+  void work(uint worker_id);
+  void serial_compaction();
+
+  class G1CompactRegionClosure : public StackObj {
+    G1CMBitMap* _bitmap;
+
+  public:
+    G1CompactRegionClosure(G1CMBitMap* bitmap) : _bitmap(bitmap) { }
+    size_t apply(oop object);
+  };
+};
+
+#endif // SHARE_GC_G1_G1FULLGCCOMPACTTASK_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/g1/g1FullGCCompactionPoint.hpp"
+#include "gc/g1/heapRegion.hpp"
+#include "oops/oop.inline.hpp"
+#include "utilities/debug.hpp"
+
+G1FullGCCompactionPoint::G1FullGCCompactionPoint() :
+    _current_region(NULL),
+    _threshold(NULL),
+    _compaction_top(NULL) {
+  _compaction_regions = new (ResourceObj::C_HEAP, mtGC) GrowableArray<HeapRegion*>(32, true, mtGC);
+  _compaction_region_iterator = _compaction_regions->begin();
+}
+
+G1FullGCCompactionPoint::~G1FullGCCompactionPoint() {
+  delete _compaction_regions;
+}
+
+void G1FullGCCompactionPoint::update() {
+  if (is_initialized()) {
+    _current_region->set_compaction_top(_compaction_top);
+  }
+}
+
+void G1FullGCCompactionPoint::initialize_values(bool init_threshold) {
+  _compaction_top = _current_region->compaction_top();
+  if (init_threshold) {
+    _threshold = _current_region->initialize_threshold();
+  }
+}
+
+bool G1FullGCCompactionPoint::has_regions() {
+  return !_compaction_regions->is_empty();
+}
+
+bool G1FullGCCompactionPoint::is_initialized() {
+  return _current_region != NULL;
+}
+
+void G1FullGCCompactionPoint::initialize(HeapRegion* hr, bool init_threshold) {
+  _current_region = hr;
+  initialize_values(init_threshold);
+}
+
+HeapRegion* G1FullGCCompactionPoint::current_region() {
+  return *_compaction_region_iterator;
+}
+
+HeapRegion* G1FullGCCompactionPoint::next_region() {
+  HeapRegion* next = *(++_compaction_region_iterator);
+  assert(next != NULL, "Must return valid region");
+  return next;
+}
+
+GrowableArray<HeapRegion*>* G1FullGCCompactionPoint::regions() {
+  return _compaction_regions;
+}
+
+bool G1FullGCCompactionPoint::object_will_fit(size_t size) {
+  size_t space_left = pointer_delta(_current_region->end(), _compaction_top);
+  return size <= space_left;
+}
+
+void G1FullGCCompactionPoint::switch_region() {
+  // Save compaction top in the region.
+  _current_region->set_compaction_top(_compaction_top);
+  // Get the next region and re-initialize the values.
+  _current_region = next_region();
+  initialize_values(true);
+}
+
+void G1FullGCCompactionPoint::forward(oop object, size_t size) {
+  assert(_current_region != NULL, "Must have been initialized");
+
+  // Ensure the object fit in the current region.
+  while (!object_will_fit(size)) {
+    switch_region();
+  }
+
+  // Store a forwarding pointer if the object should be moved.
+  if ((HeapWord*)object != _compaction_top) {
+    object->forward_to(oop(_compaction_top));
+  } else {
+    if (object->forwardee() != NULL) {
+      // Object should not move but mark-word is used so it looks like the
+      // object is forwarded. Need to clear the mark and it's no problem
+      // since it will be restored by preserved marks. There is an exception
+      // with BiasedLocking, in this case forwardee() will return NULL
+      // even if the mark-word is used. This is no problem since
+      // forwardee() will return NULL in the compaction phase as well.
+      object->init_mark();
+    } else {
+      // Make sure object has the correct mark-word set or that it will be
+      // fixed when restoring the preserved marks.
+      assert(object->mark() == markOopDesc::prototype_for_object(object) || // Correct mark
+             object->mark()->must_be_preserved(object) || // Will be restored by PreservedMarksSet
+             (UseBiasedLocking && object->has_bias_pattern()), // Will be restored by BiasedLocking
+             "should have correct prototype obj: " PTR_FORMAT " mark: " PTR_FORMAT " prototype: " PTR_FORMAT,
+             p2i(object), p2i(object->mark()), p2i(markOopDesc::prototype_for_object(object)));
+    }
+    assert(object->forwardee() == NULL, "should be forwarded to NULL");
+  }
+
+  // Update compaction values.
+  _compaction_top += size;
+  if (_compaction_top > _threshold) {
+    _threshold = _current_region->cross_threshold(_compaction_top - size, _compaction_top);
+  }
+}
+
+void G1FullGCCompactionPoint::add(HeapRegion* hr) {
+  _compaction_regions->append(hr);
+}
+
+void G1FullGCCompactionPoint::merge(G1FullGCCompactionPoint* other) {
+   _compaction_regions->appendAll(other->regions());
+}
+
+HeapRegion* G1FullGCCompactionPoint::remove_last() {
+  return _compaction_regions->pop();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+#ifndef SHARE_GC_G1_G1FULLGCCOMPACTIONPOINT_HPP
+#define SHARE_GC_G1_G1FULLGCCOMPACTIONPOINT_HPP
+
+#include "memory/allocation.hpp"
+#include "utilities/growableArray.hpp"
+
+class HeapRegion;
+
+class G1FullGCCompactionPoint : public CHeapObj<mtGC> {
+  HeapRegion* _current_region;
+  HeapWord*   _threshold;
+  HeapWord*   _compaction_top;
+  GrowableArray<HeapRegion*>* _compaction_regions;
+  GrowableArrayIterator<HeapRegion*> _compaction_region_iterator;
+
+  bool object_will_fit(size_t size);
+  void initialize_values(bool init_threshold);
+  void switch_region();
+  HeapRegion* next_region();
+
+public:
+  G1FullGCCompactionPoint();
+  ~G1FullGCCompactionPoint();
+
+  bool has_regions();
+  bool is_initialized();
+  void initialize(HeapRegion* hr, bool init_threshold);
+  void update();
+  void forward(oop object, size_t size);
+  void add(HeapRegion* hr);
+  void merge(G1FullGCCompactionPoint* other);
+
+  HeapRegion* remove_last();
+  HeapRegion* current_region();
+
+  GrowableArray<HeapRegion*>* regions();
+};
+
+#endif // SHARE_GC_G1_G1FULLGCCOMPACTIONPOINT_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCMarkTask.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/g1/g1CollectedHeap.hpp"
+#include "gc/g1/g1FullCollector.hpp"
+#include "gc/g1/g1FullGCMarker.hpp"
+#include "gc/g1/g1FullGCMarkTask.hpp"
+#include "gc/g1/g1FullGCOopClosures.inline.hpp"
+#include "gc/g1/g1FullGCReferenceProcessorExecutor.hpp"
+#include "gc/shared/gcTraceTime.inline.hpp"
+#include "gc/shared/referenceProcessor.hpp"
+
+G1FullGCMarkTask::G1FullGCMarkTask(G1FullCollector* collector) :
+    G1FullGCTask("G1 Parallel Marking Task", collector),
+    _root_processor(G1CollectedHeap::heap(), collector->workers()),
+    _terminator(collector->workers(), collector->array_queue_set()) {
+  // Need cleared claim bits for the roots processing
+  ClassLoaderDataGraph::clear_claimed_marks();
+}
+
+void G1FullGCMarkTask::work(uint worker_id) {
+  Ticks start = Ticks::now();
+  ResourceMark rm;
+  G1FullGCMarker* marker = collector()->marker(worker_id);
+  MarkingCodeBlobClosure code_closure(marker->mark_closure(), !CodeBlobToOopClosure::FixRelocations);
+
+  if (ClassUnloading) {
+    _root_processor.process_strong_roots(
+        marker->mark_closure(),
+        marker->cld_closure(),
+        &code_closure);
+  } else {
+    _root_processor.process_all_roots_no_string_table(
+        marker->mark_closure(),
+        marker->cld_closure(),
+        &code_closure);
+  }
+
+  // Mark stack is populated, now process and drain it.
+  marker->complete_marking(collector()->oop_queue_set(), collector()->array_queue_set(), &_terminator);
+
+  // This is the point where the entire marking should have completed.
+  assert(marker->oop_stack()->is_empty(), "Marking should have completed");
+  assert(marker->objarray_stack()->is_empty(), "Array marking should have completed");
+  log_task("Marking task", worker_id, start);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCMarkTask.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+#ifndef SHARE_GC_G1_G1FULLGCMARKTASK_HPP
+#define SHARE_GC_G1_G1FULLGCMARKTASK_HPP
+
+#include "gc/g1/g1FullGCCompactionPoint.hpp"
+#include "gc/g1/g1FullGCScope.hpp"
+#include "gc/g1/g1FullGCTask.hpp"
+#include "gc/g1/g1RootProcessor.hpp"
+#include "gc/g1/g1StringDedup.hpp"
+#include "gc/g1/heapRegionManager.hpp"
+#include "gc/shared/referenceProcessor.hpp"
+#include "utilities/ticks.hpp"
+
+class G1FullGCMarkTask : public G1FullGCTask {
+  G1RootProcessor          _root_processor;
+  ParallelTaskTerminator   _terminator;
+
+public:
+  G1FullGCMarkTask(G1FullCollector* collector);
+  void work(uint worker_id);
+};
+
+#endif // SHARE_GC_G1_G1FULLGCMARKTASK_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCMarker.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/g1/g1FullGCMarker.inline.hpp"
+
+G1FullGCMarker::G1FullGCMarker(uint worker_id, PreservedMarks* preserved_stack, G1CMBitMap* bitmap) :
+    _worker_id(worker_id),
+    _mark_closure(worker_id, this, G1CollectedHeap::heap()->ref_processor_stw()),
+    _verify_closure(VerifyOption_G1UseFullMarking),
+    _cld_closure(mark_closure()),
+    _stack_closure(this),
+    _preserved_stack(preserved_stack),
+    _bitmap(bitmap) {
+  _oop_stack.initialize();
+  _objarray_stack.initialize();
+}
+
+G1FullGCMarker::~G1FullGCMarker() {
+  assert(is_empty(), "Must be empty at this point");
+}
+
+void G1FullGCMarker::complete_marking(OopQueueSet* oop_stacks,
+                                      ObjArrayTaskQueueSet* array_stacks,
+                                      ParallelTaskTerminator* terminator) {
+  int hash_seed = 17;
+  do {
+    drain_stack();
+    ObjArrayTask steal_array;
+    if (array_stacks->steal(_worker_id, &hash_seed, steal_array)) {
+      follow_array_chunk(objArrayOop(steal_array.obj()), steal_array.index());
+    } else {
+      oop steal_oop;
+      if (oop_stacks->steal(_worker_id, &hash_seed, steal_oop)) {
+        follow_object(steal_oop);
+      }
+    }
+  } while (!is_empty() || !terminator->offer_termination());
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCMarker.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+#ifndef SHARE_GC_G1_G1FULLGCMARKER_HPP
+#define SHARE_GC_G1_G1FULLGCMARKER_HPP
+
+#include "gc/g1/g1FullGCOopClosures.hpp"
+#include "gc/shared/preservedMarks.hpp"
+#include "gc/shared/taskqueue.hpp"
+#include "memory/iterator.hpp"
+#include "oops/markOop.hpp"
+#include "oops/oop.hpp"
+#include "runtime/timer.hpp"
+#include "utilities/chunkedList.hpp"
+#include "utilities/growableArray.hpp"
+#include "utilities/stack.hpp"
+
+typedef OverflowTaskQueue<oop, mtGC>                 OopQueue;
+typedef OverflowTaskQueue<ObjArrayTask, mtGC>        ObjArrayTaskQueue;
+
+typedef GenericTaskQueueSet<OopQueue, mtGC>          OopQueueSet;
+typedef GenericTaskQueueSet<ObjArrayTaskQueue, mtGC> ObjArrayTaskQueueSet;
+
+class G1CMBitMap;
+
+class G1FullGCMarker : public CHeapObj<mtGC> {
+private:
+  uint               _worker_id;
+  // Backing mark bitmap
+  G1CMBitMap*        _bitmap;
+
+  // Mark stack
+  OopQueue           _oop_stack;
+  ObjArrayTaskQueue  _objarray_stack;
+  PreservedMarks*    _preserved_stack;
+
+  // Marking closures
+  G1MarkAndPushClosure _mark_closure;
+  G1VerifyOopClosure   _verify_closure;
+  G1FollowStackClosure _stack_closure;
+  CLDToOopClosure      _cld_closure;
+
+  inline bool is_empty();
+  inline bool pop_object(oop& obj);
+  inline bool pop_objarray(ObjArrayTask& array);
+  inline void push_objarray(oop obj, size_t index);
+  inline bool mark_object(oop obj);
+
+  // Marking helpers
+  inline void follow_object(oop obj);
+  inline void follow_array(objArrayOop array);
+  inline void follow_array_chunk(objArrayOop array, int index);
+public:
+  G1FullGCMarker(uint worker_id, PreservedMarks* preserved_stack, G1CMBitMap* bitmap);
+  ~G1FullGCMarker();
+
+  // Stack getters
+  OopQueue*          oop_stack()       { return &_oop_stack; }
+  ObjArrayTaskQueue* objarray_stack()  { return &_objarray_stack; }
+  PreservedMarks*    preserved_stack() { return _preserved_stack; }
+
+  // Marking entry points
+  template <class T> inline void mark_and_push(T* p);
+  inline void follow_klass(Klass* k);
+  inline void follow_cld(ClassLoaderData* cld);
+
+  inline void drain_stack();
+  void complete_marking(OopQueueSet* oop_stacks,
+                        ObjArrayTaskQueueSet* array_stacks,
+                        ParallelTaskTerminator* terminator);
+
+  // Closure getters
+  CLDToOopClosure*      cld_closure()   { return &_cld_closure; }
+  G1MarkAndPushClosure* mark_closure()  { return &_mark_closure; }
+  G1FollowStackClosure* stack_closure() { return &_stack_closure; }
+};
+
+#endif // SHARE_GC_G1_G1FULLGCMARKER_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCMarker.inline.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+#ifndef SHARE_VM_GC_G1_G1MARKSTACK_INLINE_HPP
+#define SHARE_VM_GC_G1_G1MARKSTACK_INLINE_HPP
+
+#include "gc/g1/g1Allocator.inline.hpp"
+#include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
+#include "gc/g1/g1FullGCMarker.hpp"
+#include "gc/g1/g1StringDedup.hpp"
+#include "gc/g1/g1StringDedupQueue.hpp"
+#include "gc/shared/preservedMarks.inline.hpp"
+#include "utilities/debug.hpp"
+
+inline bool G1FullGCMarker::mark_object(oop obj) {
+  // Not marking closed archive objects.
+  if (G1ArchiveAllocator::is_closed_archive_object(obj)) {
+    return false;
+  }
+
+  // Try to mark.
+  if (!_bitmap->par_mark(obj)) {
+    // Lost mark race.
+    return false;
+  }
+
+  // Marked by us, preserve if needed.
+  markOop mark = obj->mark();
+  if (mark->must_be_preserved(obj) &&
+      !G1ArchiveAllocator::is_open_archive_object(obj)) {
+    preserved_stack()->push(obj, mark);
+  }
+
+  // Check if deduplicatable string.
+  if (G1StringDedup::is_enabled()) {
+    G1StringDedup::enqueue_from_mark(obj, _worker_id);
+  }
+  return true;
+}
+
+template <class T> inline void G1FullGCMarker::mark_and_push(T* p) {
+  T heap_oop = oopDesc::load_heap_oop(p);
+  if (!oopDesc::is_null(heap_oop)) {
+    oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
+    if (mark_object(obj)) {
+      _oop_stack.push(obj);
+      assert(_bitmap->is_marked(obj), "Must be marked now - map self");
+    } else {
+      assert(_bitmap->is_marked(obj) || G1ArchiveAllocator::is_closed_archive_object(obj),
+             "Must be marked by other or closed archive object");
+    }
+  }
+}
+
+inline bool G1FullGCMarker::is_empty() {
+  return _oop_stack.is_empty() && _objarray_stack.is_empty();
+}
+
+inline bool G1FullGCMarker::pop_object(oop& oop) {
+  return _oop_stack.pop_overflow(oop) || _oop_stack.pop_local(oop);
+}
+
+inline void G1FullGCMarker::push_objarray(oop obj, size_t index) {
+  ObjArrayTask task(obj, index);
+  assert(task.is_valid(), "bad ObjArrayTask");
+  _objarray_stack.push(task);
+}
+
+inline bool G1FullGCMarker::pop_objarray(ObjArrayTask& arr) {
+  return _objarray_stack.pop_overflow(arr) || _objarray_stack.pop_local(arr);
+}
+
+inline void G1FullGCMarker::follow_array(objArrayOop array) {
+  follow_klass(array->klass());
+  // Don't push empty arrays to avoid unnecessary work.
+  if (array->length() > 0) {
+    push_objarray(array, 0);
+  }
+}
+
+void G1FullGCMarker::follow_array_chunk(objArrayOop array, int index) {
+  const int len = array->length();
+  const int beg_index = index;
+  assert(beg_index < len || len == 0, "index too large");
+
+  const int stride = MIN2(len - beg_index, (int) ObjArrayMarkingStride);
+  const int end_index = beg_index + stride;
+
+  array->oop_iterate_range(mark_closure(), beg_index, end_index);
+
+  if (VerifyDuringGC) {
+    _verify_closure.set_containing_obj(array);
+    NoHeaderExtendedOopClosure no(&_verify_closure);
+    array->oop_iterate_range(&no, beg_index, end_index);
+    if (_verify_closure.failures()) {
+      assert(false, "Failed");
+    }
+  }
+
+  if (end_index < len) {
+    push_objarray(array, end_index); // Push the continuation.
+  }
+}
+
+inline void G1FullGCMarker::follow_object(oop obj) {
+  assert(_bitmap->is_marked(obj), "should be marked");
+  if (obj->is_objArray()) {
+    // Handle object arrays explicitly to allow them to
+    // be split into chunks if needed.
+    follow_array((objArrayOop)obj);
+  } else {
+    obj->oop_iterate(mark_closure());
+    if (VerifyDuringGC) {
+      if (obj->is_instance() && InstanceKlass::cast(obj->klass())->is_reference_instance_klass()) {
+        return;
+      }
+      _verify_closure.set_containing_obj(obj);
+      obj->oop_iterate_no_header(&_verify_closure);
+      if (_verify_closure.failures()) {
+        log_warning(gc, verify)("Failed after %d", _verify_closure._cc);
+        assert(false, "Failed");
+      }
+    }
+  }
+}
+
+void G1FullGCMarker::drain_stack() {
+  do {
+    oop obj;
+    while (pop_object(obj)) {
+      assert(_bitmap->is_marked(obj), "must be marked");
+      follow_object(obj);
+    }
+    // Process ObjArrays one at a time to avoid marking stack bloat.
+    ObjArrayTask task;
+    if (pop_objarray(task)) {
+      follow_array_chunk(objArrayOop(task.obj()), task.index());
+    }
+  } while (!is_empty());
+}
+
+inline void G1FullGCMarker::follow_klass(Klass* k) {
+  oop op = k->klass_holder();
+  mark_and_push(&op);
+}
+
+inline void G1FullGCMarker::follow_cld(ClassLoaderData* cld) {
+  _cld_closure.do_cld(cld);
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/g1/g1CollectedHeap.hpp"
+#include "gc/g1/g1FullGCMarker.inline.hpp"
+#include "gc/g1/g1FullGCOopClosures.inline.hpp"
+#include "gc/g1/g1_specialized_oop_closures.hpp"
+#include "logging/logStream.hpp"
+
+void G1MarkAndPushClosure::do_oop(oop* p) {
+  do_oop_nv(p);
+}
+
+void G1MarkAndPushClosure::do_oop(narrowOop* p) {
+  do_oop_nv(p);
+}
+
+bool G1MarkAndPushClosure::do_metadata() {
+  return do_metadata_nv();
+}
+
+void G1MarkAndPushClosure::do_klass(Klass* k) {
+  do_klass_nv(k);
+}
+
+void G1MarkAndPushClosure::do_cld(ClassLoaderData* cld) {
+  do_cld_nv(cld);
+}
+
+G1AdjustAndRebuildClosure::G1AdjustAndRebuildClosure(uint worker_id) :
+  _worker_id(worker_id),
+  _compaction_delta(0),
+  _g1h(G1CollectedHeap::heap()) { }
+
+void G1AdjustAndRebuildClosure::update_compaction_delta(oop obj) {
+  if (G1ArchiveAllocator::is_open_archive_object(obj)) {
+    _compaction_delta = 0;
+    return;
+  }
+  oop forwardee = obj->forwardee();
+  if (forwardee == NULL) {
+    // Object not moved.
+    _compaction_delta = 0;
+  } else {
+    // Object moved to forwardee, calculate delta.
+    _compaction_delta = calculate_compaction_delta(obj, forwardee);
+  }
+}
+
+void G1AdjustClosure::do_oop(oop* p)       { adjust_pointer(p); }
+void G1AdjustClosure::do_oop(narrowOop* p) { adjust_pointer(p); }
+
+void G1AdjustAndRebuildClosure::do_oop(oop* p)       { do_oop_nv(p); }
+void G1AdjustAndRebuildClosure::do_oop(narrowOop* p) { do_oop_nv(p); }
+
+void G1FollowStackClosure::do_void() { _marker->drain_stack(); }
+
+void G1FullKeepAliveClosure::do_oop(oop* p) { do_oop_work(p); }
+void G1FullKeepAliveClosure::do_oop(narrowOop* p) { do_oop_work(p); }
+
+G1VerifyOopClosure::G1VerifyOopClosure(VerifyOption option) :
+   _g1h(G1CollectedHeap::heap()),
+   _containing_obj(NULL),
+   _verify_option(option),
+   _cc(0),
+   _failures(false) {
+}
+
+void G1VerifyOopClosure::print_object(outputStream* out, oop obj) {
+#ifdef PRODUCT
+  Klass* k = obj->klass();
+  const char* class_name = InstanceKlass::cast(k)->external_name();
+  out->print_cr("class name %s", class_name);
+#else // PRODUCT
+  obj->print_on(out);
+#endif // PRODUCT
+}
+
+template <class T> void G1VerifyOopClosure::do_oop_nv(T* p) {
+  T heap_oop = oopDesc::load_heap_oop(p);
+  if (!oopDesc::is_null(heap_oop)) {
+    _cc++;
+    oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
+    bool failed = false;
+    if (!_g1h->is_in_closed_subset(obj) || _g1h->is_obj_dead_cond(obj, _verify_option)) {
+      MutexLockerEx x(ParGCRareEvent_lock,
+          Mutex::_no_safepoint_check_flag);
+      LogStreamHandle(Error, gc, verify) yy;
+      if (!_failures) {
+        yy.cr();
+        yy.print_cr("----------");
+      }
+      if (!_g1h->is_in_closed_subset(obj)) {
+        HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
+        yy.print_cr("Field " PTR_FORMAT
+            " of live obj " PTR_FORMAT " in region "
+            "[" PTR_FORMAT ", " PTR_FORMAT ")",
+            p2i(p), p2i(_containing_obj),
+            p2i(from->bottom()), p2i(from->end()));
+        print_object(&yy, _containing_obj);
+        yy.print_cr("points to obj " PTR_FORMAT " not in the heap",
+            p2i(obj));
+      } else {
+        HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
+        HeapRegion* to   = _g1h->heap_region_containing((HeapWord*)obj);
+        yy.print_cr("Field " PTR_FORMAT
+            " of live obj " PTR_FORMAT " in region "
+            "[" PTR_FORMAT ", " PTR_FORMAT ")",
+            p2i(p), p2i(_containing_obj),
+            p2i(from->bottom()), p2i(from->end()));
+        print_object(&yy, _containing_obj);
+        yy.print_cr("points to dead obj " PTR_FORMAT " in region "
+            "[" PTR_FORMAT ", " PTR_FORMAT ")",
+            p2i(obj), p2i(to->bottom()), p2i(to->end()));
+        print_object(&yy, obj);
+      }
+      yy.print_cr("----------");
+      yy.flush();
+      _failures = true;
+      failed = true;
+    }
+  }
+}
+
+// Generate G1 full GC specialized oop_oop_iterate functions.
+SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_G1FULL(ALL_KLASS_OOP_OOP_ITERATE_DEFN)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+#ifndef SHARE_GC_G1_G1FULLGCOOPCLOSURES_HPP
+#define SHARE_GC_G1_G1FULLGCOOPCLOSURES_HPP
+
+#include "memory/iterator.hpp"
+#include "memory/universe.hpp"
+
+class G1CollectedHeap;
+class G1FullCollector;
+class G1CMBitMap;
+class G1FullGCMarker;
+
+// Below are closures used by the G1 Full GC.
+class G1IsAliveClosure : public BoolObjectClosure {
+  G1CMBitMap* _bitmap;
+
+public:
+  G1IsAliveClosure(G1CMBitMap* bitmap) : _bitmap(bitmap) { }
+
+  virtual bool do_object_b(oop p);
+};
+
+class G1FullKeepAliveClosure: public OopClosure {
+  G1FullGCMarker* _marker;
+  template <class T>
+  inline void do_oop_work(T* p);
+
+public:
+  G1FullKeepAliveClosure(G1FullGCMarker* pm) : _marker(pm) { }
+
+  virtual void do_oop(oop* p);
+  virtual void do_oop(narrowOop* p);
+};
+
+class G1MarkAndPushClosure : public ExtendedOopClosure {
+  G1FullGCMarker* _marker;
+  uint _worker_id;
+
+public:
+  G1MarkAndPushClosure(uint worker, G1FullGCMarker* marker, ReferenceProcessor* ref) :
+    _marker(marker),
+    _worker_id(worker),
+    ExtendedOopClosure(ref) { }
+
+  template <class T> inline void do_oop_nv(T* p);
+  virtual void do_oop(oop* p);
+  virtual void do_oop(narrowOop* p);
+
+  virtual bool do_metadata();
+  bool do_metadata_nv();
+
+  virtual void do_klass(Klass* k);
+  void do_klass_nv(Klass* k);
+
+  virtual void do_cld(ClassLoaderData* cld);
+  void do_cld_nv(ClassLoaderData* cld);
+};
+
+class G1AdjustClosure : public OopClosure {
+public:
+  template <class T> static inline oop adjust_pointer(T* p);
+  virtual void do_oop(oop* p);
+  virtual void do_oop(narrowOop* p);
+};
+
+class G1AdjustAndRebuildClosure : public ExtendedOopClosure {
+  uint _worker_id;
+  size_t _compaction_delta;
+  G1CollectedHeap* _g1h;
+
+  inline size_t calculate_compaction_delta(oop current, oop forwardee);
+  template <class T> inline T* add_compaction_delta(T* p);
+
+public:
+  G1AdjustAndRebuildClosure(uint worker_id);
+
+  void update_compaction_delta(oop obj);
+
+  template <class T> inline void add_reference(T* from_field, oop reference, uint worker_id);
+  template <class T> void do_oop_nv(T* p);
+  virtual void do_oop(oop* p);
+  virtual void do_oop(narrowOop* p);
+
+  virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
+};
+
+class G1AdjustObjectClosure {
+  G1AdjustAndRebuildClosure* _closure;
+
+public:
+  G1AdjustObjectClosure(G1AdjustAndRebuildClosure* cl) : _closure(cl) { }
+
+  inline int adjust_object(oop obj);
+};
+
+class G1VerifyOopClosure: public OopClosure {
+private:
+  G1CollectedHeap* _g1h;
+  bool             _failures;
+  oop              _containing_obj;
+  VerifyOption     _verify_option;
+
+public:
+  int _cc;
+  G1VerifyOopClosure(VerifyOption option);
+
+  void set_containing_obj(oop obj) {
+    _containing_obj = obj;
+  }
+
+  bool failures() { return _failures; }
+  void print_object(outputStream* out, oop obj);
+
+  template <class T> void do_oop_nv(T* p);
+
+  void do_oop(oop* p)       { do_oop_nv(p); }
+  void do_oop(narrowOop* p) { do_oop_nv(p); }
+};
+
+class G1FollowStackClosure: public VoidClosure {
+  G1FullGCMarker* _marker;
+
+public:
+  G1FollowStackClosure(G1FullGCMarker* marker) : _marker(marker) {}
+  virtual void do_void();
+};
+
+#endif // SHARE_GC_G1_G1FULLGCOOPCLOSURES_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+#ifndef SHARE_VM_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP
+#define SHARE_VM_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP
+
+#include "gc/g1/g1Allocator.hpp"
+#include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
+#include "gc/g1/g1FullGCMarker.inline.hpp"
+#include "gc/g1/g1FullGCOopClosures.hpp"
+#include "gc/g1/heapRegionRemSet.hpp"
+#include "memory/iterator.inline.hpp"
+
+template <typename T>
+inline void G1MarkAndPushClosure::do_oop_nv(T* p) {
+  _marker->mark_and_push(p);
+}
+
+inline bool G1MarkAndPushClosure::do_metadata_nv() {
+  return true;
+}
+
+inline void G1MarkAndPushClosure::do_klass_nv(Klass* k) {
+  _marker->follow_klass(k);
+}
+
+inline void G1MarkAndPushClosure::do_cld_nv(ClassLoaderData* cld) {
+  _marker->follow_cld(cld);
+}
+
+template <class T> inline oop G1AdjustClosure::adjust_pointer(T* p) {
+  T heap_oop = oopDesc::load_heap_oop(p);
+  if (oopDesc::is_null(heap_oop)) {
+    // NULL reference, return NULL.
+    return NULL;
+  }
+
+  oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
+  assert(Universe::heap()->is_in(obj), "should be in heap");
+  if (G1ArchiveAllocator::is_archive_object(obj)) {
+    // Never forwarding archive objects, return current reference.
+    return obj;
+  }
+
+  oop forwardee = obj->forwardee();
+  if (forwardee == NULL) {
+    // Not forwarded, return current reference.
+    assert(obj->mark() == markOopDesc::prototype_for_object(obj) || // Correct mark
+           obj->mark()->must_be_preserved(obj) || // Will be restored by PreservedMarksSet
+           (UseBiasedLocking && obj->has_bias_pattern()), // Will be restored by BiasedLocking
+           "Must have correct prototype or be preserved, obj: " PTR_FORMAT ", mark: " PTR_FORMAT ", prototype: " PTR_FORMAT,
+           p2i(obj), p2i(obj->mark()), p2i(markOopDesc::prototype_for_object(obj)));
+    return obj;
+  }
+
+  // Forwarded, update and return new reference.
+  assert(Universe::heap()->is_in_reserved(forwardee), "should be in object space");
+  oopDesc::encode_store_heap_oop_not_null(p, forwardee);
+  return forwardee;
+}
+
+template <class T>
+inline void G1AdjustAndRebuildClosure::add_reference(T* from_field, oop reference, uint worker_id) {
+  if (HeapRegion::is_in_same_region(from_field, reference)) {
+    return;
+  }
+  _g1h->heap_region_containing(reference)->rem_set()->add_reference(from_field, worker_id);
+}
+
+inline size_t G1AdjustAndRebuildClosure::calculate_compaction_delta(oop current, oop forwardee) {
+  return pointer_delta((HeapWord*)forwardee, (HeapWord*)current);
+}
+
+template <class T>
+inline T* G1AdjustAndRebuildClosure::add_compaction_delta(T* p) {
+  return (T*)((HeapWord*)p + _compaction_delta);
+}
+
+template<typename T>
+void G1AdjustAndRebuildClosure::do_oop_nv(T* p) {
+  oop new_reference = G1AdjustClosure::adjust_pointer(p);
+  if (new_reference == NULL) {
+    return;
+  }
+
+  // Update p using the calculated compaction delta to
+  // get the new field address.
+  T* new_field = add_compaction_delta(p);
+  // Update the remembered set.
+  add_reference(new_field, new_reference, _worker_id);
+}
+
+inline int G1AdjustObjectClosure::adjust_object(oop obj) {
+  _closure->update_compaction_delta(obj);
+  return obj->oop_iterate_size(_closure);
+}
+
+inline bool G1IsAliveClosure::do_object_b(oop p) {
+  return _bitmap->is_marked(p) || G1ArchiveAllocator::is_closed_archive_object(p);
+}
+
+template<typename T>
+inline void G1FullKeepAliveClosure::do_oop_work(T* p) {
+  _marker->mark_and_push(p);
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/g1/g1CollectedHeap.hpp"
+#include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
+#include "gc/g1/g1FullCollector.hpp"
+#include "gc/g1/g1FullGCCompactionPoint.hpp"
+#include "gc/g1/g1FullGCMarker.hpp"
+#include "gc/g1/g1FullGCOopClosures.inline.hpp"
+#include "gc/g1/g1FullGCPrepareTask.hpp"
+#include "gc/g1/g1HotCardCache.hpp"
+#include "gc/g1/heapRegion.inline.hpp"
+#include "gc/shared/gcTraceTime.inline.hpp"
+#include "gc/shared/referenceProcessor.hpp"
+#include "logging/log.hpp"
+#include "utilities/ticks.inline.hpp"
+
+bool G1FullGCPrepareTask::G1CalculatePointersClosure::doHeapRegion(HeapRegion* hr) {
+  if (hr->is_humongous()) {
+    oop obj = oop(hr->humongous_start_region()->bottom());
+    if (_bitmap->is_marked(obj)) {
+      if (hr->is_starts_humongous()) {
+        obj->forward_to(obj);
+      }
+    } else {
+      free_humongous_region(hr);
+    }
+  } else if (!hr->is_pinned()) {
+    prepare_for_compaction(hr);
+  }
+
+  // Reset data structures not valid after Full GC.
+  reset_region_metadata(hr);
+
+  return false;
+}
+
+G1FullGCPrepareTask::G1FullGCPrepareTask(G1FullCollector* collector) :
+    G1FullGCTask("G1 Prepare Compact Task", collector),
+    _hrclaimer(collector->workers()),
+    _freed_regions(false) {
+}
+
+void G1FullGCPrepareTask::set_freed_regions() {
+  if (!_freed_regions) {
+    _freed_regions = true;
+  }
+}
+
+bool G1FullGCPrepareTask::has_freed_regions() {
+  return _freed_regions;
+}
+
+void G1FullGCPrepareTask::work(uint worker_id) {
+  Ticks start = Ticks::now();
+  G1FullGCCompactionPoint* compaction_point = collector()->compaction_point(worker_id);
+  G1CalculatePointersClosure closure(collector()->mark_bitmap(), compaction_point);
+  G1CollectedHeap::heap()->heap_region_par_iterate_from_start(&closure, &_hrclaimer);
+
+  // Update humongous region sets
+  closure.update_sets();
+  compaction_point->update();
+
+  // Check if any regions was freed by this worker and store in task.
+  if (closure.freed_regions()) {
+    set_freed_regions();
+  }
+  log_task("Prepare compaction task", worker_id, start);
+}
+
+G1FullGCPrepareTask::G1CalculatePointersClosure::G1CalculatePointersClosure(G1CMBitMap* bitmap,
+                                                                            G1FullGCCompactionPoint* cp) :
+    _g1h(G1CollectedHeap::heap()),
+    _bitmap(bitmap),
+    _cp(cp),
+    _humongous_regions_removed(0) { }
+
+void G1FullGCPrepareTask::G1CalculatePointersClosure::free_humongous_region(HeapRegion* hr) {
+  FreeRegionList dummy_free_list("Dummy Free List for G1MarkSweep");
+
+  hr->set_containing_set(NULL);
+  _humongous_regions_removed++;
+
+  _g1h->free_humongous_region(hr, &dummy_free_list, false /* skip_remset */);
+  prepare_for_compaction(hr);
+  dummy_free_list.remove_all();
+}
+
+void G1FullGCPrepareTask::G1CalculatePointersClosure::reset_region_metadata(HeapRegion* hr) {
+  hr->reset_gc_time_stamp();
+  hr->rem_set()->clear();
+
+  _g1h->g1_barrier_set()->clear(MemRegion(hr->bottom(), hr->end()));
+
+  if (_g1h->g1_hot_card_cache()->use_cache()) {
+    _g1h->g1_hot_card_cache()->reset_card_counts(hr);
+  }
+}
+
+G1FullGCPrepareTask::G1PrepareCompactLiveClosure::G1PrepareCompactLiveClosure(G1FullGCCompactionPoint* cp) :
+    _cp(cp) { }
+
+size_t G1FullGCPrepareTask::G1PrepareCompactLiveClosure::apply(oop object) {
+  size_t size = object->size();
+  _cp->forward(object, size);
+  return size;
+}
+
+size_t G1FullGCPrepareTask::G1RePrepareClosure::apply(oop obj) {
+  // We only re-prepare objects forwarded within the current region, so
+  // skip objects that are already forwarded to another region.
+  oop forwarded_to = obj->forwardee();
+  if (forwarded_to != NULL && !_current->is_in(forwarded_to)) {
+    return obj->size();
+  }
+
+  // Get size and forward.
+  size_t size = obj->size();
+  _cp->forward(obj, size);
+
+  return size;
+}
+
+void G1FullGCPrepareTask::G1CalculatePointersClosure::prepare_for_compaction_work(G1FullGCCompactionPoint* cp,
+                                                                                  HeapRegion* hr) {
+  G1PrepareCompactLiveClosure prepare_compact(cp);
+  hr->set_compaction_top(hr->bottom());
+  hr->apply_to_marked_objects(_bitmap, &prepare_compact);
+}
+
+void G1FullGCPrepareTask::G1CalculatePointersClosure::prepare_for_compaction(HeapRegion* hr) {
+  if (!_cp->is_initialized()) {
+    hr->set_compaction_top(hr->bottom());
+    _cp->initialize(hr, true);
+  }
+  // Add region to the compaction queue and prepare it.
+  _cp->add(hr);
+  prepare_for_compaction_work(_cp, hr);
+}
+
+void G1FullGCPrepareTask::prepare_serial_compaction() {
+  GCTraceTime(Debug, gc, phases) debug("Phase 2: Prepare Serial Compaction", collector()->scope()->timer());
+  // At this point we know that no regions were completely freed by
+  // the parallel compaction. That means that the last region of
+  // all compaction queues still have data in them. We try to compact
+  // these regions in serial to avoid a premature OOM.
+  for (uint i = 0; i < collector()->workers(); i++) {
+    G1FullGCCompactionPoint* cp = collector()->compaction_point(i);
+    if (cp->has_regions()) {
+      collector()->serial_compaction_point()->add(cp->remove_last());
+    }
+  }
+
+  // Update the forwarding information for the regions in the serial
+  // compaction point.
+  G1FullGCCompactionPoint* cp = collector()->serial_compaction_point();
+  for (GrowableArrayIterator<HeapRegion*> it = cp->regions()->begin(); it != cp->regions()->end(); ++it) {
+    HeapRegion* current = *it;
+    if (!cp->is_initialized()) {
+      // Initialize the compaction point. Nothing more is needed for the first heap region
+      // since it is already prepared for compaction.
+      cp->initialize(current, false);
+    } else {
+      assert(!current->is_humongous(), "Should be no humongous regions in compaction queue");
+      G1RePrepareClosure re_prepare(cp, current);
+      current->set_compaction_top(current->bottom());
+      current->apply_to_marked_objects(collector()->mark_bitmap(), &re_prepare);
+    }
+  }
+  cp->update();
+}
+
+void G1FullGCPrepareTask::G1CalculatePointersClosure::update_sets() {
+  // We'll recalculate total used bytes and recreate the free list
+  // at the end of the GC, so no point in updating those values here.
+  _g1h->remove_from_old_sets(0, _humongous_regions_removed);
+}
+
+bool G1FullGCPrepareTask::G1CalculatePointersClosure::freed_regions() {
+  if (_humongous_regions_removed > 0) {
+    // Free regions from dead humongous regions.
+    return true;
+  }
+
+  if (!_cp->has_regions()) {
+    // No regions in queue, so no free ones either.
+    return false;
+  }
+
+  if (_cp->current_region() != _cp->regions()->last()) {
+    // The current region used for compaction is not the last in the
+    // queue. That means there is at least one free region in the queue.
+    return true;
+  }
+
+  // No free regions in the queue.
+  return false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+#ifndef SHARE_GC_G1_G1FULLGCPREPARETASK_HPP
+#define SHARE_GC_G1_G1FULLGCPREPARETASK_HPP
+
+#include "gc/g1/g1FullGCCompactionPoint.hpp"
+#include "gc/g1/g1FullGCScope.hpp"
+#include "gc/g1/g1FullGCTask.hpp"
+#include "gc/g1/g1RootProcessor.hpp"
+#include "gc/g1/g1StringDedup.hpp"
+#include "gc/g1/heapRegionManager.hpp"
+#include "gc/shared/referenceProcessor.hpp"
+#include "utilities/ticks.hpp"
+
+class G1CMBitMap;
+
+class G1FullGCPrepareTask : public G1FullGCTask {
+protected:
+  volatile bool     _freed_regions;
+  HeapRegionClaimer _hrclaimer;
+
+  void set_freed_regions();
+
+public:
+  G1FullGCPrepareTask(G1FullCollector* collector);
+  void work(uint worker_id);
+  void prepare_serial_compaction();
+  bool has_freed_regions();
+
+protected:
+  class G1CalculatePointersClosure : public HeapRegionClosure {
+  protected:
+    G1CollectedHeap* _g1h;
+    G1CMBitMap* _bitmap;
+    G1FullGCCompactionPoint* _cp;
+    uint _humongous_regions_removed;
+
+    virtual void prepare_for_compaction(HeapRegion* hr);
+    void prepare_for_compaction_work(G1FullGCCompactionPoint* cp, HeapRegion* hr);
+    void free_humongous_region(HeapRegion* hr);
+    void reset_region_metadata(HeapRegion* hr);
+
+  public:
+    G1CalculatePointersClosure(G1CMBitMap* bitmap,
+                               G1FullGCCompactionPoint* cp);
+
+    void update_sets();
+    bool doHeapRegion(HeapRegion* hr);
+    bool freed_regions();
+  };
+
+  class G1PrepareCompactLiveClosure : public StackObj {
+    G1FullGCCompactionPoint* _cp;
+
+  public:
+    G1PrepareCompactLiveClosure(G1FullGCCompactionPoint* cp);
+    size_t apply(oop object);
+  };
+
+  class G1RePrepareClosure : public StackObj {
+    G1FullGCCompactionPoint* _cp;
+    HeapRegion* _current;
+
+  public:
+    G1RePrepareClosure(G1FullGCCompactionPoint* hrcp,
+                       HeapRegion* hr) :
+        _cp(hrcp),
+        _current(hr) { }
+
+    size_t apply(oop object);
+  };
+};
+
+#endif // SHARE_GC_G1_G1FULLGCPREPARETASK_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCReferenceProcessorExecutor.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/g1/g1CollectedHeap.hpp"
+#include "gc/g1/g1FullCollector.hpp"
+#include "gc/g1/g1FullGCMarker.hpp"
+#include "gc/g1/g1FullGCOopClosures.inline.hpp"
+#include "gc/g1/g1FullGCReferenceProcessorExecutor.hpp"
+#include "gc/shared/gcTraceTime.inline.hpp"
+#include "gc/shared/referenceProcessor.hpp"
+
+G1FullGCReferenceProcessingExecutor::G1FullGCReferenceProcessingExecutor(G1FullCollector* collector) :
+    _collector(collector),
+    _reference_processor(collector->reference_processor()),
+    _old_mt_degree(_reference_processor->num_q()) {
+  if (_reference_processor->processing_is_mt()) {
+    _reference_processor->set_active_mt_degree(_collector->workers());
+  }
+}
+
+G1FullGCReferenceProcessingExecutor::~G1FullGCReferenceProcessingExecutor() {
+  if (_reference_processor->processing_is_mt()) {
+    _reference_processor->set_active_mt_degree(_old_mt_degree);
+  }
+}
+
+G1FullGCReferenceProcessingExecutor::G1RefProcTaskProxy::G1RefProcTaskProxy(ProcessTask& proc_task,
+                                                                      G1FullCollector* collector) :
+     AbstractGangTask("G1 reference processing task"),
+     _proc_task(proc_task),
+     _collector(collector),
+     _terminator(_collector->workers(), _collector->oop_queue_set()) { }
+
+void G1FullGCReferenceProcessingExecutor::G1RefProcTaskProxy::work(uint worker_id) {
+  G1FullGCMarker* marker = _collector->marker(worker_id);
+  G1IsAliveClosure is_alive(_collector->mark_bitmap());
+  G1FullKeepAliveClosure keep_alive(marker);
+  _proc_task.work(worker_id,
+                  is_alive,
+                  keep_alive,
+                  *marker->stack_closure());
+}
+
+G1FullGCReferenceProcessingExecutor::G1RefEnqueueTaskProxy::G1RefEnqueueTaskProxy(EnqueueTask& enq_task) :
+  AbstractGangTask("G1 reference enqueue task"),
+  _enq_task(enq_task) { }
+
+void G1FullGCReferenceProcessingExecutor::G1RefEnqueueTaskProxy::work(uint worker_id) {
+  _enq_task.work(worker_id);
+}
+
+void G1FullGCReferenceProcessingExecutor::run_task(AbstractGangTask* task) {
+  G1CollectedHeap::heap()->workers()->run_task(task, _collector->workers());
+}
+
+void G1FullGCReferenceProcessingExecutor::execute(ProcessTask& proc_task) {
+  G1RefProcTaskProxy proc_task_proxy(proc_task, _collector);
+  run_task(&proc_task_proxy);
+}
+
+// Driver routine for parallel reference processing.
+void G1FullGCReferenceProcessingExecutor::execute(EnqueueTask& enq_task) {
+  G1RefEnqueueTaskProxy enq_task_proxy(enq_task);
+  run_task(&enq_task_proxy);
+}
+
+void G1FullGCReferenceProcessingExecutor::execute(STWGCTimer* timer, G1FullGCTracer* tracer) {
+  GCTraceTime(Debug, gc, phases) debug("Phase 1: Reference Processing", timer);
+  // Process reference objects found during marking.
+  G1FullGCMarker* marker = _collector->marker(0);
+  G1IsAliveClosure is_alive(_collector->mark_bitmap());
+  G1FullKeepAliveClosure keep_alive(marker);
+  ReferenceProcessorPhaseTimes pt(timer, _reference_processor->num_q());
+  AbstractRefProcTaskExecutor* executor = _reference_processor->processing_is_mt() ? this : NULL;
+
+  // Process discovered references, use this executor if multi-threaded
+  // processing is enabled.
+  const ReferenceProcessorStats& stats =
+      _reference_processor->process_discovered_references(&is_alive,
+                                                          &keep_alive,
+                                                          marker->stack_closure(),
+                                                          executor,
+                                                          &pt);
+
+  tracer->report_gc_reference_stats(stats);
+  pt.print_all_references();
+
+  assert(marker->oop_stack()->is_empty(), "Should be no oops on the stack");
+
+  // Now enqueue the references.
+  _reference_processor->enqueue_discovered_references(executor, &pt);
+  pt.print_enqueue_phase();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCReferenceProcessorExecutor.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+#ifndef SHARE_GC_G1_G1FULLGCREFERENCEPROCESSOREXECUTOR_HPP
+#define SHARE_GC_G1_G1FULLGCREFERENCEPROCESSOREXECUTOR_HPP
+
+#include "gc/g1/g1FullGCCompactionPoint.hpp"
+#include "gc/g1/g1FullGCScope.hpp"
+#include "gc/g1/g1FullGCTask.hpp"
+#include "gc/g1/g1RootProcessor.hpp"
+#include "gc/g1/g1StringDedup.hpp"
+#include "gc/g1/heapRegionManager.hpp"
+#include "gc/shared/referenceProcessor.hpp"
+#include "utilities/ticks.hpp"
+
+class G1FullGCTracer;
+class STWGCTimer;
+
+class G1FullGCReferenceProcessingExecutor: public AbstractRefProcTaskExecutor {
+  G1FullCollector*    _collector;
+  ReferenceProcessor* _reference_processor;
+  uint                _old_mt_degree;
+
+public:
+  G1FullGCReferenceProcessingExecutor(G1FullCollector* collector);
+  ~G1FullGCReferenceProcessingExecutor();
+
+  // Do reference processing.
+  void execute(STWGCTimer* timer, G1FullGCTracer* tracer);
+
+  // Executes the given task using concurrent marking worker threads.
+  virtual void execute(ProcessTask& task);
+  virtual void execute(EnqueueTask& task);
+
+private:
+  void run_task(AbstractGangTask* task);
+
+  class G1RefProcTaskProxy : public AbstractGangTask {
+    typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask;
+    ProcessTask&             _proc_task;
+    G1FullCollector*         _collector;
+    ParallelTaskTerminator   _terminator;
+
+  public:
+    G1RefProcTaskProxy(ProcessTask& proc_task,
+                       G1FullCollector* scope);
+
+    virtual void work(uint worker_id);
+  };
+
+  class G1RefEnqueueTaskProxy: public AbstractGangTask {
+    typedef AbstractRefProcTaskExecutor::EnqueueTask EnqueueTask;
+    EnqueueTask& _enq_task;
+
+  public:
+    G1RefEnqueueTaskProxy(EnqueueTask& enq_task);
+    virtual void work(uint worker_id);
+  };
+};
+
+#endif // SHARE_GC_G1_G1FULLGCREFERENCEPROCESSOREXECUTOR_HPP
--- a/src/hotspot/share/gc/g1/g1FullGCScope.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1FullGCScope.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -25,13 +25,6 @@
 #include "precompiled.hpp"
 #include "gc/g1/g1FullGCScope.hpp"
 
-G1FullGCScope* G1FullGCScope::_instance = NULL;
-
-G1FullGCScope* G1FullGCScope::instance() {
-  assert(_instance != NULL, "Must be setup already");
-  return _instance;
-}
-
 G1FullGCScope::G1FullGCScope(bool explicit_gc, bool clear_soft) :
     _rm(),
     _explicit_gc(explicit_gc),
@@ -46,12 +39,10 @@
     _memory_stats(true, _g1h->gc_cause()),
     _collector_stats(_g1h->g1mm()->full_collection_counters()),
     _heap_transition(_g1h) {
-  assert(_instance == NULL, "Only one scope at a time");
   _timer.register_gc_start();
   _tracer.report_gc_start(_g1h->gc_cause(), _timer.gc_start());
   _g1h->pre_full_gc_dump(&_timer);
   _g1h->trace_heap_before_gc(&_tracer);
-  _instance = this;
 }
 
 G1FullGCScope::~G1FullGCScope() {
@@ -64,7 +55,6 @@
   _g1h->post_full_gc_dump(&_timer);
   _timer.register_gc_end();
   _tracer.report_gc_end(_timer.gc_end(), _timer.time_partitions());
-  _instance = NULL;
 }
 
 bool G1FullGCScope::is_explicit_gc() {
@@ -79,7 +69,7 @@
   return &_timer;
 }
 
-SerialOldTracer* G1FullGCScope::tracer() {
+G1FullGCTracer* G1FullGCScope::tracer() {
   return &_tracer;
 }
 
--- a/src/hotspot/share/gc/g1/g1FullGCScope.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1FullGCScope.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -45,7 +45,7 @@
   GCIdMark                _gc_id;
   SvcGCMarker             _svc_marker;
   STWGCTimer              _timer;
-  SerialOldTracer         _tracer;
+  G1FullGCTracer          _tracer;
   IsGCActiveMark          _active;
   GCTraceCPUTime          _cpu_time;
   ClearedAllSoftRefs      _soft_refs;
@@ -53,11 +53,7 @@
   TraceMemoryManagerStats _memory_stats;
   G1HeapTransition        _heap_transition;
 
-  // Singleton instance.
-  static G1FullGCScope* _instance;
 public:
-  static G1FullGCScope* instance();
-
   G1FullGCScope(bool explicit_gc, bool clear_soft);
   ~G1FullGCScope();
 
@@ -65,7 +61,7 @@
   bool should_clear_soft_refs();
 
   STWGCTimer* timer();
-  SerialOldTracer* tracer();
+  G1FullGCTracer* tracer();
   G1HeapTransition* heap_transition();
 };
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCTask.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/g1/g1FullGCTask.hpp"
+#include "logging/log.hpp"
+#include "utilities/ticks.inline.hpp"
+
+void G1FullGCTask::log_task(const char* name, uint worker_id, const Ticks& start, const Ticks& stop) {
+  Tickspan duration = stop - start;
+  double duration_ms = TimeHelper::counter_to_millis(duration.value());
+  log_trace(gc, phases)("%s (%u) %.3fms", name, worker_id, duration_ms);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1FullGCTask.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+#ifndef SHARE_GC_G1_G1FULLGCTASK_HPP
+#define SHARE_GC_G1_G1FULLGCTASK_HPP
+
+#include "gc/shared/workgroup.hpp"
+#include "utilities/ticks.hpp"
+
+class G1FullCollector;
+
+class G1FullGCTask : public AbstractGangTask {
+  G1FullCollector* _collector;
+
+protected:
+  G1FullGCTask(const char* name, G1FullCollector* collector) :
+    AbstractGangTask(name),
+    _collector(collector) { }
+
+  G1FullCollector* collector() { return _collector; }
+  void log_task(const char* name, uint worker_id, const Ticks& start, const Ticks& stop = Ticks::now());
+};
+
+#endif // SHARE_GC_G1_G1FULLGCTASK_HPP
--- a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -48,7 +48,7 @@
 public:
   // _vo == UsePrevMarking -> use "prev" marking information,
   // _vo == UseNextMarking -> use "next" marking information,
-  // _vo == UseMarkWord    -> use mark word from object header.
+  // _vo == UseFullMarking -> use "next" marking bitmap but no TAMS
   VerifyRootsClosure(VerifyOption vo) :
     _g1h(G1CollectedHeap::heap()),
     _vo(vo),
@@ -63,9 +63,6 @@
       if (_g1h->is_obj_dead_cond(obj, _vo)) {
         Log(gc, verify) log;
         log.error("Root location " PTR_FORMAT " points to dead obj " PTR_FORMAT, p2i(p), p2i(obj));
-        if (_vo == VerifyOption_G1UseMarkWord) {
-          log.error("  Mark word: " PTR_FORMAT, p2i(obj->mark()));
-        }
         ResourceMark rm;
         LogStream ls(log.error());
         obj->print_on(&ls);
@@ -95,7 +92,7 @@
     }
 
     // Don't check the code roots during marking verification in a full GC
-    if (_vo == VerifyOption_G1UseMarkWord) {
+    if (_vo == VerifyOption_G1UseFullMarking) {
       return;
     }
 
@@ -203,7 +200,7 @@
 public:
   // _vo == UsePrevMarking -> use "prev" marking information,
   // _vo == UseNextMarking -> use "next" marking information,
-  // _vo == UseMarkWord    -> use mark word from object header.
+  // _vo == UseFullMarking -> use "next" marking bitmap but no TAMS.
   VerifyObjsInRegionClosure(HeapRegion *hr, VerifyOption vo)
     : _live_bytes(0), _hr(hr), _vo(vo) {
     _g1h = G1CollectedHeap::heap();
@@ -212,15 +209,15 @@
     VerifyLivenessOopClosure isLive(_g1h, _vo);
     assert(o != NULL, "Huh?");
     if (!_g1h->is_obj_dead_cond(o, _vo)) {
-      // If the object is alive according to the mark word,
+      // If the object is alive according to the full gc mark,
       // then verify that the marking information agrees.
       // Note we can't verify the contra-positive of the
       // above: if the object is dead (according to the mark
       // word), it may not be marked, or may have been marked
       // but has since became dead, or may have been allocated
       // since the last marking.
-      if (_vo == VerifyOption_G1UseMarkWord) {
-        guarantee(!_g1h->is_obj_dead(o), "mark word and concurrent mark mismatch");
+      if (_vo == VerifyOption_G1UseFullMarking) {
+        guarantee(!_g1h->is_obj_dead(o), "Full GC marking and concurrent mark mismatch");
       }
 
       o->oop_iterate_no_header(&isLive);
@@ -299,7 +296,7 @@
 public:
   // _vo == UsePrevMarking -> use "prev" marking information,
   // _vo == UseNextMarking -> use "next" marking information,
-  // _vo == UseMarkWord    -> use mark word from object header.
+  // _vo == UseFullMarking -> use "next" marking bitmap but no TAMS
   VerifyRegionClosure(bool par, VerifyOption vo)
     : _par(par),
       _vo(vo),
@@ -357,7 +354,7 @@
 public:
   // _vo == UsePrevMarking -> use "prev" marking information,
   // _vo == UseNextMarking -> use "next" marking information,
-  // _vo == UseMarkWord    -> use mark word from object header.
+  // _vo == UseFullMarking -> use "next" marking bitmap but no TAMS
   G1ParVerifyTask(G1CollectedHeap* g1h, VerifyOption vo) :
       AbstractGangTask("Parallel verify task"),
       _g1h(g1h),
@@ -372,7 +369,7 @@
   void work(uint worker_id) {
     HandleMark hm;
     VerifyRegionClosure blk(true, _vo);
-    _g1h->heap_region_par_iterate(&blk, worker_id, &_hrclaimer);
+    _g1h->heap_region_par_iterate_from_worker_offset(&blk, &_hrclaimer, worker_id);
     if (blk.failures()) {
       _failures = true;
     }
@@ -407,7 +404,7 @@
 
   bool failures = rootsCl.failures() || codeRootsCl.failures();
 
-  if (vo != VerifyOption_G1UseMarkWord) {
+  if (!_g1h->g1_policy()->collector_state()->full_collection()) {
     // If we're verifying during a full GC then the region sets
     // will have been torn down at the start of the GC. Therefore
     // verifying the region sets will fail. So we only verify
--- a/src/hotspot/share/gc/g1/g1HeapVerifier.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1HeapVerifier.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -46,9 +46,9 @@
 
   // Perform verification.
 
-  // vo == UsePrevMarking  -> use "prev" marking information,
+  // vo == UsePrevMarking -> use "prev" marking information,
   // vo == UseNextMarking -> use "next" marking information
-  // vo == UseMarkWord    -> use the mark word in the object header
+  // vo == UseFullMarking -> use "next" marking bitmap but no TAMS
   //
   // NOTE: Only the "prev" marking information is guaranteed to be
   // consistent most of the time, so most calls to this should use
@@ -57,7 +57,7 @@
   // vo == UseNextMarking, which is to verify the "next" marking
   // information at the end of remark.
   // Currently there is only one place where this is called with
-  // vo == UseMarkWord, which is to verify the marking during a
+  // vo == UseFullMarking, which is to verify the marking during a
   // full GC.
   void verify(VerifyOption vo);
 
--- a/src/hotspot/share/gc/g1/g1HotCardCache.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1HotCardCache.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -110,7 +110,3 @@
 void G1HotCardCache::reset_card_counts(HeapRegion* hr) {
   _card_counts.clear_region(hr);
 }
-
-void G1HotCardCache::reset_card_counts() {
-  _card_counts.clear_all();
-}
--- a/src/hotspot/share/gc/g1/g1HotCardCache.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1HotCardCache.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -128,9 +128,6 @@
     }
   }
 
-  // Zeros the values in the card counts table for entire committed heap
-  void reset_card_counts();
-
   // Zeros the values in the card counts table for the given region
   void reset_card_counts(HeapRegion* hr);
 
--- a/src/hotspot/share/gc/g1/g1MarkSweep.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,387 +0,0 @@
-/*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "classfile/javaClasses.hpp"
-#include "classfile/symbolTable.hpp"
-#include "classfile/systemDictionary.hpp"
-#include "classfile/vmSymbols.hpp"
-#include "code/codeCache.hpp"
-#include "code/icBuffer.hpp"
-#include "gc/g1/g1FullGCScope.hpp"
-#include "gc/g1/g1MarkSweep.hpp"
-#include "gc/g1/g1RootProcessor.hpp"
-#include "gc/g1/g1StringDedup.hpp"
-#include "gc/serial/markSweep.inline.hpp"
-#include "gc/shared/gcHeapSummary.hpp"
-#include "gc/shared/gcLocker.hpp"
-#include "gc/shared/gcTimer.hpp"
-#include "gc/shared/gcTrace.hpp"
-#include "gc/shared/gcTraceTime.inline.hpp"
-#include "gc/shared/genCollectedHeap.hpp"
-#include "gc/shared/modRefBarrierSet.hpp"
-#include "gc/shared/referencePolicy.hpp"
-#include "gc/shared/space.hpp"
-#include "gc/shared/weakProcessor.hpp"
-#include "oops/instanceRefKlass.hpp"
-#include "oops/oop.inline.hpp"
-#include "prims/jvmtiExport.hpp"
-#include "runtime/atomic.hpp"
-#include "runtime/biasedLocking.hpp"
-#include "runtime/synchronizer.hpp"
-#include "runtime/thread.hpp"
-#include "runtime/vmThread.hpp"
-#include "utilities/copy.hpp"
-#include "utilities/events.hpp"
-
-class HeapRegion;
-
-void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp,
-                                      bool clear_all_softrefs) {
-  assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
-  HandleMark hm;  // Discard invalid handles created during gc
-
-#if COMPILER2_OR_JVMCI
-  DerivedPointerTable::clear();
-#endif
-#ifdef ASSERT
-  if (G1CollectedHeap::heap()->collector_policy()->should_clear_all_soft_refs()) {
-    assert(clear_all_softrefs, "Policy should have been checked earler");
-  }
-#endif
-  // hook up weak ref data so it can be used during Mark-Sweep
-  assert(GenMarkSweep::ref_processor() == NULL, "no stomping");
-  assert(rp != NULL, "should be non-NULL");
-  assert(rp == G1CollectedHeap::heap()->ref_processor_stw(), "Precondition");
-
-  GenMarkSweep::set_ref_processor(rp);
-  rp->setup_policy(clear_all_softrefs);
-
-  // When collecting the permanent generation Method*s may be moving,
-  // so we either have to flush all bcp data or convert it into bci.
-  CodeCache::gc_prologue();
-
-  bool marked_for_unloading = false;
-
-  allocate_stacks();
-
-  // We should save the marks of the currently locked biased monitors.
-  // The marking doesn't preserve the marks of biased objects.
-  BiasedLocking::preserve_marks();
-
-  // Process roots and do the marking.
-  mark_sweep_phase1(marked_for_unloading, clear_all_softrefs);
-
-  // Prepare compaction.
-  mark_sweep_phase2();
-
-#if COMPILER2_OR_JVMCI
-  // Don't add any more derived pointers during phase3
-  DerivedPointerTable::set_active(false);
-#endif
-
-  // Adjust all pointers.
-  mark_sweep_phase3();
-
-  // Do the actual compaction.
-  mark_sweep_phase4();
-
-  GenMarkSweep::restore_marks();
-  BiasedLocking::restore_marks();
-  GenMarkSweep::deallocate_stacks();
-
-#if COMPILER2_OR_JVMCI
-  // Now update the derived pointers.
-  DerivedPointerTable::update_pointers();
-#endif
-
-  CodeCache::gc_epilogue();
-  JvmtiExport::gc_epilogue();
-
-  // refs processing: clean slate
-  GenMarkSweep::set_ref_processor(NULL);
-}
-
-STWGCTimer* G1MarkSweep::gc_timer() {
-  return G1FullGCScope::instance()->timer();
-}
-
-SerialOldTracer* G1MarkSweep::gc_tracer() {
-  return G1FullGCScope::instance()->tracer();
-}
-
-void G1MarkSweep::allocate_stacks() {
-  GenMarkSweep::_preserved_count_max = 0;
-  GenMarkSweep::_preserved_marks = NULL;
-  GenMarkSweep::_preserved_count = 0;
-}
-
-void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading,
-                                    bool clear_all_softrefs) {
-  // Recursively traverse all live objects and mark them
-  GCTraceTime(Info, gc, phases) tm("Phase 1: Mark live objects", gc_timer());
-
-  G1CollectedHeap* g1h = G1CollectedHeap::heap();
-
-  // Need cleared claim bits for the roots processing
-  ClassLoaderDataGraph::clear_claimed_marks();
-
-  MarkingCodeBlobClosure follow_code_closure(&GenMarkSweep::follow_root_closure, !CodeBlobToOopClosure::FixRelocations);
-  {
-    G1RootProcessor root_processor(g1h, 1);
-    if (ClassUnloading) {
-      root_processor.process_strong_roots(&GenMarkSweep::follow_root_closure,
-                                          &GenMarkSweep::follow_cld_closure,
-                                          &follow_code_closure);
-    } else {
-      root_processor.process_all_roots_no_string_table(
-                                          &GenMarkSweep::follow_root_closure,
-                                          &GenMarkSweep::follow_cld_closure,
-                                          &follow_code_closure);
-    }
-  }
-
-  {
-    GCTraceTime(Debug, gc, phases) trace("Reference Processing", gc_timer());
-
-    // Process reference objects found during marking
-    ReferenceProcessor* rp = GenMarkSweep::ref_processor();
-    assert(rp == g1h->ref_processor_stw(), "Sanity");
-
-    rp->setup_policy(clear_all_softrefs);
-    ReferenceProcessorPhaseTimes pt(gc_timer(), rp->num_q());
-
-    const ReferenceProcessorStats& stats =
-        rp->process_discovered_references(&GenMarkSweep::is_alive,
-                                          &GenMarkSweep::keep_alive,
-                                          &GenMarkSweep::follow_stack_closure,
-                                          NULL,
-                                          &pt);
-    gc_tracer()->report_gc_reference_stats(stats);
-    pt.print_all_references();
-  }
-
-  // This is the point where the entire marking should have completed.
-  assert(GenMarkSweep::_marking_stack.is_empty(), "Marking should have completed");
-
-  {
-    GCTraceTime(Debug, gc, phases) trace("Weak Processing", gc_timer());
-    WeakProcessor::weak_oops_do(&GenMarkSweep::is_alive, &do_nothing_cl);
-  }
-
-  if (ClassUnloading) {
-    GCTraceTime(Debug, gc, phases) trace("Class Unloading", gc_timer());
-
-    // Unload classes and purge the SystemDictionary.
-    bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive, gc_timer());
-
-    g1h->complete_cleaning(&GenMarkSweep::is_alive, purged_class);
-  } else {
-    GCTraceTime(Debug, gc, phases) trace("Cleanup", gc_timer());
-    g1h->partial_cleaning(&GenMarkSweep::is_alive, true, true, G1StringDedup::is_enabled());
-  }
-
-  if (VerifyDuringGC) {
-    HandleMark hm;  // handle scope
-#if COMPILER2_OR_JVMCI
-    DerivedPointerTableDeactivate dpt_deact;
-#endif
-    g1h->prepare_for_verify();
-    // Note: we can verify only the heap here. When an object is
-    // marked, the previous value of the mark word (including
-    // identity hash values, ages, etc) is preserved, and the mark
-    // word is set to markOop::marked_value - effectively removing
-    // any hash values from the mark word. These hash values are
-    // used when verifying the dictionaries and so removing them
-    // from the mark word can make verification of the dictionaries
-    // fail. At the end of the GC, the original mark word values
-    // (including hash values) are restored to the appropriate
-    // objects.
-    GCTraceTime(Info, gc, verify)("During GC (full)");
-    g1h->verify(VerifyOption_G1UseMarkWord);
-  }
-
-  gc_tracer()->report_object_count_after_gc(&GenMarkSweep::is_alive);
-}
-
-
-void G1MarkSweep::mark_sweep_phase2() {
-  // Now all live objects are marked, compute the new object addresses.
-
-  // It is not required that we traverse spaces in the same order in
-  // phase2, phase3 and phase4, but the ValidateMarkSweep live oops
-  // tracking expects us to do so. See comment under phase4.
-
-  GCTraceTime(Info, gc, phases) tm("Phase 2: Compute new object addresses", gc_timer());
-
-  prepare_compaction();
-}
-
-class G1AdjustPointersClosure: public HeapRegionClosure {
- public:
-  bool doHeapRegion(HeapRegion* r) {
-    if (r->is_humongous()) {
-      if (r->is_starts_humongous()) {
-        // We must adjust the pointers on the single H object.
-        oop obj = oop(r->bottom());
-        // point all the oops to the new location
-        MarkSweep::adjust_pointers(obj);
-      }
-    } else if (!r->is_closed_archive()) {
-      // This really ought to be "as_CompactibleSpace"...
-      r->adjust_pointers();
-    }
-    return false;
-  }
-};
-
-void G1MarkSweep::mark_sweep_phase3() {
-  G1CollectedHeap* g1h = G1CollectedHeap::heap();
-
-  // Adjust the pointers to reflect the new locations
-  GCTraceTime(Info, gc, phases) tm("Phase 3: Adjust pointers", gc_timer());
-
-  // Need cleared claim bits for the roots processing
-  ClassLoaderDataGraph::clear_claimed_marks();
-
-  CodeBlobToOopClosure adjust_code_closure(&GenMarkSweep::adjust_pointer_closure, CodeBlobToOopClosure::FixRelocations);
-  {
-    G1RootProcessor root_processor(g1h, 1);
-    root_processor.process_all_roots(&GenMarkSweep::adjust_pointer_closure,
-                                     &GenMarkSweep::adjust_cld_closure,
-                                     &adjust_code_closure);
-  }
-
-  assert(GenMarkSweep::ref_processor() == g1h->ref_processor_stw(), "Sanity");
-  g1h->ref_processor_stw()->weak_oops_do(&GenMarkSweep::adjust_pointer_closure);
-
-  // Now adjust pointers in remaining weak roots.  (All of which should
-  // have been cleared if they pointed to non-surviving objects.)
-  WeakProcessor::oops_do(&GenMarkSweep::adjust_pointer_closure);
-
-  if (G1StringDedup::is_enabled()) {
-    G1StringDedup::oops_do(&GenMarkSweep::adjust_pointer_closure);
-  }
-
-  GenMarkSweep::adjust_marks();
-
-  G1AdjustPointersClosure blk;
-  g1h->heap_region_iterate(&blk);
-}
-
-class G1SpaceCompactClosure: public HeapRegionClosure {
-public:
-  G1SpaceCompactClosure() {}
-
-  bool doHeapRegion(HeapRegion* hr) {
-    if (hr->is_humongous()) {
-      if (hr->is_starts_humongous()) {
-        oop obj = oop(hr->bottom());
-        if (obj->is_gc_marked()) {
-          obj->init_mark();
-        } else {
-          assert(hr->is_empty(), "Should have been cleared in phase 2.");
-        }
-      }
-      hr->reset_during_compaction();
-    } else if (!hr->is_pinned()) {
-      hr->compact();
-    }
-    return false;
-  }
-};
-
-void G1MarkSweep::mark_sweep_phase4() {
-  // All pointers are now adjusted, move objects accordingly
-
-  // The ValidateMarkSweep live oops tracking expects us to traverse spaces
-  // in the same order in phase2, phase3 and phase4. We don't quite do that
-  // here (code and comment not fixed for perm removal), so we tell the validate code
-  // to use a higher index (saved from phase2) when verifying perm_gen.
-  G1CollectedHeap* g1h = G1CollectedHeap::heap();
-
-  GCTraceTime(Info, gc, phases) tm("Phase 4: Move objects", gc_timer());
-
-  G1SpaceCompactClosure blk;
-  g1h->heap_region_iterate(&blk);
-
-}
-
-void G1MarkSweep::prepare_compaction_work(G1PrepareCompactClosure* blk) {
-  G1CollectedHeap* g1h = G1CollectedHeap::heap();
-  g1h->heap_region_iterate(blk);
-  blk->update_sets();
-}
-
-void G1PrepareCompactClosure::free_humongous_region(HeapRegion* hr) {
-  HeapWord* end = hr->end();
-  FreeRegionList dummy_free_list("Dummy Free List for G1MarkSweep");
-
-  hr->set_containing_set(NULL);
-  _humongous_regions_removed++;
-
-  _g1h->free_humongous_region(hr, &dummy_free_list, false /* skip_remset */);
-  prepare_for_compaction(hr, end);
-  dummy_free_list.remove_all();
-}
-
-void G1PrepareCompactClosure::prepare_for_compaction(HeapRegion* hr, HeapWord* end) {
-  // If this is the first live region that we came across which we can compact,
-  // initialize the CompactPoint.
-  if (!is_cp_initialized()) {
-    _cp.space = hr;
-    _cp.threshold = hr->initialize_threshold();
-  }
-  prepare_for_compaction_work(&_cp, hr, end);
-}
-
-void G1PrepareCompactClosure::prepare_for_compaction_work(CompactPoint* cp,
-                                                          HeapRegion* hr,
-                                                          HeapWord* end) {
-  hr->prepare_for_compaction(cp);
-  // Also clear the part of the card table that will be unused after
-  // compaction.
-  _mrbs->clear(MemRegion(hr->compaction_top(), end));
-}
-
-void G1PrepareCompactClosure::update_sets() {
-  // We'll recalculate total used bytes and recreate the free list
-  // at the end of the GC, so no point in updating those values here.
-  _g1h->remove_from_old_sets(0, _humongous_regions_removed);
-}
-
-bool G1PrepareCompactClosure::doHeapRegion(HeapRegion* hr) {
-  if (hr->is_humongous()) {
-    oop obj = oop(hr->humongous_start_region()->bottom());
-    if (hr->is_starts_humongous() && obj->is_gc_marked()) {
-      obj->forward_to(obj);
-    }
-    if (!obj->is_gc_marked()) {
-      free_humongous_region(hr);
-    }
-  } else if (!hr->is_pinned()) {
-    prepare_for_compaction(hr, hr->end());
-  }
-  return false;
-}
--- a/src/hotspot/share/gc/g1/g1MarkSweep.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2001, 2017, 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.
- *
- */
-
-#ifndef SHARE_VM_GC_G1_G1MARKSWEEP_HPP
-#define SHARE_VM_GC_G1_G1MARKSWEEP_HPP
-
-#include "gc/g1/g1CollectedHeap.hpp"
-#include "gc/g1/heapRegion.hpp"
-#include "gc/serial/genMarkSweep.hpp"
-#include "gc/shared/generation.hpp"
-#include "memory/universe.hpp"
-#include "oops/markOop.hpp"
-#include "oops/oop.hpp"
-#include "runtime/timer.hpp"
-#include "utilities/growableArray.hpp"
-
-class ReferenceProcessor;
-
-// G1MarkSweep takes care of global mark-compact garbage collection for a
-// G1CollectedHeap using a four-phase pointer forwarding algorithm.  All
-// generations are assumed to support marking; those that can also support
-// compaction.
-//
-// Class unloading will only occur when a full gc is invoked.
-class G1PrepareCompactClosure;
-class G1ArchiveRegionMap;
-
-class G1MarkSweep : AllStatic {
- public:
-
-  static void invoke_at_safepoint(ReferenceProcessor* rp,
-                                  bool clear_all_softrefs);
-
-  static STWGCTimer* gc_timer();
-  static SerialOldTracer* gc_tracer();
-
-private:
-  // Mark live objects
-  static void mark_sweep_phase1(bool& marked_for_deopt,
-                                bool clear_all_softrefs);
-  // Calculate new addresses
-  static void mark_sweep_phase2();
-  // Update pointers
-  static void mark_sweep_phase3();
-  // Move objects to new positions
-  static void mark_sweep_phase4();
-
-  static void allocate_stacks();
-  static void prepare_compaction();
-  static void prepare_compaction_work(G1PrepareCompactClosure* blk);
-};
-
-class G1PrepareCompactClosure : public HeapRegionClosure {
- protected:
-  G1CollectedHeap* _g1h;
-  ModRefBarrierSet* _mrbs;
-  CompactPoint _cp;
-  uint _humongous_regions_removed;
-
-  virtual void prepare_for_compaction(HeapRegion* hr, HeapWord* end);
-  void prepare_for_compaction_work(CompactPoint* cp, HeapRegion* hr, HeapWord* end);
-  void free_humongous_region(HeapRegion* hr);
-  bool is_cp_initialized() const { return _cp.space != NULL; }
-
- public:
-  G1PrepareCompactClosure() :
-    _g1h(G1CollectedHeap::heap()),
-    _mrbs(_g1h->g1_barrier_set()),
-    _humongous_regions_removed(0) { }
-
-  void update_sets();
-  bool doHeapRegion(HeapRegion* hr);
-};
-
-#endif // SHARE_VM_GC_G1_G1MARKSWEEP_HPP
--- a/src/hotspot/share/gc/g1/g1MarkSweep_ext.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "gc/g1/g1MarkSweep.hpp"
-
-void G1MarkSweep::prepare_compaction() {
-  G1PrepareCompactClosure blk;
-  G1MarkSweep::prepare_compaction_work(&blk);
-}
--- a/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -30,7 +30,6 @@
 #include "gc/g1/g1OopClosures.hpp"
 #include "gc/g1/g1ParScanThreadState.inline.hpp"
 #include "gc/g1/g1RemSet.hpp"
-#include "gc/g1/g1RemSet.inline.hpp"
 #include "gc/g1/heapRegion.inline.hpp"
 #include "gc/g1/heapRegionRemSet.hpp"
 #include "memory/iterator.inline.hpp"
--- a/src/hotspot/share/gc/g1/g1ParScanThreadState.inline.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.inline.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -26,7 +26,7 @@
 #define SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP
 
 #include "gc/g1/g1ParScanThreadState.hpp"
-#include "gc/g1/g1RemSet.inline.hpp"
+#include "gc/g1/g1RemSet.hpp"
 #include "oops/oop.inline.hpp"
 
 template <class T> void G1ParScanThreadState::do_oop_evac(T* p, HeapRegion* from) {
--- a/src/hotspot/share/gc/g1/g1RemSet.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1RemSet.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -31,7 +31,7 @@
 #include "gc/g1/g1GCPhaseTimes.hpp"
 #include "gc/g1/g1HotCardCache.hpp"
 #include "gc/g1/g1OopClosures.inline.hpp"
-#include "gc/g1/g1RemSet.inline.hpp"
+#include "gc/g1/g1RemSet.hpp"
 #include "gc/g1/g1SATBCardTableModRefBS.inline.hpp"
 #include "gc/g1/heapRegion.inline.hpp"
 #include "gc/g1/heapRegionManager.inline.hpp"
@@ -532,7 +532,7 @@
 
 void G1RemSet::scrub(uint worker_num, HeapRegionClaimer *hrclaimer) {
   G1ScrubRSClosure scrub_cl(&_card_live_data);
-  _g1->heap_region_par_iterate(&scrub_cl, worker_num, hrclaimer);
+  _g1->heap_region_par_iterate_from_worker_offset(&scrub_cl, hrclaimer, worker_num);
 }
 
 inline void check_card_ptr(jbyte* card_ptr, CardTableModRefBS* ct_bs) {
--- a/src/hotspot/share/gc/g1/g1RemSet.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1RemSet.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -114,10 +114,6 @@
 
   G1RemSetScanState* scan_state() const { return _scan_state; }
 
-  // Record, if necessary, the fact that *p (where "p" is in region "from",
-  // which is required to be non-NULL) has changed to a new non-NULL value.
-  template <class T> void par_write_ref(HeapRegion* from, T* p, uint tid);
-
   // Eliminates any remembered set entries that correspond to dead heap ranges.
   void scrub(uint worker_num, HeapRegionClaimer* hrclaimer);
 
@@ -191,25 +187,4 @@
   size_t cards_skipped() const { return _cards_skipped; }
 };
 
-class RebuildRSOopClosure: public ExtendedOopClosure {
-  HeapRegion* _from;
-  G1RemSet* _rs;
-  uint _worker_i;
-
-  template <class T> void do_oop_work(T* p);
-
-public:
-  RebuildRSOopClosure(G1RemSet* rs, uint worker_i = 0) :
-    _from(NULL), _rs(rs), _worker_i(worker_i)
-  {}
-
-  void set_from(HeapRegion* from) {
-    assert(from != NULL, "from region must be non-NULL");
-    _from = from;
-  }
-
-  virtual void do_oop(narrowOop* p) { do_oop_work(p); }
-  virtual void do_oop(oop* p)       { do_oop_work(p); }
-};
-
 #endif // SHARE_VM_GC_G1_G1REMSET_HPP
--- a/src/hotspot/share/gc/g1/g1RemSet.inline.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2001, 2017, 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.
- *
- */
-
-#ifndef SHARE_VM_GC_G1_G1REMSET_INLINE_HPP
-#define SHARE_VM_GC_G1_G1REMSET_INLINE_HPP
-
-#include "gc/g1/g1RemSet.hpp"
-#include "gc/g1/heapRegion.hpp"
-#include "gc/g1/heapRegionRemSet.hpp"
-#include "oops/oop.inline.hpp"
-
-template <class T>
-inline void G1RemSet::par_write_ref(HeapRegion* from, T* p, uint tid) {
-  oop obj = oopDesc::load_decode_heap_oop(p);
-  if (obj == NULL) {
-    return;
-  }
-
-#ifdef ASSERT
-  // can't do because of races
-  // assert(oopDesc::is_oop_or_null(obj), "expected an oop");
-  assert(check_obj_alignment(obj), "not oop aligned");
-  assert(_g1->is_in_reserved(obj), "must be in heap");
-#endif // ASSERT
-
-  assert(from->is_in_reserved(p) || from->is_starts_humongous(), "p is not in from");
-
-  HeapRegion* to = _g1->heap_region_containing(obj);
-  if (from != to) {
-    assert(to->rem_set() != NULL, "Need per-region 'into' remsets.");
-    to->rem_set()->add_reference(p, tid);
-  }
-}
-
-template <class T>
-inline void RebuildRSOopClosure::do_oop_work(T* p) {
-  assert(_from != NULL, "from region must be non-NULL");
-  _rs->par_write_ref(_from, p, _worker_i);
-}
-
-#endif // SHARE_VM_GC_G1_G1REMSET_INLINE_HPP
--- a/src/hotspot/share/gc/g1/g1RemSetSummary.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1RemSetSummary.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -26,7 +26,7 @@
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/g1/g1ConcurrentRefine.hpp"
 #include "gc/g1/g1ConcurrentRefineThread.hpp"
-#include "gc/g1/g1RemSet.inline.hpp"
+#include "gc/g1/g1RemSet.hpp"
 #include "gc/g1/g1RemSetSummary.hpp"
 #include "gc/g1/g1YoungRemSetSamplingThread.hpp"
 #include "gc/g1/heapRegion.hpp"
--- a/src/hotspot/share/gc/g1/g1RootProcessor.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1RootProcessor.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -37,6 +37,7 @@
 #include "gc/g1/g1RootClosures.hpp"
 #include "gc/g1/g1RootProcessor.hpp"
 #include "gc/g1/heapRegion.inline.hpp"
+#include "gc/shared/weakProcessor.hpp"
 #include "memory/allocation.inline.hpp"
 #include "runtime/mutex.hpp"
 #include "services/management.hpp"
@@ -319,6 +320,16 @@
   }
 }
 
+void G1RootProcessor::process_full_gc_weak_roots(OopClosure* oops) {
+  if (!_process_strong_tasks.is_task_claimed(G1RP_PS_refProcessor_oops_do)) {
+    _g1h->ref_processor_stw()->weak_oops_do(oops);
+  }
+
+  if (!_process_strong_tasks.is_task_claimed(G1RP_PS_weakProcessor_oops_do)) {
+    WeakProcessor::oops_do(oops);
+  }
+}
+
 uint G1RootProcessor::n_workers() const {
   return _srs.n_threads();
 }
--- a/src/hotspot/share/gc/g1/g1RootProcessor.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1RootProcessor.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -65,6 +65,7 @@
     G1RP_PS_aot_oops_do,
     G1RP_PS_filter_satb_buffers,
     G1RP_PS_refProcessor_oops_do,
+    G1RP_PS_weakProcessor_oops_do,
     // Leave this one last.
     G1RP_PS_NumElements
   };
@@ -118,6 +119,10 @@
                                          CLDClosure* clds,
                                          CodeBlobClosure* blobs);
 
+  // Apply closure to weak roots in the system. Used during the adjust phase
+  // for the Full GC.
+  void process_full_gc_weak_roots(OopClosure* oops);
+
   // Number of worker threads used by the root processor.
   uint n_workers() const;
 };
--- a/src/hotspot/share/gc/g1/g1SerialFullCollector.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "gc/g1/g1CollectedHeap.inline.hpp"
-#include "gc/g1/g1FullGCScope.hpp"
-#include "gc/g1/g1MarkSweep.hpp"
-#include "gc/g1/g1RemSet.inline.hpp"
-#include "gc/g1/g1SerialFullCollector.hpp"
-#include "gc/g1/heapRegionRemSet.hpp"
-#include "gc/shared/referenceProcessor.hpp"
-
-G1SerialFullCollector::G1SerialFullCollector(G1FullGCScope* scope,
-                                             ReferenceProcessor* reference_processor) :
-    _scope(scope),
-    _reference_processor(reference_processor),
-    _is_alive_mutator(_reference_processor, NULL),
-    _mt_discovery_mutator(_reference_processor, false) {
-  // Temporarily make discovery by the STW ref processor single threaded (non-MT)
-  // and clear the STW ref processor's _is_alive_non_header field.
-}
-
-void G1SerialFullCollector::prepare_collection() {
-  _reference_processor->enable_discovery();
-  _reference_processor->setup_policy(_scope->should_clear_soft_refs());
-}
-
-void G1SerialFullCollector::complete_collection() {
-  // Enqueue any discovered reference objects that have
-  // not been removed from the discovered lists.
-  ReferenceProcessorPhaseTimes pt(NULL, _reference_processor->num_q());
-  _reference_processor->enqueue_discovered_references(NULL, &pt);
-  pt.print_enqueue_phase();
-
-  // Iterate the heap and rebuild the remembered sets.
-  rebuild_remembered_sets();
-}
-
-void G1SerialFullCollector::collect() {
-  // Do the actual collection work.
-  G1MarkSweep::invoke_at_safepoint(_reference_processor, _scope->should_clear_soft_refs());
-}
-
-class PostMCRemSetClearClosure: public HeapRegionClosure {
-  G1CollectedHeap* _g1h;
-  ModRefBarrierSet* _mr_bs;
-public:
-  PostMCRemSetClearClosure(G1CollectedHeap* g1h, ModRefBarrierSet* mr_bs) :
-    _g1h(g1h), _mr_bs(mr_bs) {}
-
-  bool doHeapRegion(HeapRegion* r) {
-    HeapRegionRemSet* hrrs = r->rem_set();
-
-    _g1h->reset_gc_time_stamps(r);
-
-    if (r->is_continues_humongous()) {
-      // We'll assert that the strong code root list and RSet is empty
-      assert(hrrs->strong_code_roots_list_length() == 0, "sanity");
-      assert(hrrs->occupied() == 0, "RSet should be empty");
-    } else {
-      hrrs->clear();
-    }
-    // You might think here that we could clear just the cards
-    // corresponding to the used region.  But no: if we leave a dirty card
-    // in a region we might allocate into, then it would prevent that card
-    // from being enqueued, and cause it to be missed.
-    // Re: the performance cost: we shouldn't be doing full GC anyway!
-    _mr_bs->clear(MemRegion(r->bottom(), r->end()));
-
-    return false;
-  }
-};
-
-
-class RebuildRSOutOfRegionClosure: public HeapRegionClosure {
-  G1CollectedHeap*   _g1h;
-  RebuildRSOopClosure _cl;
-public:
-  RebuildRSOutOfRegionClosure(G1CollectedHeap* g1, uint worker_i = 0) :
-    _cl(g1->g1_rem_set(), worker_i),
-    _g1h(g1)
-  { }
-
-  bool doHeapRegion(HeapRegion* r) {
-    if (!r->is_continues_humongous()) {
-      _cl.set_from(r);
-      r->oop_iterate(&_cl);
-    }
-    return false;
-  }
-};
-
-class ParRebuildRSTask: public AbstractGangTask {
-  G1CollectedHeap* _g1;
-  HeapRegionClaimer _hrclaimer;
-
-public:
-  ParRebuildRSTask(G1CollectedHeap* g1) :
-      AbstractGangTask("ParRebuildRSTask"), _g1(g1), _hrclaimer(g1->workers()->active_workers()) {}
-
-  void work(uint worker_id) {
-    RebuildRSOutOfRegionClosure rebuild_rs(_g1, worker_id);
-    _g1->heap_region_par_iterate(&rebuild_rs, worker_id, &_hrclaimer);
-  }
-};
-
-void G1SerialFullCollector::rebuild_remembered_sets() {
-  G1CollectedHeap* g1h = G1CollectedHeap::heap();
-  // First clear the stale remembered sets.
-  PostMCRemSetClearClosure rs_clear(g1h, g1h->g1_barrier_set());
-  g1h->heap_region_iterate(&rs_clear);
-
-  // Rebuild remembered sets of all regions.
-  uint n_workers = AdaptiveSizePolicy::calc_active_workers(g1h->workers()->total_workers(),
-                                                           g1h->workers()->active_workers(),
-                                                           Threads::number_of_non_daemon_threads());
-  g1h->workers()->update_active_workers(n_workers);
-  log_info(gc,task)("Using %u workers of %u to rebuild remembered set", n_workers, g1h->workers()->total_workers());
-
-  ParRebuildRSTask rebuild_rs_task(g1h);
-  g1h->workers()->run_task(&rebuild_rs_task);
-}
--- a/src/hotspot/share/gc/g1/g1SerialFullCollector.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2017, 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.
- *
- */
-
-#ifndef SHARE_VM_GC_G1_G1SERIALCOLLECTOR_HPP
-#define SHARE_VM_GC_G1_G1SERIALCOLLECTOR_HPP
-
-#include "memory/allocation.hpp"
-
-class G1FullGCScope;
-class ReferenceProcessor;
-
-class G1SerialFullCollector : StackObj {
-  G1FullGCScope*                       _scope;
-  ReferenceProcessor*                  _reference_processor;
-  ReferenceProcessorIsAliveMutator     _is_alive_mutator;
-  ReferenceProcessorMTDiscoveryMutator _mt_discovery_mutator;
-
-  void rebuild_remembered_sets();
-
-public:
-  G1SerialFullCollector(G1FullGCScope* scope, ReferenceProcessor* reference_processor);
-
-  void prepare_collection();
-  void collect();
-  void complete_collection();
-};
-
-#endif // SHARE_VM_GC_G1_G1SERIALCOLLECTOR_HPP
--- a/src/hotspot/share/gc/g1/g1StringDedup.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1StringDedup.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -65,10 +65,10 @@
   return false;
 }
 
-void G1StringDedup::enqueue_from_mark(oop java_string) {
+void G1StringDedup::enqueue_from_mark(oop java_string, uint worker_id) {
   assert(is_enabled(), "String deduplication not enabled");
   if (is_candidate_from_mark(java_string)) {
-    G1StringDedupQueue::push(0 /* worker_id */, java_string);
+    G1StringDedupQueue::push(worker_id, java_string);
   }
 }
 
--- a/src/hotspot/share/gc/g1/g1StringDedup.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1StringDedup.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -125,7 +125,7 @@
   // Enqueues a deduplication candidate for later processing by the deduplication
   // thread. Before enqueuing, these functions apply the appropriate candidate
   // selection policy to filters out non-candidates.
-  static void enqueue_from_mark(oop java_string);
+  static void enqueue_from_mark(oop java_string, uint worker_id);
   static void enqueue_from_evacuation(bool from_young, bool to_young,
                                       unsigned int queue, oop java_string);
 
--- a/src/hotspot/share/gc/g1/g1_specialized_oop_closures.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1_specialized_oop_closures.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -41,6 +41,9 @@
 class G1CMOopClosure;
 class G1RootRegionScanClosure;
 
+class G1MarkAndPushClosure;
+class G1AdjustAndRebuildClosure;
+
 #define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_G1(f) \
       f(G1ScanEvacuatedObjClosure,_nv)             \
       f(G1ScanObjsDuringUpdateRSClosure,_nv)       \
@@ -49,4 +52,8 @@
       f(G1CMOopClosure,_nv)                        \
       f(G1RootRegionScanClosure,_nv)
 
+#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_G1FULL(f) \
+      f(G1MarkAndPushClosure,_nv)                      \
+      f(G1AdjustAndRebuildClosure,_nv)
+
 #endif // SHARE_VM_GC_G1_G1_SPECIALIZED_OOP_CLOSURES_HPP
--- a/src/hotspot/share/gc/g1/heapRegion.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/heapRegion.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -42,6 +42,7 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/orderAccess.inline.hpp"
+#include "utilities/growableArray.hpp"
 
 int    HeapRegion::LogOfHRGrainBytes = 0;
 int    HeapRegion::LogOfHRGrainWords = 0;
@@ -106,14 +107,6 @@
   }
 }
 
-void HeapRegion::reset_after_compaction() {
-  G1ContiguousSpace::reset_after_compaction();
-  // After a compaction the mark bitmap is invalid, so we must
-  // treat all objects as being inside the unmarked area.
-  zero_marked_bytes();
-  init_top_at_mark_start();
-}
-
 void HeapRegion::hr_clear(bool keep_remset, bool clear_space, bool locked) {
   assert(_humongous_start_region == NULL,
          "we should have already filtered out humongous regions");
@@ -278,10 +271,6 @@
                                             (uint)allocation_context());
 }
 
-CompactibleSpace* HeapRegion::next_compaction_space() const {
-  return G1CollectedHeap::heap()->next_compaction_region(this);
-}
-
 void HeapRegion::note_self_forwarding_removal_start(bool during_initial_mark,
                                                     bool during_conc_mark) {
   // We always recreate the prev marking info and we'll explicitly
@@ -411,7 +400,7 @@
     // We're not verifying code roots.
     return;
   }
-  if (vo == VerifyOption_G1UseMarkWord) {
+  if (vo == VerifyOption_G1UseFullMarking) {
     // Marking verification during a full GC is performed after class
     // unloading, code cache unloading, etc so the strong code roots
     // attached to each heap region are in an inconsistent state. They won't
@@ -482,7 +471,7 @@
 public:
   // _vo == UsePrevMarking -> use "prev" marking information,
   // _vo == UseNextMarking -> use "next" marking information,
-  // _vo == UseMarkWord    -> use mark word from object header.
+  // _vo == UseFullMarking -> use "next" marking bitmap but no TAMS.
   G1VerificationClosure(G1CollectedHeap* g1h, VerifyOption vo) :
     _g1h(g1h), _bs(barrier_set_cast<CardTableModRefBS>(g1h->barrier_set())),
     _containing_obj(NULL), _failures(false), _n_failures(0), _vo(vo) {
@@ -833,7 +822,8 @@
 }
 
 void HeapRegion::prepare_for_compaction(CompactPoint* cp) {
-  scan_and_forward(this, cp);
+  // Not used for G1 anymore, but pure virtual in Space.
+  ShouldNotReachHere();
 }
 
 // G1OffsetTableContigSpace code; copied from space.cpp.  Hope this can go
--- a/src/hotspot/share/gc/g1/heapRegion.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/heapRegion.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -57,6 +57,7 @@
 
 class G1CollectedHeap;
 class G1CMBitMap;
+class G1IsAliveAndApplyClosure;
 class HeapRegionRemSet;
 class HeapRegionRemSetIterator;
 class HeapRegion;
@@ -355,8 +356,14 @@
   // and the amount of unallocated words if called on top()
   size_t block_size(const HeapWord* p) const;
 
+  // Scans through the region using the bitmap to determine what
+  // objects to call size_t ApplyToMarkedClosure::apply(oop) for.
+  template<typename ApplyToMarkedClosure>
+  inline void apply_to_marked_objects(G1CMBitMap* bitmap, ApplyToMarkedClosure* closure);
   // Override for scan_and_forward support.
   void prepare_for_compaction(CompactPoint* cp);
+  // Update heap region to be consistent after compaction.
+  void complete_compaction();
 
   inline HeapWord* par_allocate_no_bot_updates(size_t min_word_size, size_t desired_word_size, size_t* word_size);
   inline HeapWord* allocate_no_bot_updates(size_t word_size);
@@ -672,10 +679,6 @@
     _predicted_elapsed_time_ms = ms;
   }
 
-  virtual CompactibleSpace* next_compaction_space() const;
-
-  virtual void reset_after_compaction();
-
   // Routines for managing a list of code roots (attached to the
   // this region's RSet) that point into this heap region.
   void add_strong_code_root(nmethod* nm);
@@ -693,9 +696,9 @@
   void print() const;
   void print_on(outputStream* st) const;
 
-  // vo == UsePrevMarking  -> use "prev" marking information,
+  // vo == UsePrevMarking -> use "prev" marking information,
   // vo == UseNextMarking -> use "next" marking information
-  // vo == UseMarkWord    -> use the mark word in the object header
+  // vo == UseFullMarking -> use "next" marking bitmap but no TAMS
   //
   // NOTE: Only the "prev" marking information is guaranteed to be
   // consistent most of the time, so most calls to this should use
@@ -704,7 +707,7 @@
   // vo == UseNextMarking, which is to verify the "next" marking
   // information at the end of remark.
   // Currently there is only one place where this is called with
-  // vo == UseMarkWord, which is to verify the marking during a
+  // vo == UseFullMarking, which is to verify the marking during a
   // full GC.
   void verify(VerifyOption vo, bool *failures) const;
 
--- a/src/hotspot/share/gc/g1/heapRegion.inline.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/heapRegion.inline.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -27,10 +27,12 @@
 
 #include "gc/g1/g1BlockOffsetTable.inline.hpp"
 #include "gc/g1/g1CollectedHeap.inline.hpp"
+#include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
 #include "gc/g1/heapRegion.hpp"
 #include "gc/shared/space.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/atomic.hpp"
+#include "runtime/prefetch.inline.hpp"
 #include "utilities/align.hpp"
 
 inline HeapWord* G1ContiguousSpace::allocate_impl(size_t min_word_size,
@@ -180,6 +182,45 @@
   return block_size_using_bitmap(addr, G1CollectedHeap::heap()->concurrent_mark()->prev_mark_bitmap());
 }
 
+inline void HeapRegion::complete_compaction() {
+  // Reset space and bot after compaction is complete if needed.
+  reset_after_compaction();
+  if (used_region().is_empty()) {
+    reset_bot();
+  }
+
+  // After a compaction the mark bitmap is invalid, so we must
+  // treat all objects as being inside the unmarked area.
+  zero_marked_bytes();
+  init_top_at_mark_start();
+
+  // Clear unused heap memory in debug builds.
+  if (ZapUnusedHeapArea) {
+    mangle_unused_area();
+  }
+}
+
+template<typename ApplyToMarkedClosure>
+inline void HeapRegion::apply_to_marked_objects(G1CMBitMap* bitmap, ApplyToMarkedClosure* closure) {
+  HeapWord* limit = scan_limit();
+  HeapWord* next_addr = bottom();
+
+  while (next_addr < limit) {
+    Prefetch::write(next_addr, PrefetchScanIntervalInBytes);
+    // This explicit is_marked check is a way to avoid
+    // some extra work done by get_next_marked_addr for
+    // the case where next_addr is marked.
+    if (bitmap->is_marked(next_addr)) {
+      oop current = oop(next_addr);
+      next_addr += closure->apply(current);
+    } else {
+      next_addr = bitmap->get_next_marked_addr(next_addr, limit);
+    }
+  }
+
+  assert(next_addr == limit, "Should stop the scan at the limit.");
+}
+
 inline HeapWord* HeapRegion::par_allocate_no_bot_updates(size_t min_word_size,
                                                          size_t desired_word_size,
                                                          size_t* actual_word_size) {
--- a/src/hotspot/share/gc/g1/heapRegionManager.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/heapRegionManager.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -327,9 +327,7 @@
   return true;
 }
 
-void HeapRegionManager::par_iterate(HeapRegionClosure* blk, uint worker_id, HeapRegionClaimer* hrclaimer) const {
-  const uint start_index = hrclaimer->start_region_for_worker(worker_id);
-
+void HeapRegionManager::par_iterate(HeapRegionClosure* blk, HeapRegionClaimer* hrclaimer, const uint start_index) const {
   // Every worker will actually look at all regions, skipping over regions that
   // are currently not committed.
   // This also (potentially) iterates over regions newly allocated during GC. This
@@ -493,7 +491,7 @@
   }
 }
 
-uint HeapRegionClaimer::start_region_for_worker(uint worker_id) const {
+uint HeapRegionClaimer::offset_for_worker(uint worker_id) const {
   assert(worker_id < _n_workers, "Invalid worker_id.");
   return _n_regions * worker_id / _n_workers;
 }
--- a/src/hotspot/share/gc/g1/heapRegionManager.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/g1/heapRegionManager.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -189,7 +189,7 @@
     return _free_list.length();
   }
 
-  size_t total_capacity_bytes() const {
+  size_t total_free_bytes() const {
     return num_free_regions() * HeapRegion::GrainBytes;
   }
 
@@ -240,7 +240,7 @@
   // terminating the iteration early if doHeapRegion() returns true.
   void iterate(HeapRegionClosure* blk) const;
 
-  void par_iterate(HeapRegionClosure* blk, uint worker_id, HeapRegionClaimer* hrclaimer) const;
+  void par_iterate(HeapRegionClosure* blk, HeapRegionClaimer* hrclaimer, const uint start_index) const;
 
   // Uncommit up to num_regions_to_remove regions that are completely free.
   // Return the actual number of uncommitted regions.
@@ -274,9 +274,8 @@
     return _n_regions;
   }
 
-  // Calculate the starting region for given worker so
-  // that they do not all start from the same region.
-  uint start_region_for_worker(uint worker_id) const;
+  // Return a start offset given a worker id.
+  uint offset_for_worker(uint worker_id) const;
 
   // Check if region has been claimed with this HRClaimer.
   bool is_region_claimed(uint region_index) const;
--- a/src/hotspot/share/gc/serial/markSweep.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/serial/markSweep.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -65,13 +65,6 @@
 CLDToOopClosure               MarkSweep::adjust_cld_closure(&adjust_pointer_closure);
 
 inline void MarkSweep::mark_object(oop obj) {
-#if INCLUDE_ALL_GCS
-  if (G1StringDedup::is_enabled()) {
-    // We must enqueue the object before it is marked
-    // as we otherwise can't read the object's age.
-    G1StringDedup::enqueue_from_mark(obj);
-  }
-#endif
   // some marks may contain information we need to preserve so we store them away
   // and overwrite the mark.  We'll restore it at the end of markSweep.
   markOop mark = obj->mark();
--- a/src/hotspot/share/gc/shared/gcName.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/shared/gcName.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, 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
@@ -37,6 +37,7 @@
   G1New,
   ConcurrentMarkSweep,
   G1Old,
+  G1Full,
   GCNameEndSentinel
 };
 
@@ -53,6 +54,7 @@
       case G1New: return "G1New";
       case ConcurrentMarkSweep: return "ConcurrentMarkSweep";
       case G1Old: return "G1Old";
+      case G1Full: return "G1Full";
       default: ShouldNotReachHere(); return NULL;
     }
   }
--- a/src/hotspot/share/gc/shared/gcTrace.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/shared/gcTrace.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, 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
@@ -289,6 +289,12 @@
                                      double predicted_marking_length,
                                      bool prediction_active);
 };
+
+class G1FullGCTracer : public OldGCTracer {
+ public:
+  G1FullGCTracer() : OldGCTracer(G1Full) {}
+};
+
 #endif
 
 class CMSTracer : public OldGCTracer {
--- a/src/hotspot/share/gc/shared/preservedMarks.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/shared/preservedMarks.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, 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
@@ -37,6 +37,18 @@
   assert_empty();
 }
 
+void PreservedMarks::adjust_during_full_gc() {
+  StackIterator<OopAndMarkOop, mtGC> iter(_stack);
+  while (!iter.is_empty()) {
+    OopAndMarkOop* elem = iter.next_addr();
+
+    oop obj = elem->get_oop();
+    if (obj->is_forwarded()) {
+      elem->set_oop(obj->forwardee());
+    }
+  }
+}
+
 void PreservedMarks::restore_and_increment(volatile size_t* const total_size_addr) {
   const size_t stack_size = size();
   restore();
@@ -104,7 +116,6 @@
   }
 };
 
-
 void PreservedMarksSet::reclaim() {
   assert_empty();
 
--- a/src/hotspot/share/gc/shared/preservedMarks.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/shared/preservedMarks.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, 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
@@ -35,7 +35,7 @@
 
 class PreservedMarks VALUE_OBJ_CLASS_SPEC {
 private:
-  class OopAndMarkOop {
+  class OopAndMarkOop VALUE_OBJ_CLASS_SPEC {
   private:
     oop _o;
     markOop _m;
@@ -43,23 +43,26 @@
   public:
     OopAndMarkOop(oop obj, markOop m) : _o(obj), _m(m) { }
 
-    void set_mark() const {
-      _o->set_mark(_m);
-    }
+    oop get_oop() { return _o; }
+    void set_mark() const { _o->set_mark(_m); }
+    void set_oop(oop obj) { _o = obj; }
   };
   typedef Stack<OopAndMarkOop, mtGC> OopAndMarkOopStack;
 
   OopAndMarkOopStack _stack;
 
   inline bool should_preserve_mark(oop obj, markOop m) const;
-  inline void push(oop obj, markOop m);
 
 public:
   size_t size() const { return _stack.size(); }
+  inline void push(oop obj, markOop m);
   inline void push_if_necessary(oop obj, markOop m);
   // Iterate over the stack, restore all preserved marks, and
   // reclaim the memory taken up by the stack segments.
   void restore();
+  // Iterate over the stack, adjust all preserved marks according
+  // to their forwarding location stored in the mark.
+  void adjust_during_full_gc();
 
   void restore_and_increment(volatile size_t* const _total_size_addr);
   inline static void init_forwarded_mark(oop obj);
--- a/src/hotspot/share/gc/shared/specialized_oop_closures.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/shared/specialized_oop_closures.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -110,7 +110,8 @@
 #define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f)       \
   SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_MS(f)            \
   SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_CMS(f)           \
-  SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_G1(f)
+  SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_G1(f)            \
+  SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_G1FULL(f)
 #else  // INCLUDE_ALL_GCS
 #define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f)       \
   SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_MS(f)
--- a/src/hotspot/share/gc/shared/taskqueue.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/shared/taskqueue.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -369,6 +369,7 @@
   typedef typename T::element_type E;
 
   GenericTaskQueueSet(int n);
+  ~GenericTaskQueueSet();
 
   bool steal_best_of_2(uint queue_num, int* seed, E& t);
 
--- a/src/hotspot/share/gc/shared/taskqueue.inline.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/gc/shared/taskqueue.inline.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -42,6 +42,11 @@
   }
 }
 
+template <class T, MEMFLAGS F>
+inline GenericTaskQueueSet<T, F>::~GenericTaskQueueSet() {
+  FREE_C_HEAP_ARRAY(T*, _queues);
+}
+
 template<class E, MEMFLAGS F, unsigned int N>
 inline void GenericTaskQueue<E, F, N>::initialize() {
   _elems = ArrayAllocator<E>::allocate(N, F);
@@ -49,7 +54,6 @@
 
 template<class E, MEMFLAGS F, unsigned int N>
 inline GenericTaskQueue<E, F, N>::~GenericTaskQueue() {
-  assert(false, "This code is currently never called");
   ArrayAllocator<E>::free(const_cast<E*>(_elems), N);
 }
 
--- a/src/hotspot/share/interpreter/templateInterpreter.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/interpreter/templateInterpreter.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -162,6 +162,7 @@
   static int        distance_from_dispatch_table(TosState state){ return _active_table.distance_from(state); }
   static address*   normal_table(TosState state)                { return _normal_table.table_for(state); }
   static address*   normal_table()                              { return _normal_table.table_for(); }
+  static address*   safept_table(TosState state)                { return _safept_table.table_for(state); }
 
   // Support for invokes
   static address*   invoke_return_entry_table()                 { return _invoke_return_entry; }
--- a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -37,6 +37,7 @@
 #include "oops/oop.inline.hpp"
 #include "oops/objArrayOop.inline.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/safepointMechanism.inline.hpp"
 #include "utilities/align.hpp"
 
 // frequently used constants
@@ -854,9 +855,10 @@
     }
     last_pc_offset = pc_offset;
 
-    if (SafepointSynchronize::do_call_back()) {
+    JavaThread* thread = JavaThread::current();
+    if (SafepointMechanism::poll(thread)) {
       // this is a hacky way to force a safepoint check but nothing else was jumping out at me.
-      ThreadToNativeFromVM ttnfv(JavaThread::current());
+      ThreadToNativeFromVM ttnfv(thread);
     }
   }
 
--- a/src/hotspot/share/logging/logTag.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/logging/logTag.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -67,6 +67,7 @@
   LOG_TAG(fingerprint) \
   LOG_TAG(freelist) \
   LOG_TAG(gc) \
+  LOG_TAG(handshake) \
   LOG_TAG(hashtables) \
   LOG_TAG(heap) \
   LOG_TAG(humongous) \
--- a/src/hotspot/share/memory/universe.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/memory/universe.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -90,7 +90,7 @@
       // G1
       VerifyOption_G1UsePrevMarking = VerifyOption_Default,
       VerifyOption_G1UseNextMarking = VerifyOption_G1UsePrevMarking + 1,
-      VerifyOption_G1UseMarkWord    = VerifyOption_G1UseNextMarking + 1
+      VerifyOption_G1UseFullMarking = VerifyOption_G1UseNextMarking + 1
 };
 
 class Universe: AllStatic {
--- a/src/hotspot/share/oops/cpCache.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/oops/cpCache.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -440,7 +440,7 @@
 
   Symbol* error = PENDING_EXCEPTION->klass()->name();
   Symbol* message = java_lang_Throwable::detail_message(PENDING_EXCEPTION);
-  assert("message != NULL", "Missing detail message");
+  assert(message != NULL, "Missing detail message");
 
   SystemDictionary::add_resolution_error(cpool, index, error, message);
   set_indy_resolution_failed();
--- a/src/hotspot/share/opto/cfgnode.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/opto/cfgnode.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -918,11 +918,18 @@
         const TypeInt* stride_t = phase->type(stride)->isa_int();
         if (lo != NULL && hi != NULL && stride_t != NULL) { // Dying loops might have TOP here
           assert(stride_t->_hi >= stride_t->_lo, "bad stride type");
-          if (stride_t->_hi < 0) {          // Down-counter loop
-            swap(lo, hi);
-            return TypeInt::make(MIN2(lo->_lo, hi->_lo) , hi->_hi, 3);
-          } else if (stride_t->_lo >= 0) {
-            return TypeInt::make(lo->_lo, MAX2(lo->_hi, hi->_hi), 3);
+          BoolTest::mask bt = l->loopexit()->test_trip();
+          // If the loop exit condition is "not equal", the condition
+          // would not trigger if init > limit (if stride > 0) or if
+          // init < limit if (stride > 0) so we can't deduce bounds
+          // for the iv from the exit condition.
+          if (bt != BoolTest::ne) {
+            if (stride_t->_hi < 0) {          // Down-counter loop
+              swap(lo, hi);
+              return TypeInt::make(MIN2(lo->_lo, hi->_lo) , hi->_hi, 3);
+            } else if (stride_t->_lo >= 0) {
+              return TypeInt::make(lo->_lo, MAX2(lo->_hi, hi->_hi), 3);
+            }
           }
         }
       }
@@ -933,7 +940,7 @@
       // before the special code for counted loop above has a chance
       // to run (that is as long as the type of the backedge's control
       // is top), we might end up with non monotonic types
-      return phase->type(in(LoopNode::EntryControl));
+      return phase->type(in(LoopNode::EntryControl))->filter_speculative(_type);
     }
   }
 
--- a/src/hotspot/share/opto/parse1.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/opto/parse1.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -2286,7 +2286,14 @@
 
   // Create a node for the polling address
   if( add_poll_param ) {
-    Node *polladr = ConPNode::make((address)os::get_polling_page());
+    Node *polladr;
+    if (SafepointMechanism::uses_thread_local_poll()) {
+      Node *thread = _gvn.transform(new ThreadLocalNode());
+      Node *polling_page_load_addr = _gvn.transform(basic_plus_adr(top(), thread, in_bytes(Thread::polling_page_offset())));
+      polladr = make_load(control(), polling_page_load_addr, TypeRawPtr::BOTTOM, T_ADDRESS, Compile::AliasIdxRaw, MemNode::unordered);
+    } else {
+      polladr = ConPNode::make((address)os::get_polling_page());
+    }
     sfpnt->init_req(TypeFunc::Parms+0, _gvn.transform(polladr));
   }
 
--- a/src/hotspot/share/prims/whitebox.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/prims/whitebox.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -49,6 +49,7 @@
 #include "runtime/arguments.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/deoptimization.hpp"
+#include "runtime/handshake.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/os.hpp"
@@ -1727,6 +1728,40 @@
 #endif
 WB_END
 
+WB_ENTRY(jint, WB_HandshakeWalkStack(JNIEnv* env, jobject wb, jobject thread_handle, jboolean all_threads))
+  class TraceSelfClosure : public ThreadClosure {
+    jint _num_threads_completed;
+
+    void do_thread(Thread* th) {
+      assert(th->is_Java_thread(), "sanity");
+      JavaThread* jt = (JavaThread*)th;
+      ResourceMark rm;
+
+      jt->print_on(tty);
+      jt->print_stack_on(tty);
+      tty->cr();
+      Atomic::inc(&_num_threads_completed);
+    }
+
+  public:
+    TraceSelfClosure() : _num_threads_completed(0) {}
+
+    jint num_threads_completed() const { return _num_threads_completed; }
+  };
+  TraceSelfClosure tsc;
+
+  if (all_threads) {
+    Handshake::execute(&tsc);
+  } else {
+    oop thread_oop = JNIHandles::resolve(thread_handle);
+    if (thread_oop != NULL) {
+      JavaThread* target = java_lang_Thread::thread(thread_oop);
+      Handshake::execute(&tsc, target);
+    }
+  }
+  return tsc.num_threads_completed();
+WB_END
+
 //Some convenience methods to deal with objects from java
 int WhiteBox::offset_for_field(const char* field_name, oop object,
     Symbol* signature_symbol) {
@@ -2038,6 +2073,7 @@
   {CC"areOpenArchiveHeapObjectsMapped",   CC"()Z",    (void*)&WB_AreOpenArchiveHeapObjectsMapped},
   {CC"isCDSIncludedInVmBuild",            CC"()Z",    (void*)&WB_IsCDSIncludedInVmBuild },
   {CC"clearInlineCaches0",  CC"(Z)V",                 (void*)&WB_ClearInlineCaches },
+  {CC"handshakeWalkStack", CC"(Ljava/lang/Thread;Z)I", (void*)&WB_HandshakeWalkStack },
   {CC"addCompilerDirective",    CC"(Ljava/lang/String;)I",
                                                       (void*)&WB_AddCompilerDirective },
   {CC"removeCompilerDirective",   CC"(I)V",             (void*)&WB_RemoveCompilerDirective },
--- a/src/hotspot/share/runtime/arguments.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/runtime/arguments.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -50,6 +50,7 @@
 #include "runtime/globals_extension.hpp"
 #include "runtime/java.hpp"
 #include "runtime/os.hpp"
+#include "runtime/safepointMechanism.hpp"
 #include "runtime/vm_version.hpp"
 #include "services/management.hpp"
 #include "services/memTracker.hpp"
@@ -383,6 +384,7 @@
   { "MinRAMFraction",               JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
   { "InitialRAMFraction",           JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
   { "UseMembar",                    JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
+  { "FastTLABRefill",               JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "IgnoreUnverifiableClassesDuringDump", JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
 
   // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
@@ -4620,6 +4622,32 @@
   }
 #endif
 
+  bool aot_enabled = UseAOT && AOTLibrary != NULL;
+  bool jvmci_enabled = NOT_JVMCI(false) JVMCI_ONLY(EnableJVMCI || UseJVMCICompiler);
+  bool handshakes_supported = SafepointMechanism::supports_thread_local_poll() && !aot_enabled && !jvmci_enabled && ThreadLocalHandshakes;
+  // ThreadLocalHandshakesConstraintFunc handles the constraints.
+  // Here we try to figure out if a mutual exclusive option have been set that conflict with a default.
+  if (handshakes_supported) {
+    FLAG_SET_DEFAULT(UseAOT, false); // Clear the AOT flag to make sure it doesn't try to initialize.
+  } else {
+    if (FLAG_IS_DEFAULT(ThreadLocalHandshakes) && ThreadLocalHandshakes) {
+      if (aot_enabled) {
+        // If user enabled AOT but ThreadLocalHandshakes is at default set it to false.
+        log_debug(ergo)("Disabling ThreadLocalHandshakes for UseAOT.");
+        FLAG_SET_DEFAULT(ThreadLocalHandshakes, false);
+      } else if (jvmci_enabled){
+        // If user enabled JVMCI but ThreadLocalHandshakes is at default set it to false.
+        log_debug(ergo)("Disabling ThreadLocalHandshakes for EnableJVMCI/UseJVMCICompiler.");
+        FLAG_SET_DEFAULT(ThreadLocalHandshakes, false);
+      }
+    }
+  }
+  if (FLAG_IS_DEFAULT(ThreadLocalHandshakes) || !SafepointMechanism::supports_thread_local_poll()) {
+    log_debug(ergo)("ThreadLocalHandshakes %s", ThreadLocalHandshakes ? "enabled." : "disabled.");
+  } else {
+    log_info(ergo)("ThreadLocalHandshakes %s", ThreadLocalHandshakes ? "enabled." : "disabled.");
+  }
+
   return JNI_OK;
 }
 
--- a/src/hotspot/share/runtime/commandLineFlagConstraintsRuntime.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/runtime/commandLineFlagConstraintsRuntime.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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,6 +27,7 @@
 #include "runtime/commandLineFlagConstraintsRuntime.hpp"
 #include "runtime/commandLineFlagRangeList.hpp"
 #include "runtime/globals.hpp"
+#include "runtime/safepointMechanism.hpp"
 #include "runtime/task.hpp"
 #include "utilities/defaultStream.hpp"
 
@@ -130,3 +131,17 @@
     return Flag::SUCCESS;
   }
 }
+
+Flag::Error ThreadLocalHandshakesConstraintFunc(bool value, bool verbose) {
+  if (value) {
+    if (!SafepointMechanism::supports_thread_local_poll()) {
+      CommandLineError::print(verbose, "ThreadLocalHandshakes not yet supported on this platform\n");
+      return Flag::VIOLATES_CONSTRAINT;
+    }
+    if (UseAOT JVMCI_ONLY(|| EnableJVMCI || UseJVMCICompiler)) {
+      CommandLineError::print(verbose, "ThreadLocalHandshakes not yet supported in combination with AOT or JVMCI\n");
+      return Flag::VIOLATES_CONSTRAINT;
+    }
+  }
+  return Flag::SUCCESS;
+}
--- a/src/hotspot/share/runtime/commandLineFlagConstraintsRuntime.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/runtime/commandLineFlagConstraintsRuntime.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -45,4 +45,7 @@
 
 Flag::Error PerfDataSamplingIntervalFunc(intx value, bool verbose);
 
+Flag::Error ThreadLocalHandshakesConstraintFunc(bool value, bool verbose);
+
+
 #endif /* SHARE_VM_RUNTIME_COMMANDLINEFLAGCONSTRAINTSRUNTIME_HPP */
--- a/src/hotspot/share/runtime/globals.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/runtime/globals.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -598,6 +598,13 @@
   develop(bool, CleanChunkPoolAsync, true,                                  \
           "Clean the chunk pool asynchronously")                            \
                                                                             \
+  product_pd(bool, ThreadLocalHandshakes,                                   \
+          "Use thread-local polls instead of global poll for safepoints.")  \
+          constraint(ThreadLocalHandshakesConstraintFunc,AfterErgo)         \
+                                                                            \
+  diagnostic(uint, HandshakeTimeout, 0,                                     \
+          "If nonzero set a timeout in milliseconds for handshakes")        \
+                                                                            \
   experimental(bool, AlwaysSafeConstructors, false,                         \
           "Force safe construction, as if all fields are final.")           \
                                                                             \
@@ -2013,8 +2020,8 @@
   product(bool, ZeroTLAB, false,                                            \
           "Zero out the newly created TLAB")                                \
                                                                             \
-  product(bool, FastTLABRefill, true,                                       \
-          "Use fast TLAB refill code")                                      \
+  product(bool, FastTLABRefill, false,                                      \
+          "(Deprecated) Use fast TLAB refill code")                         \
                                                                             \
   product(bool, TLABStats, true,                                            \
           "Provide more detailed and expensive TLAB statistics.")           \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/runtime/handshake.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,352 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "logging/log.hpp"
+#include "logging/logStream.hpp"
+#include "memory/resourceArea.hpp"
+#include "runtime/handshake.hpp"
+#include "runtime/interfaceSupport.hpp"
+#include "runtime/osThread.hpp"
+#include "runtime/semaphore.hpp"
+#include "runtime/task.hpp"
+#include "runtime/timerTrace.hpp"
+#include "runtime/thread.hpp"
+#include "runtime/vmThread.hpp"
+#include "utilities/formatBuffer.hpp"
+#include "utilities/preserveException.hpp"
+
+#define ALL_JAVA_THREADS(X) for (JavaThread* X = Threads::first(); X; X = X->next())
+
+class HandshakeOperation: public StackObj {
+public:
+  virtual void do_handshake(JavaThread* thread) = 0;
+  virtual void cancel_handshake(JavaThread* thread) = 0;
+};
+
+class HandshakeThreadsOperation: public HandshakeOperation {
+  Semaphore _done;
+  ThreadClosure* _thread_cl;
+
+public:
+  HandshakeThreadsOperation(ThreadClosure* cl) : _done(0), _thread_cl(cl) {}
+  void do_handshake(JavaThread* thread);
+  void cancel_handshake(JavaThread* thread) { _done.signal(); };
+
+  bool thread_has_completed() { return _done.trywait(); }
+};
+
+class VM_Handshake: public VM_Operation {
+  HandshakeThreadsOperation* const _op;
+  const jlong _handshake_timeout;
+ public:
+  bool evaluate_at_safepoint() const { return false; }
+
+  bool evaluate_concurrently() const { return false; }
+
+ protected:
+
+  VM_Handshake(HandshakeThreadsOperation* op) :
+      _op(op),
+      _handshake_timeout(TimeHelper::millis_to_counter(HandshakeTimeout)) {}
+
+  void set_handshake(JavaThread* target) {
+    target->set_handshake_operation(_op);
+  }
+
+  // This method returns true for threads completed their operation
+  // and true for threads canceled their operation.
+  // A cancellation can happen if the thread is exiting.
+  bool poll_for_completed_thread() { return _op->thread_has_completed(); }
+
+  bool handshake_has_timed_out(jlong start_time);
+  static void handle_timeout();
+};
+
+bool VM_Handshake::handshake_has_timed_out(jlong start_time) {
+  // Check if handshake operation has timed out
+  if (_handshake_timeout > 0) {
+    return os::elapsed_counter() >= (start_time + _handshake_timeout);
+  }
+  return false;
+}
+
+void VM_Handshake::handle_timeout() {
+  LogStreamHandle(Warning, handshake) log_stream;
+  MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
+  ALL_JAVA_THREADS(thr) {
+    if (thr->has_handshake()) {
+      log_stream.print("Thread " PTR_FORMAT " has not cleared its handshake op", p2i(thr));
+      thr->print_thread_state_on(&log_stream);
+    }
+  }
+  log_stream.flush();
+  fatal("Handshake operation timed out");
+}
+
+
+class VM_HandshakeOneThread: public VM_Handshake {
+  JavaThread* _target;
+  bool _thread_alive;
+ public:
+  VM_HandshakeOneThread(HandshakeThreadsOperation* op, JavaThread* target) :
+    VM_Handshake(op), _target(target), _thread_alive(false) {}
+
+  void doit() {
+    TraceTime timer("Performing single-target operation (vmoperation doit)", TRACETIME_LOG(Info, handshake));
+
+    {
+      MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
+      if (Threads::includes(_target)) {
+        set_handshake(_target);
+        _thread_alive = true;
+      }
+    }
+
+    if (!_thread_alive) {
+      return;
+    }
+
+    if (!UseMembar) {
+      os::serialize_thread_states();
+    }
+
+    log_trace(handshake)("Thread signaled, begin processing by VMThtread");
+    jlong start_time = os::elapsed_counter();
+    do {
+      if (handshake_has_timed_out(start_time)) {
+        handle_timeout();
+      }
+
+      MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
+      _target->handshake_process_by_vmthread();
+
+    } while (!poll_for_completed_thread());
+  }
+
+  VMOp_Type type() const { return VMOp_HandshakeOneThread; }
+
+  bool thread_alive() const { return _thread_alive; }
+};
+
+class VM_HandshakeAllThreads: public VM_Handshake {
+ public:
+  VM_HandshakeAllThreads(HandshakeThreadsOperation* op) : VM_Handshake(op) {}
+
+  void doit() {
+    TraceTime timer("Performing operation (vmoperation doit)", TRACETIME_LOG(Info, handshake));
+
+    int number_of_threads_issued = -1;
+    int number_of_threads_completed = 0;
+    {
+      MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
+      number_of_threads_issued = Threads::number_of_threads();
+
+      ALL_JAVA_THREADS(thr) {
+        set_handshake(thr);
+      }
+    }
+
+    if (!UseMembar) {
+      os::serialize_thread_states();
+    }
+
+    log_debug(handshake)("Threads signaled, begin processing blocked threads by VMThtread");
+    const jlong start_time = os::elapsed_counter();
+    do {
+      // Check if handshake operation has timed out
+      if (handshake_has_timed_out(start_time)) {
+        handle_timeout();
+      }
+
+      // Have VM thread perform the handshake operation for blocked threads.
+      // Observing a blocked state may of course be transient but the processing is guarded
+      // by semaphores and we optimistically begin by working on the blocked threads
+      {
+          MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
+          ALL_JAVA_THREADS(thr) {
+            thr->handshake_process_by_vmthread();
+          }
+      }
+
+      while (poll_for_completed_thread()) {
+        number_of_threads_completed++;
+      }
+
+    } while (number_of_threads_issued != number_of_threads_completed);
+  }
+
+  VMOp_Type type() const { return VMOp_HandshakeAllThreads; }
+};
+
+class VM_HandshakeFallbackOperation : public VM_Operation {
+  ThreadClosure* _thread_cl;
+  Thread* _target_thread;
+  bool _all_threads;
+  bool _thread_alive;
+public:
+  VM_HandshakeFallbackOperation(ThreadClosure* cl) :
+      _thread_cl(cl), _target_thread(NULL), _all_threads(true), _thread_alive(true) {}
+  VM_HandshakeFallbackOperation(ThreadClosure* cl, Thread* target) :
+      _thread_cl(cl), _target_thread(target), _all_threads(false), _thread_alive(false) {}
+
+  void doit() {
+    ALL_JAVA_THREADS(t) {
+      if (_all_threads || t == _target_thread) {
+        if (t == _target_thread) {
+          _thread_alive = true;
+        }
+        _thread_cl->do_thread(t);
+      }
+    }
+  }
+
+  VMOp_Type type() const { return VMOp_HandshakeFallback; }
+  bool thread_alive() const { return _thread_alive; }
+};
+
+#undef ALL_JAVA_THREADS
+
+void HandshakeThreadsOperation::do_handshake(JavaThread* thread) {
+  ResourceMark rm;
+  FormatBufferResource message("Operation for thread " PTR_FORMAT ", is_vm_thread: %s",
+                               p2i(thread), BOOL_TO_STR(Thread::current()->is_VM_thread()));
+  TraceTime timer(message, TRACETIME_LOG(Debug, handshake, task));
+  _thread_cl->do_thread(thread);
+
+  // Use the semaphore to inform the VM thread that we have completed the operation
+  _done.signal();
+}
+
+void Handshake::execute(ThreadClosure* thread_cl) {
+  if (ThreadLocalHandshakes) {
+    HandshakeThreadsOperation cto(thread_cl);
+    VM_HandshakeAllThreads handshake(&cto);
+    VMThread::execute(&handshake);
+  } else {
+    VM_HandshakeFallbackOperation op(thread_cl);
+    VMThread::execute(&op);
+  }
+}
+
+bool Handshake::execute(ThreadClosure* thread_cl, JavaThread* target) {
+  if (ThreadLocalHandshakes) {
+    HandshakeThreadsOperation cto(thread_cl);
+    VM_HandshakeOneThread handshake(&cto, target);
+    VMThread::execute(&handshake);
+    return handshake.thread_alive();
+  } else {
+    VM_HandshakeFallbackOperation op(thread_cl, target);
+    VMThread::execute(&op);
+    return op.thread_alive();
+  }
+}
+
+HandshakeState::HandshakeState() : _operation(NULL), _semaphore(1), _vmthread_holds_semaphore(false), _thread_in_process_handshake(false) {}
+
+void HandshakeState::set_operation(JavaThread* target, HandshakeOperation* op) {
+  _operation = op;
+  SafepointMechanism::arm_local_poll(target);
+}
+
+void HandshakeState::clear_handshake(JavaThread* target) {
+  _operation = NULL;
+  SafepointMechanism::disarm_local_poll(target);
+}
+
+void HandshakeState::process_self_inner(JavaThread* thread) {
+  assert(Thread::current() == thread, "should call from thread");
+  CautiouslyPreserveExceptionMark pem(thread);
+  ThreadInVMForHandshake tivm(thread);
+  if (!_semaphore.trywait()) {
+    ThreadBlockInVM tbivm(thread);
+    _semaphore.wait();
+  }
+  if (has_operation()) {
+    HandshakeOperation* op = _operation;
+    clear_handshake(thread);
+    if (op != NULL) {
+      op->do_handshake(thread);
+    }
+  }
+  _semaphore.signal();
+}
+
+void HandshakeState::cancel_inner(JavaThread* thread) {
+  assert(Thread::current() == thread, "should call from thread");
+  assert(thread->thread_state() == _thread_in_vm, "must be in vm state");
+#ifdef DEBUG
+  {
+    MutexLockerEx ml(Threads_lock,  Mutex::_no_safepoint_check_flag);
+    assert(!Threads::includes(thread), "java thread must not be on threads list");
+  }
+#endif
+  HandshakeOperation* op = _operation;
+  clear_handshake(thread);
+  if (op != NULL) {
+    op->cancel_handshake(thread);
+  }
+}
+
+bool HandshakeState::vmthread_can_process_handshake(JavaThread* target) {
+  return SafepointSynchronize::safepoint_safe(target, target->thread_state());
+}
+
+bool HandshakeState::claim_handshake_for_vmthread() {
+  if (_semaphore.trywait()) {
+    if (has_operation()) {
+      _vmthread_holds_semaphore = true;
+    } else {
+      _semaphore.signal();
+    }
+  }
+  return _vmthread_holds_semaphore;
+}
+
+void HandshakeState::process_by_vmthread(JavaThread* target) {
+  assert(Thread::current()->is_VM_thread(), "should call from vm thread");
+
+  if (!has_operation()) {
+    // JT has already cleared its handshake
+    return;
+  }
+
+  if (!vmthread_can_process_handshake(target)) {
+    // JT is observed in an unsafe state, it must notice the handshake itself
+    return;
+  }
+
+  // If we own the semaphore at this point and while owning the semaphore
+  // can observe a safe state the thread cannot possibly continue without
+  // getting caught by the semaphore.
+  if (claim_handshake_for_vmthread() && vmthread_can_process_handshake(target)) {
+    guarantee(!_semaphore.trywait(), "we should already own the semaphore");
+
+    _operation->do_handshake(target);
+    clear_handshake(target);
+    _vmthread_holds_semaphore = false;
+    // Release the thread
+    _semaphore.signal();
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/runtime/handshake.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+#ifndef SHARE_VM_RUNTIME_HANDSHAKE_HPP
+#define SHARE_VM_RUNTIME_HANDSHAKE_HPP
+
+#include "memory/allocation.hpp"
+#include "runtime/semaphore.hpp"
+
+class ThreadClosure;
+class JavaThread;
+
+// A handshake operation is a callback that is executed for each JavaThread
+// while that thread is in a safepoint safe state. The callback is executed
+// either by the thread itself or by the VM thread while keeping the thread
+// in a blocked state. A handshake can be performed with a single
+// JavaThread as well.
+class Handshake : public AllStatic {
+ public:
+  // Execution of handshake operation
+  static void execute(ThreadClosure* thread_cl);
+  static bool execute(ThreadClosure* thread_cl, JavaThread* target);
+};
+
+class HandshakeOperation;
+
+// The HandshakeState keep tracks of an ongoing handshake for one JavaThread.
+// VM thread and JavaThread are serialized with the semaphore making sure
+// the operation is only done by either VM thread on behalf of the JavaThread
+// or the JavaThread itself.
+class HandshakeState VALUE_OBJ_CLASS_SPEC {
+  HandshakeOperation* volatile _operation;
+
+  Semaphore _semaphore;
+  bool _vmthread_holds_semaphore;
+  bool _thread_in_process_handshake;
+
+  bool claim_handshake_for_vmthread();
+  bool vmthread_can_process_handshake(JavaThread* target);
+
+  void clear_handshake(JavaThread* thread);
+  void cancel_inner(JavaThread* thread);
+
+  void process_self_inner(JavaThread* thread);
+public:
+  HandshakeState();
+
+  void set_operation(JavaThread* thread, HandshakeOperation* op);
+
+  bool has_operation() const {
+    return _operation != NULL;
+  }
+
+  void cancel(JavaThread* thread) {
+    if (!_thread_in_process_handshake) {
+      FlagSetting fs(_thread_in_process_handshake, true);
+      cancel_inner(thread);
+    }
+  }
+
+  void process_by_self(JavaThread* thread) {
+    if (!_thread_in_process_handshake) {
+      FlagSetting fs(_thread_in_process_handshake, true);
+      process_self_inner(thread);
+    }
+  }
+  void process_by_vmthread(JavaThread* target);
+};
+
+#endif // SHARE_VM_RUNTIME_HANDSHAKE_HPP
--- a/src/hotspot/share/runtime/interfaceSupport.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/runtime/interfaceSupport.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -30,7 +30,7 @@
 #include "runtime/mutexLocker.hpp"
 #include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
-#include "runtime/safepoint.hpp"
+#include "runtime/safepointMechanism.inline.hpp"
 #include "runtime/thread.inline.hpp"
 #include "runtime/vmThread.hpp"
 #include "utilities/globalDefinitions.hpp"
@@ -142,9 +142,7 @@
 
     InterfaceSupport::serialize_thread_state(thread);
 
-    if (SafepointSynchronize::do_call_back()) {
-      SafepointSynchronize::block(thread);
-    }
+    SafepointMechanism::block_if_requested(thread);
     thread->set_thread_state(to);
 
     CHECK_UNHANDLED_OOPS_ONLY(thread->clear_unhandled_oops();)
@@ -164,9 +162,7 @@
 
     InterfaceSupport::serialize_thread_state_with_handler(thread);
 
-    if (SafepointSynchronize::do_call_back()) {
-      SafepointSynchronize::block(thread);
-    }
+    SafepointMechanism::block_if_requested(thread);
     thread->set_thread_state(to);
 
     CHECK_UNHANDLED_OOPS_ONLY(thread->clear_unhandled_oops();)
@@ -191,7 +187,7 @@
     // We never install asynchronous exceptions when coming (back) in
     // to the runtime from native code because the runtime is not set
     // up to handle exceptions floating around at arbitrary points.
-    if (SafepointSynchronize::do_call_back() || thread->is_suspend_after_native()) {
+    if (SafepointMechanism::poll(thread) || thread->is_suspend_after_native()) {
       JavaThread::check_safepoint_and_suspend_for_native_trans(thread);
 
       // Clear unhandled oops anywhere where we could block, even if we don't.
@@ -207,6 +203,38 @@
    void trans_and_fence(JavaThreadState from, JavaThreadState to) { transition_and_fence(_thread, from, to); }
 };
 
+class ThreadInVMForHandshake : public ThreadStateTransition {
+  const JavaThreadState _original_state;
+
+  void transition_back() {
+    // This can be invoked from transition states and must return to the original state properly
+    assert(_thread->thread_state() == _thread_in_vm, "should only call when leaving VM after handshake");
+    _thread->set_thread_state(_thread_in_vm_trans);
+
+    InterfaceSupport::serialize_thread_state(_thread);
+
+    SafepointMechanism::block_if_requested(_thread);
+
+    _thread->set_thread_state(_original_state);
+  }
+
+ public:
+
+  ThreadInVMForHandshake(JavaThread* thread) : ThreadStateTransition(thread),
+      _original_state(thread->thread_state()) {
+
+    if (thread->has_last_Java_frame()) {
+      thread->frame_anchor()->make_walkable(thread);
+    }
+
+    thread->set_thread_state(_thread_in_vm);
+  }
+
+  ~ThreadInVMForHandshake() {
+    transition_back();
+  }
+
+};
 
 class ThreadInVMfromJava : public ThreadStateTransition {
  public:
--- a/src/hotspot/share/runtime/mutex.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/runtime/mutex.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -28,6 +28,7 @@
 #include "runtime/mutex.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/osThread.hpp"
+#include "runtime/safepointMechanism.inline.hpp"
 #include "runtime/thread.inline.hpp"
 #include "utilities/events.hpp"
 #include "utilities/macros.hpp"
@@ -394,7 +395,7 @@
       jint rv = Self->rng[0];
       for (int k = Delay; --k >= 0;) {
         rv = MarsagliaXORV(rv);
-        if ((flgs & 4) == 0 && SafepointSynchronize::do_call_back()) return 0;
+        if ((flgs & 4) == 0 && SafepointMechanism::poll(Self)) return 0;
       }
       Self->rng[0] = rv;
     } else {
--- a/src/hotspot/share/runtime/objectMonitor.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/runtime/objectMonitor.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -35,6 +35,7 @@
 #include "runtime/objectMonitor.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/osThread.hpp"
+#include "runtime/safepointMechanism.inline.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "runtime/thread.inline.hpp"
 #include "services/threadService.hpp"
@@ -1282,7 +1283,7 @@
   OrderAccess::release_store(&_owner, (void*)NULL);
   OrderAccess::fence();                               // ST _owner vs LD in unpark()
 
-  if (SafepointSynchronize::do_call_back()) {
+  if (SafepointMechanism::poll(Self)) {
     TEVENT(unpark before SAFEPOINT);
   }
 
@@ -1936,7 +1937,7 @@
     // This is in keeping with the "no loitering in runtime" rule.
     // We periodically check to see if there's a safepoint pending.
     if ((ctr & 0xFF) == 0) {
-      if (SafepointSynchronize::do_call_back()) {
+      if (SafepointMechanism::poll(Self)) {
         TEVENT(Spin: safepoint);
         goto Abort;           // abrupt spin egress
       }
--- a/src/hotspot/share/runtime/safepoint.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/runtime/safepoint.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -52,6 +52,7 @@
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/safepoint.hpp"
+#include "runtime/safepointMechanism.inline.hpp"
 #include "runtime/signature.hpp"
 #include "runtime/stubCodeGenerator.hpp"
 #include "runtime/stubRoutines.hpp"
@@ -169,21 +170,32 @@
     int initial_running = 0;
 
     _state            = _synchronizing;
-    OrderAccess::fence();
+
+    if (SafepointMechanism::uses_thread_local_poll()) {
+      // Arming the per thread poll while having _state != _not_synchronized means safepointing
+      log_trace(safepoint)("Setting thread local yield flag for threads");
+      for (JavaThread *cur = Threads::first(); cur != NULL; cur = cur->next()) {
+        // Make sure the threads start polling, it is time to yield.
+        SafepointMechanism::arm_local_poll(cur); // release store, global state -> local state
+      }
+    }
+    OrderAccess::fence(); // storestore|storeload, global state -> local state
 
     // Flush all thread states to memory
     if (!UseMembar) {
       os::serialize_thread_states();
     }
 
-    // Make interpreter safepoint aware
-    Interpreter::notice_safepoints();
+    if (SafepointMechanism::uses_global_page_poll()) {
+      // Make interpreter safepoint aware
+      Interpreter::notice_safepoints();
 
-    if (DeferPollingPageLoopCount < 0) {
-      // Make polling safepoint aware
-      guarantee (PageArmed == 0, "invariant") ;
-      PageArmed = 1 ;
-      os::make_polling_page_unreadable();
+      if (DeferPollingPageLoopCount < 0) {
+        // Make polling safepoint aware
+        guarantee (PageArmed == 0, "invariant") ;
+        PageArmed = 1 ;
+        os::make_polling_page_unreadable();
+      }
     }
 
     // Consider using active_processor_count() ... but that call is expensive.
@@ -293,7 +305,7 @@
         // 9. On windows consider using the return value from SwitchThreadTo()
         //    to drive subsequent spin/SwitchThreadTo()/Sleep(N) decisions.
 
-        if (int(iterations) == DeferPollingPageLoopCount) {
+        if (SafepointMechanism::uses_global_page_poll() && int(iterations) == DeferPollingPageLoopCount) {
           guarantee (PageArmed == 0, "invariant") ;
           PageArmed = 1 ;
           os::make_polling_page_unreadable();
@@ -444,7 +456,7 @@
   // A pending_exception cannot be installed during a safepoint.  The threads
   // may install an async exception after they come back from a safepoint into
   // pending_exception after they unblock.  But that should happen later.
-  for(JavaThread *cur = Threads::first(); cur; cur = cur->next()) {
+  for (JavaThread *cur = Threads::first(); cur; cur = cur->next()) {
     assert (!(cur->has_pending_exception() &&
               cur->safepoint_state()->is_at_poll_safepoint()),
             "safepoint installed a pending exception");
@@ -452,46 +464,60 @@
 #endif // ASSERT
 
   if (PageArmed) {
+    assert(SafepointMechanism::uses_global_page_poll(), "sanity");
     // Make polling safepoint aware
     os::make_polling_page_readable();
     PageArmed = 0 ;
   }
 
-  // Remove safepoint check from interpreter
-  Interpreter::ignore_safepoints();
+  if (SafepointMechanism::uses_global_page_poll()) {
+    // Remove safepoint check from interpreter
+    Interpreter::ignore_safepoints();
+  }
 
   {
     MutexLocker mu(Safepoint_lock);
 
     assert(_state == _synchronized, "must be synchronized before ending safepoint synchronization");
 
-    // Set to not synchronized, so the threads will not go into the signal_thread_blocked method
-    // when they get restarted.
-    _state = _not_synchronized;
-    OrderAccess::fence();
+    if (SafepointMechanism::uses_thread_local_poll()) {
+      _state = _not_synchronized;
+      OrderAccess::storestore(); // global state -> local state
+      for (JavaThread *current = Threads::first(); current; current = current->next()) {
+        ThreadSafepointState* cur_state = current->safepoint_state();
+        cur_state->restart(); // TSS _running
+        SafepointMechanism::disarm_local_poll(current); // release store, local state -> polling page
+      }
+      log_debug(safepoint)("Leaving safepoint region");
+    } else {
+      // Set to not synchronized, so the threads will not go into the signal_thread_blocked method
+      // when they get restarted.
+      _state = _not_synchronized;
+      OrderAccess::fence();
 
-    log_debug(safepoint)("Leaving safepoint region");
+      log_debug(safepoint)("Leaving safepoint region");
 
-    // Start suspended threads
-    for(JavaThread *current = Threads::first(); current; current = current->next()) {
-      // A problem occurring on Solaris is when attempting to restart threads
-      // the first #cpus - 1 go well, but then the VMThread is preempted when we get
-      // to the next one (since it has been running the longest).  We then have
-      // to wait for a cpu to become available before we can continue restarting
-      // threads.
-      // FIXME: This causes the performance of the VM to degrade when active and with
-      // large numbers of threads.  Apparently this is due to the synchronous nature
-      // of suspending threads.
-      //
-      // TODO-FIXME: the comments above are vestigial and no longer apply.
-      // Furthermore, using solaris' schedctl in this particular context confers no benefit
-      if (VMThreadHintNoPreempt) {
-        os::hint_no_preempt();
+      // Start suspended threads
+      for (JavaThread *current = Threads::first(); current; current = current->next()) {
+        // A problem occurring on Solaris is when attempting to restart threads
+        // the first #cpus - 1 go well, but then the VMThread is preempted when we get
+        // to the next one (since it has been running the longest).  We then have
+        // to wait for a cpu to become available before we can continue restarting
+        // threads.
+        // FIXME: This causes the performance of the VM to degrade when active and with
+        // large numbers of threads.  Apparently this is due to the synchronous nature
+        // of suspending threads.
+        //
+        // TODO-FIXME: the comments above are vestigial and no longer apply.
+        // Furthermore, using solaris' schedctl in this particular context confers no benefit
+        if (VMThreadHintNoPreempt) {
+          os::hint_no_preempt();
+        }
+        ThreadSafepointState* cur_state = current->safepoint_state();
+        assert(cur_state->type() != ThreadSafepointState::_running, "Thread not suspended at safepoint");
+        cur_state->restart();
+        assert(cur_state->is_running(), "safepoint state has not been reset");
       }
-      ThreadSafepointState* cur_state = current->safepoint_state();
-      assert(cur_state->type() != ThreadSafepointState::_running, "Thread not suspended at safepoint");
-      cur_state->restart();
-      assert(cur_state->is_running(), "safepoint state has not been reset");
     }
 
     RuntimeService::record_safepoint_end();
@@ -855,7 +881,9 @@
 void SafepointSynchronize::handle_polling_page_exception(JavaThread *thread) {
   assert(thread->is_Java_thread(), "polling reference encountered by VM thread");
   assert(thread->thread_state() == _thread_in_Java, "should come from Java code");
-  assert(SafepointSynchronize::is_synchronizing(), "polling encountered outside safepoint synchronization");
+  if (!ThreadLocalHandshakes) {
+    assert(SafepointSynchronize::is_synchronizing(), "polling encountered outside safepoint synchronization");
+  }
 
   if (ShowSafepointMsgs) {
     tty->print("handle_polling_page_exception: ");
@@ -887,7 +915,7 @@
     tty->print_cr("# SafepointSynchronize::begin: Threads which did not reach the safepoint:");
     ThreadSafepointState *cur_state;
     ResourceMark rm;
-    for(JavaThread *cur_thread = Threads::first(); cur_thread;
+    for (JavaThread *cur_thread = Threads::first(); cur_thread;
         cur_thread = cur_thread->next()) {
       cur_state = cur_thread->safepoint_state();
 
@@ -1053,13 +1081,14 @@
 
 // ---------------------------------------------------------------------------------------------------------------------
 
-// Block the thread at the safepoint poll or poll return.
+// Block the thread at poll or poll return for safepoint/handshake.
 void ThreadSafepointState::handle_polling_page_exception() {
 
   // Check state.  block() will set thread state to thread_in_vm which will
   // cause the safepoint state _type to become _call_back.
-  assert(type() == ThreadSafepointState::_running,
-         "polling page exception on thread not running state");
+  suspend_type t = type();
+  assert(!SafepointMechanism::uses_global_page_poll() || t == ThreadSafepointState::_running,
+         "polling page exception on thread not running state: %u", uint(t));
 
   // Step 1: Find the nmethod from the return address
   if (ShowSafepointMsgs && Verbose) {
@@ -1101,7 +1130,7 @@
     }
 
     // Block the thread
-    SafepointSynchronize::block(thread());
+    SafepointMechanism::block_if_requested(thread());
 
     // restore oop result, if any
     if (return_oop) {
@@ -1117,7 +1146,7 @@
     assert(real_return_addr == caller_fr.pc(), "must match");
 
     // Block the thread
-    SafepointSynchronize::block(thread());
+    SafepointMechanism::block_if_requested(thread());
     set_at_poll_safepoint(false);
 
     // If we have a pending async exception deoptimize the frame
@@ -1398,7 +1427,7 @@
     tty->print_cr("State: %s", (_state == _synchronizing) ? "synchronizing" :
                   "synchronized");
 
-    for(JavaThread *cur = Threads::first(); cur; cur = cur->next()) {
+    for (JavaThread *cur = Threads::first(); cur; cur = cur->next()) {
        cur->safepoint_state()->print();
     }
   }
--- a/src/hotspot/share/runtime/safepoint.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/runtime/safepoint.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -160,17 +160,22 @@
   inline static bool is_synchronizing()  { return _state == _synchronizing;  }
   inline static int safepoint_counter()  { return _safepoint_counter; }
 
-  inline static bool do_call_back() {
-    return (_state != _not_synchronized);
-  }
-
   inline static void increment_jni_active_count() {
     assert_locked_or_safepoint(Safepoint_lock);
     _current_jni_active_count++;
   }
 
+private:
+  inline static bool do_call_back() {
+    return (_state != _not_synchronized);
+  }
+
   // Called when a thread voluntarily blocks
   static void   block(JavaThread *thread);
+
+  friend class SafepointMechanism;
+
+public:
   static void   signal_thread_at_safepoint()              { _waiting_to_block--; }
 
   // Exception handling for page polling
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/runtime/safepointMechanism.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "logging/log.hpp"
+#include "runtime/globals.hpp"
+#include "runtime/os.hpp"
+#include "runtime/safepointMechanism.inline.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+SafepointMechanism::PollingType SafepointMechanism::_polling_type = SafepointMechanism::_global_page_poll;
+void* SafepointMechanism::_poll_armed_value;
+void* SafepointMechanism::_poll_disarmed_value;
+
+void SafepointMechanism::default_initialize() {
+  if (ThreadLocalHandshakes) {
+    set_uses_thread_local_poll();
+    const size_t page_size = os::vm_page_size();
+    const size_t allocation_size = 2 * page_size;
+    char* polling_page = os::reserve_memory(allocation_size, NULL, page_size);
+    os::commit_memory_or_exit(polling_page, allocation_size, false, "Unable to commit Safepoint polling page");
+
+    char* bad_page  = polling_page;
+    char* good_page = polling_page + page_size;
+
+    os::protect_memory(bad_page, page_size, os::MEM_PROT_NONE);
+    os::protect_memory(good_page, page_size, os::MEM_PROT_READ);
+
+    log_info(os)("SafePoint Polling address, bad (protected) page:" INTPTR_FORMAT ", good (unprotected) page:" INTPTR_FORMAT, p2i(bad_page), p2i(good_page));
+    os::set_polling_page((address)(bad_page));
+
+    intptr_t poll_page_val = reinterpret_cast<intptr_t>(bad_page);
+    _poll_armed_value = reinterpret_cast<void*>(poll_page_val | poll_bit());
+    _poll_disarmed_value = good_page;
+  } else {
+    const size_t page_size = os::vm_page_size();
+    char* polling_page = os::reserve_memory(page_size, NULL, page_size);
+    os::commit_memory_or_exit(polling_page, page_size, false, "Unable to commit Safepoint polling page");
+    os::protect_memory(polling_page, page_size, os::MEM_PROT_READ);
+
+    log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(polling_page));
+    os::set_polling_page((address)(polling_page));
+  }
+}
+
+void SafepointMechanism::initialize_header(JavaThread* thread) {
+  disarm_local_poll(thread);
+}
+
+void SafepointMechanism::initialize_serialize_page() {
+  if (!UseMembar) {
+    const size_t page_size = os::vm_page_size();
+    char* serialize_page = os::reserve_memory(page_size, NULL, page_size);
+    os::commit_memory_or_exit(serialize_page, page_size, false, "Unable to commit memory serialization page");
+    log_info(os)("Memory Serialize Page address: " INTPTR_FORMAT, p2i(serialize_page));
+    os::set_memory_serialize_page((address)(serialize_page));
+  }
+}
+
+void SafepointMechanism::initialize() {
+  pd_initialize();
+  initialize_serialize_page();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/runtime/safepointMechanism.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+#ifndef SHARE_VM_RUNTIME_SAFEPOINTMECHANISM_HPP
+#define SHARE_VM_RUNTIME_SAFEPOINTMECHANISM_HPP
+
+#include "runtime/globals.hpp"
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
+#include "utilities/sizes.hpp"
+
+// This is the abstracted interface for the safepoint implementation
+class SafepointMechanism : public AllStatic {
+  enum PollingType {
+    _global_page_poll,
+    _thread_local_poll
+  };
+  static PollingType _polling_type;
+  static void* _poll_armed_value;
+  static void* _poll_disarmed_value;
+  static void set_uses_thread_local_poll()            { _polling_type     = _thread_local_poll; }
+
+  static void* poll_armed_value()                     { return _poll_armed_value; }
+  static void* poll_disarmed_value()                  { return _poll_disarmed_value; }
+
+  static inline bool local_poll_armed(JavaThread* thread);
+
+  static inline bool local_poll(Thread* thread);
+  static inline bool global_poll();
+
+  static inline void block_if_requested_local_poll(JavaThread *thread);
+
+  static void default_initialize();
+  static void initialize_serialize_page();
+
+  static void pd_initialize() NOT_AIX({ default_initialize(); });
+
+  // By adding 8 to the base address of the protected polling page we can differentiate
+  // between the armed and disarmed value by masking out this bit.
+  const static intptr_t _poll_bit = 8;
+public:
+  static intptr_t poll_bit() { return _poll_bit; }
+
+  static bool uses_global_page_poll() { return _polling_type == _global_page_poll; }
+  static bool uses_thread_local_poll() { return _polling_type == _thread_local_poll; }
+
+  static bool supports_thread_local_poll() {
+#ifdef THREAD_LOCAL_POLL
+    return true;
+#else
+    return false;
+#endif
+  }
+
+  // Call this method to see if this thread has depending poll and appropriate action should be taken
+  static inline bool poll(Thread* thread);
+
+  // Blocks a thread until safepoint is completed
+  static inline void block_if_requested(JavaThread* thread);
+
+  static inline void arm_local_poll(JavaThread* thread);
+  static inline void disarm_local_poll(JavaThread* thread);
+
+  // Setup the selected safepoint mechanism
+  static void initialize();
+  static void initialize_header(JavaThread* thread);
+};
+
+#endif // SHARE_VM_RUNTIME_SAFEPOINTMECHANISM_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/runtime/safepointMechanism.inline.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+#ifndef SHARE_VM_RUNTIME_SAFEPOINTMECHANISM_INLINE_HPP
+#define SHARE_VM_RUNTIME_SAFEPOINTMECHANISM_INLINE_HPP
+
+#include "runtime/safepointMechanism.hpp"
+#include "runtime/safepoint.hpp"
+#include "runtime/thread.inline.hpp"
+
+bool SafepointMechanism::local_poll_armed(JavaThread* thread) {
+  const intptr_t poll_word = reinterpret_cast<intptr_t>(thread->get_polling_page());
+  return mask_bits_are_true(poll_word, poll_bit());
+}
+
+bool SafepointMechanism::global_poll() {
+  return SafepointSynchronize::do_call_back();
+}
+
+bool SafepointMechanism::local_poll(Thread* thread) {
+  if (thread->is_Java_thread()) {
+    return local_poll_armed((JavaThread*)thread);
+  } else {
+    // If the poll is on a non-java thread we can only check the global state.
+    return global_poll();
+  }
+}
+
+bool SafepointMechanism::poll(Thread* thread) {
+  if (uses_thread_local_poll()) {
+    return local_poll(thread);
+  } else {
+    return global_poll();
+  }
+}
+
+void SafepointMechanism::block_if_requested_local_poll(JavaThread *thread) {
+  bool armed = local_poll_armed(thread); // load acquire, polling page -> op / global state
+  if(armed) {
+    // We could be armed for either a handshake operation or a safepoint
+    if (thread->has_handshake()) {
+      thread->handshake_process_by_self();
+    } else {
+      if (global_poll()) {
+        SafepointSynchronize::block(thread);
+      }
+    }
+  }
+}
+
+void SafepointMechanism::block_if_requested(JavaThread *thread) {
+  if (uses_thread_local_poll()) {
+    block_if_requested_local_poll(thread);
+  } else {
+    // If we don't have per thread poll this could a handshake or a safepoint
+    if (global_poll()) {
+      SafepointSynchronize::block(thread);
+    }
+  }
+}
+
+void SafepointMechanism::arm_local_poll(JavaThread* thread) {
+  thread->set_polling_page(poll_armed_value());
+}
+
+void SafepointMechanism::disarm_local_poll(JavaThread* thread) {
+  thread->set_polling_page(poll_disarmed_value());
+}
+
+#endif // SHARE_VM_RUNTIME_SAFEPOINTMECHANISM_INLINE_HPP
--- a/src/hotspot/share/runtime/thread.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/runtime/thread.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -65,6 +65,7 @@
 #include "runtime/deoptimization.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/globals.hpp"
+#include "runtime/handshake.hpp"
 #include "runtime/init.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/java.hpp"
@@ -77,6 +78,7 @@
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/safepoint.hpp"
+#include "runtime/safepointMechanism.inline.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/statSampler.hpp"
 #include "runtime/stubRoutines.hpp"
@@ -1494,6 +1496,10 @@
   _popframe_preserved_args_size = 0;
   _frames_to_pop_failed_realloc = 0;
 
+  if (SafepointMechanism::uses_thread_local_poll()) {
+    SafepointMechanism::initialize_header(this);
+  }
+
   pd_initialize();
 }
 
@@ -1910,6 +1916,11 @@
 
   // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
   Threads::remove(this);
+
+  // If someone set a handshake on us just as we entered exit path, we simple cancel it.
+  if (ThreadLocalHandshakes) {
+    cancel_handshake();
+  }
 }
 
 #if INCLUDE_ALL_GCS
@@ -2372,11 +2383,7 @@
     InterfaceSupport::serialize_thread_state_with_handler(thread);
   }
 
-  if (SafepointSynchronize::do_call_back()) {
-    // If we are safepointing, then block the caller which may not be
-    // the same as the target thread (see above).
-    SafepointSynchronize::block(curJT);
-  }
+  SafepointMechanism::block_if_requested(curJT);
 
   if (thread->is_deopt_suspend()) {
     thread->clear_deopt_suspend();
@@ -3551,6 +3558,8 @@
   // Timing (must come after argument parsing)
   TraceTime timer("Create VM", TRACETIME_LOG(Info, startuptime));
 
+  SafepointMechanism::initialize();
+
   // Initialize the os module after parsing the args
   jint os_init_2_result = os::init_2();
   if (os_init_2_result != JNI_OK) return os_init_2_result;
--- a/src/hotspot/share/runtime/thread.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/runtime/thread.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -31,6 +31,7 @@
 #include "oops/oop.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "runtime/frame.hpp"
+#include "runtime/handshake.hpp"
 #include "runtime/javaFrameAnchor.hpp"
 #include "runtime/jniHandles.hpp"
 #include "runtime/mutexLocker.hpp"
@@ -271,6 +272,8 @@
   friend class PauseNoSafepointVerifier;
   friend class GCLocker;
 
+  volatile void* _polling_page;                 // Thread local polling page
+
   ThreadLocalAllocBuffer _tlab;                 // Thread-local eden
   jlong _allocated_bytes;                       // Cumulative number of bytes allocated on
                                                 // the Java heap
@@ -549,6 +552,8 @@
   uintptr_t        _self_raw_id;      // used by get_thread (mutable)
   int              _lgrp_id;
 
+  volatile void** polling_page_addr() { return &_polling_page; }
+
  public:
   // Stack overflow support
   address stack_base() const           { assert(_stack_base != NULL,"Sanity check"); return _stack_base; }
@@ -617,6 +622,8 @@
   static ByteSize stack_base_offset()            { return byte_offset_of(Thread, _stack_base); }
   static ByteSize stack_size_offset()            { return byte_offset_of(Thread, _stack_size); }
 
+  static ByteSize polling_page_offset()          { return byte_offset_of(Thread, _polling_page); }
+
 #define TLAB_FIELD_OFFSET(name) \
   static ByteSize tlab_##name##_offset()         { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::name##_offset(); }
 
@@ -1135,6 +1142,33 @@
   bool do_not_unlock_if_synchronized()             { return _do_not_unlock_if_synchronized; }
   void set_do_not_unlock_if_synchronized(bool val) { _do_not_unlock_if_synchronized = val; }
 
+  inline void set_polling_page(void* poll_value);
+  inline volatile void* get_polling_page();
+
+ private:
+  // Support for thread handshake operations
+  HandshakeState _handshake;
+ public:
+  void set_handshake_operation(HandshakeOperation* op) {
+    _handshake.set_operation(this, op);
+  }
+
+  bool has_handshake() const {
+    return _handshake.has_operation();
+  }
+
+  void cancel_handshake() {
+    _handshake.cancel(this);
+  }
+
+  void handshake_process_by_self() {
+    _handshake.process_by_self(this);
+  }
+
+  void handshake_process_by_vmthread() {
+    _handshake.process_by_vmthread(this);
+  }
+
   // Suspend/resume support for JavaThread
  private:
   inline void set_ext_suspended();
--- a/src/hotspot/share/runtime/thread.inline.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/runtime/thread.inline.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -163,4 +163,16 @@
   return _stack_guard_state == stack_guard_enabled;
 }
 
+// The release make sure this store is done after storing the handshake
+// operation or global state
+inline void JavaThread::set_polling_page(void* poll_value) {
+  OrderAccess::release_store(polling_page_addr(), poll_value);
+}
+
+// The aqcquire make sure reading of polling page is done before
+// the reading the handshake operation or the global state
+inline volatile void* JavaThread::get_polling_page() {
+  return OrderAccess::load_acquire(polling_page_addr());
+}
+
 #endif // SHARE_VM_RUNTIME_THREAD_INLINE_HPP
--- a/src/hotspot/share/runtime/timer.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/runtime/timer.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -37,6 +37,11 @@
   return counter_to_seconds(counter) * 1000.0;
 }
 
+jlong TimeHelper::millis_to_counter(jlong millis) {
+  jlong freq = os::elapsed_frequency() / MILLIUNITS;
+  return millis * freq;
+}
+
 elapsedTimer::elapsedTimer(jlong time, jlong timeUnitsPerSecond) {
   _active = false;
   jlong osTimeUnitsPerSecond = os::elapsed_frequency();
--- a/src/hotspot/share/runtime/timer.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/runtime/timer.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -93,6 +93,7 @@
  public:
   static double counter_to_seconds(jlong counter);
   static double counter_to_millis(jlong counter);
+  static jlong millis_to_counter(jlong millis);
 };
 
 #endif // SHARE_VM_RUNTIME_TIMER_HPP
--- a/src/hotspot/share/runtime/vm_operations.hpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/runtime/vm_operations.hpp	Wed Nov 15 08:25:28 2017 -0500
@@ -69,6 +69,9 @@
   template(G1CollectFull)                         \
   template(G1CollectForAllocation)                \
   template(G1IncCollectionPause)                  \
+  template(HandshakeOneThread)                    \
+  template(HandshakeAllThreads)                   \
+  template(HandshakeFallback)                     \
   template(DestroyAllocationContext)              \
   template(EnableBiasedLocking)                   \
   template(RevokeBias)                            \
--- a/src/hotspot/share/utilities/debug.cpp	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/hotspot/share/utilities/debug.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -631,6 +631,27 @@
   VMError::print_native_stack(tty, fr, t, buf, sizeof(buf));
 }
 
+//
+// This version of pns() will not work when called from the debugger, but is
+// useful when called from within hotspot code. The advantages over pns()
+// are not having to pass in any arguments, and it will work on Windows/x64.
+//
+// WARNING: Only intended for use when debugging. Do not leave calls to
+// pns2() in committed source (product or debug).
+//
+extern "C" void pns2() { // print native stack
+  Command c("pns2");
+  static char buf[O_BUFLEN];
+  if (os::platform_print_native_stack(tty, NULL, buf, sizeof(buf))) {
+    // We have printed the native stack in platform-specific code,
+    // so nothing else to do in this case.
+  } else {
+    Thread* t = Thread::current_or_null();
+    frame fr = os::current_frame();
+    VMError::print_native_stack(tty, fr, t, buf, sizeof(buf));
+  }
+}
+
 #endif // !PRODUCT
 
 //////////////////////////////////////////////////////////////////////////////
--- a/src/java.base/share/classes/java/time/format/ZoneName.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/java.base/share/classes/java/time/format/ZoneName.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, 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
@@ -192,7 +192,7 @@
         "Africa/Ndjamena", "Africa_Western", "Africa/Lagos",
         "Asia/Macau", "China", "Asia/Shanghai",
         "America/Lima", "Peru", "America/Lima",
-        "Africa/Windhoek", "Africa_Western", "Africa/Lagos",
+        "Africa/Windhoek", "Africa_Central", "Africa/Maputo",
         "America/Sitka", "Alaska", "America/Juneau",
         "America/Mazatlan", "America_Mountain", "America/Denver",
         "Asia/Saigon", "Indochina", "Asia/Saigon",
@@ -324,7 +324,7 @@
         "Atlantic/Faroe", "Europe_Western", "Atlantic/Canary",
         "America/Cambridge_Bay", "America_Mountain", "America/Denver",
         "America/Los_Angeles", "America_Pacific", "America/Los_Angeles",
-        "Africa/Khartoum", "Africa_Eastern", "Africa/Nairobi",
+        "Africa/Khartoum", "Africa_Central", "Africa/Maputo",
         "Europe/Simferopol", "Europe_Eastern", "Europe/Bucharest",
         "Australia/Currie", "Australia_Eastern", "Australia/Sydney",
         "Europe/Guernsey", "GMT", "Atlantic/Reykjavik",
@@ -744,7 +744,6 @@
         "UTC", "Etc/UTC",
         "Canada/Newfoundland", "America/St_Johns",
         "Europe/Skopje", "Europe/Belgrade",
-        "Canada/East-Saskatchewan", "America/Regina",
         "PRC", "Asia/Shanghai",
         "UCT", "Etc/UCT",
         "America/Mendoza", "America/Argentina/Mendoza",
--- a/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java	Wed Nov 15 08:25:28 2017 -0500
@@ -695,8 +695,9 @@
      * stale pointer that is now off the list.
      */
     final Node<E> pred(Node<E> p) {
-        Node<E> q = p.prev;
-        return (p == q) ? last() : q;
+        if (p == (p = p.prev))
+            p = last();
+        return p;
     }
 
     /**
@@ -867,31 +868,31 @@
 
     public E peekFirst() {
         restart: for (;;) {
-            for (Node<E> first = first(), p = first;;) {
-                final E item;
-                if ((item = p.item) != null) {
-                    // recheck for linearizability
-                    if (first.prev != null) continue restart;
-                    return item;
-                }
-                if ((p = succ(p)) == null)
-                    return null;
+            E item;
+            Node<E> first = first(), p = first;
+            while ((item = p.item) == null) {
+                if (p == (p = p.next)) continue restart;
+                if (p == null)
+                    break;
             }
+            // recheck for linearizability
+            if (first.prev != null) continue restart;
+            return item;
         }
     }
 
     public E peekLast() {
         restart: for (;;) {
-            for (Node<E> last = last(), p = last;;) {
-                final E item;
-                if ((item = p.item) != null) {
-                    // recheck for linearizability
-                    if (last.next != null) continue restart;
-                    return item;
-                }
-                if ((p = pred(p)) == null)
-                    return null;
+            E item;
+            Node<E> last = last(), p = last;
+            while ((item = p.item) == null) {
+                if (p == (p = p.prev)) continue restart;
+                if (p == null)
+                    break;
             }
+            // recheck for linearizability
+            if (last.next != null) continue restart;
+            return item;
         }
     }
 
@@ -921,8 +922,11 @@
                         return item;
                     }
                 }
-                if ((p = succ(p)) == null)
+                if (p == (p = p.next)) continue restart;
+                if (p == null) {
+                    if (first.prev != null) continue restart;
                     return null;
+                }
             }
         }
     }
@@ -939,8 +943,11 @@
                         return item;
                     }
                 }
-                if ((p = pred(p)) == null)
+                if (p == (p = p.prev)) continue restart;
+                if (p == null) {
+                    if (last.next != null) continue restart;
                     return null;
+                }
             }
         }
     }
--- a/src/java.base/share/classes/sun/nio/ch/IOUtil.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/java.base/share/classes/sun/nio/ch/IOUtil.java	Wed Nov 15 08:25:28 2017 -0500
@@ -297,7 +297,7 @@
                      NativeDispatcher nd)
         throws IOException
     {
-        return read(fd, bufs, offset, bufs.length, false, -1, nd);
+        return read(fd, bufs, offset, length, false, -1, nd);
     }
 
     static long read(FileDescriptor fd, ByteBuffer[] bufs, int offset, int length,
--- a/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, 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
@@ -349,7 +349,7 @@
             {"Africa/Johannesburg", SAST},
             {"Africa/Juba", EAT},
             {"Africa/Kampala", EAT},
-            {"Africa/Khartoum", EAT},
+            {"Africa/Khartoum", CAT},
             {"Africa/Kigali", CAT},
             {"Africa/Kinshasa", WAT},
             {"Africa/Lagos", WAT},
@@ -374,7 +374,7 @@
             {"Africa/Timbuktu", GMT},
             {"Africa/Tripoli", EET},
             {"Africa/Tunis", CET},
-            {"Africa/Windhoek", WAT},
+            {"Africa/Windhoek", CAT},
             {"America/Adak", HST},
             {"America/Anguilla", AST},
             {"America/Antigua", AST},
@@ -777,7 +777,6 @@
             {"Brazil/West", AMT},
             {"Canada/Atlantic", AST},
             {"Canada/Central", CST},
-            {"Canada/East-Saskatchewan", CST},
             {"Canada/Eastern", EST},
             {"Canada/Mountain", MST},
             {"Canada/Newfoundland", NST},
--- a/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, 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
@@ -85,10 +85,18 @@
 
     protected Set<SocketOption<?>> supportedOptions() {
         HashSet<SocketOption<?>> options = new HashSet<>(super.supportedOptions());
-        options.addAll(extendedOptions.options());
+        addExtSocketOptions(extendedOptions.options(), options);
         return options;
     }
 
+    private void addExtSocketOptions(Set<SocketOption<?>> extOptions,
+                                     Set<SocketOption<?>> options) {
+        // TCP_QUICKACK is applicable for TCP Sockets only.
+        extOptions.stream()
+                .filter((option) -> !option.name().equals("TCP_QUICKACK"))
+                .forEach((option) -> options.add(option));
+    }
+
     protected void socketSetOption(int opt, Object val) throws SocketException {
         if (opt == SocketOptions.SO_REUSEPORT &&
             !supportedOptions().contains(StandardSocketOptions.SO_REUSEPORT)) {
--- a/src/java.logging/share/classes/java/util/logging/FileHandler.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/java.logging/share/classes/java/util/logging/FileHandler.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, 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
@@ -616,79 +616,96 @@
      * @throws IOException
      */
     private File generate(String pattern, int generation, int unique)
-            throws IOException {
-        File file = null;
-        String word = "";
-        int ix = 0;
+            throws IOException
+    {
+        return generate(pattern, count, generation, unique);
+    }
+
+    // The static method here is provided for whitebox testing of the algorithm.
+    static File generate(String pat, int count, int generation, int unique)
+            throws IOException
+    {
+        Path path = Paths.get(pat);
+        Path result = null;
         boolean sawg = false;
         boolean sawu = false;
-        while (ix < pattern.length()) {
-            char ch = pattern.charAt(ix);
-            ix++;
-            char ch2 = 0;
-            if (ix < pattern.length()) {
-                ch2 = Character.toLowerCase(pattern.charAt(ix));
+        StringBuilder word = new StringBuilder();
+        Path prev = null;
+        for (Path elem : path) {
+            if (prev != null) {
+                prev = prev.resolveSibling(word.toString());
+                result = result == null ? prev : result.resolve(prev);
             }
-            if (ch == '/') {
-                if (file == null) {
-                    file = new File(word);
-                } else {
-                    file = new File(file, word);
+            String pattern = elem.toString();
+            int ix = 0;
+            word.setLength(0);
+            while (ix < pattern.length()) {
+                char ch = pattern.charAt(ix);
+                ix++;
+                char ch2 = 0;
+                if (ix < pattern.length()) {
+                    ch2 = Character.toLowerCase(pattern.charAt(ix));
                 }
-                word = "";
-                continue;
-            } else  if (ch == '%') {
-                if (ch2 == 't') {
-                    String tmpDir = System.getProperty("java.io.tmpdir");
-                    if (tmpDir == null) {
-                        tmpDir = System.getProperty("user.home");
+                if (ch == '%') {
+                    if (ch2 == 't') {
+                        String tmpDir = System.getProperty("java.io.tmpdir");
+                        if (tmpDir == null) {
+                            tmpDir = System.getProperty("user.home");
+                        }
+                        result = Paths.get(tmpDir);
+                        ix++;
+                        word.setLength(0);
+                        continue;
+                    } else if (ch2 == 'h') {
+                        result = Paths.get(System.getProperty("user.home"));
+                        if (jdk.internal.misc.VM.isSetUID()) {
+                            // Ok, we are in a set UID program.  For safety's sake
+                            // we disallow attempts to open files relative to %h.
+                            throw new IOException("can't use %h in set UID program");
+                        }
+                        ix++;
+                        word.setLength(0);
+                        continue;
+                    } else if (ch2 == 'g') {
+                        word = word.append(generation);
+                        sawg = true;
+                        ix++;
+                        continue;
+                    } else if (ch2 == 'u') {
+                        word = word.append(unique);
+                        sawu = true;
+                        ix++;
+                        continue;
+                    } else if (ch2 == '%') {
+                        word = word.append('%');
+                        ix++;
+                        continue;
                     }
-                    file = new File(tmpDir);
-                    ix++;
-                    word = "";
-                    continue;
-                } else if (ch2 == 'h') {
-                    file = new File(System.getProperty("user.home"));
-                    if (jdk.internal.misc.VM.isSetUID()) {
-                        // Ok, we are in a set UID program.  For safety's sake
-                        // we disallow attempts to open files relative to %h.
-                        throw new IOException("can't use %h in set UID program");
-                    }
-                    ix++;
-                    word = "";
-                    continue;
-                } else if (ch2 == 'g') {
-                    word = word + generation;
-                    sawg = true;
-                    ix++;
-                    continue;
-                } else if (ch2 == 'u') {
-                    word = word + unique;
-                    sawu = true;
-                    ix++;
-                    continue;
-                } else if (ch2 == '%') {
-                    word = word + "%";
-                    ix++;
-                    continue;
                 }
+                word = word.append(ch);
             }
-            word = word + ch;
+            prev = elem;
         }
+
         if (count > 1 && !sawg) {
-            word = word + "." + generation;
+            word = word.append('.').append(generation);
         }
         if (unique > 0 && !sawu) {
-            word = word + "." + unique;
+            word = word.append('.').append(unique);
         }
         if (word.length() > 0) {
-            if (file == null) {
-                file = new File(word);
-            } else {
-                file = new File(file, word);
-            }
+            String n = word.toString();
+            Path p = prev == null ? Paths.get(n) : prev.resolveSibling(n);
+            result = result == null ? p : result.resolve(p);
+        } else if (result == null) {
+            result = Paths.get("");
         }
-        return file;
+
+        if (path.getRoot() == null) {
+            return result.toFile();
+        } else {
+            return path.getRoot().resolve(result).toFile();
+        }
     }
 
     /**
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GCName.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GCName.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, 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
@@ -36,6 +36,7 @@
   G1New ("G1New"),
   ConcurrentMarkSweep ("ConcurrentMarkSweep"),
   G1Old ("G1Old"),
+  G1Full ("G1Full"),
   GCNameEndSentinel ("GCNameEndSentinel");
 
   private final String value;
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java	Wed Nov 15 08:25:28 2017 -0500
@@ -76,7 +76,7 @@
 
     @Override
     public int hashCode() {
-        return offset ^ modifiers;
+        return holder.hashCode() ^ offset;
     }
 
     @Override
--- a/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_de.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_de.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -350,7 +350,7 @@
             {"Africa/Johannesburg", SAST},
             {"Africa/Juba", EAT},
             {"Africa/Kampala", EAT},
-            {"Africa/Khartoum", EAT},
+            {"Africa/Khartoum", CAT},
             {"Africa/Kigali", CAT},
             {"Africa/Kinshasa", WAT},
             {"Africa/Lagos", WAT},
@@ -375,7 +375,7 @@
             {"Africa/Timbuktu", GMT},
             {"Africa/Tripoli", EET},
             {"Africa/Tunis", CET},
-            {"Africa/Windhoek", WAT},
+            {"Africa/Windhoek", CAT},
             {"America/Adak", HST},
             {"America/Anguilla", AST},
             {"America/Antigua", AST},
@@ -778,7 +778,6 @@
             {"Brazil/West", AMT},
             {"Canada/Atlantic", AST},
             {"Canada/Central", CST},
-            {"Canada/East-Saskatchewan", CST},
             {"Canada/Eastern", EST},
             {"Canada/Mountain", MST},
             {"Canada/Newfoundland", NST},
--- a/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_es.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_es.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -350,7 +350,7 @@
             {"Africa/Johannesburg", SAST},
             {"Africa/Juba", EAT},
             {"Africa/Kampala", EAT},
-            {"Africa/Khartoum", EAT},
+            {"Africa/Khartoum", CAT},
             {"Africa/Kigali", CAT},
             {"Africa/Kinshasa", WAT},
             {"Africa/Lagos", WAT},
@@ -375,7 +375,7 @@
             {"Africa/Timbuktu", GMT},
             {"Africa/Tripoli", EET},
             {"Africa/Tunis", CET},
-            {"Africa/Windhoek", WAT},
+            {"Africa/Windhoek", CAT},
             {"America/Adak", HST},
             {"America/Anguilla", AST},
             {"America/Antigua", AST},
@@ -778,7 +778,6 @@
             {"Brazil/West", AMT},
             {"Canada/Atlantic", AST},
             {"Canada/Central", CST},
-            {"Canada/East-Saskatchewan", CST},
             {"Canada/Eastern", EST},
             {"Canada/Mountain", MST},
             {"Canada/Newfoundland", NST},
--- a/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_fr.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_fr.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -350,7 +350,7 @@
             {"Africa/Johannesburg", SAST},
             {"Africa/Juba", EAT},
             {"Africa/Kampala", EAT},
-            {"Africa/Khartoum", EAT},
+            {"Africa/Khartoum", CAT},
             {"Africa/Kigali", CAT},
             {"Africa/Kinshasa", WAT},
             {"Africa/Lagos", WAT},
@@ -375,7 +375,7 @@
             {"Africa/Timbuktu", GMT},
             {"Africa/Tripoli", EET},
             {"Africa/Tunis", CET},
-            {"Africa/Windhoek", WAT},
+            {"Africa/Windhoek", CAT},
             {"America/Adak", HST},
             {"America/Anguilla", AST},
             {"America/Antigua", AST},
@@ -778,7 +778,6 @@
             {"Brazil/West", AMT},
             {"Canada/Atlantic", AST},
             {"Canada/Central", CST},
-            {"Canada/East-Saskatchewan", CST},
             {"Canada/Eastern", EST},
             {"Canada/Mountain", MST},
             {"Canada/Newfoundland", NST},
--- a/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_it.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_it.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -350,7 +350,7 @@
             {"Africa/Johannesburg", SAST},
             {"Africa/Juba", EAT},
             {"Africa/Kampala", EAT},
-            {"Africa/Khartoum", EAT},
+            {"Africa/Khartoum", CAT},
             {"Africa/Kigali", CAT},
             {"Africa/Kinshasa", WAT},
             {"Africa/Lagos", WAT},
@@ -375,7 +375,7 @@
             {"Africa/Timbuktu", GMT},
             {"Africa/Tripoli", EET},
             {"Africa/Tunis", CET},
-            {"Africa/Windhoek", WAT},
+            {"Africa/Windhoek", CAT},
             {"America/Adak", HST},
             {"America/Anguilla", AST},
             {"America/Antigua", AST},
@@ -778,7 +778,6 @@
             {"Brazil/West", AMT},
             {"Canada/Atlantic", AST},
             {"Canada/Central", CST},
-            {"Canada/East-Saskatchewan", CST},
             {"Canada/Eastern", EST},
             {"Canada/Mountain", MST},
             {"Canada/Newfoundland", NST},
--- a/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ja.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ja.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -350,7 +350,7 @@
             {"Africa/Johannesburg", SAST},
             {"Africa/Juba", EAT},
             {"Africa/Kampala", EAT},
-            {"Africa/Khartoum", EAT},
+            {"Africa/Khartoum", CAT},
             {"Africa/Kigali", CAT},
             {"Africa/Kinshasa", WAT},
             {"Africa/Lagos", WAT},
@@ -375,7 +375,7 @@
             {"Africa/Timbuktu", GMT},
             {"Africa/Tripoli", EET},
             {"Africa/Tunis", CET},
-            {"Africa/Windhoek", WAT},
+            {"Africa/Windhoek", CAT},
             {"America/Adak", HST},
             {"America/Anguilla", AST},
             {"America/Antigua", AST},
@@ -778,7 +778,6 @@
             {"Brazil/West", AMT},
             {"Canada/Atlantic", AST},
             {"Canada/Central", CST},
-            {"Canada/East-Saskatchewan", CST},
             {"Canada/Eastern", EST},
             {"Canada/Mountain", MST},
             {"Canada/Newfoundland", NST},
--- a/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ko.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ko.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -350,7 +350,7 @@
             {"Africa/Johannesburg", SAST},
             {"Africa/Juba", EAT},
             {"Africa/Kampala", EAT},
-            {"Africa/Khartoum", EAT},
+            {"Africa/Khartoum", CAT},
             {"Africa/Kigali", CAT},
             {"Africa/Kinshasa", WAT},
             {"Africa/Lagos", WAT},
@@ -375,7 +375,7 @@
             {"Africa/Timbuktu", GMT},
             {"Africa/Tripoli", EET},
             {"Africa/Tunis", CET},
-            {"Africa/Windhoek", WAT},
+            {"Africa/Windhoek", CAT},
             {"America/Adak", HST},
             {"America/Anguilla", AST},
             {"America/Antigua", AST},
@@ -778,7 +778,6 @@
             {"Brazil/West", AMT},
             {"Canada/Atlantic", AST},
             {"Canada/Central", CST},
-            {"Canada/East-Saskatchewan", CST},
             {"Canada/Eastern", EST},
             {"Canada/Mountain", MST},
             {"Canada/Newfoundland", NST},
--- a/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_pt_BR.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_pt_BR.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -350,7 +350,7 @@
             {"Africa/Johannesburg", SAST},
             {"Africa/Juba", EAT},
             {"Africa/Kampala", EAT},
-            {"Africa/Khartoum", EAT},
+            {"Africa/Khartoum", CAT},
             {"Africa/Kigali", CAT},
             {"Africa/Kinshasa", WAT},
             {"Africa/Lagos", WAT},
@@ -375,7 +375,7 @@
             {"Africa/Timbuktu", GMT},
             {"Africa/Tripoli", EET},
             {"Africa/Tunis", CET},
-            {"Africa/Windhoek", WAT},
+            {"Africa/Windhoek", CAT},
             {"America/Adak", HST},
             {"America/Anguilla", AST},
             {"America/Antigua", AST},
@@ -778,7 +778,6 @@
             {"Brazil/West", AMT},
             {"Canada/Atlantic", AST},
             {"Canada/Central", CST},
-            {"Canada/East-Saskatchewan", CST},
             {"Canada/Eastern", EST},
             {"Canada/Mountain", MST},
             {"Canada/Newfoundland", NST},
--- a/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_sv.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_sv.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -350,7 +350,7 @@
             {"Africa/Johannesburg", SAST},
             {"Africa/Juba", EAT},
             {"Africa/Kampala", EAT},
-            {"Africa/Khartoum", EAT},
+            {"Africa/Khartoum", CAT},
             {"Africa/Kigali", CAT},
             {"Africa/Kinshasa", WAT},
             {"Africa/Lagos", WAT},
@@ -375,7 +375,7 @@
             {"Africa/Timbuktu", GMT},
             {"Africa/Tripoli", EET},
             {"Africa/Tunis", CET},
-            {"Africa/Windhoek", WAT},
+            {"Africa/Windhoek", CAT},
             {"America/Adak", HST},
             {"America/Anguilla", AST},
             {"America/Antigua", AST},
@@ -778,7 +778,6 @@
             {"Brazil/West", AMT},
             {"Canada/Atlantic", AST},
             {"Canada/Central", CST},
-            {"Canada/East-Saskatchewan", CST},
             {"Canada/Eastern", EST},
             {"Canada/Mountain", MST},
             {"Canada/Newfoundland", NST},
--- a/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_CN.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_CN.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -350,7 +350,7 @@
             {"Africa/Johannesburg", SAST},
             {"Africa/Juba", EAT},
             {"Africa/Kampala", EAT},
-            {"Africa/Khartoum", EAT},
+            {"Africa/Khartoum", CAT},
             {"Africa/Kigali", CAT},
             {"Africa/Kinshasa", WAT},
             {"Africa/Lagos", WAT},
@@ -375,7 +375,7 @@
             {"Africa/Timbuktu", GMT},
             {"Africa/Tripoli", EET},
             {"Africa/Tunis", CET},
-            {"Africa/Windhoek", WAT},
+            {"Africa/Windhoek", CAT},
             {"America/Adak", HST},
             {"America/Anguilla", AST},
             {"America/Antigua", AST},
@@ -778,7 +778,6 @@
             {"Brazil/West", AMT},
             {"Canada/Atlantic", AST},
             {"Canada/Central", CST},
-            {"Canada/East-Saskatchewan", CST},
             {"Canada/Eastern", EST},
             {"Canada/Mountain", MST},
             {"Canada/Newfoundland", NST},
--- a/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_TW.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_TW.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -350,7 +350,7 @@
             {"Africa/Johannesburg", SAST},
             {"Africa/Juba", EAT},
             {"Africa/Kampala", EAT},
-            {"Africa/Khartoum", EAT},
+            {"Africa/Khartoum", CAT},
             {"Africa/Kigali", CAT},
             {"Africa/Kinshasa", WAT},
             {"Africa/Lagos", WAT},
@@ -375,7 +375,7 @@
             {"Africa/Timbuktu", GMT},
             {"Africa/Tripoli", EET},
             {"Africa/Tunis", CET},
-            {"Africa/Windhoek", WAT},
+            {"Africa/Windhoek", CAT},
             {"America/Adak", HST},
             {"America/Anguilla", AST},
             {"America/Antigua", AST},
@@ -780,7 +780,6 @@
             {"Brazil/West", AMT},
             {"Canada/Atlantic", AST},
             {"Canada/Central", CST},
-            {"Canada/East-Saskatchewan", CST},
             {"Canada/Eastern", EST},
             {"Canada/Mountain", MST},
             {"Canada/Newfoundland", NST},
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.net/linux/classes/jdk/net/LinuxSocketOptions.java	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2017, 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 jdk.net;
+
+import java.net.SocketException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import jdk.net.ExtendedSocketOptions.PlatformSocketOptions;
+
+class LinuxSocketOptions extends PlatformSocketOptions {
+
+    public LinuxSocketOptions() {
+    }
+
+    @Override
+    void setQuickAck(int fd, boolean on) throws SocketException {
+        setQuickAck0(fd, on);
+    }
+
+    @Override
+    boolean getQuickAck(int fd) throws SocketException {
+        return getQuickAck0(fd);
+    }
+
+    @Override
+    public boolean quickAckSupported() {
+        return quickAckSupported0();
+    }
+
+    native static private void setQuickAck0(int fd, boolean on) throws SocketException;
+
+    native static private boolean getQuickAck0(int fd) throws SocketException;
+
+    native static private boolean quickAckSupported0();
+
+    static {
+        AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
+            System.loadLibrary("extnet");
+            return null;
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2017, 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.
+ */
+#include <sys/socket.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+
+#include <jni.h>
+#include <netinet/tcp.h>
+#include "jni_util.h"
+
+/*
+ * Class:     jdk_net_LinuxSocketOptions
+ * Method:    setQuickAck
+ * Signature: (II)V
+ */
+JNIEXPORT void JNICALL Java_jdk_net_LinuxSocketOptions_setQuickAck0
+(JNIEnv *env, jobject unused, jint fd, jboolean on) {
+    int optval;
+    int rv;
+    optval = (on ? 1 : 0);
+    rv = setsockopt(fd, SOL_SOCKET, TCP_QUICKACK, &optval, sizeof (optval));
+    if (rv < 0) {
+        if (errno == ENOPROTOOPT) {
+            JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
+                            "unsupported socket option");
+        } else {
+            JNU_ThrowByNameWithLastError(env, "java/net/SocketException",
+                                        "set option TCP_QUICKACK failed");
+        }
+    }
+}
+
+/*
+ * Class:     jdk_net_LinuxSocketOptions
+ * Method:    getQuickAck
+ * Signature: (I)Z;
+ */
+JNIEXPORT jboolean JNICALL Java_jdk_net_LinuxSocketOptions_getQuickAck0
+(JNIEnv *env, jobject unused, jint fd) {
+    int on;
+    socklen_t sz = sizeof (on);
+    int rv = getsockopt(fd, SOL_SOCKET, TCP_QUICKACK, &on, &sz);
+    if (rv < 0) {
+        if (errno == ENOPROTOOPT) {
+            JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
+                            "unsupported socket option");
+        } else {
+            JNU_ThrowByNameWithLastError(env, "java/net/SocketException",
+                                        "get option TCP_QUICKACK failed");
+        }
+    }
+    return on != 0;
+}
+
+/*
+ * Class:     jdk_net_LinuxSocketOptions
+ * Method:    quickAckSupported
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_jdk_net_LinuxSocketOptions_quickAckSupported0
+(JNIEnv *env, jobject unused) {
+    int one = 1;
+    int rv, s;
+    s = socket(PF_INET, SOCK_STREAM, 0);
+    if (s < 0) {
+        return JNI_FALSE;
+    }
+    rv = setsockopt(s, SOL_SOCKET, TCP_QUICKACK, (void *) &one, sizeof (one));
+    if (rv != 0 && errno == ENOPROTOOPT) {
+        rv = JNI_FALSE;
+    } else {
+        rv = JNI_TRUE;
+    }
+    close(s);
+    return rv;
+}
--- a/src/jdk.net/share/classes/jdk/net/ExtendedSocketOptions.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.net/share/classes/jdk/net/ExtendedSocketOptions.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, 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
@@ -67,20 +67,53 @@
     public static final SocketOption<SocketFlow> SO_FLOW_SLA = new
         ExtSocketOption<SocketFlow>("SO_FLOW_SLA", SocketFlow.class);
 
+    /**
+     * Disable Delayed Acknowledgements.
+     *
+     * <p>
+     * This socket option can be used to reduce or disable delayed
+     * acknowledgments (ACKs). When {@code TCP_QUICKACK} is enabled, ACKs are
+     * sent immediately, rather than delayed if needed in accordance to normal
+     * TCP operation. This option is not permanent, it only enables a switch to
+     * or from {@code TCP_QUICKACK} mode. Subsequent operations of the TCP
+     * protocol will once again disable/enable {@code TCP_QUICKACK} mode
+     * depending on internal protocol processing and factors such as delayed ACK
+     * timeouts occurring and data transfer, therefore this option needs to be
+     * set with {@code setOption} after each operation of TCP on a given socket.
+     *
+     * <p>
+     * The value of this socket option is a {@code Boolean} that represents
+     * whether the option is enabled or disabled. The socket option is specific
+     * to stream-oriented sockets using the TCP/IP protocol. The exact semantics
+     * of this socket option are socket type and system dependent.
+     *
+     * @since 10
+     */
+    public static final SocketOption<Boolean> TCP_QUICKACK =
+            new ExtSocketOption<Boolean>("TCP_QUICKACK", Boolean.class);
 
     private static final PlatformSocketOptions platformSocketOptions =
             PlatformSocketOptions.get();
 
     private static final boolean flowSupported =
             platformSocketOptions.flowSupported();
+    private static final boolean quickAckSupported =
+            platformSocketOptions.quickAckSupported();
 
     private static final Set<SocketOption<?>> extendedOptions = options();
 
     static Set<SocketOption<?>> options() {
-        if (flowSupported)
-            return Set.of(SO_FLOW_SLA);
-        else
+        if (flowSupported) {
+            if (quickAckSupported) {
+                return Set.of(SO_FLOW_SLA, TCP_QUICKACK);
+            } else {
+                return Set.of(SO_FLOW_SLA);
+            }
+        } else if (quickAckSupported) {
+            return Set.of(TCP_QUICKACK);
+        } else {
             return Collections.<SocketOption<?>>emptySet();
+        }
     }
 
     static {
@@ -105,6 +138,8 @@
                     assert flowSupported;
                     SocketFlow flow = checkValueType(value, option.type());
                     setFlowOption(fd, flow);
+                } else if (option == TCP_QUICKACK) {
+                    setQuickAckOption(fd, (boolean) value);
                 } else {
                     throw new InternalError("Unexpected option " + option);
                 }
@@ -127,6 +162,8 @@
                     SocketFlow flow = SocketFlow.create();
                     getFlowOption(fd, flow);
                     return flow;
+                } else if (option == TCP_QUICKACK) {
+                    return getQuickAckOption(fd);
                 } else {
                     throw new InternalError("Unexpected option " + option);
                 }
@@ -156,12 +193,21 @@
     }
 
     private static void getFlowOption(FileDescriptor fd, SocketFlow f)
-        throws SocketException
-    {
+            throws SocketException {
         int status = platformSocketOptions.getFlowOption(fdAccess.get(fd), f);
         f.status(status);  // augment the given flow with the status
     }
 
+    private static void setQuickAckOption(FileDescriptor fd, boolean enable)
+            throws SocketException {
+        platformSocketOptions.setQuickAck(fdAccess.get(fd), enable);
+    }
+
+    private static Object getQuickAckOption(FileDescriptor fd)
+            throws SocketException {
+        return platformSocketOptions.getQuickAck(fdAccess.get(fd));
+    }
+
     static class PlatformSocketOptions {
 
         protected PlatformSocketOptions() {}
@@ -184,9 +230,13 @@
                             return System.getProperty("os.name");
                         }
                     });
-            if ("SunOS".equals(osname))
+            if ("SunOS".equals(osname)) {
                 return newInstance("jdk.net.SolarisSocketOptions");
-            return new PlatformSocketOptions();
+            } else if ("Linux".equals(osname)) {
+                return newInstance("jdk.net.LinuxSocketOptions");
+            } else {
+                return new PlatformSocketOptions();
+            }
         }
 
         private static final PlatformSocketOptions instance = create();
@@ -208,5 +258,17 @@
         boolean flowSupported() {
             return false;
         }
+
+        void setQuickAck(int fd, boolean on) throws SocketException {
+            throw new UnsupportedOperationException("unsupported TCP_QUICKACK option");
+        }
+
+        boolean getQuickAck(int fd) throws SocketException {
+            throw new UnsupportedOperationException("unsupported TCP_QUICKACK option");
+        }
+
+        boolean quickAckSupported() {
+            return false;
+        }
     }
 }
--- a/src/jdk.net/share/classes/jdk/net/Sockets.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.net/share/classes/jdk/net/Sockets.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, 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
@@ -279,6 +279,9 @@
         if (flowsupported) {
             set.add(ExtendedSocketOptions.SO_FLOW_SLA);
         }
+        if (QuickAck.available) {
+            set.add(ExtendedSocketOptions.TCP_QUICKACK);
+        }
         set = Collections.unmodifiableSet(set);
         options.put(Socket.class, set);
 
@@ -290,6 +293,9 @@
         if (reuseportsupported) {
             set.add(StandardSocketOptions.SO_REUSEPORT);
         }
+        if (QuickAck.available) {
+            set.add(ExtendedSocketOptions.TCP_QUICKACK);
+        }
         set.add(StandardSocketOptions.IP_TOS);
         set = Collections.unmodifiableSet(set);
         options.put(ServerSocket.class, set);
@@ -331,4 +337,17 @@
 
         return Collections.unmodifiableMap(options);
     }
+
+    /**
+     * Tells whether TCP_QUICKACK is supported.
+     */
+    static class QuickAck {
+
+        static final boolean available;
+
+        static {
+            Set<SocketOption<?>> s = new Socket().supportedOptions();
+            available = s.contains(ExtendedSocketOptions.TCP_QUICKACK);
+        }
+    }
 }
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/IntType.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/IntType.java	Wed Nov 15 08:25:28 2017 -0500
@@ -138,7 +138,7 @@
         } else if (to.isLong()) {
             method.visitInsn(I2L);
         } else if (to.isBoolean()) {
-            //nop
+            invokestatic(method, JSType.TO_BOOLEAN_I);
         } else if (to.isString()) {
             invokestatic(method, TO_STRING);
         } else if (to.isObject()) {
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java	Wed Nov 15 08:25:28 2017 -0500
@@ -89,6 +89,9 @@
     /** JavaScript compliant conversion function from number to boolean */
     public static final Call TO_BOOLEAN_D = staticCall(JSTYPE_LOOKUP, JSType.class, "toBoolean", boolean.class, double.class);
 
+    /** JavaScript compliant conversion function from int to boolean */
+    public static final Call TO_BOOLEAN_I = staticCall(JSTYPE_LOOKUP, JSType.class, "toBoolean", boolean.class, int.class);
+
     /** JavaScript compliant conversion function from Object to integer */
     public static final Call TO_INTEGER = staticCall(JSTYPE_LOOKUP, JSType.class, "toInteger", int.class, Object.class);
 
@@ -548,6 +551,17 @@
     }
 
     /**
+     * JavaScript compliant conversion of int to boolean
+     *
+     * @param num an int
+     *
+     * @return a boolean
+     */
+    public static boolean toBoolean(final int num) {
+        return num != 0;
+    }
+
+    /**
      * JavaScript compliant conversion of Object to boolean
      * See ECMA 9.2 ToBoolean
      *
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/gtest/gc/g1/test_heapRegion.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "precompiled.hpp"
+#include "gc/g1/g1BlockOffsetTable.hpp"
+#include "gc/g1/g1CollectedHeap.hpp"
+#include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
+#include "gc/g1/heapRegion.inline.hpp"
+#include "gc/shared/referenceProcessor.hpp"
+#include "unittest.hpp"
+
+class VerifyAndCountMarkClosure : public StackObj {
+  int _count;
+  G1CMBitMap* _bm;
+
+  void ensure_marked(HeapWord* addr) {
+    ASSERT_TRUE(_bm->is_marked(addr));
+  }
+
+public:
+  VerifyAndCountMarkClosure(G1CMBitMap* bm) : _count(0), _bm(bm) { }
+
+  virtual size_t apply(oop object) {
+    _count++;
+    ensure_marked((HeapWord*) object);
+    // Must return positive size to advance the iteration.
+    return MinObjAlignment;
+  }
+
+  void reset() {
+    _count = 0;
+  }
+
+  int count() {
+    return _count;
+  }
+};
+
+#define MARK_OFFSET_1 ( 17 * MinObjAlignment)
+#define MARK_OFFSET_2 ( 99 * MinObjAlignment)
+#define MARK_OFFSET_3 (337 * MinObjAlignment)
+
+TEST_OTHER_VM(HeapRegion, apply_to_marked_objects) {
+  if (!UseG1GC) {
+    return;
+  }
+
+  G1CollectedHeap* heap = G1CollectedHeap::heap();
+
+  // Using region 0 for testing.
+  HeapRegion* region = heap->heap_region_containing(heap->bottom_addr_for_region(0));
+
+  // Mark some "oops" in the bitmap.
+  G1CMBitMap* bitmap = heap->concurrent_mark()->next_mark_bitmap();
+  bitmap->mark(region->bottom());
+  bitmap->mark(region->bottom() + MARK_OFFSET_1);
+  bitmap->mark(region->bottom() + MARK_OFFSET_2);
+  bitmap->mark(region->bottom() + MARK_OFFSET_3);
+  bitmap->mark(region->end());
+
+  VerifyAndCountMarkClosure cl(bitmap);
+
+  // When top is equal to bottom the closure should not be
+  // applied to any object because apply_to_marked_objects
+  // will stop at HeapRegion::scan_limit which is equal to top.
+  region->set_top(region->bottom());
+  region->apply_to_marked_objects(bitmap, &cl);
+  EXPECT_EQ(0, cl.count());
+  cl.reset();
+
+  // Set top to offset_1 and expect only to find 1 entry (bottom)
+  region->set_top(region->bottom() + MARK_OFFSET_1);
+  region->apply_to_marked_objects(bitmap, &cl);
+  EXPECT_EQ(1, cl.count());
+  cl.reset();
+
+  // Set top to (offset_2 + 1) and expect only to find 3
+  // entries (bottom, offset_1 and offset_2)
+  region->set_top(region->bottom() + MARK_OFFSET_2 + MinObjAlignment);
+  region->apply_to_marked_objects(bitmap, &cl);
+  EXPECT_EQ(3, cl.count());
+  cl.reset();
+
+  // Still expect same 3 entries when top is (offset_3 - 1)
+  region->set_top(region->bottom() + MARK_OFFSET_3 - MinObjAlignment);
+  region->apply_to_marked_objects(bitmap, &cl);
+  EXPECT_EQ(3, cl.count());
+  cl.reset();
+
+  // Setting top to end should render 4 entries.
+  region->set_top(region->end());
+  region->apply_to_marked_objects(bitmap, &cl);
+  EXPECT_EQ(4, cl.count());
+  cl.reset();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/gtest/gc/shared/test_preservedMarks.cpp	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "precompiled.hpp"
+#include "gc/shared/preservedMarks.inline.hpp"
+#include "unittest.hpp"
+
+class ScopedDisabledBiasedLocking {
+  bool _orig;
+public:
+  ScopedDisabledBiasedLocking() : _orig(UseBiasedLocking) { UseBiasedLocking = false; }
+  ~ScopedDisabledBiasedLocking() { UseBiasedLocking = _orig; }
+};
+
+// Class to create a "fake" oop with a mark that will
+// return true for calls to must_be_preserved().
+class FakeOop {
+  oopDesc _oop;
+
+public:
+  FakeOop() : _oop() { _oop.set_mark(originalMark()); }
+
+  oop get_oop() { return &_oop; }
+  markOop mark() { return _oop.mark(); }
+  void set_mark(markOop m) { _oop.set_mark(m); }
+  void forward_to(oop obj) {
+    markOop m = markOopDesc::encode_pointer_as_mark(obj);
+    _oop.set_mark(m);
+  }
+
+  static markOop originalMark() { return markOop(markOopDesc::lock_mask_in_place); }
+  static markOop changedMark()  { return markOop(0x4711); }
+};
+
+TEST_VM(PreservedMarks, iterate_and_restore) {
+  // Need to disable biased locking to easily
+  // create oops that "must_be_preseved"
+  ScopedDisabledBiasedLocking dbl;
+
+  PreservedMarks pm;
+  FakeOop o1;
+  FakeOop o2;
+  FakeOop o3;
+  FakeOop o4;
+
+  // Make sure initial marks are correct.
+  ASSERT_EQ(o1.mark(), FakeOop::originalMark());
+  ASSERT_EQ(o2.mark(), FakeOop::originalMark());
+  ASSERT_EQ(o3.mark(), FakeOop::originalMark());
+  ASSERT_EQ(o4.mark(), FakeOop::originalMark());
+
+  // Change the marks and verify change.
+  o1.set_mark(FakeOop::changedMark());
+  o2.set_mark(FakeOop::changedMark());
+  ASSERT_EQ(o1.mark(), FakeOop::changedMark());
+  ASSERT_EQ(o2.mark(), FakeOop::changedMark());
+
+  // Push o1 and o2 to have their marks preserved.
+  pm.push(o1.get_oop(), o1.mark());
+  pm.push(o2.get_oop(), o2.mark());
+
+  // Fake a move from o1->o3 and o2->o4.
+  o1.forward_to(o3.get_oop());
+  o2.forward_to(o4.get_oop());
+  ASSERT_EQ(o1.get_oop()->forwardee(), o3.get_oop());
+  ASSERT_EQ(o2.get_oop()->forwardee(), o4.get_oop());
+  // Adjust will update the PreservedMarks stack to
+  // make sure the mark is updated at the new location.
+  pm.adjust_during_full_gc();
+
+  // Restore all preserved and verify that the changed
+  // mark is now present at o3 and o4.
+  pm.restore();
+  ASSERT_EQ(o3.mark(), FakeOop::changedMark());
+  ASSERT_EQ(o4.mark(), FakeOop::changedMark());
+}
--- a/test/hotspot/jtreg/TEST.groups	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/hotspot/jtreg/TEST.groups	Wed Nov 15 08:25:28 2017 -0500
@@ -37,6 +37,9 @@
 hotspot_runtime = \
   runtime
 
+hotspot_handshake = \
+  runtime/handshake
+
 hotspot_serviceability = \
   serviceability
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/loopopts/TestCountedLoopBadIVRange.java	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2017, Red Hat, Inc. 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 8190375
+ * @summary Bad range for IV phi when exit condition is a not equal test
+ * @run main/othervm -XX:-TieredCompilation TestCountedLoopBadIVRange
+ *
+ */
+
+
+public class TestCountedLoopBadIVRange {
+
+    static int test1(int[] arr) {
+        int j = 0;
+        int res = 0;
+        for (int i = 0; i < 2; i++) {
+            // When entered with j == 10, exit condition never
+            // succeeds so range of values for j can't be computed
+            // from exit condition
+            for (; j != 5; j++) {
+                if (j >= 20) {
+                    break;
+                }
+                res += arr[j];
+            }
+            j = 10;
+        }
+        return res;
+    }
+
+    static int test2(int[] arr) {
+        int j = 10;
+        int res = 0;
+        for (int i = 0; i < 2; i++) {
+            // Same as above but loop variable is decreasing
+            for (; j != 5; j--) {
+                if (j < 0) {
+                    break;
+                }
+                res += arr[j];
+            }
+            j = 1;
+        }
+        return res;
+    }
+
+    public static void main(String[] args) {
+        int[] arr = new int[20];
+        for (int i = 0; i < arr.length; i++) {
+            arr[i] = i;
+        }
+        for (int i = 0; i < 20_000; i++) {
+            int res = test1(arr);
+            if (res != 155) {
+                throw new RuntimeException("Incorrect result " + res);
+            }
+            res = test2(arr);
+            if (res != 41) {
+                throw new RuntimeException("Incorrect result " + res);
+            }
+        }
+    }
+}
--- a/test/hotspot/jtreg/gc/arguments/TestMaxMinHeapFreeRatioFlags.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/hotspot/jtreg/gc/arguments/TestMaxMinHeapFreeRatioFlags.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, 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
@@ -156,8 +156,9 @@
             if (args.length != 3) {
                 throw new IllegalArgumentException("Expected 3 args: <minRatio> <maxRatio> <shrinkHeapInSteps>");
             }
-            if (GCTypes.OldGCType.getOldGCType() == GCTypes.OldGCType.PSOld) {
-                System.out.println("Test is not applicable to parallel GC");
+            if (GCTypes.OldGCType.getOldGCType() == GCTypes.OldGCType.PSOld ||
+                GCTypes.OldGCType.getOldGCType() == GCTypes.OldGCType.G1) {
+                System.out.println("Test is not applicable to parallel full GCs");
                 return;
             }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/handshake/HandshakeTransitionTest.java	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2017, 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.nio.file.Paths;
+import java.time.Duration;
+
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+
+/*
+ * @test HandshakeTransitionTest
+ * @summary This does a sanity test of the poll in the native wrapper.
+ * @requires vm.debug
+ * @library /testlibrary /test/lib
+ * @build HandshakeTransitionTest
+ * @run main/native HandshakeTransitionTest
+ */
+
+public class HandshakeTransitionTest {
+
+    public static native void someTime(int ms);
+
+    public static void main(String[] args) throws Exception {
+        String lib = System.getProperty("test.nativepath");
+        ProcessBuilder pb =
+            ProcessTools.createJavaProcessBuilder(
+                    true,
+                    "-Djava.library.path=" + lib,
+                    "-XX:+SafepointALot",
+                    "-XX:GuaranteedSafepointInterval=20",
+                    "-Xlog:ergo*",
+                    "-XX:ParallelGCThreads=1",
+                    "-XX:ConcGCThreads=1",
+                    "-XX:CICompilerCount=2",
+                    "HandshakeTransitionTest$Test");
+
+
+        OutputAnalyzer output = ProcessTools.executeProcess(pb);
+        output.reportDiagnosticSummary();
+        output.shouldHaveExitValue(0);
+        output.stdoutShouldContain("JOINED");
+    }
+
+    static class Test implements Runnable {
+        final static int testLoops = 2000;
+        final static int testSleep = 1; //ms
+
+        public static void main(String[] args) throws Exception {
+            System.loadLibrary("HandshakeTransitionTest");
+            Test test = new Test();
+            Thread[] threads = new Thread[64];
+            for (int i = 0; i<threads.length ; i++) {
+                threads[i] = new Thread(test);
+                threads[i].start();
+            }
+            for (Thread t : threads) {
+                t.join();
+            }
+            System.out.println("JOINED");
+        }
+
+        @Override
+        public void run() {
+            try {
+                for (int i = 0; i<testLoops ; i++) {
+                    someTime(testSleep);
+                }
+            } catch (Exception e) {
+                System.out.println(e.getMessage());
+                System.exit(1);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/handshake/HandshakeWalkExitTest.java	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2017, 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 HandshakeWalkExitTest
+ * @summary This test tries to stress the handshakes with new and exiting threads
+ * @library /testlibrary /test/lib
+ * @build HandshakeWalkExitTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI HandshakeWalkExitTest
+ */
+
+import jdk.test.lib.Asserts;
+import sun.hotspot.WhiteBox;
+
+public class HandshakeWalkExitTest  implements Runnable {
+
+    @Override
+    public void run() {
+    }
+
+    static volatile boolean exit_now = false;
+    static Thread[] threads;
+
+    public static void main(String... args) throws Exception {
+        int testRuns = 100;
+        int testThreads = 500;
+
+        HandshakeWalkExitTest test = new HandshakeWalkExitTest();
+
+        threads = new Thread[64];
+
+        Runnable hser = new Runnable(){
+            public void run(){
+                WhiteBox wb = WhiteBox.getWhiteBox();
+                while(!exit_now) {
+                    wb.handshakeWalkStack(null, true);
+                    try { Thread.sleep(1); } catch(Exception e) {}
+                }
+            }
+        };
+        Thread hst = new Thread(hser);
+        hst.start();
+        for (int k = 0; k<testRuns ; k++) {
+            Thread[] threads = new Thread[testThreads];
+            for (int i = 0; i<threads.length ; i++) {
+                threads[i] = new Thread(test);
+                threads[i].start();
+            }
+        }
+        exit_now = true;
+        hst.join();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/handshake/HandshakeWalkStackFallbackTest.java	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2017, 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 HandshakeWalkStackFallbackTest
+ * @summary This test the global safepoint fallback path for handshakes
+ * @library /testlibrary /test/lib
+ * @build HandshakeWalkStackTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-ThreadLocalHandshakes HandshakeWalkStackTest
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/handshake/HandshakeWalkStackTest.java	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2016, 2017, 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 HandshakeWalkStackTest
+ * @library /testlibrary /test/lib
+ * @build HandshakeWalkStackTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI HandshakeWalkStackTest
+ */
+
+import jdk.test.lib.Asserts;
+import sun.hotspot.WhiteBox;
+
+public class HandshakeWalkStackTest {
+
+    public static void main(String... args) throws Exception {
+        int iterations = 3;
+        if (args.length > 0) {
+            iterations = Integer.parseInt(args[0]);
+        }
+        test(iterations);
+    }
+
+    private static void test(int iterations) throws Exception {
+        Thread loop_thread  = new Thread(() -> run_loop(create_list()));
+        Thread alloc_thread = new Thread(() -> run_alloc());
+        Thread wait_thread  = new Thread(() -> run_wait(new Object() {}));
+        loop_thread.start();
+        alloc_thread.start();
+        wait_thread.start();
+
+        WhiteBox wb = WhiteBox.getWhiteBox();
+        int walked = 0;
+        for (int i = 0; i < iterations; i++) {
+            System.out.println("Iteration " + i);
+            System.out.flush();
+            Thread.sleep(200);
+            walked = wb.handshakeWalkStack(loop_thread, false);
+            Asserts.assertEQ(walked, 1, "Must have walked one thread stack");
+            Thread.sleep(200);
+            walked = wb.handshakeWalkStack(alloc_thread, false);
+            Asserts.assertEQ(walked, 1, "Must have walked one thread stack");
+            Thread.sleep(200);
+            walked = wb.handshakeWalkStack(wait_thread, false);
+            Asserts.assertEQ(walked, 1, "Must have walked one thread stack");
+            Thread.sleep(200);
+            walked = wb.handshakeWalkStack(Thread.currentThread(), false);
+            Asserts.assertEQ(walked, 1, "Must have walked one thread stack");
+        }
+        Thread.sleep(200);
+        walked = wb.handshakeWalkStack(null, true);
+        Asserts.assertGT(walked, 4, "Must have walked more than three thread stacks");
+    }
+
+    static class List {
+        List next;
+
+        List(List next) {
+            this.next = next;
+        }
+    }
+
+    public static List create_list() {
+        List head = new List(null);
+        List elem = new List(head);
+        List elem2 = new List(elem);
+        List elem3 = new List(elem2);
+        List elem4 = new List(elem3);
+        head.next = elem4;
+
+        return head;
+    }
+
+    public static void run_loop(List loop) {
+        while (loop.next != null) {
+            loop = loop.next;
+        }
+    }
+
+    public static byte[] array;
+
+    public static void run_alloc() {
+        while (true) {
+            // Write to public static to ensure the byte array escapes.
+            array = new byte[4096];
+        }
+    }
+
+    public static void run_wait(Object lock) {
+        synchronized (lock) {
+            try {
+                lock.wait();
+            } catch (InterruptedException ie) {}
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/handshake/libHandshakeTransitionTest.c	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <jni.h>
+
+#ifdef WINDOWS
+#include <windows.h>
+#else
+#include <unistd.h>
+#endif
+
+JNIEXPORT void JNICALL Java_HandshakeTransitionTest_someTime
+  (JNIEnv *env, jclass jc, jint ms)
+{
+#ifdef WINDOWS
+  Sleep(ms);
+#else
+  usleep(ms*1000);
+#endif
+}
--- a/test/jdk/java/nio/channels/SocketChannel/VectorIO.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/nio/channels/SocketChannel/VectorIO.java	Wed Nov 15 08:25:28 2017 -0500
@@ -22,6 +22,7 @@
  */
 
 /* @test
+ * @bug 8191025
  * @summary Test socketchannel vector IO (use -Dseed=X to set PRNG seed)
  * @library .. /test/lib
  * @build jdk.test.lib.RandomFactory
@@ -42,11 +43,16 @@
 
     static int testSize;
 
+    // whether to use the write/read variant with a length parameter
+    static boolean setLength;
+
     public static void main(String[] args) throws Exception {
         testSize = 1;
+        setLength = false;
         runTest();
         for(int i=15; i<18; i++) {
             testSize = i;
+            setLength = !setLength;
             runTest();
         }
     }
@@ -75,6 +81,9 @@
             total += bufs[i].remaining();
         }
 
+        ByteBuffer[] bufsPlus1 = new ByteBuffer[bufs.length + 1];
+        System.arraycopy(bufs, 0, bufsPlus1, 0, bufs.length);
+
         // Get a connection to the server
         InetAddress lh = InetAddress.getLocalHost();
         InetSocketAddress isa = new InetSocketAddress(lh, port);
@@ -85,7 +94,12 @@
         // Write the data out
         long rem = total;
         while (rem > 0L) {
-            long bytesWritten = sc.write(bufs);
+            long bytesWritten;
+            if (setLength) {
+                bytesWritten = sc.write(bufsPlus1, 0, bufs.length);
+            } else {
+                bytesWritten = sc.write(bufs);
+            }
             if (bytesWritten == 0) {
                 if (sc.isBlocking()) {
                     throw new RuntimeException("write did not block");
@@ -134,6 +148,9 @@
                 total += bufs[i].capacity();
             }
 
+            ByteBuffer[] bufsPlus1 = new ByteBuffer[bufs.length + 1];
+            System.arraycopy(bufs, 0, bufsPlus1, 0, bufs.length);
+
             // Get a connection from client
             SocketChannel sc = null;
 
@@ -155,7 +172,12 @@
                 // Read data into multiple buffers
                 long avail = total;
                 while (avail > 0) {
-                    long bytesRead = sc.read(bufs);
+                    long bytesRead;
+                    if (setLength) {
+                        bytesRead = sc.read(bufsPlus1, 0, bufs.length);
+                    } else {
+                        bytesRead = sc.read(bufs);
+                    }
                     if (bytesRead < 0)
                         break;
                     if (bytesRead == 0) {
--- a/test/jdk/java/time/tck/java/time/zone/TCKZoneRules.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/time/tck/java/time/zone/TCKZoneRules.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, 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
@@ -941,21 +941,21 @@
     }
 
     public void test_Apia_jumpForwardOverInternationalDateLine_P12_to_M12() {
-        // transition occurred at 1879-07-04T00:00+12:33:04
+        // transition occurred at 1892-07-04T00:00+12:33:04
         ZoneRules test = pacificApia();
-        Instant instantBefore = LocalDate.of(1879, 7, 2).atStartOfDay(ZoneOffset.UTC).toInstant();
+        Instant instantBefore = LocalDate.of(1892, 7, 2).atStartOfDay(ZoneOffset.UTC).toInstant();
         ZoneOffsetTransition trans = test.nextTransition(instantBefore);
-        assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(1879, 7, 5, 0, 0));
-        assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(1879, 7, 4, 0, 0));
+        assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(1892, 7, 5, 0, 0));
+        assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(1892, 7, 4, 0, 0));
         assertEquals(trans.isGap(), false);
         assertEquals(trans.isOverlap(), true);
         assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(+12, 33, 4)), true);
         assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56)), true);
         assertEquals(trans.getDuration(), Duration.ofHours(-24));
-        assertEquals(trans.getInstant(), LocalDateTime.of(1879, 7, 4, 0, 0).toInstant(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56)));
+        assertEquals(trans.getInstant(), LocalDateTime.of(1892, 7, 4, 0, 0).toInstant(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56)));
 
-        ZonedDateTime zdt = ZonedDateTime.of(1879, 7, 4, 23, 0, 0, 0, ZoneId.of("Pacific/Apia"));
-        assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(1879, 7, 4, 1, 0, 0));
+        ZonedDateTime zdt = ZonedDateTime.of(1892, 7, 4, 23, 0, 0, 0, ZoneId.of("Pacific/Apia"));
+        assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(1892, 7, 4, 1, 0, 0));
     }
 
     //-------------------------------------------------------------------------
--- a/test/jdk/java/time/test/java/time/format/ZoneName.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/time/test/java/time/format/ZoneName.java	Wed Nov 15 08:25:28 2017 -0500
@@ -104,7 +104,7 @@
         "Pacific/Chuuk", "Truk", "Pacific/Truk",
         "Africa/Gaborone", "Africa_Central", "Africa/Maputo",
         "Africa/Tunis", "Europe_Central", "Europe/Paris",
-        "Africa/Khartoum", "Africa_Eastern", "Africa/Nairobi",
+        "Africa/Khartoum", "Africa_Central", "Africa/Maputo",
         "Europe/Isle_of_Man", "GMT", "Atlantic/Reykjavik",
         "Europe/Skopje", "Europe_Central", "Europe/Paris",
         "America/Merida", "America_Central", "America/Chicago",
@@ -221,7 +221,7 @@
         "Africa/Algiers", "Europe_Central", "Europe/Paris",
         "America/Miquelon", "Pierre_Miquelon", "America/Miquelon",
         "Asia/Tokyo", "Japan", "Asia/Tokyo",
-        "Africa/Windhoek", "Africa_Western", "Africa/Lagos",
+        "Africa/Windhoek", "Africa_Central", "Africa/Maputo",
         "Africa/Bujumbura", "Africa_Central", "Africa/Maputo",
         "America/Guatemala", "America_Central", "America/Chicago",
         "Africa/Dakar", "GMT", "Atlantic/Reykjavik",
@@ -662,7 +662,6 @@
         "America/Rosario", "America/Argentina/Cordoba",
         "Jamaica", "America/Jamaica",
         "Asia/Katmandu", "Asia/Kathmandu",
-        "Canada/East-Saskatchewan", "America/Regina",
         "ROK", "Asia/Seoul",
         "Asia/Macao", "Asia/Macau",
         "Australia/South", "Australia/Adelaide",
--- a/test/jdk/java/util/AbstractList/FailFastIterator.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/AbstractList/FailFastIterator.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4189896
  * @summary AbstractList iterators previously checked for co-modification
--- a/test/jdk/java/util/AbstractSequentialList/AddAll.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/AbstractSequentialList/AddAll.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4295163
  * @summary AddAll(int, Collection) intersperses the Collection with this List.
--- a/test/jdk/java/util/Collection/IteratorMicroBenchmark.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collection/IteratorMicroBenchmark.java	Wed Nov 15 08:25:28 2017 -0500
@@ -233,7 +233,7 @@
     }
 
     // Checks for correctness *and* prevents loop optimizations
-    class Check {
+    static class Check {
         private int sum;
         public void sum(int sum) {
             if (this.sum == 0)
--- a/test/jdk/java/util/Collection/MOAT.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collection/MOAT.java	Wed Nov 15 08:25:28 2017 -0500
@@ -1584,11 +1584,11 @@
     }
     interface Fun {void f() throws Throwable;}
     private static void THROWS(Class<? extends Throwable> k, Fun... fs) {
-          for (Fun f : fs)
-              try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
-              catch (Throwable t) {
-                  if (k.isAssignableFrom(t.getClass())) pass();
-                  else unexpected(t);}}
+        for (Fun f : fs)
+            try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
+            catch (Throwable t) {
+                if (k.isAssignableFrom(t.getClass())) pass();
+                else unexpected(t);}}
     static byte[] serializedForm(Object obj) {
         try {
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
--- a/test/jdk/java/util/Collection/RemoveMicroBenchmark.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collection/RemoveMicroBenchmark.java	Wed Nov 15 08:25:28 2017 -0500
@@ -230,7 +230,7 @@
     }
 
     // Checks for correctness *and* prevents loop optimizations
-    class Check {
+    static class Check {
         private int sum;
         public void sum(int sum) {
             if (this.sum == 0)
--- a/test/jdk/java/util/Collections/AddAll.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/AddAll.java	Wed Nov 15 08:25:28 2017 -0500
@@ -33,7 +33,7 @@
 
 public class AddAll {
     static final int N = 100;
-    public static void main(String args[]) {
+    public static void main(String[] args) {
         test(new ArrayList<Integer>());
         test(new LinkedList<Integer>());
         test(new HashSet<Integer>());
--- a/test/jdk/java/util/Collections/BinarySearchNullComparator.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/BinarySearchNullComparator.java	Wed Nov 15 08:25:28 2017 -0500
@@ -30,7 +30,7 @@
 import java.util.*;
 
 public class BinarySearchNullComparator {
-    public static void main(String args[]) throws Exception {
+    public static void main(String[] args) throws Exception {
         List list = Arrays.asList(new String[] {"I", "Love", "You"});
 
         int result = Collections.binarySearch(list, "You", null);
--- a/test/jdk/java/util/Collections/CheckedListBash.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/CheckedListBash.java	Wed Nov 15 08:25:28 2017 -0500
@@ -209,15 +209,14 @@
     }
 
     static void AddRandoms(List s, int n) {
-        for (int i=0; i<n; i++) {
-            int r = rnd.nextInt() % n;
-            Integer e = new Integer(r < 0 ? -r : r);
+        for (int i = 0; i < n; i++) {
+            Integer e = rnd.nextInt(n);
 
             int preSize = s.size();
             if (!s.add(e))
                 fail("Add failed.");
             int postSize = s.size();
-            if (postSize-preSize != 1)
+            if (postSize - preSize != 1)
                 fail("Add didn't increase size by 1.");
         }
     }
--- a/test/jdk/java/util/Collections/CheckedMapBash.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/CheckedMapBash.java	Wed Nov 15 08:25:28 2017 -0500
@@ -36,7 +36,6 @@
 import org.testng.annotations.DataProvider;
 
 import static org.testng.Assert.fail;
-import static org.testng.Assert.assertTrue;
 
 public class CheckedMapBash {
     static final Random rnd = new Random();
--- a/test/jdk/java/util/Collections/CheckedSetBash.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/CheckedSetBash.java	Wed Nov 15 08:25:28 2017 -0500
@@ -122,9 +122,8 @@
     }
 
     static void AddRandoms(Set s, int n) {
-        for (int i=0; i<n; i++) {
-            int r = rnd.nextInt() % n;
-            Integer e = new Integer(r < 0 ? -r : r);
+        for (int i = 0; i < n; i++) {
+            Integer e = rnd.nextInt(n);
 
             int preSize = s.size();
             boolean prePresent = s.contains(e);
--- a/test/jdk/java/util/Collections/Disjoint.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/Disjoint.java	Wed Nov 15 08:25:28 2017 -0500
@@ -34,7 +34,7 @@
 public class Disjoint {
     static final int N = 20;
 
-    public static void main(String args[]) {
+    public static void main(String[] args) {
         // Make an array of lists each of which shares a single element
         // with its "neighbors," and no elements with other lists in the array
         Random rnd = new Random();
--- a/test/jdk/java/util/Collections/EmptyNavigableMap.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/EmptyNavigableMap.java	Wed Nov 15 08:25:28 2017 -0500
@@ -48,7 +48,7 @@
 public class EmptyNavigableMap {
 
     public static <T> void assertInstance(T actual, Class<? extends T> expected) {
-        assertInstance(expected.isInstance(actual), null);
+        assertInstance(actual, expected, null);
     }
 
     public static <T> void assertInstance(T actual, Class<? extends T> expected, String message) {
--- a/test/jdk/java/util/Collections/EmptyNavigableSet.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/EmptyNavigableSet.java	Wed Nov 15 08:25:28 2017 -0500
@@ -50,7 +50,7 @@
 public class EmptyNavigableSet {
 
     public static <T> void assertInstance(T actual, Class<? extends T> expected) {
-        assertInstance(expected.isInstance(actual), null);
+        assertInstance(actual, expected, null);
     }
 
     public static <T> void assertInstance(T actual, Class<? extends T> expected, String message) {
--- a/test/jdk/java/util/Collections/Enum.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/Enum.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4323074
  * @summary Basic test for new Enumeration -> List converter
--- a/test/jdk/java/util/Collections/FindSubList.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/FindSubList.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4323074
  * @summary Basic test for Collections.indexOfSubList/lastIndexOfSubList
@@ -33,8 +33,8 @@
     public static void main(String[] args) throws Exception {
         int N = 500;
         List source = new ArrayList(3 * N);
-        List target[]= new List[N+1];
-        int  index[] = new  int[N+1];
+        List[] target = new List[N+1];
+        int[] index = new int[N+1];
         for (int i=0; i<=N; i++) {
             List t = new ArrayList();
             String s = Integer.toString(i, 2);
@@ -50,8 +50,12 @@
             }
         }
 
-        List src[] = {source, new LinkedList(source), new Vector(source),
-                      Arrays.asList(source.toArray())};
+        List[] src = {
+            source,
+            new LinkedList(source),
+            new Vector(source),
+            Arrays.asList(source.toArray())
+        };
         for (int j=0; j<src.length; j++) {
             List s = src[j];
 
@@ -75,8 +79,12 @@
             if (i != N)
                 index[i] = srcSize - index[i] - target[i].size();
         }
-        List src2[] = {source, new LinkedList(source), new Vector(source),
-                       Arrays.asList(source.toArray())};
+        List[] src2 = {
+            source,
+            new LinkedList(source),
+            new Vector(source),
+            Arrays.asList(source.toArray())
+        };
         for (int j=0; j<src2.length; j++) {
             List s = src2[j];
 
--- a/test/jdk/java/util/Collections/Frequency.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/Frequency.java	Wed Nov 15 08:25:28 2017 -0500
@@ -32,7 +32,7 @@
 
 public class Frequency {
     static final int N = 100;
-    public static void main(String args[]) {
+    public static void main(String[] args) {
         test(new ArrayList<Integer>());
         test(new LinkedList<Integer>());
     }
--- a/test/jdk/java/util/Collections/NullComparator.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/NullComparator.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4224271
  * @summary A null Comparator is now specified to indicate natural ordering.
@@ -37,7 +37,7 @@
         List sorted = new ArrayList(list);
         Collections.shuffle(list);
 
-        Object a[] = list.toArray();
+        Object[] a = list.toArray();
         Arrays.sort(a, null);
         if (!Arrays.asList(a).equals(sorted))
             throw new Exception("Arrays.sort");
--- a/test/jdk/java/util/Collections/ReplaceAll.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/ReplaceAll.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4323074
  * @summary Basic test for new replaceAll algorithm
@@ -33,7 +33,7 @@
     static final int SIZE = 20;
 
     public static void main(String[] args) throws Exception {
-        List a[] = {new ArrayList(), new LinkedList(), new Vector()};
+        List[] a = {new ArrayList(), new LinkedList(), new Vector()};
 
         for (int i=0; i<a.length; i++) {
             List lst = a[i];
--- a/test/jdk/java/util/Collections/Rotate.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/Rotate.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4323074
  * @summary Basic test for new rotate algorithm
@@ -37,7 +37,7 @@
     static Random rnd = new Random();
 
     public static void main(String[] args) throws Exception {
-        List a[] = {new ArrayList(), new LinkedList(), new Vector()};
+        List[] a = {new ArrayList(), new LinkedList(), new Vector()};
 
         for (int i=0; i<a.length; i++) {
             List lst = a[i];
--- a/test/jdk/java/util/Collections/RotateEmpty.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/RotateEmpty.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4389747
  * @summary Collections.rotate(...) returns ArithmeticException
--- a/test/jdk/java/util/Collections/Ser.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/Ser.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4190323
  * @summary EMPTY_SET, EMPTY_LIST, and the collections returned by
--- a/test/jdk/java/util/Collections/Swap.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/Swap.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug     4323074
  * @summary Basic test for newly public swap algorithm
--- a/test/jdk/java/util/Collections/ViewSynch.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/ViewSynch.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4268780
  * @summary Collection-views of submap-views of synchronized-views of
--- a/test/jdk/java/util/Collections/WrappedNull.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Collections/WrappedNull.java	Wed Nov 15 08:25:28 2017 -0500
@@ -31,152 +31,152 @@
 import java.util.*;
 
 public class WrappedNull {
-      public static void main(String argv[]) throws Exception {
-          boolean testSucceeded = false;
-          try {
-              List l = Arrays.asList(null);
-          }
-          catch (NullPointerException e) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("Arrays.asList");
+    public static void main(String[] args) throws Exception {
+        boolean testSucceeded = false;
+        try {
+            List l = Arrays.asList(null);
+        }
+        catch (NullPointerException e) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("Arrays.asList");
 
-          testSucceeded = false;
-          try {
-              Collection c = Collections.unmodifiableCollection(null);
-          }
-          catch (NullPointerException e) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("unmodifiableCollection");
+        testSucceeded = false;
+        try {
+            Collection c = Collections.unmodifiableCollection(null);
+        }
+        catch (NullPointerException e) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("unmodifiableCollection");
 
-          testSucceeded = false;
-          try {
-              Set c = Collections.unmodifiableSet(null);
-          }
-          catch (NullPointerException e) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("unmodifiableSet");
+        testSucceeded = false;
+        try {
+            Set c = Collections.unmodifiableSet(null);
+        }
+        catch (NullPointerException e) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("unmodifiableSet");
 
-          testSucceeded = false;
-          try {
-              List c = Collections.unmodifiableList(null);
-          }
-          catch (NullPointerException e) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("unmodifiableList");
+        testSucceeded = false;
+        try {
+            List c = Collections.unmodifiableList(null);
+        }
+        catch (NullPointerException e) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("unmodifiableList");
 
-          testSucceeded = false;
-          try {
-              Map c = Collections.unmodifiableMap(null);
-          }
-          catch (NullPointerException e) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("unmodifiableMap");
+        testSucceeded = false;
+        try {
+            Map c = Collections.unmodifiableMap(null);
+        }
+        catch (NullPointerException e) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("unmodifiableMap");
 
-          testSucceeded = false;
-          try {
-              SortedSet c = Collections.unmodifiableSortedSet(null);
-          }
-          catch (NullPointerException e) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("unmodifiableSortedSet");
+        testSucceeded = false;
+        try {
+            SortedSet c = Collections.unmodifiableSortedSet(null);
+        }
+        catch (NullPointerException e) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("unmodifiableSortedSet");
 
-          testSucceeded = false;
-          try {
-              SortedMap c = Collections.unmodifiableSortedMap(null);
-          }
-          catch (NullPointerException e) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("unmodifiableSortedMap");
+        testSucceeded = false;
+        try {
+            SortedMap c = Collections.unmodifiableSortedMap(null);
+        }
+        catch (NullPointerException e) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("unmodifiableSortedMap");
 
-          testSucceeded = false;
-          try {
-              Collection c = Collections.synchronizedCollection(null);
-          }
-          catch (NullPointerException e) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("synchronizedCollection");
+        testSucceeded = false;
+        try {
+            Collection c = Collections.synchronizedCollection(null);
+        }
+        catch (NullPointerException e) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("synchronizedCollection");
 
-          testSucceeded = false;
-          try {
-              Set c = Collections.synchronizedSet(null);
-          }
-          catch (NullPointerException e) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("synchronizedSet");
+        testSucceeded = false;
+        try {
+            Set c = Collections.synchronizedSet(null);
+        }
+        catch (NullPointerException e) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("synchronizedSet");
 
-          testSucceeded = false;
-          try {
-              List c = Collections.synchronizedList(null);
-          }
-          catch (NullPointerException e) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("synchronizedList");
+        testSucceeded = false;
+        try {
+            List c = Collections.synchronizedList(null);
+        }
+        catch (NullPointerException e) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("synchronizedList");
 
-          testSucceeded = false;
-          try {
-              Map c = Collections.synchronizedMap(null);
-          }
-          catch (NullPointerException e) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("synchronizedMap");
+        testSucceeded = false;
+        try {
+            Map c = Collections.synchronizedMap(null);
+        }
+        catch (NullPointerException e) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("synchronizedMap");
 
-          testSucceeded = false;
-          try {
-              SortedSet c = Collections.synchronizedSortedSet(null);
-          }
-          catch (NullPointerException e) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("synchronizedSortedSet");
+        testSucceeded = false;
+        try {
+            SortedSet c = Collections.synchronizedSortedSet(null);
+        }
+        catch (NullPointerException e) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("synchronizedSortedSet");
 
-          testSucceeded = false;
-          try {
-              SortedMap c = Collections.synchronizedSortedMap(null);
-          }
-          catch (NullPointerException e) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("synchronizedSortedMap");
+        testSucceeded = false;
+        try {
+            SortedMap c = Collections.synchronizedSortedMap(null);
+        }
+        catch (NullPointerException e) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("synchronizedSortedMap");
 
-          // Make sure that non-null arguments don't throw exc.
-          List l = Arrays.asList(new Object[0]);
-          Collection c = Collections.unmodifiableCollection(
-                             Collections.EMPTY_SET);
-          Set s = Collections.unmodifiableSet(Collections.EMPTY_SET);
-          l = Collections.unmodifiableList(Collections.EMPTY_LIST);
-          Map m = Collections.unmodifiableMap(Collections.EMPTY_MAP);
-          SortedSet ss = Collections.unmodifiableSortedSet(new TreeSet());
-          SortedMap sm = Collections.unmodifiableSortedMap(new TreeMap());
+        // Make sure that non-null arguments don't throw exc.
+        List l = Arrays.asList(new Object[0]);
+        Collection c = Collections.unmodifiableCollection(
+                Collections.EMPTY_SET);
+        Set s = Collections.unmodifiableSet(Collections.EMPTY_SET);
+        l = Collections.unmodifiableList(Collections.EMPTY_LIST);
+        Map m = Collections.unmodifiableMap(Collections.EMPTY_MAP);
+        SortedSet ss = Collections.unmodifiableSortedSet(new TreeSet());
+        SortedMap sm = Collections.unmodifiableSortedMap(new TreeMap());
 
-          c = Collections.synchronizedCollection(Collections.EMPTY_SET);
-          s = Collections.synchronizedSet(Collections.EMPTY_SET);
-          l = Collections.synchronizedList(Collections.EMPTY_LIST);
-          m = Collections.synchronizedMap(Collections.EMPTY_MAP);
-          ss = Collections.synchronizedSortedSet(new TreeSet());
-          sm = Collections.synchronizedSortedMap(new TreeMap());
-      }
+        c = Collections.synchronizedCollection(Collections.EMPTY_SET);
+        s = Collections.synchronizedSet(Collections.EMPTY_SET);
+        l = Collections.synchronizedList(Collections.EMPTY_LIST);
+        m = Collections.synchronizedMap(Collections.EMPTY_MAP);
+        ss = Collections.synchronizedSortedSet(new TreeSet());
+        sm = Collections.synchronizedSortedMap(new TreeMap());
+    }
 }
--- a/test/jdk/java/util/HashMap/KeySetRemove.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/HashMap/KeySetRemove.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4286765
  * @summary HashMap and TreeMap entrySet().remove(k) spuriously returned
@@ -31,8 +31,8 @@
 import java.util.*;
 
 public class KeySetRemove {
-    public static void main(String args[]) throws Exception {
-        Map m[] = {new HashMap(), new TreeMap()};
+    public static void main(String[] args) throws Exception {
+        Map[] m = {new HashMap(), new TreeMap()};
         for (int i=0; i<m.length; i++) {
             m[i].put("bananas", null);
             if (!m[i].keySet().remove("bananas"))
--- a/test/jdk/java/util/HashMap/SetValue.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/HashMap/SetValue.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4627516
  * @summary HashMap.Entry.setValue() returns new value (as opposed to old)
@@ -35,7 +35,7 @@
     static final String oldValue = "old";
     static final String newValue = "new";
 
-    public static void main(String args[]) throws Exception {
+    public static void main(String[] args) throws Exception {
         Map m = new HashMap();
         m.put(key, oldValue);
         Map.Entry e = (Map.Entry) m.entrySet().iterator().next();
--- a/test/jdk/java/util/HashMap/ToString.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/HashMap/ToString.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4189821
  * @summary HashMap's entry.toString threw a null pointer exc if the HashMap
--- a/test/jdk/java/util/Hashtable/EqualsCast.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Hashtable/EqualsCast.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4208530
  * @summary Hashtable was less robust to extension that it could have been
--- a/test/jdk/java/util/Hashtable/HashCode.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Hashtable/HashCode.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4559052
  * @summary Hashtable's hashCode method always returns zero(!)
--- a/test/jdk/java/util/Hashtable/IllegalLoadFactor.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Hashtable/IllegalLoadFactor.java	Wed Nov 15 08:25:28 2017 -0500
@@ -34,101 +34,100 @@
  */
 public class IllegalLoadFactor {
 
-      public static void main(String argv[]) throws Exception {
-          boolean testSucceeded = false;
-          try {
-              // this should generate an IllegalArgumentException
-              Hashtable bad1 = new Hashtable(100, -3);
-          }
-          catch (IllegalArgumentException e1) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("Hashtable, negative load factor");
+    public static void main(String[] args) throws Exception {
+        boolean testSucceeded = false;
+        try {
+            // this should generate an IllegalArgumentException
+            Hashtable bad1 = new Hashtable(100, -3);
+        }
+        catch (IllegalArgumentException e1) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("Hashtable, negative load factor");
 
-          testSucceeded = false;
-          try {
-              // this should generate an IllegalArgumentException
-              Hashtable bad1 = new Hashtable(100, Float.NaN);
-          }
-          catch (IllegalArgumentException e1) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("Hashtable, NaN load factor");
+        testSucceeded = false;
+        try {
+            // this should generate an IllegalArgumentException
+            Hashtable bad1 = new Hashtable(100, Float.NaN);
+        }
+        catch (IllegalArgumentException e1) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("Hashtable, NaN load factor");
 
-          testSucceeded = false;
-          try {
-              // this should generate an IllegalArgumentException
-              HashMap bad1 = new HashMap(100, -3);
-          }
-          catch (IllegalArgumentException e1) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("HashMap, negative load factor");
+        testSucceeded = false;
+        try {
+            // this should generate an IllegalArgumentException
+            HashMap bad1 = new HashMap(100, -3);
+        }
+        catch (IllegalArgumentException e1) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("HashMap, negative load factor");
 
-          testSucceeded = false;
-          try {
-              // this should generate an IllegalArgumentException
-              HashMap bad1 = new HashMap(100, Float.NaN);
-          }
-          catch (IllegalArgumentException e1) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("HashMap, NaN load factor");
+        testSucceeded = false;
+        try {
+            // this should generate an IllegalArgumentException
+            HashMap bad1 = new HashMap(100, Float.NaN);
+        }
+        catch (IllegalArgumentException e1) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("HashMap, NaN load factor");
 
 
-          testSucceeded = false;
-          try {
-              // this should generate an IllegalArgumentException
-              HashSet bad1 = new HashSet(100, -3);
-          }
-          catch (IllegalArgumentException e1) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("HashSet, negative load factor");
+        testSucceeded = false;
+        try {
+            // this should generate an IllegalArgumentException
+            HashSet bad1 = new HashSet(100, -3);
+        }
+        catch (IllegalArgumentException e1) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("HashSet, negative load factor");
 
-          testSucceeded = false;
-          try {
-              // this should generate an IllegalArgumentException
-              HashSet bad1 = new HashSet(100, Float.NaN);
-          }
-          catch (IllegalArgumentException e1) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("HashSet, NaN load factor");
+        testSucceeded = false;
+        try {
+            // this should generate an IllegalArgumentException
+            HashSet bad1 = new HashSet(100, Float.NaN);
+        }
+        catch (IllegalArgumentException e1) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("HashSet, NaN load factor");
 
-          testSucceeded = false;
-          try {
-              // this should generate an IllegalArgumentException
-              WeakHashMap bad1 = new WeakHashMap(100, -3);
-          }
-          catch (IllegalArgumentException e1) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("WeakHashMap, negative load factor");
+        testSucceeded = false;
+        try {
+            // this should generate an IllegalArgumentException
+            WeakHashMap bad1 = new WeakHashMap(100, -3);
+        }
+        catch (IllegalArgumentException e1) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("WeakHashMap, negative load factor");
 
-          testSucceeded = false;
-          try {
-              // this should generate an IllegalArgumentException
-              WeakHashMap bad1 = new WeakHashMap(100, Float.NaN);
-          }
-          catch (IllegalArgumentException e1) {
-              testSucceeded = true;
-          }
-          if (!testSucceeded)
-              throw new Exception("WeakHashMap, NaN load factor");
+        testSucceeded = false;
+        try {
+            // this should generate an IllegalArgumentException
+            WeakHashMap bad1 = new WeakHashMap(100, Float.NaN);
+        }
+        catch (IllegalArgumentException e1) {
+            testSucceeded = true;
+        }
+        if (!testSucceeded)
+            throw new Exception("WeakHashMap, NaN load factor");
 
-          // Make sure that legal creates don't throw exceptions
-          Map goodMap = new Hashtable(100, .69f);
-          goodMap = new HashMap(100, .69f);
-          Set goodSet = new HashSet(100, .69f);
-          goodMap = new WeakHashMap(100, .69f);
-     }
-
+        // Make sure that legal creates don't throw exceptions
+        Map goodMap = new Hashtable(100, .69f);
+        goodMap = new HashMap(100, .69f);
+        Set goodSet = new HashSet(100, .69f);
+        goodMap = new WeakHashMap(100, .69f);
+    }
 }
--- a/test/jdk/java/util/Hashtable/SelfRef.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Hashtable/SelfRef.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4421469 6282555
  * @summary Hashtable's toString method should detect self-referential
--- a/test/jdk/java/util/LinkedHashMap/Basic.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/LinkedHashMap/Basic.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4245809 8029795
  * @summary Basic test for LinkedHashMap.  (Based on MapBash)
--- a/test/jdk/java/util/LinkedHashMap/Cache.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/LinkedHashMap/Cache.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4245809
  * @summary Basic test of removeEldestElement method.
--- a/test/jdk/java/util/LinkedHashMap/EmptyMapIterator.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/LinkedHashMap/EmptyMapIterator.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4473440
  * @summary iterators on collection views of empty map weren't fail-fast.
@@ -30,7 +30,7 @@
 import java.util.*;
 
 public class EmptyMapIterator {
-    public static void main(String args[]) throws Exception {
+    public static void main(String[] args) throws Exception {
         HashMap map = new HashMap();
         Iterator iter = iter = map.entrySet().iterator();
         map.put("key", "value");
--- a/test/jdk/java/util/LinkedHashSet/Basic.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/LinkedHashSet/Basic.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4245809
  * @summary Basic test for LinkedHashSet.  (Based on SetBash)
@@ -133,9 +133,8 @@
     }
 
     static void AddRandoms(Set s, int n) throws Exception {
-        for (int i=0; i<n; i++) {
-            int r = rnd.nextInt() % n;
-            Integer e = new Integer(r < 0 ? -r : r);
+        for (int i = 0; i < n; i++) {
+            Integer e = rnd.nextInt(n);
 
             int preSize = s.size();
             boolean prePresent = s.contains(e);
--- a/test/jdk/java/util/LinkedList/AddAll.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/LinkedList/AddAll.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4163207
  * @summary AddAll was prepending instead of appending!
--- a/test/jdk/java/util/NavigableMap/LockStep.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/NavigableMap/LockStep.java	Wed Nov 15 08:25:28 2017 -0500
@@ -848,11 +848,11 @@
     }
     interface Fun {void f() throws Throwable;}
     static void THROWS(Class<? extends Throwable> k, Fun... fs) {
-          for (Fun f : fs)
-              try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
-              catch (Throwable t) {
-                  if (k.isAssignableFrom(t.getClass())) pass();
-                  else unexpected(t);}}
+        for (Fun f : fs)
+            try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
+            catch (Throwable t) {
+                if (k.isAssignableFrom(t.getClass())) pass();
+                else unexpected(t);}}
     static byte[] serializedForm(Object obj) {
         try {
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
--- a/test/jdk/java/util/Random/NextIntPowerOfTwoMod.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Random/NextIntPowerOfTwoMod.java	Wed Nov 15 08:25:28 2017 -0500
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 4187412
  * @summary The FCS release of 1.2 did not special case the Random.nextInt
--- a/test/jdk/java/util/TreeMap/HeadTailTypeError.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/TreeMap/HeadTailTypeError.java	Wed Nov 15 08:25:28 2017 -0500
@@ -31,7 +31,7 @@
 import java.util.*;
 
 public class HeadTailTypeError {
-    public static void main(String argv[]) throws Exception {
+    public static void main(String[] args) throws Exception {
         try {
             SortedMap m = new TreeMap();
             m.headMap(new Object());
--- a/test/jdk/java/util/TreeMap/SubMap.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/TreeMap/SubMap.java	Wed Nov 15 08:25:28 2017 -0500
@@ -30,7 +30,7 @@
 import java.util.*;
 
 public class SubMap {
-    public static void main(String args[]) throws Exception {
+    public static void main(String[] args) throws Exception {
         SortedMap m = new TreeMap();
         m.put(new Integer(1), new Integer(1));
         m.put(new Integer(2), new Integer(2));
--- a/test/jdk/java/util/TreeMap/SubMapClear.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/TreeMap/SubMapClear.java	Wed Nov 15 08:25:28 2017 -0500
@@ -39,7 +39,7 @@
         Set subSet = treeSet.subSet(new Integer(4),new Integer(10));
         subSet.clear();  // Used to throw exception
 
-        int a[] = new int[] {1, 2, 3, 10};
+        int[] a = { 1, 2, 3, 10 };
         Set s = new TreeSet();
         for (int i = 0; i < a.length; i++)
             s.add(new Integer(a[i]));
--- a/test/jdk/java/util/Vector/IllegalConstructorArgs.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Vector/IllegalConstructorArgs.java	Wed Nov 15 08:25:28 2017 -0500
@@ -36,12 +36,12 @@
  */
 public class IllegalConstructorArgs {
 
-      public static void main(String argv[]) {
-          int testSucceeded=0;
+    public static void main(String[] args) {
+        int testSucceeded=0;
 
         try {
-           // this should generate an IllegalArgumentException
-           Vector bad1 = new Vector(-100, 10);
+            // this should generate an IllegalArgumentException
+            Vector bad1 = new Vector(-100, 10);
         }
         catch (IllegalArgumentException e1) {
             testSucceeded =1;
--- a/test/jdk/java/util/Vector/LastIndexOf.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Vector/LastIndexOf.java	Wed Nov 15 08:25:28 2017 -0500
@@ -31,7 +31,7 @@
 import java.util.*;
 
 public class LastIndexOf {
-    public static void main(String argv[]) throws Exception {
+    public static void main(String[] args) throws Exception {
         Vector v = new Vector(10);
 
         try {
--- a/test/jdk/java/util/Vector/SyncLastIndexOf.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/Vector/SyncLastIndexOf.java	Wed Nov 15 08:25:28 2017 -0500
@@ -46,7 +46,7 @@
         }
     }
 
-    public static void main(String args[]) {
+    public static void main(String[] args) {
         Integer x = new Integer(1);
         v.addElement(x);
         new RemovingThread().start();
--- a/test/jdk/java/util/WeakHashMap/ZeroInitCap.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/WeakHashMap/ZeroInitCap.java	Wed Nov 15 08:25:28 2017 -0500
@@ -23,7 +23,7 @@
 
 import java.util.*;
 
-/**
+/*
  * @test
  * @bug     4503146
  * @summary Zero initial capacity should be legal
@@ -31,7 +31,7 @@
  */
 
 public class ZeroInitCap {
-    public static void main(String[] argv) {
+    public static void main(String[] args) {
         Map map = new WeakHashMap(0);
         map.put("a","b");
     }
--- a/test/jdk/java/util/concurrent/ConcurrentHashMap/ToArray.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/concurrent/ConcurrentHashMap/ToArray.java	Wed Nov 15 08:25:28 2017 -0500
@@ -43,7 +43,7 @@
     }
 
     static void executeTest() throws Throwable {
-        final Throwable throwable[] = new Throwable[1];
+        final Throwable[] throwable = new Throwable[1];
         final ConcurrentHashMap<Integer, Integer> m = new ConcurrentHashMap<>();
 
         // Number of workers equal to the number of processors
--- a/test/jdk/java/util/concurrent/CountDownLatch/Basic.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/concurrent/CountDownLatch/Basic.java	Wed Nov 15 08:25:28 2017 -0500
@@ -96,7 +96,7 @@
         int count = 0;
         Basic test = new Basic();
         CountDownLatch latch = new CountDownLatch(3);
-        Awaiter a[] = new Awaiter[12];
+        Awaiter[] a = new Awaiter[12];
 
         for (int i = 0; i < 3; i++) {
             CountDownLatch gate = new CountDownLatch(4);
@@ -125,7 +125,7 @@
         int count = 0;
         Basic test = new Basic();
         CountDownLatch latch = new CountDownLatch(3);
-        Awaiter a[] = new Awaiter[12];
+        Awaiter[] a = new Awaiter[12];
 
         for (int i = 0; i < 3; i++) {
             CountDownLatch gate = new CountDownLatch(4);
@@ -156,7 +156,7 @@
         int count =0;
         Basic test = new Basic();
         CountDownLatch latch = new CountDownLatch(3);
-        Awaiter a[] = new Awaiter[12];
+        Awaiter[] a = new Awaiter[12];
 
         long[] timeout = { 0L, 5L, 10L };
 
--- a/test/jdk/java/util/concurrent/ExecutorService/Invoke.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/concurrent/ExecutorService/Invoke.java	Wed Nov 15 08:25:28 2017 -0500
@@ -35,6 +35,7 @@
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -140,13 +141,17 @@
         final boolean timed = rnd.nextBoolean();
         final ExecutorService pool = Executors.newSingleThreadExecutor();
         final AtomicLong count = new AtomicLong(0);
+        final CountDownLatch invokeAnyDone = new CountDownLatch(1);
         class Task implements Callable<Long> {
             public Long call() throws Exception {
                 long x = count.incrementAndGet();
                 check(x <= 2);
-                if (x == 2)
-                    // wait for main thread to interrupt us
+                if (x == 2) {
+                    // wait for main thread to interrupt us ...
                     awaitInterrupt(timeoutSeconds);
+                    // ... and then for invokeAny to return
+                    check(invokeAnyDone.await(timeoutSeconds, SECONDS));
+                }
                 return x;
             }
         }
@@ -166,6 +171,7 @@
             else
                 val = pool.invokeAny(tasks);
             check(val == 1);
+            invokeAnyDone.countDown();
 
             // inherent race between main thread interrupt and
             // start of second task
--- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/FlakyThreadFactory.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/FlakyThreadFactory.java	Wed Nov 15 08:25:28 2017 -0500
@@ -57,12 +57,14 @@
                 }});
         test(OutOfMemoryError.class,
              new ThreadFactory() {
-                public Thread newThread(Runnable r) {
-                    new Thread(null, r, "a natural OOME", 1L << 60);
-                    // """On some platforms, the value of the stackSize
-                    // parameter may have no effect whatsoever."""
-                    throw new OutOfMemoryError("artificial OOME");
-                }});
+                 @SuppressWarnings("DeadThread")
+                 public Thread newThread(Runnable r) {
+                     // We expect this to throw OOME, but ...
+                     new Thread(null, r, "a natural OOME", 1L << 60);
+                     // """On some platforms, the value of the stackSize
+                     // parameter may have no effect whatsoever."""
+                     throw new OutOfMemoryError("artificial OOME");
+                 }});
         test(null,
              new ThreadFactory() {
                 public Thread newThread(Runnable r) {
--- a/test/jdk/java/util/concurrent/locks/Lock/FlakyMutex.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/concurrent/locks/Lock/FlakyMutex.java	Wed Nov 15 08:25:28 2017 -0500
@@ -108,6 +108,7 @@
             case 0: throw new MyError();
             case 1: throw new MyRuntimeException();
             case 2: FlakyMutex.<RuntimeException>uncheckedThrow(new MyException());
+                // fall through ... NOT!
             default: return compareAndSetState(0, 1);
             }
         }
--- a/test/jdk/java/util/concurrent/tck/ConcurrentLinkedDequeTest.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/concurrent/tck/ConcurrentLinkedDequeTest.java	Wed Nov 15 08:25:28 2017 -0500
@@ -936,6 +936,14 @@
         }
     }
 
+    void runAsync(Runnable r1, Runnable r2) {
+        boolean b = ThreadLocalRandom.current().nextBoolean();
+        CompletableFuture<Void> f1 = CompletableFuture.runAsync(b ? r1 : r2);
+        CompletableFuture<Void> f2 = CompletableFuture.runAsync(b ? r2 : r1);
+        f1.join();
+        f2.join();
+    }
+
     /**
      * Non-traversing Deque operations are linearizable.
      * https://bugs.openjdk.java.net/browse/JDK-8188900
@@ -959,18 +967,9 @@
                             x, nulls.sum(), zeros.sum()));
             };
 
-            Runnable adder = () -> {
-                d.addFirst(0);
-                d.addLast(42);
-            };
+            Runnable adder = () -> { d.addFirst(0); d.addLast(42); };
 
-            boolean b = rnd.nextBoolean();
-            Runnable r1 = b ? getter : adder;
-            Runnable r2 = b ? adder : getter;
-            CompletableFuture<Void> f1 = CompletableFuture.runAsync(r1);
-            CompletableFuture<Void> f2 = CompletableFuture.runAsync(r2);
-            f1.join();
-            f2.join();
+            runAsync(getter, adder);
         }
     }
 
@@ -995,18 +994,48 @@
                             x, nulls.sum(), zeros.sum()));
             };
 
-            Runnable adder = () -> {
-                d.addLast(0);
-                d.addFirst(42);
-            };
+            Runnable adder = () -> { d.addLast(0); d.addFirst(42); };
+
+            runAsync(getter, adder);
+        }
+    }
+
+    <T> T chooseRandomly(T... choices) {
+        return choices[ThreadLocalRandom.current().nextInt(choices.length)];
+    }
 
-            boolean b = rnd.nextBoolean();
-            Runnable r1 = b ? getter : adder;
-            Runnable r2 = b ? adder : getter;
-            CompletableFuture<Void> f1 = CompletableFuture.runAsync(r1);
-            CompletableFuture<Void> f2 = CompletableFuture.runAsync(r2);
-            f1.join();
-            f2.join();
+    /**
+     * Non-traversing Deque operations (that return null) are linearizable.
+     * Don't return null when the deque is observably never empty.
+     * https://bugs.openjdk.java.net/browse/JDK-8189387
+     * ant -Djsr166.expensiveTests=true -Djsr166.tckTestClass=ConcurrentLinkedDequeTest -Djsr166.methodFilter=testBug8189387 tck
+     */
+    public void testBug8189387() {
+        final ThreadLocalRandom rnd = ThreadLocalRandom.current();
+        Object x = new Object();
+        for (int n = expensiveTests ? 100_000 : 10; n--> 0; ) {
+            ConcurrentLinkedDeque<Object> d = new ConcurrentLinkedDeque<>();
+            Runnable add = chooseRandomly(
+                () -> d.addFirst(x),
+                () -> d.offerFirst(x),
+                () -> d.addLast(x),
+                () -> d.offerLast(x));
+
+            Runnable get = chooseRandomly(
+                () -> assertFalse(d.isEmpty()),
+                () -> assertSame(x, d.peekFirst()),
+                () -> assertSame(x, d.peekLast()),
+                () -> assertSame(x, d.pollFirst()),
+                () -> assertSame(x, d.pollLast()));
+
+            Runnable addRemove = chooseRandomly(
+                () -> { d.addFirst(x); d.pollLast(); },
+                () -> { d.offerFirst(x); d.removeFirst(); },
+                () -> { d.offerLast(x); d.removeLast(); },
+                () -> { d.addLast(x); d.pollFirst(); });
+
+            add.run();
+            runAsync(get, addRemove);
         }
     }
 }
--- a/test/jdk/java/util/concurrent/tck/CountedCompleterTest.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/concurrent/tck/CountedCompleterTest.java	Wed Nov 15 08:25:28 2017 -0500
@@ -758,6 +758,8 @@
                 CCF f = new LCCF(8);
                 assertSame(f, f.fork());
                 helpQuiesce();
+                while (!f.isDone()) // wait out race
+                    ;
                 assertEquals(21, f.number);
                 assertEquals(0, getQueuedTaskCount());
                 checkCompletedNormally(f);
--- a/test/jdk/java/util/concurrent/tck/NonNestmates.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/concurrent/tck/NonNestmates.java	Wed Nov 15 08:25:28 2017 -0500
@@ -35,7 +35,6 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
--- a/test/jdk/java/util/concurrent/tck/SubmissionPublisherTest.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/java/util/concurrent/tck/SubmissionPublisherTest.java	Wed Nov 15 08:25:28 2017 -0500
@@ -593,7 +593,7 @@
 
     /**
      * estimateMinimumDemand reports 0 until request, nonzero after
-     * request, and zero again after delivery
+     * request
      */
     public void testEstimateMinimumDemand() {
         TestSubscriber s = new TestSubscriber();
@@ -604,9 +604,6 @@
         assertEquals(0, p.estimateMinimumDemand());
         s.sn.request(1);
         assertEquals(1, p.estimateMinimumDemand());
-        p.submit(1);
-        s.awaitNext(1);
-        assertEquals(0, p.estimateMinimumDemand());
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/logging/FileHandlerPatternGeneration.java	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,232 @@
+/*
+ * Copyright (c) 2017, 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.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.*;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.logging.FileHandler;
+import java.util.logging.LogManager;
+
+/**
+ * @test
+ * @bug 8189953
+ * @summary tests the pattern generation algorithm
+ * @modules java.logging/java.util.logging:open
+ * @run main/othervm FileHandlerPatternGeneration
+ * @author danielfuchs
+ */
+public class FileHandlerPatternGeneration {
+
+    /**
+     * An array of strings where the elements at even indices are the input
+     * to give to FileHandler::generate(pattern, count, generation, unique),
+     * and the elements at the next odd index are a partially computed expected
+     * output, where %t, %h, %u, %g and file separator still need to be replaced.
+     * The final expected output is obtained by passing the partially computed
+     * output to FileHandlerPatternGeneration::generateExpected
+     * <p>
+     * The test verifies that {@code
+     *    FileHandler.generate(PATTERN[i], c, g, u).toString()
+     * }
+     * is equal to {@code
+     *    FileHandlerPatternGeneration.generateExpected(PATTERN[i],
+     *                                                  PATTERN[i+1],
+     *                                                  c, g, u)
+     * }
+     */
+    static final String[] PATTERNS = {
+            "C:/Workspace/hoge.log",         "C:/Workspace/hoge.log",
+            "C:/Workspace%g/hoge.log",       "C:/Workspace%g/hoge.log",
+            "C:/%uWorkspace/hoge.log",       "C:/%uWorkspace/hoge.log",
+            "C:/%uWorkspace%g/hoge.log",     "C:/%uWorkspace%g/hoge.log",
+            "C:/Workspace/%ghoge.log",       "C:/Workspace/%ghoge.log",
+            "C:/Workspace/%ghoge%u.log",     "C:/Workspace/%ghoge%u.log",
+            "C:/Workspace-%g/hoge.log",      "C:/Workspace-%g/hoge.log",
+            "C:/Work%hspace/hoge.log",       "%h/space/hoge.log",
+            "C:/Works%tpace%g/hoge.log",     "%t/pace%g/hoge.log",
+            "C:/%uWork%hspace/hoge.log",     "%h/space/hoge.log",
+            "C:/%uWorkspace%g/%thoge.log",   "%t/hoge.log",
+            "C:/Workspace/%g%h%%hoge.log",   "%h/%%hoge.log",
+            "C:/Work%h%%hspace/hoge.log",    "%h/%%hspace/hoge.log",
+            "C:/Works%t%%hpace%g/hoge.log",  "%t/%%hpace%g/hoge.log",
+            "C:/%uWork%h%%tspace/hoge.log",  "%h/%%tspace/hoge.log",
+            "C:/%uWorkspace%g/%t%%hoge.log", "%t/%%hoge.log",
+            "C:/Workspace/%g%h%%hoge.log",   "%h/%%hoge.log",
+            "ahaha",                         "ahaha",
+            "ahaha/ahabe",                   "ahaha/ahabe",
+            "../ahaha/ahabe",                "../ahaha/ahabe",
+            "/x%ty/w/hoge.log",              "%t/y/w/hoge.log",
+            "/x/%ty/w/hoge.log",             "%t/y/w/hoge.log",
+            "/x%t/y/w/hoge.log",             "%t/y/w/hoge.log",
+            "/x/%t/y/w/hoge.log",            "%t/y/w/hoge.log",
+            "%ty/w/hoge.log",                "%t/y/w/hoge.log",
+            "%t/y/w/hoge.log",               "%t/y/w/hoge.log",
+            "/x%hy/w/hoge.log",              "%h/y/w/hoge.log",
+            "/x/%hy/w/hoge.log",             "%h/y/w/hoge.log",
+            "/x%h/y/w/hoge.log",             "%h/y/w/hoge.log",
+            "/x/%h/y/w/hoge.log",            "%h/y/w/hoge.log",
+            "%hy/w/hoge.log",                "%h/y/w/hoge.log",
+            "%h/y/w/hoge.log",               "%h/y/w/hoge.log",
+            "ahaha-%u-%g",                   "ahaha-%u-%g",
+            "ahaha-%g/ahabe-%u",             "ahaha-%g/ahabe-%u",
+            "../ahaha-%u/ahabe",             "../ahaha-%u/ahabe",
+            "/x%ty/w/hoge-%g.log",           "%t/y/w/hoge-%g.log",
+            "/x/%ty/w/hoge-%u.log",          "%t/y/w/hoge-%u.log",
+            "%u-%g/x%t/y/w/hoge.log",        "%t/y/w/hoge.log",
+            "/x/%g%t%u/y/w/hoge.log",        "%t/%u/y/w/hoge.log",
+            "%ty/w-%g/hoge.log",             "%t/y/w-%g/hoge.log",
+            "%t/y/w-%u/hoge.log",            "%t/y/w-%u/hoge.log",
+            "/x%hy/%u-%g-w/hoge.log",        "%h/y/%u-%g-w/hoge.log",
+            "/x/%hy/w-%u-%g/hoge.log",       "%h/y/w-%u-%g/hoge.log",
+            "/x%h/y/w/%u-%ghoge.log",        "%h/y/w/%u-%ghoge.log",
+            "/x/%h/y/w/hoge-%u-%g.log",      "%h/y/w/hoge-%u-%g.log",
+            "%hy/w/%u-%g-hoge.log",          "%h/y/w/%u-%g-hoge.log",
+            "%h/y/w/hoge-%u-%g.log",         "%h/y/w/hoge-%u-%g.log",
+            "/x/y/z/hoge-%u.log",            "/x/y/z/hoge-%u.log",
+    };
+
+    // the (count, generation, unique) parameters to pass to
+    // FileHandler.generate(pattern, count, generation, unique)
+    static final int[][] GENERATIONS = {
+        {0, 0, 0},
+        {0, 1, 0},
+        {0, 1, 1},
+        {1, 1, 0},
+        {1, 1, 1},
+        {1, 1, 2},
+        {1, 2, 3},
+        {3, 4, 0},
+        {3, 4, 1},
+        {3, 4, 2},
+        {3, 0, 5},
+        {3, 1, 5},
+        {3, 2, 5},
+    };
+
+    static final Class<FileHandler> FILE_HANDLER_CLASS = FileHandler.class;
+    static final Method GENERATE;
+    static final String USER_HOME;
+    static final String TMP;
+    static {
+        Method generate;
+        try {
+           generate = FILE_HANDLER_CLASS.getDeclaredMethod("generate",
+                                                            String.class,
+                                                            int.class,
+                                                            int.class,
+                                                            int.class);
+           generate.setAccessible(true);
+        } catch (Exception e) {
+            throw new ExceptionInInitializerError(e);
+        }
+        GENERATE = generate;
+        USER_HOME = System.getProperty("user.home");
+        TMP = System.getProperty("java.io.tmpdir", USER_HOME);
+    }
+
+    public static void main(String... args) throws Throwable {
+
+        for (int i=0; i < PATTERNS.length; i+=2) {
+            String s = PATTERNS[i];
+            String partial = PATTERNS[i+1];
+            System.out.println("generate: " + s);
+            for (int[] gen : GENERATIONS) {
+                String expected = generateExpected(s, partial, gen[0], gen[1], gen[2]);
+                String output = generate(s, gen[0], gen[1], gen[2]).toString();
+                System.out.println("\t" + Arrays.toString(gen)+ ": " + output);
+                if (!expected.equals(output)) {
+                    throw new RuntimeException("test failed for \""
+                            + s +"\" " + Arrays.toString(gen) + ": "
+                            + "\n\tgenerated: \"" + output +"\""
+                            + "\n\t expected: \"" + expected +"\"");
+                }
+            }
+        }
+
+    }
+
+    // Strip the trailing separator from the string, if present
+    static String stripTrailingSeparator(String s) {
+        if (s.endsWith("/")) {
+            return s.substring(0, s.length() -1);
+        } else if (s.endsWith(File.separator)) {
+            return s.substring(0, s.length() - File.separator.length());
+        } else {
+            return s;
+        }
+    }
+
+    /**
+     * Compute the final expected output from a partially computed output found
+     * at PATTERNS[i+1]
+     * @param s           The pattern string, found at PATTERN[i]
+     *                    (with i % 2 == 0)
+     * @param partial     The partially computed output, found at PATTERN[i+1]
+     * @param count       The count parameter given to FileHandler::generate
+     * @param generation  The generation parameter given to FileHandler::generate
+     * @param unique      The unique parameter given to FileHandler::generate
+     * @return  The expected output that FileHandler.generate(s, count, gen, unique)
+     *          should produce.
+     */
+    static String generateExpected(String s, String partial,
+                                   int count, int generation, int unique)
+    {
+        boolean sawu = s.replace("%%", "$$$$").contains("%u");
+        boolean sawg = s.replace("%%", "$$$$").contains("%g");
+        String result = partial.replace("%%", "$$$$");
+        String tmp = stripTrailingSeparator(TMP);
+        String home = stripTrailingSeparator(USER_HOME);
+        result = result.replace("%h", home);
+        result = result.replace("%t", tmp);
+        result = result.replace("%g", String.valueOf(generation));
+        result = result.replace("%u", String.valueOf(unique));
+        result = result.replace("$$$$", "%");
+        result = result.replace("/", File.separator);
+        if (count > 1 && !sawg) {
+            result = result + "." + generation;
+        }
+        if (unique > 0 && !sawu) {
+            result = result + "." + unique;
+        }
+        return result;
+    }
+
+    // Calls FileHandler.generate(s, count, generation, unique) through reflection
+    static File generate(String s, int count, int generation, int unique)
+            throws Throwable
+    {
+        try {
+            return (File) GENERATE.invoke(null, s, count, generation, unique);
+        } catch (InvocationTargetException e) {
+            throw e.getCause();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jdk/net/Sockets/QuickAckTest.java	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2017, 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 8145635
+ * @summary Add TCP_QUICKACK socket option
+ * @modules jdk.net
+ * @run main QuickAckTest
+ */
+import java.io.IOException;
+import java.net.DatagramSocket;
+import java.net.MulticastSocket;
+import java.net.ServerSocket;
+import java.net.Socket;
+import jdk.net.ExtendedSocketOptions;
+import jdk.net.Sockets;
+
+public class QuickAckTest {
+
+    private static final String LOCAL_HOST = "127.0.0.1";
+
+    public static void main(String args[]) throws IOException {
+
+        try (ServerSocket ss = new ServerSocket(0);
+                Socket s = new Socket(LOCAL_HOST, ss.getLocalPort());
+                DatagramSocket ds = new DatagramSocket(0);
+                MulticastSocket mc = new MulticastSocket(0)) {
+
+            if (ss.supportedOptions().contains(ExtendedSocketOptions.TCP_QUICKACK)) {
+                Sockets.setOption(ss, ExtendedSocketOptions.TCP_QUICKACK, true);
+                if (!ss.getOption(ExtendedSocketOptions.TCP_QUICKACK)) {
+                    throw new RuntimeException("Test failed, TCP_QUICKACK should"
+                            + " have been set");
+                }
+            }
+            if (s.supportedOptions().contains(ExtendedSocketOptions.TCP_QUICKACK)) {
+                Sockets.setOption(s, ExtendedSocketOptions.TCP_QUICKACK, true);
+                if (!s.getOption(ExtendedSocketOptions.TCP_QUICKACK)) {
+                    throw new RuntimeException("Test failed, TCP_QUICKACK should"
+                            + " have been set");
+                }
+            }
+            if (ds.supportedOptions().contains(ExtendedSocketOptions.TCP_QUICKACK)) {
+                throw new RuntimeException("Test failed, TCP_QUICKACK is applicable"
+                        + " for TCP Sockets only.");
+            }
+            if (mc.supportedOptions().contains(ExtendedSocketOptions.TCP_QUICKACK)) {
+                throw new RuntimeException("Test failed, TCP_QUICKACK is applicable"
+                        + " for TCP Sockets only");
+            }
+        }
+    }
+}
--- a/test/jdk/sun/util/calendar/zi/tzdata/VERSION	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/sun/util/calendar/zi/tzdata/VERSION	Wed Nov 15 08:25:28 2017 -0500
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2017b
+tzdata2017c
--- a/test/jdk/sun/util/calendar/zi/tzdata/africa	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/sun/util/calendar/zi/tzdata/africa	Wed Nov 15 08:25:28 2017 -0500
@@ -49,7 +49,7 @@
 #
 # For data circa 1899, a common source is:
 # Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
-# http://www.jstor.org/stable/1774359
+# https://www.jstor.org/stable/1774359
 #
 # A reliable and entertaining source about time zones is
 # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
@@ -241,7 +241,7 @@
 # saving time in Egypt will end in the night of 2007-09-06 to 2007-09-07.
 # From Jesper Nørgaard Welen (2007-08-15): [The following agree:]
 # http://www.nentjes.info/Bill/bill5.htm
-# http://www.timeanddate.com/worldclock/city.html?n=53
+# https://www.timeanddate.com/worldclock/city.html?n=53
 # From Steffen Thorsen (2007-09-04): The official information...:
 # http://www.sis.gov.eg/En/EgyptOnline/Miscellaneous/000002/0207000000000000001580.htm
 Rule	Egypt	2007	only	-	Sep	Thu>=1	24:00	0	-
@@ -279,8 +279,8 @@
 # timeanddate[2] and another site I've found[3] also support that.
 #
 # [1] https://bugzilla.redhat.com/show_bug.cgi?id=492263
-# [2] http://www.timeanddate.com/worldclock/clockchange.html?n=53
-# [3] http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
+# [2] https://www.timeanddate.com/worldclock/clockchange.html?n=53
+# [3] https://wwp.greenwichmeantime.com/time-zone/africa/egypt/
 
 # From Arthur David Olson (2009-04-20):
 # In 2009 (and for the next several years), Ramadan ends before the fourth
@@ -290,10 +290,10 @@
 # From Steffen Thorsen (2009-08-11):
 # We have been able to confirm the August change with the Egyptian Cabinet
 # Information and Decision Support Center:
-# http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html
+# https://www.timeanddate.com/news/time/egypt-dst-ends-2009.html
 #
 # The Middle East News Agency
-# http://www.mena.org.eg/index.aspx
+# https://www.mena.org.eg/index.aspx
 # also reports "Egypt starts winter time on August 21"
 # today in article numbered "71, 11/08/2009 12:25 GMT."
 # Only the title above is available without a subscription to their service,
@@ -343,7 +343,7 @@
 # Thursday of April....  Clocks will still be turned back for Ramadan, but
 # dates not yet announced....
 # http://almogaz.com/news/weird-news/2015/04/05/1947105 ...
-# http://www.timeanddate.com/news/time/egypt-starts-dst-2015.html
+# https://www.timeanddate.com/news/time/egypt-starts-dst-2015.html
 
 # From Ahmed Nazmy (2015-04-20):
 # Egypt's ministers cabinet just announced ... that it will cancel DST at
@@ -470,11 +470,11 @@
 
 # From Even Scharning (2012-11-10):
 # Libya set their time one hour back at 02:00 on Saturday November 10.
-# http://www.libyaherald.com/2012/11/04/clocks-to-go-back-an-hour-on-saturday/
+# https://www.libyaherald.com/2012/11/04/clocks-to-go-back-an-hour-on-saturday/
 # Here is an official source [in Arabic]: http://ls.ly/fb6Yc
 #
 # Steffen Thorsen forwarded a translation (2012-11-10) in
-# http://mm.icann.org/pipermail/tz/2012-November/018451.html
+# https://mm.icann.org/pipermail/tz/2012-November/018451.html
 #
 # From Tim Parenti (2012-11-11):
 # Treat the 2012-11-10 change as a zone change from UTC+2 to UTC+1.
@@ -485,7 +485,7 @@
 # From Even Scharning (2013-10-25):
 # The scheduled end of DST in Libya on Friday, October 25, 2013 was
 # cancelled yesterday....
-# http://www.libyaherald.com/2013/10/24/correction-no-time-change-tomorrow/
+# https://www.libyaherald.com/2013/10/24/correction-no-time-change-tomorrow/
 #
 # From Paul Eggert (2013-10-25):
 # For now, assume they're reverting to the pre-2012 rules of permanent UT +02.
@@ -538,7 +538,7 @@
 # basis....
 # It seems that Mauritius observed daylight saving time from 1982-10-10 to
 # 1983-03-20 as well, but that was not successful....
-# http://www.timeanddate.com/news/time/mauritius-daylight-saving-time.html
+# https://www.timeanddate.com/news/time/mauritius-daylight-saving-time.html
 
 # From Alex Krivenyshev (2008-06-25):
 # http://economicdevelopment.gov.mu/portal/site/Mainhomepage/menuitem.a42b24128104d9845dabddd154508a0c/?content_id=0a7cee8b5d69a110VgnVCM1000000a04a8c0RCRD
@@ -606,7 +606,7 @@
 # http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-%C3%A9conomie-d-%C3%A9nergie-de-l-heure-d-%C3%A9t%C3%A9-ont-%C3%A9t%C3%A9-atteints-
 #
 # Our wrap-up:
-# http://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html
+# https://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html
 
 # From Arthur David Olson (2009-07-11):
 # The "mauritius-dst-will-not-repeat" wrapup includes this:
@@ -638,7 +638,7 @@
 # be one hour ahead of GMT between 1 June and 27 September, according to
 # Communication Minister and Government Spokesman, Khalid Naciri...."
 #
-# http://www.worldtimezone.net/dst_news/dst_news_morocco01.html
+# http://www.worldtimezone.com/dst_news/dst_news_morocco01.html
 # http://en.afrik.com/news11892.html
 
 # From Alex Krivenyshev (2008-05-09):
@@ -651,7 +651,7 @@
 
 # From Patrice Scattolin (2008-05-09):
 # According to this article:
-# http://www.avmaroc.com/actualite/heure-dete-comment-a127896.html
+# https://www.avmaroc.com/actualite/heure-dete-comment-a127896.html
 # (and republished here: <http://www.actu.ma/heure-dete-comment_i127896_0.html>)
 # the changes occur at midnight:
 #
@@ -673,7 +673,7 @@
 # posted in English).
 #
 # The following Google query will generate many relevant hits:
-# http://www.google.com/search?hl=en&q=Conseil+de+gouvernement+maroc+heure+avance&btnG=Search
+# https://www.google.com/search?hl=en&q=Conseil+de+gouvernement+maroc+heure+avance&btnG=Search
 
 # From Steffen Thorsen (2008-08-27):
 # Morocco will change the clocks back on the midnight between August 31
@@ -684,7 +684,7 @@
 # http://www.menara.ma/fr/Actualites/Maroc/Societe/ci.retour_a_l_heure_gmt_a_partir_du_dimanche_31_aout_a_minuit_officiel_.default
 #
 # We have some further details posted here:
-# http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html
+# https://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html
 
 # From Steffen Thorsen (2009-03-17):
 # Morocco will observe DST from 2009-06-01 00:00 to 2009-08-21 00:00 according
@@ -694,7 +694,7 @@
 # (French)
 #
 # Our summary:
-# http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html
+# https://www.timeanddate.com/news/time/morocco-starts-dst-2009.html
 
 # From Alexander Krivenyshev (2009-03-17):
 # Here is a link to official document from Royaume du Maroc Premier Ministre,
@@ -717,7 +717,7 @@
 # http://www.lavieeco.com/actualites/4099-le-maroc-passera-a-l-heure-d-ete-gmt1-le-2-mai.html
 # (French)
 # Our page:
-# http://www.timeanddate.com/news/time/morocco-starts-dst-2010.html
+# https://www.timeanddate.com/news/time/morocco-starts-dst-2010.html
 
 # From Dan Abitol (2011-03-30):
 # ...Rules for Africa/Casablanca are the following (24h format)
@@ -734,7 +734,7 @@
 # They said that the decision was already taken.
 #
 # More articles in the press
-# http://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-leve.html
+# https://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-leve.html
 # http://www.lematin.ma/Actualite/Express/Article.asp?id=148923
 # http://www.lavieeco.com/actualite/Le-Maroc-passe-sur-GMT%2B1-a-partir-de-dim
 
@@ -826,7 +826,7 @@
 # 1433 (18 April 2012) and the decision of the Head of Government of
 # 16 N. 3-29-15 Chaaban 1435 (4 June 2015).
 # Source (french):
-# http://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/
+# https://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/
 #
 # From Milamber (2015-06-09):
 # http://www.mmsp.gov.ma/fr/actualites.aspx?id=863
@@ -835,7 +835,7 @@
 # [The gov.ma announcement] would (probably) make the switch on 2015-07-19 go
 # from 03:00 to 04:00 rather than from 02:00 to 03:00, as in the patch....
 # I think the patch is correct and the quoted text is wrong; the text in
-# <http://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/> agrees
+# <https://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/> agrees
 # with the patch.
 
 # From Paul Eggert (2015-06-08):
@@ -960,9 +960,17 @@
 Link Africa/Maputo Africa/Lubumbashi	# E Dem. Rep. of Congo
 Link Africa/Maputo Africa/Lusaka	# Zambia
 
+
 # Namibia
-# The 1994-04-03 transition is from Shanks & Pottenger.
-# Shanks & Pottenger report no DST after 1998-04; go with IATA.
+
+# From Arthur David Olson (2017-08-09):
+# The text of the "Namibia Time Act, 1994" is available online at
+# www.lac.org.na/laws/1994/811.pdf
+# and includes this nugget:
+# Notwithstanding the provisions of subsection (2) of section 1, the
+# first winter period after the commencement of this Act shall
+# commence at OOhOO on Monday 21 March 1994 and shall end at 02h00 on
+# Sunday 4 September 1994.
 
 # From Petronella Sibeene (2007-03-30):
 # http://allafrica.com/stories/200703300178.html
@@ -978,19 +986,30 @@
 # observes Botswana time, we have no details about historical practice.
 # In the meantime people there can use Africa/Gaborone.
 # See: Immanuel S. The Namibian. 2017-02-23.
-# http://www.namibian.com.na/51480/read/Time-change-divides-lawmakers
+# https://www.namibian.com.na/51480/read/Time-change-divides-lawmakers
+
+# From Steffen Thorsen (2017-08-09):
+# Namibia is going to change their time zone to what is now their DST:
+# https://www.newera.com.na/2017/02/23/namibias-winter-time-might-be-repealed/
+# This video is from the government decision:
+# https://www.nbc.na/news/na-passes-namibia-time-bill-repealing-1994-namibia-time-act.8665
+# We have made the assumption so far that they will change their time zone at
+# the same time they would normally start DST, the first Sunday in September:
+# https://www.timeanddate.com/news/time/namibia-new-time-zone.html
 
 # RULE	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-Rule	Namibia	1994	max	-	Sep	Sun>=1	2:00	1:00	S
-Rule	Namibia	1995	max	-	Apr	Sun>=1	2:00	0	-
+Rule	Namibia	1994	only	-	Mar	21	0:00	0	-
+Rule	Namibia	1994	2016	-	Sep	Sun>=1	2:00	1:00	S
+Rule	Namibia	1995	2017	-	Apr	Sun>=1	2:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Windhoek	1:08:24 -	LMT	1892 Feb 8
 			1:30	-	+0130	1903 Mar
 			2:00	-	SAST	1942 Sep 20  2:00
 			2:00	1:00	SAST	1943 Mar 21  2:00
 			2:00	-	SAST	1990 Mar 21 # independence
-			2:00	-	CAT	1994 Apr  3
-			1:00	Namibia	WA%sT
+			2:00	-	CAT	1994 Mar 21  0:00
+			1:00	Namibia	WA%sT	2017 Sep  3  2:00
+			2:00	-	CAT
 
 # Niger
 # See Africa/Lagos.
@@ -1077,14 +1096,24 @@
 # no information
 
 # Sudan
-#
+
 # From <http://www.sunanews.net/sn13jane.html>
 # Sudan News Agency (2000-01-13),
 # also reported by Michaël De Beukelaer-Dossche via Steffen Thorsen:
 # Clocks will be moved ahead for 60 minutes all over the Sudan as of noon
 # Saturday....  This was announced Thursday by Caretaker State Minister for
 # Manpower Abdul-Rahman Nur-Eddin.
+
+# From Ahmed Atyya, National Telecommunications Corp. (NTC), Sudan (2017-10-17):
+# ... the Republic of Sudan is going to change the time zone from (GMT+3:00)
+# to (GMT+ 2:00) starting from Wednesday 1 November 2017.
 #
+# From Paul Eggert (2017-10-18):
+# A scanned copy (in Arabic) of Cabinet Resolution No. 352 for the
+# year 2017 can be found as an attachment in email today from Yahia
+# Abdalla of NTC, archived at:
+# https://mm.icann.org/pipermail/tz/2017-October/025333.html
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Sudan	1970	only	-	May	 1	0:00	1:00	S
 Rule	Sudan	1970	1985	-	Oct	15	0:00	0	-
@@ -1093,10 +1122,14 @@
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Khartoum	2:10:08 -	LMT	1931
 			2:00	Sudan	CA%sT	2000 Jan 15 12:00
-			3:00	-	EAT
+			3:00	-	EAT	2017 Nov  1
+			2:00	-	CAT
 
 # South Sudan
-Link Africa/Khartoum Africa/Juba
+# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
+Zone	Africa/Juba	2:06:28 -	LMT	1931
+			2:00	Sudan	CA%sT	2000 Jan 15 12:00
+			3:00	-	EAT
 
 # Swaziland
 # See Africa/Johannesburg.
@@ -1134,11 +1167,11 @@
 # According to several news sources, Tunisia will not observe DST this year.
 # (Arabic)
 # http://www.elbashayer.com/?page=viewn&nid=42546
-# http://www.babnet.net/kiwidetail-15295.asp
+# https://www.babnet.net/kiwidetail-15295.asp
 #
 # We have also confirmed this with the US embassy in Tunisia.
 # We have a wrap-up about this on the following page:
-# http://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html
+# https://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html
 
 # From Alexander Krivenyshev (2009-03-17):
 # Here is a link to Tunis Afrique Presse News Agency
--- a/test/jdk/sun/util/calendar/zi/tzdata/antarctica	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/sun/util/calendar/zi/tzdata/antarctica	Wed Nov 15 08:25:28 2017 -0500
@@ -49,7 +49,7 @@
 # Heard Island, McDonald Islands (uninhabited)
 #	previously sealers and scientific personnel wintered
 #	Margaret Turner reports
-#	http://web.archive.org/web/20021204222245/http://www.dstc.qut.edu.au/DST/marg/daylight.html
+#	https://web.archive.org/web/20021204222245/http://www.dstc.qut.edu.au/DST/marg/daylight.html
 #	(1999-09-30) that they're UT +05, with no DST;
 #	presumably this is when they have visitors.
 #
@@ -70,7 +70,7 @@
 # http://www.aad.gov.au/default.asp?casid=37079
 #
 # We have more background information here:
-# http://www.timeanddate.com/news/time/antarctica-new-times.html
+# https://www.timeanddate.com/news/time/antarctica-new-times.html
 
 # From Steffen Thorsen (2010-03-10):
 # We got these changes from the Australian Antarctic Division: ...
@@ -85,7 +85,7 @@
 # - Mawson station stays on UTC+5.
 #
 # Background:
-# http://www.timeanddate.com/news/time/antartica-time-changes-2010.html
+# https://www.timeanddate.com/news/time/antartica-time-changes-2010.html
 
 # From Steffen Thorsen (2016-10-28):
 # Australian Antarctica Division informed us that Casey changed time
@@ -168,7 +168,7 @@
 #
 # year-round base in the main continent
 # Dumont d'Urville, Île des Pétrels, -6640+14001, since 1956-11
-# <http://en.wikipedia.org/wiki/Dumont_d'Urville_Station> (2005-12-05)
+# <https://en.wikipedia.org/wiki/Dumont_d'Urville_Station> (2005-12-05)
 #
 # Another base at Port-Martin, 50km east, began operation in 1947.
 # It was destroyed by fire on 1952-01-14.
--- a/test/jdk/sun/util/calendar/zi/tzdata/asia	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/sun/util/calendar/zi/tzdata/asia	Wed Nov 15 08:25:28 2017 -0500
@@ -49,7 +49,7 @@
 #
 # For data circa 1899, a common source is:
 # Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
-# http://www.jstor.org/stable/1774359
+# https://www.jstor.org/stable/1774359
 #
 # For Russian data circa 1919, a source is:
 # Byalokoz EL. New Counting of Time in Russia since July 1, 1919.
@@ -98,8 +98,8 @@
 Rule RussiaAsia	1981	1984	-	Apr	1	 0:00	1:00	S
 Rule RussiaAsia	1981	1983	-	Oct	1	 0:00	0	-
 Rule RussiaAsia	1984	1995	-	Sep	lastSun	 2:00s	0	-
-Rule RussiaAsia	1985	2011	-	Mar	lastSun	 2:00s	1:00	S
-Rule RussiaAsia	1996	2011	-	Oct	lastSun	 2:00s	0	-
+Rule RussiaAsia	1985	2010	-	Mar	lastSun	 2:00s	1:00	S
+Rule RussiaAsia	1996	2010	-	Oct	lastSun	 2:00s	0	-
 
 # Afghanistan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -132,13 +132,17 @@
 # or
 # (brief)
 # http://www.worldtimezone.com/dst_news/dst_news_armenia03.html
+# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
+Rule Armenia	2011	only	-	Mar	lastSun	 2:00s	1:00	S
+Rule Armenia	2011	only	-	Oct	lastSun	 2:00s	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Yerevan	2:58:00 -	LMT	1924 May  2
 			3:00	-	+03	1957 Mar
 			4:00 RussiaAsia +04/+05	1991 Mar 31  2:00s
 			3:00 RussiaAsia	+03/+04	1995 Sep 24  2:00s
 			4:00	-	+04	1997
-			4:00 RussiaAsia	+04/+05
+			4:00 RussiaAsia	+04/+05	2011
+			4:00	Armenia	+04/+05
 
 # Azerbaijan
 
@@ -150,7 +154,7 @@
 # From Steffen Thorsen (2016-03-17):
 # ... the Azerbaijani Cabinet of Ministers has cancelled switching to
 # daylight saving time....
-# http://www.azernews.az/azerbaijan/94137.html
+# https://www.azernews.az/azerbaijan/94137.html
 # http://vestnikkavkaza.net/news/Azerbaijani-Cabinet-of-Ministers-cancels-daylight-saving-time.html
 # http://en.apa.az/xeber_azerbaijan_abolishes_daylight_savings_ti_240862.html
 
@@ -191,11 +195,11 @@
 # the 19th and 20th, and they have not set the end date yet.
 #
 # Some sources:
-# http://in.reuters.com/article/southAsiaNews/idINIndia-40017620090601
+# https://in.reuters.com/article/southAsiaNews/idINIndia-40017620090601
 # http://bdnews24.com/details.php?id=85889&cid=2
 #
 # Our wrap-up:
-# http://www.timeanddate.com/news/time/bangladesh-daylight-saving-2009.html
+# https://www.timeanddate.com/news/time/bangladesh-daylight-saving-2009.html
 
 # From A. N. M. Kamrus Saadat (2009-06-15):
 # Finally we've got the official mail regarding DST start time where DST start
@@ -281,9 +285,15 @@
 
 # Milne says 6:24:40 was the meridian of the time ball observatory at Rangoon.
 
+# From Paul Eggert (2017-04-20):
+# Page 27 of Reed & Low (cited for Asia/Kolkata) says "Rangoon local time is
+# used upon the railways and telegraphs of Burma, and is 6h. 24m. 47s. ahead
+# of Greenwich."  This refers to the period before Burma's transition to +0630,
+# a transition for which Shanks is the only source.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Yangon	6:24:40 -	LMT	1880        # or Rangoon
-			6:24:40	-	RMT	1920        # Rangoon Mean Time?
+Zone	Asia/Yangon	6:24:47 -	LMT	1880        # or Rangoon
+			6:24:47	-	RMT	1920        # Rangoon local time
 			6:30	-	+0630	1942 May
 			9:00	-	+09	1945 May  3
 			6:30	-	+0630
@@ -340,7 +350,7 @@
 #
 # From Jesper Nørgaard Welen (2006-07-14):
 # I have investigated the timezones around 1970 on the
-# http://www.astro.com/atlas site [with provinces and county
+# https://www.astro.com/atlas site [with provinces and county
 # boundaries summarized below]....  A few other exceptions were two
 # counties on the Sichuan side of the Xizang-Sichuan border,
 # counties Dege and Baiyu which lies on the Sichuan side and are
@@ -492,7 +502,7 @@
 
 # From David Cochrane (2014-03-26):
 # Just a confirmation that Ürümqi time was implemented in Ürümqi on 1 Feb 1986:
-# http://content.time.com/time/magazine/article/0,9171,960684,00.html
+# https://content.time.com/time/magazine/article/0,9171,960684,00.html
 
 # From Luther Ma (2014-04-22):
 # I have interviewed numerous people of various nationalities and from
@@ -649,7 +659,7 @@
 # (both in Okinawa) adopt the Western Standard Time which is based on
 # 120E. The adoption began from Jan 1, 1896. The original text can be
 # found on Wikisource:
-# http://ja.wikisource.org/wiki/標準時ニ關スル件_(公布時)
+# https://ja.wikisource.org/wiki/標準時ニ關スル件_(公布時)
 # ... This could be the first adoption of time zone in Taiwan, because
 # during the Qing Dynasty, it seems that there was no time zone
 # declared officially.
@@ -662,7 +672,7 @@
 # territory, including later occupations, adopt Japan Central Time
 # (UTC+9). The adoption began on Oct 1, 1937. The original text can
 # be found on Wikisource:
-# http://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件
+# https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件
 #
 # That is, the time zone of Taipei switched to UTC+9 on Oct 1, 1937.
 
@@ -798,6 +808,12 @@
 # Looks like the time zone split in Cyprus went through last night.
 # http://cyprus-mail.com/2016/10/30/cyprus-new-division-two-time-zones-now-reality/
 
+# From Paul Eggert (2017-10-18):
+# Northern Cyprus will reinstate winter time on October 29, thus
+# staying in sync with the rest of Cyprus.  See: Anastasiou A.
+# Cyprus to remain united in time.  Cyprus Mail 2017-10-17.
+# https://cyprus-mail.com/2017/10/17/cyprus-remain-united-time/
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Cyprus	1975	only	-	Apr	13	0:00	1:00	S
 Rule	Cyprus	1975	only	-	Oct	12	0:00	0	-
@@ -815,7 +831,8 @@
 Zone	Asia/Famagusta	2:15:48	-	LMT	1921 Nov 14
 			2:00	Cyprus	EE%sT	1998 Sep
 			2:00	EUAsia	EE%sT	2016 Sep  8
-			3:00	-	+03
+			3:00	-	+03	2017 Oct 29 1:00u
+			2:00	EUAsia	EE%sT
 
 # Classically, Cyprus belongs to Asia; e.g. see Herodotus, Histories, I.72.
 # However, for various reasons many users expect to find it under Europe.
@@ -875,7 +892,7 @@
 
 # From João Carrascalão, brother of the former governor of East Timor, in
 # East Timor may be late for its millennium
-# <http://etan.org/et99c/december/26-31/30ETMAY.htm> (1999-12-26/31):
+# <https://etan.org/et99c/december/26-31/30ETMAY.htm> (1999-12-26/31):
 # Portugal tried to change the time forward in 1974 because the sun
 # rises too early but the suggestion raised a lot of problems with the
 # Timorese and I still don't think it would work today because it
@@ -903,21 +920,62 @@
 # India
 
 # From Ian P. Beacock, in "A brief history of (modern) time", The Atlantic
-# http://www.theatlantic.com/technology/archive/2015/12/the-creation-of-modern-time/421419/
+# https://www.theatlantic.com/technology/archive/2015/12/the-creation-of-modern-time/421419/
 # (2015-12-22):
 # In January 1906, several thousand cotton-mill workers rioted on the
 # outskirts of Bombay....  They were protesting the proposed abolition of
 # local time in favor of Indian Standard Time....  Journalists called this
 # dispute the "Battle of the Clocks."  It lasted nearly half a century.
 
+# From Paul Eggert (2017-04-20):
+# Good luck trying to nail down old timekeeping records in India.
+# "... in the nineteenth century ... Madras Observatory took its magnetic
+# measurements on Göttingen time, its meteorological measurements on Madras
+# (local) time, dropped its time ball on Greenwich (ocean navigator's) time,
+# and distributed civil (local time)." -- Bartky IR. Selling the true time:
+# 19th-century timekeeping in america. Stanford U Press (2000), 247 note 19.
+# "A more potent cause of resistance to the general adoption of the present
+# standard time lies in the fact that it is Madras time.  The citizen of
+# Bombay, proud of being 'primus in Indis' and of Calcutta, equally proud of
+# his city being the Capital of India, and - for a part of the year - the Seat
+# of the Supreme Government, alike look down on Madras, and refuse to change
+# the time they are using, for that of what they regard as a benighted
+# Presidency; while Madras, having for long given the standard time to the
+# rest of India, would resist the adoption of any other Indian standard in its
+# place." -- Oldham RD. On Time in India: a suggestion for its improvement.
+# Proceedings of the Asiatic Society of Bengal (April 1899), 49-55.
+#
+# "In 1870 ... Madras time - 'now used by the telegraph and regulated from the
+# only government observatory' - was suggested as a standard railway time,
+# first to be adopted on the Great Indian Peninsular Railway (GIPR)....
+# Calcutta, Bombay, and Karachi, were to be allowed to continue with their
+# local time for civil purposes." - Prasad R. Tracks of Change: Railways and
+# Everyday Life in Colonial India. Cambridge University Press (2016), 145.
+#
+# Reed S, Low F. The Indian Year Book 1936-37. Bennett, Coleman, pp 27-8.
+# https://archive.org/details/in.ernet.dli.2015.282212
+# This lists +052110 as Madras local time used in railways, and says that on
+# 1906-01-01 railways and telegraphs in India switched to +0530.  Some
+# municipalities retained their former time, and the time in Calcutta
+# continued to depend on whether you were at the railway station or at
+# government offices.  Government time was at +055320 (according to Shanks) or
+# at +0554 (according to the Indian Year Book).  Railway time is more
+# appropriate for our purposes, as it was better documented, it is what we do
+# elsewhere (e.g., Europe/London before 1880), and after 1906 it was
+# consistent in the region now identified by Asia/Kolkata.  So, use railway
+# time for 1870-1941.  Shanks is our only (and dubious) source for the
+# 1941-1945 data.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Kolkata	5:53:28 -	LMT	1880        # Kolkata
-			5:53:20	-	HMT	1941 Oct    # Howrah Mean Time?
-			6:30	-	+0630	1942 May 15
+Zone	Asia/Kolkata	5:53:28 -	LMT	1854 Jun 28 # Kolkata
+			5:53:20	-	HMT	1870	    # Howrah Mean Time?
+			5:21:10	-	MMT	1906 Jan  1 # Madras local time
+			5:30	-	IST	1941 Oct
+			5:30	1:00	+0630	1942 May 15
 			5:30	-	IST	1942 Sep
 			5:30	1:00	+0630	1945 Oct 15
 			5:30	-	IST
-# The following are like Asia/Kolkata:
+# Since 1970 the following are like Asia/Kolkata:
 #	Andaman Is
 #	Lakshadweep (Laccadive, Minicoy and Amindivi Is)
 #	Nicobar Is
@@ -1059,7 +1117,7 @@
 # From Reuters (2007-09-16), with a heads-up from Jesper Nørgaard Welen:
 # ... the Guardian Council ... approved a law on Sunday to re-introduce
 # daylight saving time ...
-# http://uk.reuters.com/article/oilRpt/idUKBLA65048420070916
+# https://uk.reuters.com/article/oilRpt/idUKBLA65048420070916
 #
 # From Roozbeh Pournader (2007-11-05):
 # This is quoted from Official Gazette of the Islamic Republic of
@@ -1158,7 +1216,7 @@
 # http://www.aswataliraq.info/look/article.tpl?id=2047&IdLanguage=17&IdPublication=4&NrArticle=71743&NrIssue=1&NrSection=10
 #
 # We have published a short article in English about the change:
-# http://www.timeanddate.com/news/time/iraq-dumps-daylight-saving.html
+# https://www.timeanddate.com/news/time/iraq-dumps-daylight-saving.html
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Iraq	1982	only	-	May	1	0:00	1:00	D
@@ -1466,12 +1524,12 @@
 # From Yu-Cheng Chuang (2013-07-12):
 # ...the Meiji Emperor announced Ordinance No. 167 of Meiji Year 28 "The clause
 # about standard time" ... The adoption began from Jan 1, 1896.
-# http://ja.wikisource.org/wiki/標準時ニ關スル件_(公布時)
+# https://ja.wikisource.org/wiki/標準時ニ關スル件_(公布時)
 #
 # ...the Showa Emperor announced Ordinance No. 529 of Showa Year 12 ... which
 # means the whole Japan territory, including later occupations, adopt Japan
 # Central Time (UTC+9). The adoption began on Oct 1, 1937.
-# http://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件
+# https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Tokyo	9:18:59	-	LMT	1887 Dec 31 15:00u
@@ -1533,7 +1591,7 @@
 # Official, in Arabic:
 # http://www.petra.gov.jo/public_news/Nws_NewsDetails.aspx?Menu_ID=&Site_Id=2&lang=1&NewsID=133230&CatID=14
 # ... Our background/permalink about it
-# http://www.timeanddate.com/news/time/jordan-reverses-dst-decision.html
+# https://www.timeanddate.com/news/time/jordan-reverses-dst-decision.html
 # ...
 # http://www.petra.gov.jo/Public_News/Nws_NewsDetails.aspx?lang=2&site_id=1&NewsID=133313&Type=P
 # ... says midnight for the coming one and 1:00 for the ones in the future
@@ -1891,9 +1949,9 @@
 # between 1987 and 1988 ...
 
 # From Sanghyuk Jung (2014-10-29):
-# http://mm.icann.org/pipermail/tz/2014-October/021830.html
+# https://mm.icann.org/pipermail/tz/2014-October/021830.html
 # According to the Korean Wikipedia
-# http://ko.wikipedia.org/wiki/한국_표준시
+# https://ko.wikipedia.org/wiki/한국_표준시
 # [oldid=12896437 2014-09-04 08:03 UTC]
 # DST in Republic of Korea was as follows....  And I checked old
 # newspapers in Korean, all articles correspond with data in Wikipedia.
@@ -2115,7 +2173,7 @@
 # +08:00 instead. Different sources appear to disagree with the tz
 # database on this, e.g.:
 #
-# http://www.timeanddate.com/worldclock/city.html?n=1026
+# https://www.timeanddate.com/worldclock/city.html?n=1026
 # http://www.worldtimeserver.com/current_time_in_MN.aspx
 #
 # both say GMT+08:00.
@@ -2245,7 +2303,7 @@
 # help reduce load shedding by approving the closure of commercial centres at
 # 9pm and moving clocks forward by one hour for the next three months. ...."
 #
-# http://www.worldtimezone.net/dst_news/dst_news_pakistan01.html
+# http://www.worldtimezone.com/dst_news/dst_news_pakistan01.html
 # http://www.dailytimes.com.pk/default.asp?page=2008%5C05%5C15%5Cstory_15-5-2008_pg1_4
 
 # From Arthur David Olson (2008-05-19):
@@ -2311,7 +2369,7 @@
 #
 # We have confirmed this year's end date with both with the Ministry of
 # Water and Power and the Pakistan Electric Power Company:
-# http://www.timeanddate.com/news/time/pakistan-ends-dst09.html
+# https://www.timeanddate.com/news/time/pakistan-ends-dst09.html
 
 # From Christoph Göhre (2009-10-01):
 # [T]he German Consulate General in Karachi reported me today that Pakistan
@@ -2493,7 +2551,7 @@
 #
 # We are not sure if Gaza will do the same, last year they had a different
 # end date, we will keep this page updated:
-# http://www.timeanddate.com/news/time/westbank-gaza-dst-2009.html
+# https://www.timeanddate.com/news/time/westbank-gaza-dst-2009.html
 
 # From Alexander Krivenyshev (2009-09-02):
 # Seems that Gaza Strip will go back to Winter Time same date as West Bank.
@@ -2531,7 +2589,7 @@
 # the clocks were set back one hour at 2010-08-11 00:00:00 local time in
 # Gaza and the West Bank.
 # Some more background info:
-# http://www.timeanddate.com/news/time/westbank-gaza-end-dst-2010.html
+# https://www.timeanddate.com/news/time/westbank-gaza-end-dst-2010.html
 
 # From Steffen Thorsen (2011-08-26):
 # Gaza and the West Bank did go back to standard time in the beginning of
@@ -2541,7 +2599,7 @@
 #
 # http://www.maannews.net/eng/ViewDetails.aspx?ID=416217
 # Additional info:
-# http://www.timeanddate.com/news/time/palestine-dst-2011.html
+# https://www.timeanddate.com/news/time/palestine-dst-2011.html
 
 # From Alexander Krivenyshev (2011-08-27):
 # According to the article in The Jerusalem Post:
@@ -2551,7 +2609,7 @@
 # The Hamas government said on Saturday that it won't observe summertime after
 # the Muslim feast of Id al-Fitr, which begins on Tuesday..."
 # ...
-# http://www.jpost.com/MiddleEast/Article.aspx?id=235650
+# https://www.jpost.com/MiddleEast/Article.aspx?id=235650
 # http://www.worldtimezone.com/dst_news/dst_news_gazastrip05.html
 # The rules for Egypt are stolen from the 'africa' file.
 
@@ -2572,7 +2630,7 @@
 # http://safa.ps/details/news/74352/%D8%A8%D8%AF%D8%A1-%D8%A7%D9%84%D8%AA%D9%88%D9%82%D9%8A%D8%AA-%D8%A7%D9%84%D8%B5%D9%8A%D9%81%D9%8A-%D8%A8%D8%A7%D9%84%D8%B6%D9%81%D8%A9-%D9%88%D8%BA%D8%B2%D8%A9-%D9%84%D9%8A%D9%84%D8%A9-%D8%A7%D9%84%D8%AC%D9%85%D8%B9%D8%A9.html
 #
 # Our brief summary:
-# http://www.timeanddate.com/news/time/gaza-west-bank-dst-2012.html
+# https://www.timeanddate.com/news/time/gaza-west-bank-dst-2012.html
 
 # From Steffen Thorsen (2013-03-26):
 # The following news sources tells that Palestine will "start daylight saving
@@ -2592,11 +2650,11 @@
 
 # From Steffen Thorsen (2015-03-03):
 # Sources such as http://www.alquds.com/news/article/view/id/548257
-# and http://www.raya.ps/ar/news/890705.html say Palestine areas will
+# and https://www.raya.ps/ar/news/890705.html say Palestine areas will
 # start DST on 2015-03-28 00:00 which is one day later than expected.
 #
 # From Paul Eggert (2015-03-03):
-# http://www.timeanddate.com/time/change/west-bank/ramallah?year=2014
+# https://www.timeanddate.com/time/change/west-bank/ramallah?year=2014
 # says that the fall 2014 transition was Oct 23 at 24:00.
 
 # From Hannah Kreitem (2016-03-09):
@@ -2620,8 +2678,8 @@
 #
 # From Paul Eggert (2016-10-19):
 # It's also consistent with predictions in the following URLs today:
-# http://www.timeanddate.com/time/change/gaza-strip/gaza
-# http://www.timeanddate.com/time/change/west-bank/hebron
+# https://www.timeanddate.com/time/change/gaza-strip/gaza
+# https://www.timeanddate.com/time/change/west-bank/hebron
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule EgyptAsia	1957	only	-	May	10	0:00	1:00	S
@@ -2684,7 +2742,7 @@
 # Philippines, issued a proclamation announcing that 1844-12-30 was to
 # be immediately followed by 1845-01-01; see R.H. van Gent's
 # History of the International Date Line
-# http://www.staff.science.uu.nl/~gent0113/idl/idl_philippines.htm
+# https://www.staff.science.uu.nl/~gent0113/idl/idl_philippines.htm
 # The rest of the data entries are from Shanks & Pottenger.
 
 # From Jesper Nørgaard Welen (2006-04-26):
@@ -2948,7 +3006,7 @@
 # We have not found any sources saying anything about when DST ends this year.
 #
 # Our summary
-# http://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html
+# https://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html
 
 # From Steffen Thorsen (2009-10-27):
 # The Syrian Arab News Network on 2009-09-29 reported that Syria will
@@ -2975,7 +3033,7 @@
 # http://www.sana.sy/ara/2/2012/03/26/408215.htm
 #
 # Our brief summary:
-# http://www.timeanddate.com/news/time/syria-dst-2012.html
+# https://www.timeanddate.com/news/time/syria-dst-2012.html
 
 # From Arthur David Olson (2012-03-27):
 # Assume last Friday in March going forward XXX.
@@ -3058,7 +3116,7 @@
 # is quoted verbatim in:
 # http://www.thoigian.com.vn/?mPage=P80D01
 # is translated by Brian Inglis in:
-# http://mm.icann.org/pipermail/tz/2014-October/021654.html
+# https://mm.icann.org/pipermail/tz/2014-October/021654.html
 # and is the basis for the information below.
 #
 # The 1906 transition was effective July 1 and standardized Indochina to
--- a/test/jdk/sun/util/calendar/zi/tzdata/australasia	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/sun/util/calendar/zi/tzdata/australasia	Wed Nov 15 08:25:28 2017 -0500
@@ -316,7 +316,7 @@
 # http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=1096:3310-cabinet-approves-change-in-daylight-savings-dates&catid=49:cabinet-releases&Itemid=166
 #
 # A bit more background info here:
-# http://www.timeanddate.com/news/time/fiji-dst-ends-march-2010.html
+# https://www.timeanddate.com/news/time/fiji-dst-ends-march-2010.html
 
 # From Alexander Krivenyshev (2010-10-24):
 # According to Radio Fiji and Fiji Times online, Fiji will end DST 3
@@ -380,9 +380,12 @@
 # clocks go forward an hour at 2am to 3am....  Daylight Saving will
 # end at 3.00am on Sunday 15th January 2017."
 
-# From Paul Eggert (2016-10-03):
-# For now, guess DST from 02:00 the first Sunday in November to
-# 03:00 the third Sunday in January.  Although ad hoc, it matches
+# From Paul Eggert (2017-08-21):
+# Dominic Fok writes (2017-08-20) that DST ends 2018-01-14, citing
+# Extraordinary Government of Fiji Gazette Supplement No. 21 (2017-08-27),
+# [Legal Notice No. 41] of an order of the previous day by J Usamate.
+# For now, guess DST from 02:00 the first Sunday in November to 03:00
+# the first Sunday on or after January 14.  Although ad hoc, it matches
 # transitions since late 2014 and seems more likely to match future
 # practice than guessing no DST.
 
@@ -396,7 +399,7 @@
 Rule	Fiji	2012	2013	-	Jan	Sun>=18	3:00	0	-
 Rule	Fiji	2014	only	-	Jan	Sun>=18	2:00	0	-
 Rule	Fiji	2014	max	-	Nov	Sun>=1	2:00	1:00	S
-Rule	Fiji	2015	max	-	Jan	Sun>=15	3:00	0	-
+Rule	Fiji	2015	max	-	Jan	Sun>=14	3:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fiji	11:55:44 -	LMT	1915 Oct 26 # Suva
 			12:00	Fiji	+12/+13
@@ -580,7 +583,7 @@
 # The World War II entries below are instead based on Arawa-Kieta.
 # The Japanese occupied Kieta in July 1942,
 # according to the Pacific War Online Encyclopedia
-# http://pwencycl.kgbudge.com/B/o/Bougainville.htm
+# https://pwencycl.kgbudge.com/B/o/Bougainville.htm
 # and seem to have controlled it until their 1945-08-21 surrender.
 #
 # The Autonomous Region of Bougainville switched from UT +10 to +11
@@ -602,7 +605,7 @@
 			-8:00	-	-08
 
 # American Samoa
-Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1879 Jul  5
+Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1892 Jul  5
 			-11:22:48 -	LMT	1911
 			-11:00	-	SST	            # S=Samoa
 Link Pacific/Pago_Pago Pacific/Midway # in US minor outlying islands
@@ -618,7 +621,7 @@
 # Sunday of April 2011."
 #
 # Background info:
-# http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
+# https://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
 #
 # Samoa's Daylight Saving Time Act 2009 is available here, but does not
 # contain any dates:
@@ -682,7 +685,7 @@
 Rule	WS	2012	max	-	Apr	Sun>=1	4:00	0	S
 Rule	WS	2012	max	-	Sep	lastSun	3:00	1	D
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
+Zone Pacific/Apia	 12:33:04 -	LMT	1892 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	-1130	1950
 			-11:00	WS	-11/-10	2011 Dec 29 24:00
@@ -709,7 +712,7 @@
 # From Paul Eggert (2012-07-25)
 # A Google Books snippet of Appendix to the Journals of the House of
 # Representatives of New Zealand, Session 1948,
-# <http://books.google.com/books?id=ZaVCAQAAIAAJ>, page 65, says Tokelau
+# <https://books.google.com/books?id=ZaVCAQAAIAAJ>, page 65, says Tokelau
 # was "11 hours slow on G.M.T."  Go with Thorsen and assume Shanks & Pottenger
 # are off by an hour starting in 1901.
 
@@ -724,8 +727,8 @@
 Rule	Tonga	2000	only	-	Mar	19	2:00s	0	-
 Rule	Tonga	2000	2001	-	Nov	Sun>=1	2:00	1:00	S
 Rule	Tonga	2001	2002	-	Jan	lastSun	2:00	0	-
-Rule	Tonga	2016	max	-	Nov	Sun>=1	2:00	1:00	S
-Rule	Tonga	2017	max	-	Jan	Sun>=15	3:00	0	-
+Rule	Tonga	2016	only	-	Nov	Sun>=1	2:00	1:00	S
+Rule	Tonga	2017	only	-	Jan	Sun>=15	3:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Pacific/Tongatapu	12:19:20 -	LMT	1901
 			12:20	-	+1220	1941
@@ -779,7 +782,7 @@
 # Operation Fishbowl shot (Tightrope, 1962-11-04).... [See] Herman Hoerlin,
 # "The United States High-Altitude Test Experience: A Review Emphasizing the
 # Impact on the Environment", Los Alamos LA-6405, Oct 1976.
-# http://www.fas.org/sgp/othergov/doe/lanl/docs1/00322994.pdf
+# https://www.fas.org/sgp/othergov/doe/lanl/docs1/00322994.pdf
 # See the table on page 4 where he lists GMT and local times for the tests; a
 # footnote for the JI tests reads that local time is "JI time = Hawaii Time
 # Minus One Hour".
@@ -845,7 +848,7 @@
 #
 # For data circa 1899, a common source is:
 # Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
-# http://www.jstor.org/stable/1774359
+# https://www.jstor.org/stable/1774359
 #
 # A reliable and entertaining source about time zones is
 # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
@@ -992,7 +995,7 @@
 #   AEST ACST AWST AEDT ACDT
 #
 #   Parliamentary Library (2008-11-10)
-#   http://www.aph.gov.au/binaries/library/pubs/rp/2008-09/09rp14.pdf
+#   https://www.aph.gov.au/binaries/library/pubs/rp/2008-09/09rp14.pdf
 #   EST CST WST preferred for standard time; AEST AEDT ACST ACDT also used
 #
 #   The Transport Safety Bureau has an extensive series of accident reports,
@@ -1028,13 +1031,13 @@
 #
 # NSW (including LHI and Broken Hill):
 # Standard Time Act 1987 (updated 1995-04-04)
-# http://www.austlii.edu.au/au/legis/nsw/consol_act/sta1987137/index.html
+# https://www.austlii.edu.au/au/legis/nsw/consol_act/sta1987137/index.html
 # ACT
 # Standard Time and Summer Time Act 1972
-# http://www.austlii.edu.au/au/legis/act/consol_act/stasta1972279/index.html
+# https://www.austlii.edu.au/au/legis/act/consol_act/stasta1972279/index.html
 # SA
 # Standard Time Act, 1898
-# http://www.austlii.edu.au/au/legis/sa/consol_act/sta1898137/index.html
+# https://www.austlii.edu.au/au/legis/sa/consol_act/sta1898137/index.html
 
 # From David Grosz (2005-06-13):
 # It was announced last week that Daylight Saving would be extended by
@@ -1329,7 +1332,7 @@
 # http://abc.net.au/news/regionals/neweng/monthly/regeng-22jul1999-1.htm
 # (1999-07-22).  For now, we'll wait to see if this really happens.
 #
-# Victoria will following NSW.  See:
+# Victoria will follow NSW.  See:
 # Vic to extend daylight saving (1999-07-28)
 # http://abc.net.au/local/news/olympics/1999/07/item19990728112314_1.htm
 #
@@ -1432,7 +1435,7 @@
 # the ACT for all 52 weeks of the year...
 #
 # We have a wrap-up here:
-# http://www.timeanddate.com/news/time/south-australia-extends-dst.html
+# https://www.timeanddate.com/news/time/south-australia-extends-dst.html
 ###############################################################################
 
 # New Zealand
@@ -1486,7 +1489,7 @@
 # From Paul Eggert (2014-07-14):
 # Chatham Island time was formally standardized on 1957-01-01 by
 # New Zealand's Standard Time Amendment Act 1956 (1956-10-26).
-# http://www.austlii.edu.au/nz/legis/hist_act/staa19561956n100244.pdf
+# https://www.austlii.edu.au/nz/legis/hist_act/staa19561956n100244.pdf
 # According to Google Books snippet view, a speaker in the New Zealand
 # parliamentary debates in 1956 said "Clause 78 makes provision for standard
 # time in the Chatham Islands.  The time there is 45 minutes in advance of New
@@ -1601,7 +1604,7 @@
 # the Norfolk Island Museum and the Australian Bureau of Meteorology's
 # Norfolk Island station, and found no record of Norfolk observing DST
 # other than in 1974/5.  See:
-# http://www.timeanddate.com/time/australia/norfolk-island.html
+# https://www.timeanddate.com/time/australia/norfolk-island.html
 
 # Pitcairn
 
@@ -1629,11 +1632,13 @@
 
 # (Western) Samoa and American Samoa
 
-# Howse writes (p 153, citing p 10 of the 1883-11-18 New York Herald)
-# that in 1879 the King of Samoa decided to change
+# Howse writes (p 153) that after the 1879 standardization on Antipodean
+# time by the British governor of Fiji, the King of Samoa decided to change
 # "the date in his kingdom from the Antipodean to the American system,
 # ordaining - by a masterpiece of diplomatic flattery - that
 # the Fourth of July should be celebrated twice in that year."
+# This happened in 1892, according to the Evening News (Sydney) of 1892-07-20.
+# https://www.staff.science.uu.nl/~gent0113/idl/idl.htm
 
 # Although Shanks & Pottenger says they both switched to UT -11:30
 # in 1911, and to -11 in 1950. many earlier sources give -11
@@ -1644,6 +1649,7 @@
 # day in 2011.  Assume also that the Samoas follow the US and New
 # Zealand's "ST"/"DT" style of daylight-saving abbreviations.
 
+
 # Tonga
 
 # From Paul Eggert (1996-01-22):
@@ -1738,6 +1744,15 @@
 # Assume Tonga will observe DST from the first Sunday in November at 02:00
 # through the third Sunday in January at 03:00, like Fiji, for now.
 
+# From David Wade (2017-10-18):
+# In August government was disolved by the King.  The current prime minister
+# continued in office in care taker mode.  It is easy to see that few
+# decisions will be made until elections 16th November.
+#
+# From Paul Eggert (2017-10-18):
+# For now, guess that DST is discontinued.  That's what the IATA is guessing.
+
+
 # Wake
 
 # From Vernice Anderson, Personal Secretary to Philip Jessup,
@@ -1750,7 +1765,7 @@
 # making calculation of time in Washington difficult if not almost
 # impossible.
 #
-# http://www.trumanlibrary.org/wake/meeting.htm
+# https://www.trumanlibrary.org/oralhist/andrsonv.htm
 
 # From Paul Eggert (2003-03-23):
 # We have no other report of DST in Wake Island, so omit this info for now.
@@ -1778,7 +1793,7 @@
 # an international standard, there are some places on the high seas where the
 # correct date is ambiguous.
 
-# From Wikipedia <http://en.wikipedia.org/wiki/Time_zone> (2005-08-31):
+# From Wikipedia <https://en.wikipedia.org/wiki/Time_zone> (2005-08-31):
 # Before 1920, all ships kept local apparent time on the high seas by setting
 # their clocks at night or at the morning sight so that, given the ship's
 # speed and direction, it would be 12 o'clock when the Sun crossed the ship's
--- a/test/jdk/sun/util/calendar/zi/tzdata/backward	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/sun/util/calendar/zi/tzdata/backward	Wed Nov 15 08:25:28 2017 -0500
@@ -84,7 +84,9 @@
 Link	America/Manaus		Brazil/West
 Link	America/Halifax		Canada/Atlantic
 Link	America/Winnipeg	Canada/Central
-Link	America/Regina		Canada/East-Saskatchewan
+# This line is commented out, as the name exceeded the 14-character limit
+# and was an unused misnomer.
+#Link	America/Regina		Canada/East-Saskatchewan
 Link	America/Toronto		Canada/Eastern
 Link	America/Edmonton	Canada/Mountain
 Link	America/St_Johns	Canada/Newfoundland
--- a/test/jdk/sun/util/calendar/zi/tzdata/europe	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/sun/util/calendar/zi/tzdata/europe	Wed Nov 15 08:25:28 2017 -0500
@@ -60,14 +60,14 @@
 #	[PDF] (1914-03)
 #
 #	Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
-#	<http://www.jstor.org/stable/1774359>.  He writes:
+#	<https://www.jstor.org/stable/1774359>.  He writes:
 #	"It is requested that corrections and additions to these tables
 #	may be sent to Mr. John Milne, Royal Geographical Society,
 #	Savile Row, London."  Nowadays please email them to tz@iana.org.
 #
 #	Byalokoz EL. New Counting of Time in Russia since July 1, 1919.
 #	This Russian-language source was consulted by Vladimir Karpinsky; see
-#	http://mm.icann.org/pipermail/tz/2014-August/021320.html
+#	https://mm.icann.org/pipermail/tz/2014-August/021320.html
 #	The full Russian citation is:
 #	Бялокоз, Евгений Людвигович. Новый счет времени в течении суток
 #	введенный декретом Совета народных комиссаров для всей России с 1-го
@@ -210,7 +210,7 @@
 # foundations of civilization throughout the world.
 #	-- "A Silent Toast to William Willett", Pictorial Weekly;
 #	republished in Finest Hour (Spring 2002) 1(114):26
-#	http://www.winstonchurchill.org/images/finesthour/Vol.01%20No.114.pdf
+#	https://www.winstonchurchill.org/publications/finest-hour/finest-hour-114/a-silent-toast-to-william-willett-by-winston-s-churchill
 
 # From Paul Eggert (2015-08-08):
 # The OED Supplement says that the English originally said "Daylight Saving"
@@ -248,8 +248,8 @@
 # official designation; the reply of the 21st was that there wasn't
 # but he couldn't think of anything better than the "Double British
 # Summer Time" that the BBC had been using informally.
-# http://www.polyomino.org.uk/british-time/bbc-19410418.png
-# http://www.polyomino.org.uk/british-time/ho-19410421.png
+# https://www.polyomino.org.uk/british-time/bbc-19410418.png
+# https://www.polyomino.org.uk/british-time/ho-19410421.png
 
 # From Sir Alexander Maxwell in the above-mentioned letter (1941-04-21):
 # [N]o official designation has as far as I know been adopted for the time
@@ -266,13 +266,13 @@
 # the history of summer time legislation in the United Kingdom.
 # Since 1998 Joseph S. Myers has been updating
 # and extending this list, which can be found in
-# http://www.polyomino.org.uk/british-time/
+# https://www.polyomino.org.uk/british-time/
 
 # From Joseph S. Myers (1998-01-06):
 #
 # The legal time in the UK outside of summer time is definitely GMT, not UTC;
 # see Lord Tanlaw's speech
-# http://www.publications.parliament.uk/pa/ld199798/ldhansrd/vo970611/text/70611-10.htm#70611-10_head0
+# https://www.publications.parliament.uk/pa/ld199798/ldhansrd/vo970611/text/70611-10.htm#70611-10_head0
 # (Lords Hansard 11 June 1997 columns 964 to 976).
 
 # From Paul Eggert (2006-03-22):
@@ -318,7 +318,7 @@
 # Irish 'public feeling (was) outraged by forcing of English time on us'."
 # -- Parsons M. Dublin lost its time zone - and 25 minutes - after 1916 Rising.
 # Irish Times 2014-10-27.
-# http://www.irishtimes.com/news/politics/dublin-lost-its-time-zone-and-25-minutes-after-1916-rising-1.1977411
+# https://www.irishtimes.com/news/politics/dublin-lost-its-time-zone-and-25-minutes-after-1916-rising-1.1977411
 
 # From Joseph S. Myers (2005-01-26):
 # Irish laws are available online at <http://www.irishstatutebook.ie>.
@@ -371,6 +371,12 @@
 # Justice (tel +353 1 678 9711) who confirmed to me that the correct name is
 # "Irish Summer Time", abbreviated to "IST".
 
+# Michael Deckers (2017-06-01) gave the following URLs for Ireland's
+# Summer Time Act, 1925 and Summer Time Orders, 1926 and 1947:
+# http://www.irishstatutebook.ie/eli/1925/act/8/enacted/en/print.html
+# http://www.irishstatutebook.ie/eli/1926/sro/919/made/en/print.html
+# http://www.irishstatutebook.ie/eli/1947/sro/71/made/en/print.html
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 # Summer Time Act, 1916
 Rule	GB-Eire	1916	only	-	May	21	2:00s	1:00	BST
@@ -495,14 +501,14 @@
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Europe/Dublin	-0:25:00 -	LMT	1880 Aug  2
-			-0:25:21 -	DMT	1916 May 21  2:00 # Dublin MT
+			-0:25:21 -	DMT	1916 May 21  2:00s # Dublin MT
 			-0:25:21 1:00	IST	1916 Oct  1  2:00s
 			 0:00	GB-Eire	%s	1921 Dec  6 # independence
-			 0:00	GB-Eire	GMT/IST	1940 Feb 25  2:00
-			 0:00	1:00	IST	1946 Oct  6  2:00
-			 0:00	-	GMT	1947 Mar 16  2:00
-			 0:00	1:00	IST	1947 Nov  2  2:00
-			 0:00	-	GMT	1948 Apr 18  2:00
+			 0:00	GB-Eire	GMT/IST	1940 Feb 25  2:00s
+			 0:00	1:00	IST	1946 Oct  6  2:00s
+			 0:00	-	GMT	1947 Mar 16  2:00s
+			 0:00	1:00	IST	1947 Nov  2  2:00s
+			 0:00	-	GMT	1948 Apr 18  2:00s
 			 0:00	GB-Eire	GMT/IST	1968 Oct 27
 			 1:00	-	IST	1971 Oct 31  2:00u
 			 0:00	GB-Eire	GMT/IST	1996
@@ -648,7 +654,7 @@
 # Council of Ministers of the USSR from 1989-03-14 No. 227.
 #
 # I did not find full texts of these acts.  For the 1989 one we have
-# title at http://base.garant.ru/70754136/ :
+# title at https://base.garant.ru/70754136/ :
 # "About change in calculation of time on the territories of
 # Lithuanian SSR, Latvian SSR and Estonian SSR, Astrakhan,
 # Kaliningrad, Kirov, Kuybyshev, Ulyanovsk and Uralsk oblasts".
@@ -679,7 +685,7 @@
 # http://bmockbe.ru/events/?ID=7583
 #
 # Medvedev signed a law on the calculation of the time (in russian):
-# http://www.regnum.ru/news/polit/1413906.html
+# https://www.regnum.ru/news/polit/1413906.html
 
 # From Arthur David Olson (2011-06-15):
 # Take "abolishing daylight saving time" to mean that time is now considered
@@ -806,7 +812,7 @@
 # Sources (Russian language):
 # http://www.belta.by/ru/all_news/society/V-Belarusi-otmenjaetsja-perexod-na-sezonnoe-vremja_i_572952.html
 # http://naviny.by/rubrics/society/2011/09/16/ic_articles_116_175144/
-# http://news.tut.by/society/250578.html
+# https://news.tut.by/society/250578.html
 #
 # From Alexander Bokovoy (2014-10-09):
 # Belarussian government decided against changing to winter time....
@@ -1127,7 +1133,7 @@
 # for their standard and summer times. He says no, they use "suveaeg"
 # (summer time) and "talveaeg" (winter time).
 
-# From The Baltic Times <http://www.baltictimes.com/> (1999-09-09)
+# From The Baltic Times <https://www.baltictimes.com/> (1999-09-09)
 # via Steffen Thorsen:
 # This year will mark the last time Estonia shifts to summer time,
 # a council of the ruling coalition announced Sept. 6....
@@ -1179,7 +1185,7 @@
 # This is documented in Heikki Oja: Aikakirja 2007, published by The Almanac
 # Office of University of Helsinki, ISBN 952-10-3221-9, available online (in
 # Finnish) at
-# http://almanakka.helsinki.fi/aikakirja/Aikakirja2007kokonaan.pdf
+# https://almanakka.helsinki.fi/aikakirja/Aikakirja2007kokonaan.pdf
 #
 # Page 105 (56 in PDF version) has a handy table of all past daylight savings
 # transitions. It is easy enough to interpret without Finnish skills.
@@ -1192,7 +1198,7 @@
 
 # From Konstantin Hyppönen (2014-06-13):
 # [Heikki Oja's book Aikakirja 2013]
-# http://almanakka.helsinki.fi/images/aikakirja/Aikakirja2013kokonaan.pdf
+# https://almanakka.helsinki.fi/images/aikakirja/Aikakirja2013kokonaan.pdf
 # pages 104-105, including a scan from a newspaper published on Apr 2 1942
 # say that ... [o]n Apr 2 1942, 24 o'clock (which means Apr 3 1942,
 # 00:00), clocks were moved one hour forward. The newspaper
@@ -1322,7 +1328,7 @@
 
 # From Jörg Schilling (2002-10-23):
 # In 1945, Berlin was switched to Moscow Summer time (GMT+4) by
-# http://www.dhm.de/lemo/html/biografien/BersarinNikolai/
+# https://www.dhm.de/lemo/html/biografien/BersarinNikolai/
 # General [Nikolai] Bersarin.
 
 # From Paul Eggert (2003-03-08):
@@ -1547,7 +1553,7 @@
 # From Paul Eggert (2016-10-27):
 # Go with INRiM for DST rules, except as corrected by Inglis for 1944
 # for the Kingdom of Italy.  This is consistent with Renzo Baldini.
-# Model Rome's occupation by using using C-Eur rules from 1943-09-10
+# Model Rome's occupation by using C-Eur rules from 1943-09-10
 # to 1944-06-04; although Rome was an open city during this period, it
 # was effectively controlled by Germany.
 #
@@ -1862,14 +1868,14 @@
 # Following Moldova and neighboring Ukraine- Transnistria (Pridnestrovie)-
 # Tiraspol will go back to winter time on October 30, 2011.
 # News from Moldova (in russian):
-# http://ru.publika.md/link_317061.html
+# https://ru.publika.md/link_317061.html
 
 # From Roman Tudos (2015-07-02):
 # http://lex.justice.md/index.php?action=view&view=doc&lang=1&id=355077
 # From Paul Eggert (2015-07-01):
 # The abovementioned official link to IGO1445-868/2014 states that
 # 2014-10-26's fallback transition occurred at 03:00 local time.  Also,
-# http://www.trm.md/en/social/la-30-martie-vom-trece-la-ora-de-vara
+# https://www.trm.md/en/social/la-30-martie-vom-trece-la-ora-de-vara
 # says the 2014-03-30 spring-forward transition was at 02:00 local time.
 # Guess that since 1997 Moldova has switched one hour before the EU.
 
@@ -1941,7 +1947,7 @@
 # Amsterdam mean time.
 
 # The data entries before 1945 are taken from
-# http://www.staff.science.uu.nl/~gent0113/wettijd/wettijd.htm
+# https://www.staff.science.uu.nl/~gent0113/wettijd/wettijd.htm
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Neth	1916	only	-	May	 1	0:00	1:00	NST	# Netherlands Summer Time
@@ -2022,7 +2028,7 @@
 # so it must have diverged from Oslo time during the war, as Oslo was
 # keeping Berlin time.
 #
-# <http://home.no.net/janmayen/history.htm> says that the meteorologists
+# <https://www.jan-mayen.no/history.htm> says that the meteorologists
 # burned down their station in 1940 and left the island, but returned in
 # 1941 with a small Norwegian garrison and continued operations despite
 # frequent air attacks from Germans.  In 1943 the Americans established a
@@ -2060,7 +2066,7 @@
 Rule	Poland	1945	only	-	Nov	 1	0:00	0	-
 # For 1946 on the source is Kazimierz Borkowski,
 # Toruń Center for Astronomy, Dept. of Radio Astronomy, Nicolaus Copernicus U.,
-# http://www.astro.uni.torun.pl/~kb/Artykuly/U-PA/Czas2.htm#tth_tAb1
+# https://www.astro.uni.torun.pl/~kb/Artykuly/U-PA/Czas2.htm#tth_tAb1
 # Thanks to Przemysław Augustyniak (2005-05-28) for this reference.
 # He also gives these further references:
 # Mon Pol nr 13, poz 162 (1995) <http://www.abc.com.pl/serwis/mp/1995/0162.htm>
@@ -2094,7 +2100,7 @@
 #
 # From Paul Eggert (2014-08-11), after a heads-up from Stephen Colebourne:
 # According to a Portuguese decree (1911-05-26)
-# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf
+# https://dre.pt/application/dir/pdf1sdip/1911/05/12500/23132313.pdf
 # Lisbon was at -0:36:44.68, but switched to GMT on 1912-01-01 at 00:00.
 # Round the old offset to -0:36:45.  This agrees with Willett but disagrees
 # with Shanks, who says the transition occurred on 1911-05-24 at 00:00 for
@@ -2276,7 +2282,7 @@
 # 2011 No. 725" and contains no other dates or "effective date" information.
 #
 # Another source is
-# http://www.rg.ru/2011/09/06/chas-zona-dok.html
+# https://rg.ru/2011/09/06/chas-zona-dok.html
 # which, according to translate.google.com, begins "Resolution of the
 # Government of the Russian Federation on August 31, 2011 N 725" and also
 # contains "Date first official publication: September 6, 2011 Posted on:
@@ -2284,7 +2290,7 @@
 # does not contain any "effective date" information.
 #
 # Another source is
-# http://en.wikipedia.org/wiki/Oymyakonsky_District#cite_note-RuTime-7
+# https://en.wikipedia.org/wiki/Oymyakonsky_District#cite_note-RuTime-7
 # which, in note 8, contains "Resolution No. 725 of August 31, 2011...
 # Effective as of after 7 days following the day of the official publication"
 # but which does not contain any reference to September 6, 2011.
@@ -2320,7 +2326,7 @@
 # http://itar-tass.com/obschestvo/1333711
 # http://www.pravo.gov.ru:8080/page.aspx?111660
 # http://www.kremlin.ru/acts/46279
-# From October 26, 2014 the new Russian time zone map will looks like this:
+# From October 26, 2014 the new Russian time zone map will look like this:
 # http://www.worldtimezone.com/dst_news/dst_news_russia-map-2014-07.html
 
 # From Paul Eggert (2006-03-22):
@@ -2367,7 +2373,7 @@
 # with maintenance only and represent our best guesses as to which regions
 # are covered by each zone.  They are not meant to be taken as an authoritative
 # listing.  The region codes listed come from
-# http://en.wikipedia.org/w/?title=Federal_subjects_of_Russia&oldid=611810498
+# https://en.wikipedia.org/w/?title=Federal_subjects_of_Russia&oldid=611810498
 # and are used for convenience only; no guarantees are made regarding their
 # future stability.  ISO 3166-2:RU codes are also listed for first-level
 # divisions where available.
@@ -2532,7 +2538,7 @@
 # http://www.kaliningradka.ru/site_pc/cherez/index.php?ELEMENT_ID=40091
 # says that Kaliningrad decided not to be an exception 2 days before the
 # 1991-03-31 switch and one person at
-# http://izhevsk.ru/forum_light_message/50/682597-m8369040.html
+# https://izhevsk.ru/forum_light_message/50/682597-m8369040.html
 # says he remembers that Samara opted out of the 1992-01-19 exception
 # 2 days before the switch.
 #
@@ -2604,7 +2610,7 @@
 			 3:00	-	MSK	1997 Mar lastSun  1:00u
 # From Alexander Krivenyshev (2014-03-17):
 # time change at 2:00 (2am) on March 30, 2014
-# http://vz.ru/news/2014/3/17/677464.html
+# https://vz.ru/news/2014/3/17/677464.html
 # From Paul Eggert (2014-03-30):
 # Simferopol and Sevastopol reportedly changed their central town clocks
 # late the previous day, but this appears to have been ceremonial
@@ -2787,7 +2793,7 @@
 # suggests that Altai Republic transitioned to Moscow+3 on
 # 1995-05-28.
 #
-# http://regnum.ru/news/society/1957270.html
+# https://regnum.ru/news/society/1957270.html
 # has some historical data for Altai Krai:
 # before 1957: west part on UTC+6, east on UTC+7
 # after 1957: UTC+7
@@ -3161,8 +3167,8 @@
 # districts, but have very similar populations.  In fact, Wikipedia currently
 # lists them both as having 3528 people, exactly 1668 males and 1860 females
 # each!  (Yikes!)
-# http://en.wikipedia.org/w/?title=Srednekolymsky_District&oldid=603435276
-# http://en.wikipedia.org/w/?title=Verkhnekolymsky_District&oldid=594378493
+# https://en.wikipedia.org/w/?title=Srednekolymsky_District&oldid=603435276
+# https://en.wikipedia.org/w/?title=Verkhnekolymsky_District&oldid=594378493
 # Assume this is a mistake, albeit an amusing one.
 #
 # Looking at censuses, the populations of the two municipalities seem to have
@@ -3483,7 +3489,7 @@
 #
 # From Alois Treindl (2013-09-11):
 # The Federal regulations say
-# http://www.admin.ch/opc/de/classified-compilation/20071096/index.html
+# https://www.admin.ch/opc/de/classified-compilation/20071096/index.html
 # ... the meridian for Bern mean time ... is 7 degrees 26' 22.50".
 # Expressed in time, it is 0h29m45.5s.
 
@@ -3560,9 +3566,9 @@
 # According to the articles linked below, Turkey will change into summer
 # time zone (GMT+3) on March 28, 2011 at 3:00 a.m. instead of March 27.
 # This change is due to a nationwide exam on 27th.
-# http://www.worldbulletin.net/?aType=haber&ArticleID=70872
+# https://www.worldbulletin.net/?aType=haber&ArticleID=70872
 # Turkish:
-# http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373
+# https://www.hurriyet.com.tr/yaz-saati-uygulamasi-bir-gun-ileri-alindi-17230464
 
 # From Faruk Pasin (2014-02-14):
 # The DST for Turkey has been changed for this year because of the
@@ -3698,7 +3704,7 @@
 # http://www.segodnya.ua/news/14290482.html
 #
 # Deputies cancelled the winter time (in Russian)
-# http://www.pravda.com.ua/rus/news/2011/09/20/6600616/
+# https://www.pravda.com.ua/rus/news/2011/09/20/6600616/
 #
 # From Philip Pizzey (2011-10-18):
 # Today my Ukrainian colleagues have informed me that the
--- a/test/jdk/sun/util/calendar/zi/tzdata/leapseconds	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/sun/util/calendar/zi/tzdata/leapseconds	Wed Nov 15 08:25:28 2017 -0500
@@ -26,19 +26,18 @@
 # This file is in the public domain.
 
 # This file is generated automatically from the data in the public-domain
-# leap-seconds.list file available from most NIST time servers.
-# If the URL <ftp://time.nist.gov/pub/leap-seconds.list> does not work,
-# you should be able to pick up leap-seconds.list from a secondary NIST server.
-# See <http://tf.nist.gov/tf-cgi/servers.cgi> for a list of secondary servers.
+# leap-seconds.list file, which is copied from:
+# ftp://ftp.nist.gov/pub/time/leap-seconds.list
 # For more about leap-seconds.list, please see
 # The NTP Timescale and Leap Seconds
-# http://www.eecis.udel.edu/~mills/leap.html
+# https://www.eecis.udel.edu/~mills/leap.html
 
 # The International Earth Rotation and Reference Systems Service
 # periodically uses leap seconds to keep UTC to within 0.9 s of UT1
 # (which measures the true angular orientation of the earth in space); see
-# Terry J Quinn, The BIPM and the accurate measure of time,
-# Proc IEEE 79, 7 (July 1991), 894-905 <http://dx.doi.org/10.1109/5.84965>.
+# Levine J. Coordinated Universal Time and the leap second.
+# URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995
+# http://ieeexplore.ieee.org/document/7909995/
 # There were no leap seconds before 1972, because the official mechanism
 # accounting for the discrepancy between atomic time and the earth's rotation
 # did not exist until the early 1970s.
@@ -81,5 +80,5 @@
 Leap	2015	Jun	30	23:59:60	+	S
 Leap	2016	Dec	31	23:59:60	+	S
 
-#	Updated through IERS Bulletin C53
-#	File expires on:  28 December 2017
+#	Updated through IERS Bulletin C54
+#	File expires on:  28 June 2018
--- a/test/jdk/sun/util/calendar/zi/tzdata/northamerica	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/sun/util/calendar/zi/tzdata/northamerica	Wed Nov 15 08:25:28 2017 -0500
@@ -128,10 +128,13 @@
 # Last night I heard part of a rebroadcast of a 1945 Arch Oboler radio drama.
 # In the introduction, Oboler spoke of "Eastern Peace Time."
 # An AltaVista search turned up:
-# http://rowayton.org/rhs/hstaug45.html
+# https://web.archive.org/web/20000926032210/http://rowayton.org/rhs/hstaug45.html
 # "When the time is announced over the radio now, it is 'Eastern Peace
 # Time' instead of the old familiar 'Eastern War Time.'  Peace is wonderful."
 # (August 1945) by way of confirmation.
+#
+# From Paul Eggert (2017-09-23):
+# This was the V-J Day issue of the Clamdigger, a Rowayton, CT newsletter.
 
 # From Joseph Gallant citing
 # George H. Douglas, _The Early Days of Radio Broadcasting_ (1987):
@@ -280,7 +283,7 @@
 # HST and HDT are standardized abbreviations for Hawaii-Aleutian
 # standard and daylight times.  See section 9.47 (p 234) of the
 # U.S. Government Printing Office Style Manual (2008)
-# http://www.gpo.gov/fdsys/pkg/GPO-STYLEMANUAL-2008/pdf/GPO-STYLEMANUAL-2008.pdf
+# https://www.gpo.gov/fdsys/pkg/GPO-STYLEMANUAL-2008/pdf/GPO-STYLEMANUAL-2008.pdf
 
 # From Arthur David Olson, 2005-08-09
 # The following was signed into law on 2005-08-08.
@@ -369,7 +372,7 @@
 # western Tennessee, most of Texas, Wisconsin
 
 # From Larry M. Smith (2006-04-26) re Wisconsin:
-# http://www.legis.state.wi.us/statutes/Stat0175.pdf ...
+# https://docs.legis.wisconsin.gov/statutes/statutes/175.pdf
 # is currently enforced at the 01:00 time of change.  Because the local
 # "bar time" in the state corresponds to 02:00, a number of citations
 # are issued for the "sale of class 'B' alcohol after prohibited
@@ -378,7 +381,7 @@
 # From Douglas R. Bomberg (2007-03-12):
 # Wisconsin has enacted (nearly eleventh-hour) legislation to get WI
 # Statue 175 closer in synch with the US Congress' intent....
-# http://www.legis.state.wi.us/2007/data/acts/07Act3.pdf
+# https://docs.legis.wisconsin.gov/2007/related/acts/3
 
 # From an email administrator of the City of Fort Pierre, SD (2015-12-21):
 # Fort Pierre is technically located in the Mountain time zone as is
@@ -425,7 +428,7 @@
 # ...it appears that Mercer County, North Dakota, changed from the
 # mountain time zone to the central time zone at the last transition from
 # daylight-saving to standard time (on Nov. 7, 2010):
-# http://www.gpo.gov/fdsys/pkg/FR-2010-09-29/html/2010-24376.htm
+# https://www.gpo.gov/fdsys/pkg/FR-2010-09-29/html/2010-24376.htm
 # http://www.bismarcktribune.com/news/local/article_1eb1b588-c758-11df-b472-001cc4c03286.html
 
 # From Andy Lipscomb (2011-01-24):
@@ -476,7 +479,7 @@
 # legal time, and is not part of the data here.)  See:
 # Ross SA. An energy crisis from the past: Northern California in 1948.
 # Working Paper No. 8, Institute of Governmental Studies, UC Berkeley,
-# 1973-11.  http://escholarship.org/uc/item/8x22k30c
+# 1973-11.  https://escholarship.org/uc/item/8x22k30c
 #
 # In another measure to save electricity, DST was instituted from 1948-03-14
 # at 02:01 to 1949-01-16 at 02:00, with the governor having the option to move
@@ -497,8 +500,8 @@
 # which established DST from April's last Sunday at 01:00 until September's
 # last Sunday at 02:00. This was amended by 1962's Proposition 6, which changed
 # the fall-back date to October's last Sunday. See:
-# http://repository.uchastings.edu/cgi/viewcontent.cgi?article=1501&context=ca_ballot_props
-# http://repository.uchastings.edu/cgi/viewcontent.cgi?article=1636&context=ca_ballot_props
+# https://repository.uchastings.edu/cgi/viewcontent.cgi?article=1501&context=ca_ballot_props
+# https://repository.uchastings.edu/cgi/viewcontent.cgi?article=1636&context=ca_ballot_props
 #
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
 Rule	CA	1948	only	-	Mar	14	2:01	1:00	D
@@ -515,20 +518,31 @@
 # Alaska
 # AK%sT is the modern abbreviation for -09 per USNO.
 #
-# From Paul Eggert (2001-05-30):
+# From Paul Eggert (2017-06-15):
 # Howse writes that Alaska switched from the Julian to the Gregorian calendar,
 # and from east-of-GMT to west-of-GMT days, when the US bought it from Russia.
-# This was on 1867-10-18, a Friday; the previous day was 1867-10-06 Julian,
-# also a Friday.  Include only the time zone part of this transition,
-# ignoring the switch from Julian to Gregorian, since we can't represent
-# the Julian calendar.
+# On Friday, 1867-10-18 (Gregorian), at precisely 15:30 local time, the
+# Russian forts and fleet at Sitka fired salutes to mark the ceremony of
+# formal transfer.  See the Sacramento Daily Union (1867-11-14), p 3, col 2.
+# https://cdnc.ucr.edu/cgi-bin/cdnc?a=d&d=SDU18671114.2.12.1
+# Sitka workers did not change their calendars until Sunday, 1867-10-20,
+# and so celebrated two Sundays that week.  See: Ahllund T (tr Hallamaa P).
+# From the memoirs of a Finnish workman. Alaska History. 2006 Fall;21(2):1-25.
+# http://alaskahistoricalsociety.org/wp-content/uploads/2016/12/Ahllund-2006-Memoirs-of-a-Finnish-Workman.pdf
+# Include only the time zone part of this transition, ignoring the switch
+# from Julian to Gregorian, since we can't represent the Julian calendar.
 #
-# As far as we know, none of the exact locations mentioned below were
+# As far as we know, of the locations mentioned below only Sitka was
 # permanently inhabited in 1867 by anyone using either calendar.
-# (Yakutat was colonized by the Russians in 1799, but the settlement
-# was destroyed in 1805 by a Yakutat-kon war party.)  However, there
-# were nearby inhabitants in some cases and for our purposes perhaps
-# it's best to simply use the official transition.
+# (Yakutat was colonized by the Russians in 1799, but the settlement was
+# destroyed in 1805 by a Yakutat-kon war party.)  Many of Alaska's inhabitants
+# were unaware of the US acquisition of Alaska, much less of any calendar or
+# time change.  However, the Russian-influenced part of Alaska did observe
+# Russian time, and it is more accurate to model this than to ignore it.
+# The database format requires an exact transition time; use the Russian
+# salute as a somewhat-arbitrary time for the formal transfer of control for
+# all of Alaska.  Sitka's UTC offset is -9:01:13; adjust its 15:30 to the
+# local times of other Alaskan locations so that they change simultaneously.
 
 # From Paul Eggert (2014-07-18):
 # One opinion of the early-1980s turmoil in Alaska over time zones and
@@ -581,10 +595,10 @@
 # It seems Metlakatla did go off PST on Sunday, November 1, changing
 # their time to AKST and are going to follow Alaska's DST, switching
 # between AKST and AKDT from now on....
-# http://www.krbd.org/2015/10/30/annette-island-times-they-are-a-changing/
+# https://www.krbd.org/2015/10/30/annette-island-times-they-are-a-changing/
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone America/Juneau	 15:02:19 -	LMT	1867 Oct 18
+Zone America/Juneau	 15:02:19 -	LMT	1867 Oct 19 15:33:32
 			 -8:57:41 -	LMT	1900 Aug 20 12:00
 			 -8:00	-	PST	1942
 			 -8:00	US	P%sT	1946
@@ -594,7 +608,7 @@
 			 -8:00	US	P%sT	1983 Oct 30  2:00
 			 -9:00	US	Y%sT	1983 Nov 30
 			 -9:00	US	AK%sT
-Zone America/Sitka	 14:58:47 -	LMT	1867 Oct 18
+Zone America/Sitka	 14:58:47 -	LMT	1867 Oct 19 15:30
 			 -9:01:13 -	LMT	1900 Aug 20 12:00
 			 -8:00	-	PST	1942
 			 -8:00	US	P%sT	1946
@@ -602,7 +616,7 @@
 			 -8:00	US	P%sT	1983 Oct 30  2:00
 			 -9:00	US	Y%sT	1983 Nov 30
 			 -9:00	US	AK%sT
-Zone America/Metlakatla	 15:13:42 -	LMT	1867 Oct 18
+Zone America/Metlakatla	 15:13:42 -	LMT	1867 Oct 19 15:44:55
 			 -8:46:18 -	LMT	1900 Aug 20 12:00
 			 -8:00	-	PST	1942
 			 -8:00	US	P%sT	1946
@@ -610,14 +624,14 @@
 			 -8:00	US	P%sT	1983 Oct 30  2:00
 			 -8:00	-	PST	2015 Nov  1  2:00
 			 -9:00	US	AK%sT
-Zone America/Yakutat	 14:41:05 -	LMT	1867 Oct 18
+Zone America/Yakutat	 14:41:05 -	LMT	1867 Oct 19 15:12:18
 			 -9:18:55 -	LMT	1900 Aug 20 12:00
 			 -9:00	-	YST	1942
 			 -9:00	US	Y%sT	1946
 			 -9:00	-	YST	1969
 			 -9:00	US	Y%sT	1983 Nov 30
 			 -9:00	US	AK%sT
-Zone America/Anchorage	 14:00:24 -	LMT	1867 Oct 18
+Zone America/Anchorage	 14:00:24 -	LMT	1867 Oct 19 14:31:37
 			 -9:59:36 -	LMT	1900 Aug 20 12:00
 			-10:00	-	AST	1942
 			-10:00	US	A%sT	1967 Apr
@@ -625,7 +639,7 @@
 			-10:00	US	AH%sT	1983 Oct 30  2:00
 			 -9:00	US	Y%sT	1983 Nov 30
 			 -9:00	US	AK%sT
-Zone America/Nome	 12:58:21 -	LMT	1867 Oct 18
+Zone America/Nome	 12:58:22 -	LMT	1867 Oct 19 13:29:35
 			-11:01:38 -	LMT	1900 Aug 20 12:00
 			-11:00	-	NST	1942
 			-11:00	US	N%sT	1946
@@ -634,7 +648,7 @@
 			-11:00	US	B%sT	1983 Oct 30  2:00
 			 -9:00	US	Y%sT	1983 Nov 30
 			 -9:00	US	AK%sT
-Zone America/Adak	 12:13:21 -	LMT	1867 Oct 18
+Zone America/Adak	 12:13:22 -	LMT	1867 Oct 19 12:44:35
 			-11:46:38 -	LMT	1900 Aug 20 12:00
 			-11:00	-	NST	1942
 			-11:00	US	N%sT	1946
@@ -670,7 +684,7 @@
 # "Hawaiian Time" by Robert C. Schmitt and Doak C. Cox appears on pages 207-225
 # of volume 26 of The Hawaiian Journal of History (1992). As of 2010-12-09,
 # the article is available at
-# http://evols.library.manoa.hawaii.edu/bitstream/10524/239/2/JL26215.pdf
+# https://evols.library.manoa.hawaii.edu/bitstream/10524/239/2/JL26215.pdf
 # and indicates that standard time was adopted effective noon, January
 # 13, 1896 (page 218), that in "1933, the Legislature decreed daylight
 # saving for the period between the last Sunday of each April and the
@@ -769,7 +783,7 @@
 # Indiana
 #
 # For a map of Indiana's time zone regions, see:
-# http://en.wikipedia.org/wiki/Time_in_Indiana
+# https://en.wikipedia.org/wiki/Time_in_Indiana
 #
 # From Paul Eggert (2007-08-17):
 # Since 1970, most of Indiana has been like America/Indiana/Indianapolis,
@@ -996,7 +1010,7 @@
 # From Paul Eggert (2001-07-16):
 # The final rule was published in the
 # Federal Register 65, 160 (2000-08-17), pp 50154-50158.
-# http://frwebgate.access.gpo.gov/cgi-bin/getdoc.cgi?dbname=2000_register&docid=fr17au00-22
+# https://www.gpo.gov/fdsys/pkg/FR-2000-08-17/html/00-20854.htm
 #
 Zone America/Kentucky/Monticello -5:39:24 - LMT	1883 Nov 18 12:20:36
 			-6:00	US	C%sT	1946
@@ -1022,7 +1036,7 @@
 # West Wendover, NV officially switched from Pacific to mountain time on
 # 1999-10-31.  See the
 # Federal Register 64, 203 (1999-10-21), pp 56705-56707.
-# http://frwebgate.access.gpo.gov/cgi-bin/getdoc.cgi?dbname=1999_register&docid=fr21oc99-15
+# https://www.gpo.gov/fdsys/pkg/FR-1999-10-21/html/99-27240.htm
 # However, the Federal Register says that West Wendover already operated
 # on mountain time, and the rule merely made this official;
 # hence a separate tz entry is not needed.
@@ -1052,12 +1066,23 @@
 # one hour in 1914."  This change is not in Shanks.  We have no more
 # info, so omit this for now.
 #
+# From Paul Eggert (2017-07-26):
+# Although Shanks says Detroit observed DST in 1967 from 06-14 00:01
+# until 10-29 00:01, I now see multiple reports that this is incorrect.
+# For example, according to a 50-year anniversary report about the 1967
+# Detroit riots and a major-league doubleheader on 1967-07-23, "By the time
+# the last fly ball of the doubleheader settled into the glove of leftfielder
+# Lenny Green, it was after 7 p.m.  Detroit did not observe daylight saving
+# time, so light was already starting to fail.  Twilight was made even deeper
+# by billowing columns of smoke that ascended in an unbroken wall north of the
+# ballpark."  See: Dow B. Detroit '67: As violence unfolded, Tigers played two
+# at home vs. Yankees. Detroit Free Press 2017-07-23.
+# https://www.freep.com/story/sports/mlb/tigers/2017/07/23/detroit-tigers-1967-riot-new-york-yankees/499951001/
+#
 # Most of Michigan observed DST from 1973 on, but was a bit late in 1975.
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
 Rule	Detroit	1948	only	-	Apr	lastSun	2:00	1:00	D
 Rule	Detroit	1948	only	-	Sep	lastSun	2:00	0	S
-Rule	Detroit	1967	only	-	Jun	14	2:00	1:00	D
-Rule	Detroit	1967	only	-	Oct	lastSun	2:00	0	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Detroit	-5:32:11 -	LMT	1905
 			-6:00	-	CST	1915 May 15  2:00
@@ -1121,7 +1146,7 @@
 #	[PDF] (1914-03)
 #
 #	Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
-#	<http://www.jstor.org/stable/1774359>.
+#	<https://www.jstor.org/stable/1774359>.
 #
 # See the 'europe' file for Greenland.
 
@@ -1167,19 +1192,19 @@
 # The British Columbia government announced yesterday that it will
 # adjust daylight savings next year to align with changes in the
 # U.S. and the rest of Canada....
-# http://www2.news.gov.bc.ca/news_releases_2005-2009/2006AG0014-000330.htm
+# https://archive.news.gov.bc.ca/releases/news_releases_2005-2009/2006AG0014-000330.htm
 # ...
 # Nova Scotia
 # Daylight saving time will be extended by four weeks starting in 2007....
-# http://www.gov.ns.ca/just/regulations/rg2/2006/ma1206.pdf
+# https://www.novascotia.ca/just/regulations/rg2/2006/ma1206.pdf
 #
 # [For New Brunswick] the new legislation dictates that the time change is to
 # be done at 02:00 instead of 00:01.
-# http://www.gnb.ca/0062/acts/BBA-2006/Chap-19.pdf
+# https://www.gnb.ca/0062/acts/BBA-2006/Chap-19.pdf
 # ...
 # Manitoba has traditionally changed the clock every fall at 03:00.
 # As of 2006, the transition is to take place one hour earlier at 02:00.
-# http://web2.gov.mb.ca/laws/statutes/ccsm/o030e.php
+# https://web2.gov.mb.ca/laws/statutes/ccsm/o030e.php
 # ...
 # [Alberta, Ontario, Quebec] will follow US rules.
 # http://www.qp.gov.ab.ca/documents/spring/CH03_06.CFM
@@ -1193,7 +1218,7 @@
 # http://www.hoa.gov.nl.ca/hoa/bills/Bill0634.htm
 # ...
 # Yukon
-# http://www.gov.yk.ca/legislation/regs/oic2006_127.pdf
+# https://www.gov.yk.ca/legislation/regs/oic2006_127.pdf
 # ...
 # N.W.T. will follow US rules.  Whoever maintains the government web site
 # does not seem to believe in bookmarks.  To see the news release, click the
@@ -1214,8 +1239,8 @@
 # time and daylight saving time arrangements in Canada circa 1998.
 #
 # National Research Council Canada maintains info about time zones and DST.
-# http://www.nrc-cnrc.gc.ca/eng/services/time/time_zones.html
-# http://www.nrc-cnrc.gc.ca/eng/services/time/faq/index.html#Q5
+# https://www.nrc-cnrc.gc.ca/eng/services/time/time_zones.html
+# https://www.nrc-cnrc.gc.ca/eng/services/time/faq/index.html#Q5
 # Its unofficial information is often taken from Matthews and Vincent.
 
 # From Paul Eggert (2006-06-27):
@@ -1252,11 +1277,13 @@
 
 # Newfoundland and Labrador
 
-# From Paul Eggert (2000-10-02):
-# Matthews and Vincent (1998) write that Labrador should use NST/NDT,
-# but the only part of Labrador that follows the rules is the
-# southeast corner, including Port Hope Simpson and Mary's Harbour,
-# but excluding, say, Black Tickle.
+# From Paul Eggert (2017-10-14):
+# Legally Labrador should observe Newfoundland time; see:
+# McLeod J. Labrador time - legal or not? St. John's Telegram, 2017-10-07
+# http://www.thetelegram.com/news/local/labrador-time--legal-or-not-154860/
+# Matthews and Vincent (1998) write that the only part of Labrador
+# that follows the rules is the southeast corner, including Port Hope
+# Simpson and Mary's Harbour, but excluding, say, Black Tickle.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	StJohns	1917	only	-	Apr	 8	2:00	1:00	D
@@ -1456,7 +1483,7 @@
 # http://www.justice.gouv.qc.ca/english/publications/generale/temps-minganie-a.htm
 # that the coastal strip from just east of Natashquan to Blanc-Sablon
 # observes Atlantic standard time all year round.
-# http://www.assnat.qc.ca/Media/Process.aspx?MediaId=ANQ.Vigie.Bll.DocumentGenerique_8845en
+# https://www.assnat.qc.ca/Media/Process.aspx?MediaId=ANQ.Vigie.Bll.DocumentGenerique_8845en
 # says this common practice was codified into law as of 2007.
 # For lack of better info, guess this practice began around 1970, contra to
 # Shanks & Pottenger who have this region observing AST/ADT.
@@ -1488,6 +1515,11 @@
 # earlier in June).
 #
 # Kenora, Ontario, was to abandon DST on 1914-06-01 (-05-21).
+#
+# From Paul Eggert (2017-07-08):
+# For more on Orillia, see: Daubs K. Bold attempt at daylight saving
+# time became a comic failure in Orillia. Toronto Star 2017-07-08.
+# https://www.thestar.com/news/insight/2017/07/08/bold-attempt-at-daylight-saving-time-became-a-comic-failure-in-orillia.html
 
 # From Paul Eggert (1997-10-17):
 # Mark Brader writes that an article in the 1997-10-14 Toronto Star
@@ -1979,7 +2011,7 @@
 #	* 1967. Paragraph 28(34)(g) of the Interpretation Act, S.C. 1967-68,
 #	c. 7 defines Yukon standard time as UTC-9....
 #	see Interpretation Act, R.S.C. 1985, c. I-21, s. 35(1).
-#	[http://canlii.ca/t/7vhg]
+#	[https://www.canlii.org/en/ca/laws/stat/rsc-1985-c-i-21/latest/rsc-1985-c-i-21.html]
 #	* C.O. 1973/214 switched Yukon to PST on 1973-10-28 00:00.
 #	* O.I.C. 1980/02 established DST.
 #	* O.I.C. 1987/056 changed DST to Apr firstSun 2:00 to Oct lastSun 2:00.
@@ -2044,7 +2076,7 @@
 #     hours behind Greenwich Time.
 #
 # * Yukon Standard Time defined as Pacific Standard Time, YCO 1973/214
-#   http://www.canlii.org/en/yk/laws/regu/yco-1973-214/latest/yco-1973-214.html
+#   https://www.canlii.org/en/yk/laws/regu/yco-1973-214/latest/yco-1973-214.html
 #   C.O. 1973/214 INTERPRETATION ACT ...
 #
 #     1. Effective October 28, 1973 Commissioner's Order 1967/59 is hereby
@@ -2059,7 +2091,7 @@
 #   http://? - no online source found
 #
 # * Yukon Daylight Saving Time, YOIC 1987/56
-#   http://www.canlii.org/en/yk/laws/regu/yoic-1987-56/latest/yoic-1987-56.html
+#   https://www.canlii.org/en/yk/laws/regu/yoic-1987-56/latest/yoic-1987-56.html
 #   O.I.C. 1987/056 INTERPRETATION ACT ...
 #
 #   In every year between
@@ -2071,7 +2103,7 @@
 #   Dated ... 9th day of March, A.D., 1987.
 #
 # * Yukon Daylight Saving Time 2006, YOIC 2006/127
-#   http://www.canlii.org/en/yk/laws/regu/yoic-2006-127/latest/yoic-2006-127.html
+#   https://www.canlii.org/en/yk/laws/regu/yoic-2006-127/latest/yoic-2006-127.html
 #   O.I.C. 2006/127 INTERPRETATION ACT ...
 #
 #     1. In Yukon each year the time for general purposes shall be 7 hours
@@ -2085,7 +2117,7 @@
 #     3. This order comes into force January 1, 2007.
 #
 # * Interpretation Act, RSY 2002, c 125
-# http://www.canlii.org/en/yk/laws/stat/rsy-2002-c-125/latest/rsy-2002-c-125.html
+# https://www.canlii.org/en/yk/laws/stat/rsy-2002-c-125/latest/rsy-2002-c-125.html
 
 # From Rives McDow (1999-09-04):
 # Nunavut ... moved ... to incorporate the whole territory into one time zone.
@@ -2128,7 +2160,7 @@
 
 # From Michaela Rodrigue, writing in the
 # Nunatsiaq News (1999-11-19):
-# http://www.nunatsiaq.com/archives/nunavut991130/nvt91119_17.html
+# http://www.nunatsiaqonline.ca/archives/nunavut991130/nvt91119_17.html
 # Clyde River, Pangnirtung and Sanikiluaq now operate with two time zones,
 # central - or Nunavut time - for government offices, and eastern time
 # for municipal offices and schools....  Igloolik [was similar but then]
@@ -2146,7 +2178,7 @@
 # Central Time and Southampton Island [in the Central zone] is not
 # required to use daylight savings.
 
-# From <http://www.nunatsiaq.com/archives/nunavut001130/nvt21110_02.html>
+# From <http://www.nunatsiaqonline.ca/archives/nunavut001130/nvt21110_02.html>
 # Nunavut now has two time zones (2000-11-10):
 # The Nunavut government would allow its employees in Kugluktuk and
 # Cambridge Bay to operate on central time year-round, putting them
@@ -2477,7 +2509,7 @@
 # http://gaceta.diputados.gob.mx/Gaceta/61/2009/dic/V2-101209.html
 #
 # Our page:
-# http://www.timeanddate.com/news/time/north-mexico-dst-change.html
+# https://www.timeanddate.com/news/time/north-mexico-dst-change.html
 
 # From Arthur David Olson (2010-01-20):
 # The page
@@ -2896,7 +2928,7 @@
 # http://www.nnc.cubaweb.cu/marzo-2008/cien-1-11-3-08.htm
 #
 # Some more background information is posted here:
-# http://www.timeanddate.com/news/time/cuba-starts-dst-march-16.html
+# https://www.timeanddate.com/news/time/cuba-starts-dst-march-16.html
 #
 # The article also says that Cuba has been observing DST since 1963,
 # while Shanks (and tzdata) has 1965 as the first date (except in the
@@ -2943,7 +2975,7 @@
 # http://granma.co.cu/2011/03/08/nacional/artic01.html
 #
 # Our info:
-# http://www.timeanddate.com/news/time/cuba-starts-dst-2011.html
+# https://www.timeanddate.com/news/time/cuba-starts-dst-2011.html
 #
 # From Steffen Thorsen (2011-10-30)
 # Cuba will end DST two weeks later this year. Instead of going back
@@ -2953,7 +2985,7 @@
 # http://www.radioangulo.cu/noticias/cuba/17105-cuba-restablecera-el-horario-del-meridiano-de-greenwich.html
 #
 # Our page:
-# http://www.timeanddate.com/news/time/cuba-time-changes-2011.html
+# https://www.timeanddate.com/news/time/cuba-time-changes-2011.html
 #
 # From Steffen Thorsen (2012-03-01)
 # According to Radio Reloj, Cuba will start DST on Midnight between March
@@ -2963,7 +2995,7 @@
 # http://www.radioreloj.cu/index.php/noticias-radio-reloj/71-miscelaneas/7529-cuba-aplicara-el-horario-de-verano-desde-el-1-de-abril
 #
 # Our info on it:
-# http://www.timeanddate.com/news/time/cuba-starts-dst-2012.html
+# https://www.timeanddate.com/news/time/cuba-starts-dst-2012.html
 
 # From Steffen Thorsen (2012-11-03):
 # Radio Reloj and many other sources report that Cuba is changing back
@@ -3158,8 +3190,8 @@
 # From Steffen Thorsen (2016-03-12):
 # Jean Antoine, editor of www.haiti-reference.com informed us that Haiti
 # are not going on DST this year.  Several other resources confirm this: ...
-# http://www.radiotelevisioncaraibes.com/presse/heure_d_t_pas_de_changement_d_heure_pr_vu_pour_cet_ann_e.html
-# http://www.vantbefinfo.com/changement-dheure-pas-pour-haiti/
+# https://www.radiotelevisioncaraibes.com/presse/heure_d_t_pas_de_changement_d_heure_pr_vu_pour_cet_ann_e.html
+# https://www.vantbefinfo.com/changement-dheure-pas-pour-haiti/
 # http://news.anmwe.com/haiti-lheure-nationale-ne-sera-ni-avancee-ni-reculee-cette-annee/
 
 # From Steffen Thorsen (2017-03-12):
@@ -3358,7 +3390,7 @@
 # Turks and Caicos
 #
 # From Chris Dunn in
-# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=415007
+# https://bugs.debian.org/415007
 # (2007-03-15): In the Turks & Caicos Islands (America/Grand_Turk) the
 # daylight saving dates for time changes have been adjusted to match
 # the recent U.S. change of dates.
@@ -3380,12 +3412,25 @@
 # "permanent daylight saving time" by one year....
 # http://tcweeklynews.com/time-change-to-go-ahead-this-november-p5437-127.htm
 #
+# From the Turks & Caicos Cabinet (2017-07-20), heads-up from Steffen Thorsen:
+# ... agreed to the reintroduction in TCI of Daylight Saving Time (DST)
+# during the summer months and Standard Time, also known as Local
+# Time, during the winter months with effect from April 2018 ...
+# https://www.gov.uk/government/news/turks-and-caicos-post-cabinet-meeting-statement--3
+#
+# From Paul Eggert (2017-08-26):
+# The date of effect of the spring 2018 change appears to be March 11,
+# which makes more sense.  See: Hamilton D. Time change back
+# by March 2018 for TCI. Magnetic Media. 2017-08-25.
+# http://magneticmediatv.com/2017/08/time-change-back-by-march-2018-for-tci/
+#
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Grand_Turk	-4:44:32 -	LMT	1890
 			-5:07:11 -	KMT	1912 Feb # Kingston Mean Time
 			-5:00	-	EST	1979
 			-5:00	US	E%sT	2015 Nov Sun>=1 2:00
-			-4:00	-	AST
+			-4:00	-	AST	2018 Mar 11 3:00
+			-5:00	US	E%sT
 
 # British Virgin Is
 # Virgin Is
--- a/test/jdk/sun/util/calendar/zi/tzdata/southamerica	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/sun/util/calendar/zi/tzdata/southamerica	Wed Nov 15 08:25:28 2017 -0500
@@ -45,7 +45,7 @@
 #
 # For data circa 1899, a common source is:
 # Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
-# http://www.jstor.org/stable/1774359
+# https://www.jstor.org/stable/1774359
 #
 # These tables use numeric abbreviations like -03 and -0330 for
 # integer hour and minute UTC offsets.  Although earlier editions used
@@ -288,8 +288,8 @@
 #
 # Es inminente que en San Luis atrasen una hora los relojes
 # (It is imminent in San Luis clocks one hour delay)
-# http://www.lagaceta.com.ar/nota/253414/Economia/Es-inminente-que-en-San-Luis-atrasen-una-hora-los-relojes.html
-# http://www.worldtimezone.net/dst_news/dst_news_argentina02.html
+# https://www.lagaceta.com.ar/nota/253414/Economia/Es-inminente-que-en-San-Luis-atrasen-una-hora-los-relojes.html
+# http://www.worldtimezone.com/dst_news/dst_news_argentina02.html
 
 # From Jesper Nørgaard Welen (2008-01-18):
 # The page of the San Luis provincial government
@@ -408,7 +408,7 @@
 # Perhaps San Luis operates on the legal fiction that it is at -04
 # with perpetual summer time, but ordinary usage typically seems to
 # just say it's at -03; see, for example,
-# http://es.wikipedia.org/wiki/Hora_oficial_argentina
+# https://es.wikipedia.org/wiki/Hora_oficial_argentina
 # We've documented similar situations as being plain changes to
 # standard time, so let's do that here too.  This does not change UTC
 # offsets, only tm_isdst and the time zone abbreviations.  One minor
@@ -739,7 +739,7 @@
 # (Portuguese)
 #
 # We have a written a short article about it as well:
-# http://www.timeanddate.com/news/time/brazil-dst-2008-2009.html
+# https://www.timeanddate.com/news/time/brazil-dst-2008-2009.html
 #
 # From Alexander Krivenyshev (2011-10-04):
 # State Bahia will return to Daylight savings time this year after 8 years off.
@@ -748,7 +748,7 @@
 
 # In Portuguese:
 # http://g1.globo.com/bahia/noticia/2011/10/governador-jaques-wagner-confirma-horario-de-verao-na-bahia.html
-# http://noticias.terra.com.br/brasil/noticias/0,,OI5390887-EI8139,00-Bahia+volta+a+ter+horario+de+verao+apos+oito+anos.html
+# https://noticias.terra.com.br/brasil/noticias/0,,OI5390887-EI8139,00-Bahia+volta+a+ter+horario+de+verao+apos+oito+anos.html
 
 # From Guilherme Bernardes Rodrigues (2011-10-07):
 # There is news in the media, however there is still no decree about it.
@@ -774,16 +774,16 @@
 
 # From Rodrigo Severo (2012-10-16):
 # Tocantins state will have DST.
-# http://noticias.terra.com.br/brasil/noticias/0,,OI6232536-EI306.html
+# https://noticias.terra.com.br/brasil/noticias/0,,OI6232536-EI306.html
 
 # From Steffen Thorsen (2013-09-20):
 # Tocantins in Brazil is very likely not to observe DST from October....
 # http://conexaoto.com.br/2013/09/18/ministerio-confirma-que-tocantins-esta-fora-do-horario-de-verao-em-2013-mas-falta-publicacao-de-decreto
 # We will keep this article updated when this is confirmed:
-# http://www.timeanddate.com/news/time/brazil-starts-dst-2013.html
+# https://www.timeanddate.com/news/time/brazil-starts-dst-2013.html
 
 # From Steffen Thorsen (2013-10-17):
-# http://www.timeanddate.com/news/time/acre-amazonas-change-time-zone.html
+# https://www.timeanddate.com/news/time/acre-amazonas-change-time-zone.html
 # Senator Jorge Viana announced that Acre will change time zone on November 10.
 # He did not specify the time of the change, nor if western parts of Amazonas
 # will change as well.
@@ -1099,18 +1099,18 @@
 # the following source, cited by Oscar van Vlijmen (2006-10-08):
 # [1] Chile Law
 # http://www.webexhibits.org/daylightsaving/chile.html
-# This contains a copy of a this official table:
+# This contains a copy of this official table:
 # Cambios en la hora oficial de Chile desde 1900 (retrieved 2008-03-30)
-# http://web.archive.org/web/20080330200901/http://www.horaoficial.cl/cambio.htm
+# https://web.archive.org/web/20080330200901/http://www.horaoficial.cl/cambio.htm
 # [1] needs several corrections, though.
 #
 # The first set of corrections is from:
 # [2] History of the Official Time of Chile
 # http://www.horaoficial.cl/ing/horaof_ing.html (retrieved 2012-03-06).  See:
-# http://web.archive.org/web/20120306042032/http://www.horaoficial.cl/ing/horaof_ing.html
+# https://web.archive.org/web/20120306042032/http://www.horaoficial.cl/ing/horaof_ing.html
 # This is an English translation of:
 # Historia de la hora oficial de Chile (retrieved 2012-10-24).  See:
-# http://web.archive.org/web/20121024234627/http://www.horaoficial.cl/horaof.htm
+# https://web.archive.org/web/20121024234627/http://www.horaoficial.cl/horaof.htm
 # A fancier Spanish version (requiring mouse-clicking) is at:
 # http://www.horaoficial.cl/historia_hora.html
 # Conflicts between [1] and [2] were resolved as follows:
@@ -1386,10 +1386,10 @@
 # Milne says the Central and South American Telegraph Company used -5:24:15.
 #
 # From Alois Treindl (2016-12-15):
-# http://www.elcomercio.com/actualidad/hora-sixto-1993.html
+# https://www.elcomercio.com/actualidad/hora-sixto-1993.html
 # ... Whether the law applied also to Galápagos, I do not know.
 # From Paul Eggert (2016-12-15):
-# http://www.elcomercio.com/afull/modificacion-husohorario-ecuador-presidentes-decreto.html
+# https://www.elcomercio.com/afull/modificacion-husohorario-ecuador-presidentes-decreto.html
 # This says President Sixto Durán Ballén signed decree No. 285, which
 # established DST from 1992-11-28 to 1993-02-05; it does not give transition
 # times.  The people called it "hora de Sixto" ("Sixto hour").  The change did
@@ -1801,7 +1801,7 @@
 # hours of presidential broadcasts, hours of lines,' quipped comedian
 # Jean Mary Curró ...". See: Cawthorne A, Kai D. Venezuela scraps
 # half-hour time difference set by Chavez. Reuters 2016-04-15 14:50 -0400
-# http://www.reuters.com/article/us-venezuela-timezone-idUSKCN0XC2BE
+# https://www.reuters.com/article/us-venezuela-timezone-idUSKCN0XC2BE
 #
 # From Matt Johnson (2016-04-20):
 # ... published in the official Gazette [2016-04-18], here:
--- a/test/jdk/sun/util/calendar/zi/tzdata/zone.tab	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/jdk/sun/util/calendar/zi/tzdata/zone.tab	Wed Nov 15 08:25:28 2017 -0500
@@ -209,7 +209,7 @@
 GD	+1203-06145	America/Grenada
 GE	+4143+04449	Asia/Tbilisi
 GF	+0456-05220	America/Cayenne
-GG	+4927-00232	Europe/Guernsey
+GG	+492717-0023210	Europe/Guernsey
 GH	+0533-00013	Africa/Accra
 GI	+3608-00521	Europe/Gibraltar
 GL	+6411-05144	America/Godthab	Greenland (most areas)
@@ -244,7 +244,7 @@
 IR	+3540+05126	Asia/Tehran
 IS	+6409-02151	Atlantic/Reykjavik
 IT	+4154+01229	Europe/Rome
-JE	+4912-00207	Europe/Jersey
+JE	+491101-0020624	Europe/Jersey
 JM	+175805-0764736	America/Jamaica
 JO	+3157+03556	Asia/Amman
 JP	+353916+1394441	Asia/Tokyo
--- a/test/lib/sun/hotspot/WhiteBox.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/lib/sun/hotspot/WhiteBox.java	Wed Nov 15 08:25:28 2017 -0500
@@ -531,6 +531,9 @@
   public native int addCompilerDirective(String compDirect);
   public native void removeCompilerDirective(int count);
 
+  // Handshakes
+  public native int handshakeWalkStack(Thread t, boolean all_threads);
+
   // Returns true on linux if library has the noexecstack flag set.
   public native boolean checkLibSpecifiesNoexecstack(String libfilename);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8190391.js	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2017, 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.
+ */
+
+/**
+ * JDK-8190391 : nashorn: "!!" of nonzero even integer var becomes false when returned
+ *
+ * @test
+ * @run
+ */
+
+
+function func(x){
+    return !!x;
+}
+print(func(0));
+print(func(2));
+print(func(3));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8190391.js.EXPECTED	Wed Nov 15 08:25:28 2017 -0500
@@ -0,0 +1,3 @@
+false
+true
+true
--- a/test/nashorn/src/jdk/nashorn/internal/test/framework/TestReorderInterceptor.java	Wed Nov 15 08:14:56 2017 -0500
+++ b/test/nashorn/src/jdk/nashorn/internal/test/framework/TestReorderInterceptor.java	Wed Nov 15 08:25:28 2017 -0500
@@ -47,6 +47,10 @@
                 final Object o2 = mi2.getInstance();
                 if (o1 instanceof ITest && o2 instanceof ITest) {
                     return ((ITest)o1).getTestName().compareTo(((ITest)o2).getTestName());
+                } else if (o1 instanceof ITest) {
+                    return 1;
+                } else if (o2 instanceof ITest) {
+                    return -1;
                 }
                 // something else, don't care about the order
                 return 0;