|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
@@ -218,21 +218,22 @@ private static Object doDowncall(SegmentAllocator returnAllocator, Object[] args
|
218 | 218 | // note that cif is not used, but we store it here to keep it alive
|
219 | 219 | private record UpcallData(MemoryLayout returnLayout, List<MemoryLayout> argLayouts, MemorySegment cif) {}
|
220 | 220 |
|
| 221 | + @SuppressWarnings("restricted") |
221 | 222 | private static void doUpcall(MethodHandle target, MemorySegment retPtr, MemorySegment argPtrs, UpcallData data) throws Throwable {
|
222 | 223 | List<MemoryLayout> argLayouts = data.argLayouts();
|
223 | 224 | int numArgs = argLayouts.size();
|
224 | 225 | MemoryLayout retLayout = data.returnLayout();
|
225 | 226 | try (Arena upcallArena = Arena.ofConfined()) {
|
226 | 227 | MemorySegment argsSeg = argPtrs.reinterpret(numArgs * ADDRESS.byteSize(), upcallArena, null);
|
227 | 228 | MemorySegment retSeg = retLayout != null
|
228 |
| - ? retPtr.reinterpret(retLayout.byteSize(), upcallArena, null) |
| 229 | + ? retPtr.reinterpret(retLayout.byteSize(), upcallArena, null) // restricted |
229 | 230 | : null;
|
230 | 231 |
|
231 | 232 | Object[] args = new Object[numArgs];
|
232 | 233 | for (int i = 0; i < numArgs; i++) {
|
233 | 234 | MemoryLayout argLayout = argLayouts.get(i);
|
234 | 235 | MemorySegment argPtr = argsSeg.getAtIndex(ADDRESS, i)
|
235 |
| - .reinterpret(argLayout.byteSize(), upcallArena, null); |
| 236 | + .reinterpret(argLayout.byteSize(), upcallArena, null); // restricted |
236 | 237 | args[i] = readValue(argPtr, argLayout);
|
237 | 238 | }
|
238 | 239 |
|
|
0 commit comments