#
# Copyright (c) 2011, 2022, 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.
#
GENSRC_BUFFER :=
GENSRC_BUFFER_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio
GENSRC_BUFFER_SRC := $(MODULE_SRC)/share/classes/java/nio
###
$(GENSRC_BUFFER_DST)/_the.buffer.dir:
$(call LogInfo, Generating buffer classes)
$(call MakeDir, $(@D))
$(TOUCH) $@
define fixRw
$1 _RW := $2
$1 _rwkey := rw
ifeq (R, $2 )
$1 _rwkey := ro
endif
endef
define typesAndBits
# param 1 target
# param 2 type
# param 3 BO
$1 _a := a
$1 _A := A
$1 _type := $2
ifeq ($2 , byte)
$1 _x := b
$1 _Type := Byte
$1 _fulltype := byte
$1 _Fulltype := Byte
$1 _category := integralType
$1 _LBPV := 0
endif
ifeq ($2 , char)
$1 _x := c
$1 _Type := Char
$1 _fulltype := character
$1 _Fulltype := Character
$1 _category := integralType
$1 _streams := streamableType
$1 _streamtype := int
$1 _Streamtype := Int
$1 _LBPV := 1
endif
ifeq ($2 , short)
$1 _x := s
$1 _Type := Short
$1 _fulltype := short
$1 _Fulltype := Short
$1 _category := integralType
$1 _LBPV := 1
endif
ifeq ($2 , int)
$1 _a := an
$1 _A := An
$1 _x := i
$1 _Type := Int
$1 _fulltype := integer
$1 _Fulltype := Integer
$1 _category := integralType
$1 _LBPV := 2
endif
ifeq ($2 , long)
$1 _x := l
$1 _Type := Long
$1 _fulltype := long
$1 _Fulltype := Long
$1 _category := integralType
$1 _LBPV := 3
endif
ifeq ($2 , float)
$1 _x := f
$1 _Type := Float
$1 _fulltype := float
$1 _Fulltype := Float
$1 _category := floatingPointType
$1 _LBPV := 2
endif
ifeq ($2 , double)
$1 _x := d
$1 _Type := Double
$1 _fulltype := double
$1 _Fulltype := Double
$1 _category := floatingPointType
$1 _LBPV := 3
endif
$1 _Swaptype := $$($1 _Type)
$1 _memtype := $2
$1 _Memtype := $$($1 _Type)
ifeq ($2 , float)
$1 _memtype := int
$1 _Memtype := Int
ifneq ($3 , U)
$1 _Swaptype := Int
$1 _fromBits := Float.intBitsToFloat
$1 _toBits := Float.floatToRawIntBits
endif
endif
ifeq ($2 , double)
$1 _memtype := long
$1 _Memtype := Long
ifneq ($3 , U)
$1 _Swaptype := Long
$1 _fromBits := Double.longBitsToDouble
$1 _toBits := Double.doubleToRawLongBits
endif
endif
ifeq ($3 , S)
$1 _swap := Bits.swap
endif
endef
define genBinOps
# param 1 target
# param 2 type
# param 3 BO
# param 4 RW
# param 5 nbytes
# param 6 nbytesButOne
$(call typesAndBits,$1 ,$2 ,$3 )
$(call fixRw,$1 ,$4 )
$1 _nbytes := $5
$1 _nbytesButOne := $6
$1 _CMD := $(TOOL_SPP) \
-Dtype=$$($1 _type) \
-DType=$$($1 _Type) \
-Dfulltype=$$($1 _fulltype) \
-Dmemtype=$$($1 _memtype) \
-DMemtype=$$($1 _Memtype) \
-DfromBits=$$($1 _fromBits) \
-DtoBits=$$($1 _toBits) \
-DLG_BYTES_PER_VALUE=$$($1 _LBPV) \
-DBYTES_PER_VALUE="(1 << $$($1_LBPV))" \
-Dnbytes=$$($1 _nbytes) \
-DnbytesButOne=$$($1 _nbytesButOne) \
-DRW=$$($1 _RW) \
-K$$($1 _rwkey) \
-Da=$$($1 _a) \
-be
endef
define SetupGenBuffer
# param 1 is for output file
# param 2 is template dependency
# param 3-9 are named args.
# type :=
# BIN :=
# RW := Mutability (R)ead-only (W)ritable
# BO := (U)nswapped/(S)wapped/(L)ittle/(B)ig
#
$(if $3 ,$1 _$(strip $3 ))
$(if $4 ,$1 _$(strip $4 ))
$(if $5 ,$1 _$(strip $5 ))
$(if $6 ,$1 _$(strip $6 ))
$(if $7 ,$1 _$(strip $7 ))
$(if $8 ,$1 _$(strip $8 ))
$(if $9 ,$1 _$(strip $9 ))
$(if $(10 ),$1 _$(strip $(10 )))
$(if $(11 ),$1 _$(strip $(11 )))
$(if $(12 ),$1 _$(strip $(12 )))
$(if $(13 ),$1 _$(strip $(13 )))
$(if $(14 ),$1 _$(strip $(14 )))
$(foreach i,3 4 5 6 7 8 9 10 11 12 13 14 15 ,$(if $($i),$1 _$(strip $($i)))$(NEWLINE))
$(call LogSetupMacroEntry,SetupGenBuffer($1 ),$2 ,$3 ,$4 ,$5 ,$6 ,$7 ,$8 ,$9 ,$(10 ),$(11 ),$(12 ),$(13 ),$(14 ),$(15 ))
$(if $(16 ),$(error Internal makefile error: Too many arguments to SetupGenBuffer, please update GensrcBuffer.gmk))
$(call fixRw,$1 ,$$($1 _RW))
$(call typesAndBits,$1 ,$$($1 _type),$$($1 _BO))
$1 _DST := $(GENSRC_BUFFER_DST)/$1 .java
$1 _SRC := $(GENSRC_BUFFER_SRC)/$(strip $2 ).java.template
$1 _SRC_BIN := $(GENSRC_BUFFER_SRC)/$(strip $2 )-bin.java.template
$1 _DEP := $$($1 _SRC)
ifneq ($$($1 _BIN), 1 )
$1 _DEP := $$($1 _SRC)
$1 _OUT := $$($1 _DST)
else
$1 _DEP += $$($1 _SRC) $$($1 _SRC_BIN)
$1 _OUT := $(GENSRC_BUFFER_DST)/$1 .binop.0 .java
endif
ifeq ($$($1 _BIN), 1 )
$(call genBinOps,$1 _char,char,$$($1 _BO),$$($1 _RW),two,one)
$(call genBinOps,$1 _short,short,$$($1 _BO),$$($1 _RW),two,one)
$(call genBinOps,$1 _int,int,$$($1 _BO),$$($1 _RW),four,three)
$(call genBinOps,$1 _long,long,$$($1 _BO),$$($1 _RW),eight,seven)
$(call genBinOps,$1 _float,float,$$($1 _BO),$$($1 _RW),four,three)
$(call genBinOps,$1 _double,double,$$($1 _BO),$$($1 _RW),eight,seven)
endif
$$($1 _DST): $$($1 _DEP) $(GENSRC_BUFFER_DST)/_the.buffer.dir
$(RM ) $$($1 _OUT).tmp
$(TOOL_SPP) -i$$($1 _SRC) -o$$($1 _OUT).tmp \
-K$$($1 _type) \
-K$$($1 _category) \
-K$$($1 _streams) \
-Dtype=$$($1 _type) \
-DType=$$($1 _Type) \
-Dfulltype=$$($1 _fulltype) \
-DFulltype=$$($1 _Fulltype) \
-Dstreamtype=$$($1 _streamtype) \
-DStreamtype=$$($1 _Streamtype) \
-Dx=$$($1 _x) \
-Dmemtype=$$($1 _memtype) \
-DMemtype=$$($1 _Memtype) \
-DSwaptype=$$($1 _Swaptype) \
-DfromBits=$$($1 _fromBits) \
-DtoBits=$$($1 _toBits) \
-DLG_BYTES_PER_VALUE=$$($1 _LBPV) \
-DBYTES_PER_VALUE="(1 << $$($1_LBPV))" \
-DBO=$$($1 _BO) \
-Dswap=$$($1 _swap) \
-DRW=$$($1 _RW) \
-K$$($1 _rwkey) \
-Da=$$($1 _a) \
-DA=$$($1 _A) \
-Kbo$$($1 _BO)
$(MV) $$($1 _OUT).tmp $$($1 _OUT)
# Do the extra bin thing
ifeq ($$($1 _BIN), 1 )
$(SED) -e '/#BIN/,$$$$d' < $$($1_OUT) > $$($1_DST).tmp
$(RM ) $$($1 _OUT)
$$($1 _char_CMD) -i$$($1 _SRC_BIN) -o$$($1 _DST).tmp
$$($1 _short_CMD) -i$$($1 _SRC_BIN) -o$$($1 _DST).tmp
$$($1 _int_CMD) -i$$($1 _SRC_BIN) -o$$($1 _DST).tmp
$$($1 _long_CMD) -i$$($1 _SRC_BIN) -o$$($1 _DST).tmp
$$($1 _float_CMD) -i$$($1 _SRC_BIN) -o$$($1 _DST).tmp
$$($1 _double_CMD) -i$$($1 _SRC_BIN) -o$$($1 _DST).tmp
$(PRINTF) "}\n" >> $$($1 _DST).tmp
mv $$($1 _DST).tmp $$($1 _DST)
endif
GENSRC_BUFFER += $$($1 _DST)
endef
###
X_BUF := X-Buffer
$(eval $(call SetupGenBuffer,ByteBuffer, $(X_BUF), type:=byte, BIN:=1 ))
$(eval $(call SetupGenBuffer,CharBuffer, $(X_BUF), type:=char))
$(eval $(call SetupGenBuffer,ShortBuffer, $(X_BUF), type:=short))
$(eval $(call SetupGenBuffer,IntBuffer, $(X_BUF), type:=int))
$(eval $(call SetupGenBuffer,LongBuffer, $(X_BUF), type:=long))
$(eval $(call SetupGenBuffer,FloatBuffer, $(X_BUF), type:=float))
$(eval $(call SetupGenBuffer,DoubleBuffer,$(X_BUF), type:=double))
# Buffers whose contents are heap-allocated
#
HEAP_X_BUF := Heap-X-Buffer
$(eval $(call SetupGenBuffer,HeapByteBuffer, $(HEAP_X_BUF), type:=byte))
$(eval $(call SetupGenBuffer,HeapByteBufferR, $(HEAP_X_BUF), type:=byte, RW:=R))
$(eval $(call SetupGenBuffer,HeapCharBuffer, $(HEAP_X_BUF), type:=char))
$(eval $(call SetupGenBuffer,HeapCharBufferR, $(HEAP_X_BUF), type:=char, RW:=R))
$(eval $(call SetupGenBuffer,HeapShortBuffer, $(HEAP_X_BUF), type:=short))
$(eval $(call SetupGenBuffer,HeapShortBufferR, $(HEAP_X_BUF), type:=short, RW:=R))
$(eval $(call SetupGenBuffer,HeapIntBuffer, $(HEAP_X_BUF), type:=int))
$(eval $(call SetupGenBuffer,HeapIntBufferR, $(HEAP_X_BUF), type:=int, RW:=R))
$(eval $(call SetupGenBuffer,HeapLongBuffer, $(HEAP_X_BUF), type:=long))
$(eval $(call SetupGenBuffer,HeapLongBufferR, $(HEAP_X_BUF), type:=long, RW:=R))
$(eval $(call SetupGenBuffer,HeapFloatBuffer, $(HEAP_X_BUF), type:=float))
$(eval $(call SetupGenBuffer,HeapFloatBufferR, $(HEAP_X_BUF), type:=float, RW:=R))
$(eval $(call SetupGenBuffer,HeapDoubleBuffer, $(HEAP_X_BUF), type:=double))
$(eval $(call SetupGenBuffer,HeapDoubleBufferR,$(HEAP_X_BUF), type:=double, RW:=R))
# Direct byte buffer
#
DIRECT_X_BUF := Direct-X-Buffer
$(eval $(call SetupGenBuffer,DirectByteBuffer, $(DIRECT_X_BUF), type:=byte, BIN:=1 ))
$(eval $(call SetupGenBuffer,DirectByteBufferR,$(DIRECT_X_BUF), type:=byte, BIN:=1 , RW:=R))
# Unswapped views of direct byte buffers
#
$(eval $(call SetupGenBuffer,DirectCharBufferU, $(DIRECT_X_BUF), type:=char, BO:=U))
$(eval $(call SetupGenBuffer,DirectCharBufferRU, $(DIRECT_X_BUF), type:=char, RW:=R, BO:=U))
$(eval $(call SetupGenBuffer,DirectShortBufferU, $(DIRECT_X_BUF), type:=short, BO:=U))
$(eval $(call SetupGenBuffer,DirectShortBufferRU, $(DIRECT_X_BUF), type:=short, RW:=R, BO:=U))
$(eval $(call SetupGenBuffer,DirectIntBufferU, $(DIRECT_X_BUF), type:=int, BO:=U))
$(eval $(call SetupGenBuffer,DirectIntBufferRU, $(DIRECT_X_BUF), type:=int, RW:=R, BO:=U))
$(eval $(call SetupGenBuffer,DirectLongBufferU, $(DIRECT_X_BUF), type:=long, BO:=U))
$(eval $(call SetupGenBuffer,DirectLongBufferRU, $(DIRECT_X_BUF), type:=long, RW:=R, BO:=U))
$(eval $(call SetupGenBuffer,DirectFloatBufferU, $(DIRECT_X_BUF), type:=float, BO:=U))
$(eval $(call SetupGenBuffer,DirectFloatBufferRU, $(DIRECT_X_BUF), type:=float, RW:=R, BO:=U))
$(eval $(call SetupGenBuffer,DirectDoubleBufferU, $(DIRECT_X_BUF), type:=double, BO:=U))
$(eval $(call SetupGenBuffer,DirectDoubleBufferRU,$(DIRECT_X_BUF), type:=double, RW:=R, BO:=U))
# Swapped views of direct byte buffers
#
$(eval $(call SetupGenBuffer,DirectCharBufferS, $(DIRECT_X_BUF), type:=char, BO:=S))
$(eval $(call SetupGenBuffer,DirectCharBufferRS, $(DIRECT_X_BUF), type:=char, RW:=R, BO:=S))
$(eval $(call SetupGenBuffer,DirectShortBufferS, $(DIRECT_X_BUF), type:=short, BO:=S))
$(eval $(call SetupGenBuffer,DirectShortBufferRS, $(DIRECT_X_BUF), type:=short, RW:=R, BO:=S))
$(eval $(call SetupGenBuffer,DirectIntBufferS, $(DIRECT_X_BUF), type:=int, BO:=S))
$(eval $(call SetupGenBuffer,DirectIntBufferRS, $(DIRECT_X_BUF), type:=int, RW:=R, BO:=S))
$(eval $(call SetupGenBuffer,DirectLongBufferS, $(DIRECT_X_BUF), type:=long, BO:=S))
$(eval $(call SetupGenBuffer,DirectLongBufferRS, $(DIRECT_X_BUF), type:=long, RW:=R, BO:=S))
$(eval $(call SetupGenBuffer,DirectFloatBufferS, $(DIRECT_X_BUF), type:=float, BO:=S))
$(eval $(call SetupGenBuffer,DirectFloatBufferRS, $(DIRECT_X_BUF), type:=float, RW:=R, BO:=S))
$(eval $(call SetupGenBuffer,DirectDoubleBufferS, $(DIRECT_X_BUF), type:=double, BO:=S))
$(eval $(call SetupGenBuffer,DirectDoubleBufferRS,$(DIRECT_X_BUF), type:=double, RW:=R, BO:=S))
# Big-endian views of byte buffers
#
BYTE_X_BUF := ByteBufferAs-X-Buffer
$(eval $(call SetupGenBuffer,ByteBufferAsCharBufferB, $(BYTE_X_BUF), type:=char, BO:=B))
$(eval $(call SetupGenBuffer,ByteBufferAsCharBufferRB, $(BYTE_X_BUF), type:=char, RW:=R, BO:=B))
$(eval $(call SetupGenBuffer,ByteBufferAsShortBufferB, $(BYTE_X_BUF), type:=short, BO:=B))
$(eval $(call SetupGenBuffer,ByteBufferAsShortBufferRB, $(BYTE_X_BUF), type:=short, RW:=R, BO:=B))
$(eval $(call SetupGenBuffer,ByteBufferAsIntBufferB, $(BYTE_X_BUF), type:=int, BO:=B))
$(eval $(call SetupGenBuffer,ByteBufferAsIntBufferRB, $(BYTE_X_BUF), type:=int, RW:=R, BO:=B))
$(eval $(call SetupGenBuffer,ByteBufferAsLongBufferB, $(BYTE_X_BUF), type:=long, BO:=B))
$(eval $(call SetupGenBuffer,ByteBufferAsLongBufferRB, $(BYTE_X_BUF), type:=long, RW:=R, BO:=B))
$(eval $(call SetupGenBuffer,ByteBufferAsFloatBufferB, $(BYTE_X_BUF), type:=float, BO:=B))
$(eval $(call SetupGenBuffer,ByteBufferAsFloatBufferRB, $(BYTE_X_BUF), type:=float, RW:=R, BO:=B))
$(eval $(call SetupGenBuffer,ByteBufferAsDoubleBufferB, $(BYTE_X_BUF), type:=double, BO:=B))
$(eval $(call SetupGenBuffer,ByteBufferAsDoubleBufferRB,$(BYTE_X_BUF), type:=double, RW:=R, BO:=B))
# Little-endian views of byte buffers
#
$(eval $(call SetupGenBuffer,ByteBufferAsCharBufferL, $(BYTE_X_BUF), type:=char, BO:=L))
$(eval $(call SetupGenBuffer,ByteBufferAsCharBufferRL, $(BYTE_X_BUF), type:=char, RW:=R, BO:=L))
$(eval $(call SetupGenBuffer,ByteBufferAsShortBufferL, $(BYTE_X_BUF), type:=short, BO:=L))
$(eval $(call SetupGenBuffer,ByteBufferAsShortBufferRL, $(BYTE_X_BUF), type:=short, RW:=R, BO:=L))
$(eval $(call SetupGenBuffer,ByteBufferAsIntBufferL, $(BYTE_X_BUF), type:=int, BO:=L))
$(eval $(call SetupGenBuffer,ByteBufferAsIntBufferRL, $(BYTE_X_BUF), type:=int, RW:=R, BO:=L))
$(eval $(call SetupGenBuffer,ByteBufferAsLongBufferL, $(BYTE_X_BUF), type:=long, BO:=L))
$(eval $(call SetupGenBuffer,ByteBufferAsLongBufferRL, $(BYTE_X_BUF), type:=long, RW:=R, BO:=L))
$(eval $(call SetupGenBuffer,ByteBufferAsFloatBufferL, $(BYTE_X_BUF), type:=float, BO:=L))
$(eval $(call SetupGenBuffer,ByteBufferAsFloatBufferRL, $(BYTE_X_BUF), type:=float, RW:=R, BO:=L))
$(eval $(call SetupGenBuffer,ByteBufferAsDoubleBufferL, $(BYTE_X_BUF), type:=double, BO:=L))
$(eval $(call SetupGenBuffer,ByteBufferAsDoubleBufferRL,$(BYTE_X_BUF), type:=double, RW:=R, BO:=L))
###
$(GENSRC_BUFFER): $(BUILD_TOOLS_JDK)
TARGETS += $(GENSRC_BUFFER)
Messung V0.5 in Prozent C=81 H=99 G=90
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-10)
¤
*© Formatika GbR, Deutschland