|
| 1 | +# |
| 2 | +# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. |
| 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 | +SCOPED_MEMORY_ACCESS_GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/jdk/internal/misc |
| 27 | +SCOPED_MEMORY_ACCESS_SRC_DIR := $(TOPDIR)/src/java.base/share/classes/jdk/internal/misc |
| 28 | +SCOPED_MEMORY_ACCESS_TEMPLATE := $(SCOPED_MEMORY_ACCESS_SRC_DIR)/X-ScopedMemoryAccess.java.template |
| 29 | +SCOPED_MEMORY_ACCESS_BIN_TEMPLATE := $(SCOPED_MEMORY_ACCESS_SRC_DIR)/X-ScopedMemoryAccess-bin.java.template |
| 30 | +SCOPED_MEMORY_ACCESS_DEST := $(SCOPED_MEMORY_ACCESS_GENSRC_DIR)/ScopedMemoryAccess.java |
| 31 | + |
| 32 | +################################################################################ |
| 33 | +# Setup a rule for generating the ScopedMemoryAccess java class |
| 34 | +# Param 1 - Variable declaration prefix |
| 35 | +# Param 2 - Type with first letter capitalized |
| 36 | +define GenerateScopedOp |
| 37 | + |
| 38 | + $1_Type := $2 |
| 39 | + |
| 40 | + ifeq ($$($1_Type), Byte) |
| 41 | + $1_type := byte |
| 42 | + $1_BoxType := $$($1_Type) |
| 43 | + |
| 44 | + $1_rawType := $$($1_type) |
| 45 | + $1_RawType := $$($1_Type) |
| 46 | + $1_RawBoxType := $$($1_BoxType) |
| 47 | + |
| 48 | + $1_ARGS += -Kbyte |
| 49 | + endif |
| 50 | + |
| 51 | + ifeq ($$($1_Type), Short) |
| 52 | + $1_type := short |
| 53 | + $1_BoxType := $$($1_Type) |
| 54 | + |
| 55 | + $1_rawType := $$($1_type) |
| 56 | + $1_RawType := $$($1_Type) |
| 57 | + $1_RawBoxType := $$($1_BoxType) |
| 58 | + $1_ARGS += -KUnaligned |
| 59 | + endif |
| 60 | + |
| 61 | + ifeq ($$($1_Type), Char) |
| 62 | + $1_type := char |
| 63 | + $1_BoxType := Character |
| 64 | + |
| 65 | + $1_rawType := $$($1_type) |
| 66 | + $1_RawType := $$($1_Type) |
| 67 | + $1_RawBoxType := $$($1_BoxType) |
| 68 | + $1_ARGS += -KUnaligned |
| 69 | + endif |
| 70 | + |
| 71 | + ifeq ($$($1_Type), Int) |
| 72 | + $1_type := int |
| 73 | + $1_BoxType := Integer |
| 74 | + |
| 75 | + $1_rawType := $$($1_type) |
| 76 | + $1_RawType := $$($1_Type) |
| 77 | + $1_RawBoxType := $$($1_BoxType) |
| 78 | + |
| 79 | + $1_ARGS += -KCAS |
| 80 | + $1_ARGS += -KAtomicAdd |
| 81 | + $1_ARGS += -KBitwise |
| 82 | + $1_ARGS += -KUnaligned |
| 83 | + endif |
| 84 | + |
| 85 | + ifeq ($$($1_Type), Long) |
| 86 | + $1_type := long |
| 87 | + $1_BoxType := $$($1_Type) |
| 88 | + |
| 89 | + $1_rawType := $$($1_type) |
| 90 | + $1_RawType := $$($1_Type) |
| 91 | + $1_RawBoxType := $$($1_BoxType) |
| 92 | + |
| 93 | + $1_ARGS += -KCAS |
| 94 | + $1_ARGS += -KAtomicAdd |
| 95 | + $1_ARGS += -KBitwise |
| 96 | + $1_ARGS += -KUnaligned |
| 97 | + endif |
| 98 | + |
| 99 | + ifeq ($$($1_Type), Float) |
| 100 | + $1_type := float |
| 101 | + $1_BoxType := $$($1_Type) |
| 102 | + |
| 103 | + $1_rawType := int |
| 104 | + $1_RawType := Int |
| 105 | + $1_RawBoxType := Integer |
| 106 | + |
| 107 | + $1_ARGS += -KCAS |
| 108 | + $1_ARGS += -KfloatingPoint |
| 109 | + endif |
| 110 | + |
| 111 | + ifeq ($$($1_Type), Double) |
| 112 | + $1_type := double |
| 113 | + $1_BoxType := $$($1_Type) |
| 114 | + |
| 115 | + $1_rawType := long |
| 116 | + $1_RawType := Long |
| 117 | + $1_RawBoxType := Long |
| 118 | + |
| 119 | + $1_ARGS += -KCAS |
| 120 | + $1_ARGS += -KfloatingPoint |
| 121 | + endif |
| 122 | + |
| 123 | + ifneq ($$(findstring $$($1_Type), Byte Short Char Int Long Float Double), ) |
| 124 | + $1_ARGS += -KAtomicAdd |
| 125 | + endif |
| 126 | + |
| 127 | + ifneq ($$(findstring $$($1_Type), Boolean Byte Short Char Int Long), ) |
| 128 | + $1_ARGS += -KBitwise |
| 129 | + endif |
| 130 | + |
| 131 | + ifneq ($$(findstring $$($1_Type), Byte Short Char), ) |
| 132 | + $1_ARGS += -KShorterThanInt |
| 133 | + endif |
| 134 | +endef |
| 135 | + |
| 136 | +################################################################################ |
| 137 | +# Setup a rule for generating the ScopedMemoryAccess java class |
| 138 | + |
| 139 | +SCOPE_MEMORY_ACCESS_TYPES := Byte Short Char Int Long Float Double |
| 140 | +$(foreach t, $(SCOPE_MEMORY_ACCESS_TYPES), \ |
| 141 | + $(eval $(call GenerateScopedOp,BIN_$t,$t))) |
| 142 | + |
| 143 | +$(SCOPED_MEMORY_ACCESS_DEST): $(BUILD_TOOLS_JDK) $(SCOPED_MEMORY_ACCESS_TEMPLATE) $(SCOPED_MEMORY_ACCESS_BIN_TEMPLATE) |
| 144 | + $(call MakeDir, $(SCOPED_MEMORY_ACCESS_GENSRC_DIR)) |
| 145 | + $(CP) $(SCOPED_MEMORY_ACCESS_TEMPLATE) $(SCOPED_MEMORY_ACCESS_DEST) |
| 146 | + $(foreach t, $(SCOPE_MEMORY_ACCESS_TYPES), \ |
| 147 | + $(TOOL_SPP) -nel -K$(BIN_$t_type) -Dtype=$(BIN_$t_type) -DType=$(BIN_$t_Type) $(BIN_$t_ARGS) \ |
| 148 | + -i$(SCOPED_MEMORY_ACCESS_BIN_TEMPLATE) -o$(SCOPED_MEMORY_ACCESS_DEST) ;) |
| 149 | + $(PRINTF) "}\n" >> $(SCOPED_MEMORY_ACCESS_DEST) |
| 150 | + |
| 151 | +TARGETS += $(SCOPED_MEMORY_ACCESS_DEST) |
0 commit comments