author | cjplummer |
Sat, 06 May 2017 00:05:32 +0000 | |
changeset 46439 | 6de560f6c1ad |
parent 41842 | 50202a344d28 |
permissions | -rw-r--r-- |
34548
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
1 |
/* |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
3 |
* |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
4 |
* Redistribution and use in source and binary forms, with or without |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
5 |
* modification, are permitted provided that the following conditions |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
6 |
* are met: |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
7 |
* |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
8 |
* - Redistributions of source code must retain the above copyright |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
9 |
* notice, this list of conditions and the following disclaimer. |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
10 |
* |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
11 |
* - Redistributions in binary form must reproduce the above copyright |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
12 |
* notice, this list of conditions and the following disclaimer in the |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
13 |
* documentation and/or other materials provided with the distribution. |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
14 |
* |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
15 |
* - Neither the name of Oracle nor the names of its |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
16 |
* contributors may be used to endorse or promote products derived |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
17 |
* from this software without specific prior written permission. |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
18 |
* |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
19 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
20 |
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
21 |
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
22 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
23 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
24 |
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
25 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
26 |
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
27 |
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
28 |
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
29 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
30 |
*/ |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
31 |
|
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
32 |
import static jdk.dynalink.StandardNamespace.ELEMENT; |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
33 |
import static jdk.dynalink.StandardNamespace.PROPERTY; |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
34 |
import static jdk.dynalink.StandardOperation.GET; |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
35 |
import static jdk.dynalink.StandardOperation.SET; |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
36 |
|
34548
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
37 |
import java.lang.invoke.MethodHandle; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
38 |
import java.lang.invoke.MethodType; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
39 |
import java.nio.Buffer; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
40 |
import java.nio.ByteBuffer; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
41 |
import java.nio.CharBuffer; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
42 |
import java.nio.DoubleBuffer; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
43 |
import java.nio.FloatBuffer; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
44 |
import java.nio.IntBuffer; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
45 |
import java.nio.LongBuffer; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
46 |
import java.nio.ShortBuffer; |
41422 | 47 |
import java.util.ArrayList; |
48 |
import java.util.List; |
|
34548
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
49 |
import jdk.dynalink.CallSiteDescriptor; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
50 |
import jdk.dynalink.NamedOperation; |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
51 |
import jdk.dynalink.NamespaceOperation; |
34548
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
52 |
import jdk.dynalink.Operation; |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
53 |
import jdk.dynalink.StandardNamespace; |
41422 | 54 |
import jdk.dynalink.linker.GuardedInvocation; |
34548
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
55 |
import jdk.dynalink.linker.GuardingDynamicLinker; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
56 |
import jdk.dynalink.linker.GuardingDynamicLinkerExporter; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
57 |
import jdk.dynalink.linker.LinkRequest; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
58 |
import jdk.dynalink.linker.LinkerServices; |
41422 | 59 |
import jdk.dynalink.linker.TypeBasedGuardingDynamicLinker; |
34548
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
60 |
import jdk.dynalink.linker.support.Guards; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
61 |
import jdk.dynalink.linker.support.Lookup; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
62 |
|
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
63 |
/** |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
64 |
* This is a dynalink pluggable linker (see http://openjdk.java.net/jeps/276). |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
65 |
* This linker adds array-like indexing and "length" property to nio Buffer objects. |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
66 |
*/ |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
67 |
public final class BufferIndexingLinkerExporter extends GuardingDynamicLinkerExporter { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
68 |
static { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
69 |
System.out.println("pluggable dynalink buffer indexing linker loaded"); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
70 |
} |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
71 |
|
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
72 |
private static final MethodHandle BUFFER_LIMIT; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
73 |
private static final MethodHandle BYTEBUFFER_GET; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
74 |
private static final MethodHandle BYTEBUFFER_PUT; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
75 |
private static final MethodHandle CHARBUFFER_GET; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
76 |
private static final MethodHandle CHARBUFFER_PUT; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
77 |
private static final MethodHandle SHORTBUFFER_GET; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
78 |
private static final MethodHandle SHORTBUFFER_PUT; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
79 |
private static final MethodHandle INTBUFFER_GET; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
80 |
private static final MethodHandle INTBUFFER_PUT; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
81 |
private static final MethodHandle LONGBUFFER_GET; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
82 |
private static final MethodHandle LONGBUFFER_PUT; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
83 |
private static final MethodHandle FLOATBUFFER_GET; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
84 |
private static final MethodHandle FLOATBUFFER_PUT; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
85 |
private static final MethodHandle DOUBLEBUFFER_GET; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
86 |
private static final MethodHandle DOUBLEBUFFER_PUT; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
87 |
|
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
88 |
// guards |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
89 |
private static final MethodHandle IS_BUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
90 |
private static final MethodHandle IS_BYTEBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
91 |
private static final MethodHandle IS_CHARBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
92 |
private static final MethodHandle IS_SHORTBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
93 |
private static final MethodHandle IS_INTBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
94 |
private static final MethodHandle IS_LONGBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
95 |
private static final MethodHandle IS_FLOATBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
96 |
private static final MethodHandle IS_DOUBLEBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
97 |
|
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
98 |
private static final MethodType GUARD_TYPE; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
99 |
|
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
100 |
static { |
41422 | 101 |
final Lookup look = Lookup.PUBLIC; |
34548
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
102 |
BUFFER_LIMIT = look.findVirtual(Buffer.class, "limit", MethodType.methodType(int.class)); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
103 |
BYTEBUFFER_GET = look.findVirtual(ByteBuffer.class, "get", |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
104 |
MethodType.methodType(byte.class, int.class)); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
105 |
BYTEBUFFER_PUT = look.findVirtual(ByteBuffer.class, "put", |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
106 |
MethodType.methodType(ByteBuffer.class, int.class, byte.class)); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
107 |
CHARBUFFER_GET = look.findVirtual(CharBuffer.class, "get", |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
108 |
MethodType.methodType(char.class, int.class)); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
109 |
CHARBUFFER_PUT = look.findVirtual(CharBuffer.class, "put", |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
110 |
MethodType.methodType(CharBuffer.class, int.class, char.class)); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
111 |
SHORTBUFFER_GET = look.findVirtual(ShortBuffer.class, "get", |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
112 |
MethodType.methodType(short.class, int.class)); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
113 |
SHORTBUFFER_PUT = look.findVirtual(ShortBuffer.class, "put", |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
114 |
MethodType.methodType(ShortBuffer.class, int.class, short.class)); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
115 |
INTBUFFER_GET = look.findVirtual(IntBuffer.class, "get", |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
116 |
MethodType.methodType(int.class, int.class)); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
117 |
INTBUFFER_PUT = look.findVirtual(IntBuffer.class, "put", |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
118 |
MethodType.methodType(IntBuffer.class, int.class, int.class)); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
119 |
LONGBUFFER_GET = look.findVirtual(LongBuffer.class, "get", |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
120 |
MethodType.methodType(long.class, int.class)); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
121 |
LONGBUFFER_PUT = look.findVirtual(LongBuffer.class, "put", |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
122 |
MethodType.methodType(LongBuffer.class, int.class, long.class)); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
123 |
FLOATBUFFER_GET = look.findVirtual(FloatBuffer.class, "get", |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
124 |
MethodType.methodType(float.class, int.class)); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
125 |
FLOATBUFFER_PUT = look.findVirtual(FloatBuffer.class, "put", |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
126 |
MethodType.methodType(FloatBuffer.class, int.class, float.class)); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
127 |
DOUBLEBUFFER_GET = look.findVirtual(DoubleBuffer.class, "get", |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
128 |
MethodType.methodType(double.class, int.class)); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
129 |
DOUBLEBUFFER_PUT = look.findVirtual(DoubleBuffer.class, "put", |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
130 |
MethodType.methodType(DoubleBuffer.class, int.class, double.class)); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
131 |
|
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
132 |
GUARD_TYPE = MethodType.methodType(boolean.class, Object.class); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
133 |
IS_BUFFER = Guards.isInstance(Buffer.class, GUARD_TYPE); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
134 |
IS_BYTEBUFFER = Guards.isInstance(ByteBuffer.class, GUARD_TYPE); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
135 |
IS_CHARBUFFER = Guards.isInstance(CharBuffer.class, GUARD_TYPE); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
136 |
IS_SHORTBUFFER = Guards.isInstance(ShortBuffer.class, GUARD_TYPE); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
137 |
IS_INTBUFFER = Guards.isInstance(IntBuffer.class, GUARD_TYPE); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
138 |
IS_LONGBUFFER = Guards.isInstance(LongBuffer.class, GUARD_TYPE); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
139 |
IS_FLOATBUFFER = Guards.isInstance(FloatBuffer.class, GUARD_TYPE); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
140 |
IS_DOUBLEBUFFER = Guards.isInstance(DoubleBuffer.class, GUARD_TYPE); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
141 |
} |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
142 |
|
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
143 |
@Override |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
144 |
public List<GuardingDynamicLinker> get() { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
145 |
final ArrayList<GuardingDynamicLinker> linkers = new ArrayList<>(); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
146 |
linkers.add(new TypeBasedGuardingDynamicLinker() { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
147 |
@Override |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
148 |
public boolean canLinkType(final Class<?> type) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
149 |
return Buffer.class.isAssignableFrom(type); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
150 |
} |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
151 |
|
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
152 |
@Override |
41422 | 153 |
public GuardedInvocation getGuardedInvocation(final LinkRequest request, |
154 |
final LinkerServices linkerServices) throws Exception { |
|
34548
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
155 |
final Object self = request.getReceiver(); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
156 |
if (self == null || !canLinkType(self.getClass())) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
157 |
return null; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
158 |
} |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
159 |
|
41422 | 160 |
final CallSiteDescriptor desc = request.getCallSiteDescriptor(); |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
161 |
final Operation namedOp = desc.getOperation(); |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
162 |
final Operation namespaceOp = NamedOperation.getBaseOperation(namedOp); |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
163 |
final Operation op = NamespaceOperation.getBaseOperation(namespaceOp); |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
164 |
final StandardNamespace ns = StandardNamespace.findFirst(namespaceOp); |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
165 |
if (ns == null) { |
34548
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
166 |
return null; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
167 |
} |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
168 |
|
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
169 |
if (op == GET) { |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
170 |
if (ns == ELEMENT) { |
34548
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
171 |
return linkGetElement(self); |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
172 |
} else if (ns == PROPERTY) { |
41422 | 173 |
final Object name = NamedOperation.getName(desc.getOperation()); |
34548
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
174 |
if ("length".equals(name)) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
175 |
return linkLength(); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
176 |
} |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
177 |
} |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
178 |
} else if (op == SET && ns == ELEMENT) { |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
41422
diff
changeset
|
179 |
return linkSetElement(self); |
34548
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
180 |
} |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
181 |
|
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
182 |
return null; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
183 |
} |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
184 |
}); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
185 |
return linkers; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
186 |
} |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
187 |
|
41422 | 188 |
private static GuardedInvocation linkGetElement(final Object self) { |
34548
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
189 |
MethodHandle method = null; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
190 |
MethodHandle guard = null; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
191 |
if (self instanceof ByteBuffer) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
192 |
method = BYTEBUFFER_GET; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
193 |
guard = IS_BYTEBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
194 |
} else if (self instanceof CharBuffer) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
195 |
method = CHARBUFFER_GET; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
196 |
guard = IS_CHARBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
197 |
} else if (self instanceof ShortBuffer) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
198 |
method = SHORTBUFFER_GET; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
199 |
guard = IS_SHORTBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
200 |
} else if (self instanceof IntBuffer) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
201 |
method = INTBUFFER_GET; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
202 |
guard = IS_INTBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
203 |
} else if (self instanceof LongBuffer) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
204 |
method = LONGBUFFER_GET; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
205 |
guard = IS_LONGBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
206 |
} else if (self instanceof FloatBuffer) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
207 |
method = FLOATBUFFER_GET; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
208 |
guard = IS_FLOATBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
209 |
} else if (self instanceof DoubleBuffer) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
210 |
method = DOUBLEBUFFER_GET; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
211 |
guard = IS_DOUBLEBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
212 |
} |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
213 |
|
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
214 |
return method != null? new GuardedInvocation(method, guard) : null; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
215 |
} |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
216 |
|
41422 | 217 |
private static GuardedInvocation linkSetElement(final Object self) { |
34548
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
218 |
MethodHandle method = null; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
219 |
MethodHandle guard = null; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
220 |
if (self instanceof ByteBuffer) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
221 |
method = BYTEBUFFER_PUT; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
222 |
guard = IS_BYTEBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
223 |
} else if (self instanceof CharBuffer) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
224 |
method = CHARBUFFER_PUT; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
225 |
guard = IS_CHARBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
226 |
} else if (self instanceof ShortBuffer) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
227 |
method = SHORTBUFFER_PUT; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
228 |
guard = IS_SHORTBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
229 |
} else if (self instanceof IntBuffer) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
230 |
method = INTBUFFER_PUT; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
231 |
guard = IS_INTBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
232 |
} else if (self instanceof LongBuffer) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
233 |
method = LONGBUFFER_PUT; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
234 |
guard = IS_LONGBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
235 |
} else if (self instanceof FloatBuffer) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
236 |
method = FLOATBUFFER_PUT; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
237 |
guard = IS_FLOATBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
238 |
} else if (self instanceof DoubleBuffer) { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
239 |
method = DOUBLEBUFFER_PUT; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
240 |
guard = IS_DOUBLEBUFFER; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
241 |
} |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
242 |
|
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
243 |
return method != null? new GuardedInvocation(method, guard) : null; |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
244 |
} |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
245 |
|
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
246 |
private static GuardedInvocation linkLength() { |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
247 |
return new GuardedInvocation(BUFFER_LIMIT, IS_BUFFER); |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
248 |
} |
44779bfb4c13
8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff
changeset
|
249 |
} |