Skip to content

Commit

Permalink
8309692: Fix -Wconversion warnings in javaClasses
Browse files Browse the repository at this point in the history
Reviewed-by: fparain, matsaave
  • Loading branch information
coleenp committed Jun 9, 2023
1 parent 7d82479 commit beec734
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/hotspot/share/classfile/javaClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,16 +817,16 @@ static void initialize_static_primitive_field(fieldDescriptor* fd, Handle mirror
BasicType t = fd->field_type();
switch (t) {
case T_BYTE:
mirror()->byte_field_put(fd->offset(), fd->int_initial_value());
mirror()->byte_field_put(fd->offset(), checked_cast<jbyte>(fd->int_initial_value()));
break;
case T_BOOLEAN:
mirror()->bool_field_put(fd->offset(), fd->int_initial_value());
mirror()->bool_field_put(fd->offset(), checked_cast<jboolean>(fd->int_initial_value()));
break;
case T_CHAR:
mirror()->char_field_put(fd->offset(), fd->int_initial_value());
mirror()->char_field_put(fd->offset(), checked_cast<jchar>(fd->int_initial_value()));
break;
case T_SHORT:
mirror()->short_field_put(fd->offset(), fd->int_initial_value());
mirror()->short_field_put(fd->offset(), checked_cast<jshort>(fd->int_initial_value()));
break;
case T_INT:
mirror()->int_field_put(fd->offset(), fd->int_initial_value());
Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/share/classfile/javaClasses.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,15 +325,15 @@ inline bool java_lang_Module::is_instance(oop obj) {
inline int Backtrace::merge_bci_and_version(int bci, int version) {
// only store u2 for version, checking for overflow.
if (version > USHRT_MAX || version < 0) version = USHRT_MAX;
assert((jushort)bci == bci, "bci should be short");
return build_int_from_shorts(version, bci);
assert((u2)bci == bci, "bci should be short");
return build_int_from_shorts((u2)version, (u2)bci);
}

inline int Backtrace::merge_mid_and_cpref(int mid, int cpref) {
// only store u2 for mid and cpref, checking for overflow.
assert((jushort)mid == mid, "mid should be short");
assert((jushort)cpref == cpref, "cpref should be short");
return build_int_from_shorts(cpref, mid);
assert((u2)mid == mid, "mid should be short");
assert((u2)cpref == cpref, "cpref should be short");
return build_int_from_shorts((u2)cpref, (u2)mid);
}

inline int Backtrace::bci_at(unsigned int merged) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ const int ObjectAlignmentInBytes = 8;
"(0.0 means off)") \
range(0.0, (double)max_intx) \
\
product(intx, MaxJavaStackTraceDepth, 1024, \
product(int, MaxJavaStackTraceDepth, 1024, \
"The maximum number of lines in the stack trace for Java " \
"exceptions (0 means all)") \
range(0, max_jint/2) \
Expand Down

1 comment on commit beec734

@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.