178f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee/*
278f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee * Copyright (C) 2017 The Android Open Source Project
378f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee *
478f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee * Licensed under the Apache License, Version 2.0 (the "License");
578f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee * you may not use this file except in compliance with the License.
678f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee * You may obtain a copy of the License at
778f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee *
878f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee *      http://www.apache.org/licenses/LICENSE-2.0
978f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee *
1078f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee * Unless required by applicable law or agreed to in writing, software
1178f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee * distributed under the License is distributed on an "AS IS" BASIS,
1278f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1378f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee * See the License for the specific language governing permissions and
1478f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee * limitations under the License.
1578f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee */
1678f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee
1778f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee#include "interpreter/interpreter_intrinsics.h"
1878f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee
199e734c7ab4599d7747a05db0dc73c7b668cb6683David Sehr#include "dex/dex_instruction.h"
2026ef34c01ae5db2d3c964844b3717b8974a612c9Orion Hodson#include "intrinsics_enum.h"
21d9911eeca13f609c885e0f6a5ce81af9b6340bfaAndreas Gampe#include "interpreter/interpreter_common.h"
22d9911eeca13f609c885e0f6a5ce81af9b6340bfaAndreas Gampe
2378f1bdc6bbf0ac07a333ada2396987e8391eee49buzbeenamespace art {
2478f1bdc6bbf0ac07a333ada2396987e8391eee49buzbeenamespace interpreter {
2578f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee
2631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
2731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee#define BINARY_INTRINSIC(name, op, get1, get2, set)                 \
2831afbec96e9f9c8e58778694e74aea7ce55e1378buzbeestatic ALWAYS_INLINE bool name(ShadowFrame* shadow_frame,           \
2931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee                               const Instruction* inst,             \
3031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee                               uint16_t inst_data,                  \
3131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee                               JValue* result_register)             \
3231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    REQUIRES_SHARED(Locks::mutator_lock_) {                         \
3331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee  uint32_t arg[Instruction::kMaxVarArgRegs] = {};                   \
3431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee  inst->GetVarArgs(arg, inst_data);                                 \
3531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee  result_register->set(op(shadow_frame->get1, shadow_frame->get2)); \
3631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee  return true;                                                      \
3778f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee}
3878f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee
3931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee#define BINARY_II_INTRINSIC(name, op, set) \
4031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    BINARY_INTRINSIC(name, op, GetVReg(arg[0]), GetVReg(arg[1]), set)
4131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
4231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee#define BINARY_JJ_INTRINSIC(name, op, set) \
4331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    BINARY_INTRINSIC(name, op, GetVRegLong(arg[0]), GetVRegLong(arg[2]), set)
4431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
4531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee#define BINARY_JI_INTRINSIC(name, op, set) \
4631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    BINARY_INTRINSIC(name, op, GetVRegLong(arg[0]), GetVReg(arg[2]), set)
4731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
4831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee#define UNARY_INTRINSIC(name, op, get, set)                  \
4978f1bdc6bbf0ac07a333ada2396987e8391eee49buzbeestatic ALWAYS_INLINE bool name(ShadowFrame* shadow_frame,    \
5078f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee                               const Instruction* inst,      \
5178f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee                               uint16_t inst_data,           \
5278f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee                               JValue* result_register)      \
5378f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee    REQUIRES_SHARED(Locks::mutator_lock_) {                  \
5478f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee  uint32_t arg[Instruction::kMaxVarArgRegs] = {};            \
5578f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee  inst->GetVarArgs(arg, inst_data);                          \
5678f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee  result_register->set(op(shadow_frame->get(arg[0])));       \
5778f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee  return true;                                               \
5878f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee}
5978f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee
6031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
6131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Integer.reverse(I)I
6231afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpIntegerReverse, ReverseBits32, GetVReg, SetI);
6331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
6431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Integer.reverseBytes(I)I
6531afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpIntegerReverseBytes, BSWAP, GetVReg, SetI);
6631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
6731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Integer.bitCount(I)I
6831afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpIntegerBitCount, POPCOUNT, GetVReg, SetI);
6931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
7031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Integer.compare(II)I
7131afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeBINARY_II_INTRINSIC(MterpIntegerCompare, Compare, SetI);
7231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
7331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Integer.highestOneBit(I)I
7431afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpIntegerHighestOneBit, HighestOneBitValue, GetVReg, SetI);
7531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
7631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Integer.LowestOneBit(I)I
7731afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpIntegerLowestOneBit, LowestOneBitValue, GetVReg, SetI);
7831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
7931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Integer.numberOfLeadingZeros(I)I
8031afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpIntegerNumberOfLeadingZeros, JAVASTYLE_CLZ, GetVReg, SetI);
8131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
8231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Integer.numberOfTrailingZeros(I)I
8331afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpIntegerNumberOfTrailingZeros, JAVASTYLE_CTZ, GetVReg, SetI);
8431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
8531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Integer.rotateRight(II)I
8631afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeBINARY_II_INTRINSIC(MterpIntegerRotateRight, (Rot<int32_t, false>), SetI);
8731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
8831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Integer.rotateLeft(II)I
8931afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeBINARY_II_INTRINSIC(MterpIntegerRotateLeft, (Rot<int32_t, true>), SetI);
9031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
9131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Integer.signum(I)I
9231afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpIntegerSignum, Signum, GetVReg, SetI);
9331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
9431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Long.reverse(I)I
9531afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpLongReverse, ReverseBits64, GetVRegLong, SetJ);
9631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
9731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Long.reverseBytes(J)J
9831afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpLongReverseBytes, BSWAP, GetVRegLong, SetJ);
9931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
10031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Long.bitCount(J)I
10131afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpLongBitCount, POPCOUNT, GetVRegLong, SetI);
10231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
10331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Long.compare(JJ)I
10431afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeBINARY_JJ_INTRINSIC(MterpLongCompare, Compare, SetI);
10531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
10631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Long.highestOneBit(J)J
10731afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpLongHighestOneBit, HighestOneBitValue, GetVRegLong, SetJ);
10831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
10931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Long.lowestOneBit(J)J
11031afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpLongLowestOneBit, LowestOneBitValue, GetVRegLong, SetJ);
11131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
11231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Long.numberOfLeadingZeros(J)I
11331afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpLongNumberOfLeadingZeros, JAVASTYLE_CLZ, GetVRegLong, SetJ);
11431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
11531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Long.numberOfTrailingZeros(J)I
11631afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpLongNumberOfTrailingZeros, JAVASTYLE_CTZ, GetVRegLong, SetJ);
11731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
11831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Long.rotateRight(JI)J
11931afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeBINARY_JJ_INTRINSIC(MterpLongRotateRight, (Rot<int64_t, false>), SetJ);
12031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
12131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Long.rotateLeft(JI)J
12231afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeBINARY_JJ_INTRINSIC(MterpLongRotateLeft, (Rot<int64_t, true>), SetJ);
12331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
12431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Long.signum(J)I
12531afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpLongSignum, Signum, GetVRegLong, SetI);
12631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
12731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// java.lang.Short.reverseBytes(S)S
12831afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpShortReverseBytes, BSWAP, GetVRegShort, SetS);
12931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
13078f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.min(II)I
13131afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeBINARY_II_INTRINSIC(MterpMathMinIntInt, std::min, SetI);
13231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
13378f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.min(JJ)J
13431afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeBINARY_JJ_INTRINSIC(MterpMathMinLongLong, std::min, SetJ);
13531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
13678f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.max(II)I
13731afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeBINARY_II_INTRINSIC(MterpMathMaxIntInt, std::max, SetI);
13831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
13978f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.max(JJ)J
14031afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeBINARY_JJ_INTRINSIC(MterpMathMaxLongLong, std::max, SetJ);
14131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
14278f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.abs(I)I
14331afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpMathAbsInt, std::abs, GetVReg, SetI);
14431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
14578f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.abs(J)J
14631afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpMathAbsLong, std::abs, GetVRegLong, SetJ);
14731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
14878f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.abs(F)F
14931afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpMathAbsFloat, 0x7fffffff&, GetVReg, SetI);
15031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
15178f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.abs(D)D
15231afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpMathAbsDouble, INT64_C(0x7fffffffffffffff)&, GetVRegLong, SetJ);
15331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
15478f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.sqrt(D)D
15531afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpMathSqrt, std::sqrt, GetVRegDouble, SetD);
15631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
15778f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.ceil(D)D
15831afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpMathCeil, std::ceil, GetVRegDouble, SetD);
15931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
16078f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.floor(D)D
16131afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpMathFloor, std::floor, GetVRegDouble, SetD);
16231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
16378f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.sin(D)D
16431afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpMathSin, std::sin, GetVRegDouble, SetD);
16531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
16678f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.cos(D)D
16731afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpMathCos, std::cos, GetVRegDouble, SetD);
16831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
16978f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.tan(D)D
17031afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpMathTan, std::tan, GetVRegDouble, SetD);
17131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
17278f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.asin(D)D
17331afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpMathAsin, std::asin, GetVRegDouble, SetD);
17431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
17578f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.acos(D)D
17631afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpMathAcos, std::acos, GetVRegDouble, SetD);
17731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
17878f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee// java.lang.Math.atan(D)D
17931afbec96e9f9c8e58778694e74aea7ce55e1378buzbeeUNARY_INTRINSIC(MterpMathAtan, std::atan, GetVRegDouble, SetD);
18078f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee
181e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee// java.lang.String.charAt(I)C
182e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbeestatic ALWAYS_INLINE bool MterpStringCharAt(ShadowFrame* shadow_frame,
183e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                            const Instruction* inst,
184e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                            uint16_t inst_data,
185e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                            JValue* result_register)
186e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    REQUIRES_SHARED(Locks::mutator_lock_) {
187e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  uint32_t arg[Instruction::kMaxVarArgRegs] = {};
188e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  inst->GetVarArgs(arg, inst_data);
189e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  mirror::String* str = shadow_frame->GetVRegReference(arg[0])->AsString();
190e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  int length = str->GetLength();
191e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  int index = shadow_frame->GetVReg(arg[1]);
192e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  uint16_t res;
193e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  if (UNLIKELY(index < 0) || (index >= length)) {
194e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    return false;  // Punt and let non-intrinsic version deal with the throw.
195e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  }
196e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  if (str->IsCompressed()) {
197e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    res = str->GetValueCompressed()[index];
198e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  } else {
199e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    res = str->GetValue()[index];
200e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  }
201e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  result_register->SetC(res);
202e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  return true;
203e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee}
204e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee
205e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee// java.lang.String.compareTo(Ljava/lang/string)I
206e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbeestatic ALWAYS_INLINE bool MterpStringCompareTo(ShadowFrame* shadow_frame,
207e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                               const Instruction* inst,
208e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                               uint16_t inst_data,
209e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                               JValue* result_register)
210e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    REQUIRES_SHARED(Locks::mutator_lock_) {
211e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  uint32_t arg[Instruction::kMaxVarArgRegs] = {};
212e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  inst->GetVarArgs(arg, inst_data);
213e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  mirror::String* str = shadow_frame->GetVRegReference(arg[0])->AsString();
214e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  mirror::Object* arg1 = shadow_frame->GetVRegReference(arg[1]);
215e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  if (arg1 == nullptr) {
216e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    return false;
217e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  }
218e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  result_register->SetI(str->CompareTo(arg1->AsString()));
219e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  return true;
220e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee}
221e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee
222e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee#define STRING_INDEXOF_INTRINSIC(name, starting_pos)             \
223e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbeestatic ALWAYS_INLINE bool Mterp##name(ShadowFrame* shadow_frame, \
224e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                      const Instruction* inst,   \
225e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                      uint16_t inst_data,        \
226e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                      JValue* result_register)   \
227e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    REQUIRES_SHARED(Locks::mutator_lock_) {                      \
228e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  uint32_t arg[Instruction::kMaxVarArgRegs] = {};                \
229e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  inst->GetVarArgs(arg, inst_data);                              \
230e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  mirror::String* str = shadow_frame->GetVRegReference(arg[0])->AsString(); \
231e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  int ch = shadow_frame->GetVReg(arg[1]);                        \
232e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  if (ch >= 0x10000) {                                           \
233e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    /* Punt if supplementary char. */                            \
234e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    return false;                                                \
235e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  }                                                              \
236e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  result_register->SetI(str->FastIndexOf(ch, starting_pos));     \
237e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  return true;                                                   \
238e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee}
239e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee
240e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee// java.lang.String.indexOf(I)I
241e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbeeSTRING_INDEXOF_INTRINSIC(StringIndexOf, 0);
242e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee
243e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee// java.lang.String.indexOf(II)I
244e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbeeSTRING_INDEXOF_INTRINSIC(StringIndexOfAfter, shadow_frame->GetVReg(arg[2]));
245e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee
246e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee#define SIMPLE_STRING_INTRINSIC(name, operation)                 \
247e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbeestatic ALWAYS_INLINE bool Mterp##name(ShadowFrame* shadow_frame, \
248e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                      const Instruction* inst,   \
249e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                      uint16_t inst_data,        \
250e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                      JValue* result_register)   \
251e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    REQUIRES_SHARED(Locks::mutator_lock_) {                      \
252e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  uint32_t arg[Instruction::kMaxVarArgRegs] = {};                \
253e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  inst->GetVarArgs(arg, inst_data);                              \
254e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  mirror::String* str = shadow_frame->GetVRegReference(arg[0])->AsString(); \
255e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  result_register->operation;                                    \
256e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  return true;                                                   \
257e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee}
258e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee
259e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee// java.lang.String.isEmpty()Z
260e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbeeSIMPLE_STRING_INTRINSIC(StringIsEmpty, SetZ(str->GetLength() == 0))
261e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee
262e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee// java.lang.String.length()I
263e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbeeSIMPLE_STRING_INTRINSIC(StringLength, SetI(str->GetLength()))
264e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee
265e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee// java.lang.String.getCharsNoCheck(II[CI)V
266e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbeestatic ALWAYS_INLINE bool MterpStringGetCharsNoCheck(ShadowFrame* shadow_frame,
267e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                                     const Instruction* inst,
268e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                                     uint16_t inst_data,
269e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                                     JValue* result_register ATTRIBUTE_UNUSED)
270e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    REQUIRES_SHARED(Locks::mutator_lock_) {
271e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  // Start, end & index already checked by caller - won't throw.  Destination is uncompressed.
272e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  uint32_t arg[Instruction::kMaxVarArgRegs] = {};
273e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  inst->GetVarArgs(arg, inst_data);
274e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  mirror::String* str = shadow_frame->GetVRegReference(arg[0])->AsString();
275e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  int32_t start = shadow_frame->GetVReg(arg[1]);
276e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  int32_t end = shadow_frame->GetVReg(arg[2]);
277e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  int32_t index = shadow_frame->GetVReg(arg[4]);
278e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  mirror::CharArray* array = shadow_frame->GetVRegReference(arg[3])->AsCharArray();
279e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  uint16_t* dst = array->GetData() + index;
280e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  int32_t len = (end - start);
281e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  if (str->IsCompressed()) {
282e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    const uint8_t* src_8 = str->GetValueCompressed() + start;
283e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    for (int i = 0; i < len; i++) {
284e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee      dst[i] = src_8[i];
285e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    }
286e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  } else {
287e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    uint16_t* src_16 = str->GetValue() + start;
288e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    memcpy(dst, src_16, len * sizeof(uint16_t));
289e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  }
290e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  return true;
291e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee}
292e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee
293e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee// java.lang.String.equalsLjava/lang/Object;)Z
294e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbeestatic ALWAYS_INLINE bool MterpStringEquals(ShadowFrame* shadow_frame,
295e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                            const Instruction* inst,
296e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                            uint16_t inst_data,
297e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee                                            JValue* result_register)
298e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    REQUIRES_SHARED(Locks::mutator_lock_) {
299e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  uint32_t arg[Instruction::kMaxVarArgRegs] = {};
300e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  inst->GetVarArgs(arg, inst_data);
301e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  mirror::String* str = shadow_frame->GetVRegReference(arg[0])->AsString();
302e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  mirror::Object* obj = shadow_frame->GetVRegReference(arg[1]);
303e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  bool res = false;  // Assume not equal.
304e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  if ((obj != nullptr) && obj->IsString()) {
305e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    mirror::String* str2 = obj->AsString();
306e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    if (str->GetCount() == str2->GetCount()) {
307e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee      // Length & compression status are same.  Can use block compare.
308e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee      void* bytes1;
309e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee      void* bytes2;
310e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee      int len = str->GetLength();
311e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee      if (str->IsCompressed()) {
312e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee        bytes1 = str->GetValueCompressed();
313e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee        bytes2 = str2->GetValueCompressed();
314e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee      } else {
315e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee        len *= sizeof(uint16_t);
316e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee        bytes1 = str->GetValue();
317e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee        bytes2 = str2->GetValue();
318e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee      }
319e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee      res = (memcmp(bytes1, bytes2, len) == 0);
320e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    }
321e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  }
322e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  result_register->SetZ(res);
323e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee  return true;
324e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee}
325e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee
32643f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson#define VARHANDLE_FENCE_INTRINSIC(name, std_memory_operation)              \
32743f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodsonstatic ALWAYS_INLINE bool name(ShadowFrame* shadow_frame ATTRIBUTE_UNUSED, \
32843f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson                               const Instruction* inst ATTRIBUTE_UNUSED,   \
32943f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson                               uint16_t inst_data ATTRIBUTE_UNUSED,        \
33043f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson                               JValue* result_register ATTRIBUTE_UNUSED)   \
33143f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    REQUIRES_SHARED(Locks::mutator_lock_) {                                \
33243f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson  std::atomic_thread_fence(std_memory_operation);                          \
33343f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson  return true;                                                             \
3344a4610a438ff2b836f6fe07839a0689ce618863aOrion Hodson}
3354a4610a438ff2b836f6fe07839a0689ce618863aOrion Hodson
3364a4610a438ff2b836f6fe07839a0689ce618863aOrion Hodson// The VarHandle fence methods are static (unlike sun.misc.Unsafe versions).
3374a4610a438ff2b836f6fe07839a0689ce618863aOrion Hodson// The fences for the LoadLoadFence and StoreStoreFence are stronger
3384a4610a438ff2b836f6fe07839a0689ce618863aOrion Hodson// than strictly required, but the impact should be marginal.
3394a4610a438ff2b836f6fe07839a0689ce618863aOrion HodsonVARHANDLE_FENCE_INTRINSIC(MterpVarHandleFullFence, std::memory_order_seq_cst)
3404a4610a438ff2b836f6fe07839a0689ce618863aOrion HodsonVARHANDLE_FENCE_INTRINSIC(MterpVarHandleAcquireFence, std::memory_order_acquire)
3414a4610a438ff2b836f6fe07839a0689ce618863aOrion HodsonVARHANDLE_FENCE_INTRINSIC(MterpVarHandleReleaseFence, std::memory_order_release)
3424a4610a438ff2b836f6fe07839a0689ce618863aOrion HodsonVARHANDLE_FENCE_INTRINSIC(MterpVarHandleLoadLoadFence, std::memory_order_acquire)
3434a4610a438ff2b836f6fe07839a0689ce618863aOrion HodsonVARHANDLE_FENCE_INTRINSIC(MterpVarHandleStoreStoreFence, std::memory_order_release)
3444a4610a438ff2b836f6fe07839a0689ce618863aOrion Hodson
34543f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson#define METHOD_HANDLE_INVOKE_INTRINSIC(name)                                                      \
34643f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodsonstatic ALWAYS_INLINE bool Mterp##name(ShadowFrame* shadow_frame,                                  \
34743f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson                               const Instruction* inst,                                           \
34843f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson                               uint16_t inst_data,                                                \
34943f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson                               JValue* result)                                                    \
35043f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    REQUIRES_SHARED(Locks::mutator_lock_) {                                                       \
35143f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson  if (inst->Opcode() == Instruction::INVOKE_POLYMORPHIC) {                                        \
35243f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    return DoInvokePolymorphic<false>(Thread::Current(), *shadow_frame, inst, inst_data, result); \
35343f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson  } else {                                                                                        \
35443f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    return DoInvokePolymorphic<true>(Thread::Current(), *shadow_frame, inst, inst_data, result);  \
35543f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson  }                                                                                               \
35643f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson}
35743f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson
35843f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonMETHOD_HANDLE_INVOKE_INTRINSIC(MethodHandleInvokeExact)
35943f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonMETHOD_HANDLE_INVOKE_INTRINSIC(MethodHandleInvoke)
36043f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson
36143f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson#define VAR_HANDLE_ACCESSOR_INTRINSIC(name)                                   \
36243f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodsonstatic ALWAYS_INLINE bool Mterp##name(ShadowFrame* shadow_frame,              \
36343f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson                               const Instruction* inst,                       \
36443f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson                               uint16_t inst_data,                            \
36543f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson                               JValue* result)                                \
36643f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    REQUIRES_SHARED(Locks::mutator_lock_) {                                   \
36743f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson  return Do##name(Thread::Current(), *shadow_frame, inst, inst_data, result); \
36843f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson}
36943f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson
37043f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleCompareAndExchange)
37143f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleCompareAndExchangeAcquire)
37243f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleCompareAndExchangeRelease)
37343f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleCompareAndSet)
37443f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGet);
37543f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAcquire)
37643f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAndAdd)
37743f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAndAddAcquire)
37843f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAndAddRelease)
37943f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAndBitwiseAnd)
38043f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAndBitwiseAndAcquire)
38143f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAndBitwiseAndRelease)
38243f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAndBitwiseOr)
38343f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAndBitwiseOrAcquire)
38443f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAndBitwiseOrRelease)
38543f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAndBitwiseXor)
38643f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAndBitwiseXorAcquire)
38743f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAndBitwiseXorRelease)
38843f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAndSet)
38943f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAndSetAcquire)
39043f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetAndSetRelease)
39143f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetOpaque)
39243f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleGetVolatile)
39343f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleSet)
39443f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleSetOpaque)
39543f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleSetRelease)
39643f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleSetVolatile)
39743f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleWeakCompareAndSet)
39843f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleWeakCompareAndSetAcquire)
39943f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleWeakCompareAndSetPlain)
40043f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion HodsonVAR_HANDLE_ACCESSOR_INTRINSIC(VarHandleWeakCompareAndSetRelease)
40143f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson
4024d4175a132b944214ed7559beb9b6b91d2eb36e1Hans Boehmstatic ALWAYS_INLINE bool MterpReachabilityFence(ShadowFrame* shadow_frame ATTRIBUTE_UNUSED,
4034d4175a132b944214ed7559beb9b6b91d2eb36e1Hans Boehm                                                 const Instruction* inst ATTRIBUTE_UNUSED,
4044d4175a132b944214ed7559beb9b6b91d2eb36e1Hans Boehm                                                 uint16_t inst_data ATTRIBUTE_UNUSED,
4054d4175a132b944214ed7559beb9b6b91d2eb36e1Hans Boehm                                                 JValue* result_register ATTRIBUTE_UNUSED)
4064d4175a132b944214ed7559beb9b6b91d2eb36e1Hans Boehm    REQUIRES_SHARED(Locks::mutator_lock_) {
4074d4175a132b944214ed7559beb9b6b91d2eb36e1Hans Boehm  // Do nothing; Its only purpose is to keep the argument reference live
4084d4175a132b944214ed7559beb9b6b91d2eb36e1Hans Boehm  // at preceding suspend points. That's automatic in the interpreter.
4094d4175a132b944214ed7559beb9b6b91d2eb36e1Hans Boehm  return true;
4104d4175a132b944214ed7559beb9b6b91d2eb36e1Hans Boehm}
4114d4175a132b944214ed7559beb9b6b91d2eb36e1Hans Boehm
41231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee// Macro to help keep track of what's left to implement.
41331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee#define UNIMPLEMENTED_CASE(name)    \
41431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    case Intrinsics::k##name:       \
41531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee      res = false;                  \
41631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee      break;
41731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee
41878f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee#define INTRINSIC_CASE(name)                                           \
41978f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee    case Intrinsics::k##name:                                          \
42078f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee      res = Mterp##name(shadow_frame, inst, inst_data, result_register); \
42178f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee      break;
42278f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee
42378f1bdc6bbf0ac07a333ada2396987e8391eee49buzbeebool MterpHandleIntrinsic(ShadowFrame* shadow_frame,
42478f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee                          ArtMethod* const called_method,
42578f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee                          const Instruction* inst,
42678f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee                          uint16_t inst_data,
42778f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee                          JValue* result_register)
42878f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee    REQUIRES_SHARED(Locks::mutator_lock_) {
42978f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee  Intrinsics intrinsic = static_cast<Intrinsics>(called_method->GetIntrinsic());
43078f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee  bool res = false;  // Assume failure
43178f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee  switch (intrinsic) {
43231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(DoubleDoubleToRawLongBits /* (D)J */)
43331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(DoubleDoubleToLongBits /* (D)J */)
43431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(DoubleIsInfinite /* (D)Z */)
43531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(DoubleIsNaN /* (D)Z */)
43631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(DoubleLongBitsToDouble /* (J)D */)
43731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(FloatFloatToRawIntBits /* (F)I */)
43831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(FloatFloatToIntBits /* (F)I */)
43931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(FloatIsInfinite /* (F)Z */)
44031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(FloatIsNaN /* (F)Z */)
44131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(FloatIntBitsToFloat /* (I)F */)
44231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(IntegerReverse)
44331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(IntegerReverseBytes)
44431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(IntegerBitCount)
44531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(IntegerCompare)
44631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(IntegerHighestOneBit)
44731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(IntegerLowestOneBit)
44831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(IntegerNumberOfLeadingZeros)
44931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(IntegerNumberOfTrailingZeros)
45031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(IntegerRotateRight)
45131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(IntegerRotateLeft)
45231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(IntegerSignum)
45331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(LongReverse)
45431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(LongReverseBytes)
45531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(LongBitCount)
45631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(LongCompare)
45731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(LongHighestOneBit)
45831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(LongLowestOneBit)
45931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(LongNumberOfLeadingZeros)
46031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(LongNumberOfTrailingZeros)
46131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(LongRotateRight)
46231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(LongRotateLeft)
46331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(LongSignum)
46431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(ShortReverseBytes)
46531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(MathAbsDouble)
46631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(MathAbsFloat)
46731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(MathAbsLong)
46831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(MathAbsInt)
46931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathMinDoubleDouble /* (DD)D */)
47031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathMinFloatFloat /* (FF)F */)
47178f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee    INTRINSIC_CASE(MathMinLongLong)
47231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(MathMinIntInt)
47331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathMaxDoubleDouble /* (DD)D */)
47431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathMaxFloatFloat /* (FF)F */)
47578f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee    INTRINSIC_CASE(MathMaxLongLong)
47631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(MathMaxIntInt)
47778f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee    INTRINSIC_CASE(MathCos)
47831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(MathSin)
47978f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee    INTRINSIC_CASE(MathAcos)
48031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(MathAsin)
48178f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee    INTRINSIC_CASE(MathAtan)
48231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathAtan2 /* (DD)D */)
48331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathCbrt /* (D)D */)
48431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathCosh /* (D)D */)
48531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathExp /* (D)D */)
48631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathExpm1 /* (D)D */)
48731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathHypot /* (DD)D */)
48831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathLog /* (D)D */)
48931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathLog10 /* (D)D */)
49031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathNextAfter /* (DD)D */)
4914d17987da58d9411adbed1a18203d76d6119612dVladimir Marko    UNIMPLEMENTED_CASE(MathPow /* (DD)D */)
49231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathSinh /* (D)D */)
49331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(MathTan)
49431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathTanh /* (D)D */)
49531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(MathSqrt)
49631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(MathCeil)
49731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(MathFloor)
49831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathRint /* (D)D */)
49931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathRoundDouble /* (D)J */)
50031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MathRoundFloat /* (F)I */)
50131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(SystemArrayCopyChar /* ([CI[CII)V */)
50231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(SystemArrayCopy /* (Ljava/lang/Object;ILjava/lang/Object;II)V */)
50331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(ThreadCurrentThread /* ()Ljava/lang/Thread; */)
50431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MemoryPeekByte /* (J)B */)
50531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MemoryPeekIntNative /* (J)I */)
50631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MemoryPeekLongNative /* (J)J */)
50731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MemoryPeekShortNative /* (J)S */)
50831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MemoryPokeByte /* (JB)V */)
50931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MemoryPokeIntNative /* (JI)V */)
51031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MemoryPokeLongNative /* (JJ)V */)
51131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(MemoryPokeShortNative /* (JS)V */)
5124d4175a132b944214ed7559beb9b6b91d2eb36e1Hans Boehm    INTRINSIC_CASE(ReachabilityFence /* (Ljava/lang/Object;)V */)
513e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    INTRINSIC_CASE(StringCharAt)
514e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    INTRINSIC_CASE(StringCompareTo)
515e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    INTRINSIC_CASE(StringEquals)
516e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    INTRINSIC_CASE(StringGetCharsNoCheck)
51731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(StringIndexOf)
51831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    INTRINSIC_CASE(StringIndexOfAfter)
51931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(StringStringIndexOf /* (Ljava/lang/String;)I */)
52031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(StringStringIndexOfAfter /* (Ljava/lang/String;I)I */)
521e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    INTRINSIC_CASE(StringIsEmpty)
522e667a3c2e4cae5a977e412a1d80f31a1dc4f3028buzbee    INTRINSIC_CASE(StringLength)
52331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(StringNewStringFromBytes /* ([BIII)Ljava/lang/String; */)
52431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(StringNewStringFromChars /* (II[C)Ljava/lang/String; */)
52531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(StringNewStringFromString /* (Ljava/lang/String;)Ljava/lang/String; */)
52631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(StringBufferAppend /* (Ljava/lang/String;)Ljava/lang/StringBuffer; */)
52731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(StringBufferLength /* ()I */)
52831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(StringBufferToString /* ()Ljava/lang/String; */)
52931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(StringBuilderAppend /* (Ljava/lang/String;)Ljava/lang/StringBuilder; */)
53031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(StringBuilderLength /* ()I */)
53131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(StringBuilderToString /* ()Ljava/lang/String; */)
53231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeCASInt /* (Ljava/lang/Object;JII)Z */)
53331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeCASLong /* (Ljava/lang/Object;JJJ)Z */)
53431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeCASObject /* (Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z */)
53531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeGet /* (Ljava/lang/Object;J)I */)
53631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeGetVolatile /* (Ljava/lang/Object;J)I */)
53731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeGetObject /* (Ljava/lang/Object;J)Ljava/lang/Object; */)
53831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeGetObjectVolatile /* (Ljava/lang/Object;J)Ljava/lang/Object; */)
53931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeGetLong /* (Ljava/lang/Object;J)J */)
54031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeGetLongVolatile /* (Ljava/lang/Object;J)J */)
54131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafePut /* (Ljava/lang/Object;JI)V */)
54231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafePutOrdered /* (Ljava/lang/Object;JI)V */)
54331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafePutVolatile /* (Ljava/lang/Object;JI)V */)
54431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafePutObject /* (Ljava/lang/Object;JLjava/lang/Object;)V */)
54531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafePutObjectOrdered /* (Ljava/lang/Object;JLjava/lang/Object;)V */)
54631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafePutObjectVolatile /* (Ljava/lang/Object;JLjava/lang/Object;)V */)
54731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafePutLong /* (Ljava/lang/Object;JJ)V */)
54831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafePutLongOrdered /* (Ljava/lang/Object;JJ)V */)
54931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafePutLongVolatile /* (Ljava/lang/Object;JJ)V */)
55031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeGetAndAddInt /* (Ljava/lang/Object;JI)I */)
55131afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeGetAndAddLong /* (Ljava/lang/Object;JJ)J */)
55231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeGetAndSetInt /* (Ljava/lang/Object;JI)I */)
55331afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeGetAndSetLong /* (Ljava/lang/Object;JJ)J */)
55431afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeGetAndSetObject /* (Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object; */)
55531afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeLoadFence /* ()V */)
55631afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeStoreFence /* ()V */)
55731afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(UnsafeFullFence /* ()V */)
55831afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(ReferenceGetReferent /* ()Ljava/lang/Object; */)
55931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    UNIMPLEMENTED_CASE(IntegerValueOf /* (I)Ljava/lang/Integer; */)
560365719c23d809e595cf320bfba40e76bb4e87940Nicolas Geoffray    UNIMPLEMENTED_CASE(ThreadInterrupted /* ()Z */)
5614a4610a438ff2b836f6fe07839a0689ce618863aOrion Hodson    INTRINSIC_CASE(VarHandleFullFence)
5624a4610a438ff2b836f6fe07839a0689ce618863aOrion Hodson    INTRINSIC_CASE(VarHandleAcquireFence)
5634a4610a438ff2b836f6fe07839a0689ce618863aOrion Hodson    INTRINSIC_CASE(VarHandleReleaseFence)
5644a4610a438ff2b836f6fe07839a0689ce618863aOrion Hodson    INTRINSIC_CASE(VarHandleLoadLoadFence)
5654a4610a438ff2b836f6fe07839a0689ce618863aOrion Hodson    INTRINSIC_CASE(VarHandleStoreStoreFence)
56643f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(MethodHandleInvokeExact)
56743f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(MethodHandleInvoke)
56843f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleCompareAndExchange)
56943f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleCompareAndExchangeAcquire)
57043f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleCompareAndExchangeRelease)
57143f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleCompareAndSet)
57243f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGet)
57343f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAcquire)
57443f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAndAdd)
57543f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAndAddAcquire)
57643f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAndAddRelease)
57743f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAndBitwiseAnd)
57843f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAndBitwiseAndAcquire)
57943f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAndBitwiseAndRelease)
58043f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAndBitwiseOr)
58143f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAndBitwiseOrAcquire)
58243f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAndBitwiseOrRelease)
58343f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAndBitwiseXor)
58443f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAndBitwiseXorAcquire)
58543f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAndBitwiseXorRelease)
58643f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAndSet)
58743f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAndSetAcquire)
58843f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetAndSetRelease)
58943f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetOpaque)
59043f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleGetVolatile)
59143f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleSet)
59243f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleSetOpaque)
59343f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleSetRelease)
59443f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleSetVolatile)
59543f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleWeakCompareAndSet)
59643f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleWeakCompareAndSetAcquire)
59743f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleWeakCompareAndSetPlain)
59843f0cdbe3281cd5c9a33d5472b1538e5617f6691Orion Hodson    INTRINSIC_CASE(VarHandleWeakCompareAndSetRelease)
59931afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    case Intrinsics::kNone:
60031afbec96e9f9c8e58778694e74aea7ce55e1378buzbee      res = false;
60178f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee      break;
60231afbec96e9f9c8e58778694e74aea7ce55e1378buzbee    // Note: no default case to ensure we catch any newly added intrinsics.
60378f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee  }
60478f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee  return res;
60578f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee}
60678f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee
60778f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee}  // namespace interpreter
60878f1bdc6bbf0ac07a333ada2396987e8391eee49buzbee}  // namespace art
609