jdk/src/java.base/share/native/libjli/java.h
author alanb
Thu, 17 Mar 2016 19:04:16 +0000
changeset 36511 9d0388c6b336
parent 33987 24ecd3c83f33
child 37359 4a3768da1851
permissions -rw-r--r--
8142968: Module System implementation Summary: Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282 Reviewed-by: alanb, mchung, naoto, rriggs, psandoz, plevart, mullan, ascarpino, vinnie, prr, sherman, dfuchs, mhaupt Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, chris.hegarty@oracle.com, alexandr.scherbatiy@oracle.com, amy.lu@oracle.com, calvin.cheung@oracle.com, daniel.fuchs@oracle.com, erik.joelsson@oracle.com, harold.seigel@oracle.com, jaroslav.bachorik@oracle.com, jean-francois.denise@oracle.com, jan.lahoda@oracle.com, james.laskey@oracle.com, lois.foltan@oracle.com, miroslav.kos@oracle.com, huaming.li@oracle.com, sean.mullan@oracle.com, naoto.sato@oracle.com, masayoshi.okutsu@oracle.com, peter.levart@gmail.com, philip.race@oracle.com, claes.redestad@oracle.com, sergey.bylokhov@oracle.com, alexandre.iline@oracle.com, volker.simonis@gmail.com, staffan.larsen@oracle.com, stuart.marks@oracle.com, semyon.sadetsky@oracle.com, serguei.spitsyn@oracle.com, sundararajan.athijegannathan@oracle.com, valerie.peng@oracle.com, vincent.x.ryan@oracle.com, weijun.wang@oracle.com, yuri.nesterenko@oracle.com, yekaterina.kantserova@oracle.com, alexander.kulyakhtin@oracle.com, felix.yang@oracle.com, andrei.eremeev@oracle.com, frank.yuan@oracle.com, sergei.pikalev@oracle.com, sibabrata.sahoo@oracle.com, tiantian.du@oracle.com, sha.jiang@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
28771
2885fb2e1002 8068033: JNI exception pending in jdk/src/share/bin/java.c
ksrini
parents: 27938
diff changeset
     2
 * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3834
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3834
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3834
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3834
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3834
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#ifndef _JAVA_H_
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#define _JAVA_H_
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include <stdio.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#include <stdlib.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#include <string.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include <limits.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#include <jni.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#include <jvm.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * Get system specific defines.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
#include "emessages.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#include "java_md.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#include "jli_util.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#include "manifest_info.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
#include "wildcard.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
#include "splashscreen.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
# define KB (1024UL)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
# define MB (1024UL * KB)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
# define GB (1024UL * MB)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
#define CURRENT_DATA_MODEL (CHAR_BIT * sizeof(void*))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * The following environment variable is used to influence the behavior
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * of the jre exec'd through the SelectVersion routine.  The command line
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * options which specify the version are not passed to the exec'd version,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * because that jre may be an older version which wouldn't recognize them.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * This environment variable is known to this (and later) version and serves
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * to suppress the version selection code.  This is not only for efficiency,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * but also for correctness, since any command line options have been
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * removed which would cause any value found in the manifest to be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * This would be incorrect because the command line options are defined
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * to take precedence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * The value associated with this environment variable is the MainClass
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * name from within the executable jar file (if any). This is strictly a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * performance enhancement to avoid re-reading the jar file manifest.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
#define ENV_ENTRY "_JAVA_VERSION_SET"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
#define SPLASH_FILE_ENV_ENTRY "_JAVA_SPLASH_FILE"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
#define SPLASH_JAR_ENV_ENTRY "_JAVA_SPLASH_JAR"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * Pointers to the needed JNI invocation API, initialized by LoadJavaVM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
typedef jint (JNICALL *CreateJavaVM_t)(JavaVM **pvm, void **env, void *args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
typedef jint (JNICALL *GetDefaultJavaVMInitArgs_t)(void *args);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
    80
typedef jint (JNICALL *GetCreatedJavaVMs_t)(JavaVM **vmBuf, jsize bufLen, jsize *nVMs);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
typedef struct {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    CreateJavaVM_t CreateJavaVM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    GetDefaultJavaVMInitArgs_t GetDefaultJavaVMInitArgs;
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
    85
    GetCreatedJavaVMs_t GetCreatedJavaVMs;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
} InvocationFunctions;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
JLI_Launch(int argc, char ** argv,              /* main argc, argc */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        int jargc, const char** jargv,          /* java args */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        int appclassc, const char** appclassv,  /* app classpath */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        const char* fullversion,                /* full version defined */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        const char* dotversion,                 /* dot version defined */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        const char* pname,                      /* program name */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        const char* lname,                      /* launcher name */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        jboolean javaargs,                      /* JAVA_ARGS */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        jboolean cpwildcard,                    /* classpath wildcard */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        jboolean javaw,                         /* windows-only javaw */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        jint     ergo_class                     /* ergnomics policy */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * Prototypes for launcher functions in the system specific java_md.c.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
GetXUsagePath(char *buf, jint bufsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
GetApplicationHome(char *buf, jint bufsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
#define GetArch() GetArchPath(CURRENT_DATA_MODEL)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
6005
f9e6c98d4ee3 6921472: RFE: java launcher code needs clean up
ksrini
parents: 5506
diff changeset
   117
/*
f9e6c98d4ee3 6921472: RFE: java launcher code needs clean up
ksrini
parents: 5506
diff changeset
   118
 * Different platforms will implement this, here
f9e6c98d4ee3 6921472: RFE: java launcher code needs clean up
ksrini
parents: 5506
diff changeset
   119
 * pargc is a pointer to the original argc,
f9e6c98d4ee3 6921472: RFE: java launcher code needs clean up
ksrini
parents: 5506
diff changeset
   120
 * pargv is a pointer to the original argv,
f9e6c98d4ee3 6921472: RFE: java launcher code needs clean up
ksrini
parents: 5506
diff changeset
   121
 * jrepath is an accessible path to the jre as determined by the call
f9e6c98d4ee3 6921472: RFE: java launcher code needs clean up
ksrini
parents: 5506
diff changeset
   122
 * so_jrepath is the length of the buffer jrepath
f9e6c98d4ee3 6921472: RFE: java launcher code needs clean up
ksrini
parents: 5506
diff changeset
   123
 * jvmpath is an accessible path to the jvm as determined by the call
f9e6c98d4ee3 6921472: RFE: java launcher code needs clean up
ksrini
parents: 5506
diff changeset
   124
 * so_jvmpath is the length of the buffer jvmpath
f9e6c98d4ee3 6921472: RFE: java launcher code needs clean up
ksrini
parents: 5506
diff changeset
   125
 */
f9e6c98d4ee3 6921472: RFE: java launcher code needs clean up
ksrini
parents: 5506
diff changeset
   126
void CreateExecutionEnvironment(int *argc, char ***argv,
f9e6c98d4ee3 6921472: RFE: java launcher code needs clean up
ksrini
parents: 5506
diff changeset
   127
                                char *jrepath, jint so_jrepath,
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   128
                                char *jvmpath, jint so_jvmpath,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   129
                                char *jvmcfg,  jint so_jvmcfg);
6005
f9e6c98d4ee3 6921472: RFE: java launcher code needs clean up
ksrini
parents: 5506
diff changeset
   130
1145
404b11752c57 6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents: 715
diff changeset
   131
/* Reports an error message to stderr or a window as appropriate. */
404b11752c57 6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents: 715
diff changeset
   132
void JLI_ReportErrorMessage(const char * message, ...);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
1145
404b11752c57 6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents: 715
diff changeset
   134
/* Reports a system error message to stderr or a window */
404b11752c57 6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents: 715
diff changeset
   135
void JLI_ReportErrorMessageSys(const char * message, ...);
404b11752c57 6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents: 715
diff changeset
   136
404b11752c57 6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents: 715
diff changeset
   137
/* Reports an error message only to stderr. */
404b11752c57 6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents: 715
diff changeset
   138
void JLI_ReportMessage(const char * message, ...);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
/*
1145
404b11752c57 6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents: 715
diff changeset
   141
 * Reports an exception which terminates the vm to stderr or a window
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 * as appropriate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 */
1145
404b11752c57 6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents: 715
diff changeset
   144
void JLI_ReportExceptionDescription(JNIEnv * env);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
void PrintMachineDependentOptions();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
 * Block current thread and continue execution in new thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
int ContinueInNewThread0(int (JNICALL *continuation)(void *),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                        jlong stack_size, void * args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
/* sun.java.launcher.* platform properties. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
void SetJavaLauncherPlatformProps(void);
7997
78536cac0841 6912013: Remove the temporary launcher fix to add modules in the bootclasspath
mchung
parents: 6005
diff changeset
   155
void SetJavaCommandLineProp(char* what, int argc, char** argv);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
void SetJavaLauncherProp(void);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 * Functions defined in java.c and used in java_md.c.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
 */
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   161
jint ReadKnownVMs(const char *jvmcfg, jboolean speculative);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
char *CheckJvmType(int *argc, char ***argv, jboolean speculative);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
void AddOption(char *str, void *info);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
enum ergo_policy {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
   DEFAULT_POLICY = 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
   NEVER_SERVER_CLASS,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
   ALWAYS_SERVER_CLASS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
const char* GetProgramName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
const char* GetFullVersion();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
jboolean IsJavaArgs();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
jboolean IsJavaw();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
jint GetErgoPolicy();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
jboolean ServerClassMachine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   179
int ContinueInNewThread(InvocationFunctions* ifn, jlong threadStackSize,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   180
                   int argc, char** argv,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   181
                   int mode, char *what, int ret);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   182
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   183
int JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   184
                   int argc, char** argv,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   185
                   int mode, char *what, int ret);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
39
560da37936db 6596475: (launcher) javaw should call InitCommonControls
ksrini
parents: 2
diff changeset
   187
/*
560da37936db 6596475: (launcher) javaw should call InitCommonControls
ksrini
parents: 2
diff changeset
   188
 * Initialize platform specific settings
560da37936db 6596475: (launcher) javaw should call InitCommonControls
ksrini
parents: 2
diff changeset
   189
 */
560da37936db 6596475: (launcher) javaw should call InitCommonControls
ksrini
parents: 2
diff changeset
   190
void InitLauncher(jboolean javaw);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
1323
e14a3b3536cd 6742159: (launcher) improve the java launching mechanism
ksrini
parents: 1145
diff changeset
   192
/*
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   193
 * For MacOSX and Windows/Unix compatibility we require these
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   194
 * entry points, some of them may be stubbed out on Windows/Unixes.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   195
 */
30467
075f4f160f19 8076264: [macosx] Launching app on MacOSX requires enclosing class
serb
parents: 29742
diff changeset
   196
void     PostJVMInit(JNIEnv *env, jclass mainClass, JavaVM *vm);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   197
void     ShowSplashScreen();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   198
void     RegisterThread();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   199
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   200
 * this method performs additional platform specific processing and
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   201
 * should return JNI_TRUE to indicate the argument has been consumed,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   202
 * otherwise returns JNI_FALSE to allow the calling logic to further
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   203
 * process the option.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   204
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   205
jboolean ProcessPlatformOption(const char *arg);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   206
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   207
/*
1323
e14a3b3536cd 6742159: (launcher) improve the java launching mechanism
ksrini
parents: 1145
diff changeset
   208
 * This allows for finding classes from the VM's bootstrap class loader directly,
e14a3b3536cd 6742159: (launcher) improve the java launching mechanism
ksrini
parents: 1145
diff changeset
   209
 * FindClass uses the application class loader internally, this will cause
e14a3b3536cd 6742159: (launcher) improve the java launching mechanism
ksrini
parents: 1145
diff changeset
   210
 * unnecessary searching of the classpath for the required classes.
e14a3b3536cd 6742159: (launcher) improve the java launching mechanism
ksrini
parents: 1145
diff changeset
   211
 *
e14a3b3536cd 6742159: (launcher) improve the java launching mechanism
ksrini
parents: 1145
diff changeset
   212
 */
e14a3b3536cd 6742159: (launcher) improve the java launching mechanism
ksrini
parents: 1145
diff changeset
   213
typedef jclass (JNICALL FindClassFromBootLoader_t(JNIEnv *env,
3834
16342ebd576d 6864028: Update the java launcher to use the new entry point JVM_FindClassFromBootLoader
mchung
parents: 1331
diff changeset
   214
                                                  const char *name));
1323
e14a3b3536cd 6742159: (launcher) improve the java launching mechanism
ksrini
parents: 1145
diff changeset
   215
jclass FindBootStrapClass(JNIEnv *env, const char *classname);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   216
13411
224a28370893 7146424: Wildcard expansion for single entry classpath
ksrini
parents: 12047
diff changeset
   217
jobjectArray CreateApplicationArgs(JNIEnv *env, char **strv, int argc);
224a28370893 7146424: Wildcard expansion for single entry classpath
ksrini
parents: 12047
diff changeset
   218
jobjectArray NewPlatformStringArray(JNIEnv *env, char **strv, int strc);
224a28370893 7146424: Wildcard expansion for single entry classpath
ksrini
parents: 12047
diff changeset
   219
jclass GetLauncherHelperClass(JNIEnv *env);
224a28370893 7146424: Wildcard expansion for single entry classpath
ksrini
parents: 12047
diff changeset
   220
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   221
int JNICALL JavaMain(void * args); /* entry point                  */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   222
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   223
enum LaunchMode {               // cf. sun.launcher.LauncherHelper
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   224
    LM_UNKNOWN = 0,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   225
    LM_CLASS,
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 33987
diff changeset
   226
    LM_JAR,
9d0388c6b336 8142968: Module System implementation
alanb
parents: 33987
diff changeset
   227
    LM_MODULE
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   228
};
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   229
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   230
static const char *launchModeNames[]
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   231
    = { "Unknown", "Main class", "JAR file" };
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   232
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   233
typedef struct {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   234
    int    argc;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   235
    char **argv;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   236
    int    mode;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   237
    char  *what;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   238
    InvocationFunctions ifn;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   239
} JavaMainArgs;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   240
17445
6c4e2d6b953b 8013736: [launcher] cleanup code for correctness
ksrini
parents: 13411
diff changeset
   241
#define NULL_CHECK_RETURN_VALUE(NCRV_check_pointer, NCRV_return_value) \
6c4e2d6b953b 8013736: [launcher] cleanup code for correctness
ksrini
parents: 13411
diff changeset
   242
    do { \
6c4e2d6b953b 8013736: [launcher] cleanup code for correctness
ksrini
parents: 13411
diff changeset
   243
        if ((NCRV_check_pointer) == NULL) { \
6c4e2d6b953b 8013736: [launcher] cleanup code for correctness
ksrini
parents: 13411
diff changeset
   244
            JLI_ReportErrorMessage(JNI_ERROR); \
6c4e2d6b953b 8013736: [launcher] cleanup code for correctness
ksrini
parents: 13411
diff changeset
   245
            return NCRV_return_value; \
6c4e2d6b953b 8013736: [launcher] cleanup code for correctness
ksrini
parents: 13411
diff changeset
   246
        } \
6c4e2d6b953b 8013736: [launcher] cleanup code for correctness
ksrini
parents: 13411
diff changeset
   247
    } while (JNI_FALSE)
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   248
17445
6c4e2d6b953b 8013736: [launcher] cleanup code for correctness
ksrini
parents: 13411
diff changeset
   249
#define NULL_CHECK0(NC0_check_pointer) \
6c4e2d6b953b 8013736: [launcher] cleanup code for correctness
ksrini
parents: 13411
diff changeset
   250
    NULL_CHECK_RETURN_VALUE(NC0_check_pointer, 0)
6c4e2d6b953b 8013736: [launcher] cleanup code for correctness
ksrini
parents: 13411
diff changeset
   251
6c4e2d6b953b 8013736: [launcher] cleanup code for correctness
ksrini
parents: 13411
diff changeset
   252
#define NULL_CHECK(NC_check_pointer) \
6c4e2d6b953b 8013736: [launcher] cleanup code for correctness
ksrini
parents: 13411
diff changeset
   253
    NULL_CHECK_RETURN_VALUE(NC_check_pointer, )
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
   254
28771
2885fb2e1002 8068033: JNI exception pending in jdk/src/share/bin/java.c
ksrini
parents: 27938
diff changeset
   255
#define CHECK_EXCEPTION_RETURN() \
2885fb2e1002 8068033: JNI exception pending in jdk/src/share/bin/java.c
ksrini
parents: 27938
diff changeset
   256
    do { \
2885fb2e1002 8068033: JNI exception pending in jdk/src/share/bin/java.c
ksrini
parents: 27938
diff changeset
   257
        if ((*env)->ExceptionOccurred(env)) { \
2885fb2e1002 8068033: JNI exception pending in jdk/src/share/bin/java.c
ksrini
parents: 27938
diff changeset
   258
            return; \
2885fb2e1002 8068033: JNI exception pending in jdk/src/share/bin/java.c
ksrini
parents: 27938
diff changeset
   259
        } \
2885fb2e1002 8068033: JNI exception pending in jdk/src/share/bin/java.c
ksrini
parents: 27938
diff changeset
   260
    } while (JNI_FALSE)
2885fb2e1002 8068033: JNI exception pending in jdk/src/share/bin/java.c
ksrini
parents: 27938
diff changeset
   261
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
#endif /* _JAVA_H_ */