RFR: 8207025: JvmtiEnv::SetSystemProperty() does not handle OOM [v2]

Serguei Spitsyn sspitsyn at openjdk.java.net
Mon Mar 28 23:38:51 UTC 2022


On Mon, 28 Mar 2022 22:06:12 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   @dholmes-ora comments: changed implementation to work with JvmtiEnv::SetSystemProperty
>
> src/hotspot/share/prims/jvmtiEnv.cpp line 3431:
> 
>> 3429: jvmtiError
>> 3430: JvmtiEnv::SetSystemProperty(const char* property, const char* value_ptr) {
>> 3431:   NULL_CHECK(property, JVMTI_ERROR_NULL_POINTER);
> 
> You don't need this. The null check happens in the wrapper code generated from the xml file. See  build/<config>/hotspot/variant-server/gensrc/jvmtifiles/jvmtiEnterTrace.cpp

I agree with David here that this change is not needed.
This is a relevant fragment from the jvmtiEnter.cpp:

static jvmtiError JNICALL
jvmti_SetSystemProperty(jvmtiEnv* env,
            const char* property,
            const char* value_ptr) {
  . . .
  if (Threads::number_of_threads() != 0) {
    . . .
    if (property == NULL) {
      return JVMTI_ERROR_NULL_POINTER;
    }
    err = jvmti_env->SetSystemProperty(property, value_ptr);
  } else {
    if (property == NULL) {
      return JVMTI_ERROR_NULL_POINTER;
    }
    err = jvmti_env->SetSystemProperty(property, value_ptr);
  }
  return err;

-------------

PR: https://git.openjdk.java.net/jdk/pull/7981


More information about the serviceability-dev mailing list