src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template
changeset 49210 7c795d301dbf
parent 48356 29e165bdf669
equal deleted inserted replaced
49209:bd7c17f99a19 49210:7c795d301dbf
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    30 #begin
    30 #begin
    31 
    31 
    32 #if[rw]
    32 #if[rw]
    33 
    33 
    34     private $type$ get$Type$(long a) {
    34     private $type$ get$Type$(long a) {
    35         $memtype$ x = UNSAFE.get$Memtype$Unaligned(null, a, bigEndian);
    35         try {
    36         return $fromBits$(x);
    36             $memtype$ x = UNSAFE.get$Memtype$Unaligned(null, a, bigEndian);
       
    37             return $fromBits$(x);
       
    38         } finally {
       
    39             Reference.reachabilityFence(this);
       
    40         }
    37     }
    41     }
    38 
    42 
    39     public $type$ get$Type$() {
    43     public $type$ get$Type$() {
    40         return get$Type$(ix(nextGetIndex($BYTES_PER_VALUE$)));
    44         try {
       
    45             return get$Type$(ix(nextGetIndex($BYTES_PER_VALUE$)));
       
    46         } finally {
       
    47             Reference.reachabilityFence(this);
       
    48         }
    41     }
    49     }
    42 
    50 
    43     public $type$ get$Type$(int i) {
    51     public $type$ get$Type$(int i) {
    44         return get$Type$(ix(checkIndex(i, $BYTES_PER_VALUE$)));
    52         try {
       
    53             return get$Type$(ix(checkIndex(i, $BYTES_PER_VALUE$)));
       
    54         } finally {
       
    55             Reference.reachabilityFence(this);
       
    56         }
    45     }
    57     }
    46 
    58 
    47 #end[rw]
    59 #end[rw]
    48 
    60 
    49     private ByteBuffer put$Type$(long a, $type$ x) {
    61     private ByteBuffer put$Type$(long a, $type$ x) {
    50 #if[rw]
    62 #if[rw]
    51         $memtype$ y = $toBits$(x);
    63         try {
    52         UNSAFE.put$Memtype$Unaligned(null, a, y, bigEndian);
    64             $memtype$ y = $toBits$(x);
       
    65             UNSAFE.put$Memtype$Unaligned(null, a, y, bigEndian);
       
    66         } finally {
       
    67             Reference.reachabilityFence(this);
       
    68         }
    53         return this;
    69         return this;
    54 #else[rw]
    70 #else[rw]
    55         throw new ReadOnlyBufferException();
    71         throw new ReadOnlyBufferException();
    56 #end[rw]
    72 #end[rw]
    57     }
    73     }