mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8264774: Implementation of Foreign Function and Memory API (Incubator)
Co-authored-by: Paul Sandoz <psandoz@openjdk.org> Co-authored-by: Jorn Vernee <jvernee@openjdk.org> Co-authored-by: Vladimir Ivanov <vlivanov@openjdk.org> Co-authored-by: Athijegannathan Sundararajan <sundar@openjdk.org> Co-authored-by: Chris Hegarty <chegar@openjdk.org> Reviewed-by: psandoz, chegar, mchung, vlivanov
This commit is contained in:
parent
71425ddfb4
commit
a223189b06
219 changed files with 10936 additions and 5695 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2021, 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
|
||||
|
@ -30,6 +30,7 @@ import jdk.internal.access.SharedSecrets;
|
|||
import jdk.internal.access.foreign.MemorySegmentProxy;
|
||||
import jdk.internal.access.foreign.UnmapperProxy;
|
||||
import jdk.internal.misc.ScopedMemoryAccess;
|
||||
import jdk.internal.misc.ScopedMemoryAccess.Scope;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import jdk.internal.misc.VM.BufferPool;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
|
@ -821,6 +822,18 @@ public abstract class Buffer {
|
|||
return buffer.segment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Scope.Handle acquireScope(Buffer buffer, boolean async) {
|
||||
var scope = buffer.scope();
|
||||
if (scope == null) {
|
||||
return null;
|
||||
}
|
||||
if (async && scope.ownerThread() != null) {
|
||||
throw new IllegalStateException("Confined scope not supported");
|
||||
}
|
||||
return scope.acquire();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void force(FileDescriptor fd, long address, boolean isSync, long offset, long size) {
|
||||
MappedMemoryUtils.force(fd, address, isSync, offset, size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue