Skip to content

Commit

Permalink
Revert "[vm] Add support for real unboxed floating point fields in AOT"
Browse files Browse the repository at this point in the history
This reverts commit 9eb531b.

Reason for revert: Bots are red. Some tests are failing.

https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-obfuscate-linux-release-x64/6039

https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-android-release-arm_x64/957

Original change's description:
> [vm] Add support for real unboxed floating point fields in AOT
> 
> Non-nullable floating point fields (double, Float32x4, Float64x2)
> are fully unboxed in their classes.
> 
> A bitmap for each class was added to the shared class table in order to keep
> track of the pointers of the classes. Since all classes in Flutter Gallery
> have less than 64 fields, the bitmap is represented by a 64 bit integer and
> fields whose offset is more than 64 words are not unboxed.
> 
> The instance sizes and field offsets might change between target and host
> in cross-compilation, since the number of words used to store unboxed fields
> may differ.
> 
> dart-aot Xeon
> 
>   SplayLatency               -4.62%
>   SplayHarderLatency         -4.17%
>   NavierStokes               -2.20%
>   Tracer                      8.72%
>   ParticleSystemPaint         2.90%
>   NBodySIMD                   8.35%
>   NBody                      25.59%
> 
> With hack TFA to make doubles in Rect/Offset/Size classes in flutter non-nullable:
> 
> flutter arm-v8:
> 
>   gallery total size: -1%
> 
>   matrix_utils_transform_rect_perspective   -16.70% (less is better)
>   matrix_utils_transform_rect_affine        -31.82% (less is better)
>   matrix_utils_transform_point_perspective  -24.90% (less is better)
>   matrix_utils_transform_point_affine)      -27.26% (less is better)
>   rrect_contains_bench                      -4.719% (less is better)
> 
> Change-Id: I9ae09c9c3167d99f9efd071a92937aa51093fd1d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131824
> Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Samir Jindel <sjindel@google.com>

TBR=kustermann@google.com,rmacnak@google.com,sjindel@google.com,victoragnez@google.com

Change-Id: Ic73858f6adb7f55c4129d4f46ff4731b378cb634
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134020
Reviewed-by: Zichang Guo <zichangguo@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
  • Loading branch information
zichangg authored and commit-bot@chromium.org committed Jan 30, 2020
1 parent d67fbe5 commit 162d6c5
Show file tree
Hide file tree
Showing 46 changed files with 535 additions and 3,632 deletions.

This file was deleted.

4 changes: 0 additions & 4 deletions runtime/platform/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,6 @@ typedef simd128_value_t fpu_register_t;
#define DUAL_MAPPING_SUPPORTED 1
#endif

#if defined(DART_PRECOMPILED_RUNTIME) || defined(DART_PRECOMPILER)
#define SUPPORT_UNBOXED_INSTANCE_FIELDS
#endif

// Short form printf format specifiers
#define Pd PRIdPTR
#define Pu PRIuPTR
Expand Down
14 changes: 4 additions & 10 deletions runtime/platform/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Utils {
}

