8248524: [JVMCI] Memory corruption / segfault during NumPy installation
Reviewed-by: kvn
This commit is contained in:
parent
e07ad838b5
commit
8cfc7e39df
@ -621,26 +621,13 @@ const char* JVMCIEnv::as_utf8_string(JVMCIObject str) {
|
||||
} else {
|
||||
JNIAccessMark jni(this);
|
||||
int length = jni()->GetStringLength(str.as_jstring());
|
||||
char* result = NEW_RESOURCE_ARRAY(char, length + 1);
|
||||
int utf8_length = jni()->GetStringUTFLength(str.as_jstring());
|
||||
char* result = NEW_RESOURCE_ARRAY(char, utf8_length + 1);
|
||||
jni()->GetStringUTFRegion(str.as_jstring(), 0, length, result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
char* JVMCIEnv::as_utf8_string(JVMCIObject str, char* buf, int buflen) {
|
||||
if (is_hotspot()) {
|
||||
return java_lang_String::as_utf8_string(HotSpotJVMCI::resolve(str), buf, buflen);
|
||||
} else {
|
||||
JNIAccessMark jni(this);
|
||||
int length = jni()->GetStringLength(str.as_jstring());
|
||||
if (length >= buflen) {
|
||||
length = buflen;
|
||||
}
|
||||
jni()->GetStringUTFRegion(str.as_jstring(), 0, length, buf);
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
#define DO_THROW(name) \
|
||||
void JVMCIEnv::throw_##name(const char* msg) { \
|
||||
if (is_hotspot()) { \
|
||||
|
@ -261,7 +261,6 @@ public:
|
||||
JVMCIObject create_box(BasicType type, jvalue* value, JVMCI_TRAPS);
|
||||
|
||||
const char* as_utf8_string(JVMCIObject str);
|
||||
char* as_utf8_string(JVMCIObject str, char* buf, int buflen);
|
||||
|
||||
JVMCIObject create_string(Symbol* str, JVMCI_TRAPS) {
|
||||
JVMCIObject s = create_string(str->as_C_string(), JVMCI_CHECK_(JVMCIObject()));
|
||||
|
Loading…
Reference in New Issue
Block a user