Top


定義場所(file name)

jdk/src/share/bin/java.c

名前(function name)

static int
ContinueInNewThread(InvocationFunctions* ifn, int argc, char **argv,
                    int mode, char *what, int ret)
{

本体部(body)

  {- -------------------------------------------
  (1) もし threadStackSize が指定されていなければ, JNI_GetDefaultJavaVMInitArgs() でデフォルトのスタックサイズを取得する.
      (JNI_GetDefaultJavaVMInitArgs() は, JNI_VERSION_1_1 が指定されると(なぜか?)デフォルトのスタックサイズを返してくれる.
       See: JNI_GetDefaultJavaVMInitArgs())
      ---------------------------------------- -}

        /*
         * If user doesn't specify stack size, check if VM has a preference.
         * Note that HotSpot no longer supports JNI_VERSION_1_1 but it will
         * return its default stack size through the init args structure.
         */
        if (threadStackSize == 0) {
          struct JDK1_1InitArgs args1_1;
          memset((void*)&args1_1, 0, sizeof(args1_1));
          args1_1.version = JNI_VERSION_1_1;
          ifn->GetDefaultJavaVMInitArgs(&args1_1);  /* ignore return value */
          if (args1_1.javaStackSize > 0) {
             threadStackSize = args1_1.javaStackSize;
          }
        }

  {- -------------------------------------------
  (1) ContinueInNewThread0() を呼んで Java プログラムの実行を行う.
      ---------------------------------------- -}

        { /* Create a new thread to create JVM and invoke main method */
          JavaMainArgs args;
          int rslt;

          args.argc = argc;
          args.argv = argv;
          args.mode = mode;
          args.what = what;
          args.ifn = *ifn;

          rslt = ContinueInNewThread0(JavaMain, threadStackSize, (void*)&args);

  {- -------------------------------------------
  (1) リターン.
        (もし caller から渡された ret 引数が 0 でなければそれを返す.
         0 であれば ContinueInNewThread0 の返値を返す.)
      ---------------------------------------- -}

          /* If the caller has deemed there is an error we
           * simply return that, otherwise we return the value of
           * the callee
           */
          return (ret != 0) ? ret : rslt;
        }
    }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.