diff --git a/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp b/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp index 4e2493fc251..777c4ced8a3 100644 --- a/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp +++ b/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp @@ -299,6 +299,24 @@ void JfrJavaSupport::set_array_element(jobjectArray arr, jobject element, int in /* * Field access */ +static void write_bool_field(const Handle& h_oop, fieldDescriptor* fd, jboolean value) { + assert(h_oop.not_null(), "invariant"); + assert(fd != nullptr, "invariant"); + h_oop->bool_field_put(fd->offset(), value); +} + +static void write_char_field(const Handle& h_oop, fieldDescriptor* fd, jchar value) { + assert(h_oop.not_null(), "invariant"); + assert(fd != nullptr, "invariant"); + h_oop->char_field_put(fd->offset(), value); +} + +static void write_short_field(const Handle& h_oop, fieldDescriptor* fd, jshort value) { + assert(h_oop.not_null(), "invariant"); + assert(fd != nullptr, "invariant"); + h_oop->short_field_put(fd->offset(), value); +} + static void write_int_field(const Handle& h_oop, fieldDescriptor* fd, jint value) { assert(h_oop.not_null(), "invariant"); assert(fd != nullptr, "invariant"); @@ -341,8 +359,14 @@ static void write_specialized_field(JfrJavaArguments* args, const Handle& h_oop, switch(fd->field_type()) { case T_BOOLEAN: + write_bool_field(h_oop, fd, args->param(1).get_jboolean()); + break; case T_CHAR: + write_char_field(h_oop, fd, args->param(1).get_jchar()); + break; case T_SHORT: + write_short_field(h_oop, fd, args->param(1).get_jshort()); + break; case T_INT: write_int_field(h_oop, fd, args->param(1).get_jint()); break; @@ -374,8 +398,14 @@ static void read_specialized_field(JavaValue* result, const Handle& h_oop, field switch(fd->field_type()) { case T_BOOLEAN: + result->set_jint(h_oop->bool_field(fd->offset())); + break; case T_CHAR: + result->set_jint(h_oop->char_field(fd->offset())); + break; case T_SHORT: + result->set_jint(h_oop->short_field(fd->offset())); + break; case T_INT: result->set_jint(h_oop->int_field(fd->offset())); break;