From d3e9c62976780e830da79ae32be4192dee196db2 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Wed, 5 Aug 2020 12:20:28 +0100 Subject: ARM: Allow FP args in core regs for @CriticalNative. If a float or double argument needs to be passed in core register to a @CriticalNative method due to soft-float native ABI, insert a fake call to Float.floatToRawIntBits() or Double.doubleToRawLongBits() to satisfy type checks in the compiler. We cannot do that for intrinsics that expect those inputs in actual FP registers, so we still prevent such intrinsics from using `kCallCriticalNative`. This should be irrelevant if an actual intrinsic implementation is emitted. There are currently two unimplemented intrinsics that are affected by the carve-out, namely MathRoundDouble and FP16ToHalf, and four intrinsics implemented only when ARMv8A is supported, namely MathRint, MathRoundFloat, MathCeil and MathFloor. Test: testrunner.py --target --32 -t 178-app-image-native-method Bug: 112189621 Change-Id: Id14ef4f49f8a0e6489f97dc9588c0e6a5c122632 --- compiler/optimizing/nodes.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'compiler/optimizing/nodes.h') diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 63ba3c0d8f..55e579baf4 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -399,6 +399,7 @@ class HGraph : public ArenaObject { has_simd_(false), has_loops_(false), has_irreducible_loops_(false), + has_direct_critical_native_call_(false), dead_reference_safe_(dead_reference_safe), debuggable_(debuggable), current_instruction_id_(start_instruction_id), @@ -677,6 +678,9 @@ class HGraph : public ArenaObject { bool HasIrreducibleLoops() const { return has_irreducible_loops_; } void SetHasIrreducibleLoops(bool value) { has_irreducible_loops_ = value; } + bool HasDirectCriticalNativeCall() const { return has_direct_critical_native_call_; } + void SetHasDirectCriticalNativeCall(bool value) { has_direct_critical_native_call_ = value; } + ArtMethod* GetArtMethod() const { return art_method_; } void SetArtMethod(ArtMethod* method) { art_method_ = method; } @@ -788,6 +792,10 @@ class HGraph : public ArenaObject { // so there might be false positives. bool has_irreducible_loops_; + // Flag whether there are any direct calls to native code registered + // for @CriticalNative methods. + bool has_direct_critical_native_call_; + // Is the code known to be robust against eliminating dead references // and the effects of early finalization? If false, dead reference variables // are kept if they might be visible to the garbage collector. -- cgit v1.2.3-59-g8ed1b