Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
8248524: [JVMCI] Memory corruption / segfault during NumPy installation
- Loading branch information
Showing
with
2 additions
and
16 deletions.
-
+2
−15
src/hotspot/share/jvmci/jvmciEnv.cpp
-
+0
−1
src/hotspot/share/jvmci/jvmciEnv.hpp
|
@@ -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 @@ class JVMCIEnv : public ResourceObj { |
|
|
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())); |
|
|