Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
constants_x64.h
Go to the documentation of this file.
1// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_VM_CONSTANTS_X64_H_
6#define RUNTIME_VM_CONSTANTS_X64_H_
7
8#ifndef RUNTIME_VM_CONSTANTS_H_
9#error Do not include constants_x64.h directly; use constants.h instead.
10#endif
11
12#include "platform/assert.h"
13#include "platform/globals.h"
14#include "platform/utils.h"
15
16#include "vm/constants_base.h"
17
18namespace dart {
19
20#define R(reg) (static_cast<RegList>(1) << (reg))
21
23 RAX = 0,
24 RCX = 1,
25 RDX = 2,
26 RBX = 3,
27 RSP = 4, // SP
28 RBP = 5, // FP
29 RSI = 6,
30 RDI = 7,
31 R8 = 8,
32 R9 = 9,
33 R10 = 10,
34 R11 = 11, // TMP
35 R12 = 12, // CODE_REG
36 R13 = 13,
37 R14 = 14, // THR
38 R15 = 15, // PP
40 kNoRegister = -1, // Signals an illegal register.
41};
42
44 AL = 0,
45 CL = 1,
46 DL = 2,
47 BL = 3,
48 AH = 4,
49 CH = 5,
50 DH = 6,
51 BH = 7,
52 SPL = 4 | 0x10,
53 BPL = 5 | 0x10,
54 SIL = 6 | 0x10,
55 DIL = 7 | 0x10,
56 R8B = 8,
57 R9B = 9,
58 R10B = 10,
59 R11B = 11,
60 R12B = 12,
61 R13B = 13,
62 R14B = 14,
63 R15B = 15,
65 kNoByteRegister = -1 // Signals an illegal register.
66};
67
69 if (RSP <= reg && reg <= RDI) {
70 return static_cast<ByteRegister>(reg | 0x10);
71 } else {
72 return static_cast<ByteRegister>(reg);
73 }
74}
75
77 XMM0 = 0,
78 XMM1 = 1,
79 XMM2 = 2,
80 XMM3 = 3,
81 XMM4 = 4,
82 XMM5 = 5,
83 XMM6 = 6,
84 XMM7 = 7,
85 XMM8 = 8,
86 XMM9 = 9,
87 XMM10 = 10,
88 XMM11 = 11,
89 XMM12 = 12,
90 XMM13 = 13,
91 XMM14 = 14,
92 XMM15 = 15,
94 kNoXmmRegister = -1 // Signals an illegal register.
95};
96
97// Architecture independent aliases.
100const int kFpuRegisterSize = 16;
101typedef simd128_value_t fpu_register_t;
104
105extern const char* const cpu_reg_names[kNumberOfCpuRegisters];
106extern const char* const cpu_reg_abi_names[kNumberOfCpuRegisters];
108extern const char* const fpu_reg_names[kNumberOfXmmRegisters];
109
112 REX_B = 1 << 0,
113 REX_X = 1 << 1,
114 REX_R = 1 << 2,
115 REX_W = 1 << 3,
116 REX_PREFIX = 1 << 6
118
119// Register aliases.
120const Register TMP = R11; // Used as scratch register by the assembler.
121const Register TMP2 = kNoRegister; // No second assembler scratch register.
122// Caches object pool pointer in generated code.
123const Register PP = R15;
124const Register SPREG = RSP; // Stack pointer register.
125const Register FPREG = RBP; // Frame pointer register.
126const Register IC_DATA_REG = RBX; // ICData/MegamorphicCache register.
127const Register ARGS_DESC_REG = R10; // Arguments descriptor register.
128const Register CODE_REG = R12;
129// Set when calling Dart functions in JIT mode, used by LazyCompileStub.
131const Register THR = R14; // Caches current thread in generated code.
133
134// ABI for catch-clause entry point.
137
138// ABI for write barrier stub.
142
143// Common ABI for shared slow path stubs.
144struct SharedSlowPathStubABI {
145 static constexpr Register kResultReg = RAX;
146};
147
148// ABI for instantiation stubs.
149struct InstantiationABI {
151 static constexpr Register kInstantiatorTypeArgumentsReg = RDX;
152 static constexpr Register kFunctionTypeArgumentsReg = RCX;
153 static constexpr Register kResultTypeArgumentsReg = RAX;
154 static constexpr Register kResultTypeReg = RAX;
155 static constexpr Register kScratchReg = R9;
156};
157
158// Registers in addition to those listed in InstantiationABI used inside the
159// implementation of the InstantiateTypeArguments stubs.
160struct InstantiateTAVInternalRegs {
161 // The set of registers that must be pushed/popped when probing a hash-based
162 // cache due to overlap with the registers in InstantiationABI.
163 static constexpr intptr_t kSavedRegisters = 0;
164
165 // Additional registers used to probe hash-based caches.
166 static constexpr Register kEntryStartReg = R10;
167 static constexpr Register kProbeMaskReg = R13;
168 static constexpr Register kProbeDistanceReg = R8;
169 static constexpr Register kCurrentEntryIndexReg = RSI;
170};
171
172// Registers in addition to those listed in TypeTestABI used inside the
173// implementation of type testing stubs that are _not_ preserved.
174struct TTSInternalRegs {
175 static constexpr Register kInstanceTypeArgumentsReg = RSI;
176 static constexpr Register kScratchReg = R8;
177 static constexpr Register kSubTypeArgumentReg = R10;
178 static constexpr Register kSuperTypeArgumentReg = R13;
179
180 // Must be pushed/popped whenever generic type arguments are being checked as
181 // they overlap with registers in TypeTestABI.
182 static constexpr intptr_t kSavedTypeArgumentRegisters = 0;
183
184 static constexpr intptr_t kInternalRegisters =
185 ((1 << kInstanceTypeArgumentsReg) | (1 << kScratchReg) |
188};
189
190// Registers in addition to those listed in TypeTestABI used inside the
191// implementation of subtype test cache stubs that are _not_ preserved.
192struct STCInternalRegs {
193 static constexpr Register kCacheEntryReg = RDI;
194 static constexpr Register kInstanceCidOrSignatureReg = R10;
196
197 static constexpr intptr_t kInternalRegisters =
200};
201
202// Calling convention when calling TypeTestingStub and SubtypeTestCacheStub.
203struct TypeTestABI {
204 static constexpr Register kInstanceReg = RAX;
205 static constexpr Register kDstTypeReg = RBX;
206 static constexpr Register kInstantiatorTypeArgumentsReg = RDX;
207 static constexpr Register kFunctionTypeArgumentsReg = RCX;
208 static constexpr Register kSubtypeTestCacheReg = R9;
209 static constexpr Register kScratchReg = RSI;
210
211 // For calls to InstanceOfStub.
212 static constexpr Register kInstanceOfResultReg = kInstanceReg;
213 // For calls to SubtypeNTestCacheStub. Must not overlap with any other
214 // registers above, for it is also used internally as kNullReg in those stubs.
215 static constexpr Register kSubtypeTestCacheResultReg = R8;
216
217 static constexpr intptr_t kPreservedAbiRegisters =
218 (1 << kInstanceReg) | (1 << kDstTypeReg) |
220
221 static constexpr intptr_t kNonPreservedAbiRegisters =
224 (1 << kScratchReg) | (1 << kSubtypeTestCacheResultReg) | (1 << CODE_REG);
225
226 static constexpr intptr_t kAbiRegisters =
228};
229
230// Calling convention when calling AssertSubtypeStub.
231struct AssertSubtypeABI {
232 static constexpr Register kSubTypeReg = RAX;
233 static constexpr Register kSuperTypeReg = RBX;
234 static constexpr Register kInstantiatorTypeArgumentsReg = RDX;
235 static constexpr Register kFunctionTypeArgumentsReg = RCX;
236 static constexpr Register kDstNameReg = R9;
237
238 static constexpr intptr_t kAbiRegisters =
239 (1 << kSubTypeReg) | (1 << kSuperTypeReg) |
241 (1 << kDstNameReg);
242
243 // No result register, as AssertSubtype is only run for side effect
244 // (throws if the subtype check fails).
245};
246
247// ABI for InitStaticFieldStub.
248struct InitStaticFieldABI {
249 static constexpr Register kFieldReg = RDX;
250 static constexpr Register kResultReg = RAX;
251};
252
253// Registers used inside the implementation of InitLateStaticFieldStub.
254struct InitLateStaticFieldInternalRegs {
255 static constexpr Register kAddressReg = RCX;
256 static constexpr Register kScratchReg = RSI;
257};
258
259// ABI for InitInstanceFieldStub.
260struct InitInstanceFieldABI {
261 static constexpr Register kInstanceReg = RBX;
262 static constexpr Register kFieldReg = RDX;
263 static constexpr Register kResultReg = RAX;
264};
265
266// Registers used inside the implementation of InitLateInstanceFieldStub.
267struct InitLateInstanceFieldInternalRegs {
268 static constexpr Register kAddressReg = RCX;
269 static constexpr Register kScratchReg = RSI;
270};
271
272// ABI for LateInitializationError stubs.
273struct LateInitializationErrorABI {
274 static constexpr Register kFieldReg = RSI;
275};
276
277// ABI for ThrowStub.
278struct ThrowABI {
279 static constexpr Register kExceptionReg = RAX;
280};
281
282// ABI for ReThrowStub.
283struct ReThrowABI {
284 static constexpr Register kExceptionReg = RAX;
285 static constexpr Register kStackTraceReg = RBX;
286};
287
288// ABI for AssertBooleanStub.
289struct AssertBooleanABI {
290 static constexpr Register kObjectReg = RAX;
291};
292
293// ABI for RangeErrorStub.
294struct RangeErrorABI {
295 static constexpr Register kLengthReg = RAX;
296 static constexpr Register kIndexReg = RBX;
297};
298
299// ABI for AllocateObjectStub.
300struct AllocateObjectABI {
301 static constexpr Register kResultReg = RAX;
302 static constexpr Register kTypeArgumentsReg = RDX;
303 static constexpr Register kTagsReg = R8;
304};
305
306// ABI for AllocateClosureStub.
307struct AllocateClosureABI {
309 static constexpr Register kFunctionReg = RBX;
310 static constexpr Register kContextReg = RDX;
311 static constexpr Register kInstantiatorTypeArgsReg = RCX;
312 static constexpr Register kScratchReg = R13;
313};
314
315// ABI for AllocateMintShared*Stub.
316struct AllocateMintABI {
318 static constexpr Register kTempReg = RBX;
319};
320
321// ABI for Allocate{Mint,Double,Float32x4,Float64x2}Stub.
322struct AllocateBoxABI {
324 static constexpr Register kTempReg = RBX;
325};
326
327// ABI for AllocateArrayStub.
328struct AllocateArrayABI {
330 static constexpr Register kLengthReg = R10;
331 static constexpr Register kTypeArgumentsReg = RBX;
332};
333
334// ABI for AllocateRecordStub.
335struct AllocateRecordABI {
337 static constexpr Register kShapeReg = RBX;
338 static constexpr Register kTemp1Reg = RDX;
339 static constexpr Register kTemp2Reg = RCX;
340};
341
342// ABI for AllocateSmallRecordStub (AllocateRecord2, AllocateRecord2Named,
343// AllocateRecord3, AllocateRecord3Named).
344struct AllocateSmallRecordABI {
346 static constexpr Register kShapeReg = R10;
347 static constexpr Register kValue0Reg = RBX;
348 static constexpr Register kValue1Reg = RDX;
349 static constexpr Register kValue2Reg = RCX;
350 static constexpr Register kTempReg = RDI;
351};
352
353// ABI for AllocateTypedDataArrayStub.
354struct AllocateTypedDataArrayABI {
356 static constexpr Register kLengthReg = kResultReg;
357};
358
359// ABI for BoxDoubleStub.
360struct BoxDoubleStubABI {
361 static constexpr FpuRegister kValueReg = XMM0;
362 static constexpr Register kTempReg = RBX;
363 static constexpr Register kResultReg = RAX;
364};
365
366// ABI for DoubleToIntegerStub.
367struct DoubleToIntegerStubABI {
368 static constexpr FpuRegister kInputReg = XMM0;
369 static constexpr Register kRecognizedKindReg = RAX;
370 static constexpr Register kResultReg = RAX;
371};
372
373// ABI for SuspendStub (AwaitStub, AwaitWithTypeCheckStub, YieldAsyncStarStub,
374// SuspendSyncStarAtStartStub, SuspendSyncStarAtYieldStub).
375struct SuspendStubABI {
376 static constexpr Register kArgumentReg = RAX;
377 static constexpr Register kTypeArgsReg = RDX; // Can be the same as kTempReg
378 static constexpr Register kTempReg = RDX;
379 static constexpr Register kFrameSizeReg = RCX;
380 static constexpr Register kSuspendStateReg = RBX;
381 static constexpr Register kFunctionDataReg = R8;
382 static constexpr Register kSrcFrameReg = RSI;
383 static constexpr Register kDstFrameReg = RDI;
384
385 // Number of bytes to skip after
386 // suspend stub return address in order to resume.
387 // X64: mov rsp, rbp; pop rbp; ret
388 static constexpr intptr_t kResumePcDistance = 5;
389};
390
391// ABI for InitSuspendableFunctionStub (InitAsyncStub, InitAsyncStarStub,
392// InitSyncStarStub).
393struct InitSuspendableFunctionStubABI {
394 static constexpr Register kTypeArgsReg = RAX;
395};
396
397// ABI for ResumeStub
398struct ResumeStubABI {
399 static constexpr Register kSuspendStateReg = RBX;
400 static constexpr Register kTempReg = RDX;
401 // Registers for the frame copying (the 1st part).
402 static constexpr Register kFrameSizeReg = RCX;
403 static constexpr Register kSrcFrameReg = RSI;
404 static constexpr Register kDstFrameReg = RDI;
405 // Registers for control transfer.
406 // (the 2nd part, can reuse registers from the 1st part)
407 static constexpr Register kResumePcReg = RCX;
408 // Can also reuse kSuspendStateReg but should not conflict with CODE_REG/PP.
409 static constexpr Register kExceptionReg = RSI;
410 static constexpr Register kStackTraceReg = RDI;
411};
412
413// ABI for ReturnStub (ReturnAsyncStub, ReturnAsyncNotFutureStub,
414// ReturnAsyncStarStub).
415struct ReturnStubABI {
416 static constexpr Register kSuspendStateReg = RBX;
417};
418
419// ABI for AsyncExceptionHandlerStub.
420struct AsyncExceptionHandlerStubABI {
421 static constexpr Register kSuspendStateReg = RBX;
422};
423
424// ABI for CloneSuspendStateStub.
425struct CloneSuspendStateStubABI {
426 static constexpr Register kSourceReg = RAX;
427 static constexpr Register kDestinationReg = RBX;
428 static constexpr Register kTempReg = RDX;
429 static constexpr Register kFrameSizeReg = RCX;
430 static constexpr Register kSrcFrameReg = RSI;
431 static constexpr Register kDstFrameReg = RDI;
432};
433
434// ABI for FfiAsyncCallbackSendStub.
435struct FfiAsyncCallbackSendStubABI {
436 static constexpr Register kArgsReg = RAX;
437};
438
439// ABI for DispatchTableNullErrorStub and consequently for all dispatch
440// table calls (though normal functions will not expect or use this
441// register). This ABI is added to distinguish memory corruption errors from
442// null errors.
443struct DispatchTableNullErrorABI {
444 static constexpr Register kClassIdReg = RCX;
445};
446
447typedef uint32_t RegList;
448const RegList kAllCpuRegistersList = 0xFFFF;
449const RegList kAllFpuRegistersList = 0xFFFF;
450
452 R(SPREG) | R(FPREG) | R(TMP) | R(PP) | R(THR);
453constexpr intptr_t kNumberOfReservedCpuRegisters =
455// CPU registers available to Dart allocator.
457 kAllCpuRegistersList & ~kReservedCpuRegisters;
458constexpr int kNumberOfDartAvailableCpuRegs =
460// Low numbered registers sometimes require fewer prefixes.
461constexpr int kRegisterAllocationBias = 0;
462constexpr int kStoreBufferWrapperSize = 13;
463
464#if defined(DART_TARGET_OS_WINDOWS)
466 R(RBX) | R(RSI) | R(RDI) | R(R12) | R(R13) | R(R14) | R(R15);
468 R(XMM0) | R(XMM1) | R(XMM2) | R(XMM3) | R(XMM4) | R(XMM5);
469#else
470const RegList kAbiPreservedCpuRegs = R(RBX) | R(R12) | R(R13) | R(R14) | R(R15);
472#endif
473
474// Registers available to Dart that are not preserved by runtime calls.
476 kDartAvailableCpuRegs & ~kAbiPreservedCpuRegs;
477
479 TIMES_1 = 0,
480 TIMES_2 = 1,
481 TIMES_4 = 2,
482 TIMES_8 = 3,
483 // Note that Intel addressing does not support this addressing.
484 // > Scale factor — A value of 2, 4, or 8 that is multiplied by the index
485 // > value.
486 // https://software.intel.com/en-us/download/intel-64-and-ia-32-architectures-sdm-combined-volumes-1-2a-2b-2c-2d-3a-3b-3c-3d-and-4
487 // 3.7.5 Specifying an Offset
488 TIMES_16 = 4,
489// We can't include vm/compiler/runtime_api.h, so just be explicit instead
490// of using (dart::)kWordSizeLog2.
491#if defined(TARGET_ARCH_IS_64_BIT)
492 // Used for Smi-boxed indices.
493 TIMES_HALF_WORD_SIZE = kInt64SizeLog2 - 1,
494 // Used for unboxed indices.
495 TIMES_WORD_SIZE = kInt64SizeLog2,
496#else
497#error "Unexpected word size"
498#endif
499#if !defined(DART_COMPRESSED_POINTERS)
500 TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE,
501#else
502 TIMES_COMPRESSED_WORD_SIZE = TIMES_HALF_WORD_SIZE,
503#endif
504 // Used for Smi-boxed indices.
506};
507
508class CallingConventions {
509 public:
510#if defined(DART_TARGET_OS_WINDOWS)
511 static constexpr Register kArg1Reg = RCX;
512 static constexpr Register kArg2Reg = RDX;
513 static constexpr Register kArg3Reg = R8;
514 static constexpr Register kArg4Reg = R9;
515 static const Register ArgumentRegisters[];
516 static constexpr intptr_t kArgumentRegisters =
518 static constexpr intptr_t kNumArgRegs = 4;
520
521 static const XmmRegister FpuArgumentRegisters[];
522 static constexpr intptr_t kFpuArgumentRegisters =
523 R(XMM0) | R(XMM1) | R(XMM2) | R(XMM3);
524 static constexpr intptr_t kNumFpuArgRegs = 4;
525
526 // Whether ArgumentRegisters[i] prevents using XmmArgumentRegisters[i] at the
527 // same time and vice versa.
528 static constexpr bool kArgumentIntRegXorFpuReg = true;
529
530 // AL not set on vararg calls in Windows.
532
533 // > The x64 Application Binary Interface (ABI) uses a four-register
534 // > fast-call calling convention by default. Space is allocated on the call
535 // > stack as a shadow store for callees to save those registers.
536 // https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-160
537 //
538 // The caller allocates this space. The caller should also reclaim this space
539 // after the call to restore the stack to its original state if needed.
540 //
541 // This is also known as home space.
542 // https://devblogs.microsoft.com/oldnewthing/20160623-00/?p=93735
543 static constexpr intptr_t kShadowSpaceBytes = 4 * kWordSize;
544
545 static constexpr intptr_t kVolatileCpuRegisters =
546 R(RAX) | R(RCX) | R(RDX) | R(R8) | R(R9) | R(R10) | R(R11);
547
549
550 static constexpr intptr_t kCalleeSaveXmmRegisters =
551 R(XMM6) | R(XMM7) | R(XMM8) | R(XMM9) | R(XMM10) | R(XMM11) | R(XMM12) |
552 R(XMM13) | R(XMM14) | R(XMM15);
553
554 static constexpr XmmRegister xmmFirstNonParameterReg = XMM4;
555
556 // Windows x64 ABI specifies that small objects are passed in registers.
557 // Otherwise they are passed by reference.
558 static const size_t kRegisterTransferLimit = 16;
559
560 static constexpr Register kReturnReg = RAX;
561 static constexpr Register kSecondReturnReg = RDX;
562 static constexpr FpuRegister kReturnFpuReg = XMM0;
564
565 // Whether larger than wordsize arguments are aligned to even registers.
570
571 // How stack arguments are aligned.
576
577 // How fields in compounds are aligned.
579
580 // Whether 1 or 2 byte-sized arguments or return values are passed extended
581 // to 4 bytes.
585
586#else
587 static constexpr Register kArg1Reg = RDI;
588 static constexpr Register kArg2Reg = RSI;
589 static constexpr Register kArg3Reg = RDX;
590 static constexpr Register kArg4Reg = RCX;
591 static constexpr Register kArg5Reg = R8;
592 static constexpr Register kArg6Reg = R9;
593 static const Register ArgumentRegisters[];
594 static constexpr intptr_t kArgumentRegisters = R(kArg1Reg) | R(kArg2Reg) |
595 R(kArg3Reg) | R(kArg4Reg) |
596 R(kArg5Reg) | R(kArg6Reg);
597 static constexpr intptr_t kNumArgRegs = 6;
599
600 static const XmmRegister FpuArgumentRegisters[];
601 static constexpr intptr_t kFpuArgumentRegisters =
602 R(XMM0) | R(XMM1) | R(XMM2) | R(XMM3) | R(XMM4) | R(XMM5) | R(XMM6) |
603 R(XMM7);
604 static constexpr intptr_t kNumFpuArgRegs = 8;
605
606 // Whether ArgumentRegisters[i] prevents using XmmArgumentRegisters[i] at the
607 // same time and vice versa.
608 static constexpr bool kArgumentIntRegXorFpuReg = false;
609
610 // > For calls that may call functions that use varargs or stdargs
611 // > (prototype-less calls or calls to functions containing ellipsis (...) in
612 // > the declaration) %al16 is used as hidden argument to specify the number
613 // > of vector registers used. The contents of %al do not need to match
614 // > exactly the number of registers, but must be an upper bound on the number
615 // > of vector registers used and is in the range 0–8 inclusive.
616 // System V ABI spec.
618
619 static constexpr intptr_t kShadowSpaceBytes = 0;
620
621 static constexpr intptr_t kVolatileCpuRegisters = R(RAX) | R(RCX) | R(RDX) |
622 R(RSI) | R(RDI) | R(R8) |
623 R(R9) | R(R10) | R(R11);
624
626
627 static constexpr intptr_t kCalleeSaveXmmRegisters = 0;
628
630
631 static constexpr Register kReturnReg = RAX;
632 static constexpr Register kSecondReturnReg = RDX;
633 static constexpr FpuRegister kReturnFpuReg = XMM0;
636
637 // Whether larger than wordsize arguments are aligned to even registers.
642
643 // How stack arguments are aligned.
648
649 // How fields in compounds are aligned.
651
652 // Whether 1 or 2 byte-sized arguments or return values are passed extended
653 // to 4 bytes.
654 // Note that `kReturnRegisterExtension != kArgumentRegisterExtension`, which
655 // effectively means that the caller is responsable for truncating and
656 // extending both arguments and return value.
660
661#endif
662
663 static constexpr intptr_t kCalleeSaveCpuRegisters = kAbiPreservedCpuRegs;
664
666
667 static constexpr Register kFfiAnyNonAbiRegister = R12;
668 static constexpr Register kFirstNonArgumentRegister = RAX;
669 static constexpr Register kSecondNonArgumentRegister = RBX;
670 static constexpr Register kStackPointerRegister = SPREG;
671
673
677};
678
679// Register based calling convention used for Dart functions.
680//
681// See |compiler::ComputeCallingConvention| for more details.
683 static constexpr Register kCpuRegistersForArgs[] = {RDI, RSI, RDX,
684 RBX, R8, R9};
685 static constexpr FpuRegister kFpuRegistersForArgs[] = {XMM1, XMM2, XMM3,
686 XMM4, XMM5, XMM6};
687};
688
689#undef R
690
691class Instr {
692 public:
693 static constexpr uint8_t kHltInstruction = 0xF4;
694 // We prefer not to use the int3 instruction since it conflicts with gdb.
695 static constexpr uint8_t kBreakPointInstruction = kHltInstruction;
696 static constexpr int kBreakPointInstructionSize = 1;
697 static constexpr uint8_t kGdbBreakpointInstruction = 0xcc;
698
701 return (*reinterpret_cast<const uint8_t*>(this)) == kBreakPointInstruction;
702 }
703
704 // Instructions are read out of a code stream. The only way to get a
705 // reference to an instruction is to convert a pointer. There is no way
706 // to allocate or create instances of class Instr.
707 // Use the At(pc) function to create references to Instr.
708 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); }
709
710 private:
711 DISALLOW_ALLOCATION();
712 // We need to prevent the creation of instances of class Instr.
714};
715
716// The largest multibyte nop we will emit. This could go up to 15 if it
717// becomes important to us.
718const int MAX_NOP_SIZE = 8;
719
720const uint64_t kBreakInstructionFiller = 0xCCCCCCCCCCCCCCCCL;
721
722// Based on presentation "Causes of Performance Instability due to Code
723// Placement in X86 - Zia Ansari, Intel"[1].
724//
725// [1]: https://www.youtube.com/watch?v=IX16gcX4vDQ
726const intptr_t kPreferredLoopAlignment = 32;
727
728} // namespace dart
729
730#endif // RUNTIME_VM_CONSTANTS_X64_H_
static constexpr ExtensionStrategy kArgumentStackExtension
static constexpr Register kSecondReturnReg
static constexpr XmmRegister xmmFirstNonParameterReg
static constexpr Register kVarArgFpuRegisterCount
static constexpr intptr_t kCalleeSaveCpuRegisters
static constexpr AlignmentStrategy kArgumentRegisterAlignmentVarArgs
static constexpr RegList kVolatileXmmRegisters
static constexpr AlignmentStrategy kFieldAlignment
static const FpuRegister FpuArgumentRegisters[]
static constexpr FpuRegister kSecondReturnFpuReg
static constexpr Register kArg5Reg
static const Register ArgumentRegisters[]
static constexpr bool kArgumentIntRegXorFpuReg
static constexpr intptr_t kVolatileCpuRegisters
COMPILE_ASSERT(((R(kFfiAnyNonAbiRegister)) &kCalleeSaveCpuRegisters) !=0)
static constexpr intptr_t kFpuArgumentRegisters
static constexpr FpuRegister kReturnFpuReg
static constexpr intptr_t kNumFpuArgRegs
static constexpr Register kPointerToReturnStructRegisterCall
static constexpr Register kFirstNonArgumentRegister
static constexpr Register kFfiAnyNonAbiRegister
static constexpr AlignmentStrategy kArgumentStackAlignmentVarArgs
static constexpr Register kPointerToReturnStructRegisterReturn
static constexpr AlignmentStrategy kArgumentRegisterAlignment
static constexpr Register kArg3Reg
static constexpr ExtensionStrategy kReturnRegisterExtension
COMPILE_ASSERT((kArgumentRegisters &kReservedCpuRegisters)==0)
static constexpr Register kArg6Reg
static constexpr Register kArg1Reg
COMPILE_ASSERT(((R(kFirstNonArgumentRegister)|R(kSecondNonArgumentRegister)) &(kArgumentRegisters|R(kPointerToReturnStructRegisterCall)))==0)
static constexpr Register kStackPointerRegister
static constexpr Register kReturnReg
static constexpr intptr_t kArgumentRegisters
static constexpr Register kSecondNonArgumentRegister
static constexpr Register kArg2Reg
static constexpr ExtensionStrategy kArgumentRegisterExtension
static constexpr intptr_t kShadowSpaceBytes
static constexpr Register kArg4Reg
static constexpr intptr_t kNumArgRegs
static constexpr AlignmentStrategy kArgumentStackAlignment
static constexpr intptr_t kCalleeSaveXmmRegisters
static Instr * At(uword pc)
static constexpr int32_t kBreakPointInstruction
static constexpr int kBreakPointInstructionSize
static constexpr uint8_t kHltInstruction
bool IsBreakPoint()
static constexpr uint8_t kGdbBreakpointInstruction
static constexpr int CountOneBits32(uint32_t x)
Definition utils.h:145
#define ASSERT(E)
#define R(r)
ExtensionStrategy
@ kExtendedTo4
@ kNotExtended
const FpuRegister kNoFpuRegister
const Register kWriteBarrierSlotReg
@ TIMES_COMPRESSED_HALF_WORD_SIZE
@ TIMES_COMPRESSED_WORD_SIZE
const Register THR
const Register kExceptionObjectReg
const RegList kReservedCpuRegisters
const Register kWriteBarrierObjectReg
const RegList kAllFpuRegistersList
const Register kWriteBarrierValueReg
uint16_t RegList
const char *const fpu_reg_names[kNumberOfFpuRegisters]
const FpuRegister FpuTMP
const Register CALLEE_SAVED_TEMP
uintptr_t uword
Definition globals.h:501
const Register CODE_REG
constexpr uword kBreakInstructionFiller
const Register TMP2
const Register ARGS_DESC_REG
@ kNumberOfCpuRegisters
@ kNoRegister
const int kNumberOfFpuRegisters
const RegList kAbiPreservedCpuRegs
constexpr RegList kDartAvailableCpuRegs
const Register TMP
const RegList kDartVolatileCpuRegs
const Register FPREG
const intptr_t kStoreBufferWrapperSize
constexpr int kRegisterAllocationBias
const int MAX_NOP_SIZE
const Register FUNCTION_REG
constexpr intptr_t kNumberOfReservedCpuRegisters
const Register IC_DATA_REG
const char *const cpu_reg_names[kNumberOfCpuRegisters]
constexpr intptr_t kInt64SizeLog2
Definition globals.h:452
constexpr intptr_t kWordSize
Definition globals.h:509
const Register PP
@ kNoByteRegister
@ kNumberOfByteRegisters
QRegister FpuRegister
const Register kStackTraceObjectReg
const RegList kAllCpuRegistersList
const intptr_t kPreferredLoopAlignment
simd128_value_t fpu_register_t
const char *const cpu_reg_byte_names[kNumberOfByteRegisters]
const RegList kAbiVolatileFpuRegs
const Register SPREG
AlignmentStrategy
@ kAlignedToValueSize
@ kAlignedToWordSize
const char *const cpu_reg_abi_names[kNumberOfCpuRegisters]
const int kFpuRegisterSize
constexpr int kNumberOfDartAvailableCpuRegs
ByteRegister ByteRegisterOf(Register reg)
@ kNumberOfXmmRegisters
@ kNoXmmRegister
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName)
Definition globals.h:593
static constexpr Register kResultReg
static constexpr Register kLengthReg
static constexpr Register kTypeArgumentsReg
static constexpr Register kResultReg
static constexpr Register kTempReg
static constexpr Register kFunctionReg
static constexpr Register kContextReg
static constexpr Register kResultReg
static constexpr Register kInstantiatorTypeArgsReg
static constexpr Register kScratchReg
static constexpr Register kResultReg
static constexpr Register kTempReg
static constexpr Register kTypeArgumentsReg
static constexpr Register kResultReg
static constexpr Register kTagsReg
static constexpr Register kShapeReg
static constexpr Register kResultReg
static constexpr Register kTemp1Reg
static constexpr Register kTemp2Reg
static constexpr Register kResultReg
static constexpr Register kShapeReg
static constexpr Register kValue2Reg
static constexpr Register kValue0Reg
static constexpr Register kTempReg
static constexpr Register kValue1Reg
static constexpr Register kLengthReg
static constexpr Register kResultReg
static constexpr Register kObjectReg
static constexpr Register kSubTypeReg
static constexpr Register kSuperTypeReg
static constexpr Register kFunctionTypeArgumentsReg
static constexpr intptr_t kAbiRegisters
static constexpr Register kInstantiatorTypeArgumentsReg
static constexpr Register kDstNameReg
static constexpr Register kSuspendStateReg
static constexpr Register kTempReg
static constexpr Register kResultReg
static constexpr FpuRegister kValueReg
static constexpr Register kDestinationReg
static constexpr Register kSrcFrameReg
static constexpr Register kFrameSizeReg
static constexpr Register kSourceReg
static constexpr Register kTempReg
static constexpr Register kDstFrameReg
static constexpr Register kCpuRegistersForArgs[]
static constexpr FpuRegister kFpuRegistersForArgs[]
static constexpr Register kClassIdReg
static constexpr Register kResultReg
static constexpr Register kRecognizedKindReg
static constexpr FpuRegister kInputReg
static constexpr Register kArgsReg
static constexpr Register kFieldReg
static constexpr Register kResultReg
static constexpr Register kInstanceReg
static constexpr Register kAddressReg
static constexpr Register kScratchReg
static constexpr Register kAddressReg
static constexpr Register kScratchReg
static constexpr Register kResultReg
static constexpr Register kFieldReg
static constexpr Register kTypeArgsReg
static constexpr Register kEntryStartReg
static constexpr intptr_t kSavedRegisters
static constexpr Register kCurrentEntryIndexReg
static constexpr Register kProbeMaskReg
static constexpr Register kProbeDistanceReg
static constexpr Register kInstantiatorTypeArgumentsReg
static constexpr Register kScratchReg
static constexpr Register kResultTypeReg
static constexpr Register kUninstantiatedTypeArgumentsReg
static constexpr Register kResultTypeArgumentsReg
static constexpr Register kFunctionTypeArgumentsReg
static constexpr Register kFieldReg
static constexpr Register kLengthReg
static constexpr Register kIndexReg
static constexpr Register kStackTraceReg
static constexpr Register kExceptionReg
static constexpr Register kSrcFrameReg
static constexpr Register kDstFrameReg
static constexpr Register kFrameSizeReg
static constexpr Register kSuspendStateReg
static constexpr Register kExceptionReg
static constexpr Register kTempReg
static constexpr Register kResumePcReg
static constexpr Register kStackTraceReg
static constexpr Register kSuspendStateReg
static constexpr Register kInstanceInstantiatorTypeArgumentsReg
static constexpr intptr_t kInternalRegisters
static constexpr Register kInstanceCidOrSignatureReg
static constexpr Register kCacheEntryReg
static constexpr Register kResultReg
static constexpr Register kSrcFrameReg
static constexpr Register kFunctionDataReg
static constexpr Register kSuspendStateReg
static constexpr intptr_t kResumePcDistance
static constexpr Register kTempReg
static constexpr Register kArgumentReg
static constexpr Register kDstFrameReg
static constexpr Register kTypeArgsReg
static constexpr Register kFrameSizeReg
static constexpr intptr_t kInternalRegisters
static constexpr intptr_t kSavedTypeArgumentRegisters
static constexpr Register kSuperTypeArgumentReg
static constexpr Register kSubTypeArgumentReg
static constexpr Register kInstanceTypeArgumentsReg
static constexpr Register kScratchReg
static constexpr Register kExceptionReg
static constexpr Register kSubtypeTestCacheReg
static constexpr Register kDstTypeReg
static constexpr Register kInstanceReg
static constexpr Register kFunctionTypeArgumentsReg
static constexpr Register kInstantiatorTypeArgumentsReg
static constexpr intptr_t kNonPreservedAbiRegisters
static constexpr Register kSubtypeTestCacheResultReg
static constexpr intptr_t kPreservedAbiRegisters
static constexpr Register kScratchReg
static constexpr intptr_t kAbiRegisters
static constexpr Register kInstanceOfResultReg