Elliott Hughes | 2faa5f1 | 2012-01-30 14:42:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Ian Rogers | b033c75 | 2011-07-20 12:22:35 -0700 | [diff] [blame] | 16 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_RUNTIME_INSTRUCTION_SET_H_ |
| 18 | #define ART_RUNTIME_INSTRUCTION_SET_H_ |
Ian Rogers | b033c75 | 2011-07-20 12:22:35 -0700 | [diff] [blame] | 19 | |
Ian Rogers | c8b306f | 2012-02-17 21:34:44 -0800 | [diff] [blame] | 20 | #include <iosfwd> |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 21 | #include <string> |
| 22 | |
Alexei Zavjalov | 41c507a | 2014-05-15 16:02:46 +0700 | [diff] [blame] | 23 | #include "base/logging.h" // Logging is required for FATAL in the helper functions. |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 24 | #include "base/macros.h" |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 25 | #include "base/value_object.h" |
Andreas Gampe | 7cd26f3 | 2014-06-18 17:01:15 -0700 | [diff] [blame] | 26 | #include "globals.h" // For KB. |
Ian Rogers | c8b306f | 2012-02-17 21:34:44 -0800 | [diff] [blame] | 27 | |
buzbee | c143c55 | 2011-08-20 17:38:58 -0700 | [diff] [blame] | 28 | namespace art { |
| 29 | |
| 30 | enum InstructionSet { |
| 31 | kNone, |
| 32 | kArm, |
Serban Constantinescu | ed8dd49 | 2014-02-11 14:15:10 +0000 | [diff] [blame] | 33 | kArm64, |
buzbee | c143c55 | 2011-08-20 17:38:58 -0700 | [diff] [blame] | 34 | kThumb2, |
Shih-wei Liao | 6edfde4 | 2012-03-01 15:49:12 -0800 | [diff] [blame] | 35 | kX86, |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 36 | kX86_64, |
Douglas Leung | 2db3e26 | 2014-06-25 16:02:55 -0700 | [diff] [blame] | 37 | kMips, |
| 38 | kMips64 |
buzbee | c143c55 | 2011-08-20 17:38:58 -0700 | [diff] [blame] | 39 | }; |
Ian Rogers | 8afeb85 | 2014-04-02 14:55:49 -0700 | [diff] [blame] | 40 | std::ostream& operator<<(std::ostream& os, const InstructionSet& rhs); |
buzbee | c143c55 | 2011-08-20 17:38:58 -0700 | [diff] [blame] | 41 | |
Andreas Gampe | 7cd26f3 | 2014-06-18 17:01:15 -0700 | [diff] [blame] | 42 | #if defined(__arm__) |
| 43 | static constexpr InstructionSet kRuntimeISA = kArm; |
| 44 | #elif defined(__aarch64__) |
| 45 | static constexpr InstructionSet kRuntimeISA = kArm64; |
| 46 | #elif defined(__mips__) |
| 47 | static constexpr InstructionSet kRuntimeISA = kMips; |
| 48 | #elif defined(__i386__) |
| 49 | static constexpr InstructionSet kRuntimeISA = kX86; |
| 50 | #elif defined(__x86_64__) |
| 51 | static constexpr InstructionSet kRuntimeISA = kX86_64; |
| 52 | #else |
| 53 | static constexpr InstructionSet kRuntimeISA = kNone; |
| 54 | #endif |
| 55 | |
Alexei Zavjalov | 41c507a | 2014-05-15 16:02:46 +0700 | [diff] [blame] | 56 | // Architecture-specific pointer sizes |
| 57 | static constexpr size_t kArmPointerSize = 4; |
| 58 | static constexpr size_t kArm64PointerSize = 8; |
| 59 | static constexpr size_t kMipsPointerSize = 4; |
Ian Rogers | 02875c5 | 2014-09-25 17:36:39 -0700 | [diff] [blame] | 60 | static constexpr size_t kMips64PointerSize = 8; |
Alexei Zavjalov | 41c507a | 2014-05-15 16:02:46 +0700 | [diff] [blame] | 61 | static constexpr size_t kX86PointerSize = 4; |
| 62 | static constexpr size_t kX86_64PointerSize = 8; |
| 63 | |
| 64 | // ARM instruction alignment. ARM processors require code to be 4-byte aligned, |
| 65 | // but ARM ELF requires 8.. |
| 66 | static constexpr size_t kArmAlignment = 8; |
| 67 | |
| 68 | // ARM64 instruction alignment. This is the recommended alignment for maximum performance. |
| 69 | static constexpr size_t kArm64Alignment = 16; |
| 70 | |
| 71 | // MIPS instruction alignment. MIPS processors require code to be 4-byte aligned. |
| 72 | // TODO: Can this be 4? |
| 73 | static constexpr size_t kMipsAlignment = 8; |
| 74 | |
| 75 | // X86 instruction alignment. This is the recommended alignment for maximum performance. |
| 76 | static constexpr size_t kX86Alignment = 16; |
| 77 | |
| 78 | |
Brian Carlstrom | 2afe494 | 2014-05-19 10:25:33 -0700 | [diff] [blame] | 79 | const char* GetInstructionSetString(InstructionSet isa); |
Andreas Gampe | 20c8930 | 2014-08-19 17:28:06 -0700 | [diff] [blame] | 80 | |
| 81 | // Note: Returns kNone when the string cannot be parsed to a known value. |
Narayan Kamath | 11d9f06 | 2014-04-23 20:24:57 +0100 | [diff] [blame] | 82 | InstructionSet GetInstructionSetFromString(const char* instruction_set); |
| 83 | |
Alexei Zavjalov | 41c507a | 2014-05-15 16:02:46 +0700 | [diff] [blame] | 84 | static inline size_t GetInstructionSetPointerSize(InstructionSet isa) { |
| 85 | switch (isa) { |
| 86 | case kArm: |
| 87 | // Fall-through. |
| 88 | case kThumb2: |
| 89 | return kArmPointerSize; |
| 90 | case kArm64: |
| 91 | return kArm64PointerSize; |
| 92 | case kX86: |
| 93 | return kX86PointerSize; |
| 94 | case kX86_64: |
| 95 | return kX86_64PointerSize; |
| 96 | case kMips: |
| 97 | return kMipsPointerSize; |
Ian Rogers | 02875c5 | 2014-09-25 17:36:39 -0700 | [diff] [blame] | 98 | case kMips64: |
| 99 | return kMips64PointerSize; |
Alexei Zavjalov | 41c507a | 2014-05-15 16:02:46 +0700 | [diff] [blame] | 100 | case kNone: |
| 101 | LOG(FATAL) << "ISA kNone does not have pointer size."; |
| 102 | return 0; |
| 103 | default: |
| 104 | LOG(FATAL) << "Unknown ISA " << isa; |
| 105 | return 0; |
| 106 | } |
| 107 | } |
| 108 | |
Andreas Gampe | af13ad9 | 2014-04-11 12:07:48 -0700 | [diff] [blame] | 109 | size_t GetInstructionSetAlignment(InstructionSet isa); |
Alexei Zavjalov | 41c507a | 2014-05-15 16:02:46 +0700 | [diff] [blame] | 110 | |
| 111 | static inline bool Is64BitInstructionSet(InstructionSet isa) { |
| 112 | switch (isa) { |
| 113 | case kArm: |
| 114 | case kThumb2: |
| 115 | case kX86: |
| 116 | case kMips: |
| 117 | return false; |
| 118 | |
| 119 | case kArm64: |
| 120 | case kX86_64: |
Ian Rogers | 02875c5 | 2014-09-25 17:36:39 -0700 | [diff] [blame] | 121 | case kMips64: |
Alexei Zavjalov | 41c507a | 2014-05-15 16:02:46 +0700 | [diff] [blame] | 122 | return true; |
| 123 | |
| 124 | case kNone: |
| 125 | LOG(FATAL) << "ISA kNone does not have bit width."; |
| 126 | return 0; |
| 127 | default: |
| 128 | LOG(FATAL) << "Unknown ISA " << isa; |
| 129 | return 0; |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | static inline size_t GetBytesPerGprSpillLocation(InstructionSet isa) { |
| 134 | switch (isa) { |
| 135 | case kArm: |
| 136 | // Fall-through. |
| 137 | case kThumb2: |
| 138 | return 4; |
| 139 | case kArm64: |
| 140 | return 8; |
| 141 | case kX86: |
| 142 | return 4; |
| 143 | case kX86_64: |
| 144 | return 8; |
| 145 | case kMips: |
| 146 | return 4; |
| 147 | case kNone: |
| 148 | LOG(FATAL) << "ISA kNone does not have spills."; |
| 149 | return 0; |
| 150 | default: |
| 151 | LOG(FATAL) << "Unknown ISA " << isa; |
| 152 | return 0; |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | static inline size_t GetBytesPerFprSpillLocation(InstructionSet isa) { |
| 157 | switch (isa) { |
| 158 | case kArm: |
| 159 | // Fall-through. |
| 160 | case kThumb2: |
| 161 | return 4; |
| 162 | case kArm64: |
| 163 | return 8; |
| 164 | case kX86: |
| 165 | return 8; |
| 166 | case kX86_64: |
| 167 | return 8; |
| 168 | case kMips: |
| 169 | return 4; |
| 170 | case kNone: |
| 171 | LOG(FATAL) << "ISA kNone does not have spills."; |
| 172 | return 0; |
| 173 | default: |
| 174 | LOG(FATAL) << "Unknown ISA " << isa; |
| 175 | return 0; |
| 176 | } |
| 177 | } |
Andreas Gampe | af13ad9 | 2014-04-11 12:07:48 -0700 | [diff] [blame] | 178 | |
Andreas Gampe | 7ea6f79 | 2014-07-14 16:21:44 -0700 | [diff] [blame] | 179 | size_t GetStackOverflowReservedBytes(InstructionSet isa); |
Andreas Gampe | 91268c1 | 2014-04-03 17:50:24 -0700 | [diff] [blame] | 180 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 181 | class ArmInstructionSetFeatures; |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 182 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 183 | // Abstraction used to describe features of a different instruction sets. |
| 184 | class InstructionSetFeatures { |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 185 | public: |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 186 | // Process a CPU variant string for the given ISA and create an InstructionSetFeatures. |
| 187 | static const InstructionSetFeatures* FromVariant(InstructionSet isa, |
| 188 | const std::string& variant, |
| 189 | std::string* error_msg); |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 190 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 191 | // Parse a string of the form "div,lpae" and create an InstructionSetFeatures. |
| 192 | static const InstructionSetFeatures* FromFeatureString(InstructionSet isa, |
| 193 | const std::string& feature_list, |
| 194 | std::string* error_msg); |
Ian Rogers | 8afeb85 | 2014-04-02 14:55:49 -0700 | [diff] [blame] | 195 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 196 | // Parse a bitmap for the given isa and create an InstructionSetFeatures. |
| 197 | static const InstructionSetFeatures* FromBitmap(InstructionSet isa, uint32_t bitmap); |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 198 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 199 | // Turn C pre-processor #defines into the equivalent instruction set features for kRuntimeISA. |
| 200 | static const InstructionSetFeatures* FromCppDefines(); |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 201 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 202 | // Process /proc/cpuinfo and use kRuntimeISA to produce InstructionSetFeatures. |
| 203 | static const InstructionSetFeatures* FromCpuInfo(); |
Vladimir Marko | 674744e | 2014-04-24 15:18:26 +0100 | [diff] [blame] | 204 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 205 | // Process the auxiliary vector AT_HWCAP entry and use kRuntimeISA to produce |
| 206 | // InstructionSetFeatures. |
| 207 | static const InstructionSetFeatures* FromHwcap(); |
Vladimir Marko | 674744e | 2014-04-24 15:18:26 +0100 | [diff] [blame] | 208 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 209 | // Use assembly tests of the current runtime (ie kRuntimeISA) to determine the |
| 210 | // InstructionSetFeatures. This works around kernel bugs in AT_HWCAP and /proc/cpuinfo. |
| 211 | static const InstructionSetFeatures* FromAssembly(); |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 212 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 213 | // Are these features the same as the other given features? |
| 214 | virtual bool Equals(const InstructionSetFeatures* other) const = 0; |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 215 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 216 | // Return the ISA these features relate to. |
| 217 | virtual InstructionSet GetInstructionSet() const = 0; |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 218 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 219 | // Return a bitmap that represents the features. ISA specific. |
| 220 | virtual uint32_t AsBitmap() const = 0; |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 221 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 222 | // Return a string of the form "div,lpae" or "none". |
| 223 | virtual std::string GetFeatureString() const = 0; |
| 224 | |
| 225 | // Down cast this ArmInstructionFeatures. |
| 226 | const ArmInstructionSetFeatures* AsArmInstructionSetFeatures() const; |
| 227 | |
| 228 | virtual ~InstructionSetFeatures() {} |
| 229 | |
| 230 | protected: |
| 231 | InstructionSetFeatures() {} |
Serban Constantinescu | 75b9113 | 2014-04-09 18:39:10 +0100 | [diff] [blame] | 232 | |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 233 | private: |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 234 | DISALLOW_COPY_AND_ASSIGN(InstructionSetFeatures); |
| 235 | }; |
| 236 | std::ostream& operator<<(std::ostream& os, const InstructionSetFeatures& rhs); |
| 237 | |
| 238 | // Instruction set features relevant to the ARM architecture. |
| 239 | class ArmInstructionSetFeatures FINAL : public InstructionSetFeatures { |
| 240 | public: |
| 241 | // Process a CPU variant string like "krait" or "cortex-a15" and create InstructionSetFeatures. |
| 242 | static const ArmInstructionSetFeatures* FromVariant(const std::string& variant, |
| 243 | std::string* error_msg); |
| 244 | |
| 245 | // Parse a string of the form "div,lpae" and create an InstructionSetFeatures. |
| 246 | static const ArmInstructionSetFeatures* FromFeatureString(const std::string& feature_list, |
| 247 | std::string* error_msg); |
| 248 | |
| 249 | // Parse a bitmap and create an InstructionSetFeatures. |
| 250 | static const ArmInstructionSetFeatures* FromBitmap(uint32_t bitmap); |
| 251 | |
| 252 | // Turn C pre-processor #defines into the equivalent instruction set features. |
| 253 | static const ArmInstructionSetFeatures* FromCppDefines(); |
| 254 | |
| 255 | // Process /proc/cpuinfo and use kRuntimeISA to produce InstructionSetFeatures. |
| 256 | static const ArmInstructionSetFeatures* FromCpuInfo(); |
| 257 | |
| 258 | // Process the auxiliary vector AT_HWCAP entry and use kRuntimeISA to produce |
| 259 | // InstructionSetFeatures. |
| 260 | static const ArmInstructionSetFeatures* FromHwcap(); |
| 261 | |
| 262 | // Use assembly tests of the current runtime (ie kRuntimeISA) to determine the |
| 263 | // InstructionSetFeatures. This works around kernel bugs in AT_HWCAP and /proc/cpuinfo. |
| 264 | static const ArmInstructionSetFeatures* FromAssembly(); |
| 265 | |
| 266 | bool Equals(const InstructionSetFeatures* other) const OVERRIDE; |
| 267 | |
| 268 | InstructionSet GetInstructionSet() const OVERRIDE { |
| 269 | return kArm; |
| 270 | } |
| 271 | |
| 272 | uint32_t AsBitmap() const OVERRIDE; |
| 273 | |
| 274 | // Return a string of the form "div,lpae" or "none". |
| 275 | std::string GetFeatureString() const OVERRIDE; |
| 276 | |
| 277 | // Is the divide instruction feature enabled? |
| 278 | bool HasDivideInstruction() const { |
| 279 | return has_div_; |
| 280 | } |
| 281 | |
| 282 | // Is the Large Physical Address Extension (LPAE) instruction feature enabled? When true code can |
| 283 | // be used that assumes double register loads and stores (ldrd, strd) don't tear. |
| 284 | bool HasLpae() const { |
| 285 | return has_lpae_; |
| 286 | } |
| 287 | |
| 288 | virtual ~ArmInstructionSetFeatures() {} |
| 289 | |
| 290 | private: |
| 291 | ArmInstructionSetFeatures(bool has_lpae, bool has_div) |
| 292 | : has_lpae_(has_lpae), has_div_(has_div) { |
| 293 | } |
| 294 | |
| 295 | // Bitmap positions for encoding features as a bitmap. |
| 296 | enum { |
| 297 | kDivBitfield = 1, |
| 298 | kLpaeBitfield = 2, |
| 299 | }; |
| 300 | |
| 301 | const bool has_lpae_; |
| 302 | const bool has_div_; |
| 303 | |
| 304 | DISALLOW_COPY_AND_ASSIGN(ArmInstructionSetFeatures); |
| 305 | }; |
| 306 | |
| 307 | // A class used for instruction set features on ISAs that don't yet have any features defined. |
| 308 | class UnknownInstructionSetFeatures FINAL : public InstructionSetFeatures { |
| 309 | public: |
| 310 | static const UnknownInstructionSetFeatures* Unknown(InstructionSet isa) { |
| 311 | return new UnknownInstructionSetFeatures(isa); |
| 312 | } |
| 313 | |
| 314 | bool Equals(const InstructionSetFeatures* other) const OVERRIDE { |
| 315 | return isa_ == other->GetInstructionSet(); |
| 316 | } |
| 317 | |
| 318 | InstructionSet GetInstructionSet() const OVERRIDE { |
| 319 | return isa_; |
| 320 | } |
| 321 | |
| 322 | uint32_t AsBitmap() const OVERRIDE { |
| 323 | return 0; |
| 324 | } |
| 325 | |
| 326 | std::string GetFeatureString() const OVERRIDE { |
| 327 | return "none"; |
| 328 | } |
| 329 | |
| 330 | virtual ~UnknownInstructionSetFeatures() {} |
| 331 | |
| 332 | private: |
| 333 | explicit UnknownInstructionSetFeatures(InstructionSet isa) : isa_(isa) {} |
| 334 | |
| 335 | const InstructionSet isa_; |
| 336 | |
| 337 | DISALLOW_COPY_AND_ASSIGN(UnknownInstructionSetFeatures); |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 338 | }; |
| 339 | |
Andreas Gampe | d58342c | 2014-06-05 14:18:08 -0700 | [diff] [blame] | 340 | // The following definitions create return types for two word-sized entities that will be passed |
| 341 | // in registers so that memory operations for the interface trampolines can be avoided. The entities |
| 342 | // are the resolved method and the pointer to the code to be invoked. |
| 343 | // |
| 344 | // On x86, ARM32 and MIPS, this is given for a *scalar* 64bit value. The definition thus *must* be |
| 345 | // uint64_t or long long int. |
| 346 | // |
| 347 | // On x86_64 and ARM64, structs are decomposed for allocation, so we can create a structs of two |
| 348 | // size_t-sized values. |
| 349 | // |
| 350 | // We need two operations: |
| 351 | // |
| 352 | // 1) A flag value that signals failure. The assembly stubs expect the lower part to be "0". |
| 353 | // GetTwoWordFailureValue() will return a value that has lower part == 0. |
| 354 | // |
| 355 | // 2) A value that combines two word-sized values. |
| 356 | // GetTwoWordSuccessValue() constructs this. |
| 357 | // |
| 358 | // IMPORTANT: If you use this to transfer object pointers, it is your responsibility to ensure |
| 359 | // that the object does not move or the value is updated. Simple use of this is NOT SAFE |
| 360 | // when the garbage collector can move objects concurrently. Ensure that required locks |
| 361 | // are held when using! |
| 362 | |
| 363 | #if defined(__i386__) || defined(__arm__) || defined(__mips__) |
| 364 | typedef uint64_t TwoWordReturn; |
| 365 | |
| 366 | // Encodes method_ptr==nullptr and code_ptr==nullptr |
| 367 | static inline constexpr TwoWordReturn GetTwoWordFailureValue() { |
| 368 | return 0; |
| 369 | } |
| 370 | |
| 371 | // Use the lower 32b for the method pointer and the upper 32b for the code pointer. |
| 372 | static inline TwoWordReturn GetTwoWordSuccessValue(uintptr_t hi, uintptr_t lo) { |
| 373 | uint32_t lo32 = static_cast<uint32_t>(lo); |
| 374 | uint64_t hi64 = static_cast<uint64_t>(hi); |
| 375 | return ((hi64 << 32) | lo32); |
| 376 | } |
| 377 | |
| 378 | #elif defined(__x86_64__) || defined(__aarch64__) |
| 379 | struct TwoWordReturn { |
| 380 | uintptr_t lo; |
| 381 | uintptr_t hi; |
| 382 | }; |
| 383 | |
| 384 | // Encodes method_ptr==nullptr. Leaves random value in code pointer. |
| 385 | static inline TwoWordReturn GetTwoWordFailureValue() { |
| 386 | TwoWordReturn ret; |
| 387 | ret.lo = 0; |
| 388 | return ret; |
| 389 | } |
| 390 | |
| 391 | // Write values into their respective members. |
| 392 | static inline TwoWordReturn GetTwoWordSuccessValue(uintptr_t hi, uintptr_t lo) { |
| 393 | TwoWordReturn ret; |
| 394 | ret.lo = lo; |
| 395 | ret.hi = hi; |
| 396 | return ret; |
| 397 | } |
| 398 | #else |
| 399 | #error "Unsupported architecture" |
| 400 | #endif |
| 401 | |
buzbee | c143c55 | 2011-08-20 17:38:58 -0700 | [diff] [blame] | 402 | } // namespace art |
| 403 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 404 | #endif // ART_RUNTIME_INSTRUCTION_SET_H_ |