test/hotspot/jtreg/gc/stress/gclocker/libTestGCLocker.c
author jiangli
Fri, 02 Nov 2018 19:30:31 -0400
changeset 52397 1322829d1501
parent 47216 71c04702a3d5
child 53523 4c5184c56dc2
permissions -rw-r--r--
8209564: runtime/appcds/CDSandJFR.java timeout on tier6 on sparc Summary: Set timeout 500 in CDSandJFR.java Reviewed-by: dcubed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46397
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
     1
/*
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
     4
 *
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
     8
 *
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    13
 * accompanied this code).
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    14
 *
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    18
 *
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    21
 * questions.
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    22
 */
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    23
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    24
#include <jni.h>
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    25
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    26
JNIEXPORT void JNICALL
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    27
Java_GCLockerStresser_fillWithRandomValues(JNIEnv* env, jclass clz, jbyteArray arr) {
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    28
  jsize size = (*env)->GetArrayLength(env, arr);
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    29
  jbyte* p = (*env)->GetPrimitiveArrayCritical(env, arr, NULL);
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    30
  jsize i;
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    31
  for (i = 0; i < size; i++) {
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    32
    p[i] = i % 128;
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    33
  }
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    34
  (*env)->ReleasePrimitiveArrayCritical(env, arr, p, 0);
2dd13ff72976 8177968: Add GC stress test TestGCLocker
ehelin
parents:
diff changeset
    35
}