8309468: Remove jvmti Allocate locker test case

Reviewed-by: dholmes, lmesnik, sspitsyn
This commit is contained in:
Leo Korinth 2023-06-13 12:31:20 +00:00
parent 05f896a153
commit c884862ad2
9 changed files with 3 additions and 260 deletions

View File

@ -94,11 +94,6 @@ MLVM_STRESS_INCLUDES := \
-I$(VM_TESTBASE_DIR)/nsk/share/native \
-I$(VM_TESTBASE_DIR)/nsk/share/jni
NSK_GC_LOCK_JVMTI_INCLUDES := \
-I$(VM_TESTBASE_DIR)/nsk/share/gc/lock/jvmti \
-I$(VM_TESTBASE_DIR)/nsk/share/native \
-I$(VM_TESTBASE_DIR)/nsk/share/jni
NSK_GC_LOCK_JNI_INCLUDES := \
-I$(VM_TESTBASE_DIR)/nsk/share/gc/lock/jni \
-I$(VM_TESTBASE_DIR)/nsk/share/native \
@ -172,8 +167,6 @@ BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libIndyRedefineClass := $(MLVM_JVMTI_INCLUD
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libnativeAndMH := $(MLVM_STRESS_INCLUDES)
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libJVMTIAllocLocker := $(NSK_GC_LOCK_JVMTI_INCLUDES)
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libBooleanArrayCriticalLocker := $(NSK_GC_LOCK_JNI_INCLUDES)
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libByteArrayCriticalLocker := $(NSK_GC_LOCK_JNI_INCLUDES)
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libCharArrayCriticalLocker := $(NSK_GC_LOCK_JNI_INCLUDES)

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2023, 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
@ -1491,8 +1491,7 @@ vmTestbase_vm_gc_quick = \
vmTestbase/gc/gctests/StringInternGC/StringInternGC.java \
vmTestbase/gc/gctests/ReferencesGC/ReferencesGC.java \
vmTestbase/gc/lock/jni/jnilock001/TestDescription.java \
vmTestbase/gc/lock/jniref/jnireflock01/TestDescription.java \
vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock01/TestDescription.java
vmTestbase/gc/lock/jniref/jnireflock01/TestDescription.java
vmTestbase_vm_compiler_quick = \
vmTestbase/vm/compiler/jbe/constprop/constprop01/constprop01.java \

View File

@ -1,23 +0,0 @@
#
# Copyright (c) 2017, 2018, 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
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
exclusiveAccess.dirs=.

View File

@ -1,38 +0,0 @@
/*
* Copyright (c) 2017, 2022, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @key stress randomness
*
* @summary converted from VM Testbase gc/lock/jvmti/alloc/jvmtialloclock01.
* VM Testbase keywords: [gc, stress, stressopt, jvmti, nonconcurrent]
*
* @library /vmTestbase
* /test/lib
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm/native -Xbootclasspath/a:. -Xlog:gc=debug:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -agentlib:JVMTIAllocLocker gc.lock.LockerTest -lockers jvmtiAlloc -t 1
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2023, 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
@ -25,7 +25,6 @@ package nsk.share.gc.lock;
import nsk.share.TestBug;
import nsk.share.gc.lock.jni.JNILockers;
import nsk.share.gc.lock.jvmti.JVMTIAllocLockers;
import nsk.share.gc.lock.jniref.*;
/**
@ -51,8 +50,6 @@ public class LockerUtils {
return new JNIRefLockers();
else if (id.equals("jniWeakGlobalRef"))
return new JNIWeakGlobalRefLockers();
else if (id.equals("jvmtiAlloc"))
return new JVMTIAllocLockers();
else
throw new TestBug("Invalid lockers id: " + id);
}

View File

@ -1,68 +0,0 @@
/*
* Copyright (c) 2007, 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <jni.h>
#include <jvmti.h>
#include <time.h>
#include <stdlib.h>
#include "jni_tools.h"
extern "C" {
static jvmtiEnv *jvmti = NULL;
static jvmtiCapabilities caps;
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_0);
if (res != JNI_OK || jvmti == NULL) {
printf("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
return JNI_OK;
}
/*
* Class: nsk_share_gc_lock_jvmti_JVMTIAllocLocker
* Method: jVMTIAllocSection
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jvmti_JVMTIAllocLocker_jVMTIAllocSection
(JNIEnv *env, jobject o, jlong enterTime, jlong sleepTime) {
unsigned char *ptr;
time_t current_time, old_time;
jvmtiError err;
old_time = time(NULL);
enterTime /= 1000;
current_time = 0;
while (current_time - old_time < enterTime) {
err = jvmti->Allocate(1, &ptr);
mssleep((long) sleepTime);
err = jvmti->Deallocate(ptr);
mssleep((long) sleepTime);
current_time = time(NULL);
}
}
}

View File

@ -1,58 +0,0 @@
/*
* Copyright (c) 2007, 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package nsk.share.gc.lock.jvmti;
import nsk.share.TestBug;
import nsk.share.gc.lock.Locker;
import nsk.share.gc.lock.CriticalSectionTimedLocker;
/**
* Malloc locker tries to hold malloc lock (if there is any)
* by calling malloc() and free() in a loop.
*/
public class JVMTIAllocLocker extends CriticalSectionTimedLocker {
static {
System.loadLibrary("JVMTIAllocLocker");
}
public JVMTIAllocLocker() {
}
public JVMTIAllocLocker(long enterTime, long sleepTime) {
super(enterTime, sleepTime);
setSleepTime(sleepTime);
}
/**
* This native method does Allocate() / Deallocate() in a loop
* while java field locked is set to true, sleeping
* for sleepTime between Allocate() and Deallocate() and after
* Deallocate().
*/
private native void jVMTIAllocSection(long enterTime, long sleepTime);
protected void criticalSection(long enterTime, long sleepTime) {
jVMTIAllocSection(enterTime, sleepTime);
}
}

View File

@ -1,33 +0,0 @@
/*
* Copyright (c) 2007, 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package nsk.share.gc.lock.jvmti;
import nsk.share.gc.lock.Lockers;
import nsk.share.gc.lock.Locker;
public class JVMTIAllocLockers implements Lockers {
public Locker createLocker(Object obj) {
return new JVMTIAllocLocker();
}
}

View File

@ -1,26 +0,0 @@
/*
* Copyright (c) 2017, 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "JVMTIAllocLocker.cpp"
#include "jni_tools.cpp"
#include "nsk_tools.cpp"