template <typename T>
static constexpr inline T Maximum(T x, T y) {
static inline T Maximum(T x, T y) {
return x > y ? x : y;
}

Expand Down Expand Up @@ -352,18 +352,12 @@ class Utils {
return bit_cast<word>(mask);
}

template <typename T = uword>
static T Bit(uint32_t n) {
ASSERT(n < sizeof(T) * kBitsPerByte);
T bit = 1;
static uword Bit(uint32_t n) {
ASSERT(n < kBitsPerWord);
uword bit = 1;
return bit << n;
}

template <typename T>
DART_FORCE_INLINE static bool TestBit(T mask, intptr_t position) {
return ((mask >> position) & 1) != 0;
}

// Decode integer in SLEB128 format from |data| and update |byte_index|.
template <typename ValueType>
static ValueType DecodeSLEB128(const uint8_t* data,
Expand Down
59 changes: 0 additions & 59 deletions runtime/tests/vm/dart/unboxed_fields_type_args_test.dart

This file was deleted.

12 changes: 6 additions & 6 deletions runtime/vm/bootstrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ static void Finish(Thread* thread) {
// Verify that closure field offsets are identical in Dart and C++.
ASSERT(fields.Length() == 6);
field ^= fields.At(0);
ASSERT(field.HostOffset() == Closure::instantiator_type_arguments_offset());
ASSERT(field.Offset() == Closure::instantiator_type_arguments_offset());
field ^= fields.At(1);
ASSERT(field.HostOffset() == Closure::function_type_arguments_offset());
ASSERT(field.Offset() == Closure::function_type_arguments_offset());
field ^= fields.At(2);
ASSERT(field.HostOffset() == Closure::delayed_type_arguments_offset());
ASSERT(field.Offset() == Closure::delayed_type_arguments_offset());
field ^= fields.At(3);
ASSERT(field.HostOffset() == Closure::function_offset());
ASSERT(field.Offset() == Closure::function_offset());
field ^= fields.At(4);
ASSERT(field.HostOffset() == Closure::context_offset());
ASSERT(field.Offset() == Closure::context_offset());
field ^= fields.At(5);
ASSERT(field.HostOffset() == Closure::hash_offset());
ASSERT(field.Offset() == Closure::hash_offset());
#endif // defined(DEBUG)

// Eagerly compile Bool class, bool constants are used from within compiler.
Expand Down
30 changes: 15 additions & 15 deletions runtime/vm/class_finalizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,33 +240,33 @@ void ClassFinalizer::VerifyBootstrapClasses() {
#if defined(DEBUG)
// Basic checking.
cls = object_store->object_class();
ASSERT(Instance::InstanceSize() == cls.host_instance_size());
ASSERT(Instance::InstanceSize() == cls.instance_size());
cls = object_store->integer_implementation_class();
ASSERT(Integer::InstanceSize() == cls.host_instance_size());
ASSERT(Integer::InstanceSize() == cls.instance_size());
cls = object_store->smi_class();
ASSERT(Smi::InstanceSize() == cls.host_instance_size());
ASSERT(Smi::InstanceSize() == cls.instance_size());
cls = object_store->mint_class();
ASSERT(Mint::InstanceSize() == cls.host_instance_size());
ASSERT(Mint::InstanceSize() == cls.instance_size());
cls = object_store->one_byte_string_class();
ASSERT(OneByteString::InstanceSize() == cls.host_instance_size());
ASSERT(OneByteString::InstanceSize() == cls.instance_size());
cls = object_store->two_byte_string_class();
ASSERT(TwoByteString::InstanceSize() == cls.host_instance_size());
ASSERT(TwoByteString::InstanceSize() == cls.instance_size());
cls = object_store->external_one_byte_string_class();
ASSERT(ExternalOneByteString::InstanceSize() == cls.host_instance_size());
ASSERT(ExternalOneByteString::InstanceSize() == cls.instance_size());
cls = object_store->external_two_byte_string_class();
ASSERT(ExternalTwoByteString::InstanceSize() == cls.host_instance_size());
ASSERT(ExternalTwoByteString::InstanceSize() == cls.instance_size());
cls = object_store->double_class();
ASSERT(Double::InstanceSize() == cls.host_instance_size());
ASSERT(Double::InstanceSize() == cls.instance_size());
cls = object_store->bool_class();
ASSERT(Bool::InstanceSize() == cls.host_instance_size());
ASSERT(Bool::InstanceSize() == cls.instance_size());
cls = object_store->array_class();
ASSERT(Array::InstanceSize() == cls.host_instance_size());
ASSERT(Array::InstanceSize() == cls.instance_size());
cls = object_store->immutable_array_class();
ASSERT(ImmutableArray::InstanceSize() == cls.host_instance_size());
ASSERT(ImmutableArray::InstanceSize() == cls.instance_size());
cls = object_store->weak_property_class();
ASSERT(WeakProperty::InstanceSize() == cls.host_instance_size());
ASSERT(WeakProperty::InstanceSize() == cls.instance_size());
cls = object_store->linked_hash_map_class();
ASSERT(LinkedHashMap::InstanceSize() == cls.host_instance_size());
ASSERT(LinkedHashMap::InstanceSize() == cls.instance_size());
#endif // defined(DEBUG)

// Remember the currently pending classes.
Expand Down Expand Up @@ -1358,7 +1358,7 @@ void ClassFinalizer::VerifyImplicitFieldOffsets() {
fields_array ^= cls.fields();
ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields());
field ^= fields_array.At(0);
ASSERT(field.HostOffset() == ByteBuffer::data_offset());
ASSERT(field.Offset() == ByteBuffer::data_offset());
name ^= field.name();
expected_name ^= String::New("_data");
ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name));
Expand Down
Loading

0 comments on commit 162d6c5

Please sign in to comment.