8254231: Implementation of Foreign Linker API (Incubator)

Reviewed-by: coleenp, ihse, dholmes, vlivanov
This commit is contained in:
Maurizio Cimadamore 2020-11-23 11:00:38 +00:00
parent 53f38353e0
commit 0fb31dbf3a
212 changed files with 67390 additions and 179 deletions

View file

@ -246,6 +246,29 @@ Java_jdk_internal_loader_NativeLibraries_findEntry0
return res;
}
/*
* Class: jdk_internal_loader_NativeLibraries
* Method: findEntryInProcess
* Signature: (Ljava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
Java_jdk_internal_loader_NativeLibraries_findEntryInProcess
(JNIEnv *env, jclass cls, jstring name)
{
const char *cname;
jlong res;
if (!initIDs(env))
return jlong_zero;
cname = (*env)->GetStringUTFChars(env, name, 0);
if (cname == 0)
return jlong_zero;
res = ptr_to_jlong(findEntryInProcess(cname));
(*env)->ReleaseStringUTFChars(env, name, cname);
return res;
}
/*
* Class: jdk_internal_loader_NativeLibraries
* Method: findBuiltinLib

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
@ -333,6 +333,8 @@ JNIEXPORT void InitializeEncoding(JNIEnv *env, const char *name);
void* getProcessHandle();
void* findEntryInProcess(const char* name);
void buildJniFunctionName(const char *sym, const char *cname,
char *jniEntryName);