-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathopenjdk8.patch
1799 lines (1723 loc) · 65.7 KB
/
openjdk8.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/Makefile b/Makefile
index 7fe922ba..f3275e00 100644
--- a/Makefile
+++ b/Makefile
@@ -1,130 +1,89 @@
-#
-# Copyright (c) 2012, 2013, 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.
-#
+.PHONY: sigve sigve-debug image image-all install clean-sigve clean clean-all dist-clean dist-clean-all config config-all help
-# This must be the first rule
-default:
+CONF = release
+JVM_TAG = vanilla
+JVM_NAME = j2sdk-image.java8.$(JVM_TAG)
+LOCAL_JVM = $(HOME)/jvms/$(JVM_NAME)
+BUILD_DIR = build/linux-x86_64-normal-server-$(CONF)
+BUILD_JVM = $(BUILD_DIR)/images/j2sdk-image
-# Inclusion of this pseudo-target will cause make to execute this file
-# serially, regardless of -j. Recursively called makefiles will not be
-# affected, however. This is required for correct dependency management.
-.NOTPARALLEL:
+sigve: image
+ -make -C sigve sigve
+ -make -C sigve install
-# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make.
-# /usr/ccs/bin/make lacks basically every other flow control mechanism.
-TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
+sigve-debug: image
+ -make -C sigve debug
+ -make -C sigve install
-# Assume we have GNU make, but check version.
-ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), )
- $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
-endif
+image:
+ make -f Makefile.openjdk CONF=$(CONF) images
-# Locate this Makefile
-ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
- makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
-else
- makefile_path:=$(lastword $(MAKEFILE_LIST))
-endif
-root_dir:=$(dir $(makefile_path))
+image-all:
+ -make CONF="release" image
+ -make CONF="fastdebug" image
+ -make CONF="slowdebug" image
-# ... and then we can include our helper functions
-include $(root_dir)/make/MakeHelpers.gmk
+install:
+ rm -rf $(LOCAL_JVM)
+ cp $(BUILD_DIR)/jdk/objs/java_objs/java.debuginfo $(BUILD_JVM)/bin/
+ cp -r $(BUILD_JVM) $(LOCAL_JVM)
+ cd $(LOCAL_JVM)/jre/lib/amd64/server && unzip libjvm.diz
+ cd $(LOCAL_JVM)/jre/lib/amd64 && unzip libjava.diz
+ unlink $(HOME)/jvms/java_home
+ ln -s $(LOCAL_JVM) $(HOME)/jvms/java_home
-$(eval $(call ParseLogLevel))
-$(eval $(call ParseConfAndSpec))
+clean-sigve:
+ -make -C sigve clean
-# Now determine if we have zero, one or several configurations to build.
-ifeq ($(SPEC),)
- # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing.
-else
- ifeq ($(words $(SPEC)),1)
- # We are building a single configuration. This is the normal case. Execute the Main.gmk file.
- include $(root_dir)/make/Main.gmk
- else
- # We are building multiple configurations.
- # First, find out the valid targets
- # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find
- # available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
- all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \
- cd $(root_dir) && $(MAKE) -p -q FRC SPEC=$(firstword $(SPEC)) | \
- grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
+clean: clean-sigve
+ -make -f Makefile.openjdk CONF=$(CONF) clean
- $(all_phony_targets):
- @$(foreach spec,$(SPEC),(cd $(root_dir) && $(MAKE) SPEC=$(spec) \
- $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true
+clean-all:
+ -make CONF="release" clean
+ -make CONF="fastdebug" clean
+ -make CONF="slowdebug" clean
- .PHONY: $(all_phony_targets)
+dist-clean: clean-sigve
+ -make -f Makefile.openjdk CONF=$(CONF) dist-clean
- endif
-endif
+dist-clean-all:
+ -make CONF="release" dist-clean
+ -make CONF="fastdebug" dist-clean
+ -make CONF="slowdebug" dist-clean
-# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
-# If you addd more global targets, please update the variable global_targets in MakeHelpers.
+config:
+ bash ./configure --with-boot-jdk=/usr/lib/jvm/java-8-openjdk-amd64 \
+ --with-cacerts-file=/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/cacerts \
+ --with-freetype-lib=/usr/lib/x86_64-linux-gnu \
+ --with-freetype-include=/usr/include/freetype2 \
+ --with-debug-level=$(CONF)
-help:
- $(info )
- $(info OpenJDK Makefile help)
- $(info =====================)
- $(info )
- $(info Common make targets)
- $(info . make [default] # Compile all product in langtools, hotspot, jaxp, jaxws,)
- $(info . # corba and jdk)
- $(info . make all # Compile everything, all repos and images)
- $(info . make images # Create complete j2sdk and j2re images)
- $(info . make docs # Create javadocs)
- $(info . make overlay-images # Create limited images for sparc 64 bit platforms)
- $(info . make profiles # Create complete j2re compact profile images)
- $(info . make bootcycle-images # Build images twice, second time with newly build JDK)
- $(info . make install # Install the generated images locally)
- $(info . make clean # Remove all files generated by make, but not those)
- $(info . # generated by configure)
- $(info . make dist-clean # Remove all files, including configuration)
- $(info . make help # Give some help on using make)
- $(info . make test # Run tests, default is all tests (see TEST below))
- $(info )
- $(info Targets for specific components)
- $(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, nashorn, images, overlay-images, docs or test))
- $(info . make <component> # Build <component> and everything it depends on. )
- $(info . make <component>-only # Build <component> only, without dependencies. This)
- $(info . # is faster but can result in incorrect build results!)
- $(info . make clean-<component> # Remove files generated by make for <component>)
- $(info )
- $(info Useful make variables)
- $(info . make CONF= # Build all configurations (note, assignment is empty))
- $(info . make CONF=<substring> # Build the configuration(s) with a name matching)
- $(info . # <substring>)
- $(info )
- $(info . make LOG=<loglevel> # Change the log level from warn to <loglevel>)
- $(info . # Available log levels are:)
- $(info . # 'warn' (default), 'info', 'debug' and 'trace')
- $(info . # To see executed command lines, use LOG=debug)
- $(info )
- $(info . make JOBS=<n> # Run <n> parallel make jobs)
- $(info . # Note that -jN does not work as expected!)
- $(info )
- $(info . make test TEST=<test> # Only run the given test or tests, e.g.)
- $(info . # make test TEST="jdk_lang jdk_net")
- $(info )
+config-all:
+ -make CONF="release" config
+ -make CONF="fastdebug" config
+ -make CONF="slowdebug" config
-.PHONY: help
+help:
+ @echo
+ @echo 'sigve Makefile'
+ @echo '=============='
+ @echo 'commands:'
+ @echo '- sigve (default): build a JVM image with sigve'
+ @echo '- sigve-debug: build a JVM image with debug sigve'
+ @echo '- image: build only the JVM image'
+ @echo '- image-all: build JVM images for all targets'
+ @echo '- install: the minecrafters do all sorts of research!'
+ @echo '- clean: so fresh'
+ @echo '- clean-all: so fresh and so clean'
+ @echo '- dist-clean: nothing left'
+ @echo '- dist-clean-all: nothing left for all targets'
+ @echo '- config: gl'
+ @echo '- config-all: glhf'
+ @echo '- help: show this help'
+ @echo 'build targets: set with `CONF="<target>"'
+ @echo '- release (default)'
+ @echo '- fastdebug'
+ @echo '- slowdebug'
+ @echo 'example: clean and build slowdebug'
+ @echo 'make CONF="slowdebug" clean && make CONF="slowdebug" image'
+ @echo
diff --git a/Makefile.openjdk b/Makefile.openjdk
new file mode 100644
index 00000000..7fe922ba
--- /dev/null
+++ b/Makefile.openjdk
@@ -0,0 +1,130 @@
+#
+# Copyright (c) 2012, 2013, 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.
+#
+
+# This must be the first rule
+default:
+
+# Inclusion of this pseudo-target will cause make to execute this file
+# serially, regardless of -j. Recursively called makefiles will not be
+# affected, however. This is required for correct dependency management.
+.NOTPARALLEL:
+
+# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make.
+# /usr/ccs/bin/make lacks basically every other flow control mechanism.
+TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
+
+# Assume we have GNU make, but check version.
+ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), )
+ $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
+endif
+
+# Locate this Makefile
+ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
+ makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
+else
+ makefile_path:=$(lastword $(MAKEFILE_LIST))
+endif
+root_dir:=$(dir $(makefile_path))
+
+# ... and then we can include our helper functions
+include $(root_dir)/make/MakeHelpers.gmk
+
+$(eval $(call ParseLogLevel))
+$(eval $(call ParseConfAndSpec))
+
+# Now determine if we have zero, one or several configurations to build.
+ifeq ($(SPEC),)
+ # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing.
+else
+ ifeq ($(words $(SPEC)),1)
+ # We are building a single configuration. This is the normal case. Execute the Main.gmk file.
+ include $(root_dir)/make/Main.gmk
+ else
+ # We are building multiple configurations.
+ # First, find out the valid targets
+ # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find
+ # available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
+ all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \
+ cd $(root_dir) && $(MAKE) -p -q FRC SPEC=$(firstword $(SPEC)) | \
+ grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
+
+ $(all_phony_targets):
+ @$(foreach spec,$(SPEC),(cd $(root_dir) && $(MAKE) SPEC=$(spec) \
+ $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true
+
+ .PHONY: $(all_phony_targets)
+
+ endif
+endif
+
+# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
+# If you addd more global targets, please update the variable global_targets in MakeHelpers.
+
+help:
+ $(info )
+ $(info OpenJDK Makefile help)
+ $(info =====================)
+ $(info )
+ $(info Common make targets)
+ $(info . make [default] # Compile all product in langtools, hotspot, jaxp, jaxws,)
+ $(info . # corba and jdk)
+ $(info . make all # Compile everything, all repos and images)
+ $(info . make images # Create complete j2sdk and j2re images)
+ $(info . make docs # Create javadocs)
+ $(info . make overlay-images # Create limited images for sparc 64 bit platforms)
+ $(info . make profiles # Create complete j2re compact profile images)
+ $(info . make bootcycle-images # Build images twice, second time with newly build JDK)
+ $(info . make install # Install the generated images locally)
+ $(info . make clean # Remove all files generated by make, but not those)
+ $(info . # generated by configure)
+ $(info . make dist-clean # Remove all files, including configuration)
+ $(info . make help # Give some help on using make)
+ $(info . make test # Run tests, default is all tests (see TEST below))
+ $(info )
+ $(info Targets for specific components)
+ $(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, nashorn, images, overlay-images, docs or test))
+ $(info . make <component> # Build <component> and everything it depends on. )
+ $(info . make <component>-only # Build <component> only, without dependencies. This)
+ $(info . # is faster but can result in incorrect build results!)
+ $(info . make clean-<component> # Remove files generated by make for <component>)
+ $(info )
+ $(info Useful make variables)
+ $(info . make CONF= # Build all configurations (note, assignment is empty))
+ $(info . make CONF=<substring> # Build the configuration(s) with a name matching)
+ $(info . # <substring>)
+ $(info )
+ $(info . make LOG=<loglevel> # Change the log level from warn to <loglevel>)
+ $(info . # Available log levels are:)
+ $(info . # 'warn' (default), 'info', 'debug' and 'trace')
+ $(info . # To see executed command lines, use LOG=debug)
+ $(info )
+ $(info . make JOBS=<n> # Run <n> parallel make jobs)
+ $(info . # Note that -jN does not work as expected!)
+ $(info )
+ $(info . make test TEST=<test> # Only run the given test or tests, e.g.)
+ $(info . # make test TEST="jdk_lang jdk_net")
+ $(info )
+
+.PHONY: help
diff --git a/hotspot/make/linux/makefiles/mapfile-vers-debug b/hotspot/make/linux/makefiles/mapfile-vers-debug
index 2da4b7d9..33bb9efe 100644
--- a/hotspot/make/linux/makefiles/mapfile-vers-debug
+++ b/hotspot/make/linux/makefiles/mapfile-vers-debug
@@ -94,6 +94,7 @@ SUNWprivate_1.1 {
JVM_FindSignal;
JVM_FreeMemory;
JVM_GC;
+ JVM_SIGVE;
JVM_GetAllThreads;
JVM_GetArrayElement;
JVM_GetArrayLength;
diff --git a/hotspot/make/linux/makefiles/mapfile-vers-product b/hotspot/make/linux/makefiles/mapfile-vers-product
index 4ec3d5bf..536a8f7c 100644
--- a/hotspot/make/linux/makefiles/mapfile-vers-product
+++ b/hotspot/make/linux/makefiles/mapfile-vers-product
@@ -94,6 +94,7 @@ SUNWprivate_1.1 {
JVM_FindSignal;
JVM_FreeMemory;
JVM_GC;
+ JVM_SIGVE;
JVM_GetAllThreads;
JVM_GetArrayElement;
JVM_GetArrayLength;
diff --git a/hotspot/src/os/linux/vm/jvm_linux.cpp b/hotspot/src/os/linux/vm/jvm_linux.cpp
index ba84788a..484e6de5 100644
--- a/hotspot/src/os/linux/vm/jvm_linux.cpp
+++ b/hotspot/src/os/linux/vm/jvm_linux.cpp
@@ -173,6 +173,8 @@ struct siglabel siglabels[] = {
#ifdef SIGSYS
"SYS", SIGSYS /* Bad system call. Only on some Linuxen! */
#endif
+ , "VE", SIGVE
+ , "VF", SIGVF
};
JVM_ENTRY_NO_ENV(jint, JVM_FindSignal(const char *name))
diff --git a/hotspot/src/os/linux/vm/jvm_linux.h b/hotspot/src/os/linux/vm/jvm_linux.h
index dd5e3894..ff5ee77c 100644
--- a/hotspot/src/os/linux/vm/jvm_linux.h
+++ b/hotspot/src/os/linux/vm/jvm_linux.h
@@ -92,6 +92,8 @@
#define SHUTDOWN1_SIGNAL SIGHUP /* Shutdown Hooks support. */
#define SHUTDOWN2_SIGNAL SIGINT
#define SHUTDOWN3_SIGNAL SIGTERM
+#define SIGVE 64
+#define SIGVF 63
#endif /* JVM_MD_H */
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index 044a70a6..209370fe 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -1412,6 +1412,14 @@ jlong os::javaTimeNanos() {
}
}
+unsigned long os::realtime() {
+ struct timespec tp;
+ int status = Linux::clock_gettime(CLOCK_REALTIME, &tp);
+ assert(status == 0, "gettime error");
+ unsigned long result = tp.tv_sec * (1000UL * 1000 * 1000) + tp.tv_nsec;
+ return result;
+}
+
void os::javaTimeNanos_info(jvmtiTimerInfo *info_ptr) {
if (Linux::supports_monotonic_clock()) {
info_ptr->max_value = ALL_64_BITS;
@@ -2529,6 +2537,51 @@ int os::signal_wait() {
return check_pending_signals(true);
}
+// note: we setup the actual java userHandler in System.initializeSystemClass
+// by default it calls JVM_SIGVE (see sigve in Runtime.c)
+int os::sigve_init() {
+ int pid = current_process_id();
+ char path[17]; // /tmp/sigve/(11) + pid(5: default max = 32768) + null
+ snprintf(path, 17, "/tmp/sigve/%d", pid);
+
+ int fd = ::open(path, O_CREAT | O_EXCL | O_RDWR, 0664);
+ if (fd == -1) {
+ if (errno == EEXIST) {
+ if (::unlink(path)) {
+ tty->print("[sigve][error] unlink (%d %s)\n", errno, strerror(errno));
+ return -1;
+ }
+ fd = ::open(path, O_CREAT | O_EXCL | O_RDWR, 0664);
+ if (fd == -1) {
+ tty->print("[sigve][error] open failed after unlink (%d %s)\n", errno, strerror(errno));
+ return -1;
+ }
+ } else {
+ tty->print("[sigve][error] open failed (%d %s)\n", errno, strerror(errno));
+ return -1;
+ }
+ }
+ ::close(fd);
+
+ if (UseSIGVE) {
+ signal(SIGVE, user_handler());
+ signal(SIGVF, user_handler());
+ }
+
+ tty->print("[sigve] init pid = %d\n", pid);
+ return 0;
+}
+
+void os::sigve_destroy() {
+ int pid = current_process_id();
+ char path[17]; // /tmp/sigve/(11) + pid(5: default max = 32768) + null
+ snprintf(path, 17, "/tmp/sigve/%d", pid);
+
+ if (::unlink(path)) {
+ tty->print("[sigve][error] destroy unlink (%d %s)\n", errno, strerror(errno));
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
// Virtual Memory
@@ -6288,6 +6341,10 @@ int os::get_core_path(char* buffer, size_t bufferSize) {
return strlen(buffer);
}
+int os::madvise_dontneed(char *addr, size_t bytes) {
+ return ::madvise(addr, bytes, MADV_DONTNEED);
+}
+
/////////////// Unit tests ///////////////
#ifndef PRODUCT
diff --git a/hotspot/src/os/linux/vm/os_linux.inline.hpp b/hotspot/src/os/linux/vm/os_linux.inline.hpp
index 10d56d89..771e998e 100644
--- a/hotspot/src/os/linux/vm/os_linux.inline.hpp
+++ b/hotspot/src/os/linux/vm/os_linux.inline.hpp
@@ -116,6 +116,11 @@ inline int os::ftruncate(int fd, jlong length) {
inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
{
+// hotspot quickfix see: http://hg.openjdk.java.net/jdk10/master/rev/f5f2a2d13775
+// readdir_r has been deprecated since glibc 2.24.
+// See https://sourceware.org/bugzilla/show_bug.cgi?id=19056 for more details.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
dirent* p;
int status;
assert(dirp != NULL, "just checking");
@@ -129,6 +134,8 @@ inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
return NULL;
} else
return p;
+
+#pragma GCC diagnostic pop
}
inline int os::closedir(DIR *dirp) {
diff --git a/hotspot/src/share/vm/code/dependencies.cpp b/hotspot/src/share/vm/code/dependencies.cpp
index c284160e..30bbe302 100644
--- a/hotspot/src/share/vm/code/dependencies.cpp
+++ b/hotspot/src/share/vm/code/dependencies.cpp
@@ -525,7 +525,7 @@ void Dependencies::write_dependency_to(xmlStream* xtty,
xtty->object("x", arg.metadata_value());
}
} else {
- char xn[10]; sprintf(xn, "x%d", j);
+ char xn[10]; sprintf(xn, "x%d", (short)j);
if (arg.is_oop()) {
xtty->object(xn, arg.oop_value());
} else {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index 76bfcd6e..95b82066 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -1524,6 +1524,16 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
g1mm()->update_sizes();
gc_epilogue(true);
+
+ /*
+ if (UseSIGVE && (gc_cause() == GCCause::_sigvf || gc_cause() == GCCause::_java_lang_system_gc)) {
+ TimeStamp ts;
+ unsigned long long freed_bytes = 0;
+ ts.update();
+ int freed = _hrm.madvise_free_list(0, freed_bytes);
+ gclog_or_tty->print("{[sigvf] madvise regions: %d (%llu bytes), took: %ld}\n", freed, freed_bytes, ts.ticks_since_update());
+ }
+ */
}
if (G1Log::finer()) {
@@ -1836,6 +1846,7 @@ void G1CollectedHeap::shrink(size_t shrink_bytes) {
G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) :
SharedHeap(policy_),
+ _sigve_gctime(0),
_g1_policy(policy_),
_dirty_card_queue_set(false),
_into_cset_dirty_card_queue_set(false),
@@ -2484,6 +2495,30 @@ void G1CollectedHeap::collect(GCCause::Cause cause) {
{
MutexLocker ml(Heap_lock);
+ // check if we should handle sigve (sigvf should always cause full pause)
+ if (UseSIGVE && cause == GCCause::_sigve) {
+ if (_sigve_ts.is_updated()) {
+ jlong time_since_sigve = _sigve_ts.ticks_since_update();
+ double cost = time_since_sigve * (SIGVECost * 1.0 / 100);
+ if (_sigve_gctime > cost) {
+ gclog_or_tty->print("%lu: [sigve] dropping signal (gc time: %ld, cost: %.3f, time since: %ld)\n",
+ os::realtime(), _sigve_gctime, cost, time_since_sigve);
+ return;
+ } else {
+ gclog_or_tty->print("%lu: [sigve] handling signal (gc time: %ld, cost: %.3f, time since: %ld)\n",
+ os::realtime(), _sigve_gctime, cost, time_since_sigve);
+ }
+ } else {
+ gclog_or_tty->print("%lu: [sigve] handling signal _sigve_ts not updated (gc time: %ld)\n",
+ os::realtime(), _sigve_gctime);
+ }
+ // clear timestamp since we decided to handle sigve
+ _sigve_ts.clear();
+ }
+ if (UseSIGVE) {
+ gclog_or_tty->print("%lu: [%s] handling signal\n", os::realtime(), GCCause::to_string(cause));
+ }
+
// Read the GC count while holding the Heap_lock
gc_count_before = total_collections();
full_gc_count_before = total_full_collections();
@@ -2519,6 +2554,7 @@ void G1CollectedHeap::collect(GCCause::Cause cause) {
}
} else {
if (cause == GCCause::_gc_locker || cause == GCCause::_wb_young_gc
+ || (UseSIGVE && cause == GCCause::_sigve) /* || (UseSIGVE && cause == GCCause::_java_lang_system_gc) */
DEBUG_ONLY(|| cause == GCCause::_scavenge_alot)) {
// Schedule a standard evacuation pause. We're setting word_size
@@ -2530,6 +2566,7 @@ void G1CollectedHeap::collect(GCCause::Cause cause) {
cause);
VMThread::execute(&op);
} else {
+ gclog_or_tty->print("%lu: [sigvf] doing full gc\n", os::realtime());
// Schedule a Full GC.
VM_G1CollectFull op(gc_count_before, full_gc_count_before, cause);
VMThread::execute(&op);
@@ -4244,7 +4281,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
// investigate this in CR 7178365.
double sample_end_time_sec = os::elapsedTime();
double pause_time_ms = (sample_end_time_sec - sample_start_time_sec) * MILLIUNITS;
- g1_policy()->record_collection_pause_end(pause_time_ms, evacuation_info);
+ g1_policy()->record_collection_pause_end(pause_time_ms, evacuation_info, gc_cause());
MemoryService::track_memory_usage();
@@ -4324,10 +4361,29 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
// before any GC notifications are raised.
g1mm()->update_sizes();
+ /*
+ if (UseSIGVE && (gc_cause() == GCCause::_sigve || gc_cause() == GCCause::_java_lang_system_gc)) {
+ TimeStamp ts;
+ ts.update();
+ unsigned long long freed_bytes = 0;
+ int freed = _hrm.madvise_free_list(0, freed_bytes);
+ gclog_or_tty->print("{[sigve] madvise regions: %d (%llu bytes), took: %ld}\n", freed, freed_bytes, ts.ticks_since_update());
+ }
+ */
+
+ if (UseSIGVE && (gc_cause() == GCCause::_sigve)) {
+ _sigve_ts.update();
+ }
+
_gc_tracer_stw->report_evacuation_info(&evacuation_info);
_gc_tracer_stw->report_tenuring_threshold(_g1_policy->tenuring_threshold());
_gc_timer_stw->register_gc_end();
_gc_tracer_stw->report_gc_end(_gc_timer_stw->gc_end(), _gc_timer_stw->time_partitions());
+
+ if (UseSIGVE && gc_cause() == GCCause::_sigve) {
+ _sigve_gctime = _gc_timer_stw->gc_end().value() - _gc_timer_stw->gc_start().value();
+ gclog_or_tty->print("{[sigve_gctime] updating gctime with stw: %ld}\n", _sigve_gctime);
+ }
}
// It should now be safe to tell the concurrent mark thread to start
// without its logging output interfering with the logging output
@@ -5902,6 +5958,12 @@ void G1CollectedHeap::free_region(HeapRegion* hr,
}
hr->hr_clear(par, true /* clear_space */, locked /* locked */);
free_list->add_ordered(hr);
+
+ /*
+ int ret = os::madvise_dontneed((char *) hr->bottom(), hr->capacity());
+ assert(!ret, "hottub madvise issue");
+ gclog_or_tty->print("{[sigve] madvise freed3 %zd, %p}\n", hr->capacity(), hr->bottom());
+ */
}
void G1CollectedHeap::free_humongous_region(HeapRegion* hr,
@@ -6640,6 +6702,12 @@ public:
// Add free regions to the free list
r->set_free();
r->set_allocation_context(AllocationContext::system());
+ //gclog_or_tty->print("{[sigve] madvise start %p, len %zd}\n", r->bottom(), r->capacity());
+ /*
+ int ret = os::madvise_dontneed((char *) r->bottom(), r->capacity());
+ assert(!ret, "hottub madvise issue");
+ gclog_or_tty->print("{[sigve] madvise freed2 %zd, %p}\n", r->capacity(), r->bottom());
+ */
_hrm->insert_into_free_list(r);
} else if (!_free_list_only) {
assert(!r->is_young(), "we should not come across young regions");
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
index 500390af..7cf89d78 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
@@ -220,6 +220,9 @@ private:
// The one and only G1CollectedHeap, so static functions can find it.
static G1CollectedHeap* _g1h;
+ TimeStamp _sigve_ts;
+ jlong _sigve_gctime;
+
static size_t _humongous_object_threshold_in_words;
// The secondary free list which contains regions that have been
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
index ea80c449..c58f0ae3 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
@@ -956,7 +956,7 @@ bool G1CollectorPolicy::need_to_start_conc_mark(const char* source, size_t alloc
// Anything below that is considered to be zero
#define MIN_TIMER_GRANULARITY 0.0000001
-void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, EvacuationInfo& evacuation_info) {
+void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, EvacuationInfo& evacuation_info, GCCause::Cause gc_cause) {
double end_time_sec = os::elapsedTime();
assert(_cur_collection_pause_used_regions_at_start >= cset_region_length(),
"otherwise, the subtraction below does not make sense");
@@ -1078,6 +1078,11 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, Evacua
}
}
+ // always do mixed if we got high signal
+ if (!last_pause_included_initial_mark && UseSIGVE && (gc_cause == GCCause::_sigvf || gc_cause == GCCause::_java_lang_system_gc)) {
+ set_gcs_are_young(false);
+ }
+
_short_lived_surv_rate_group->start_adding_regions();
// do that for any other surv rate groupsx
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
index 96e4dc63..604cdc3f 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
@@ -673,7 +673,7 @@ public:
// Record the start and end of an evacuation pause.
void record_collection_pause_start(double start_time_sec);
- void record_collection_pause_end(double pause_time_ms, EvacuationInfo& evacuation_info);
+ void record_collection_pause_end(double pause_time_ms, EvacuationInfo& evacuation_info, GCCause::Cause gc_cause);
// Record the start and end of a full collection.
void record_full_collection_start();
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp
index 0c26b783..1dfea53d 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp
@@ -72,6 +72,7 @@ class G1RegionsLargerThanCommitSizeMapper : public G1RegionToSpaceMapper {
fire_on_commit(start_idx, num_regions, zero_filled);
}
+ // hotspot: normal path??
virtual void uncommit_regions(uint start_idx, size_t num_regions) {
_storage.uncommit((size_t)start_idx * _pages_per_region, num_regions * _pages_per_region);
_commit_map.clear_range(start_idx, start_idx + num_regions);
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
index 020eb08d..06ce721c 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
@@ -131,6 +131,7 @@ void HeapRegionManager::make_regions_available(uint start, uint num_regions) {
_available_map.par_set_range(start, start + num_regions, BitMap::unknown_range);
+ //unsigned long long madvise_freed = 0;
for (uint i = start; i < start + num_regions; i++) {
assert(is_available(i), err_msg("Just made region %u available but is apparently not.", i));
HeapRegion* hr = at(i);
@@ -141,8 +142,17 @@ void HeapRegionManager::make_regions_available(uint start, uint num_regions) {
MemRegion mr(bottom, bottom + HeapRegion::GrainWords);
hr->initialize(mr);
+ /*
+ int ret = os::madvise_dontneed((char *) hr->bottom(), hr->capacity());
+ assert(!ret, "hottub madvise issue");
+ madvise_freed += hr->capacity();
+ */
insert_into_free_list(at(i));
}
+ /*
+ gclog_or_tty->print("{[sigve] madvise freed %llu}\n", madvise_freed);
+ */
+
}
MemoryUsage HeapRegionManager::get_auxiliary_data_memory_usage() const {
@@ -463,3 +473,40 @@ void HeapRegionManager::verify_optional() {
}
#endif // PRODUCT
+int HeapRegionManager::madvise_free_list(size_t bytes, unsigned long long &freed_bytes) {
+ if (bytes == 0) {
+ return 0;
+ }
+ (void)bytes;
+ // TODO: only advise/free bytes worth of regions
+ // TODO: be smarter about which regions are advised?
+ int freed = 0;
+ FreeRegionListIterator iter(&_free_list);
+ while (iter.more_available()) {
+ HeapRegion* r = iter.get_next();
+ int ret = os::madvise_dontneed((char *)r->bottom(), r->capacity());
+ /* int ret = os::madvise_dontneed((char *)r->bottom(), r->end() - r->bottom()); */
+ assert(!ret, "hottub madvise issue");
+ freed++;
+ freed_bytes += r->capacity();
+ /* freed_bytes += r->end() - r->bottom(); */
+ /* gclog_or_tty->print("{[test] madvise cap: %ld, minus: %ld}\n", r->capacity(), r->end() - r->bottom()); */
+ }
+ return freed;
+}
+
+void HeapRegionManager::madvise_region(HeapRegion* hr) {
+ int ret = os::madvise_dontneed((char *) hr->bottom(), hr->capacity());
+ assert(!ret, "hottub madvise issue");
+}
+
+void HeapRegionManager::insert_list_into_free_list(FreeRegionList* list) {
+ if (UseSIGVE) {
+ FreeRegionListIterator iter(list);
+ while (iter.more_available()) {
+ HeapRegion* hr = iter.get_next();
+ this->madvise_region(hr);
+ }
+ }
+ _free_list.add_ordered(list);
+}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp
index 83996f71..06d3257d 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp
@@ -159,9 +159,7 @@ public:
inline void insert_into_free_list(HeapRegion* hr);
// Insert the given region list into the global free region list.
- void insert_list_into_free_list(FreeRegionList* list) {
- _free_list.add_ordered(list);
- }
+ void insert_list_into_free_list(FreeRegionList* list);
HeapRegion* allocate_free_region(bool is_old) {
HeapRegion* hr = _free_list.remove_region(is_old);
@@ -232,6 +230,10 @@ public:
// Return the actual number of uncommitted regions.
uint shrink_by(uint num_regions_to_remove);
+ // hottub
+ int madvise_free_list(size_t bytes, unsigned long long &freed_bytes);
+ void madvise_region(HeapRegion* hr);
+
void verify();
// Do some sanity checking.
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.inline.hpp
index 96bc92fc..3824b319 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.inline.hpp
@@ -48,6 +48,9 @@ inline HeapRegion* HeapRegionManager::at(uint index) const {
}
inline void HeapRegionManager::insert_into_free_list(HeapRegion* hr) {
+ if (UseSIGVE) {
+ this->madvise_region(hr);
+ }
_free_list.add_ordered(hr);
}
diff --git a/hotspot/src/share/vm/gc_interface/gcCause.cpp b/hotspot/src/share/vm/gc_interface/gcCause.cpp
index a364214b..cd198a52 100644
--- a/hotspot/src/share/vm/gc_interface/gcCause.cpp
+++ b/hotspot/src/share/vm/gc_interface/gcCause.cpp
@@ -103,6 +103,12 @@ const char* GCCause::to_string(GCCause::Cause cause) {
case _last_ditch_collection:
return "Last ditch collection";
+ case _sigve:
+ return "sigve";
+
+ case _sigvf:
+ return "sigvf";
+
case _last_gc_cause:
return "ILLEGAL VALUE - last gc cause - ILLEGAL VALUE";
diff --git a/hotspot/src/share/vm/gc_interface/gcCause.hpp b/hotspot/src/share/vm/gc_interface/gcCause.hpp
index 26ad48f7..fb75e308 100644
--- a/hotspot/src/share/vm/gc_interface/gcCause.hpp
+++ b/hotspot/src/share/vm/gc_interface/gcCause.hpp
@@ -74,6 +74,10 @@ class GCCause : public AllStatic {
_g1_humongous_allocation,
_last_ditch_collection,
+
+ _sigve,
+ _sigvf,
+
_last_gc_cause
};
diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp
index 439e55e3..e0fd2ebc 100644
--- a/hotspot/src/share/vm/opto/compile.cpp
+++ b/hotspot/src/share/vm/opto/compile.cpp
@@ -3480,7 +3480,7 @@ void Compile::verify_graph_edges(bool no_dead_code) {
_root->verify_edges(visited);
if (no_dead_code) {
// Now make sure that no visited node is used by an unvisited node.
- bool dead_nodes = 0;
+ int dead_nodes = 0;
Unique_Node_List checked(area);
while (visited.size() > 0) {
Node* n = visited.pop();
diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp
index 07c36de8..3ce26e00 100644
--- a/hotspot/src/share/vm/prims/jvm.cpp
+++ b/hotspot/src/share/vm/prims/jvm.cpp
@@ -462,6 +462,25 @@ JVM_ENTRY_NO_ENV(void, JVM_GC(void))
JVM_END
+JVM_ENTRY_NO_ENV(void, JVM_SIGVE(jint x))
+ if (UseSIGVE) {
+ GCCause::Cause cause;
+ switch (x) {
+ case SIGVE:
+ cause = GCCause::_sigve;
+ break;
+ case SIGVF:
+ cause = GCCause::_sigvf;
+ break;
+ default:
+ tty->print("[error] JVM_SIGVE got %d\n", x);
+ return;
+ }
+ Universe::heap()->collect(cause);
+ }
+JVM_END
+
+
JVM_LEAF(jlong, JVM_MaxObjectInspectionAge(void))
JVMWrapper("JVM_MaxObjectInspectionAge");
return Universe::heap()->millis_since_last_gc();
diff --git a/hotspot/src/share/vm/prims/jvm.h b/hotspot/src/share/vm/prims/jvm.h
index 3b36b73a..f077f41a 100644
--- a/hotspot/src/share/vm/prims/jvm.h
+++ b/hotspot/src/share/vm/prims/jvm.h
@@ -156,6 +156,9 @@ JVM_Halt(jint code);
JNIEXPORT void JNICALL
JVM_GC(void);
+JNIEXPORT void JNICALL
+JVM_SIGVE(jint x);
+
/* Returns the number of real-time milliseconds that have elapsed since the
* least-recently-inspected heap object was last inspected by the garbage
* collector.
diff --git a/hotspot/src/share/vm/runtime/fprofiler.cpp b/hotspot/src/share/vm/runtime/fprofiler.cpp
index 58cb6e89..26dc510b 100644
--- a/hotspot/src/share/vm/runtime/fprofiler.cpp
+++ b/hotspot/src/share/vm/runtime/fprofiler.cpp
@@ -635,7 +635,7 @@ class vmNode : public ProfilerNode {
const char *name() const { return _name; }
bool is_compiled() const { return true; }
- bool vm_match(const char* name) const { return strcmp(name, _name) == 0; }
+ bool vm_match(const char* name) const { return (name != NULL) ? strcmp(name, _name) == 0 : 1; }
Method* method() { return NULL; }
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index 6c9bd3b0..1443787f 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -1173,6 +1173,16 @@ class CommandLineFlags {
product(bool, ReduceSignalUsage, false, \
"Reduce the use of OS signals in Java and/or the VM") \
\
+ product(bool, UseSIGVEPidFile, false, \
+ "Make the pid file in /tmp/sigve, but nothing else.") \
+ \
+ product(bool, UseSIGVE, false, \
+ "I'm not signal handling! You're signal handling!") \
+ \
+ product(uintx, SIGVECost, 10, \
+ "handle new sigve signal if:" \
+ "time to handle last sigve < SIGVECost * time since last sigve") \
+ \
develop_pd(bool, ShareVtableStubs, \
"Share vtable stubs (smaller code but worse branch prediction") \
\
diff --git a/hotspot/src/share/vm/runtime/java.cpp b/hotspot/src/share/vm/runtime/java.cpp
index faec9bae..b3594ebb 100644
--- a/hotspot/src/share/vm/runtime/java.cpp
+++ b/hotspot/src/share/vm/runtime/java.cpp
@@ -471,6 +471,10 @@ void before_exit(JavaThread * thread) {
}
}
+ if (UseSIGVE || UseSIGVEPidFile) {
+ os::sigve_destroy();
+ }
+
// The only difference between this and Win32's _onexit procs is that
// this version is invoked before any threads get killed.
ExitProc* current = exit_procs;
diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp
index 06e81a55..33372e50 100644
--- a/hotspot/src/share/vm/runtime/os.cpp
+++ b/hotspot/src/share/vm/runtime/os.cpp
@@ -388,6 +388,12 @@ void os::signal_init() {
}
// Handle ^BREAK
os::signal(SIGBREAK, os::user_handler());
+
+ if (UseSIGVE || UseSIGVEPidFile) {
+ if (os::sigve_init()) {
+ UseSIGVE = false;
+ }
+ }
}
}
diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp
index e008b9c6..94fab9a9 100644
--- a/hotspot/src/share/vm/runtime/os.hpp
+++ b/hotspot/src/share/vm/runtime/os.hpp
@@ -324,6 +324,7 @@ class os: AllStatic {
bool executable, const char* mesg);
static bool uncommit_memory(char* addr, size_t bytes);
static bool release_memory(char* addr, size_t bytes);
+ static int madvise_dontneed(char* addr, size_t bytes);
// Touch memory pages that cover the memory range from start to end (exclusive)
// to make the OS back the memory range with actual memory.
@@ -738,6 +739,9 @@ class os: AllStatic {