Files
sdk/runtime/tests
Alexander Markov 071d50f679 [vm/compiler] Fix generation of Smi immediates when using compressed pointers
When compiler generates 32-bit instructions with immediate operand
(such as add/sub etc) it expects to find 32-bit immediate value.
In compressed pointers mode Smi occupies 32 bits with unspecified
upper bits. So getting a raw value of a Smi using

  static_cast<int64_t>(constant.ptr())

is not correct. For example it may yield 0xfffffffe instead of
0xfffffffffffffffe for -1 value.

This change fixes a few places in code generator to use Smi::RawValue
instead of doing a static_cast.

TEST=runtime/tests/vm/dart/regress_47704_test.dart
Fixes https://github.com/dart-lang/sdk/issues/47704

Change-Id: I1f649c5a22f221c7f4e69a884c88c265973be606
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220660
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-11-18 17:12:18 +00:00
..