8215009: GCC 8 compilation error in libjli
Reviewed-by: dholmes, mikael, rriggs
This commit is contained in:
parent
7af48cfb45
commit
b818234d2a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2019, 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
|
||||
@ -717,10 +717,17 @@ void SplashFreeLibrary() {
|
||||
}
|
||||
|
||||
/*
|
||||
* Block current thread and continue execution in a new thread
|
||||
* Signature adapter for pthread_create().
|
||||
*/
|
||||
static void* ThreadJavaMain(void* args) {
|
||||
return (void*)(intptr_t)JavaMain(args);
|
||||
}
|
||||
|
||||
/*
|
||||
* Block current thread and continue execution in a new thread.
|
||||
*/
|
||||
int
|
||||
ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void * args) {
|
||||
CallJavaMainInNewThread(jlong stack_size, void* args) {
|
||||
int rslt;
|
||||
pthread_t tid;
|
||||
pthread_attr_t attr;
|
||||
@ -732,18 +739,18 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
|
||||
}
|
||||
pthread_attr_setguardsize(&attr, 0); // no pthread guard page on java threads
|
||||
|
||||
if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
|
||||
void * tmp;
|
||||
if (pthread_create(&tid, &attr, ThreadJavaMain, args) == 0) {
|
||||
void* tmp;
|
||||
pthread_join(tid, &tmp);
|
||||
rslt = (int)(intptr_t)tmp;
|
||||
} else {
|
||||
/*
|
||||
* Continue execution in current thread if for some reason (e.g. out of
|
||||
* memory/LWP) a new thread can't be created. This will likely fail
|
||||
* later in continuation as JNI_CreateJavaVM needs to create quite a
|
||||
* later in JavaMain as JNI_CreateJavaVM needs to create quite a
|
||||
* few new threads, anyway, just give it a try..
|
||||
*/
|
||||
rslt = continuation(args);
|
||||
rslt = JavaMain(args);
|
||||
}
|
||||
|
||||
pthread_attr_destroy(&attr);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2019, 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
|
||||
@ -388,8 +388,8 @@ JLI_Launch(int argc, char ** argv, /* main argc, argv */
|
||||
} while (JNI_FALSE)
|
||||
|
||||
|
||||
int JNICALL
|
||||
JavaMain(void * _args)
|
||||
int
|
||||
JavaMain(void* _args)
|
||||
{
|
||||
JavaMainArgs *args = (JavaMainArgs *)_args;
|
||||
int argc = args->argc;
|
||||
@ -2348,7 +2348,7 @@ ContinueInNewThread(InvocationFunctions* ifn, jlong threadStackSize,
|
||||
args.what = what;
|
||||
args.ifn = *ifn;
|
||||
|
||||
rslt = ContinueInNewThread0(JavaMain, threadStackSize, (void*)&args);
|
||||
rslt = CallJavaMainInNewThread(threadStackSize, (void*)&args);
|
||||
/* If the caller has deemed there is an error we
|
||||
* simply return that, otherwise we return the value of
|
||||
* the callee
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2019, 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
|
||||
@ -156,10 +156,9 @@ JLI_ReportExceptionDescription(JNIEnv * env);
|
||||
void PrintMachineDependentOptions();
|
||||
|
||||
/*
|
||||
* Block current thread and continue execution in new thread
|
||||
* Block current thread and continue execution in new thread.
|
||||
*/
|
||||
int ContinueInNewThread0(int (JNICALL *continuation)(void *),
|
||||
jlong stack_size, void * args);
|
||||
int CallJavaMainInNewThread(jlong stack_size, void* args);
|
||||
|
||||
/* sun.java.launcher.* platform properties. */
|
||||
void SetJavaLauncherPlatformProps(void);
|
||||
@ -224,7 +223,10 @@ jobjectArray CreateApplicationArgs(JNIEnv *env, char **strv, int argc);
|
||||
jobjectArray NewPlatformStringArray(JNIEnv *env, char **strv, int strc);
|
||||
jclass GetLauncherHelperClass(JNIEnv *env);
|
||||
|
||||
int JNICALL JavaMain(void * args); /* entry point */
|
||||
/*
|
||||
* Entry point.
|
||||
*/
|
||||
int JavaMain(void* args);
|
||||
|
||||
enum LaunchMode { // cf. sun.launcher.LauncherHelper
|
||||
LM_UNKNOWN = 0,
|
||||
|
@ -718,10 +718,17 @@ void SplashFreeLibrary() {
|
||||
}
|
||||
|
||||
/*
|
||||
* Block current thread and continue execution in a new thread
|
||||
* Signature adapter for pthread_create() or thr_create().
|
||||
*/
|
||||
static void* ThreadJavaMain(void* args) {
|
||||
return (void*)(intptr_t)JavaMain(args);
|
||||
}
|
||||
|
||||
/*
|
||||
* Block current thread and continue execution in a new thread.
|
||||
*/
|
||||
int
|
||||
ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void * args) {
|
||||
CallJavaMainInNewThread(jlong stack_size, void* args) {
|
||||
int rslt;
|
||||
#ifndef __solaris__
|
||||
pthread_t tid;
|
||||
@ -734,31 +741,31 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
|
||||
}
|
||||
pthread_attr_setguardsize(&attr, 0); // no pthread guard page on java threads
|
||||
|
||||
if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
|
||||
void * tmp;
|
||||
if (pthread_create(&tid, &attr, ThreadJavaMain, args) == 0) {
|
||||
void* tmp;
|
||||
pthread_join(tid, &tmp);
|
||||
rslt = (int)(intptr_t)tmp;
|
||||
} else {
|
||||
/*
|
||||
* Continue execution in current thread if for some reason (e.g. out of
|
||||
* memory/LWP) a new thread can't be created. This will likely fail
|
||||
* later in continuation as JNI_CreateJavaVM needs to create quite a
|
||||
* later in JavaMain as JNI_CreateJavaVM needs to create quite a
|
||||
* few new threads, anyway, just give it a try..
|
||||
*/
|
||||
rslt = continuation(args);
|
||||
rslt = JavaMain(args);
|
||||
}
|
||||
|
||||
pthread_attr_destroy(&attr);
|
||||
#else /* __solaris__ */
|
||||
thread_t tid;
|
||||
long flags = 0;
|
||||
if (thr_create(NULL, stack_size, (void *(*)(void *))continuation, args, flags, &tid) == 0) {
|
||||
void * tmp;
|
||||
if (thr_create(NULL, stack_size, ThreadJavaMain, args, flags, &tid) == 0) {
|
||||
void* tmp;
|
||||
thr_join(tid, NULL, &tmp);
|
||||
rslt = (int)(intptr_t)tmp;
|
||||
} else {
|
||||
/* See above. Continue in current thread if thr_create() failed */
|
||||
rslt = continuation(args);
|
||||
rslt = JavaMain(args);
|
||||
}
|
||||
#endif /* !__solaris__ */
|
||||
return rslt;
|
||||
|
@ -704,10 +704,17 @@ void SplashFreeLibrary() {
|
||||
}
|
||||
|
||||
/*
|
||||
* Block current thread and continue execution in a new thread
|
||||
* Signature adapter for _beginthreadex().
|
||||
*/
|
||||
static unsigned __stdcall ThreadJavaMain(void* args) {
|
||||
return (unsigned)JavaMain(args);
|
||||
}
|
||||
|
||||
/*
|
||||
* Block current thread and continue execution in a new thread.
|
||||
*/
|
||||
int
|
||||
ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void * args) {
|
||||
CallJavaMainInNewThread(jlong stack_size, void* args) {
|
||||
int rslt = 0;
|
||||
unsigned thread_id;
|
||||
|
||||
@ -724,7 +731,7 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
|
||||
HANDLE thread_handle =
|
||||
(HANDLE)_beginthreadex(NULL,
|
||||
(unsigned)stack_size,
|
||||
continuation,
|
||||
ThreadJavaMain,
|
||||
args,
|
||||
STACK_SIZE_PARAM_IS_A_RESERVATION,
|
||||
&thread_id);
|
||||
@ -732,7 +739,7 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
|
||||
thread_handle =
|
||||
(HANDLE)_beginthreadex(NULL,
|
||||
(unsigned)stack_size,
|
||||
continuation,
|
||||
ThreadJavaMain,
|
||||
args,
|
||||
0,
|
||||
&thread_id);
|
||||
@ -776,7 +783,7 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
|
||||
GetExitCodeThread(thread_handle, &rslt);
|
||||
CloseHandle(thread_handle);
|
||||
} else {
|
||||
rslt = continuation(args);
|
||||
rslt = JavaMain(args);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_AWT_PRELOAD
|
||||
|
Loading…
x
Reference in New Issue
Block a user