author | dnsimon |
Mon, 06 Nov 2017 09:44:42 +0100 | |
changeset 47785 | 5692c538ecef |
parent 47217 | 72e3ae9a25eb |
child 48695 | a7ce228abcd7 |
permissions | -rw-r--r-- |
36934 | 1 |
# |
41472 | 2 |
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
36934 | 3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
# |
|
5 |
# This code is free software; you can redistribute it and/or modify it |
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
|
7 |
# published by the Free Software Foundation. Oracle designates this |
|
8 |
# particular file as subject to the "Classpath" exception as provided |
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
|
10 |
# |
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
# accompanied this code). |
|
16 |
# |
|
17 |
# You should have received a copy of the GNU General Public License version |
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
# |
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
# or visit www.oracle.com if you need additional information or have any |
|
23 |
# questions. |
|
24 |
# |
|
25 |
||
26 |
GENSRC_VARHANDLES := |
|
27 |
||
28 |
VARHANDLES_GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/invoke |
|
47217 | 29 |
VARHANDLES_SRC_DIR := $(TOPDIR)/src/java.base/share/classes/java/lang/invoke |
36934 | 30 |
|
31 |
################################################################################ |
|
32 |
# Setup a rule for generating a VarHandle java class |
|
33 |
# Param 1 - Variable declaration prefix |
|
34 |
# Param 2 - Type with first letter capitalized |
|
35 |
define GenerateVarHandle |
|
36 |
||
37 |
$1_Type := $2 |
|
38 |
||
39 |
$1_FILENAME := $(VARHANDLES_GENSRC_DIR)/VarHandle$$($1_Type)s.java |
|
40 |
||
39471
6622892a347a
8158039: VarHandle float/double field/array access should support CAS/set/add atomics
psandoz
parents:
39470
diff
changeset
|
41 |
$1_ARGS += -KCAS |
36934 | 42 |
|
39471
6622892a347a
8158039: VarHandle float/double field/array access should support CAS/set/add atomics
psandoz
parents:
39470
diff
changeset
|
43 |
ifneq ($$(findstring $$($1_Type), Byte Short Char Int Long Float Double), ) |
36934 | 44 |
$1_ARGS += -KAtomicAdd |
45 |
endif |
|
46 |
||
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39471
diff
changeset
|
47 |
ifneq ($$(findstring $$($1_Type), Boolean Byte Short Char Int Long), ) |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39471
diff
changeset
|
48 |
$1_ARGS += -KBitwise |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39471
diff
changeset
|
49 |
endif |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39471
diff
changeset
|
50 |
|
39470
d6f8b4a85fb0
8157726: VarHandles/Unsafe should support sub-word atomic ops
shade
parents:
36938
diff
changeset
|
51 |
ifneq ($$(findstring $$($1_Type), Byte Short Char), ) |
d6f8b4a85fb0
8157726: VarHandles/Unsafe should support sub-word atomic ops
shade
parents:
36938
diff
changeset
|
52 |
$1_ARGS += -KShorterThanInt |
d6f8b4a85fb0
8157726: VarHandles/Unsafe should support sub-word atomic ops
shade
parents:
36938
diff
changeset
|
53 |
endif |
d6f8b4a85fb0
8157726: VarHandles/Unsafe should support sub-word atomic ops
shade
parents:
36938
diff
changeset
|
54 |
|
36934 | 55 |
$$($1_FILENAME): $(VARHANDLES_SRC_DIR)/X-VarHandle.java.template $(BUILD_TOOLS_JDK) |
56 |
ifeq ($$($1_Type), Object) |
|
57 |
$$(eval $1_type := $$($1_Type)) |
|
58 |
else |
|
36938
b43bd5279f4e
8152959: Build crashes in jdk9-hs-comp on Linux with gnumake 3.81
erikj
parents:
36934
diff
changeset
|
59 |
$$(eval $1_type := $$$$(shell $(TR) '[:upper:]' '[:lower:]' <<< $$$$($1_Type))) |
36934 | 60 |
endif |
36938
b43bd5279f4e
8152959: Build crashes in jdk9-hs-comp on Linux with gnumake 3.81
erikj
parents:
36934
diff
changeset
|
61 |
$$(call MakeDir, $$(@D)) |
36934 | 62 |
$(TOOL_SPP) -nel -K$$($1_type) -Dtype=$$($1_type) -DType=$$($1_Type) \ |
63 |
$$($1_ARGS) < $$< > $$@ |
|
64 |
||
65 |
GENSRC_VARHANDLES += $$($1_FILENAME) |
|
66 |
endef |
|
67 |
||
68 |
################################################################################ |
|
69 |
||
70 |
################################################################################ |
|
71 |
# Setup a rule for generating a VarHandleByteArray java class |
|
72 |
# Param 1 - Variable declaration prefix |
|
73 |
# Param 2 - Type with first letter capitalized |
|
74 |
define GenerateVarHandleByteArray |
|
75 |
||
76 |
$1_Type := $2 |
|
77 |
||
78 |
$1_FILENAME := $(VARHANDLES_GENSRC_DIR)/VarHandleByteArrayAs$$($1_Type)s.java |
|
79 |
||
80 |
ifeq ($$($1_Type), Short) |
|
81 |
$1_type := short |
|
82 |
$1_BoxType := $$($1_Type) |
|
83 |
||
84 |
$1_rawType := $$($1_type) |
|
85 |
$1_RawType := $$($1_Type) |
|
86 |
$1_RawBoxType := $$($1_BoxType) |
|
87 |
endif |
|
88 |
||
89 |
ifeq ($$($1_Type), Char) |
|
90 |
$1_type := char |
|
91 |
$1_BoxType := Character |
|
92 |
||
93 |
$1_rawType := $$($1_type) |
|
94 |
$1_RawType := $$($1_Type) |
|
95 |
$1_RawBoxType := $$($1_BoxType) |
|
96 |
endif |
|
97 |
||
98 |
ifeq ($$($1_Type), Int) |
|
99 |
$1_type := int |
|
100 |
$1_BoxType := Integer |
|
101 |
||
102 |
$1_rawType := $$($1_type) |
|
103 |
$1_RawType := $$($1_Type) |
|
104 |
$1_RawBoxType := $$($1_BoxType) |
|
105 |
||
106 |
$1_ARGS += -KCAS |
|
107 |
$1_ARGS += -KAtomicAdd |
|
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39471
diff
changeset
|
108 |
$1_ARGS += -KBitwise |
36934 | 109 |
endif |
110 |
||
111 |
ifeq ($$($1_Type), Long) |
|
112 |
$1_type := long |
|
113 |
$1_BoxType := $$($1_Type) |
|
114 |
||
115 |
$1_rawType := $$($1_type) |
|
116 |
$1_RawType := $$($1_Type) |
|
117 |
$1_RawBoxType := $$($1_BoxType) |
|
118 |
||
119 |
$1_ARGS += -KCAS |
|
120 |
$1_ARGS += -KAtomicAdd |
|
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39471
diff
changeset
|
121 |
$1_ARGS += -KBitwise |
36934 | 122 |
endif |
123 |
||
124 |
ifeq ($$($1_Type), Float) |
|
125 |
$1_type := float |
|
126 |
$1_BoxType := $$($1_Type) |
|
127 |
||
128 |
$1_rawType := int |
|
129 |
$1_RawType := Int |
|
130 |
$1_RawBoxType := Integer |
|
131 |
||
132 |
$1_ARGS += -KCAS |
|
133 |
$1_ARGS += -KfloatingPoint |
|
134 |
endif |
|
135 |
||
136 |
ifeq ($$($1_Type), Double) |
|
137 |
$1_type := double |
|
138 |
$1_BoxType := $$($1_Type) |
|
139 |
||
140 |
$1_rawType := long |
|
141 |
$1_RawType := Long |
|
142 |
$1_RawBoxType := Long |
|
143 |
||
144 |
$1_ARGS += -KCAS |
|
145 |
$1_ARGS += -KfloatingPoint |
|
146 |
endif |
|
147 |
||
148 |
$$($1_FILENAME): $(VARHANDLES_SRC_DIR)/X-VarHandleByteArrayView.java.template $(BUILD_TOOLS_JDK) |
|
36938
b43bd5279f4e
8152959: Build crashes in jdk9-hs-comp on Linux with gnumake 3.81
erikj
parents:
36934
diff
changeset
|
149 |
$$(call MakeDir, $$(@D)) |
36934 | 150 |
$(TOOL_SPP) -nel -K$$($1_type) \ |
151 |
-Dtype=$$($1_type) -DType=$$($1_Type) -DBoxType=$$($1_BoxType) \ |
|
152 |
-DrawType=$$($1_rawType) -DRawType=$$($1_RawType) -DRawBoxType=$$($1_RawBoxType) \ |
|
153 |
$$($1_ARGS) < $$< > $$@ |
|
154 |
||
155 |
GENSRC_VARHANDLES += $$($1_FILENAME) |
|
156 |
endef |
|
157 |
||
158 |
################################################################################ |
|
159 |
||
160 |
# List the types to generate source for, with capitalized first letter |
|
161 |
VARHANDLES_TYPES := Boolean Byte Short Char Int Long Float Double Object |
|
36938
b43bd5279f4e
8152959: Build crashes in jdk9-hs-comp on Linux with gnumake 3.81
erikj
parents:
36934
diff
changeset
|
162 |
$(foreach t, $(VARHANDLES_TYPES), \ |
b43bd5279f4e
8152959: Build crashes in jdk9-hs-comp on Linux with gnumake 3.81
erikj
parents:
36934
diff
changeset
|
163 |
$(eval $(call GenerateVarHandle,VAR_HANDLE_$t,$t))) |
36934 | 164 |
|
165 |
# List the types to generate source for, with capitalized first letter |
|
166 |
VARHANDLES_BYTE_ARRAY_TYPES := Short Char Int Long Float Double |
|
36938
b43bd5279f4e
8152959: Build crashes in jdk9-hs-comp on Linux with gnumake 3.81
erikj
parents:
36934
diff
changeset
|
167 |
$(foreach t, $(VARHANDLES_BYTE_ARRAY_TYPES), \ |
b43bd5279f4e
8152959: Build crashes in jdk9-hs-comp on Linux with gnumake 3.81
erikj
parents:
36934
diff
changeset
|
168 |
$(eval $(call GenerateVarHandleByteArray,VAR_HANDLE_BYTE_ARRAY_$t,$t))) |
36934 | 169 |
|
170 |
GENSRC_JAVA_BASE += $(GENSRC_VARHANDLES) |