1*9880d681SAndroid Build Coastguard Worker===================================== 2*9880d681SAndroid Build Coastguard WorkerGarbage Collection Safepoints in LLVM 3*9880d681SAndroid Build Coastguard Worker===================================== 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Worker.. contents:: 6*9880d681SAndroid Build Coastguard Worker :local: 7*9880d681SAndroid Build Coastguard Worker :depth: 2 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard WorkerStatus 10*9880d681SAndroid Build Coastguard Worker======= 11*9880d681SAndroid Build Coastguard Worker 12*9880d681SAndroid Build Coastguard WorkerThis document describes a set of experimental extensions to LLVM. Use 13*9880d681SAndroid Build Coastguard Workerwith caution. Because the intrinsics have experimental status, 14*9880d681SAndroid Build Coastguard Workercompatibility across LLVM releases is not guaranteed. 15*9880d681SAndroid Build Coastguard Worker 16*9880d681SAndroid Build Coastguard WorkerLLVM currently supports an alternate mechanism for conservative 17*9880d681SAndroid Build Coastguard Workergarbage collection support using the ``gcroot`` intrinsic. The mechanism 18*9880d681SAndroid Build Coastguard Workerdescribed here shares little in common with the alternate ``gcroot`` 19*9880d681SAndroid Build Coastguard Workerimplementation and it is hoped that this mechanism will eventually 20*9880d681SAndroid Build Coastguard Workerreplace the gc_root mechanism. 21*9880d681SAndroid Build Coastguard Worker 22*9880d681SAndroid Build Coastguard WorkerOverview 23*9880d681SAndroid Build Coastguard Worker======== 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard WorkerTo collect dead objects, garbage collectors must be able to identify 26*9880d681SAndroid Build Coastguard Workerany references to objects contained within executing code, and, 27*9880d681SAndroid Build Coastguard Workerdepending on the collector, potentially update them. The collector 28*9880d681SAndroid Build Coastguard Workerdoes not need this information at all points in code - that would make 29*9880d681SAndroid Build Coastguard Workerthe problem much harder - but only at well-defined points in the 30*9880d681SAndroid Build Coastguard Workerexecution known as 'safepoints' For most collectors, it is sufficient 31*9880d681SAndroid Build Coastguard Workerto track at least one copy of each unique pointer value. However, for 32*9880d681SAndroid Build Coastguard Workera collector which wishes to relocate objects directly reachable from 33*9880d681SAndroid Build Coastguard Workerrunning code, a higher standard is required. 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard WorkerOne additional challenge is that the compiler may compute intermediate 36*9880d681SAndroid Build Coastguard Workerresults ("derived pointers") which point outside of the allocation or 37*9880d681SAndroid Build Coastguard Workereven into the middle of another allocation. The eventual use of this 38*9880d681SAndroid Build Coastguard Workerintermediate value must yield an address within the bounds of the 39*9880d681SAndroid Build Coastguard Workerallocation, but such "exterior derived pointers" may be visible to the 40*9880d681SAndroid Build Coastguard Workercollector. Given this, a garbage collector can not safely rely on the 41*9880d681SAndroid Build Coastguard Workerruntime value of an address to indicate the object it is associated 42*9880d681SAndroid Build Coastguard Workerwith. If the garbage collector wishes to move any object, the 43*9880d681SAndroid Build Coastguard Workercompiler must provide a mapping, for each pointer, to an indication of 44*9880d681SAndroid Build Coastguard Workerits allocation. 45*9880d681SAndroid Build Coastguard Worker 46*9880d681SAndroid Build Coastguard WorkerTo simplify the interaction between a collector and the compiled code, 47*9880d681SAndroid Build Coastguard Workermost garbage collectors are organized in terms of three abstractions: 48*9880d681SAndroid Build Coastguard Workerload barriers, store barriers, and safepoints. 49*9880d681SAndroid Build Coastguard Worker 50*9880d681SAndroid Build Coastguard Worker#. A load barrier is a bit of code executed immediately after the 51*9880d681SAndroid Build Coastguard Worker machine load instruction, but before any use of the value loaded. 52*9880d681SAndroid Build Coastguard Worker Depending on the collector, such a barrier may be needed for all 53*9880d681SAndroid Build Coastguard Worker loads, merely loads of a particular type (in the original source 54*9880d681SAndroid Build Coastguard Worker language), or none at all. 55*9880d681SAndroid Build Coastguard Worker 56*9880d681SAndroid Build Coastguard Worker#. Analogously, a store barrier is a code fragment that runs 57*9880d681SAndroid Build Coastguard Worker immediately before the machine store instruction, but after the 58*9880d681SAndroid Build Coastguard Worker computation of the value stored. The most common use of a store 59*9880d681SAndroid Build Coastguard Worker barrier is to update a 'card table' in a generational garbage 60*9880d681SAndroid Build Coastguard Worker collector. 61*9880d681SAndroid Build Coastguard Worker 62*9880d681SAndroid Build Coastguard Worker#. A safepoint is a location at which pointers visible to the compiled 63*9880d681SAndroid Build Coastguard Worker code (i.e. currently in registers or on the stack) are allowed to 64*9880d681SAndroid Build Coastguard Worker change. After the safepoint completes, the actual pointer value 65*9880d681SAndroid Build Coastguard Worker may differ, but the 'object' (as seen by the source language) 66*9880d681SAndroid Build Coastguard Worker pointed to will not. 67*9880d681SAndroid Build Coastguard Worker 68*9880d681SAndroid Build Coastguard Worker Note that the term 'safepoint' is somewhat overloaded. It refers to 69*9880d681SAndroid Build Coastguard Worker both the location at which the machine state is parsable and the 70*9880d681SAndroid Build Coastguard Worker coordination protocol involved in bring application threads to a 71*9880d681SAndroid Build Coastguard Worker point at which the collector can safely use that information. The 72*9880d681SAndroid Build Coastguard Worker term "statepoint" as used in this document refers exclusively to the 73*9880d681SAndroid Build Coastguard Worker former. 74*9880d681SAndroid Build Coastguard Worker 75*9880d681SAndroid Build Coastguard WorkerThis document focuses on the last item - compiler support for 76*9880d681SAndroid Build Coastguard Workersafepoints in generated code. We will assume that an outside 77*9880d681SAndroid Build Coastguard Workermechanism has decided where to place safepoints. From our 78*9880d681SAndroid Build Coastguard Workerperspective, all safepoints will be function calls. To support 79*9880d681SAndroid Build Coastguard Workerrelocation of objects directly reachable from values in compiled code, 80*9880d681SAndroid Build Coastguard Workerthe collector must be able to: 81*9880d681SAndroid Build Coastguard Worker 82*9880d681SAndroid Build Coastguard Worker#. identify every copy of a pointer (including copies introduced by 83*9880d681SAndroid Build Coastguard Worker the compiler itself) at the safepoint, 84*9880d681SAndroid Build Coastguard Worker#. identify which object each pointer relates to, and 85*9880d681SAndroid Build Coastguard Worker#. potentially update each of those copies. 86*9880d681SAndroid Build Coastguard Worker 87*9880d681SAndroid Build Coastguard WorkerThis document describes the mechanism by which an LLVM based compiler 88*9880d681SAndroid Build Coastguard Workercan provide this information to a language runtime/collector, and 89*9880d681SAndroid Build Coastguard Workerensure that all pointers can be read and updated if desired. The 90*9880d681SAndroid Build Coastguard Workerheart of the approach is to construct (or rewrite) the IR in a manner 91*9880d681SAndroid Build Coastguard Workerwhere the possible updates performed by the garbage collector are 92*9880d681SAndroid Build Coastguard Workerexplicitly visible in the IR. Doing so requires that we: 93*9880d681SAndroid Build Coastguard Worker 94*9880d681SAndroid Build Coastguard Worker#. create a new SSA value for each potentially relocated pointer, and 95*9880d681SAndroid Build Coastguard Worker ensure that no uses of the original (non relocated) value is 96*9880d681SAndroid Build Coastguard Worker reachable after the safepoint, 97*9880d681SAndroid Build Coastguard Worker#. specify the relocation in a way which is opaque to the compiler to 98*9880d681SAndroid Build Coastguard Worker ensure that the optimizer can not introduce new uses of an 99*9880d681SAndroid Build Coastguard Worker unrelocated value after a statepoint. This prevents the optimizer 100*9880d681SAndroid Build Coastguard Worker from performing unsound optimizations. 101*9880d681SAndroid Build Coastguard Worker#. recording a mapping of live pointers (and the allocation they're 102*9880d681SAndroid Build Coastguard Worker associated with) for each statepoint. 103*9880d681SAndroid Build Coastguard Worker 104*9880d681SAndroid Build Coastguard WorkerAt the most abstract level, inserting a safepoint can be thought of as 105*9880d681SAndroid Build Coastguard Workerreplacing a call instruction with a call to a multiple return value 106*9880d681SAndroid Build Coastguard Workerfunction which both calls the original target of the call, returns 107*9880d681SAndroid Build Coastguard Workerit's result, and returns updated values for any live pointers to 108*9880d681SAndroid Build Coastguard Workergarbage collected objects. 109*9880d681SAndroid Build Coastguard Worker 110*9880d681SAndroid Build Coastguard Worker Note that the task of identifying all live pointers to garbage 111*9880d681SAndroid Build Coastguard Worker collected values, transforming the IR to expose a pointer giving the 112*9880d681SAndroid Build Coastguard Worker base object for every such live pointer, and inserting all the 113*9880d681SAndroid Build Coastguard Worker intrinsics correctly is explicitly out of scope for this document. 114*9880d681SAndroid Build Coastguard Worker The recommended approach is to use the :ref:`utility passes 115*9880d681SAndroid Build Coastguard Worker <statepoint-utilities>` described below. 116*9880d681SAndroid Build Coastguard Worker 117*9880d681SAndroid Build Coastguard WorkerThis abstract function call is concretely represented by a sequence of 118*9880d681SAndroid Build Coastguard Workerintrinsic calls known collectively as a "statepoint relocation sequence". 119*9880d681SAndroid Build Coastguard Worker 120*9880d681SAndroid Build Coastguard WorkerLet's consider a simple call in LLVM IR: 121*9880d681SAndroid Build Coastguard Worker 122*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm 123*9880d681SAndroid Build Coastguard Worker 124*9880d681SAndroid Build Coastguard Worker define i8 addrspace(1)* @test1(i8 addrspace(1)* %obj) 125*9880d681SAndroid Build Coastguard Worker gc "statepoint-example" { 126*9880d681SAndroid Build Coastguard Worker call void ()* @foo() 127*9880d681SAndroid Build Coastguard Worker ret i8 addrspace(1)* %obj 128*9880d681SAndroid Build Coastguard Worker } 129*9880d681SAndroid Build Coastguard Worker 130*9880d681SAndroid Build Coastguard WorkerDepending on our language we may need to allow a safepoint during the execution 131*9880d681SAndroid Build Coastguard Workerof ``foo``. If so, we need to let the collector update local values in the 132*9880d681SAndroid Build Coastguard Workercurrent frame. If we don't, we'll be accessing a potential invalid reference 133*9880d681SAndroid Build Coastguard Workeronce we eventually return from the call. 134*9880d681SAndroid Build Coastguard Worker 135*9880d681SAndroid Build Coastguard WorkerIn this example, we need to relocate the SSA value ``%obj``. Since we can't 136*9880d681SAndroid Build Coastguard Workeractually change the value in the SSA value ``%obj``, we need to introduce a new 137*9880d681SAndroid Build Coastguard WorkerSSA value ``%obj.relocated`` which represents the potentially changed value of 138*9880d681SAndroid Build Coastguard Worker``%obj`` after the safepoint and update any following uses appropriately. The 139*9880d681SAndroid Build Coastguard Workerresulting relocation sequence is: 140*9880d681SAndroid Build Coastguard Worker 141*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm 142*9880d681SAndroid Build Coastguard Worker 143*9880d681SAndroid Build Coastguard Worker define i8 addrspace(1)* @test1(i8 addrspace(1)* %obj) 144*9880d681SAndroid Build Coastguard Worker gc "statepoint-example" { 145*9880d681SAndroid Build Coastguard Worker %0 = call token (i64, i32, void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 0, i8 addrspace(1)* %obj) 146*9880d681SAndroid Build Coastguard Worker %obj.relocated = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %0, i32 7, i32 7) 147*9880d681SAndroid Build Coastguard Worker ret i8 addrspace(1)* %obj.relocated 148*9880d681SAndroid Build Coastguard Worker } 149*9880d681SAndroid Build Coastguard Worker 150*9880d681SAndroid Build Coastguard WorkerIdeally, this sequence would have been represented as a M argument, N 151*9880d681SAndroid Build Coastguard Workerreturn value function (where M is the number of values being 152*9880d681SAndroid Build Coastguard Workerrelocated + the original call arguments and N is the original return 153*9880d681SAndroid Build Coastguard Workervalue + each relocated value), but LLVM does not easily support such a 154*9880d681SAndroid Build Coastguard Workerrepresentation. 155*9880d681SAndroid Build Coastguard Worker 156*9880d681SAndroid Build Coastguard WorkerInstead, the statepoint intrinsic marks the actual site of the 157*9880d681SAndroid Build Coastguard Workersafepoint or statepoint. The statepoint returns a token value (which 158*9880d681SAndroid Build Coastguard Workerexists only at compile time). To get back the original return value 159*9880d681SAndroid Build Coastguard Workerof the call, we use the ``gc.result`` intrinsic. To get the relocation 160*9880d681SAndroid Build Coastguard Workerof each pointer in turn, we use the ``gc.relocate`` intrinsic with the 161*9880d681SAndroid Build Coastguard Workerappropriate index. Note that both the ``gc.relocate`` and ``gc.result`` are 162*9880d681SAndroid Build Coastguard Workertied to the statepoint. The combination forms a "statepoint relocation 163*9880d681SAndroid Build Coastguard Workersequence" and represents the entirety of a parseable call or 'statepoint'. 164*9880d681SAndroid Build Coastguard Worker 165*9880d681SAndroid Build Coastguard WorkerWhen lowered, this example would generate the following x86 assembly: 166*9880d681SAndroid Build Coastguard Worker 167*9880d681SAndroid Build Coastguard Worker.. code-block:: gas 168*9880d681SAndroid Build Coastguard Worker 169*9880d681SAndroid Build Coastguard Worker .globl test1 170*9880d681SAndroid Build Coastguard Worker .align 16, 0x90 171*9880d681SAndroid Build Coastguard Worker pushq %rax 172*9880d681SAndroid Build Coastguard Worker callq foo 173*9880d681SAndroid Build Coastguard Worker .Ltmp1: 174*9880d681SAndroid Build Coastguard Worker movq (%rsp), %rax # This load is redundant (oops!) 175*9880d681SAndroid Build Coastguard Worker popq %rdx 176*9880d681SAndroid Build Coastguard Worker retq 177*9880d681SAndroid Build Coastguard Worker 178*9880d681SAndroid Build Coastguard WorkerEach of the potentially relocated values has been spilled to the 179*9880d681SAndroid Build Coastguard Workerstack, and a record of that location has been recorded to the 180*9880d681SAndroid Build Coastguard Worker:ref:`Stack Map section <stackmap-section>`. If the garbage collector 181*9880d681SAndroid Build Coastguard Workerneeds to update any of these pointers during the call, it knows 182*9880d681SAndroid Build Coastguard Workerexactly what to change. 183*9880d681SAndroid Build Coastguard Worker 184*9880d681SAndroid Build Coastguard WorkerThe relevant parts of the StackMap section for our example are: 185*9880d681SAndroid Build Coastguard Worker 186*9880d681SAndroid Build Coastguard Worker.. code-block:: gas 187*9880d681SAndroid Build Coastguard Worker 188*9880d681SAndroid Build Coastguard Worker # This describes the call site 189*9880d681SAndroid Build Coastguard Worker # Stack Maps: callsite 2882400000 190*9880d681SAndroid Build Coastguard Worker .quad 2882400000 191*9880d681SAndroid Build Coastguard Worker .long .Ltmp1-test1 192*9880d681SAndroid Build Coastguard Worker .short 0 193*9880d681SAndroid Build Coastguard Worker # .. 8 entries skipped .. 194*9880d681SAndroid Build Coastguard Worker # This entry describes the spill slot which is directly addressable 195*9880d681SAndroid Build Coastguard Worker # off RSP with offset 0. Given the value was spilled with a pushq, 196*9880d681SAndroid Build Coastguard Worker # that makes sense. 197*9880d681SAndroid Build Coastguard Worker # Stack Maps: Loc 8: Direct RSP [encoding: .byte 2, .byte 8, .short 7, .int 0] 198*9880d681SAndroid Build Coastguard Worker .byte 2 199*9880d681SAndroid Build Coastguard Worker .byte 8 200*9880d681SAndroid Build Coastguard Worker .short 7 201*9880d681SAndroid Build Coastguard Worker .long 0 202*9880d681SAndroid Build Coastguard Worker 203*9880d681SAndroid Build Coastguard WorkerThis example was taken from the tests for the :ref:`RewriteStatepointsForGC` utility pass. As such, it's full StackMap can be easily examined with the following command. 204*9880d681SAndroid Build Coastguard Worker 205*9880d681SAndroid Build Coastguard Worker.. code-block:: bash 206*9880d681SAndroid Build Coastguard Worker 207*9880d681SAndroid Build Coastguard Worker opt -rewrite-statepoints-for-gc test/Transforms/RewriteStatepointsForGC/basics.ll -S | llc -debug-only=stackmaps 208*9880d681SAndroid Build Coastguard Worker 209*9880d681SAndroid Build Coastguard WorkerBase & Derived Pointers 210*9880d681SAndroid Build Coastguard Worker^^^^^^^^^^^^^^^^^^^^^^^ 211*9880d681SAndroid Build Coastguard Worker 212*9880d681SAndroid Build Coastguard WorkerA "base pointer" is one which points to the starting address of an allocation 213*9880d681SAndroid Build Coastguard Worker(object). A "derived pointer" is one which is offset from a base pointer by 214*9880d681SAndroid Build Coastguard Workersome amount. When relocating objects, a garbage collector needs to be able 215*9880d681SAndroid Build Coastguard Workerto relocate each derived pointer associated with an allocation to the same 216*9880d681SAndroid Build Coastguard Workeroffset from the new address. 217*9880d681SAndroid Build Coastguard Worker 218*9880d681SAndroid Build Coastguard Worker"Interior derived pointers" remain within the bounds of the allocation 219*9880d681SAndroid Build Coastguard Workerthey're associated with. As a result, the base object can be found at 220*9880d681SAndroid Build Coastguard Workerruntime provided the bounds of allocations are known to the runtime system. 221*9880d681SAndroid Build Coastguard Worker 222*9880d681SAndroid Build Coastguard Worker"Exterior derived pointers" are outside the bounds of the associated object; 223*9880d681SAndroid Build Coastguard Workerthey may even fall within *another* allocations address range. As a result, 224*9880d681SAndroid Build Coastguard Workerthere is no way for a garbage collector to determine which allocation they 225*9880d681SAndroid Build Coastguard Workerare associated with at runtime and compiler support is needed. 226*9880d681SAndroid Build Coastguard Worker 227*9880d681SAndroid Build Coastguard WorkerThe ``gc.relocate`` intrinsic supports an explicit operand for describing the 228*9880d681SAndroid Build Coastguard Workerallocation associated with a derived pointer. This operand is frequently 229*9880d681SAndroid Build Coastguard Workerreferred to as the base operand, but does not strictly speaking have to be 230*9880d681SAndroid Build Coastguard Workera base pointer, but it does need to lie within the bounds of the associated 231*9880d681SAndroid Build Coastguard Workerallocation. Some collectors may require that the operand be an actual base 232*9880d681SAndroid Build Coastguard Workerpointer rather than merely an internal derived pointer. Note that during 233*9880d681SAndroid Build Coastguard Workerlowering both the base and derived pointer operands are required to be live 234*9880d681SAndroid Build Coastguard Workerover the associated call safepoint even if the base is otherwise unused 235*9880d681SAndroid Build Coastguard Workerafterwards. 236*9880d681SAndroid Build Coastguard Worker 237*9880d681SAndroid Build Coastguard WorkerIf we extend our previous example to include a pointless derived pointer, 238*9880d681SAndroid Build Coastguard Workerwe get: 239*9880d681SAndroid Build Coastguard Worker 240*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm 241*9880d681SAndroid Build Coastguard Worker 242*9880d681SAndroid Build Coastguard Worker define i8 addrspace(1)* @test1(i8 addrspace(1)* %obj) 243*9880d681SAndroid Build Coastguard Worker gc "statepoint-example" { 244*9880d681SAndroid Build Coastguard Worker %gep = getelementptr i8, i8 addrspace(1)* %obj, i64 20000 245*9880d681SAndroid Build Coastguard Worker %token = call token (i64, i32, void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 0, i8 addrspace(1)* %obj, i8 addrspace(1)* %gep) 246*9880d681SAndroid Build Coastguard Worker %obj.relocated = call i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %token, i32 7, i32 7) 247*9880d681SAndroid Build Coastguard Worker %gep.relocated = call i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %token, i32 7, i32 8) 248*9880d681SAndroid Build Coastguard Worker %p = getelementptr i8, i8 addrspace(1)* %gep, i64 -20000 249*9880d681SAndroid Build Coastguard Worker ret i8 addrspace(1)* %p 250*9880d681SAndroid Build Coastguard Worker } 251*9880d681SAndroid Build Coastguard Worker 252*9880d681SAndroid Build Coastguard WorkerNote that in this example %p and %obj.relocate are the same address and we 253*9880d681SAndroid Build Coastguard Workercould replace one with the other, potentially removing the derived pointer 254*9880d681SAndroid Build Coastguard Workerfrom the live set at the safepoint entirely. 255*9880d681SAndroid Build Coastguard Worker 256*9880d681SAndroid Build Coastguard Worker.. _gc_transition_args: 257*9880d681SAndroid Build Coastguard Worker 258*9880d681SAndroid Build Coastguard WorkerGC Transitions 259*9880d681SAndroid Build Coastguard Worker^^^^^^^^^^^^^^^^^^ 260*9880d681SAndroid Build Coastguard Worker 261*9880d681SAndroid Build Coastguard WorkerAs a practical consideration, many garbage-collected systems allow code that is 262*9880d681SAndroid Build Coastguard Workercollector-aware ("managed code") to call code that is not collector-aware 263*9880d681SAndroid Build Coastguard Worker("unmanaged code"). It is common that such calls must also be safepoints, since 264*9880d681SAndroid Build Coastguard Workerit is desirable to allow the collector to run during the execution of 265*9880d681SAndroid Build Coastguard Workerunmanaged code. Furthermore, it is common that coordinating the transition from 266*9880d681SAndroid Build Coastguard Workermanaged to unmanaged code requires extra code generation at the call site to 267*9880d681SAndroid Build Coastguard Workerinform the collector of the transition. In order to support these needs, a 268*9880d681SAndroid Build Coastguard Workerstatepoint may be marked as a GC transition, and data that is necessary to 269*9880d681SAndroid Build Coastguard Workerperform the transition (if any) may be provided as additional arguments to the 270*9880d681SAndroid Build Coastguard Workerstatepoint. 271*9880d681SAndroid Build Coastguard Worker 272*9880d681SAndroid Build Coastguard Worker Note that although in many cases statepoints may be inferred to be GC 273*9880d681SAndroid Build Coastguard Worker transitions based on the function symbols involved (e.g. a call from a 274*9880d681SAndroid Build Coastguard Worker function with GC strategy "foo" to a function with GC strategy "bar"), 275*9880d681SAndroid Build Coastguard Worker indirect calls that are also GC transitions must also be supported. This 276*9880d681SAndroid Build Coastguard Worker requirement is the driving force behind the decision to require that GC 277*9880d681SAndroid Build Coastguard Worker transitions are explicitly marked. 278*9880d681SAndroid Build Coastguard Worker 279*9880d681SAndroid Build Coastguard WorkerLet's revisit the sample given above, this time treating the call to ``@foo`` 280*9880d681SAndroid Build Coastguard Workeras a GC transition. Depending on our target, the transition code may need to 281*9880d681SAndroid Build Coastguard Workeraccess some extra state in order to inform the collector of the transition. 282*9880d681SAndroid Build Coastguard WorkerLet's assume a hypothetical GC--somewhat unimaginatively named "hypothetical-gc" 283*9880d681SAndroid Build Coastguard Worker--that requires that a TLS variable must be written to before and after a call 284*9880d681SAndroid Build Coastguard Workerto unmanaged code. The resulting relocation sequence is: 285*9880d681SAndroid Build Coastguard Worker 286*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm 287*9880d681SAndroid Build Coastguard Worker 288*9880d681SAndroid Build Coastguard Worker @flag = thread_local global i32 0, align 4 289*9880d681SAndroid Build Coastguard Worker 290*9880d681SAndroid Build Coastguard Worker define i8 addrspace(1)* @test1(i8 addrspace(1) *%obj) 291*9880d681SAndroid Build Coastguard Worker gc "hypothetical-gc" { 292*9880d681SAndroid Build Coastguard Worker 293*9880d681SAndroid Build Coastguard Worker %0 = call token (i64, i32, void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @foo, i32 0, i32 1, i32* @Flag, i32 0, i8 addrspace(1)* %obj) 294*9880d681SAndroid Build Coastguard Worker %obj.relocated = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %0, i32 7, i32 7) 295*9880d681SAndroid Build Coastguard Worker ret i8 addrspace(1)* %obj.relocated 296*9880d681SAndroid Build Coastguard Worker } 297*9880d681SAndroid Build Coastguard Worker 298*9880d681SAndroid Build Coastguard WorkerDuring lowering, this will result in a instruction selection DAG that looks 299*9880d681SAndroid Build Coastguard Workersomething like: 300*9880d681SAndroid Build Coastguard Worker 301*9880d681SAndroid Build Coastguard Worker:: 302*9880d681SAndroid Build Coastguard Worker 303*9880d681SAndroid Build Coastguard Worker CALLSEQ_START 304*9880d681SAndroid Build Coastguard Worker ... 305*9880d681SAndroid Build Coastguard Worker GC_TRANSITION_START (lowered i32 *@Flag), SRCVALUE i32* Flag 306*9880d681SAndroid Build Coastguard Worker STATEPOINT 307*9880d681SAndroid Build Coastguard Worker GC_TRANSITION_END (lowered i32 *@Flag), SRCVALUE i32 *Flag 308*9880d681SAndroid Build Coastguard Worker ... 309*9880d681SAndroid Build Coastguard Worker CALLSEQ_END 310*9880d681SAndroid Build Coastguard Worker 311*9880d681SAndroid Build Coastguard WorkerIn order to generate the necessary transition code, the backend for each target 312*9880d681SAndroid Build Coastguard Workersupported by "hypothetical-gc" must be modified to lower ``GC_TRANSITION_START`` 313*9880d681SAndroid Build Coastguard Workerand ``GC_TRANSITION_END`` nodes appropriately when the "hypothetical-gc" 314*9880d681SAndroid Build Coastguard Workerstrategy is in use for a particular function. Assuming that such lowering has 315*9880d681SAndroid Build Coastguard Workerbeen added for X86, the generated assembly would be: 316*9880d681SAndroid Build Coastguard Worker 317*9880d681SAndroid Build Coastguard Worker.. code-block:: gas 318*9880d681SAndroid Build Coastguard Worker 319*9880d681SAndroid Build Coastguard Worker .globl test1 320*9880d681SAndroid Build Coastguard Worker .align 16, 0x90 321*9880d681SAndroid Build Coastguard Worker pushq %rax 322*9880d681SAndroid Build Coastguard Worker movl $1, %fs:Flag@TPOFF 323*9880d681SAndroid Build Coastguard Worker callq foo 324*9880d681SAndroid Build Coastguard Worker movl $0, %fs:Flag@TPOFF 325*9880d681SAndroid Build Coastguard Worker .Ltmp1: 326*9880d681SAndroid Build Coastguard Worker movq (%rsp), %rax # This load is redundant (oops!) 327*9880d681SAndroid Build Coastguard Worker popq %rdx 328*9880d681SAndroid Build Coastguard Worker retq 329*9880d681SAndroid Build Coastguard Worker 330*9880d681SAndroid Build Coastguard WorkerNote that the design as presented above is not fully implemented: in particular, 331*9880d681SAndroid Build Coastguard Workerstrategy-specific lowering is not present, and all GC transitions are emitted as 332*9880d681SAndroid Build Coastguard Workeras single no-op before and after the call instruction. These no-ops are often 333*9880d681SAndroid Build Coastguard Workerremoved by the backend during dead machine instruction elimination. 334*9880d681SAndroid Build Coastguard Worker 335*9880d681SAndroid Build Coastguard Worker 336*9880d681SAndroid Build Coastguard WorkerIntrinsics 337*9880d681SAndroid Build Coastguard Worker=========== 338*9880d681SAndroid Build Coastguard Worker 339*9880d681SAndroid Build Coastguard Worker'llvm.experimental.gc.statepoint' Intrinsic 340*9880d681SAndroid Build Coastguard Worker^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 341*9880d681SAndroid Build Coastguard Worker 342*9880d681SAndroid Build Coastguard WorkerSyntax: 343*9880d681SAndroid Build Coastguard Worker""""""" 344*9880d681SAndroid Build Coastguard Worker 345*9880d681SAndroid Build Coastguard Worker:: 346*9880d681SAndroid Build Coastguard Worker 347*9880d681SAndroid Build Coastguard Worker declare token 348*9880d681SAndroid Build Coastguard Worker @llvm.experimental.gc.statepoint(i64 <id>, i32 <num patch bytes>, 349*9880d681SAndroid Build Coastguard Worker func_type <target>, 350*9880d681SAndroid Build Coastguard Worker i64 <#call args>, i64 <flags>, 351*9880d681SAndroid Build Coastguard Worker ... (call parameters), 352*9880d681SAndroid Build Coastguard Worker i64 <# transition args>, ... (transition parameters), 353*9880d681SAndroid Build Coastguard Worker i64 <# deopt args>, ... (deopt parameters), 354*9880d681SAndroid Build Coastguard Worker ... (gc parameters)) 355*9880d681SAndroid Build Coastguard Worker 356*9880d681SAndroid Build Coastguard WorkerOverview: 357*9880d681SAndroid Build Coastguard Worker""""""""" 358*9880d681SAndroid Build Coastguard Worker 359*9880d681SAndroid Build Coastguard WorkerThe statepoint intrinsic represents a call which is parse-able by the 360*9880d681SAndroid Build Coastguard Workerruntime. 361*9880d681SAndroid Build Coastguard Worker 362*9880d681SAndroid Build Coastguard WorkerOperands: 363*9880d681SAndroid Build Coastguard Worker""""""""" 364*9880d681SAndroid Build Coastguard Worker 365*9880d681SAndroid Build Coastguard WorkerThe 'id' operand is a constant integer that is reported as the ID 366*9880d681SAndroid Build Coastguard Workerfield in the generated stackmap. LLVM does not interpret this 367*9880d681SAndroid Build Coastguard Workerparameter in any way and its meaning is up to the statepoint user to 368*9880d681SAndroid Build Coastguard Workerdecide. Note that LLVM is free to duplicate code containing 369*9880d681SAndroid Build Coastguard Workerstatepoint calls, and this may transform IR that had a unique 'id' per 370*9880d681SAndroid Build Coastguard Workerlexical call to statepoint to IR that does not. 371*9880d681SAndroid Build Coastguard Worker 372*9880d681SAndroid Build Coastguard WorkerIf 'num patch bytes' is non-zero then the call instruction 373*9880d681SAndroid Build Coastguard Workercorresponding to the statepoint is not emitted and LLVM emits 'num 374*9880d681SAndroid Build Coastguard Workerpatch bytes' bytes of nops in its place. LLVM will emit code to 375*9880d681SAndroid Build Coastguard Workerprepare the function arguments and retrieve the function return value 376*9880d681SAndroid Build Coastguard Workerin accordance to the calling convention; the former before the nop 377*9880d681SAndroid Build Coastguard Workersequence and the latter after the nop sequence. It is expected that 378*9880d681SAndroid Build Coastguard Workerthe user will patch over the 'num patch bytes' bytes of nops with a 379*9880d681SAndroid Build Coastguard Workercalling sequence specific to their runtime before executing the 380*9880d681SAndroid Build Coastguard Workergenerated machine code. There are no guarantees with respect to the 381*9880d681SAndroid Build Coastguard Workeralignment of the nop sequence. Unlike :doc:`StackMaps` statepoints do 382*9880d681SAndroid Build Coastguard Workernot have a concept of shadow bytes. Note that semantically the 383*9880d681SAndroid Build Coastguard Workerstatepoint still represents a call or invoke to 'target', and the nop 384*9880d681SAndroid Build Coastguard Workersequence after patching is expected to represent an operation 385*9880d681SAndroid Build Coastguard Workerequivalent to a call or invoke to 'target'. 386*9880d681SAndroid Build Coastguard Worker 387*9880d681SAndroid Build Coastguard WorkerThe 'target' operand is the function actually being called. The 388*9880d681SAndroid Build Coastguard Workertarget can be specified as either a symbolic LLVM function, or as an 389*9880d681SAndroid Build Coastguard Workerarbitrary Value of appropriate function type. Note that the function 390*9880d681SAndroid Build Coastguard Workertype must match the signature of the callee and the types of the 'call 391*9880d681SAndroid Build Coastguard Workerparameters' arguments. 392*9880d681SAndroid Build Coastguard Worker 393*9880d681SAndroid Build Coastguard WorkerThe '#call args' operand is the number of arguments to the actual 394*9880d681SAndroid Build Coastguard Workercall. It must exactly match the number of arguments passed in the 395*9880d681SAndroid Build Coastguard Worker'call parameters' variable length section. 396*9880d681SAndroid Build Coastguard Worker 397*9880d681SAndroid Build Coastguard WorkerThe 'flags' operand is used to specify extra information about the 398*9880d681SAndroid Build Coastguard Workerstatepoint. This is currently only used to mark certain statepoints 399*9880d681SAndroid Build Coastguard Workeras GC transitions. This operand is a 64-bit integer with the following 400*9880d681SAndroid Build Coastguard Workerlayout, where bit 0 is the least significant bit: 401*9880d681SAndroid Build Coastguard Worker 402*9880d681SAndroid Build Coastguard Worker +-------+---------------------------------------------------+ 403*9880d681SAndroid Build Coastguard Worker | Bit # | Usage | 404*9880d681SAndroid Build Coastguard Worker +=======+===================================================+ 405*9880d681SAndroid Build Coastguard Worker | 0 | Set if the statepoint is a GC transition, cleared | 406*9880d681SAndroid Build Coastguard Worker | | otherwise. | 407*9880d681SAndroid Build Coastguard Worker +-------+---------------------------------------------------+ 408*9880d681SAndroid Build Coastguard Worker | 1-63 | Reserved for future use; must be cleared. | 409*9880d681SAndroid Build Coastguard Worker +-------+---------------------------------------------------+ 410*9880d681SAndroid Build Coastguard Worker 411*9880d681SAndroid Build Coastguard WorkerThe 'call parameters' arguments are simply the arguments which need to 412*9880d681SAndroid Build Coastguard Workerbe passed to the call target. They will be lowered according to the 413*9880d681SAndroid Build Coastguard Workerspecified calling convention and otherwise handled like a normal call 414*9880d681SAndroid Build Coastguard Workerinstruction. The number of arguments must exactly match what is 415*9880d681SAndroid Build Coastguard Workerspecified in '# call args'. The types must match the signature of 416*9880d681SAndroid Build Coastguard Worker'target'. 417*9880d681SAndroid Build Coastguard Worker 418*9880d681SAndroid Build Coastguard WorkerThe 'transition parameters' arguments contain an arbitrary list of 419*9880d681SAndroid Build Coastguard WorkerValues which need to be passed to GC transition code. They will be 420*9880d681SAndroid Build Coastguard Workerlowered and passed as operands to the appropriate GC_TRANSITION nodes 421*9880d681SAndroid Build Coastguard Workerin the selection DAG. It is assumed that these arguments must be 422*9880d681SAndroid Build Coastguard Workeravailable before and after (but not necessarily during) the execution 423*9880d681SAndroid Build Coastguard Workerof the callee. The '# transition args' field indicates how many operands 424*9880d681SAndroid Build Coastguard Workerare to be interpreted as 'transition parameters'. 425*9880d681SAndroid Build Coastguard Worker 426*9880d681SAndroid Build Coastguard WorkerThe 'deopt parameters' arguments contain an arbitrary list of Values 427*9880d681SAndroid Build Coastguard Workerwhich is meaningful to the runtime. The runtime may read any of these 428*9880d681SAndroid Build Coastguard Workervalues, but is assumed not to modify them. If the garbage collector 429*9880d681SAndroid Build Coastguard Workermight need to modify one of these values, it must also be listed in 430*9880d681SAndroid Build Coastguard Workerthe 'gc pointer' argument list. The '# deopt args' field indicates 431*9880d681SAndroid Build Coastguard Workerhow many operands are to be interpreted as 'deopt parameters'. 432*9880d681SAndroid Build Coastguard Worker 433*9880d681SAndroid Build Coastguard WorkerThe 'gc parameters' arguments contain every pointer to a garbage 434*9880d681SAndroid Build Coastguard Workercollector object which potentially needs to be updated by the garbage 435*9880d681SAndroid Build Coastguard Workercollector. Note that the argument list must explicitly contain a base 436*9880d681SAndroid Build Coastguard Workerpointer for every derived pointer listed. The order of arguments is 437*9880d681SAndroid Build Coastguard Workerunimportant. Unlike the other variable length parameter sets, this 438*9880d681SAndroid Build Coastguard Workerlist is not length prefixed. 439*9880d681SAndroid Build Coastguard Worker 440*9880d681SAndroid Build Coastguard WorkerSemantics: 441*9880d681SAndroid Build Coastguard Worker"""""""""" 442*9880d681SAndroid Build Coastguard Worker 443*9880d681SAndroid Build Coastguard WorkerA statepoint is assumed to read and write all memory. As a result, 444*9880d681SAndroid Build Coastguard Workermemory operations can not be reordered past a statepoint. It is 445*9880d681SAndroid Build Coastguard Workerillegal to mark a statepoint as being either 'readonly' or 'readnone'. 446*9880d681SAndroid Build Coastguard Worker 447*9880d681SAndroid Build Coastguard WorkerNote that legal IR can not perform any memory operation on a 'gc 448*9880d681SAndroid Build Coastguard Workerpointer' argument of the statepoint in a location statically reachable 449*9880d681SAndroid Build Coastguard Workerfrom the statepoint. Instead, the explicitly relocated value (from a 450*9880d681SAndroid Build Coastguard Worker``gc.relocate``) must be used. 451*9880d681SAndroid Build Coastguard Worker 452*9880d681SAndroid Build Coastguard Worker'llvm.experimental.gc.result' Intrinsic 453*9880d681SAndroid Build Coastguard Worker^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 454*9880d681SAndroid Build Coastguard Worker 455*9880d681SAndroid Build Coastguard WorkerSyntax: 456*9880d681SAndroid Build Coastguard Worker""""""" 457*9880d681SAndroid Build Coastguard Worker 458*9880d681SAndroid Build Coastguard Worker:: 459*9880d681SAndroid Build Coastguard Worker 460*9880d681SAndroid Build Coastguard Worker declare type* 461*9880d681SAndroid Build Coastguard Worker @llvm.experimental.gc.result(token %statepoint_token) 462*9880d681SAndroid Build Coastguard Worker 463*9880d681SAndroid Build Coastguard WorkerOverview: 464*9880d681SAndroid Build Coastguard Worker""""""""" 465*9880d681SAndroid Build Coastguard Worker 466*9880d681SAndroid Build Coastguard Worker``gc.result`` extracts the result of the original call instruction 467*9880d681SAndroid Build Coastguard Workerwhich was replaced by the ``gc.statepoint``. The ``gc.result`` 468*9880d681SAndroid Build Coastguard Workerintrinsic is actually a family of three intrinsics due to an 469*9880d681SAndroid Build Coastguard Workerimplementation limitation. Other than the type of the return value, 470*9880d681SAndroid Build Coastguard Workerthe semantics are the same. 471*9880d681SAndroid Build Coastguard Worker 472*9880d681SAndroid Build Coastguard WorkerOperands: 473*9880d681SAndroid Build Coastguard Worker""""""""" 474*9880d681SAndroid Build Coastguard Worker 475*9880d681SAndroid Build Coastguard WorkerThe first and only argument is the ``gc.statepoint`` which starts 476*9880d681SAndroid Build Coastguard Workerthe safepoint sequence of which this ``gc.result`` is a part. 477*9880d681SAndroid Build Coastguard WorkerDespite the typing of this as a generic token, *only* the value defined 478*9880d681SAndroid Build Coastguard Workerby a ``gc.statepoint`` is legal here. 479*9880d681SAndroid Build Coastguard Worker 480*9880d681SAndroid Build Coastguard WorkerSemantics: 481*9880d681SAndroid Build Coastguard Worker"""""""""" 482*9880d681SAndroid Build Coastguard Worker 483*9880d681SAndroid Build Coastguard WorkerThe ``gc.result`` represents the return value of the call target of 484*9880d681SAndroid Build Coastguard Workerthe ``statepoint``. The type of the ``gc.result`` must exactly match 485*9880d681SAndroid Build Coastguard Workerthe type of the target. If the call target returns void, there will 486*9880d681SAndroid Build Coastguard Workerbe no ``gc.result``. 487*9880d681SAndroid Build Coastguard Worker 488*9880d681SAndroid Build Coastguard WorkerA ``gc.result`` is modeled as a 'readnone' pure function. It has no 489*9880d681SAndroid Build Coastguard Workerside effects since it is just a projection of the return value of the 490*9880d681SAndroid Build Coastguard Workerprevious call represented by the ``gc.statepoint``. 491*9880d681SAndroid Build Coastguard Worker 492*9880d681SAndroid Build Coastguard Worker'llvm.experimental.gc.relocate' Intrinsic 493*9880d681SAndroid Build Coastguard Worker^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 494*9880d681SAndroid Build Coastguard Worker 495*9880d681SAndroid Build Coastguard WorkerSyntax: 496*9880d681SAndroid Build Coastguard Worker""""""" 497*9880d681SAndroid Build Coastguard Worker 498*9880d681SAndroid Build Coastguard Worker:: 499*9880d681SAndroid Build Coastguard Worker 500*9880d681SAndroid Build Coastguard Worker declare <pointer type> 501*9880d681SAndroid Build Coastguard Worker @llvm.experimental.gc.relocate(token %statepoint_token, 502*9880d681SAndroid Build Coastguard Worker i32 %base_offset, 503*9880d681SAndroid Build Coastguard Worker i32 %pointer_offset) 504*9880d681SAndroid Build Coastguard Worker 505*9880d681SAndroid Build Coastguard WorkerOverview: 506*9880d681SAndroid Build Coastguard Worker""""""""" 507*9880d681SAndroid Build Coastguard Worker 508*9880d681SAndroid Build Coastguard WorkerA ``gc.relocate`` returns the potentially relocated value of a pointer 509*9880d681SAndroid Build Coastguard Workerat the safepoint. 510*9880d681SAndroid Build Coastguard Worker 511*9880d681SAndroid Build Coastguard WorkerOperands: 512*9880d681SAndroid Build Coastguard Worker""""""""" 513*9880d681SAndroid Build Coastguard Worker 514*9880d681SAndroid Build Coastguard WorkerThe first argument is the ``gc.statepoint`` which starts the 515*9880d681SAndroid Build Coastguard Workersafepoint sequence of which this ``gc.relocation`` is a part. 516*9880d681SAndroid Build Coastguard WorkerDespite the typing of this as a generic token, *only* the value defined 517*9880d681SAndroid Build Coastguard Workerby a ``gc.statepoint`` is legal here. 518*9880d681SAndroid Build Coastguard Worker 519*9880d681SAndroid Build Coastguard WorkerThe second argument is an index into the statepoints list of arguments 520*9880d681SAndroid Build Coastguard Workerwhich specifies the allocation for the pointer being relocated. 521*9880d681SAndroid Build Coastguard WorkerThis index must land within the 'gc parameter' section of the 522*9880d681SAndroid Build Coastguard Workerstatepoint's argument list. The associated value must be within the 523*9880d681SAndroid Build Coastguard Workerobject with which the pointer being relocated is associated. The optimizer 524*9880d681SAndroid Build Coastguard Workeris free to change *which* interior derived pointer is reported, provided that 525*9880d681SAndroid Build Coastguard Workerit does not replace an actual base pointer with another interior derived 526*9880d681SAndroid Build Coastguard Workerpointer. Collectors are allowed to rely on the base pointer operand 527*9880d681SAndroid Build Coastguard Workerremaining an actual base pointer if so constructed. 528*9880d681SAndroid Build Coastguard Worker 529*9880d681SAndroid Build Coastguard WorkerThe third argument is an index into the statepoint's list of arguments 530*9880d681SAndroid Build Coastguard Workerwhich specify the (potentially) derived pointer being relocated. It 531*9880d681SAndroid Build Coastguard Workeris legal for this index to be the same as the second argument 532*9880d681SAndroid Build Coastguard Workerif-and-only-if a base pointer is being relocated. This index must land 533*9880d681SAndroid Build Coastguard Workerwithin the 'gc parameter' section of the statepoint's argument list. 534*9880d681SAndroid Build Coastguard Worker 535*9880d681SAndroid Build Coastguard WorkerSemantics: 536*9880d681SAndroid Build Coastguard Worker"""""""""" 537*9880d681SAndroid Build Coastguard Worker 538*9880d681SAndroid Build Coastguard WorkerThe return value of ``gc.relocate`` is the potentially relocated value 539*9880d681SAndroid Build Coastguard Workerof the pointer specified by it's arguments. It is unspecified how the 540*9880d681SAndroid Build Coastguard Workervalue of the returned pointer relates to the argument to the 541*9880d681SAndroid Build Coastguard Worker``gc.statepoint`` other than that a) it points to the same source 542*9880d681SAndroid Build Coastguard Workerlanguage object with the same offset, and b) the 'based-on' 543*9880d681SAndroid Build Coastguard Workerrelationship of the newly relocated pointers is a projection of the 544*9880d681SAndroid Build Coastguard Workerunrelocated pointers. In particular, the integer value of the pointer 545*9880d681SAndroid Build Coastguard Workerreturned is unspecified. 546*9880d681SAndroid Build Coastguard Worker 547*9880d681SAndroid Build Coastguard WorkerA ``gc.relocate`` is modeled as a ``readnone`` pure function. It has no 548*9880d681SAndroid Build Coastguard Workerside effects since it is just a way to extract information about work 549*9880d681SAndroid Build Coastguard Workerdone during the actual call modeled by the ``gc.statepoint``. 550*9880d681SAndroid Build Coastguard Worker 551*9880d681SAndroid Build Coastguard Worker.. _statepoint-stackmap-format: 552*9880d681SAndroid Build Coastguard Worker 553*9880d681SAndroid Build Coastguard WorkerStack Map Format 554*9880d681SAndroid Build Coastguard Worker================ 555*9880d681SAndroid Build Coastguard Worker 556*9880d681SAndroid Build Coastguard WorkerLocations for each pointer value which may need read and/or updated by 557*9880d681SAndroid Build Coastguard Workerthe runtime or collector are provided via the :ref:`Stack Map format 558*9880d681SAndroid Build Coastguard Worker<stackmap-format>` specified in the PatchPoint documentation. 559*9880d681SAndroid Build Coastguard Worker 560*9880d681SAndroid Build Coastguard WorkerEach statepoint generates the following Locations: 561*9880d681SAndroid Build Coastguard Worker 562*9880d681SAndroid Build Coastguard Worker* Constant which describes the calling convention of the call target. This 563*9880d681SAndroid Build Coastguard Worker constant is a valid :ref:`calling convention identifier <callingconv>` for 564*9880d681SAndroid Build Coastguard Worker the version of LLVM used to generate the stackmap. No additional compatibility 565*9880d681SAndroid Build Coastguard Worker guarantees are made for this constant over what LLVM provides elsewhere w.r.t. 566*9880d681SAndroid Build Coastguard Worker these identifiers. 567*9880d681SAndroid Build Coastguard Worker* Constant which describes the flags passed to the statepoint intrinsic 568*9880d681SAndroid Build Coastguard Worker* Constant which describes number of following deopt *Locations* (not 569*9880d681SAndroid Build Coastguard Worker operands) 570*9880d681SAndroid Build Coastguard Worker* Variable number of Locations, one for each deopt parameter listed in 571*9880d681SAndroid Build Coastguard Worker the IR statepoint (same number as described by previous Constant). At 572*9880d681SAndroid Build Coastguard Worker the moment, only deopt parameters with a bitwidth of 64 bits or less 573*9880d681SAndroid Build Coastguard Worker are supported. Values of a type larger than 64 bits can be specified 574*9880d681SAndroid Build Coastguard Worker and reported only if a) the value is constant at the call site, and b) 575*9880d681SAndroid Build Coastguard Worker the constant can be represented with less than 64 bits (assuming zero 576*9880d681SAndroid Build Coastguard Worker extension to the original bitwidth). 577*9880d681SAndroid Build Coastguard Worker* Variable number of relocation records, each of which consists of 578*9880d681SAndroid Build Coastguard Worker exactly two Locations. Relocation records are described in detail 579*9880d681SAndroid Build Coastguard Worker below. 580*9880d681SAndroid Build Coastguard Worker 581*9880d681SAndroid Build Coastguard WorkerEach relocation record provides sufficient information for a collector to 582*9880d681SAndroid Build Coastguard Workerrelocate one or more derived pointers. Each record consists of a pair of 583*9880d681SAndroid Build Coastguard WorkerLocations. The second element in the record represents the pointer (or 584*9880d681SAndroid Build Coastguard Workerpointers) which need updated. The first element in the record provides a 585*9880d681SAndroid Build Coastguard Workerpointer to the base of the object with which the pointer(s) being relocated is 586*9880d681SAndroid Build Coastguard Workerassociated. This information is required for handling generalized derived 587*9880d681SAndroid Build Coastguard Workerpointers since a pointer may be outside the bounds of the original allocation, 588*9880d681SAndroid Build Coastguard Workerbut still needs to be relocated with the allocation. Additionally: 589*9880d681SAndroid Build Coastguard Worker 590*9880d681SAndroid Build Coastguard Worker* It is guaranteed that the base pointer must also appear explicitly as a 591*9880d681SAndroid Build Coastguard Worker relocation pair if used after the statepoint. 592*9880d681SAndroid Build Coastguard Worker* There may be fewer relocation records then gc parameters in the IR 593*9880d681SAndroid Build Coastguard Worker statepoint. Each *unique* pair will occur at least once; duplicates 594*9880d681SAndroid Build Coastguard Worker are possible. 595*9880d681SAndroid Build Coastguard Worker* The Locations within each record may either be of pointer size or a 596*9880d681SAndroid Build Coastguard Worker multiple of pointer size. In the later case, the record must be 597*9880d681SAndroid Build Coastguard Worker interpreted as describing a sequence of pointers and their corresponding 598*9880d681SAndroid Build Coastguard Worker base pointers. If the Location is of size N x sizeof(pointer), then 599*9880d681SAndroid Build Coastguard Worker there will be N records of one pointer each contained within the Location. 600*9880d681SAndroid Build Coastguard Worker Both Locations in a pair can be assumed to be of the same size. 601*9880d681SAndroid Build Coastguard Worker 602*9880d681SAndroid Build Coastguard WorkerNote that the Locations used in each section may describe the same 603*9880d681SAndroid Build Coastguard Workerphysical location. e.g. A stack slot may appear as a deopt location, 604*9880d681SAndroid Build Coastguard Workera gc base pointer, and a gc derived pointer. 605*9880d681SAndroid Build Coastguard Worker 606*9880d681SAndroid Build Coastguard WorkerThe LiveOut section of the StkMapRecord will be empty for a statepoint 607*9880d681SAndroid Build Coastguard Workerrecord. 608*9880d681SAndroid Build Coastguard Worker 609*9880d681SAndroid Build Coastguard WorkerSafepoint Semantics & Verification 610*9880d681SAndroid Build Coastguard Worker================================== 611*9880d681SAndroid Build Coastguard Worker 612*9880d681SAndroid Build Coastguard WorkerThe fundamental correctness property for the compiled code's 613*9880d681SAndroid Build Coastguard Workercorrectness w.r.t. the garbage collector is a dynamic one. It must be 614*9880d681SAndroid Build Coastguard Workerthe case that there is no dynamic trace such that a operation 615*9880d681SAndroid Build Coastguard Workerinvolving a potentially relocated pointer is observably-after a 616*9880d681SAndroid Build Coastguard Workersafepoint which could relocate it. 'observably-after' is this usage 617*9880d681SAndroid Build Coastguard Workermeans that an outside observer could observe this sequence of events 618*9880d681SAndroid Build Coastguard Workerin a way which precludes the operation being performed before the 619*9880d681SAndroid Build Coastguard Workersafepoint. 620*9880d681SAndroid Build Coastguard Worker 621*9880d681SAndroid Build Coastguard WorkerTo understand why this 'observable-after' property is required, 622*9880d681SAndroid Build Coastguard Workerconsider a null comparison performed on the original copy of a 623*9880d681SAndroid Build Coastguard Workerrelocated pointer. Assuming that control flow follows the safepoint, 624*9880d681SAndroid Build Coastguard Workerthere is no way to observe externally whether the null comparison is 625*9880d681SAndroid Build Coastguard Workerperformed before or after the safepoint. (Remember, the original 626*9880d681SAndroid Build Coastguard WorkerValue is unmodified by the safepoint.) The compiler is free to make 627*9880d681SAndroid Build Coastguard Workereither scheduling choice. 628*9880d681SAndroid Build Coastguard Worker 629*9880d681SAndroid Build Coastguard WorkerThe actual correctness property implemented is slightly stronger than 630*9880d681SAndroid Build Coastguard Workerthis. We require that there be no *static path* on which a 631*9880d681SAndroid Build Coastguard Workerpotentially relocated pointer is 'observably-after' it may have been 632*9880d681SAndroid Build Coastguard Workerrelocated. This is slightly stronger than is strictly necessary (and 633*9880d681SAndroid Build Coastguard Workerthus may disallow some otherwise valid programs), but greatly 634*9880d681SAndroid Build Coastguard Workersimplifies reasoning about correctness of the compiled code. 635*9880d681SAndroid Build Coastguard Worker 636*9880d681SAndroid Build Coastguard WorkerBy construction, this property will be upheld by the optimizer if 637*9880d681SAndroid Build Coastguard Workercorrectly established in the source IR. This is a key invariant of 638*9880d681SAndroid Build Coastguard Workerthe design. 639*9880d681SAndroid Build Coastguard Worker 640*9880d681SAndroid Build Coastguard WorkerThe existing IR Verifier pass has been extended to check most of the 641*9880d681SAndroid Build Coastguard Workerlocal restrictions on the intrinsics mentioned in their respective 642*9880d681SAndroid Build Coastguard Workerdocumentation. The current implementation in LLVM does not check the 643*9880d681SAndroid Build Coastguard Workerkey relocation invariant, but this is ongoing work on developing such 644*9880d681SAndroid Build Coastguard Workera verifier. Please ask on llvm-dev if you're interested in 645*9880d681SAndroid Build Coastguard Workerexperimenting with the current version. 646*9880d681SAndroid Build Coastguard Worker 647*9880d681SAndroid Build Coastguard Worker.. _statepoint-utilities: 648*9880d681SAndroid Build Coastguard Worker 649*9880d681SAndroid Build Coastguard WorkerUtility Passes for Safepoint Insertion 650*9880d681SAndroid Build Coastguard Worker====================================== 651*9880d681SAndroid Build Coastguard Worker 652*9880d681SAndroid Build Coastguard Worker.. _RewriteStatepointsForGC: 653*9880d681SAndroid Build Coastguard Worker 654*9880d681SAndroid Build Coastguard WorkerRewriteStatepointsForGC 655*9880d681SAndroid Build Coastguard Worker^^^^^^^^^^^^^^^^^^^^^^^^ 656*9880d681SAndroid Build Coastguard Worker 657*9880d681SAndroid Build Coastguard WorkerThe pass RewriteStatepointsForGC transforms a functions IR by replacing a 658*9880d681SAndroid Build Coastguard Worker``gc.statepoint`` (with an optional ``gc.result``) with a full relocation 659*9880d681SAndroid Build Coastguard Workersequence, including all required ``gc.relocates``. To function, the pass 660*9880d681SAndroid Build Coastguard Workerrequires that the GC strategy specified for the function be able to reliably 661*9880d681SAndroid Build Coastguard Workerdistinguish between GC references and non-GC references in IR it is given. 662*9880d681SAndroid Build Coastguard Worker 663*9880d681SAndroid Build Coastguard WorkerAs an example, given this code: 664*9880d681SAndroid Build Coastguard Worker 665*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm 666*9880d681SAndroid Build Coastguard Worker 667*9880d681SAndroid Build Coastguard Worker define i8 addrspace(1)* @test1(i8 addrspace(1)* %obj) 668*9880d681SAndroid Build Coastguard Worker gc "statepoint-example" { 669*9880d681SAndroid Build Coastguard Worker call token (i64, i32, void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0) 670*9880d681SAndroid Build Coastguard Worker ret i8 addrspace(1)* %obj 671*9880d681SAndroid Build Coastguard Worker } 672*9880d681SAndroid Build Coastguard Worker 673*9880d681SAndroid Build Coastguard WorkerThe pass would produce this IR: 674*9880d681SAndroid Build Coastguard Worker 675*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm 676*9880d681SAndroid Build Coastguard Worker 677*9880d681SAndroid Build Coastguard Worker define i8 addrspace(1)* @test1(i8 addrspace(1)* %obj) 678*9880d681SAndroid Build Coastguard Worker gc "statepoint-example" { 679*9880d681SAndroid Build Coastguard Worker %0 = call token (i64, i32, void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0, i8 addrspace(1)* %obj) 680*9880d681SAndroid Build Coastguard Worker %obj.relocated = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %0, i32 12, i32 12) 681*9880d681SAndroid Build Coastguard Worker ret i8 addrspace(1)* %obj.relocated 682*9880d681SAndroid Build Coastguard Worker } 683*9880d681SAndroid Build Coastguard Worker 684*9880d681SAndroid Build Coastguard WorkerIn the above examples, the addrspace(1) marker on the pointers is the mechanism 685*9880d681SAndroid Build Coastguard Workerthat the ``statepoint-example`` GC strategy uses to distinguish references from 686*9880d681SAndroid Build Coastguard Workernon references. Address space 1 is not globally reserved for this purpose. 687*9880d681SAndroid Build Coastguard Worker 688*9880d681SAndroid Build Coastguard WorkerThis pass can be used an utility function by a language frontend that doesn't 689*9880d681SAndroid Build Coastguard Workerwant to manually reason about liveness, base pointers, or relocation when 690*9880d681SAndroid Build Coastguard Workerconstructing IR. As currently implemented, RewriteStatepointsForGC must be 691*9880d681SAndroid Build Coastguard Workerrun after SSA construction (i.e. mem2ref). 692*9880d681SAndroid Build Coastguard Worker 693*9880d681SAndroid Build Coastguard WorkerRewriteStatepointsForGC will ensure that appropriate base pointers are listed 694*9880d681SAndroid Build Coastguard Workerfor every relocation created. It will do so by duplicating code as needed to 695*9880d681SAndroid Build Coastguard Workerpropagate the base pointer associated with each pointer being relocated to 696*9880d681SAndroid Build Coastguard Workerthe appropriate safepoints. The implementation assumes that the following 697*9880d681SAndroid Build Coastguard WorkerIR constructs produce base pointers: loads from the heap, addresses of global 698*9880d681SAndroid Build Coastguard Workervariables, function arguments, function return values. Constant pointers (such 699*9880d681SAndroid Build Coastguard Workeras null) are also assumed to be base pointers. In practice, this constraint 700*9880d681SAndroid Build Coastguard Workercan be relaxed to producing interior derived pointers provided the target 701*9880d681SAndroid Build Coastguard Workercollector can find the associated allocation from an arbitrary interior 702*9880d681SAndroid Build Coastguard Workerderived pointer. 703*9880d681SAndroid Build Coastguard Worker 704*9880d681SAndroid Build Coastguard WorkerIn practice, RewriteStatepointsForGC can be run much later in the pass 705*9880d681SAndroid Build Coastguard Workerpipeline, after most optimization is already done. This helps to improve 706*9880d681SAndroid Build Coastguard Workerthe quality of the generated code when compiled with garbage collection support. 707*9880d681SAndroid Build Coastguard WorkerIn the long run, this is the intended usage model. At this time, a few details 708*9880d681SAndroid Build Coastguard Workerhave yet to be worked out about the semantic model required to guarantee this 709*9880d681SAndroid Build Coastguard Workeris always correct. As such, please use with caution and report bugs. 710*9880d681SAndroid Build Coastguard Worker 711*9880d681SAndroid Build Coastguard Worker.. _PlaceSafepoints: 712*9880d681SAndroid Build Coastguard Worker 713*9880d681SAndroid Build Coastguard WorkerPlaceSafepoints 714*9880d681SAndroid Build Coastguard Worker^^^^^^^^^^^^^^^^ 715*9880d681SAndroid Build Coastguard Worker 716*9880d681SAndroid Build Coastguard WorkerThe pass PlaceSafepoints transforms a function's IR by replacing any call or 717*9880d681SAndroid Build Coastguard Workerinvoke instructions with appropriate ``gc.statepoint`` and ``gc.result`` pairs, 718*9880d681SAndroid Build Coastguard Workerand inserting safepoint polls sufficient to ensure running code checks for a 719*9880d681SAndroid Build Coastguard Workersafepoint request on a timely manner. This pass is expected to be run before 720*9880d681SAndroid Build Coastguard WorkerRewriteStatepointsForGC and thus does not produce full relocation sequences. 721*9880d681SAndroid Build Coastguard Worker 722*9880d681SAndroid Build Coastguard WorkerAs an example, given input IR of the following: 723*9880d681SAndroid Build Coastguard Worker 724*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm 725*9880d681SAndroid Build Coastguard Worker 726*9880d681SAndroid Build Coastguard Worker define void @test() gc "statepoint-example" { 727*9880d681SAndroid Build Coastguard Worker call void @foo() 728*9880d681SAndroid Build Coastguard Worker ret void 729*9880d681SAndroid Build Coastguard Worker } 730*9880d681SAndroid Build Coastguard Worker 731*9880d681SAndroid Build Coastguard Worker declare void @do_safepoint() 732*9880d681SAndroid Build Coastguard Worker define void @gc.safepoint_poll() { 733*9880d681SAndroid Build Coastguard Worker call void @do_safepoint() 734*9880d681SAndroid Build Coastguard Worker ret void 735*9880d681SAndroid Build Coastguard Worker } 736*9880d681SAndroid Build Coastguard Worker 737*9880d681SAndroid Build Coastguard Worker 738*9880d681SAndroid Build Coastguard WorkerThis pass would produce the following IR: 739*9880d681SAndroid Build Coastguard Worker 740*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm 741*9880d681SAndroid Build Coastguard Worker 742*9880d681SAndroid Build Coastguard Worker define void @test() gc "statepoint-example" { 743*9880d681SAndroid Build Coastguard Worker %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) 744*9880d681SAndroid Build Coastguard Worker %safepoint_token1 = call token (i64, i32, void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 0) 745*9880d681SAndroid Build Coastguard Worker ret void 746*9880d681SAndroid Build Coastguard Worker } 747*9880d681SAndroid Build Coastguard Worker 748*9880d681SAndroid Build Coastguard WorkerIn this case, we've added an (unconditional) entry safepoint poll and converted the call into a ``gc.statepoint``. Note that despite appearances, the entry poll is not necessarily redundant. We'd have to know that ``foo`` and ``test`` were not mutually recursive for the poll to be redundant. In practice, you'd probably want to your poll definition to contain a conditional branch of some form. 749*9880d681SAndroid Build Coastguard Worker 750*9880d681SAndroid Build Coastguard Worker 751*9880d681SAndroid Build Coastguard WorkerAt the moment, PlaceSafepoints can insert safepoint polls at method entry and 752*9880d681SAndroid Build Coastguard Workerloop backedges locations. Extending this to work with return polls would be 753*9880d681SAndroid Build Coastguard Workerstraight forward if desired. 754*9880d681SAndroid Build Coastguard Worker 755*9880d681SAndroid Build Coastguard WorkerPlaceSafepoints includes a number of optimizations to avoid placing safepoint 756*9880d681SAndroid Build Coastguard Workerpolls at particular sites unless needed to ensure timely execution of a poll 757*9880d681SAndroid Build Coastguard Workerunder normal conditions. PlaceSafepoints does not attempt to ensure timely 758*9880d681SAndroid Build Coastguard Workerexecution of a poll under worst case conditions such as heavy system paging. 759*9880d681SAndroid Build Coastguard Worker 760*9880d681SAndroid Build Coastguard WorkerThe implementation of a safepoint poll action is specified by looking up a 761*9880d681SAndroid Build Coastguard Workerfunction of the name ``gc.safepoint_poll`` in the containing Module. The body 762*9880d681SAndroid Build Coastguard Workerof this function is inserted at each poll site desired. While calls or invokes 763*9880d681SAndroid Build Coastguard Workerinside this method are transformed to a ``gc.statepoints``, recursive poll 764*9880d681SAndroid Build Coastguard Workerinsertion is not performed. 765*9880d681SAndroid Build Coastguard Worker 766*9880d681SAndroid Build Coastguard WorkerBy default PlaceSafepoints passes in ``0xABCDEF00`` as the statepoint 767*9880d681SAndroid Build Coastguard WorkerID and ``0`` as the number of patchable bytes to the newly constructed 768*9880d681SAndroid Build Coastguard Worker``gc.statepoint``. These values can be configured on a per-callsite 769*9880d681SAndroid Build Coastguard Workerbasis using the attributes ``"statepoint-id"`` and 770*9880d681SAndroid Build Coastguard Worker``"statepoint-num-patch-bytes"``. If a call site is marked with a 771*9880d681SAndroid Build Coastguard Worker``"statepoint-id"`` function attribute and its value is a positive 772*9880d681SAndroid Build Coastguard Workerinteger (represented as a string), then that value is used as the ID 773*9880d681SAndroid Build Coastguard Workerof the newly constructed ``gc.statepoint``. If a call site is marked 774*9880d681SAndroid Build Coastguard Workerwith a ``"statepoint-num-patch-bytes"`` function attribute and its 775*9880d681SAndroid Build Coastguard Workervalue is a positive integer, then that value is used as the 'num patch 776*9880d681SAndroid Build Coastguard Workerbytes' parameter of the newly constructed ``gc.statepoint``. The 777*9880d681SAndroid Build Coastguard Worker``"statepoint-id"`` and ``"statepoint-num-patch-bytes"`` attributes 778*9880d681SAndroid Build Coastguard Workerare not propagated to the ``gc.statepoint`` call or invoke if they 779*9880d681SAndroid Build Coastguard Workercould be successfully parsed. 780*9880d681SAndroid Build Coastguard Worker 781*9880d681SAndroid Build Coastguard WorkerIf you are scheduling the RewriteStatepointsForGC pass late in the pass order, 782*9880d681SAndroid Build Coastguard Workeryou should probably schedule this pass immediately before it. The exception 783*9880d681SAndroid Build Coastguard Workerwould be if you need to preserve abstract frame information (e.g. for 784*9880d681SAndroid Build Coastguard Workerdeoptimization or introspection) at safepoints. In that case, ask on the 785*9880d681SAndroid Build Coastguard Workerllvm-dev mailing list for suggestions. 786*9880d681SAndroid Build Coastguard Worker 787*9880d681SAndroid Build Coastguard Worker 788*9880d681SAndroid Build Coastguard WorkerSupported Architectures 789*9880d681SAndroid Build Coastguard Worker======================= 790*9880d681SAndroid Build Coastguard Worker 791*9880d681SAndroid Build Coastguard WorkerSupport for statepoint generation requires some code for each backend. 792*9880d681SAndroid Build Coastguard WorkerToday, only X86_64 is supported. 793*9880d681SAndroid Build Coastguard Worker 794*9880d681SAndroid Build Coastguard WorkerProblem Areas and Active Work 795*9880d681SAndroid Build Coastguard Worker============================= 796*9880d681SAndroid Build Coastguard Worker 797*9880d681SAndroid Build Coastguard Worker#. As the existing users of the late rewriting model have matured, we've found 798*9880d681SAndroid Build Coastguard Worker cases where the optimizer breaks the assumption that an SSA value of 799*9880d681SAndroid Build Coastguard Worker gc-pointer type actually contains a gc-pointer and vice-versa. We need to 800*9880d681SAndroid Build Coastguard Worker clarify our expectations and propose at least one small IR change. (Today, 801*9880d681SAndroid Build Coastguard Worker the gc-pointer distinction is managed via address spaces. This turns out 802*9880d681SAndroid Build Coastguard Worker not to be quite strong enough.) 803*9880d681SAndroid Build Coastguard Worker 804*9880d681SAndroid Build Coastguard Worker#. Support for languages which allow unmanaged pointers to garbage collected 805*9880d681SAndroid Build Coastguard Worker objects (i.e. pass a pointer to an object to a C routine) via pinning. 806*9880d681SAndroid Build Coastguard Worker 807*9880d681SAndroid Build Coastguard Worker#. Support for garbage collected objects allocated on the stack. Specifically, 808*9880d681SAndroid Build Coastguard Worker allocas are always assumed to be in address space 0 and we need a 809*9880d681SAndroid Build Coastguard Worker cast/promotion operator to let rewriting identify them. 810*9880d681SAndroid Build Coastguard Worker 811*9880d681SAndroid Build Coastguard Worker#. The current statepoint lowering is known to be somewhat poor. In the very 812*9880d681SAndroid Build Coastguard Worker long term, we'd like to integrate statepoints with the register allocator; 813*9880d681SAndroid Build Coastguard Worker in the near term this is unlikely to happen. We've found the quality of 814*9880d681SAndroid Build Coastguard Worker lowering to be relatively unimportant as hot-statepoints are almost always 815*9880d681SAndroid Build Coastguard Worker inliner bugs. 816*9880d681SAndroid Build Coastguard Worker 817*9880d681SAndroid Build Coastguard Worker#. Concerns have been raised that the statepoint representation results in a 818*9880d681SAndroid Build Coastguard Worker large amount of IR being produced for some examples and that this 819*9880d681SAndroid Build Coastguard Worker contributes to higher than expected memory usage and compile times. There's 820*9880d681SAndroid Build Coastguard Worker no immediate plans to make changes due to this, but alternate models may be 821*9880d681SAndroid Build Coastguard Worker explored in the future. 822*9880d681SAndroid Build Coastguard Worker 823*9880d681SAndroid Build Coastguard Worker#. Relocations along exceptional paths are currently broken in ToT. In 824*9880d681SAndroid Build Coastguard Worker particular, there is current no way to represent a rethrow on a path which 825*9880d681SAndroid Build Coastguard Worker also has relocations. See `this llvm-dev discussion 826*9880d681SAndroid Build Coastguard Worker <https://groups.google.com/forum/#!topic/llvm-dev/AE417XjgxvI>`_ for more 827*9880d681SAndroid Build Coastguard Worker detail. 828*9880d681SAndroid Build Coastguard Worker 829*9880d681SAndroid Build Coastguard WorkerBugs and Enhancements 830*9880d681SAndroid Build Coastguard Worker===================== 831*9880d681SAndroid Build Coastguard Worker 832*9880d681SAndroid Build Coastguard WorkerCurrently known bugs and enhancements under consideration can be 833*9880d681SAndroid Build Coastguard Workertracked by performing a `bugzilla search 834*9880d681SAndroid Build Coastguard Worker<http://llvm.org/bugs/buglist.cgi?cmdtype=runnamed&namedcmd=Statepoint%20Bugs&list_id=64342>`_ 835*9880d681SAndroid Build Coastguard Workerfor [Statepoint] in the summary field. When filing new bugs, please 836*9880d681SAndroid Build Coastguard Workeruse this tag so that interested parties see the newly filed bug. As 837*9880d681SAndroid Build Coastguard Workerwith most LLVM features, design discussions take place on `llvm-dev 838*9880d681SAndroid Build Coastguard Worker<http://lists.llvm.org/mailman/listinfo/llvm-dev>`_, and patches 839*9880d681SAndroid Build Coastguard Workershould be sent to `llvm-commits 840*9880d681SAndroid Build Coastguard Worker<http://lists.llvm.org/mailman/listinfo/llvm-commits>`_ for review. 841*9880d681SAndroid Build Coastguard Worker 842