On Sat, 27 Apr 2024 00:02:16 GMT, Dean Long <dl...@openjdk.org> wrote:

>> src/hotspot/share/code/nmethod.cpp line 117:
>> 
>>> 115:   result = static_cast<T>(thing); \
>>> 116:   assert(static_cast<int>(result) == thing, "failed: %d != %d", 
>>> static_cast<int>(result), thing);
>>> 117: 
>> 
>> I replaced `checked_cast<>()` with this macro because of next issues:
>>  - The existing assert points to `utilities/checkedCast.hpp` file where this 
>> method is located and not where failed cast. It does not help when it is 
>> used several times in one method (for example, in `nmethod()` constructors).
>>  - The existing assert does not print values
>
> I thought @kimbarrett had a draft PR to address the error reporting issue, 
> but I can't seem to find it.  To solve the general problem, I think we need a 
> version of vmassert() that takes `char* file, int lineno` as arguments, and a 
> macro wrapper for checked_cast() that passes `__FILE__` and `__LINEN__` from 
> the caller.

Yes, it would be perfect separate RFE.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18984#discussion_r1581641784

Reply via email to