Skip to content

Commit

Permalink
8295697: Resolve conflicts between serviceability/jvmti and nsk/jvmti…
Browse files Browse the repository at this point in the history
… shared code

Reviewed-by: lmesnik, sspitsyn, cjplummer
  • Loading branch information
Alex Menkov committed Oct 20, 2022
1 parent 1164258 commit 6240431
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 425 deletions.
54 changes: 1 addition & 53 deletions test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
Expand Down Expand Up @@ -43,9 +43,6 @@
#include "nsk_tools.h"
#include "jni_tools.h"

/*************************************************************/

extern "C" {

/*************************************************************/

Expand Down Expand Up @@ -101,54 +98,6 @@ int nsk_jni_lverify_void(JNIEnv* jni, const char file[], int line,
return !failure;
}

char *jlong_to_string(jlong value, char *string) {
char buffer[32];
char *pbuf, *pstr;

pstr = string;
if (value == 0) {
*pstr++ = '0';
} else {
if (value < 0) {
*pstr++ = '-';
value = -value;
}
pbuf = buffer;
while (value != 0) {
*pbuf++ = '0' + (char)(value % 10);
value = value / 10;
}
while (pbuf != buffer) {
*pstr++ = *--pbuf;
}
}
*pstr = '\0';

return string;
}

char *julong_to_string(julong value, char *string) {
char buffer[32];
char *pbuf, *pstr;

pstr = string;
if (value == 0) {
*pstr++ = '0';
} else {
pbuf = buffer;
while (value != 0) {
*pbuf++ = '0' + (char)(value % 10);
value = value / 10;
}
while (pbuf != buffer) {
*pstr++ = *--pbuf;
}
}
*pstr = '\0';

return string;
}

void mssleep(long millis) {
#if (defined(WIN32) || defined(_WIN32))
Sleep(millis);
Expand Down Expand Up @@ -197,4 +146,3 @@ jni_create_vmoptions(int size, char *args[], int argsCnt)

/*************************************************************/

}
38 changes: 3 additions & 35 deletions test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
Expand Down Expand Up @@ -34,6 +34,8 @@

/*************************************************************/

#include "jvmti_common.h"

/* printf format specifier for jlong */
#ifdef _WIN32

Expand All @@ -52,16 +54,6 @@

#endif // !_WIN32

/**
* Additional Java basic types
*/

#ifdef _WIN32
typedef unsigned __int64 julong;
#else
typedef unsigned long long julong;
#endif

/*************************************************************/

/**
Expand Down Expand Up @@ -94,10 +86,6 @@

/*************************************************************/

extern "C" {

/*************************************************************/

/**
* If positive, assert status is true; or
* if !positive, assert status is not true.
Expand Down Expand Up @@ -127,22 +115,6 @@ int nsk_jni_lverify_void(JNIEnv* jni, const char file[], int line,
*/
int nsk_jni_check_exception(JNIEnv* jni, const char file[], int line);

/**
* Convert the digits of the given value argument to a null-terminated
* character string and store the result (up to 32 bytes) in string.
* If value is negative, the first character of the stored string is
* the minus sign (-). The function returns a pointer to the begining
* of the result string.
*/
char *jlong_to_string(jlong value, char *string);

/**
* Convert the digits of the given value argument to a null-terminated
* character string and store the result (up to 32 bytes) in string.
* The function returns a pointer to the begining of the result string.
*/
char *julong_to_string(julong value, char *string);

/**
* Sleep for given number of milliseconds.
*/
Expand All @@ -163,8 +135,4 @@ void jni_print_vmargs(JavaVMInitArgs vmargs);

/*************************************************************/

}

/*************************************************************/

#endif

1 comment on commit 6240431

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.