8350118: Simplify the layout access VarHandle

Reviewed-by: mcimadamore, jvernee, erikj
This commit is contained in:
Chen Liang 2025-02-28 20:01:17 +00:00
parent fb659eba02
commit c7fa499bf5
18 changed files with 1977 additions and 1140 deletions

View file

@ -42,6 +42,17 @@ define GenerateScopedOp
$1_Type := $2
ifeq ($$($1_Type), Boolean)
$1_type := boolean
$1_BoxType := $$($1_Type)
$1_rawType := $$($1_type)
$1_RawType := $$($1_Type)
$1_RawBoxType := $$($1_BoxType)
$1_ARGS += -KCAS
endif
ifeq ($$($1_Type), Byte)
$1_type := byte
$1_BoxType := $$($1_Type)
@ -50,6 +61,7 @@ define GenerateScopedOp
$1_RawType := $$($1_Type)
$1_RawBoxType := $$($1_BoxType)
$1_ARGS += -KCAS
$1_ARGS += -Kbyte
endif
@ -60,6 +72,8 @@ define GenerateScopedOp
$1_rawType := $$($1_type)
$1_RawType := $$($1_Type)
$1_RawBoxType := $$($1_BoxType)
$1_ARGS += -KCAS
$1_ARGS += -KUnaligned
endif
@ -70,6 +84,8 @@ define GenerateScopedOp
$1_rawType := $$($1_type)
$1_RawType := $$($1_Type)
$1_RawBoxType := $$($1_BoxType)
$1_ARGS += -KCAS
$1_ARGS += -KUnaligned
endif
@ -82,8 +98,6 @@ define GenerateScopedOp
$1_RawBoxType := $$($1_BoxType)
$1_ARGS += -KCAS
$1_ARGS += -KAtomicAdd
$1_ARGS += -KBitwise
$1_ARGS += -KUnaligned
endif
@ -96,8 +110,6 @@ define GenerateScopedOp
$1_RawBoxType := $$($1_BoxType)
$1_ARGS += -KCAS
$1_ARGS += -KAtomicAdd
$1_ARGS += -KBitwise
$1_ARGS += -KUnaligned
endif
@ -133,7 +145,7 @@ define GenerateScopedOp
$1_ARGS += -KBitwise
endif
ifneq ($$(findstring $$($1_Type), Byte Short Char), )
ifneq ($$(findstring $$($1_Type), Boolean Byte Short Char), )
$1_ARGS += -KShorterThanInt
endif
endef
@ -141,7 +153,7 @@ endef
################################################################################
# Setup a rule for generating the ScopedMemoryAccess java class
SCOPE_MEMORY_ACCESS_TYPES := Byte Short Char Int Long Float Double
SCOPE_MEMORY_ACCESS_TYPES := Boolean Byte Short Char Int Long Float Double
$(foreach t, $(SCOPE_MEMORY_ACCESS_TYPES), \
$(eval $(call GenerateScopedOp,BIN_$t,$t)))

View file

@ -174,6 +174,18 @@ define GenerateVarHandleMemorySegment
$1_FILENAME := $(VARHANDLES_GENSRC_DIR)/VarHandleSegmentAs$$($1_Type)s.java
ifeq ($$($1_Type), Boolean)
$1_type := boolean
$1_BoxType := $$($1_Type)
$1_rawType := $$($1_type)
$1_RawType := $$($1_Type)
$1_RawBoxType := $$($1_BoxType)
$1_ARGS += -Kbyte
$1_ARGS += -KShorterThanInt
endif
ifeq ($$($1_Type), Byte)
$1_type := byte
$1_BoxType := $$($1_Type)
@ -183,6 +195,7 @@ define GenerateVarHandleMemorySegment
$1_RawBoxType := $$($1_BoxType)
$1_ARGS += -Kbyte
$1_ARGS += -KShorterThanInt
endif
ifeq ($$($1_Type), Short)
@ -192,6 +205,8 @@ define GenerateVarHandleMemorySegment
$1_rawType := $$($1_type)
$1_RawType := $$($1_Type)
$1_RawBoxType := $$($1_BoxType)
$1_ARGS += -KShorterThanInt
endif
ifeq ($$($1_Type), Char)
@ -201,6 +216,8 @@ define GenerateVarHandleMemorySegment
$1_rawType := $$($1_type)
$1_RawType := $$($1_Type)
$1_RawBoxType := $$($1_BoxType)
$1_ARGS += -KShorterThanInt
endif
ifeq ($$($1_Type), Int)
@ -277,7 +294,7 @@ $(foreach t, $(VARHANDLES_BYTE_ARRAY_TYPES), \
$(eval $(call GenerateVarHandleByteArray,VAR_HANDLE_BYTE_ARRAY_$t,$t)))
# List the types to generate source for, with capitalized first letter
VARHANDLES_MEMORY_SEGMENT_TYPES := Byte Short Char Int Long Float Double
VARHANDLES_MEMORY_SEGMENT_TYPES := Boolean Byte Short Char Int Long Float Double
$(foreach t, $(VARHANDLES_MEMORY_SEGMENT_TYPES), \
$(eval $(call GenerateVarHandleMemorySegment,VAR_HANDLE_MEMORY_SEGMENT_$t,$t)))