< prev index next >

test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c

Print this page

        

*** 31,40 **** --- 31,41 ---- * It's OK - don't file a bug. */ #include <assert.h> #include <jni.h> + #include <jvm.h> #include <alloca.h> #include <signal.h> #include <string.h> #include <sys/mman.h> #include <stdlib.h>
*** 89,98 **** --- 90,113 ---- fprintf(stderr, "Test ERROR. Can't set sigaction (%d)\n", errno); exit(7); } } + int get_java_stacksize () { + size_t stacksize; + pthread_attr_t attr; + JDK1_1InitArgs jdk_args; + + jdk_args.version = JNI_VERSION_1_1; + JNI_GetDefaultJavaVMInitArgs(&jdk_args); + if (jdk_args.javaStackSize <= 0) { + fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n"); + exit(7); + } + return jdk_args.javaStackSize; + } + void *run_java_overflow (void *p) { JNIEnv *env; jclass class_id; jmethodID method_id; int res;
*** 252,268 **** if (JNI_CreateJavaVM (&_jvm, (void **)&env, &vm_args) < 0 ) { fprintf(stderr, "Test ERROR. Can't create JavaVM\n"); exit(7); } pthread_t thr; if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) { printf("\nTesting JAVA_OVERFLOW\n"); printf("Testing stack guard page behaviour for other thread\n"); ! pthread_create (&thr, NULL, run_java_overflow, NULL); pthread_join (thr, NULL); printf("Testing stack guard page behaviour for initial thread\n"); run_java_overflow(NULL); // This test crash on error --- 267,289 ---- if (JNI_CreateJavaVM (&_jvm, (void **)&env, &vm_args) < 0 ) { fprintf(stderr, "Test ERROR. Can't create JavaVM\n"); exit(7); } + int stack_size = get_java_stacksize(); pthread_t thr; + pthread_attr_t thread_attr; + + pthread_attr_init(&thread_attr); + pthread_attr_setstacksize(&thread_attr, stack_size); if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) { printf("\nTesting JAVA_OVERFLOW\n"); printf("Testing stack guard page behaviour for other thread\n"); ! ! pthread_create (&thr, &thread_attr, run_java_overflow, NULL); pthread_join (thr, NULL); printf("Testing stack guard page behaviour for initial thread\n"); run_java_overflow(NULL); // This test crash on error
*** 271,281 **** if (argc > 1 && strcmp(argv[1], "test_native_overflow") == 0) { printf("\nTesting NATIVE_OVERFLOW\n"); printf("Testing stack guard page behaviour for other thread\n"); ! pthread_create (&thr, NULL, run_native_overflow, NULL); pthread_join (thr, NULL); printf("Testing stack guard page behaviour for initial thread\n"); run_native_overflow(NULL); --- 292,302 ---- if (argc > 1 && strcmp(argv[1], "test_native_overflow") == 0) { printf("\nTesting NATIVE_OVERFLOW\n"); printf("Testing stack guard page behaviour for other thread\n"); ! pthread_create (&thr, &thread_attr, run_native_overflow, NULL); pthread_join (thr, NULL); printf("Testing stack guard page behaviour for initial thread\n"); run_native_overflow(NULL);
< prev index next >